-
Notifications
You must be signed in to change notification settings - Fork 116
OSSM 3376 Deprecate fields pilotSecretName and rootCAConfigMapName #1137
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: maistra-2.4
Are you sure you want to change the base?
Changes from all commits
653ab7b
c006f75
c93dfcf
fa8b613
e0f9c4c
a2adaa1
c5b29c9
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 |
|---|---|---|
|
|
@@ -274,10 +274,41 @@ func (v *versionStrategyV2_4) ValidateRequest(ctx context.Context, cl client.Cli | |
| return admission.ValidationResponse(false, "a cluster-scoped SMCP may only be created by users with cluster-admin permissions") | ||
| } | ||
| } | ||
|
|
||
| hasPilotSecretName := ContainsPilotSecretNameField(smcp) | ||
| if hasPilotSecretName { | ||
| return admission.ValidationResponse(false, "SMCP does not allow PilotSecretName field") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to put yourself in the user's shoes. When they get this error message, will they know what's wrong? I think the user might then ask "why doesn't the SMCP allow this field?". It's best if the message itself explains why.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am having a hard time coming up with a more intellect response in this field. Any idea on what to say?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I re-read the Jira issue and it looks like we shouldn't return an error but a deprecation warning. So, the message could read something like We need to figure out how to emit a warning.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I can see in the JIRA issue "...if the deprecated fields exist, a warning should be returned."
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, as I said: we must return a warning not an error. And we can't do that until we upgrade k8s.io/api to v0.19+.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok, nevermind. I misunderstood your comment and I thought you mean I specified wrong requirements. |
||
| } | ||
| hasRootCAConfigMapName := ContainsRootCAConfigMapNameField(smcp) | ||
| if hasRootCAConfigMapName { | ||
| return admission.ValidationResponse(false, "SMCP does not allow RootCAConfigMapName field") | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed you add this validation code to the |
||
| return admission.ValidationResponse(true, "") | ||
| } | ||
|
|
||
| func ContainsPilotSecretNameField(smcp metav1.Object) bool { | ||
| switch s := smcp.(type) { | ||
| case *v1.ServiceMeshControlPlane: | ||
| return false | ||
| case *v2.ServiceMeshControlPlane: | ||
| return s.Spec.IsPilotSecretNameEnabled() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better if the code in this function was inlined here (i.e. remove the function and move the code here). |
||
| default: | ||
| return false | ||
| } | ||
| } | ||
| func ContainsRootCAConfigMapNameField(smcp metav1.Object) bool { | ||
| switch s := smcp.(type) { | ||
| case *v1.ServiceMeshControlPlane: | ||
| return false | ||
| case *v2.ServiceMeshControlPlane: | ||
| return s.Spec.IsRootCAConfigMapNameEnabled() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| default: | ||
| return false | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| func (v *versionStrategyV2_4) isRequesterClusterAdmin(ctx context.Context, cl client.Client, req admission.Request) (bool, error) { | ||
| sar := &authorizationv1.SubjectAccessReview{ | ||
| Spec: authorizationv1.SubjectAccessReviewSpec{ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.