fix exec
This commit is contained in:
parent
143eb968ea
commit
fc8f0916a5
|
|
@ -6,7 +6,8 @@ import (
|
|||
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
|
||||
"k8s.io/client-go/pkg/api"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/pkg/api/v1"
|
||||
"k8s.io/client-go/tools/remotecommand"
|
||||
|
||||
"github.com/zalando-incubator/postgres-operator/pkg/spec"
|
||||
|
|
@ -27,17 +28,17 @@ func (c *Cluster) ExecCommand(podName *spec.NamespacedName, command ...string) (
|
|||
return "", fmt.Errorf("could not determine which container to use")
|
||||
}
|
||||
|
||||
req := c.RestClient.Post().
|
||||
req := c.KubeClient.CoreV1().RESTClient().Post().
|
||||
Resource("pods").
|
||||
Name(podName.Name).
|
||||
Namespace(podName.Namespace).
|
||||
SubResource("exec")
|
||||
req.VersionedParams(&api.PodExecOptions{
|
||||
req.VersionedParams(&v1.PodExecOptions{
|
||||
Container: pod.Spec.Containers[0].Name,
|
||||
Command: command,
|
||||
Stdout: true,
|
||||
Stderr: true,
|
||||
}, api.ParameterCodec)
|
||||
}, scheme.ParameterCodec)
|
||||
|
||||
exec, err := remotecommand.NewExecutor(c.RestConfig, "POST", req.URL())
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue