Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/jenkins] Add runAsUser and runAsGroup to podTemplate #22641

Merged
merged 1 commit into from
Jun 15, 2020

Conversation

janekbaraniewski
Copy link
Contributor

Is this a new chart

NOTE: We're experiencing a high volume of PRs to this repo and reviews will be delayed. Please host your own chart repository and submit your repository to the Helm Hub instead of this repo to make them discoverable to the community. Here is how to submit new chart repositories to the Helm Hub.

No

What this PR does / why we need it:

Adds ability to configure user/group for Jenkins agent containers. Currently it's impossible to do using Jenking Configuration as a Code because of those missing values, causing failure of custom agent sidecar containers with different default user.

Special notes for your reviewer:

@lachie83 Hey, first time making a PR to charts repo so not really sure how it works, should I tag all maintainers here?

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • DCO signed
  • Chart Version bumped
  • Variables are documented in the README.md
  • Title of the PR starts with chart name (e.g. [stable/mychartname])

@helm-bot helm-bot added Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 2, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @janekbaraniewski. Thanks for your PR.

I'm waiting for a helm member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 2, 2020
@janekbaraniewski
Copy link
Contributor Author

/assign @viglesiasce

Copy link
Collaborator

@wmcdona89 wmcdona89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janekbaraniewski thanks for the PR!

please rebase and also update values.yaml and the CHANGELOG

@@ -190,6 +190,8 @@ Returns kubernetes pod template configuration as code
resourceLimitMemory: {{.Values.agent.resources.limits.memory}}
resourceRequestCpu: {{.Values.agent.resources.requests.cpu}}
resourceRequestMemory: {{.Values.agent.resources.requests.memory}}
runAsUser: {{ .Values.agent.runAsUser }}
runAsGroup: {{ .Values.agent.runAsGroup }}
Copy link
Collaborator

@wmcdona89 wmcdona89 Jun 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain your use case in more detail? these fields can be configured for both the pod and the container and I'm wondering if there's a need to support both. if so, the naming will need to account for this.

perhaps...

agent.runAsUserContainer
agent.runAsGroupContainer
agent.runAsUserPod
agent.runAsGroupPod

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I'm using custom agent sidecar image with some custom default user example which doesn't have proper permissions to use mounted jenkins workspace that's managed by jnlp container.
So in my case I only need to modify them at container level and I'm not sure if there is a need to set it at pod level. Only example I can think of is when you want to also change user in jnlp sidecar that's added to agent pod when you overwrite sideContainerName and set it to one value for all containers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, setting these options at the container level does seem like the more common use case.

@torstenwalter
Copy link
Collaborator

@wmcdona89 Isn't it already possible to configure it using podTemplate?
In that case it could be better to add an example rather than introducing yet another field.

@janekbaraniewski
Copy link
Contributor Author

@torstenwalter that's true, it is possible to configure using agent.podTemplates. However, this doesn't suit my usecase that well.

I need to define common "base" configuration that then can have specific fields overwritten depending on environment. Since agent.podTemplates is essentially a string I cannot simply overwrite for example image attribute without redefining whole structure again. I could introduce some rendering mechanism but that introduces additional complexity to my configuration and I would like to avoid it if possible.

I also can't see a reason why it should be possible to do it using podTemplates but not additionalAgents. From a user perspective I think that's misleading since both of them claim to do the same thing - configure additional kubernetes pod templates.

Signed-off-by: Jan Baraniewski <janekbaraniewski@gmail.com>
@janekbaraniewski janekbaraniewski force-pushed the jenkins/set_agent_user branch from d558f25 to 68030d8 Compare June 8, 2020 12:33
@helm-bot helm-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 8, 2020
@wmcdona89
Copy link
Collaborator

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 10, 2020
@wmcdona89
Copy link
Collaborator

@torstenwalter lgtm

@torstenwalter
Copy link
Collaborator

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: janekbaraniewski, torstenwalter

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Jun 14, 2020
@torstenwalter
Copy link
Collaborator

/retest

4 similar comments
@unguiculus
Copy link
Member

/retest

@unguiculus
Copy link
Member

/retest

@torstenwalter
Copy link
Collaborator

/retest

@scottrigby
Copy link
Member

/retest

@janekbaraniewski janekbaraniewski deleted the jenkins/set_agent_user branch June 16, 2020 09:29
camelus0211 pushed a commit to camelus0211/charts that referenced this pull request Jul 6, 2020
)

Signed-off-by: Jan Baraniewski <janekbaraniewski@gmail.com>
Signed-off-by: camelusluo <camelusluo@tencent.com>
irlevesque pushed a commit to quantopian/charts that referenced this pull request Jul 13, 2020
)

Signed-off-by: Jan Baraniewski <janekbaraniewski@gmail.com>
includerandom pushed a commit to includerandom/helm_charts that referenced this pull request Jul 19, 2020
)

Signed-off-by: Jan Baraniewski <janekbaraniewski@gmail.com>
li-adrienloiseau pushed a commit to li-adrienloiseau/charts that referenced this pull request Jul 29, 2020
)

Signed-off-by: Jan Baraniewski <janekbaraniewski@gmail.com>
Signed-off-by: Adrien Loiseau <adrien.loiseau@logic-immo.com>
mmingorance-dh pushed a commit to mmingorance-dh/charts that referenced this pull request Aug 28, 2020
)

Signed-off-by: Jan Baraniewski <janekbaraniewski@gmail.com>
Signed-off-by: Miguel Mingorance <miguel.mingorance@deliveryhero.com>
wmcdona89 pushed a commit to wmcdona89/charts that referenced this pull request Aug 30, 2020
)

Signed-off-by: Jan Baraniewski <janekbaraniewski@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). lgtm Indicates that a PR is ready to be merged. ok-to-test size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants