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

OSSM 3376 Deprecate fields pilotSecretName and rootCAConfigMapName #1137

Draft
wants to merge 7 commits into
base: maistra-2.4
Choose a base branch
from

Conversation

mayleighnmyers
Copy link
Contributor

@maistra-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link

openshift-ci bot commented Mar 21, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

case *v1.ServiceMeshControlPlane:
return false
case *v2.ServiceMeshControlPlane:
return s.Spec.IsPilotSecretNameEnabled()
Copy link
Contributor

Choose a reason for hiding this comment

The 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).

case *v1.ServiceMeshControlPlane:
return false
case *v2.ServiceMeshControlPlane:
return s.Spec.IsRootCAConfigMapNameEnabled()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.


hasPilotSecretName := ContainsPilotSecretNameField(smcp)
if hasPilotSecretName {
return admission.ValidationResponse(false, "SMCP does not allow PilotSecretName field")
Copy link
Contributor

@luksa luksa Mar 22, 2023

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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?

Copy link
Contributor

Choose a reason for hiding this comment

The 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 spec.foo.bar.baz.pilotSecretName is deprecated; will be removed in 2.5.0; use foo.bar.baz.xyz instead.

We need to figure out how to emit a warning.

Copy link
Member

Choose a reason for hiding this comment

The 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.

I can see in the JIRA issue "...if the deprecated fields exist, a warning should be returned."

Copy link
Contributor

Choose a reason for hiding this comment

The 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+.

Copy link
Member

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

I noticed you add this validation code to the ValidateRequest function, which isn't the best place for it. Instead, I think you should create a validateSecurity function and call it in ValidateV2(). The ValidateRequest function exists for cases where you need to actually check the admission.Request object.

Copy link

openshift-ci bot commented Jun 12, 2024

@mayleighnmyers: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/lint c5b29c9 link true /test lint
ci/prow/unit c5b29c9 link true /test unit
ci/prow/gencheck c5b29c9 link true /test gencheck

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants