ansible-collections / kubernetes.core

The collection includes a variety of Ansible content to help automate the management of applications in Kubernetes and OpenShift clusters, as well as the provisioning and maintenance of clusters themselves.
Other
215 stars 135 forks source link

[3.2.0] Not Compatible with https://github.com/kubernetes-client/python/releases/tag/v31.0.0 #785

Open hswong3i opened 2 days ago

hswong3i commented 2 days ago
SUMMARY

https://github.com/kubernetes-client/python/releases/tag/v31.0.0 released on 2024-09-19, and now officially available from https://pypi.org/project/kubernetes/31.0.0/

When running following playbook with v30.1.0 everything looks good (see https://github.com/alvistack/ansible-collection-kubernetes/blob/8d0e953/playbooks/70-kube_csi_cephfs-verify.yml#L40-L57):

    - name: setup csi-cephfs as default storageclass
      vars:
        ansible_python_interpreter: python3
      kubernetes.core.k8s:
        state: present
        wait: true
        definition:
          apiVersion: storage.k8s.io/v1
          kind: StorageClass
          metadata:
            name: csi-cephfs
            annotations:
              storageclass.kubernetes.io/is-default-class: "true"
      when: inventory_hostname == groups['kube_master'][0]
      register: result
      until: result is succeeded
      changed_when: result is not succeeded
      retries: 60

But it is totally failed when running with v31.0.0; once rolling back to v30.1.0 problem get solved.

ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
$ ansible --version
ansible [core 2.17.5]
  config file = /home/hswong3i/Documents/alvistack/ansible-collection-kubernetes/ansible.cfg
  configured module search path = ['/home/hswong3i/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/hswong3i/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.7 (main, Oct  3 2024, 15:15:22) [GCC 14.2.0] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
$ ansible-galaxy collection list kubernetes.core

# /usr/lib/python3/dist-packages/ansible_collections
Collection      Version
--------------- -------
kubernetes.core 3.2.0  

# /usr/share/ansible/collections/ansible_collections
Collection      Version
--------------- -------
kubernetes.core 3.2.0
CONFIGURATION
$ ansible-config dump --only-changed
ANSIBLE_FORCE_COLOR(env: ANSIBLE_FORCE_COLOR) = True
ANSIBLE_NOCOWS(/home/hswong3i/Documents/alvistack/ansible-collection-kubernetes/ansible.cfg) = True
CONFIG_FILE() = /home/hswong3i/Documents/alvistack/ansible-collection-kubernetes/ansible.cfg
DEFAULT_FORKS(/home/hswong3i/Documents/alvistack/ansible-collection-kubernetes/ansible.cfg) = 20
DEFAULT_MANAGED_STR(/home/hswong3i/Documents/alvistack/ansible-collection-kubernetes/ansible.cfg) = Ansible managed: Do NOT edit this file manually!
HOST_KEY_CHECKING(/home/hswong3i/Documents/alvistack/ansible-collection-kubernetes/ansible.cfg) = False
INTERPRETER_PYTHON(/home/hswong3i/Documents/alvistack/ansible-collection-kubernetes/ansible.cfg) = auto
RETRY_FILES_ENABLED(/home/hswong3i/Documents/alvistack/ansible-collection-kubernetes/ansible.cfg) = False
OS / ENVIRONMENT
$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.10"
NAME="Ubuntu"
VERSION_ID="24.10"
VERSION="24.10 (Oracular Oriole)"
VERSION_CODENAME=oracular
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=oracular
LOGO=ubuntu-logo
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
hswong3i commented 2 days ago

Even if manually swap the bundled kubenetes.core from 3.2.0 to main as below (see https://github.com/alvistack/ansible-community-ansible-build-data/commit/04b9ac4a869b678f73382b238709690222feb7e3), it still only working with v30.1.0:

    wget -c -O /tmp/kubernetes.core-main.tar.gz https://github.com/ansible-collections/kubernetes.core/archive/refs/heads/main.tar.gz
    rm -rf ansible_collections/kubernetes/core/*
    tar zxvf /tmp/kubernetes.core-main.tar.gz --strip-components=1 -C ansible_collections/kubernetes/core/

After swapping to main:

# ansible-galaxy collection list kubernetes.core

# /usr/lib/python3/dist-packages/ansible_collections
Collection      Version
--------------- -------
kubernetes.core 5.0.0  

# /usr/share/ansible/collections/ansible_collections
Collection      Version
--------------- -------
kubernetes.core 5.0.0