Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl v1.30.0 command failed in ansible-operator:v1.34.1 with error malformed ws or wss URL #87

Open
caixiangibm opened this issue Aug 6, 2024 · 2 comments

Comments

@caixiangibm
Copy link

caixiangibm commented Aug 6, 2024

Bug Report

kubectl v1.30.0 command failed in ansible-operator:v1.34.1 with error malformed ws or wss URL

What did you do?

We built our ansible operator image based on quay.io/operator-framework/ansible-operator:v1.34.1, and also put kubectl v1.30.0 into the operator image.
In one of ansible operator task, we need to use kubectl to copy some folder to temporary Operator pod, but this task failed with following error messages (some words are masked)
FAILED! => {"changed": true, "cmd": ["kubectl", "cp", "/some_path/some_folder", "{{tmp_operator_pod_name}}:/some_path", "-n", "name_space"], ..., "msg": "non-zero return code", "rc": 1, ..., "stderr": "Defaulted container "operator" out of: operator, **** (init)\nerror: malformed ws or wss URL", "stderr_lines": ["Defaulted container "operator" out of: operator, *** (init)", "error: malformed ws or wss URL"], "stdout": "", "stdout_lines": []}

- block:
  - name: Copy some folder from Operator to temporary Operator pod
    command: kubectl cp /some_path/some_folder {{tmp_operator_pod_name}}:/some_path -n {{meta.namespace}}

But the same task works with kubectl v1.29.3 or kubectl v1.28.0

What did you expect to see?

We expect the latest kubectl 1.30.* should work with ansible-operator:v1.34.1 or higher version to run "kubectl cp" or other kubectl commands.

What did you see instead? Under which circumstances?

"kubectl cp" command (kubectl v1.30.0) failed with error: malformed ws or wss URL

Environment

Operator type:

language ansible

Kubernetes cluster type:

OpenShift

$ operator-sdk version

ansible-operator version
ansible-operator version: "v1.34.1", commit: "a954ad17369509a87bc108f316276cb1cb4157ee", kubernetes version: "v1.28.0", go version: "go1.20.14", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

ansible-operator v1.34.1 - go version: "go1.20.14"
kubectl v1.30.0 - goVersion: go1.22.2

$ kubectl version

kubectl version --client -o yaml
clientVersion:
  buildDate: "2024-04-17T17:36:05Z"
  compiler: gc
  gitCommit: 7c48c2bd72b9bf5c44d21d7338cc7bea77d0ad2a
  gitTreeState: clean
  gitVersion: v1.30.0
  goVersion: go1.22.2
  major: "1"
  minor: "30"
  platform: linux/amd64
kustomizeVersion: v5.0.4-0.20230601165947-6ce0bf390ce3

Possible Solution

Not sure whether it is compatible problem for ansible-operator to invoke other go application (e.g. kubectl)?
kubectl v1.30.0 - goVersion: go1.22.2
kubectl v1.29.3 - goVersion: go1.21.8
kubectl v1.28.0 - goVersion: go1.20.7

Additional context

Copy link

openshift-ci bot commented Aug 6, 2024

@caixiangibm: The label(s) language/ansible cannot be applied, because the repository doesn't have them.

In response to this:

Bug Report

kubectl v1.30.0 command failed in ansible-operator:v1.34.1 with error malformed ws or wss URL

What did you do?

We built our ansible operator image based on quay.io/operator-framework/ansible-operator:v1.34.1, and also put kubectl v1.30.0 into the operator image.
In one of ansible operator task, we need to use kubectl to copy some folder to temporary Operator pod, but this task failed with following error messages (some words are masked)
FAILED! => {"changed": true, "cmd": ["kubectl", "cp", "/some_path/some_folder", "{{tmp_operator_pod_name}}:/some_path", "-n", "name_space"], ..., "msg": "non-zero return code", "rc": 1, ..., "stderr": "Defaulted container "operator" out of: operator, **** (init)\nerror: malformed ws or wss URL", "stderr_lines": ["Defaulted container "operator" out of: operator, *** (init)", "error: malformed ws or wss URL"], "stdout": "", "stdout_lines": []}

- block:
 - name: Copy some folder from Operator to temporary Operator pod
   command: kubectl cp /some_path/some_folder {{tmp_operator_pod_name}}:/some_path -n {{meta.namespace}}

But the same task works with kubectl v1.29.3 or kubectl v1.28.0

What did you expect to see?

We expect the latest kubectl 1.30.* should work with ansible-operator:v1.34.1 or higher version to run "kubectl cp" or other kubectl commands.

What did you see instead? Under which circumstances?

"kubectl cp" command (kubectl v1.30.0) failed with error: malformed ws or wss URL

Environment

Operator type:

/language ansible

Kubernetes cluster type:

OpenShift

$ operator-sdk version

ansible-operator version
ansible-operator version: "v1.34.1", commit: "a954ad17369509a87bc108f316276cb1cb4157ee", kubernetes version: "v1.28.0", go version: "go1.20.14", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

ansible-operator v1.34.1 - go version: "go1.20.14"
kubectl v1.30.0 - goVersion: go1.22.2

$ kubectl version

kubectl version --client -o yaml
clientVersion:
 buildDate: "2024-04-17T17:36:05Z"
 compiler: gc
 gitCommit: 7c48c2bd72b9bf5c44d21d7338cc7bea77d0ad2a
 gitTreeState: clean
 gitVersion: v1.30.0
 goVersion: go1.22.2
 major: "1"
 minor: "30"
 platform: linux/amd64
kustomizeVersion: v5.0.4-0.20230601165947-6ce0bf390ce3

Possible Solution

Not sure whether it is compatible problem for ansible-operator to invoke other go application (e.g. kubectl)?
kubectl v1.30.0 - goVersion: go1.22.2
kubectl v1.29.3 - goVersion: go1.21.8
kubectl v1.28.0 - goVersion: go1.20.7

Additional context

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@PYLochou
Copy link

Note that the command: kubectl cp could be rewritten with k8s_cp module (https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_cp_module.html) regardless of kubectl version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants