kubernetes-sigs / kubespray

Deploy a Production Ready Kubernetes Cluster
Apache License 2.0
15.62k stars 6.35k forks source link

ERROR! Unexpected Exception, this is probably a bug: module 'ansible_collections.kubernetes.core.plugins.action.helm_repository' has no attribute 'ActionModule' #11314

Open franznemeth opened 1 week ago

franznemeth commented 1 week ago

What happened?

I am running upgrade-cluster.yml to upgrade from 1.29.2 to 1.29.5 and I got the following exception:

TASK [helm-apps : Validating arguments against arg spec 'main' - Install a list of Helm charts.] *********************************************************************************************************************************************************************************************************************************************************************************************************************************************task path: /home/franz.nemeth/git/k8s-clusters/kubespray/playbooks/upgrade_cluster.yml:41
ok: [ceres.lan] => {
    "changed": false,
    "msg": "The arg spec validation passed",
    "validate_args_context": {
        "argument_spec_name": "main",
        "name": "helm-apps",
        "path": "/home/franz.nemeth/git/k8s-clusters/kubespray/roles/helm-apps",
        "type": "role"
    }
}
ERROR! Unexpected Exception, this is probably a bug: module 'ansible_collections.kubernetes.core.plugins.action.helm_repository' has no attribute 'ActionModule'
the full traceback was:

Traceback (most recent call last):
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/cli/playbook.py", line 156, in run
    results = pbex.run()
              ^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/executor/playbook_executor.py", line 190, in run
    result = self._tqm.run(play=play)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/executor/task_queue_manager.py", line 348, in run
    play_return = strategy.run(iterator, play_context)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/plugins/strategy/linear.py", line 193, in run
    action = action_loader.get(task_action, class_only=True, collection_list=task.collections)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/plugins/loader.py", line 862, in get
    return self.get_with_context(name, *args, **kwargs).object
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/plugins/loader.py", line 913, in get_with_context
    obj = getattr(self._module_cache[path], self.class_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'ansible_collections.kubernetes.core.plugins.action.helm_repository' has no attribute 'ActionModule'

What did you expect to happen?

The upgrade-cluster.yml to run through successfully

How can we reproduce it (as minimally and precisely as possible)?

Running the upgrade-cluster.yml playbook

OS

Linux 5.15.153.1-microsoft-standard-WSL2 x86_64
NAME="Fedora Remix for WSL"
VERSION="40"
ID=fedoraremixforwsl
ID_LIKE=fedora
VERSION_ID=40
PLATFORM_ID="platform:f40"
PRETTY_NAME="Fedora Remix for WSL"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:40"
HOME_URL="https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL"
SUPPORT_URL="https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL"
BUG_REPORT_URL="https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/issues"
PRIVACY_POLICY_URL="https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/blob/master/PRIVACY.md"
FEDORA_REMIX_VERSION=40.0.3

Version of Ansible

ansible [core 2.16.8]
  config file = None
  configured module search path = ['/home/franz.nemeth/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible
  ansible collection location = /home/franz.nemeth/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/franz.nemeth/git/k8s-clusters/venv/bin/ansible
  python version = 3.12.3 (main, Apr 17 2024, 00:00:00) [GCC 14.0.1 20240411 (Red Hat 14.0.1-0)] (/home/franz.nemeth/git/k8s-clusters/venv/bin/python)
  jinja version = 3.1.4
  libyaml = True

Version of Python

Python 3.12.3

Version of Kubespray (commit)

2e0008c3f

Network plugin used

custom_cni

Full inventory with variables

container_manager: containerd
etcd_deployment_type: kubeadm
# Cilium helm installation
kube_network_plugin: custom_cni
# This must be set to root otherwise cilium agent init fails with permission denied while copying to /opt/cni/bin
cni_bin_owner: root
custom_cni_chart_namespace: kube-system
custom_cni_chart_release_name: cilium
custom_cni_chart_repository_name: cilium
custom_cni_chart_repository_url: https://helm.cilium.io
custom_cni_chart_ref: cilium/cilium
custom_cni_chart_version: 1.15.2
custom_cni_chart_values:
  annotateK8sNode: true
  dnsPolicy: "ClusterFirstWithHostNet"
  kubeProxyReplacement: "true"
  k8sServiceHost: "10.11.12.13"
  k8sServicePort: "6443"
  nodeinit:
    enabled: true
  ipam:
    mode: "kubernetes"
    operator:
      clusterPoolIPv4PodCIDRList: ["{{ kube_pods_subnet }}"]

kube_version: v1.29.5

# Cluster Loglevel configuration
kube_log_level: 2

# Kubernetes internal network for services, unused block of space.
kube_service_addresses: 10.43.0.0/16
kube_pods_subnet: 10.42.0.0/16
---
# inventory.yaml
all:
  # Ansible connection settings.
  vars:
    # Explicitly set the connection type to the node servers.
    ansible_connection: ssh
  hosts:
    ceres.lan:
      ansible_host: 10.11.12.13
    deimos.lan:
      ansible_host: 10.11.12.14
  children:
    kube_control_plane:
      hosts:
        ceres.lan:
    kube_node:
      hosts:
        ceres.lan:
        deimos.lan:
    etcd:
      hosts:
        ceres.lan:
    k8s_cluster:
      children:
        kube_control_plane:
        kube_node:

Command used to invoke ansible

cd kubespray && ansible-playbook -i ../inventory ./upgrade-cluster.yml -b

Output of ansible run

TASK [helm-apps : Validating arguments against arg spec 'main' - Install a list of Helm charts.] *********************************************************************************************************************************************************************************************************************************************************************************************************************************************task path: /home/franz.nemeth/git/k8s-clusters/kubespray/playbooks/upgrade_cluster.yml:41
ok: [ceres.lan] => {
    "changed": false,
    "msg": "The arg spec validation passed",
    "validate_args_context": {
        "argument_spec_name": "main",
        "name": "helm-apps",
        "path": "/home/franz.nemeth/git/k8s-clusters/kubespray/roles/helm-apps",
        "type": "role"
    }
}
ERROR! Unexpected Exception, this is probably a bug: module 'ansible_collections.kubernetes.core.plugins.action.helm_repository' has no attribute 'ActionModule'
the full traceback was:

Traceback (most recent call last):
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/cli/playbook.py", line 156, in run
    results = pbex.run()
              ^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/executor/playbook_executor.py", line 190, in run
    result = self._tqm.run(play=play)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/executor/task_queue_manager.py", line 348, in run
    play_return = strategy.run(iterator, play_context)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/plugins/strategy/linear.py", line 193, in run
    action = action_loader.get(task_action, class_only=True, collection_list=task.collections)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/plugins/loader.py", line 862, in get
    return self.get_with_context(name, *args, **kwargs).object
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/franz.nemeth/git/k8s-clusters/venv/lib/python3.12/site-packages/ansible/plugins/loader.py", line 913, in get_with_context
    obj = getattr(self._module_cache[path], self.class_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'ansible_collections.kubernetes.core.plugins.action.helm_repository' has no attribute 'ActionModule'

Anything else we need to know

No response

franznemeth commented 5 days ago

I found a fix. Running ansible-galaxy collection install kubernetes.core --upgrade inside my venv solved the issue. Is this something I can contribute back to the project or is this a problem with my local environment?