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

[stable/jenkins] Add support for custom pod templates #21671

Merged
merged 9 commits into from
Apr 4, 2020

Conversation

lgg42
Copy link
Contributor

@lgg42 lgg42 commented Mar 29, 2020

Signed-off-by: Luis Garnica Guilarte luisgarnica42@gmail.com

Is this a new chart

No.

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.

What this PR does / why we need it:

This PR allows to configure additional pod templates in the default kubernetes cloud.
We want to configure from scratch custom pod templates the same way we do with all the settings using JCasC.

Which issue this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)

  • fixes #

Special notes for your reviewer:

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])

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
@helm-bot helm-bot added the Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). label Mar 29, 2020
@helm-bot helm-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 29, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @lgg42. 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 Mar 29, 2020
@@ -189,6 +189,7 @@ The following tables list the configurable parameters of the Jenkins chart and t
| `serviceAccountAgent.name` | name of the agent ServiceAccount to be used by access-controlled resources | autogenerated |
| `serviceAccountAgent.create` | Configures if an agent ServiceAccount with this name should be created | `false` |
| `serviceAccountAgent.annotations` | Configures annotation for the agent ServiceAccount | `{}` |
| `podTemplates` | Configures extra pod templates for the default kubernetes cloud | `{}` |
Copy link
Collaborator

@wmcdona89 wmcdona89 Mar 29, 2020

Choose a reason for hiding this comment

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

What about putting this under master.JCasC.podTemplates so all the JCasC config values would be grouped together. Another option could be to put it in the agent section as podTemplates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also think is a nice change. I left a comment in your PR. I think maybe your PR is the one to go. Let's see how we manage to get this feature working the best possible way. I'm on hold (on committing) until we find common ground 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change done to agent.podTemplates as we talked in your PR.

@helm-bot helm-bot removed the Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). label Apr 1, 2020
Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
@helm-bot helm-bot added the Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). label Apr 1, 2020
@lgg42
Copy link
Contributor Author

lgg42 commented Apr 1, 2020

/assign @mogaal

stable/jenkins/templates/_helpers.tpl Outdated Show resolved Hide resolved
stable/jenkins/CHANGELOG.md Outdated Show resolved Hide resolved
stable/jenkins/README.md Outdated Show resolved Hide resolved
stable/jenkins/values.yaml Outdated Show resolved Hide resolved
@wmcdona89
Copy link
Collaborator

wmcdona89 commented Apr 1, 2020

@lgg42 Turns out I'll be able to leverage agent.podTemplates to inject "agents" into the default casc. Here's an example with the new podTemplate template in my PR.

# A list of agents. Each entry corresponds to a chart `agent` in terms of the values that can be set.
additionalAgents:
  - podName: maven
    customJenkinsLabels: maven
    image: jenkins/jnlp-agent-maven
  - podName: node
    customJenkinsLabels: node
    image: jenkins/jnlp-agent-node

agent:
  podTemplates:
    agents: |-
      {{- /* save chart agent as `set` modifies the input dictionary */}}
      {{- $rootAgent := .Values.agent }}

      {{- /* each additional agent inherits from $rootAgent */}}
      {{- range .Values.additionalAgents }}
      {{- include "jenkins.casc.podTemplate" (set $ "Values" (set $.Values "agent" (merge . $rootAgent))) }}
      {{- end }}

      {{- /* restore chart agent */}}
      {{- $_ := set .Values "agent" $rootAgent }}

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
… into support-pod-templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
@lgg42
Copy link
Contributor Author

lgg42 commented Apr 1, 2020

@lgg42 Turns out I'll be able to leverage agent.podTemplates to inject "agents" into the default casc. Here's an example with the new podTemplate template in my PR.

# A list of agents. Each entry corresponds to a chart `agent` in terms of the values that can be set.
additionalAgents:
  - podName: maven
    customJenkinsLabels: maven
    image: jenkins/jnlp-agent-maven
  - podName: node
    customJenkinsLabels: node
    image: jenkins/jnlp-agent-node

