Skip to content

Conversation

noahlehmann
Copy link
Contributor

SUMMARY

Added the option insecure_skip_tls_verify to the following helm modules:

  • helm_repository
  • helm
  • Unified the option with alias in helm_pull

For helm, added the option to the helm diff call, as it got fixed upstream.

Upstream Issue: databus23/helm-diff#503
Fixed with: helm/helm#12856

Fixes #694

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • kubernetes.core.helm
  • kubernetes.core.helm_repository
  • kubernetes.core.helm_pull
ADDITIONAL INFORMATION

Basically the option was added in the parameters set in the ansible job, in the docs and then injected in the helm and helm diff binary calls if set. Defaults to False.

Example
---
- name: Test helm modules
  tasks:
    - name: Test helm repository insecure
      kubernetes.core.helm_repository:
        name: insecure
        repo_url: "<helm-repo-with-self-signed-tls>"
        state: present
        insecure_skip_tls_verify: true
    - name: Test helm pull insecure
      kubernetes.core.helm_pull:
        chart_ref: "oci://<helm-repo-with-self-signed-tls>/ptroject"
        destination: /tmp
        insecure_skip_tls_verify: true
    - name: Test helm insecure
      kubernetes.core.helm:
        name: insecure
        chart_ref: "oci://<helm-repo-with-self-signed-tls>/project"
        namespace: helm-insecure-test
        state: present
        insecure_skip_tls_verify: true
Note

Might need an alias for telm_template, as the option is called insecure_registry, in the manual and docs of helm it would be --insecure-skip-tls-verify as well though.
Not included, as it was recently merged with #805

Copy link

@noahlehmann
Copy link
Contributor Author

@yurnov thanks for checking in. Bumped the version_added field to 5.3.0 for now, can change to 6.0.0 whenever needed. Let me know.

Copy link

Copy link
Contributor

@abikouo abikouo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noahlehmann, thanks for your contribution to this collection.
It would be nice to add unit or integration tests related to this new feature.

@yurnov
Copy link
Contributor

yurnov commented Apr 25, 2025

Hi @noahlehmann,

Do you need support with fixing CI issues (most of them will be fixed by the rebase and the remaining pat is basically linters) and test?

Copy link

@noahlehmann
Copy link
Contributor Author

@yurnov Thanks, but got the linting jobs fixed.

@abikouo The only reasonable test I can think of in the setup is unit testing the helm command to check whether the flag --insecure-skip-tls-verify is set/not-set properly. Preparing a testable helm registry seams way overkill, considering the integration tests seems to run on a fixed repo (ingress-nginx).

I also only see unit tests for complex tasks in the modules helm and helm_template.

Maybe you could guide me on what you had in mind?

@yurnov
Copy link
Contributor

yurnov commented Apr 25, 2025

@yurnov Thanks, but got the linting jobs fixed.

@abikouo The only reasonable test I can think of in the setup is unit testing the helm command to check whether the flag --insecure-skip-tls-verify is set/not-set properly. Preparing a testable helm registry seams way overkill, considering the integration tests seems to run on a fixed repo (ingress-nginx).

I also only see unit tests for complex tasks in the modules helm and helm_template.

Maybe you could guide me on what you had in mind?

I suggest adding an additional integration test in the same way as here

So, in your case, it will be something like:

    - name: Install chart with insecure-skip-tls-verify
      helm:
        binary_path: "{{ helm_binary }}"
        chart_ref: oci://registry-1.docker.io/bitnamicharts/redis
        release_name: test-redis
        release_namespace: "{{ helm_namespace }}"
        create_namespace: true
        release_values: "{{ chart_release_values }}"
        insecure_skip_tls_verify: true
      register: install

    - name: Assert that --insecure-skip-tls-verify is used
      assert:
        that:
          - install is changed
          - '"--insecure-skip-tls-verify" in install.command'
          - '"--tls" not in install.command'
          - '"--ca-file" not in install.command'

@noahlehmann
Copy link
Contributor Author

@yurnov understood, thanks.

I intentionally left out the mutual exclusion of the ca-file flag, as helm itself doesn't care as well. As far as I could tell at least.

Copy link

@yurnov
Copy link
Contributor

yurnov commented Apr 26, 2025

@yurnov understood, thanks.

I intentionally left out the mutual exclusion of the ca-file flag, as helm itself doesn't care as well. As far as I could tell at least.

I added '"--ca-file" not in install.command' just as an example, that is not required at all

