-
Notifications
You must be signed in to change notification settings - Fork 274
Allow cluster-scoped instance CRDs via schema scope #885
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
138b7ee
47f1282
bcb1cc5
ca3260f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -516,10 +516,14 @@ func (igr *instanceGraphReconciler) setManaged( | |
|
|
||
| igr.instanceLabeler.ApplyLabels(instancePatch) | ||
|
|
||
| updated, err := igr.client.Resource(igr.gvr). | ||
| Namespace(obj.GetNamespace()). | ||
| Apply(ctx, instancePatch.GetName(), instancePatch, | ||
| metav1.ApplyOptions{FieldManager: FieldManagerForLabeler, Force: true}) | ||
| instanceClient := igr.client.Resource(igr.gvr) | ||
| var namespacedClient dynamic.ResourceInterface = instanceClient | ||
| if ns := obj.GetNamespace(); ns != "" { | ||
| namespacedClient = instanceClient.Namespace(ns) | ||
| } | ||
|
|
||
| updated, err := namespacedClient.Apply(ctx, instancePatch.GetName(), instancePatch, | ||
| metav1.ApplyOptions{FieldManager: FieldManagerForLabeler, Force: true}) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to update managed state: %w", err) | ||
| } | ||
|
|
@@ -552,10 +556,14 @@ func (igr *instanceGraphReconciler) setUnmanaged( | |
| return nil, fmt.Errorf("failed to remove finalizer: %w", err) | ||
| } | ||
|
|
||
| updated, err := igr.client.Resource(igr.gvr). | ||
| Namespace(obj.GetNamespace()). | ||
| Apply(ctx, instancePatch.GetName(), instancePatch, | ||
| metav1.ApplyOptions{FieldManager: FieldManagerForLabeler, Force: true}) | ||
| instanceClient := igr.client.Resource(igr.gvr) | ||
| var namespacedClient dynamic.ResourceInterface = instanceClient | ||
| if ns := obj.GetNamespace(); ns != "" { | ||
| namespacedClient = instanceClient.Namespace(ns) | ||
| } | ||
|
||
|
|
||
| updated, err := namespacedClient.Apply(ctx, instancePatch.GetName(), instancePatch, | ||
| metav1.ApplyOptions{FieldManager: FieldManagerForLabeler, Force: true}) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to update unmanaged state: %w", err) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespacedClientname is misleading IMO It could be cluster-scoped or namespaced client depending on the resourceI would suggest defining a
getGVRClientused here, in thesetUnmanagedand in thegetResourceClientfunction to ensure namespacing is well-managed everywhere