Skip to content

Commit

Permalink
remove unnecessary logs
Browse files Browse the repository at this point in the history
Signed-off-by: souravbiswassanto <saurov@appscode.com>
  • Loading branch information
souravbiswassanto committed Nov 8, 2024
1 parent bf28db4 commit 02f8e60
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
3 changes: 0 additions & 3 deletions pkg/controllers/apps/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/klog/v2"
cu "kmodules.xyz/client-go/client"
core_util "kmodules.xyz/client-go/core/v1"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -109,8 +108,6 @@ func (r *SidekickReconciler) setDeletionInitiatorAnnotation(ctx context.Context,
return po
},
)
klog.Infoln("pod annotation set: ", pod.Annotations)

return err
}

Expand Down
5 changes: 0 additions & 5 deletions pkg/controllers/apps/sidekick.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/klog/v2"
"k8s.io/utils/ptr"
cu "kmodules.xyz/client-go/client"
core_util "kmodules.xyz/client-go/core/v1"
Expand Down Expand Up @@ -96,11 +95,9 @@ func (r *SidekickReconciler) calculateSidekickPhase(ctx context.Context, sidekic
if err != nil && !errors.IsNotFound(err) {
return sidekick.Status.Phase, err
}

if err == nil {
restartCounter := getContainerRestartCounts(&pod)
podUID := string(pod.GetUID())

sidekick.Status.ContainerRestartCountsPerPod[podUID] = restartCounter
if pod.Status.Phase == corev1.PodFailed && pod.ObjectMeta.DeletionTimestamp == nil {
sidekick.Status.FailureCount[podUID] = true
Expand All @@ -110,7 +107,6 @@ func (r *SidekickReconciler) calculateSidekickPhase(ctx context.Context, sidekic
sidekick.Status.FailureCount[podUID] = false
}
}

}

phase := r.getSidekickPhase(sidekick, &pod)
Expand Down Expand Up @@ -170,7 +166,6 @@ func getTotalBackOffCounts(sidekick *appsv1alpha1.Sidekick) int32 {
if sidekick.Spec.BackoffLimit == nil {
sidekick.Spec.BackoffLimit = ptr.To(int32(0))
}
klog.Infoln(*sidekick.Spec.BackoffLimit, totalContainerRestartCount, failureCount)
return failureCount + totalContainerRestartCount
}

Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/apps/sidekick_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func (r *SidekickReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
if e2 == nil {
expectedHash := meta.GenerationHash(&sidekick)
actualHash := pod.Annotations[keyHash]

if expectedHash != actualHash ||
leader.Name != pod.Annotations[keyLeader] ||
leader.Spec.NodeName != pod.Spec.NodeName || (pod.Status.Phase == corev1.PodFailed && sidekick.Spec.RestartPolicy == corev1.RestartPolicyNever) {
Expand Down

0 comments on commit 02f8e60

Please sign in to comment.