-
Notifications
You must be signed in to change notification settings - Fork 416
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
Update eventlistener podSeurityContext to adhere to restricted pod se… #1740
base: main
Are you sure you want to change the base?
Update eventlistener podSeurityContext to adhere to restricted pod se… #1740
Conversation
Hi @kristofferchr. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/kind feature |
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.
/ok-to-test
/retest |
1 similar comment
/retest |
30b8c69
to
cf0b25d
Compare
…curity standards Alter podSecurityContext to include seccompProfile, runAsUser, runAsGroup and fsGroup when set-security-context is set. As podSecurityContext only included runAsNonRoot, which could cause injected sidecars to miss some required restricted pod security standards securityContext fields.
cf0b25d
to
53e47ba
Compare
func getStrongerSecurityPolicy(cfg *config.Config) corev1.PodSecurityContext { | ||
securityContext := baseStrongerSecurityPolicy | ||
securityContext.RunAsUser = ptr.Int64(cfg.Defaults.DefaultRunAsUser) | ||
securityContext.RunAsGroup = ptr.Int64(cfg.Defaults.DefaultRunAsGroup) | ||
securityContext.FSGroup = ptr.Int64(cfg.Defaults.DefaultRunAsGroup) | ||
return securityContext | ||
} | ||
|
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 already setting these values here https://github.com/tektoncd/triggers/blob/main/pkg/reconciler/eventlistener/resources/container.go#L53-L68
except FSGroup
if you want to add FSGroup can you update this https://github.com/tektoncd/triggers/blob/main/pkg/reconciler/eventlistener/resources/container.go#L53-L68 part of the code
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 checked my specific use case again(istio injected sidecars) and it appears runAsGroup and runAsUser is set for that container.
However, i would like to keep seccompProfile as it is not set and therefore violates restricted pod security standards.
FSGroup is not available in container securityContext, only PodSecurityContext.
I can remove runAsGroup and runAsUser if you do not wish to have a pod level 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.
@kristofferchr: PR needs rebase. 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/test-infra repository. |
Solves issue #1739
Currently, when
el-security-context
is enabled, thesecurityContext
forEventListener
in the pod template only setsrunAsNonRoot
. Expanding podTemplatesecurityContext
can make it easier to fulfill restricted pod security standards.Makes it possible to have a default
securityContext
set for injected sidecar containers that does not fulfill restricted pod security standars. An example of this is injected istio containers.Changes
Alter podSecurityContext to include seccompProfile, runAsUser, runAsGroup and fsGroup when set-security-context is set.
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes