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 reset_then_reuse_values support to helm module #802

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

b0z02003
Copy link

@b0z02003 b0z02003 commented Nov 30, 2024

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
  • Feature Pull Request
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.

Copy link

@b0z02003 b0z02003 force-pushed the helm_reset_then_reuse_values branch from 01b422e to 6486e64 Compare December 14, 2024 16:48
Copy link

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.

@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.

plugins/modules/helm.py Outdated Show resolved Hide resolved
plugins/modules/helm.py Outdated Show resolved Hide resolved
Copy link

@b0z02003
Copy link
Author

@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).

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.

This will address linters issues

if reset_then_reuse_values:
helm_version = module.get_helm_version()
if LooseVersion(helm_version) < LooseVersion("3.14.0"):
module.warn("helm support option --reset-then-reuse-values starting release >= 3.14.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
module.warn("helm support option --reset-then-reuse-values starting release >= 3.14.0")
module.warn(
"helm support option --reset-then-reuse-values starting release >= 3.14.0"
)

if LooseVersion(helm_diff_version) < LooseVersion("3.9.12"):
module.warn("helm diff support option --reset-then-reuse-values starting release >= 3.9.12")
elif LooseVersion(helm_version) < LooseVersion("3.14.0"):
module.warn("helm support option --reset-then-reuse-values starting release >= 3.14.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
module.warn("helm support option --reset-then-reuse-values starting release >= 3.14.0")
module.warn(
"helm support option --reset-then-reuse-values starting release >= 3.14.0"
)

helm_diff_version = get_plugin_version("diff")
helm_version = module.get_helm_version()
if LooseVersion(helm_diff_version) < LooseVersion("3.9.12"):
module.warn("helm diff support option --reset-then-reuse-values starting release >= 3.9.12")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
module.warn("helm diff support option --reset-then-reuse-values starting release >= 3.9.12")
module.warn(
"helm diff support option --reset-then-reuse-values starting release >= 3.9.12"
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for reset_then_reuse_values to helm upgrade
3 participants