Skip to content
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

[stable/jenkins] Create agent-jcasc template to configure multiple agents #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

wmcdona89
Copy link
Owner

@wmcdona89 wmcdona89 commented Mar 15, 2020

What this PR does / why we need it:

This PR provides the ability to configure multiple agents via JCasC. See the README for an example.

Which issue this PR fixes

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

Special notes for your reviewer:

The pod template definition (kubernetes.templates) in template jenkins.casc.defaults is moved to a new jenkins.agent-jcasc template with the following modifications. See http://www.mergely.com/h9N9IvrT/?ws=1.

  1. name fields moved to the top so they stand out
  2. command quoted when not nil to support empty string (empty string ensures Jenkins doesn't apply a default value such as /bin/sh -c)
  3. empty checks added for resources, resources.limits, resources.requests, and yamlTemplate
  4. workingDir parameterized
  5. volumes added

I chose not to make use of the kubernetes plugin casc fields related to agent inheritance.

defaultsProviderTemplate - the agent from which all other agents inherit configuration
Merging agent into the other agents in the JCasC allows all agents to make use of the chart's default configuration for agent. To wait for the kubernetes plugin to merge the values at runtime means each agent would need to set sideContainerName (so container values could be inherited) as well as set any fields which get assigned a default value when nil and thus aren't eligible for inheritance (e.g. command and workingDir).

inheritFrom - indicates from which agent this agent should inherit configuration
I thought an agent.inheritFrom field would look out of place in the chart since the chart only defines a single agent.

helm template tests

for helm 2 use --execute instead of --show-only

auto-reload

default JCasC config

helm template stable/jenkins \
--show-only templates/jcasc-config.yaml \
--set master.sidecars.configAutoReload.enabled=true \
--set master.JCasC.enabled=true \
--set master.JCasC.defaultConfig=true

JCasC ConfigScripts

stable/jenkins/agent-values.yaml contains the example from the README

helm template stable/jenkins \
--show-only templates/jcasc-config.yaml \
--set master.sidecars.configAutoReload.enabled=true \
--set master.JCasC.enabled=true \
--set master.JCasC.defaultConfig=false \
--values stable/jenkins/agent-values.yaml

NO auto-reload

default JCasC config

helm template stable/jenkins \
--show-only templates/config.yaml \
--set master.sidecars.configAutoReload.enabled=false \
--set master.JCasC.enabled=true \
--set master.JCasC.defaultConfig=true

JCasC ConfigScripts

stable/jenkins/agent-values.yaml contains the example from the README

helm template stable/jenkins \
--show-only templates/config.yaml \
--set master.sidecars.configAutoReload.enabled=false \
--set master.JCasC.enabled=true \
--set master.JCasC.defaultConfig=false \
--values stable/jenkins/agent-values.yaml

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

@wmcdona89 wmcdona89 changed the title [stable/jenkins] Create agent-jcasc template to enable multiple agents [stable/jenkins] Create template agent-jcasc to enable multiple agents Mar 21, 2020
@wmcdona89 wmcdona89 changed the title [stable/jenkins] Create template agent-jcasc to enable multiple agents [stable/jenkins] Create agent-jcasc template to enable multiple agents Mar 21, 2020
@wmcdona89 wmcdona89 force-pushed the agent-jcasc-template branch from 7f30711 to 8c0affd Compare March 21, 2020 21:21
@wmcdona89 wmcdona89 force-pushed the agent-jcasc-template branch from 8c0affd to 5f70000 Compare March 21, 2020 21:25
@wmcdona89 wmcdona89 changed the title [stable/jenkins] Create agent-jcasc template to enable multiple agents [stable/jenkins] Create agent-jcasc template to configure multiple agents Mar 28, 2020
wmcdona89 pushed a commit that referenced this pull request Aug 30, 2020
Add GitHub workflow for lint, test and release
wmcdona89 pushed a commit that referenced this pull request Aug 30, 2020
This adds https://github.com/github/super-linter GitHub action to validate markdown files.
To ensure a nice contributor experience all linting errors have been fixed.

Note: yaml linting is disabled as Helm templates are no valid yaml.

Signed-off-by: Torsten Walter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[stable/jenkins] Support Multiple Kubernetes podTemplates
1 participant