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

Detect drifts between the manifest and its live Kubernetes resources #1442

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

Conversation

chotiwat
Copy link
Contributor

@chotiwat chotiwat commented Jul 25, 2024

Description

This PR aims to address #1095 by performing a dry-run, server-side apply of the manifest during planning, which allows Terraform to detect any changes to the Kubernetes resources managed by the Helm release.

Mini Changelog

  • Introduce a new resources attribute which tracks Kubernetes resources managed by the deployed Helm release
    • The attribute is a map of resource key to resource JSON string.
    • Fields managed by kube-controller-manager or updated via subresource APIs (e.g. /status and /scale) are removed to avoid perpetual drifts.
    • Sensitive values are redacted like in the manifest attribute.
    • Fields like uid, creationTimestamp, resourceVersion, and managedFields are scrubbed to prevent the inconsistent final plan issue.
  • Generate a new version of resources during planning using a dry-run, server-side apply for diffing
  • Add acceptance tests to confirm that Kubernetes resources are reconciled when they are modified or deleted

Acceptance tests

  • Have you added an acceptance test for the functionality being added?

Release Note

Release note for CHANGELOG:

`resource/helm_release`: add `resources` map attribute to allow drift detection against live kubernetes resources [GH-1095](https://github.com/hashicorp/terraform-provider-helm/issues/1095)

References

#1095
#1239

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

@chotiwat chotiwat requested a review from a team as a code owner July 25, 2024 01:19
Copy link

hashicorp-cla-app bot commented Jul 25, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@zifeo
Copy link

zifeo commented Oct 12, 2024

@BBBmau is there a way we could get your review on that one 🙏 ?

Copy link
Contributor

@sheneska sheneska left a comment

Choose a reason for hiding this comment

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

Hi @chotiwat, thanks for the changes. Could you please add a change log?

@chotiwat
Copy link
Contributor Author

@sheneska done

Copy link
Contributor

@sheneska sheneska left a comment

Choose a reason for hiding this comment

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

Hi @chotiwat , thank you for your proposed changes! We are currently working on migrating from the SDK to framework plugin, once this is completed we can proceed with reviewing this PR.

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

Successfully merging this pull request may close these issues.

3 participants