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

Support granular management policies #336

Merged
merged 8 commits into from
Jul 31, 2023
Merged

Conversation

lsviben
Copy link
Contributor

@lsviben lsviben commented Jul 17, 2023

Description of your changes

ManagementPolicy -> granular ManagementPolicies

Adds support for granular management policies described based on the design.

This is a breaking change for the management policies alpha feature. (ObserveOnly)

The old

spec:
  managmentPolicy: FullControl/ObserveOnly/OrphanOnDelete

is getting replaced by

spec: 
  managementPolicies: ["*", "Observe", "Create", "Update", "LateInitialize", "Delete"]

After applying the updated provider, the spec.managementPolicy field will be removed automatically, and the spec.managementPolicies: ["*"] will be defaulted. This is equivalent to FullControl but for resources using ObserveOnly and OrphanOnDelete the it meanst that the behavior changes.

Suggested migration if needed is to:

  • pause your resources using non-default management policies before upgrading the provider version
  • noting down which ones those are (could be by adding labels managementPolicy: x )
  • upgrading provider version
  • setting desired management policies on the marked ones (those with label managementPolicy)

initProvider

The new upjet version introduces the spec.initProvider field, which can be used to set fields which can replace spec.forProvider fields during resource creation.

In practice, how it works is that spec.initProvider and spec.forProvider are merged before writing the main.tf file, plus based on fields in spec.initProvider which are not in spec.forProvider we calculate a list of fields which are added to the ignore_changes terraform hook, to avoid them being used in updates.

Both new features are only active if the managementPolicy alplha feature flag is enabled.

** NOTE: This PR uses an unmerged branch of upjet, should be merged after it **

Fixes #334

I have:

  • Run make reviewable test to ensure this PR is ready for review.

Running above crashes on my machine :(.

How has this code been tested

The granular policies were tested with crossplane-runtime gmp PR & crossplane/upjet#224. More details in the crossplane-runtime PR.

The initProvider was tested with initProvider upjet PR. More details there

@turkenf
Copy link
Collaborator

turkenf commented Jul 31, 2023

/test-examples="examples/container/nodepool.yaml"

@turkenf
Copy link
Collaborator

turkenf commented Jul 31, 2023

/test-examples="examples/container/cluster.yaml"

@turkenf
Copy link
Collaborator

turkenf commented Jul 31, 2023

/test-examples="examples/cloudplatform/serviceaccount.yaml"

1 similar comment
@ulucinar
Copy link
Collaborator

/test-examples="examples/cloudplatform/serviceaccount.yaml"

Signed-off-by: lsviben <sviben.lovro@gmail.com>
Signed-off-by: lsviben <sviben.lovro@gmail.com>
Signed-off-by: lsviben <sviben.lovro@gmail.com>
Signed-off-by: lsviben <sviben.lovro@gmail.com>
Signed-off-by: lsviben <sviben.lovro@gmail.com>
Signed-off-by: lsviben <sviben.lovro@gmail.com>
Signed-off-by: lsviben <sviben.lovro@gmail.com>
@turkenf
Copy link
Collaborator

turkenf commented Jul 31, 2023

/test-examples="examples/cloudplatform/serviceaccount.yaml"

@ulucinar
Copy link
Collaborator

/test-examples="examples/cloudplatform/serviceaccount.yaml"

Copy link
Collaborator

@ulucinar ulucinar left a comment

Choose a reason for hiding this comment

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

Thanks @lsviben, lgtm.

Copy link
Collaborator

@turkenf turkenf left a comment

Choose a reason for hiding this comment

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

Thank you @lsviben, LGTM.

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
@turkenf
Copy link
Collaborator

turkenf commented Jul 31, 2023

/test-examples="examples/cloudplatform/serviceaccount.yaml"

@turkenf turkenf merged commit 0fa3ecb into crossplane-contrib:main Jul 31, 2023
8 checks passed
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.

Support granular management policies
3 participants