-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
helm diff output #395
Comments
Hi @krisek Thanks for taking the time to report this feature. |
To clarify, a diff is currently returned if you are upgrading an existing release and you have the helm diff plugin installed. We do not generate a diff if you are installing a new release or if you do not have helm diff installed. I think we should be able to easily add the diff for installing new releases as this is supported by helm diff. I would not see us adding diff support without helm diff installed in the near future, though, as this would be a significant amount of effort. |
Yes, without helm diff it is definitely a mission impossible. The background is that I'm working on a CI/CD pipeline that has a dry-run feature -- to help the operator to see what would happen if the pipeline were really ran. |
@krisek , you can achieve something like this by comparing the current and future release with helm_template and fact_diff. Pseudo code: - name: "{{ release_name }} : fetch existing release info"
kubernetes.core.helm_info:
release_name: "{{ release_name }}"
release_namespace: "{{ release_namespace }}"
check_mode: false
changed_when: false
when: ansible_diff_mode
register: existing_info
- name: "{{ release_name }} : render existing release"
kubernetes.core.helm_template:
chart_version: "{{ existing_info['status']['chart'][(chart_name|length + 1):] }}" # cut version from "somechart-1.2.3"
release_values: "{{ existing_info['status']['values'] }}" # use values from last release
validate: true # opened pull request #587 for this one
...
...
register: existing_tpl
- name: "{{ release_name }} : render new release"
kubernetes.core.helm_template:
chart_version: "{{ new_version }}"
release_values "{{ new_release_values }}"
...
...
register: new_tpl
- name: "{{ release_name }} : diff"
ansible.utils.fact_diff:
before: "{{ existing_tpl.stdout|default('')|trim }}"
after: "{{ new_tpl.stdout|trim }}"
...
changed_when: existing_tpl.stdout|default('')|trim != new_tpl.stdout|trim
Pull request for |
SUMMARY
The Kubernetes returns with
--check --diff
CLI parameters, the actual diff that would be applied on the cluster. It would be great if the helm module would do the same.ISSUE TYPE
COMPONENT NAME
helm.py
ADDITIONAL INFORMATION
It would be a great enhancement for CI/CD pipelines.
ansible-playbook -i inventory.yaml -e variable_host="play" --check --diff basic-service-deploy.yaml
The text was updated successfully, but these errors were encountered: