-
Notifications
You must be signed in to change notification settings - Fork 266
Log unknown adherence values and add support for legacy adhering components to ShouldHonorClusterTLSProfile #2308
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: master
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ package crypto | |||||||||||
|
|
||||||||||||
| import ( | ||||||||||||
| configv1 "github.com/openshift/api/config/v1" | ||||||||||||
| "k8s.io/klog/v2" | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| // ShouldHonorClusterTLSProfile returns true if the component should honor the | ||||||||||||
|
|
@@ -13,10 +14,15 @@ import ( | |||||||||||
| // | ||||||||||||
| // Unknown enum values are treated as StrictAllComponents for forward compatibility | ||||||||||||
| // and to default to the more secure behavior. | ||||||||||||
| func ShouldHonorClusterTLSProfile(tlsAdherence configv1.TLSAdherencePolicy) bool { | ||||||||||||
| func ShouldHonorClusterTLSProfile(tlsAdherence configv1.TLSAdherencePolicy, isLegacyAdheringComponent bool, logger klog.Logger) bool { | ||||||||||||
| if isLegacyAdheringComponent { | ||||||||||||
| return true | ||||||||||||
| } | ||||||||||||
| switch tlsAdherence { | ||||||||||||
| case configv1.TLSAdherencePolicyNoOpinion, configv1.TLSAdherencePolicyLegacyAdheringComponentsOnly: | ||||||||||||
| return false | ||||||||||||
| case configv1.TLSAdherencePolicyStrictAllComponents: | ||||||||||||
| return true | ||||||||||||
| default: | ||||||||||||
| return true | ||||||||||||
|
Comment on lines
26
to
27
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. Unknown policy path still does not log, so the new Line 26-27 defaults to Suggested patch default:
+ logger.Info("unknown TLSAdherencePolicy value; defaulting to strict behavior", "tlsAdherence", tlsAdherence)
return true📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| } | ||||||||||||
|
|
||||||||||||
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.
Signature change at Line 17 breaks existing callers unless updated in the same PR.
ShouldHonorClusterTLSProfilenow requires 3 args, but the providedpkg/crypto/tls_adherence_test.gosnippet still calls it with one argument (ShouldHonorClusterTLSProfile(tt.tlsAdherence)), which will fail to compile until call sites are updated (or a compatibility wrapper is added).🤖 Prompt for AI Agents