-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add validator for clusterproxyconfigs to make sure only one is ever created for a given cluster #327
Conversation
This can not be merged until rancher/rancher#43147 is merged because ClusterProxyConfigs do not exist yet. Once that is done, I'll fix-up the dependencies. |
db4ea76
to
7dcae15
Compare
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.
It would be great to also add an integration test https://github.com/rancher/webhook/wiki/Adding-a-New-Resource#integration-tests
pkg/resources/management.cattle.io/v3/clusterproxyconfig/validator.go
Outdated
Show resolved
Hide resolved
go.mod
Outdated
@@ -6,6 +6,7 @@ go 1.21 | |||
replace github.com/rancher/wrangler v1.1.1 => github.com/rancher/wrangler v1.1.1-0.20230831050635-df1bd5aae9df | |||
|
|||
replace ( | |||
github.com/rancher/rancher/pkg/apis => github.com/pmatseykanets/rancher/pkg/apis v0.0.0-20240123143352-5df802d576a6 |
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.
Is this temporary or just something that never got removed?
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.
It's temporary #327 (comment)
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.
yes, temporary
pkg/resources/management.cattle.io/v3/clusterproxyconfig/validator_test.go
Show resolved
Hide resolved
pkg/resources/management.cattle.io/v3/clusterproxyconfig/validator_test.go
Outdated
Show resolved
Hide resolved
go.mod
Outdated
@@ -20,6 +21,7 @@ replace ( | |||
k8s.io/controller-manager => k8s.io/controller-manager v0.27.4 | |||
k8s.io/cri-api => k8s.io/cri-api v0.27.4 | |||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.4 | |||
k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.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.
Just curious: is this to help with Goland's failures to run go list
? I am experiencing a similar issue, and adding this line fixes it.
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.
Yes, that is exactly why it's in here. I figured I'd clean it up with the rest of the deps once the rancher side merges. Not sure if it's the "right" fix or not long-term.
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.
What's the issue with Goland and the need for this line?
f6c8e39
to
bf1a429
Compare
Integration test added |
I think the integration test failure is expected until rancher/rancher#43147 is merged |
pkg/resources/management.cattle.io/v3/clusterproxyconfig/validator.go
Outdated
Show resolved
Hide resolved
pkg/resources/management.cattle.io/v3/clusterproxyconfig/validator.go
Outdated
Show resolved
Hide resolved
pkg/resources/management.cattle.io/v3/clusterproxyconfig/validator_test.go
Outdated
Show resolved
Hide resolved
Note, some deps changed due to rancher/rancher being on go 1.22 now. |
Waiting for #341 to merge so we can pick up the required rancher/rancher changes |
Ok, the rancher/rancher PR merged, so I've updated the deps here. Should be good to go. |
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.
A small comment, otherwise LGTM.
pkg/resources/management.cattle.io/v3/clusterproxyconfig/validator.go
Outdated
Show resolved
Hide resolved
…reated for a given cluster (rancher#327) * Add validator for clusterproxyconfigs to make sure only one is ever created for a given cluster * Add integration test for clusterProxyConfigs
Issue: rancher/rancher#22417
Problem
ClusterProxyConfigs are limited to one per downstream cluster.
Solution
This validation webhook check makes certain that you can never create more than one clusterproxyconfig per downstream cluster.
CheckList