Bug Report
What did you do?
Changing a resource with server_side_apply used for kubernetes.core fails with TypeError: Object of type bytes is not JSON serializable (see ansible-collections/kubernetes.core#548) or alternatively error decoding YAML: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {} if the patched version is used in the operator image.
What did you expect to see?
The server side apply should work as it does in 1.25.3
What did you see instead? Under which circumstances?
The errors described above.
Environment
Operator type:
/language ansible
Kubernetes cluster type:
Custom
$ operator-sdk version
1.26.0
$ go version (if language is Go)
ansible [core 2.13.7]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/usr/share/ansible/openshift']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
ansible collection location = /opt/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.13 (default, Jun 14 2022, 17:49:07) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
jinja version = 3.1.2
libyaml = True
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.1", GitCommit:"8f94681cd294aa8cfd3407b8191f6c70214973a4", GitTreeState:"clean", BuildDate:"2023-01-18T15:58:16Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.8", GitCommit:"fdc77503e954d1ee641c0e350481f7528e8d068b", GitTreeState:"clean", BuildDate:"2022-11-09T13:31:40Z", GoVersion:"go1.18.8", Compiler:"gc", Platform:"linux/amd64"}
Possible Solution
Revert to 1.25.3 of the docker image
Additional context
Tried to fix it with the following content in the Dockerfile:
# Be able to install collections from git
RUN pip uninstall --yes ansible && \
pip install ansible
# Results in: Successfully installed ansible-6.7.0 ansible-core-2.13.7 packaging-23.0 resolvelib-0.8.1
RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \
&& rm -rf ~/.ansible/collections/ansible_collections/kubernetes/core \
&& ansible-galaxy collection install -r ${HOME}/requirements_k8s_core.yml \
&& chmod -R ug+rwx ${HOME}/.ansible
where requirements.yml:
---
collections:
- name: community.kubernetes
version: "2.0.1"
- name: operator_sdk.util
version: "0.4.0"
- name: cloud.common
version: "2.1.2"
- name: community.crypto
and requirements_k8s_core.yml:
---
collections:
- name: https://github.com/stiller-leser/kubernetes.core
type: git
version: 2.3.2-flybyray-patch-1
In the end only a revert to 1.25.3 helped (including the latest Ansible versions).
Best regards,
stiller-leser
Bug Report
What did you do?
Changing a resource with
server_side_applyused forkubernetes.corefails withTypeError: Object of type bytes is not JSON serializable(see ansible-collections/kubernetes.core#548) or alternativelyerror decoding YAML: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {}if the patched version is used in the operator image.What did you expect to see?
The server side apply should work as it does in 1.25.3
What did you see instead? Under which circumstances?
The errors described above.
Environment
Operator type:
/language ansible
Kubernetes cluster type:
Custom
$ operator-sdk version1.26.0
$ go version(if language is Go)ansible [core 2.13.7]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/usr/share/ansible/openshift']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
ansible collection location = /opt/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.13 (default, Jun 14 2022, 17:49:07) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
jinja version = 3.1.2
libyaml = True
$ kubectl versionClient Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.1", GitCommit:"8f94681cd294aa8cfd3407b8191f6c70214973a4", GitTreeState:"clean", BuildDate:"2023-01-18T15:58:16Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.8", GitCommit:"fdc77503e954d1ee641c0e350481f7528e8d068b", GitTreeState:"clean", BuildDate:"2022-11-09T13:31:40Z", GoVersion:"go1.18.8", Compiler:"gc", Platform:"linux/amd64"}
Possible Solution
Revert to 1.25.3 of the docker image
Additional context
Tried to fix it with the following content in the Dockerfile:
where requirements.yml:
and requirements_k8s_core.yml:
In the end only a revert to 1.25.3 helped (including the latest Ansible versions).
Best regards,
stiller-leser