agent:
  podTemplates:
    agents: |-
      {{- /* save chart agent as `set` modifies the input dictionary */}}
      {{- $rootAgent := .Values.agent }}

      {{- /* each additional agent inherits from $rootAgent */}}
      {{- range .Values.additionalAgents }}
      {{- include "jenkins.casc.podTemplate" (set $ "Values" (set $.Values "agent" (merge . $rootAgent))) }}
      {{- end }}

      {{- /* restore chart agent */}}
      {{- $_ := set .Values "agent" $agent }}

Amazing!!! 💪

@arencibiafrancisco
Copy link

Can't wait for this to be merged! Have been looking for this! Another JenkinsX user here. agent.podTemplates is perfect!

… into support-pod-templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
… into support-pod-templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
```
agent:
podTemplates:
python: |
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI. I noticed the JenkinsX values file doesn't use multi-line strings. As it turns out, having this be a multi-line string (and not calling toYaml in the template) actually provides additional flexibility and allows for passing in a block of templating.

agent:
  podTemplates:
    agents: |-
      {{- /* save chart agent as `set` modifies the input dictionary */}}
      {{- $rootAgent := .Values.agent }}

      {{- /* each additional agent inherits from $rootAgent */}}
      {{- range .Values.additionalAgents }}
      {{- include "jenkins.casc.podTemplate" (set $ "Values" (set $.Values "agent" (merge . $rootAgent))) }}
      {{- end }}

      {{- /* restore chart agent */}}
      {{- $_ := set .Values "agent" $rootAgent }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm glad you pointed me this out and resulted to be a good thing. I just followed examples from other parts of this chart.
So, does it looks already ok to test to you?
It's my first contribution here, how long does this process tend to take?

Copy link
Collaborator

@torstenwalter torstenwalter left a comment

Choose a reason for hiding this comment

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

This looks good to me. I have just some minor remarks - see inline comments.
Could you do me a favor and add defaultConfig: true in ci/casc-values.yaml. I think it"s time to check these setting as part of the build.

stable/jenkins/README.md Outdated Show resolved Hide resolved
stable/jenkins/values.yaml Outdated Show resolved Hide resolved
stable/jenkins/Chart.yaml Outdated Show resolved Hide resolved
lgg42 and others added 3 commits April 3, 2020 21:19
… into support-pod-templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
… into support-pod-templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
@lgg42
Copy link
Contributor Author

lgg42 commented Apr 3, 2020

@torstenwalter thanks for your change comments! all resolved. I also added the line you requested in ci/casc-values.yaml.

@torstenwalter
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 Apr 3, 2020
@torstenwalter
Copy link
Collaborator

/retest

1 similar comment
@lgg42
Copy link
Contributor Author

lgg42 commented Apr 4, 2020

/retest

@lgg42
Copy link
Contributor Author

lgg42 commented Apr 4, 2020

CI's failing with

I0404 04:49:59.725] Error: incompatible versions client[v2.16.5] server[v2.15.2]

Is this something I could fix from my part?

@unguiculus
Copy link
Member

/retest

@torstenwalter
Copy link
Collaborator

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lgg42, 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 Apr 4, 2020
@k8s-ci-robot k8s-ci-robot merged commit 9fab101 into helm:master Apr 4, 2020
@torstenwalter
Copy link
Collaborator

@lgg42 Thanks a lot for the PR.

@lgg42
Copy link
Contributor Author

lgg42 commented Apr 4, 2020

Thank you all for allowing this PR go through! ♥️

irlevesque pushed a commit to quantopian/charts that referenced this pull request Jul 13, 2020
* [stable/jenkins] Add support for custom pod templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
includerandom pushed a commit to includerandom/helm_charts that referenced this pull request Jul 19, 2020
* [stable/jenkins] Add support for custom pod templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>
li-adrienloiseau pushed a commit to li-adrienloiseau/charts that referenced this pull request Jul 29, 2020
* [stable/jenkins] Add support for custom pod templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@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
* [stable/jenkins] Add support for custom pod templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@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
* [stable/jenkins] Add support for custom pod templates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@gmail.com>

* [stable/jenkins] change value name to agent.podTemplates

Signed-off-by: Luis Garnica Guilarte <luisgarnica42@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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants