Skip to content

[release-v3.3] cherry-pick: Don't log object contents #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pkg/controllers/pod/pod_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func NewPodController(ctx context.Context, k8sClientset *kubernetes.Clientset, c

wepInterface, err := podConverter.Convert(obj)
if err != nil {
log.WithError(err).Errorf("Error while converting %#v to wep.", obj)
log.WithError(err).Errorf("Error while converting %v to wep.", key)
return
}

Expand All @@ -134,8 +134,6 @@ func NewPodController(ctx context.Context, k8sClientset *kubernetes.Clientset, c
return
}
log.Debugf("Got UPDATE event for pod: %s", key)
log.Debugf("Old object: \n%#v\n", oldObj)
log.Debugf("New object: \n%#v\n", newObj)

// Ignore updates for not ready / irrelevant pods.
if !isReadyCalicoPod(newObj.(*v1.Pod)) {
Expand All @@ -145,7 +143,7 @@ func NewPodController(ctx context.Context, k8sClientset *kubernetes.Clientset, c

wepInterface, err := podConverter.Convert(newObj)
if err != nil {
log.WithError(err).Errorf("Error while converting %#v to wep.", newObj)
log.WithError(err).Errorf("Error while converting %v to wep.", key)
return
}

Expand All @@ -170,7 +168,7 @@ func NewPodController(ctx context.Context, k8sClientset *kubernetes.Clientset, c

wepInterface, err := podConverter.Convert(obj)
if err != nil {
log.WithError(err).Errorf("Error while converting %#v to wep.", obj)
log.WithError(err).Errorf("Error while converting %v to wep.", key)
return
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/converter/pod_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package converter

import (
"errors"
"fmt"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -68,11 +69,11 @@ func (p *podConverter) Convert(k8sObj interface{}) (interface{}, error) {
if !ok {
tombstone, ok := k8sObj.(cache.DeletedFinalStateUnknown)
if !ok {
return nil, fmt.Errorf("couldn't get object from tombstone %+v", k8sObj)
return nil, errors.New("couldn't get object from tombstone")
}
pod, ok = tombstone.Obj.(*v1.Pod)
if !ok {
return nil, fmt.Errorf("tombstone contained object that is not a Pod %+v", k8sObj)
return nil, errors.New("tombstone contained object that is not a Pod")
}
}

Expand Down