-
Notifications
You must be signed in to change notification settings - Fork 592
Add TLS adherance feature gate #2680
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
Open
richardsonnick
wants to merge
1
commit into
openshift:master
Choose a base branch
from
richardsonnick:tls-adherance-fate
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+813
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
config/v1/tests/apiservers.config.openshift.io/TLSAdherence.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| name: "APIServer" | ||
| crdName: apiservers.config.openshift.io | ||
| featureGates: | ||
| - TLSAdherence | ||
| tests: | ||
| onCreate: | ||
| - name: Should be able to create with tlsAdherence set to LegacyExternalAPIServerComponentsOnly | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| tlsAdherence: LegacyExternalAPIServerComponentsOnly | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| audit: | ||
| profile: Default | ||
| tlsAdherence: LegacyExternalAPIServerComponentsOnly | ||
| - name: Should be able to create with tlsAdherence set to StrictAllComponents | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| tlsAdherence: StrictAllComponents | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| audit: | ||
| profile: Default | ||
| tlsAdherence: StrictAllComponents | ||
| - name: Should reject invalid tlsAdherence value | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| tlsAdherence: InvalidValue | ||
| expectedError: 'spec.tlsAdherence: Unsupported value: "InvalidValue": supported values: "LegacyExternalAPIServerComponentsOnly", "StrictAllComponents"' | ||
| onUpdate: | ||
| - name: Should be able to update tlsAdherence from LegacyExternalAPIServerComponentsOnly to StrictAllComponents | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| tlsAdherence: LegacyExternalAPIServerComponentsOnly | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| tlsAdherence: StrictAllComponents | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| audit: | ||
| profile: Default | ||
| tlsAdherence: StrictAllComponents | ||
| - name: Should be able to update tlsAdherence from StrictAllComponents to LegacyExternalAPIServerComponentsOnly | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| tlsAdherence: StrictAllComponents | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| tlsAdherence: LegacyExternalAPIServerComponentsOnly | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| audit: | ||
| profile: Default | ||
| tlsAdherence: LegacyExternalAPIServerComponentsOnly | ||
| - name: Should not allow removing tlsAdherence once set | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: | ||
| tlsAdherence: StrictAllComponents | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: APIServer | ||
| spec: {} | ||
| expectedError: "tlsAdherence may not be removed once set" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We need to configure validation on this field, and set the default.
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.
Oh I see you are defining the Enum validation on the type, which is fine. Let's also include the
+kubebuilder:defaultmarker there as well.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.
Hmm, reading the tlsAdherence description again, it seems like you are wanting it to be possible for an empty string to be allowed to be persisted for this field in etcd, which would allow us in theory to change the default semantic later in the future from legacy to strict without a change in the actual tlsAdherence value.
In practice, I think the problem with that idea is that each component essentially has their own implementation of this API and we'd have to do a really good job coordinating a semantic switch from legacy to strict.
What do folks think about:
LegacyExternalAPIServerComponentsOnlyto etcd by default.StrictAllComponentsand will not have to worry about the possibility of""with changing semantics later.StrictAllComponentsas the new default, we make sure newly installed clusters get that, and we potentially block upgrades of clusters that still useLegacyExternalAPIServerComponentsOnly? Or maybe there's some other way to encourage users to switch toStrictAllComponents?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.
For configuration APIs we generally try to avoid setting the default via
+kubebuilder:defaultmarker so that we can change the default behavior of the "no-opinion" mechanism.In this case, I don't think we will be doing that but I still wouldn't use the
+kubebuilder:defaultmarker because then we won't be able to distinguish whether or not the user intentionally set the field or if we defaulted it on their behalf and you technically get locked into that default being a contractual default.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.
Thanks, I was hoping you'd have some good advice here. It is the intent to eventually make all components honor the cluster-wide default, so I supposed we'll just have to deal with trying to coordinate a semantic change across a bunch of components at once when the time comes.
To facilitate that, I'd suggest a library-go function somehow like this:
And then when we want to change the semantic, we'd update that function to:
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.
That aligns with what I envisioned.
Can we make sure to update the EP with a mention of this kind of check/library that implementors are expected to use?
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.
Added a mention of this helper function.
Also created a draft diff in library-go to add this function: openshift/library-go#2114
Will need to land this first to get the TLSAdherencePolicy type into library-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.
The behavior for unknown values seem inconsistent with the behavior for unset/empty values. Shouldn't unknown values lead to a warning and setting the default value instead of
StrictAllComponents? This would be less surprising for both users and implementers ?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.
I'm not super opinionated on what the "unknown" case means for components, but I think
StrictAllComponentsis reasonable.I suspect that we probably won't add many new allowed values here. Assuming that we do have a scenario where we've added a new value that might be unknown for some components, I think the current assumption of unknown != explicit legacy choice (that all components should be aware of) being that components should respect the configuration defined here is reasonable.
Issuing some kind of warning sounds reasonable to me. You wouldn't want to modify this value based on one component not understanding the value here because other components may understand the value.