ansible-collections / community.kubernetes

Kubernetes Collection for Ansible
https://galaxy.ansible.com/community/kubernetes
GNU General Public License v3.0
265 stars 104 forks source link

helm doesn't detect changes in kubernetes objects #207

Closed ncauchois closed 4 years ago

ncauchois commented 4 years ago

SUMMARY

If you make changes directly in a kubernetes object as deployment, helm will not detect these changes and redeploy with good values.

ISSUE TYPE
COMPONENT NAME

community.kubernetes.helm

ANSIBLE VERSION
ansible 2.9.9
  config file = None
  configured module search path = ['/home/awesomeuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jul 20 2020, 23:11:29) [GCC 9.3.0]
OS / ENVIRONMENT

debian

STEPS TO REPRODUCE
  1. Release the chart
    community.kubernetes.helm:
    release_name: logs
    chart_ref: ../../kubernetes/helm-loki/
    release_namespace: logging
    atomic: true
    wait: true
    wait_timeout: 10m
    values: "{{ lookup('template', 'loki.yaml.j2') | from_yaml }}"
  2. Edit kubernetes deployment and change memory resource request. kubectl edit deploy xxx
  3. Release the chart again
EXPECTED RESULTS

I'd expect that the memory resource request change is detected and helm corrects this change.

ACTUAL RESULTS

The module doesn't detect the change and nothing is released.

ok: [localhost] => changed=false
Akasurde commented 4 years ago

@ncauchois Thanks for reporting this issue. Do you think this is similar to https://github.com/ansible-collections/community.kubernetes/issues/128?

ncauchois commented 4 years ago

@Akasurde yes it looks like, but I don't know if it's exactly the same problem.

ncauchois commented 4 years ago

The problem comes from here: https://github.com/ansible-collections/community.kubernetes/blob/e9d8bf703bcb9bced1ae327d99be99e907d7d83a/plugins/modules/helm.py#L476. The helm command is never launched if there is no force, differences between the values ​​or on the version of the chart.

tima commented 4 years ago

We're going to fold addressing this and other related issues into #248.