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
214 stars 133 forks source link

set_values not being deployed with helm #732

Closed vivian-rook closed 4 months ago

vivian-rook commented 4 months ago
SUMMARY

Addition of set_values to helm not detected

ISSUE TYPE
COMPONENT NAME

kubernetes.core.helm

ANSIBLE VERSION
$ ansible --version
ansible [core 2.16.7]
  config file = None
  configured module search path = ['/home/rook/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/rook/paws/.venv/deploy/lib/python3.11/site-packages/ansible
  ansible collection location = /home/rook/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/rook/paws/.venv/deploy/bin/ansible
  python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/home/rook/paws/.venv/deploy/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
$ ansible-galaxy collection list community.general

# /home/rook/paws/.venv/deploy/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 8.6.1
CONFIGURATION
CONFIG_FILE() = /home/rook/paws/ansible/ansible.cfg
DEFAULT_STDOUT_CALLBACK(/home/rook/paws/ansible/ansible.cfg) = debug
EDITOR(env: EDITOR) = vim
OS / ENVIRONMENT

Debian 12

STEPS TO REPRODUCE

Deploy ingress-nginx first without set_values:

    - name: Deploy ingress-nginx
      kubernetes.core.helm:
        name: ingress-nginx
        chart_ref: ingress-nginx
        chart_repo_url: https://kubernetes.github.io/ingress-nginx
        chart_version: 4.10.1
        release_namespace: ingress-nginx
        create_namespace: true

Deploy again with set_values:

    - name: Deploy ingress-nginx
      kubernetes.core.helm:
        name: ingress-nginx
        chart_ref: ingress-nginx
        chart_repo_url: https://kubernetes.github.io/ingress-nginx
        chart_version: 4.10.1
        release_namespace: ingress-nginx
        create_namespace: true
        set_values:
          - value: controller.service.type=NodePort
            value_type: string
          - value: controller.service.enableHttps=false
            value_type: string
          - value: controller.service.nodePorts.http=30001
            value_type: string
          - value: controller.config.proxy-body-size=4m
            value_type: string
          - value: controller.config.allow-snippet-annotations=true
            value_type: string
EXPECTED RESULTS

set values are deployed. NodePort used, port 30001 set, etc.

ACTUAL RESULTS

set values are not deployed. ingress-nginx remains on default with load balancer rather than NodePort Seen with kubectl get all -n ingress-nginx

Of note. This does seem to work if the set_values are set and deploy to a newly deploy k8s cluster. But does not seem to work as an update to an existing deployment. Also the set_values can be removed from an existing deployment, but then will not be added back if added back to the playbook.

gravesm commented 4 months ago

I'm not able to reproduce this problem. What version of the collection are you using? You provided the version for community.general, not kubernetes.core.

vivian-rook commented 4 months ago

How do I get the version of kubernetes.core?

gravesm commented 4 months ago

$ ansible-galaxy collection list kubernetes.core

vivian-rook commented 4 months ago
$ ansible-galaxy collection list kubernetes.core

# /home/rook/paws/.venv/deploy/lib/python3.11/site-packages/ansible_collections
Collection      Version
--------------- -------
kubernetes.core 2.4.2  
gravesm commented 4 months ago

This was fixed in version 3.0.1. You can also use force: true in your second deploy task, but I would just recommend upgrading to the latest version (4.0.0). There have been a number of bugfixes to the helm module since 2.4.2.