…kip-tls-verify

# Conflicts:
#	plugins/modules/helm.py
#	tests/integration/targets/helm/defaults/main.yml
@noahlehmann
Copy link
Contributor Author

Updated the changes, last merge to main had conflicts with this PR.
Tested and formatted.

Copy link

Copy link

…t if the CRD is installed prior running the test
Copy link

@abikouo abikouo added the mergeit label May 2, 2025
Copy link

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/bdbd308ecf8b4da28f6f2b174a246fa1

✔️ ansible-galaxy-importer SUCCESS in 5m 46s
✔️ build-ansible-collection SUCCESS in 5m 26s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 914a16e into ansible-collections:main May 2, 2025
53 checks passed
Copy link

patchback bot commented May 2, 2025

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/914a16ec5cfb806ccc529d610295c9481da4566b/pr-901

Backported as #925

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request May 2, 2025
SUMMARY
Added the option insecure_skip_tls_verify  to the following helm modules:

helm_repository
helm
Unified the option with alias in helm_pull

For helm, added the option to the helm diff call, as it got fixed upstream.
Upstream Issue: databus23/helm-diff#503
Fixed with: helm/helm#12856
Fixes #694
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

kubernetes.core.helm
kubernetes.core.helm_repository
kubernetes.core.helm_pull

ADDITIONAL INFORMATION
Basically the option was added in the parameters set in the ansible job, in the docs and then injected in the helm and helm diff binary calls if set. Defaults to False.
Example
---
- name: Test helm modules
  tasks:
    - name: Test helm repository insecure
      kubernetes.core.helm_repository:
        name: insecure
        repo_url: "<helm-repo-with-self-signed-tls>"
        state: present
        insecure_skip_tls_verify: true
    - name: Test helm pull insecure
      kubernetes.core.helm_pull:
        chart_ref: "oci://<helm-repo-with-self-signed-tls>/ptroject"
        destination: /tmp
        insecure_skip_tls_verify: true
    - name: Test helm insecure
      kubernetes.core.helm:
        name: insecure
        chart_ref: "oci://<helm-repo-with-self-signed-tls>/project"
        namespace: helm-insecure-test
        state: present
        insecure_skip_tls_verify: true
Note
Might need an alias for telm_template, as the option is called insecure_registry, in the manual and docs of helm it would be --insecure-skip-tls-verify as well though.
Not included, as it was recently merged with #805

Reviewed-by: Yuriy Novostavskiy
Reviewed-by: Noah Lehmann
Reviewed-by: Bikouo Aubin
Reviewed-by: Bianca Henderson <[email protected]>
Reviewed-by: Mike Graves <[email protected]>
(cherry picked from commit 914a16e)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request May 6, 2025
This is a backport of PR #901 as merged into main (914a16e).
SUMMARY
Added the option insecure_skip_tls_verify  to the following helm modules:

helm_repository
helm
Unified the option with alias in helm_pull

For helm, added the option to the helm diff call, as it got fixed upstream.
Upstream Issue: databus23/helm-diff#503
Fixed with: helm/helm#12856
Fixes #694
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

kubernetes.core.helm
kubernetes.core.helm_repository
kubernetes.core.helm_pull

ADDITIONAL INFORMATION
Basically the option was added in the parameters set in the ansible job, in the docs and then injected in the helm and helm diff binary calls if set. Defaults to False.
Example
---
- name: Test helm modules
  tasks:
    - name: Test helm repository insecure
      kubernetes.core.helm_repository:
        name: insecure
        repo_url: "<helm-repo-with-self-signed-tls>"
        state: present
        insecure_skip_tls_verify: true
    - name: Test helm pull insecure
      kubernetes.core.helm_pull:
        chart_ref: "oci://<helm-repo-with-self-signed-tls>/ptroject"
        destination: /tmp
        insecure_skip_tls_verify: true
    - name: Test helm insecure
      kubernetes.core.helm:
        name: insecure
        chart_ref: "oci://<helm-repo-with-self-signed-tls>/project"
        namespace: helm-insecure-test
        state: present
        insecure_skip_tls_verify: true
Note
Might need an alias for telm_template, as the option is called insecure_registry, in the manual and docs of helm it would be --insecure-skip-tls-verify as well though.
Not included, as it was recently merged with #805

Reviewed-by: Bianca Henderson <[email protected]>
Reviewed-by: Mike Graves <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

validate_certs=no not work in helm module
5 participants