generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add reuse_values and reset_values support to helm module (#575)
helm - add reuse_values and reset_values support SUMMARY closes #394 ISSUE TYPE Feature Pull Request COMPONENT NAME helm ADDITIONAL INFORMATION Reviewed-by: Mike Graves <[email protected]>
- Loading branch information
Showing
5 changed files
with
122 additions
and
2 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
changelogs/fragments/575-helm-add-support-for-reuse_values-and-reset_values.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
minor_changes: | ||
- helm - add reuse_values and reset_values support to helm module (https://github.com/ansible-collections/kubernetes.core/issues/394). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ test_namespace: | |
- "helm-local-path-003" | ||
- "helm-from-repository" | ||
- "helm-from-url" | ||
- "helm-reuse-values" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
tests/integration/targets/helm/tasks/test_helm_reuse_values.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
- name: Test helm reuse_values | ||
vars: | ||
helm_namespace: "{{ test_namespace[9] }}" | ||
chart_release_values: | ||
replica: | ||
replicaCount: 3 | ||
master: | ||
count: 1 | ||
kind: Deployment | ||
chart_reuse_values: | ||
replica: | ||
replicaCount: 1 | ||
master: | ||
count: 3 | ||
block: | ||
- name: Initial chart installation | ||
helm: | ||
binary_path: "{{ helm_binary }}" | ||
chart_ref: redis | ||
chart_repo_url: https://charts.bitnami.com/bitnami | ||
release_name: test-redis | ||
release_namespace: "{{ helm_namespace }}" | ||
create_namespace: true | ||
release_values: "{{ chart_release_values }}" | ||
register: install | ||
|
||
- name: Get value set as string | ||
helm_info: | ||
binary_path: "{{ helm_binary }}" | ||
release_name: test-redis | ||
release_namespace: "{{ helm_namespace }}" | ||
register: release_value | ||
|
||
- name: Validate that chart values are as expected | ||
assert: | ||
that: | ||
- install is changed | ||
- '"--reuse-values=True" not in install.command' | ||
- release_value["status"]["values"] == chart_release_values | ||
|
||
- name: Upgrade chart using reuse_values=true | ||
helm: | ||
binary_path: "{{ helm_binary }}" | ||
chart_ref: redis | ||
chart_repo_url: https://charts.bitnami.com/bitnami | ||
release_name: test-redis | ||
release_namespace: "{{ helm_namespace }}" | ||
reuse_values: true | ||
reset_values: false | ||
release_values: "{{ chart_reuse_values }}" | ||
register: upgrade | ||
|
||
- name: Get value set as string | ||
helm_info: | ||
binary_path: "{{ helm_binary }}" | ||
release_name: test-redis | ||
release_namespace: "{{ helm_namespace }}" | ||
register: release_value | ||
|
||
- name: Validate that chart values are as expected | ||
assert: | ||
that: | ||
- upgrade is changed | ||
- '"--reuse-values=True" in upgrade.command' | ||
- '"--reset-values" not in upgrade.command' | ||
- release_value["status"]["values"] == chart_release_values | combine(chart_reuse_values, recursive=true) | ||
|
||
always: | ||
- name: Remove helm namespace | ||
k8s: | ||
api_version: v1 | ||
kind: Namespace | ||
name: "{{ helm_namespace }}" | ||
state: absent |