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

Set namespace when looking up resource with externalName #246

Closed
wants to merge 1 commit into from

Conversation

ctrox
Copy link

@ctrox ctrox commented Feb 25, 2021

Description of your changes

Set namespace when looking up resource with externalName.

Fixes #245

I have:

  • Read and followed Crossplane's [contribution process].
  • Run make reviewable test to ensure this PR is ready for review.

Fixes crossplane#245

Signed-off-by: Cyrill Troxler <cyrill@nine.ch>
@@ -687,7 +687,7 @@ func (r *Reconciler) Reconcile(_ context.Context, req reconcile.Request) (reconc
// of the loop. In that case, we warn the user that the external resource
// might be leaked.
err := retry.OnError(retry.DefaultRetry, resource.IsAPIError, func() error {
nn := types.NamespacedName{Name: managed.GetName()}
nn := types.NamespacedName{Name: managed.GetName(), Namespace: managed.GetNamespace()}
Copy link
Member

Choose a reason for hiding this comment

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

Managed resources are intended to be cluster-scoped and the machinery here is intended to accommodate that fact. Using namespace-scoped managed resources could impact other aspects of the managed reconciler, such as cross-resource references. Do you have an example of where you are currently using the managed reconciler successfully for a namespaced resource?

Copy link
Author

Choose a reason for hiding this comment

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

I was not aware of that :) I know that all included Crossplane providers only use cluster-scoped resources for their managed resources but so far nothing had stopped us using namespaced resources in our own provider. So far everything has worked but tbh we have not had to use cross-resource refs yet. If this is completely unsupported, I think there should be a more obvious way to tell us (docs or maybe even some check on controller start).

But of course my preference would be that this is somewhat supported so we can keep using it. I'm aware of all the other constructs that Crossplane provides to have namespaced resources (compositions, publications etc.) but sometimes that's just a bit too much configuration overhead for simple resources. So anyway, I don't have an example ready right now but there is not much to it besides setting +kubebuilder:resource:scope=Namespaced. I would prefer it if crossplane-runtime did not limit this use-case but maybe instead pointed at the limitations of it, like for example that cross-resource refs would just work if the other resource is cluster-scoped.

@ctrox
Copy link
Author

ctrox commented Mar 9, 2021

This turned out not to be a bug, I addressed the wider issue here: #251

@ctrox ctrox closed this Mar 9, 2021
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.

Namespaced resources with externalName fails to update
2 participants