-
Notifications
You must be signed in to change notification settings - Fork 560
OCPBUGS-29729: Updates default security context behavior for catalog source pods #3206
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
OCPBUGS-29729: Updates default security context behavior for catalog source pods #3206
Conversation
This change updates the logic for setting security contexts within the OLM pod reconciler. Now, it differentiates between 'Restricted' and 'Legacy' security contexts more explicitly. The 'Restricted' security context applies default security settings unless overridden, while the 'Legacy' context clears all security settings. When no security context is configured, it defaults to restricted. Additionally, the related tests have been updated to reflect these changes and ensure correct behavior. Signed-off-by: btofel <[email protected]>
Signed-off-by: btofel <[email protected]>
Signed-off-by: btofel <[email protected]> Signed-off-by: Brett Tofel <[email protected]>
50952ce
to
9dc398d
Compare
2cadc5e
to
73c129a
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.
This looks reasonable to me, still might be a good idea to get more eyes on it.
func WithSecurityContextConfig(securityContextConfig v1alpha1.SecurityConfig) PodOptionFunc { | ||
return func(option *PodOption) { | ||
option.SecurityContextConfig = securityContextConfig | ||
} | ||
} |
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.
This naming is still something that I think could lead to confusion. This is the default security context config, right?
This name implies that whatever value is here is what will be used. But it isn't until we evaluate the catalog source that we decide what the actual value to use is.
I'm also having trouble understanding why in some cases we use the options ...PodOptionFunc
parameter and in others we use the podSecurityConfig v1alpha1.SecurityConfig
parameter.
In this case, my suggestions would be:
- drop the option func (my reasoning is: calling a function that takes this variadic parameter means that passing that parameter is optional, which means we need a default for the default, which just complicates things even more).
- use
defaultPodSecurityConfig
as the name of the variables and parameters everywhere, except where we finally decide thesecurityContext
we're going to put into the pod.
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.
see if that's better. I just really wanted to make as few changes as possible XD but you make good points.
This PR is a positive step towards better handling of security contexts in the OLM pod reconciler, making it easier to manage and test security configurations comprehensively. LGTM |
73c129a
to
87232d0
Compare
ee56764
to
66856c2
Compare
Signed-off-by: Per Goncalves da Silva <[email protected]>
66856c2
to
27f9246
Compare
I think this could merge. @joelanford did @perdasilva address the naming problem sufficiently? |
9b28021
Description of the change:
Before: by default CatalogSource would stamp out pods with the "legacy" security profile
Now: by default CatalogSource stamps out "restricted" security profile pods when in appropriately labeled namespaces and "legacy" otherwise
Motivation for the change:
Helps users be secure-by-default on PSA clusters when deploying in "restricted" namespaces (no change for older clusters)
Architectural changes:
Testing remarks:
Reviewer Checklist
/doc
[FLAKE]
are truly flaky and have an issue