-
Notifications
You must be signed in to change notification settings - Fork 398
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
Labels sync targets with the SyncTargetKey for reverse lookup #1672
Conversation
1163243
to
ebdecd3
Compare
pkg/reconciler/workload/virtualworkspaceurls/virtualworkspaceurls_reconcile.go
Outdated
Show resolved
Hide resolved
pkg/reconciler/workload/virtualworkspaceurls/virtualworkspaceurls_controller.go
Outdated
Show resolved
Hide resolved
ebdecd3
to
9800241
Compare
klog.Errorf("failed to patch sync target: %v", err) | ||
return err | ||
} | ||
klog.V(4).InfoS("patched synctarget", "name", newSyncTarget.Name, "workspace", logicalcluster.From(newSyncTarget)) |
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.
nit: would do that before the patch and include the actual patch bytes, and V(2).
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.
done
klog.Errorf("failed to patch sync target status: %v", err) | ||
return err | ||
} | ||
klog.V(4).InfoS("patched synctarget status", "name", newSyncTarget.Name, "workspace", logicalcluster.From(newSyncTarget)) |
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.
same
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.
done
@@ -34,6 +34,13 @@ import ( | |||
func (c *Controller) reconcile(syncTarget *workloadv1alpha1.SyncTarget, workspaceShards []*v1alpha1.ClusterWorkspaceShard) (*workloadv1alpha1.SyncTarget, error) { | |||
syncTargetCopy := syncTarget.DeepCopy() | |||
|
|||
labels := syncTargetCopy.GetLabels() |
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.
you can edit syncTargetCopy.Labels
directly. No need for Get/SetLabel.
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.
that panics.
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.
no. Of course you have to create the map if it is nil. But no need for calling setter and getter.
9800241
to
aab6669
Compare
…ting synctargets with kubectl
…bel to SyncTargets
aab6669
to
9effac7
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sttts The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR adds a new label to SyncTarget resources
internal.workload.kcp.dev/key
this label contains the SyncTargetKey, a hash generated with theToSyncTargetKey()
helper func.