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

Update ClusterSet and ClusterClaim webhooks #4043

Merged
merged 1 commit into from
Jul 25, 2022

Conversation

luolanzone
Copy link
Contributor

@luolanzone luolanzone commented Jul 21, 2022

  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]

@luolanzone luolanzone added the area/multi-cluster Issues or PRs related to multi cluster. label Jul 21, 2022
@luolanzone luolanzone requested a review from hjiajing July 21, 2022 08:24
@luolanzone luolanzone requested a review from jianjuns July 21, 2022 08:30
@luolanzone
Copy link
Contributor Author

/test-multicluster-e2e

@codecov
Copy link

codecov bot commented Jul 21, 2022

Codecov Report

Merging #4043 (81a1476) into main (2a092ab) will increase coverage by 1.46%.
The diff coverage is 56.25%.

Impacted file tree graph

@@            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     
Flag Coverage Δ
e2e-tests 59.06% <35.41%> (?)
kind-e2e-tests 49.50% <ø> (-0.50%) ⬇️
unit-tests 44.20% <48.71%> (+0.01%) ⬆️
Impacted Files Coverage Δ
...apis/multicluster/v1alpha2/clusterclaim_webhook.go 24.13% <11.11%> (ø)
.../cmd/multicluster-controller/clusterset_webhook.go 59.37% <59.37%> (ø)
...icluster/cmd/multicluster-controller/controller.go 62.92% <100.00%> (+54.27%) ⬆️
multicluster/cmd/multicluster-controller/main.go 66.66% <100.00%> (+66.66%) ⬆️
pkg/ipfix/ipfix_process.go 81.25% <0.00%> (-18.75%) ⬇️
pkg/agent/flowexporter/connections/connections.go 61.61% <0.00%> (-14.15%) ⬇️
...g/agent/controller/serviceexternalip/controller.go 69.62% <0.00%> (-11.95%) ⬇️
pkg/agent/flowexporter/exporter/exporter.go 67.82% <0.00%> (-10.15%) ⬇️
...agent/flowexporter/connections/deny_connections.go 65.59% <0.00%> (-8.61%) ⬇️
pkg/agent/flowexporter/utils.go 72.34% <0.00%> (-8.52%) ⬇️
... and 59 more

@luolanzone
Copy link
Contributor Author

/test-multicluster-e2e

Copy link
Contributor

@jianjuns jianjuns left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably remove "the".

Copy link
Contributor Author

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"),
Copy link
Contributor

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?

Copy link
Contributor

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"

Copy link
Contributor Author

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]>
@jianjuns
Copy link
Contributor

/test-multicluster-e2e
/skip-all

@jianjuns jianjuns merged commit 13f470e into antrea-io:main Jul 25, 2022
@luolanzone luolanzone deleted the mc-webhooks branch July 26, 2022 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/multi-cluster Issues or PRs related to multi cluster.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants