-
Notifications
You must be signed in to change notification settings - Fork 374
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
Update ClusterSet and ClusterClaim webhooks #4043
Conversation
/test-multicluster-e2e |
Codecov Report
@@ Coverage Diff @@
## main #4043 +/- ##
==========================================
+ Coverage 63.93% 65.40% +1.46%
==========================================
Files 292 307 +15
Lines 43671 43850 +179
==========================================
+ Hits 27922 28679 +757
+ Misses 13492 12843 -649
- Partials 2257 2328 +71
|
4919ac2
to
e3bf763
Compare
/test-multicluster-e2e |
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.
Nits.
if r.Name != WellKnownClusterClaimClusterSet && r.Name != WellKnownClusterClaimID { | ||
err := fmt.Errorf("The name %s is not valid, only 'id.k8s.io' and 'clusterset.k8s.io' are valid names for ClusterClaim", r.Name) | ||
err := fmt.Errorf("the name %s is not valid, only 'id.k8s.io' and 'clusterset.k8s.io' are valid names for ClusterClaim", r.Name) |
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.
Probably remove "the".
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
} | ||
|
||
if len(clusterSetList.Items) > 0 { | ||
klog.ErrorS(fmt.Errorf("multiple ClusterSets in the Namespace are not allowed"), |
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.
Why not create a single error to be used both here and in the returned error?
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.
"multiple ClusterSets in a Namespace are not allowed" or "only a single ClusterSet is allowed in a Namespace"
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. defined an error "multiple ClusterSets in a Namespace are not allowed"
1. Add a ClusterSet webhook to make Leader's `clusterID` immutable, and allow only one ClusterSet in mc-controller's Namespace. 2. Update ClusterClaim webhook to make `value` field (ClusterID/ClusterSetID) immutable 3. Remove unused mutate webhook of ClusterClaim Signed-off-by: Lan Luo <[email protected]>
/test-multicluster-e2e |
allow only one ClusterSet in mc-controller's Namespace.
Value
field(ClusterID/ClusterSetID) immutable
Signed-off-by: Lan Luo [email protected]