Skip to content

Commit

Permalink
feat(debug): add some extra debug at level 3
Browse files Browse the repository at this point in the history
  • Loading branch information
aauren committed Oct 7, 2023
1 parent 4c6e19f commit 9d63cc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controllers/proxy/service_endpoints_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package proxy

import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net"
Expand Down Expand Up @@ -637,6 +638,8 @@ func (nsc *NetworkServicesController) cleanupStaleIPVSConfig(activeServiceEndpoi
// cleanup stale ipvs service and servers
klog.V(1).Info("Cleaning up if any, old ipvs service and servers which are no longer needed")

prettyMap, _ := json.MarshalIndent(activeServiceEndpointMap, " ", " ")
klog.V(3).Infof("Current active service map:\n%s", prettyMap)
var protocol string
for _, ipvsSvc := range ipvsSvcs {
// Note that this isn't all that safe of an assumption because FWMark services have a completely different
Expand Down Expand Up @@ -664,6 +667,7 @@ func (nsc *NetworkServicesController) cleanupStaleIPVSConfig(activeServiceEndpoi
// Only delete the service if it's not there anymore to prevent flapping
// old: if !ok || len(endpointIDs) == 0 {
if !ok {
klog.V(3).Infof("didn't find key: %s in above map", key)
excluded := false
for _, excludedCidr := range nsc.excludedCidrs {
if excludedCidr.Contains(ipvsSvc.Address) {
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/ipset.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ func (ipset *IPSet) Save() error {
// Send formatted ipset.sets into stdin of "ipset restore" command.
func (ipset *IPSet) Restore() error {
restoreString := buildIPSetRestore(ipset)
klog.V(3).Infof("ipset restore looks like: %s", restoreString)
stdin := bytes.NewBufferString(restoreString)
err := ipset.runWithStdin(stdin, "restore", "-exist")
if err != nil {
Expand Down

0 comments on commit 9d63cc6

Please sign in to comment.