-
Notifications
You must be signed in to change notification settings - Fork 140
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 reset_then_reuse_values support to helm module #802
base: main
Are you sure you want to change the base?
add reset_then_reuse_values support to helm module #802
Conversation
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 32s |
01b422e
to
6486e64
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 5m 13s |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 51s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@b0z02003 Thanks for submitting this PR.
In addition to the requested changes, you must include the new test files in main.yml
of the corresponding integration test targets.
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 48s |
@abikouo Thanks for the suggestions ! I've tried to improve on them to also check for helm version and added the integration tests (that was a big oversight on my part, my bad). |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 14s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will address linters issues
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 18s |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 50s |
@b0z02003 Some tests are failing because you need to rebase your branch with the |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 56s |
f771f25
to
6ff5f87
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 49s |
I see some race conditions:
|
within this commit helm and helm diff plugin updated to versions that suppots --reset-then-reuse-values, fixed a few small CI fault and added tests for older version to ensure warning message. Race condition fixed by using separate namespace. --reset-then-reuse-values flag to 'helm upgrade' supported starting from 3.14.0 ref: https://github.com/helm/helm/releases/tag/v3.14.0, helm/helm@a9d59f9
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 5m 05s |
I have fixed this race condition and all other parts of the integration test for this PR and added a test to ensure that a warning appears in case of older versions of Helm and Helm diff, so the CI part is fully OK. However, I still have a not resolved question: Should we have just a warning message and skips of the unsupported option
And same here: I'm not sure, looking for suggestions from repo maintainers and @b0z02003. |
plugins/modules/helm.py
Outdated
if reset_then_reuse_values: | ||
helm_version = module.get_helm_version() | ||
if LooseVersion(helm_version) < LooseVersion("3.14.0"): | ||
module.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it it ok to have worning, or better to change to fail like:
module.fail_json(
msg='helm support option --reset-then-reuse-values starting release >= 3.14.0',
**opt_result
just to avoid a case when helm will runs without --reset-then-reuse-values
with unexpected result in CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, we should fail when trying to use that kind of unsupported feature, I updated the PR accordingly. However, I did not include the **opt_result
part (nor any parameter other than msg
) since the failure is not the result of a command execution. I also changed the message to better reflect the versioning status and to better match the messages I found in the collection, are you OK with that?
plugins/modules/helm.py
Outdated
helm_diff_version = get_plugin_version("diff") | ||
helm_version = module.get_helm_version() | ||
if LooseVersion(helm_diff_version) < LooseVersion("3.9.12"): | ||
module.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 50s |
Hi @b0z02003, you committed to testing in CI https://github.com/ansible-collections/kubernetes.core/actions/runs/12853271360/job/35836239457, and all tests passed. |
if reset_then_reuse_values: | ||
helm_diff_version = get_plugin_version("diff") | ||
helm_version = module.get_helm_version() | ||
if LooseVersion(helm_diff_version) < LooseVersion("3.9.12"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a case when both requirement aren't meet, the only fist check will be executed and only reset_then_reuse_values requires helm diff >= 3.9.12, current version is {0}
will be on fail message.
So, it better to check both conditions and have a message that contains helm, helm diff or both, depends on versions installed.
If you don't mind, I will prepare commit that improve this part
the main idea to check both versions and print both version in single run before this commit a failed two requrement will cause only single version in error message
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 06s |
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 46s |
no feature release planned in stable-5 branch
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 24s |
SUMMARY
Starting with version 3.14.0, Helm supports
--reset-then-reuse-values
. As discussed on the original PR. This greatly improves on--reuse-values
as it allows to avoid templates errors when new features are added to an upgraded chart.Closes #803
ISSUE TYPE
COMPONENT NAME
helm
ADDITIONAL INFORMATION
This PR is greatly 'inspired' by #575 and because I wasn't sure how I could provide additional tests for it, I actually copied those build previously for
--reuse-values
(as it is an improvement on this feature.