helm: add support for the K8S_ envvars (#319)

Add support for:

- K8S_AUTH_HOST
- K8S_AUTH_API_KEY
- K8S_AUTH_VERIFY_SSL
- K8S_AUTH_SSL_CA_CERT

This commit also refactor the way we pass K8S related configuration to `helm`:

All the calls are now done in a new module_utils module (`helm.py`).
The handling of the `kube_*` variables has also been moved in this new
module.

We need https://github.com/helm/helm/pull/8622 to be able to ignore the
certificate validation. As a workaround, the generate a temporary
kubeconfig configuration file.

Closes: #279
This commit is contained in:
Gonéri Le Bouder
2020-12-11 11:41:08 -05:00
committed by GitHub
parent 5d3e465672
commit 221631c06a
13 changed files with 340 additions and 126 deletions

View File

@@ -12,6 +12,9 @@
- name: "Install {{ helm_version }}"
include_tasks: install.yml
- name: "Ensure we honor the environment variables"
include_tasks: test_read_envvars.yml
- name: tests_repository
include_tasks: tests_repository.yml

View File

@@ -0,0 +1,10 @@
- name: Pass a bogus server through the K8S_AUTH_HOST environment variable and ensure helm fails as expected
helm:
binary_path: "{{ helm_binary }}"
state: absent
name: does-not-exist
namespace: "{{ helm_namespace }}"
environment:
K8S_AUTH_HOST: somewhere
register: _helm_result
failed_when: '"http://somewhere/version" not in _helm_result.stderr'