Skip to content
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

Add dependency update command to Helm module #191

Closed
WissemChb opened this issue Jul 28, 2021 · 2 comments · Fixed by #208
Closed

Add dependency update command to Helm module #191

WissemChb opened this issue Jul 28, 2021 · 2 comments · Fixed by #208
Labels
has_pr topic/helm Issues relating to helm plugins type/enhancement New feature or request

Comments

@WissemChb
Copy link
Contributor

SUMMARY

I'm using the Kubernetes.core.helm module to deploy charts. But, if I'm not mistaken, I found that there is no way to pull helm sub-charts when using helm dependency.

ISSUE TYPE
  • Add the command helm dependency update in the module.
COMPONENT NAME

helm

ADDITIONAL INFORMATION

We add an Ansible task parameter dependency_update: true|false(default false) that enable/disable the helm dependency update.

- name: Deploy Grafana chart using values files on target
  kubernetes.core.helm:
    name: test
    chart_ref: stable/grafana
    dependency_update: true #Enable dependency update
    release_namespace: monitoring
    values_files:
      - /path/to/values.yaml
@gravesm
Copy link
Member

gravesm commented Jul 29, 2021

@WissemChb Thanks for filing this feature request. You are correct that there is currently no way to do this using the helm module.

@gravesm gravesm added topic/helm Issues relating to helm plugins type/enhancement New feature or request labels Jul 29, 2021
@WissemChb
Copy link
Contributor Author

Thank you for your response, so I'll start adding this feature.

@gravesm gravesm linked a pull request Aug 19, 2021 that will close this issue
@gravesm gravesm added the has_pr label Aug 19, 2021
softwarefactory-project-zuul bot pushed a commit that referenced this issue Apr 26, 2022
Add helm dependency update

SUMMARY

Execute the helm dependency update under the hood when found dependencies block in Chart.yaml file.
Support the execution of:

Standalone dependency update by executing: helm dependency update CHART
Inline dependency update when specifying the helm chart_repo_url by adding --dependency-update to the helm install command.


ISSUE TYPE


Feature Pull Request #191

COMPONENT NAME

helm, helm_template
ADDITIONAL INFORMATION





There is a doc generated for history_max option for the helm module. I think that is not generated in the previous PR #164.


There is others changes affect the docs/ folder when I run the collection_prep_add_docs -p .  command. These changes are added in the last commit  64eab40. I let you decide rather we keep the commit or remove it.


The --dependency-update insertion option is tested used a local helm chart repository create via docker. So here are the tasks that test this feature.  Maybe if we create a GitHub repository for the helm chart, we can add this test code in the CI pipeline.


# Test The update dependency with chart_repo_url
- name: "Test chart without dependencies block and chart_repo_url defined"
  block:
    - name: "Test chart without dependencies block and chart_repo_url defined"
      helm:
        binary_path: "{{ helm_binary }}"
        name: test
        chart_ref: "ingress-nginx"
        chart_repo_url: https://kubernetes.github.io/ingress-nginx
        chart_version: "{{ chart_source_version | default(omit) }}"
        namespace: "{{ helm_namespace }}"
        create_namespace: yes
      register: release

    - assert:
        that:
          - "'--dependency-update' not in release.command"
          - "'upgrade' in release.command"
        success_msg: "Command does not contains '--dependency-update' options"
        fail_msg: "Command contains '--dependency-update' options"

- name: "Test chart with dependencies block and chart_repo_url defined and replace True"
  block:
    - name: "Test chart with dependencies block and chart_repo_url defined and replace True"
      helm:
        binary_path: "{{ helm_binary }}"
        name: test1
        chart_ref: "dep_up"
        chart_repo_url: http://repo:8080/charts
        chart_version: "{{ chart_source_version | default(omit) }}"
        namespace: "{{ helm_namespace }}"
        create_namespace: yes
        replace: true
      register: release
    - debug: var=release
    - assert:
        that:
          - "'--dependency-update' in release.command"
          - "'install' in release.command"
        success_msg: "Command contains '--dependency-update' options with helm install command"
        fail_msg: "Command not contains '--dependency-update' with helm install command"

- name: "Test chart with dependencies block and chart_repo_url defined and replace False fails"
  block:
    - name: "Test chart with dependencies block and chart_repo_url defined and replace False fails"
      helm:
        binary_path: "{{ helm_binary }}"
        name: test2
        chart_ref: "dep_up"
        chart_repo_url: http://repo:8080/charts
        chart_version: "{{ chart_source_version | default(omit) }}"
        namespace: "{{ helm_namespace }}"
        create_namespace: yes
        replace: false
      register: release
      ignore_errors: true

    - assert:
        that:
          - release.failed
          - release.msg == "'--dependency-update' hasn't been supported yet with 'helm upgrade'. Please use 'helm install' instead by adding 'replace' option"
        success_msg: "Command build fail when adding  '--dependency-update' with the helm upgrade command"

Reviewed-by: Mike Graves <mgraves@redhat.com>
Reviewed-by: Wissem BEN CHAABANE <benchaaben.wissem@gmail.com>
Reviewed-by: Bikouo Aubin <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has_pr topic/helm Issues relating to helm plugins type/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants