-
Notifications
You must be signed in to change notification settings - Fork 420
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
Handle validation when value for runAsGroup and runAsUser is empty #1747
Conversation
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
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 think "0" shouldn't be allowed in both the vanilla k8s and OpenShift.
@khrm actually in doc and all it sayd
It might be because we have
runAsNonRoot: true and setting Alright i did verify |
Do we allow setting runAsNonRoot as false? |
Yes make sense |
The following is the coverage report on the affected files.
|
/test |
@dibyom PR is ready to review PTAL thank you |
@savitaashture: The
The following commands are available to trigger optional jobs:
Use In response to this:
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. |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
@@ -42,3 +42,4 @@ data: | |||
default-service-account: "default" | |||
default-run-as-user: "65532" |
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 think we should default set them empty, and if user wants they can set as their desired value
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.
Those values were set from starting and now if we remove we might break behavior
IMO its okay to set some default values when user won't set anything
We are setting default values here https://github.com/tektoncd/triggers/pull/1747/files#diff-572521168fb33345a93f07ab72e633d00cccb422144d8a05399a6fa98cb12025R33-R35
In the config-defaults-triggers.yaml is sample example to show how user can set as its under _example: |
@@ -39,6 +41,11 @@ type Defaults struct { | |||
DefaultServiceAccount string | |||
DefaultRunAsUser int64 |
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 dont need these default if we want to keep empty value in cm
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.
As mentioned here #1747 (comment) imo if user don't set empty then we can set them with default values
It shouldn't be mandatory that user has to set values through CM its completely optional (which is the current behavior )
Only thing is now we are providing way to configure different values by providing those keys in CM or remove default values for those keys if they don't want by setting ""
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.
Let's rebase these. @savitaashture We can merge the PR then.
The following is the coverage report on the affected files.
|
/test tekton-triggers-unit-tests |
1 similar comment
/test tekton-triggers-unit-tests |
@khrm Done |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: khrm 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 |
SeccompProfile: &corev1.SeccompProfile{ | ||
Type: corev1.SeccompProfileTypeRuntimeDefault, | ||
}, | ||
} | ||
} | ||
|
||
containerSecurityContext.RunAsUser = ptr.Int64(cfg.Defaults.DefaultRunAsUser) | ||
containerSecurityContext.RunAsGroup = ptr.Int64(cfg.Defaults.DefaultRunAsGroup) | ||
if !cfg.Defaults.IsDefaultRunAsUserEmpty { |
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 have this also behind c.SetSecurityContext
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.
and other field like capability, priviledge escalation can be moved out of the flag
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.
ya make sense
we can do that
/lgtm |
Changes
As part of 48f257d and add787c
default-run-as-user
anddefault-run-as-group
is empty ("") then don't set container SCC for runAsUser and runAsGroupbecause users on platform like OpenShift generally don't set these values and it will be set with default
So added check to handle the same
As part of 848ccb0
Added new field default-run-as-non-root to
config-defaults-triggers
configmap so that RunAsNonRoot can be now configured through CMReason for configuring runAsNonRoot through cm
0
which is valid value but because ofrunAsNonRoot: true
getting below error
0
basically this can be the combination
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