Skip to content
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
3 changes: 3 additions & 0 deletions internal/controller/runtime/pod_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions percona/clientcmd/clientcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Loading