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

Prevent superfluous external-name annotation on XRs #2353

Merged
merged 5 commits into from
Jul 1, 2021

Conversation

ulucinar
Copy link
Contributor

@ulucinar ulucinar commented Jun 4, 2021

Signed-off-by: Alper Rifat Ulucinar ulucinar@users.noreply.github.com

Description of your changes

Fixes #2350

I have:

  • [X ] Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Using getting-started guide's aws (with default VPC) configuration, I provisioned an XR via its claim. The superfluous external-name annotation is not observed. Please see the comment below for the semantics of this change.

@ulucinar
Copy link
Contributor Author

ulucinar commented Jun 4, 2021

The semantics of this change are as follows. The context is the interaction between a claim and the corresponding XR. external-name below refers to the external-name annotation:

  • For already existing XRs (statically provisioned), the source of truth for the external-name is the XR. Even if an external-name is provided for the claim, claim's external-name is reconciled to (statically provisioned) XR's claim, and it's removed if the (statically provisioned) XR does not contain an external-name. This is motivated by
    // It's possible we're being asked to configure a statically provisioned
  • We no longer add a superfluous external-name if the claim does not have one (and XR is dynamically-provisioned (via the claim))
  • For dynamically-provisioned XRs (via their claims) if the claim contains an external-name annotation, it's also used for the XR. And as explained above, external-name on the claim is reconciled from the XR's external-name. This is motivated by:
    // Propagate the actual external name back from the composite to the claim.

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

ulucinar commented Jun 25, 2021

We now have a behavior change in case there is a mismatch between a claim's external-name and the bound XR's external name: Controller now returns an error and refuses to reconcile the XR with the following error message:

mismatch of external names between claim and composite resource

- Assert an error if claim's and bound statically provisioned
  XR's external-names do not match

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

@negz negz left a comment

Choose a reason for hiding this comment

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

This looks good to me, apart from a few small nits.

WRT whether we return an error or overwrite the claim's external name when they conflict, I don't feel strongly either way. You make a good point at #2353 (comment) @ulucinar and I'd also be happy to approve the variant you suggest if you feel that is the better path.

internal/controller/apiextensions/claim/api.go Outdated Show resolved Hide resolved
internal/controller/apiextensions/claim/configurator.go Outdated Show resolved Hide resolved
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
Copy link
Member

@negz negz left a comment

Choose a reason for hiding this comment

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

This looks great @ulucinar! Thank you. Let me know when you're ready for me to merge this.

internal/controller/apiextensions/claim/api_test.go Outdated Show resolved Hide resolved
internal/controller/apiextensions/claim/api.go Outdated Show resolved Hide resolved
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
@ulucinar
Copy link
Contributor Author

ulucinar commented Jul 1, 2021

Hi @negz,
After the backport changes are merged into their respective release branches, do we follow the same release procedure as wesaas for instance? I think I have read something in the lines of accumulating and releasing things in batches for crossplane, is this correct? Do I need to do anything else after this is merged?

@negz
Copy link
Member

negz commented Jul 1, 2021

@ulucinar I think we will want to include these in patch release "soon", but whether we release patch releases just for this bug or wait for a few more to build up is pretty open ended. We should definitely get the backports done, but we might want to hold off a little to see if we can get a few more bugs fixed before we cut patch releases.

@github-actions
Copy link

github-actions bot commented Jul 1, 2021

Successfully created backport PR #2419 for release-1.1.

@github-actions
Copy link

github-actions bot commented Jul 1, 2021

Successfully created backport PR #2420 for release-1.2.

@github-actions
Copy link

github-actions bot commented Jul 1, 2021

Successfully created backport PR #2421 for release-1.3.

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

Successfully merging this pull request may close these issues.

Composite reconciler initializes with empty string for external name
3 participants