From 224383d20643532529d95e133444e7249c407e30 Mon Sep 17 00:00:00 2001 From: Moji Date: Wed, 4 Sep 2024 10:31:22 +0200 Subject: [PATCH] feat: show a message when the deployment is pending (#553) * feat: Show a message when the deployment is pending * chore: updated the max pending time * chore: update loggers to be consistent with the rest from main --- pkg/instance/execution.go | 5 +- pkg/instance/network.go | 27 +++--- pkg/k8s/custom_resource.go | 2 +- pkg/k8s/daemonset.go | 16 +++- pkg/k8s/errors.go | 2 + pkg/k8s/k8s.go | 21 +++-- pkg/k8s/namespace.go | 9 +- pkg/k8s/networkpolicy.go | 2 +- pkg/k8s/pod.go | 26 ++++-- pkg/k8s/pod_status.go | 135 ++++++++++++++++++++++++++++ pkg/k8s/pvc.go | 4 +- pkg/k8s/replicaset.go | 8 +- pkg/k8s/service.go | 16 +++- pkg/k8s/types.go | 3 + pkg/knuu/knuu.go | 2 +- pkg/log/logger.go | 5 +- pkg/sidecars/netshaper/helpers.go | 2 +- pkg/sidecars/netshaper/netshaper.go | 1 - pkg/traefik/traefik.go | 2 +- 19 files changed, 231 insertions(+), 57 deletions(-) create mode 100644 pkg/k8s/pod_status.go diff --git a/pkg/instance/execution.go b/pkg/instance/execution.go index bd390ac..620ccf7 100644 --- a/pkg/instance/execution.go +++ b/pkg/instance/execution.go @@ -73,10 +73,7 @@ func (e *execution) StartWithCallback(ctx context.Context, callback func()) erro go func() { err := e.WaitInstanceIsRunning(ctx) if err != nil { - e.instance.Logger.WithFields(logrus.Fields{ - "instance": e.instance.k8sName, - "error": err, - }).Errorf("waiting for instance to be running") + e.instance.Logger.WithError(err).WithField("instance", e.instance.k8sName).Error("waiting for instance to be running") return } callback() diff --git a/pkg/instance/network.go b/pkg/instance/network.go index ddbca44..10dd74f 100644 --- a/pkg/instance/network.go +++ b/pkg/instance/network.go @@ -83,14 +83,15 @@ func (n *network) PortForwardTCP(ctx context.Context, port int) (int, error) { if attempt == maxRetries { return -1, ErrForwardingPort.WithParams(maxRetries) } - n.instance.Logger.WithFields(logrus.Fields{ - "instance": n.instance.name, - "port": port, - "error": err, - "attempt": attempt, - "max": maxRetries, - "retry_interval": retryInterval.String(), - }).Debug("forwarding port failed, retrying") + n.instance.Logger. + WithError(err). + WithFields(logrus.Fields{ + "instance": n.instance.name, + "port": port, + "attempt": attempt, + "max": maxRetries, + "retry_interval": retryInterval.String(), + }).Debug("forwarding port failed, retrying") } return localPort, nil } @@ -295,10 +296,7 @@ func (n *network) deployOrPatchService(ctx context.Context, portsTCP, portsUDP [ func (n *network) enableIfDisabled(ctx context.Context) error { disableNetwork, err := n.IsDisabled(ctx) if err != nil { - n.instance.Logger.WithFields(logrus.Fields{ - "instance": n.instance.name, - "error": err, - }).Error("error checking network status for instance") + n.instance.Logger.WithError(err).WithField("instance", n.instance.k8sName).Error("error checking network status for instance") return ErrCheckingNetworkStatusForInstance.WithParams(n.instance.k8sName).Wrap(err) } @@ -306,10 +304,7 @@ func (n *network) enableIfDisabled(ctx context.Context) error { return nil } if err := n.Enable(ctx); err != nil { - n.instance.Logger.WithFields(logrus.Fields{ - "instance": n.instance.name, - "error": err, - }).Error("error enabling network for instance") + n.instance.Logger.WithError(err).WithField("instance", n.instance.k8sName).Error("error enabling network for instance") return ErrEnablingNetworkForInstance.WithParams(n.instance.k8sName).Wrap(err) } return nil diff --git a/pkg/k8s/custom_resource.go b/pkg/k8s/custom_resource.go index 09047cd..f174411 100644 --- a/pkg/k8s/custom_resource.go +++ b/pkg/k8s/custom_resource.go @@ -43,7 +43,7 @@ func (c *Client) CreateCustomResource( return ErrCreatingCustomResource.WithParams(gvr.Resource).Wrap(err) } - c.logger.Debugf("CustomResource %s created", name) + c.logger.WithField("name", name).Debug("customResource created") return nil } diff --git a/pkg/k8s/daemonset.go b/pkg/k8s/daemonset.go index f7ed8af..8f8c6c3 100644 --- a/pkg/k8s/daemonset.go +++ b/pkg/k8s/daemonset.go @@ -3,6 +3,7 @@ package k8s import ( "context" + "github.com/sirupsen/logrus" appv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" @@ -49,7 +50,10 @@ func (c *Client) CreateDaemonSet( if err != nil { return nil, ErrCreatingDaemonset.WithParams(name).Wrap(err) } - c.logger.Debugf("DaemonSet %s created in namespace %s", name, c.namespace) + c.logger.WithFields(logrus.Fields{ + "name": name, + "namespace": c.namespace, + }).Debug("daemonSet created") return created, nil } @@ -73,7 +77,10 @@ func (c *Client) UpdateDaemonSet(ctx context.Context, if err != nil { return nil, ErrUpdatingDaemonset.WithParams(name).Wrap(err) } - c.logger.Debugf("DaemonSet %s updated in namespace %s", name, c.namespace) + c.logger.WithFields(logrus.Fields{ + "name": name, + "namespace": c.namespace, + }).Debug("daemonSet updated") return updated, nil } @@ -82,7 +89,10 @@ func (c *Client) DeleteDaemonSet(ctx context.Context, name string) error { if err != nil { return ErrDeletingDaemonset.WithParams(name).Wrap(err) } - c.logger.Debugf("DaemonSet %s deleted in namespace %s", name, c.namespace) + c.logger.WithFields(logrus.Fields{ + "name": name, + "namespace": c.namespace, + }).Debug("daemonSet deleted") return nil } diff --git a/pkg/k8s/errors.go b/pkg/k8s/errors.go index 3a5b302..6892514 100644 --- a/pkg/k8s/errors.go +++ b/pkg/k8s/errors.go @@ -133,4 +133,6 @@ var ( ErrInvalidServiceAccountName = errors.New("InvalidServiceAccountName", "invalid service account name %s: %v") ErrInvalidClusterRoleBindingName = errors.New("InvalidClusterRoleBindingName", "invalid cluster role binding name %s: %v") ErrInvalidServiceName = errors.New("InvalidServiceName", "invalid service name %s: %v") + ErrListingPods = errors.New("ListingPods", "failed to list pods") + ErrGetPodStatus = errors.New("GetPodStatus", "failed to get pod status for pod %s") ) diff --git a/pkg/k8s/k8s.go b/pkg/k8s/k8s.go index 912f1b1..4c7450c 100644 --- a/pkg/k8s/k8s.go +++ b/pkg/k8s/k8s.go @@ -29,6 +29,9 @@ const ( // retryInterval is the interval to wait between retries retryInterval = 100 * time.Millisecond + + // if any pod is pending for more than this duration, a warning is logged + defaultMaxPendingDuration = 60 * time.Second ) type Client struct { @@ -37,6 +40,8 @@ type Client struct { dynamicClient dynamic.Interface namespace string logger *logrus.Logger + // max duration for any pod to be in pending state, otherwise it triggers a notice to be shown + maxPendingDuration time.Duration } var _ KubeManager = &Client{} @@ -77,16 +82,18 @@ func NewClientCustom( logger *logrus.Logger, ) (*Client, error) { kc := &Client{ - clientset: cs, - discoveryClient: dc, - dynamicClient: dC, - namespace: namespace, - logger: logger, + clientset: cs, + discoveryClient: dc, + dynamicClient: dC, + namespace: namespace, + logger: logger, + maxPendingDuration: defaultMaxPendingDuration, } kc.namespace = SanitizeName(namespace) if err := kc.CreateNamespace(ctx, kc.namespace); err != nil { return nil, ErrCreatingNamespace.WithParams(kc.namespace).Wrap(err) } + kc.startPendingPodsWarningMonitor(ctx) return kc, nil } @@ -105,3 +112,7 @@ func (c *Client) Namespace() string { func (c *Client) DiscoveryClient() discovery.DiscoveryInterface { return c.discoveryClient } + +func (c *Client) SetMaxPendingDuration(duration time.Duration) { + c.maxPendingDuration = duration +} diff --git a/pkg/k8s/namespace.go b/pkg/k8s/namespace.go index 90c68e8..92caadd 100644 --- a/pkg/k8s/namespace.go +++ b/pkg/k8s/namespace.go @@ -24,10 +24,11 @@ func (c *Client) CreateNamespace(ctx context.Context, name string) error { if !apierrs.IsAlreadyExists(err) { return ErrCreatingNamespace.WithParams(name).Wrap(err) } - c.logger.Debugf("Namespace %s already exists, continuing.\n", name) + c.logger.WithField("name", name).Debug("namespace already exists, continuing") + return nil } - c.logger.Debugf("Namespace %s created.\n", name) + c.logger.WithField("name", name).Debug("namespace created") return nil } @@ -50,10 +51,10 @@ func (c *Client) NamespaceExists(ctx context.Context, name string) (bool, error) } if apierrs.IsNotFound(err) { - c.logger.Debugf("Namespace %s does not exist, err: %v", name, err) + c.logger.WithField("name", name).WithError(err).Debug("namespace does not exist") return false, nil } - c.logger.Errorf("Error getting namespace %s, err: %v", name, err) + c.logger.WithField("name", name).WithError(err).Error("getting namespace") return false, err } diff --git a/pkg/k8s/networkpolicy.go b/pkg/k8s/networkpolicy.go index d852f66..77321aa 100644 --- a/pkg/k8s/networkpolicy.go +++ b/pkg/k8s/networkpolicy.go @@ -97,7 +97,7 @@ func (c *Client) GetNetworkPolicy(ctx context.Context, name string) (*v1.Network func (c *Client) NetworkPolicyExists(ctx context.Context, name string) bool { _, err := c.GetNetworkPolicy(ctx, name) if err != nil { - c.logger.Debug("NetworkPolicy does not exist, err: ", err) + c.logger.WithField("name", name).WithError(err).Debug("getting networkPolicy") return false } diff --git a/pkg/k8s/pod.go b/pkg/k8s/pod.go index 832f9e0..10ae7d3 100644 --- a/pkg/k8s/pod.go +++ b/pkg/k8s/pod.go @@ -9,6 +9,7 @@ import ( "strings" "time" + "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" @@ -105,7 +106,7 @@ func (c *Client) NewFile(source, dest string) *File { } func (c *Client) ReplacePodWithGracePeriod(ctx context.Context, podConfig PodConfig, gracePeriod *int64) (*v1.Pod, error) { - c.logger.Debugf("Replacing pod %s", podConfig.Name) + c.logger.WithField("name", podConfig.Name).Debug("replacing pod") if err := c.DeletePodWithGracePeriod(ctx, podConfig.Name, gracePeriod); err != nil { return nil, ErrDeletingPod.Wrap(err) @@ -127,13 +128,13 @@ func (c *Client) waitForPodDeletion(ctx context.Context, name string) error { for { select { case <-ctx.Done(): - c.logger.Errorf("Context cancelled while waiting for pod %s to delete", name) + c.logger.WithField("name", name).Error("context cancelled while waiting for pod to delete") return ctx.Err() case <-time.After(retryInterval): _, err := c.getPod(ctx, name) if err != nil { if apierrs.IsNotFound(err) { - c.logger.Debugf("Pod %s successfully deleted", name) + c.logger.WithField("name", name).Debug("pod successfully deleted") return nil } return ErrWaitingForPodDeletion.WithParams(name).Wrap(err) @@ -309,8 +310,11 @@ func (c *Client) PortForwardPod( if stderr.Len() > 0 { return ErrPortForwarding.WithParams(stderr.String()) } - c.logger.Debugf("Port forwarding from %d to %d", localPort, remotePort) - c.logger.Debugf("Port forwarding stdout: %v", stdout) + c.logger.WithFields(logrus.Fields{ + "local_port": localPort, + "remote_port": remotePort, + "stdout": stdout.String(), + }).Debug("port forwarding") // Start the port forwarding go func() { @@ -325,7 +329,10 @@ func (c *Client) PortForwardPod( select { case <-readyChan: // Ready to forward - c.logger.Debugf("Port forwarding ready from %d to %d", localPort, remotePort) + c.logger.WithFields(logrus.Fields{ + "local_port": localPort, + "remote_port": remotePort, + }).Debug("port forwarding ready") case err := <-errChan: // if there's an error, return it return ErrForwardingPorts.Wrap(err) @@ -491,7 +498,7 @@ func (c *Client) buildInitContainerCommand(volumes []*Volume, files []*File) []s fullCommand := strings.Join(cmds, "") commands = append(commands, fullCommand) - c.logger.Debugf("Init container command: %s", fullCommand) + c.logger.WithField("command", fullCommand).Debug("init container command") return commands } @@ -582,6 +589,9 @@ func (c *Client) preparePod(spec PodConfig, init bool) *v1.Pod { Spec: c.preparePodSpec(spec, init), } - c.logger.Debugf("Prepared pod %s in namespace %s", spec.Name, spec.Namespace) + c.logger.WithFields(logrus.Fields{ + "name": spec.Name, + "namespace": spec.Namespace, + }).Debug("prepared pod") return pod } diff --git a/pkg/k8s/pod_status.go b/pkg/k8s/pod_status.go new file mode 100644 index 0000000..f326503 --- /dev/null +++ b/pkg/k8s/pod_status.go @@ -0,0 +1,135 @@ +package k8s + +import ( + "context" + "fmt" + "strings" + "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type PodStatus struct { + Name string + Status corev1.PodPhase + PendingDuration time.Duration +} + +// AllPodsStatuses reports the status of pods in the current namespace. +func (c *Client) AllPodsStatuses(ctx context.Context) ([]PodStatus, error) { + pods, err := c.clientset.CoreV1(). + Pods(c.namespace).List(ctx, metav1.ListOptions{}) + if err != nil { + return nil, ErrListingPods.Wrap(err) + } + + if len(pods.Items) == 0 { + return nil, nil + } + + output := make([]PodStatus, 0, len(pods.Items)) + for _, pod := range pods.Items { + pendingDuration := time.Duration(0) + if pod.Status.Phase == corev1.PodPending { + pendingDuration = time.Since(pod.CreationTimestamp.Time) + } + + output = append(output, PodStatus{ + Name: pod.Name, + Status: pod.Status.Phase, + PendingDuration: pendingDuration, + }) + } + return output, nil +} + +func (c *Client) PodStatus(ctx context.Context, name string) (PodStatus, error) { + pod, err := c.clientset.CoreV1(). + Pods(c.namespace).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return PodStatus{}, ErrGetPodStatus.WithParams(name).Wrap(err) + } + + pendingDuration := time.Duration(0) + if pod.Status.Phase == corev1.PodPending { + pendingDuration = time.Since(pod.CreationTimestamp.Time) + } + + return PodStatus{ + Name: pod.Name, + Status: pod.Status.Phase, + PendingDuration: pendingDuration, + }, nil +} + +func (c *Client) PrintAllPodsStatuses(ctx context.Context) error { + statuses, err := c.AllPodsStatuses(ctx) + if err != nil { + return err + } + + for _, s := range statuses { + fmt.Printf("%-60s | %s\n", s.Name, s.Status) + } + return nil +} + +// reportLongPendingPods checks for pods that have been pending longer than the specified maxPendingDuration +// and logs a warning message with the pods that are pending for too long. +func (c *Client) reportLongPendingPods(ctx context.Context) error { + statuses, err := c.AllPodsStatuses(ctx) + if err != nil { + return err + } + + // Collect pods that have been pending longer than the allowed duration + longPendingPods := make([]string, 0) + for _, s := range statuses { + if s.Status == corev1.PodPending && s.PendingDuration > c.maxPendingDuration { + longPendingPods = append(longPendingPods, s.Name) + } + } + + // If there are no pods pending too long, return nil + if len(longPendingPods) == 0 { + return nil + } + + c.logger.WithField("pending_pods", strings.Join(longPendingPods, ", ")).Warn("Pods pending for too long") + c.logger.WithField("pod_statuses", generatePodsStatusSummary(statuses)).Info("Pod statuses") + return nil +} + +// startPendingPodsWarningMonitor starts a background process to periodically check for pods that have been pending longer than the maxPendingDuration. +func (c *Client) startPendingPodsWarningMonitor(ctx context.Context) { + go func() { + ticker := time.NewTicker(c.maxPendingDuration) + defer ticker.Stop() + + for { + select { + case <-ticker.C: + if err := c.reportLongPendingPods(ctx); err != nil { + c.logger.WithError(err).Error("failed to report long pending pods") + } + case <-ctx.Done(): + c.logger.Infof("Shutting down long pending pods monitor.") + return + } + } + }() +} + +func generatePodsStatusSummary(statuses []PodStatus) string { + summary := make(map[corev1.PodPhase]int) + for _, s := range statuses { + summary[s.Status]++ + } + + output := "" + for status, count := range summary { + output += fmt.Sprintf("%s: %d , ", status, count) + } + return strings.TrimSuffix(output, ", ") +} diff --git a/pkg/k8s/pvc.go b/pkg/k8s/pvc.go index 7af2ad2..a39b2ed 100644 --- a/pkg/k8s/pvc.go +++ b/pkg/k8s/pvc.go @@ -48,7 +48,7 @@ func (c *Client) CreatePersistentVolumeClaim( return ErrCreatingPersistentVolumeClaim.WithParams(name).Wrap(err) } - c.logger.Debugf("PersistentVolumeClaim %s created", name) + c.logger.WithField("name", name).Debug("PersistentVolumeClaim created") return nil } @@ -66,7 +66,7 @@ func (c *Client) DeletePersistentVolumeClaim(ctx context.Context, name string) e return ErrDeletingPersistentVolumeClaim.WithParams(name).Wrap(err) } - c.logger.Debugf("PersistentVolumeClaim %s deleted", name) + c.logger.WithField("name", name).Debug("PersistentVolumeClaim deleted") return nil } diff --git a/pkg/k8s/replicaset.go b/pkg/k8s/replicaset.go index bf3adf9..3749daf 100644 --- a/pkg/k8s/replicaset.go +++ b/pkg/k8s/replicaset.go @@ -4,6 +4,7 @@ import ( "context" "time" + "github.com/sirupsen/logrus" appv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -36,7 +37,7 @@ func (c *Client) CreateReplicaSet(ctx context.Context, rsConfig ReplicaSetConfig } func (c *Client) ReplaceReplicaSetWithGracePeriod(ctx context.Context, ReplicaSetConfig ReplicaSetConfig, gracePeriod *int64) (*appv1.ReplicaSet, error) { - c.logger.Debugf("Replacing ReplicaSet %s", ReplicaSetConfig.Name) + c.logger.WithField("name", ReplicaSetConfig.Name).Debug("replacing replicaSet") if err := c.DeleteReplicaSetWithGracePeriod(ctx, ReplicaSetConfig.Name, gracePeriod); err != nil { return nil, ErrDeletingReplicaSet.Wrap(err) @@ -174,6 +175,9 @@ func (c *Client) prepareReplicaSet(rsConf ReplicaSetConfig, init bool) *appv1.Re }, } - c.logger.Debugf("Prepared ReplicaSet %s in namespace %s", rsConf.Name, rsConf.Namespace) + c.logger.WithFields(logrus.Fields{ + "name": rsConf.Name, + "namespace": rsConf.Namespace, + }).Debug("prepared replicaSet") return rs } diff --git a/pkg/k8s/service.go b/pkg/k8s/service.go index 40dbc5e..7650ea6 100644 --- a/pkg/k8s/service.go +++ b/pkg/k8s/service.go @@ -6,6 +6,7 @@ import ( "net" "time" + "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -45,7 +46,10 @@ func (c *Client) CreateService( if err != nil { return nil, ErrCreatingService.WithParams(name).Wrap(err) } - c.logger.Debugf("Service %s created in namespace %s", name, c.namespace) + c.logger.WithFields(logrus.Fields{ + "name": name, + "namespace": c.namespace, + }).Debug("service created") return serv, nil } @@ -79,7 +83,10 @@ func (c *Client) PatchService( return nil, ErrPatchingService.WithParams(name).Wrap(err) } - c.logger.Debugf("Service %s patched in namespace %s", name, c.namespace) + c.logger.WithFields(logrus.Fields{ + "name": name, + "namespace": c.namespace, + }).Debug("service patched") return serv, nil } @@ -97,7 +104,10 @@ func (c *Client) DeleteService(ctx context.Context, name string) error { return ErrDeletingService.WithParams(name).Wrap(err) } - c.logger.Debugf("Service %s deleted in namespace %s", name, c.namespace) + c.logger.WithFields(logrus.Fields{ + "name": name, + "namespace": c.namespace, + }).Debug("service deleted") return nil } diff --git a/pkg/k8s/types.go b/pkg/k8s/types.go index 6e1381b..a6db04f 100644 --- a/pkg/k8s/types.go +++ b/pkg/k8s/types.go @@ -74,4 +74,7 @@ type KubeManager interface { UpdateDaemonSet(ctx context.Context, name string, labels map[string]string, initContainers []corev1.Container, containers []corev1.Container) (*appv1.DaemonSet, error) WaitForDeployment(ctx context.Context, name string) error WaitForService(ctx context.Context, name string) error + AllPodsStatuses(ctx context.Context) ([]PodStatus, error) + PodStatus(ctx context.Context, name string) (PodStatus, error) + PrintAllPodsStatuses(ctx context.Context) error } diff --git a/pkg/knuu/knuu.go b/pkg/knuu/knuu.go index 898b512..edebef9 100644 --- a/pkg/knuu/knuu.go +++ b/pkg/knuu/knuu.go @@ -88,7 +88,7 @@ func (k *Knuu) HandleStopSignal(ctx context.Context) { <-stop k.Logger.Info("Received signal to stop, cleaning up resources...") if err := k.CleanUp(ctx); err != nil { - k.Logger.WithField("error", err).Error("deleting namespace") + k.Logger.WithError(err).Error("deleting namespace") } }() } diff --git a/pkg/log/logger.go b/pkg/log/logger.go index 7fba226..41fd220 100644 --- a/pkg/log/logger.go +++ b/pkg/log/logger.go @@ -31,10 +31,7 @@ func DefaultLogger() *logrus.Logger { if customLevel := os.Getenv(envLogLevel); customLevel != "" { err := logger.Level.UnmarshalText([]byte(customLevel)) if err != nil { - logger.WithFields(logrus.Fields{ - "env_log_level": envLogLevel, - "error": err, - }). + logger.WithError(err).WithField("env_log_level", envLogLevel). Warn("Failed to parse env var LOG_LEVEL, defaulting to INFO") } } diff --git a/pkg/sidecars/netshaper/helpers.go b/pkg/sidecars/netshaper/helpers.go index 53c770e..c6fd108 100644 --- a/pkg/sidecars/netshaper/helpers.go +++ b/pkg/sidecars/netshaper/helpers.go @@ -10,7 +10,7 @@ import ( func (bt *NetShaper) setNewClientByURL(url string) { bt.client = sdk.NewClient(url) - bt.instance.Logger.Debugf("NetShaper (BitTwister) address '%s'", url) + bt.instance.Logger.WithField("address", url).Debug("NetShaper (BitTwister) address") } func (bt *NetShaper) SetPort(port int) { diff --git a/pkg/sidecars/netshaper/netshaper.go b/pkg/sidecars/netshaper/netshaper.go index 3cb0623..b2b5012 100644 --- a/pkg/sidecars/netshaper/netshaper.go +++ b/pkg/sidecars/netshaper/netshaper.go @@ -90,7 +90,6 @@ func (bt *NetShaper) PreStart(ctx context.Context) error { if err != nil { return err } - bt.instance.Logger.Debugf("BitTwister URL: %s", btURL) bt.setNewClientByURL(btURL) return nil diff --git a/pkg/traefik/traefik.go b/pkg/traefik/traefik.go index 9606879..e31456a 100644 --- a/pkg/traefik/traefik.go +++ b/pkg/traefik/traefik.go @@ -352,7 +352,7 @@ func (t *Traefik) createIngressRoute( func (t *Traefik) IsTraefikAPIAvailable(ctx context.Context) bool { apiResourceList, err := t.K8sClient.Clientset().Discovery().ServerResourcesForGroupVersion(traefikAPIGroupVersion) if err != nil { - t.Logger.WithField("error", err).Error("Failed to discover Traefik API resources") + t.Logger.WithError(err).Error("Failed to discover Traefik API resources") return false }