-
Notifications
You must be signed in to change notification settings - Fork 198
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 triggers default configmap for runAsUser and runAsGroup to handle restricted securityContext for Triggers #2125
Update triggers default configmap for runAsUser and runAsGroup to handle restricted securityContext for Triggers #2125
Conversation
@tektoncd/operator-maintainers Will bring this issue in WG call also wanted to talk |
@piyush-garg When
And pod is up and running with those securityContext values
I could even send the requests
The taskrun created
|
cc @khrm |
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.
Did you test this with OpenShift <=4.15?
Yes |
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.
/approve
@jkandasa
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.
cc @piyush-garg
@savitaashture Please update the release notes |
i dont know how 65532 is working on openshift, and thing which used to work before is not working now. I need to disucss this more |
Sure @piyush-garg |
Lets setup a adhoc call and try few things which i have in mind, i think it should work fine with the original flag |
When
all above things will be set but Therefore, I need to try out a couple of things by making changes in triggers and operators. |
f7a28b8
to
5decdc6
Compare
The following is the coverage report on the affected files.
|
5decdc6
to
a7085c0
Compare
19e5656
to
5286871
Compare
The following is the coverage report on the affected files.
|
5286871
to
987520c
Compare
squashed |
The following is the coverage report on the affected files.
|
@jkandasa @piyush-garg addressed all the review comments |
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 @savitaashture LGTM
cc @piyush-garg
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jkandasa, khrm, vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -92,5 +92,7 @@ type TriggersProperties struct { | |||
// OptionalTriggersProperties defines the fields which are to be | |||
// defined for triggers only if user pass them | |||
type OptionalTriggersProperties struct { | |||
DefaultServiceAccount string `json:"default-service-account,omitempty"` | |||
DefaultServiceAccount string `json:"default-service-account,omitempty"` | |||
DefaultRunAsUser *string `json:"default-run-as-user,omitempty"` |
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 should not add it here, its a configmap thing and it can be done through options.
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 have already stopped adding more configs
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.
@savitaashture ah I just notice, it is applicable for kubernets too.
Will it work without runAsUser
and runAsGroup
in kubernetes?
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 should not add it in spec
we just remove those two values in openshift profile only
user should be able to configure through options in both profile
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.
okay
got it
then in that case i want to set default value as ""
for both runAsUser and runAsGroup should i add under Options of Triggers 🤔
user should be able to configure through options in both profile
right but to set default values what is the best way in Operator
Is it through adding under options in tektonConfig ?
I mean shall i add default values here https://github.com/tektoncd/operator/blob/main/config/crs/openshift/config/all/operator_v1alpha1_config_cr.yaml directly
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.
just call the tranformer in openshift extension to set the default value
987520c
to
8c05647
Compare
The following is the coverage report on the affected files.
|
8c05647
to
d553b6f
Compare
The following is the coverage report on the affected files.
|
// Updating the default values of runAsUser and runAsGroup to an empty string | ||
// to ensure compatibility with OpenShift's requirements for managing these settings | ||
// in Triggers Eventlistener containers SCC. | ||
type triggersProperties struct { |
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.
can we define the struct out of this function
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.
moved out of the function
DefaultRunAsUser *string `json:"default-run-as-user,omitempty"` | ||
DefaultRunAsGroup *string `json:"default-run-as-group,omitempty"` | ||
} | ||
triggersData := triggersProperties{ |
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 can also be defined like a constant outside
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.
updated a bit please check now
5f27bc5
to
3d3dd91
Compare
The following is the coverage report on the affected files.
|
…ult cm for triggers to handle restricted securityContext Context: As part of addressing https://issues.redhat.com/browse/OCPSTRAT-487, there's a plan to enable restricted security context by default starting from Openshift 4.16. Once this becomes the default setting, existing Triggers functionality may break. This is because we currently set security context to false, and the pipelines-scc security context constraint (SCC) doesn't have seccompProfiles: runtime/default, which is required when restricted security context is enabled by default.
3d3dd91
to
8bba2da
Compare
The following is the coverage report on the affected files.
|
/lgtm |
Context:
As part of addressing https://issues.redhat.com/browse/OCPSTRAT-487, there's a plan to enable restricted security context by default starting from Openshift 4.17.
Once this becomes the default setting, existing Triggers functionality may break.
This is because we currently set security context to false, and the pipelines-scc security context constraint (SCC) doesn't have seccompProfiles: runtime/default, which is required when restricted security context is enabled by default because by default triggers set
runAsUser and
runAsGroup` to 65532.So Updated Triggers only to accept values for
runAsUser and
runAsGroupthrough CM and using Operator we are setting to
""` so that Openshift can set those random values.Tested below scenarios:
1 set security context to restricted for a namespace (
oc label ns test pod-security.kubernetes.io/enforce=restricted --overwrite=true
)pipelines-scc
and Created EL, POD is up and running
2 remove security context to restricted for a namespace (
oc label ns test pod-security.kubernetes.io/enforce-
)pipelines-scc
and Created EL, POD is up and running
Fixes : https://issues.redhat.com/browse/SRVKP-4372
Signed-off-by: Savita Ashture sashture@redhat.com
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make test lint
before submitting a PRSee the contribution guide for more details.
Release Notes