diff --git a/internal/controller/runtime/pod_client.go b/internal/controller/runtime/pod_client.go index 4122303bf5..597de85a24 100644 --- a/internal/controller/runtime/pod_client.go +++ b/internal/controller/runtime/pod_client.go @@ -15,6 +15,7 @@ import ( "k8s.io/client-go/tools/remotecommand" "k8s.io/client-go/util/flowcontrol" "sigs.k8s.io/controller-runtime/pkg/client/apiutil" + logf "sigs.k8s.io/controller-runtime/pkg/log" ) // podExecutor runs command on container in pod in namespace. Non-nil streams @@ -62,6 +63,8 @@ func NewPodExecutor(config *rest.Config) (podExecutor, error) { exec, err := remotecommand.NewSPDYExecutor(configCopy, "POST", request.URL()) + log := logf.FromContext(ctx) + log.V(1).Info("Running command in pod", "pod", pod, "container", container, "command", command) if err == nil { err = exec.StreamWithContext(ctx, remotecommand.StreamOptions{ Stdin: stdin, diff --git a/percona/clientcmd/clientcmd.go b/percona/clientcmd/clientcmd.go index 411e1a1551..879d281e1d 100644 --- a/percona/clientcmd/clientcmd.go +++ b/percona/clientcmd/clientcmd.go @@ -13,6 +13,7 @@ import ( "k8s.io/client-go/tools/remotecommand" "k8s.io/client-go/util/flowcontrol" "k8s.io/client-go/util/retry" + logf "sigs.k8s.io/controller-runtime/pkg/log" ) type Client struct { @@ -73,6 +74,9 @@ func (c *Client) Exec(ctx context.Context, pod *corev1.Pod, containerName string return errors.Wrap(err, "failed to create executor") } + log := logf.FromContext(ctx) + log.V(1).Info("Running command in pod", "pod", pod.Name, "container", containerName, "command", command) + retryErr := retry.OnError(retry.DefaultRetry, func(err error) bool { return true // Retry on all errors }, func() error {