Skip to content

Commit 0c108b1

Browse files
authored
feat: add support for kubernetes plugin garbage collection (#1175)
1 parent ef0b310 commit 0c108b1

File tree

6 files changed

+122
-95
lines changed

6 files changed

+122
-95
lines changed

charts/jenkins/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Use the following links to reference issues, PRs, and commits prior to v2.6.0.
1212
The changelog until v1.5.7 was auto-generated based on git commits.
1313
Those entries include a reference to the git commit to be able to get more details.
1414

15+
## 5.5.8
16+
17+
Add `agent.garbageCollection` to support setting [kubernetes plugin garbage collection](https://plugins.jenkins.io/kubernetes/#plugin-content-garbage-collection-beta).
18+
1519
## 5.5.7
1620

1721
Update `kubernetes` to version `4285.v50ed5f624918`

charts/jenkins/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: jenkins
33
type: application
44
home: https://www.jenkins.io/
5-
version: 5.5.7
5+
version: 5.5.8
66
appVersion: 2.462.1
77
description: >
88
Jenkins - Build great things at any scale! As the leading open source automation server, Jenkins provides over 1800 plugins to support building, deploying and automating any project.

charts/jenkins/VALUES.md

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,32 @@ The following tables list the configurable parameters of the Jenkins chart and t
88

99
| Key | Type | Description | Default |
1010
|:----|:-----|:---------|:------------|
11-
| [additionalAgents](./values.yaml#L1177) | object | Configure additional | `{}` |
12-
| [additionalClouds](./values.yaml#L1202) | object | | `{}` |
11+
| [additionalAgents](./values.yaml#L1189) | object | Configure additional | `{}` |
12+
| [additionalClouds](./values.yaml#L1214) | object | | `{}` |
1313
| [agent.TTYEnabled](./values.yaml#L1095) | bool | Allocate pseudo tty to the side container | `false` |
14-
| [agent.additionalContainers](./values.yaml#L1130) | list | Add additional containers to the agents | `[]` |
14+
| [agent.additionalContainers](./values.yaml#L1142) | list | Add additional containers to the agents | `[]` |
1515
| [agent.alwaysPullImage](./values.yaml#L988) | bool | Always pull agent container image before build | `false` |
16-
| [agent.annotations](./values.yaml#L1126) | object | Annotations to apply to the pod | `{}` |
16+
| [agent.annotations](./values.yaml#L1138) | object | Annotations to apply to the pod | `{}` |
1717
| [agent.args](./values.yaml#L1089) | string | Arguments passed to command to execute | `"${computer.jnlpmac} ${computer.name}"` |
1818
| [agent.command](./values.yaml#L1087) | string | Command to execute when side container starts | `nil` |
1919
| [agent.componentName](./values.yaml#L956) | string | | `"jenkins-agent"` |
20-
| [agent.connectTimeout](./values.yaml#L1124) | int | Timeout in seconds for an agent to be online | `100` |
20+
| [agent.connectTimeout](./values.yaml#L1136) | int | Timeout in seconds for an agent to be online | `100` |
2121
| [agent.containerCap](./values.yaml#L1097) | int | Max number of agents to launch | `10` |
2222
| [agent.customJenkinsLabels](./values.yaml#L953) | list | Append Jenkins labels to the agent | `[]` |
2323
| [agent.defaultsProviderTemplate](./values.yaml#L907) | string | The name of the pod template to use for providing default values | `""` |
2424
| [agent.directConnection](./values.yaml#L959) | bool | | `false` |
25-
| [agent.disableDefaultAgent](./values.yaml#L1148) | bool | Disable the default Jenkins Agent configuration | `false` |
25+
| [agent.disableDefaultAgent](./values.yaml#L1160) | bool | Disable the default Jenkins Agent configuration | `false` |
2626
| [agent.enabled](./values.yaml#L905) | bool | Enable Kubernetes plugin jnlp-agent podTemplate | `true` |
2727
| [agent.envVars](./values.yaml#L1070) | list | Environment variables for the agent Pod | `[]` |
28+
| [agent.garbageCollection.enabled](./values.yaml#L1104) | bool | When enabled, Jenkins will periodically check for orphan pods that have not been touched for the given timeout period and delete them. | `false` |
29+
| [agent.garbageCollection.namespaces](./values.yaml#L1106) | string | Namespaces to look at for garbage collection, in addition to the default namespace defined for the cloud. One namespace per line. | `""` |
30+
| [agent.garbageCollection.timeout](./values.yaml#L1111) | int | Timeout value for orphaned pods | `300` |
2831
| [agent.hostNetworking](./values.yaml#L967) | bool | Enables the agent to use the host network | `false` |
29-
| [agent.idleMinutes](./values.yaml#L1102) | int | Allows the Pod to remain active for reuse until the configured number of minutes has passed since the last step was executed on it | `0` |
32+
| [agent.idleMinutes](./values.yaml#L1114) | int | Allows the Pod to remain active for reuse until the configured number of minutes has passed since the last step was executed on it | `0` |
3033
| [agent.image.repository](./values.yaml#L946) | string | Repository to pull the agent jnlp image from | `"jenkins/inbound-agent"` |
3134
| [agent.image.tag](./values.yaml#L948) | string | Tag of the image to pull | `"3261.v9c670a_4748a_9-1"` |
3235
| [agent.imagePullSecretName](./values.yaml#L955) | string | Name of the secret to be used to pull the image | `nil` |
33-
| [agent.inheritYamlMergeStrategy](./values.yaml#L1122) | bool | Controls whether the defined yaml merge strategy will be inherited if another defined pod template is configured to inherit from the current one | `false` |
36+
| [agent.inheritYamlMergeStrategy](./values.yaml#L1134) | bool | Controls whether the defined yaml merge strategy will be inherited if another defined pod template is configured to inherit from the current one | `false` |
3437
| [agent.jenkinsTunnel](./values.yaml#L923) | string | Overrides the Kubernetes Jenkins tunnel | `nil` |
3538
| [agent.jenkinsUrl](./values.yaml#L919) | string | Overrides the Kubernetes Jenkins URL | `nil` |
3639
| [agent.jnlpregistry](./values.yaml#L943) | string | Custom registry used to pull the agent jnlp image from | `nil` |
@@ -44,7 +47,7 @@ The following tables list the configurable parameters of the Jenkins chart and t
4447
| [agent.podLabels](./values.yaml#L941) | object | Custom Pod labels (an object with `label-key: label-value` pairs) | `{}` |
4548
| [agent.podName](./values.yaml#L1099) | string | Agent Pod base name | `"default"` |
4649
| [agent.podRetention](./values.yaml#L997) | string | | `"Never"` |
47-
| [agent.podTemplates](./values.yaml#L1158) | object | Configures extra pod templates for the default kubernetes cloud | `{}` |
50+
| [agent.podTemplates](./values.yaml#L1170) | object | Configures extra pod templates for the default kubernetes cloud | `{}` |
4851
| [agent.privileged](./values.yaml#L961) | bool | Agent privileged container | `false` |
4952
| [agent.resources](./values.yaml#L969) | object | Resources allocation (Requests and Limits) | `{"limits":{"cpu":"512m","memory":"512Mi"},"requests":{"cpu":"512m","memory":"512Mi"}}` |
5053
| [agent.restrictedPssSecurityContext](./values.yaml#L994) | bool | Set a restricted securityContext on jnlp containers | `false` |
@@ -63,13 +66,13 @@ The following tables list the configurable parameters of the Jenkins chart and t
6366
| [agent.websocket](./values.yaml#L958) | bool | Enables agent communication via websockets | `false` |
6467
| [agent.workingDir](./values.yaml#L950) | string | Configure working directory for default agent | `"/home/jenkins/agent"` |
6568
| [agent.workspaceVolume](./values.yaml#L1043) | object | Workspace volume (defaults to EmptyDir) | `{}` |
66-
| [agent.yamlMergeStrategy](./values.yaml#L1120) | string | Defines how the raw yaml field gets merged with yaml definitions from inherited pod templates. Possible values: "merge" or "override" | `"override"` |
67-
| [agent.yamlTemplate](./values.yaml#L1109) | string | The raw yaml of a Pod API Object to merge into the agent spec | `""` |
68-
| [awsSecurityGroupPolicies.enabled](./values.yaml#L1328) | bool | | `false` |
69-
| [awsSecurityGroupPolicies.policies[0].name](./values.yaml#L1330) | string | | `""` |
70-
| [awsSecurityGroupPolicies.policies[0].podSelector](./values.yaml#L1332) | object | | `{}` |
71-
| [awsSecurityGroupPolicies.policies[0].securityGroupIds](./values.yaml#L1331) | list | | `[]` |
72-
| [checkDeprecation](./values.yaml#L1325) | bool | Checks if any deprecated values are used | `true` |
69+
| [agent.yamlMergeStrategy](./values.yaml#L1132) | string | Defines how the raw yaml field gets merged with yaml definitions from inherited pod templates. Possible values: "merge" or "override" | `"override"` |
70+
| [agent.yamlTemplate](./values.yaml#L1121) | string | The raw yaml of a Pod API Object to merge into the agent spec | `""` |
71+
| [awsSecurityGroupPolicies.enabled](./values.yaml#L1340) | bool | | `false` |
72+
| [awsSecurityGroupPolicies.policies[0].name](./values.yaml#L1342) | string | | `""` |
73+
| [awsSecurityGroupPolicies.policies[0].podSelector](./values.yaml#L1344) | object | | `{}` |
74+
| [awsSecurityGroupPolicies.policies[0].securityGroupIds](./values.yaml#L1343) | list | | `[]` |
75+
| [checkDeprecation](./values.yaml#L1337) | bool | Checks if any deprecated values are used | `true` |
7376
| [clusterZone](./values.yaml#L21) | string | Override the cluster name for FQDN resolving | `"cluster.local"` |
7477
| [controller.JCasC.authorizationStrategy](./values.yaml#L533) | string | Jenkins Config as Code Authorization Strategy-section | `"loggedInUsersCanDoAnything:\n allowAnonymousRead: false"` |
7578
| [controller.JCasC.configMapAnnotations](./values.yaml#L538) | object | Annotations for the JCasC ConfigMap | `{}` |
@@ -274,40 +277,40 @@ The following tables list the configurable parameters of the Jenkins chart and t
274277
| [controller.usePodSecurityContext](./values.yaml#L176) | bool | Enable pod security context (must be `true` if podSecurityContextOverride, runAsUser or fsGroup are set) | `true` |
275278
| [credentialsId](./values.yaml#L27) | string | The Jenkins credentials to access the Kubernetes API server. For the default cluster it is not needed. | `nil` |
276279
| [fullnameOverride](./values.yaml#L13) | string | Override the full resource names | `jenkins-(release-name)` or `jenkins` if the release-name is `jenkins` |
277-
| [helmtest.bats.image.registry](./values.yaml#L1341) | string | Registry of the image used to test the framework | `"docker.io"` |
278-
| [helmtest.bats.image.repository](./values.yaml#L1343) | string | Repository of the image used to test the framework | `"bats/bats"` |
279-
| [helmtest.bats.image.tag](./values.yaml#L1345) | string | Tag of the image to test the framework | `"1.11.0"` |
280+
| [helmtest.bats.image.registry](./values.yaml#L1353) | string | Registry of the image used to test the framework | `"docker.io"` |
281+
| [helmtest.bats.image.repository](./values.yaml#L1355) | string | Repository of the image used to test the framework | `"bats/bats"` |
282+
| [helmtest.bats.image.tag](./values.yaml#L1357) | string | Tag of the image to test the framework | `"1.11.0"` |
280283
| [kubernetesURL](./values.yaml#L24) | string | The URL of the Kubernetes API server | `"https://kubernetes.default"` |
281284
| [nameOverride](./values.yaml#L10) | string | Override the resource name prefix | `Chart.Name` |
282285
| [namespaceOverride](./values.yaml#L16) | string | Override the deployment namespace | `Release.Namespace` |
283-
| [networkPolicy.apiVersion](./values.yaml#L1271) | string | NetworkPolicy ApiVersion | `"networking.k8s.io/v1"` |
284-
| [networkPolicy.enabled](./values.yaml#L1266) | bool | Enable the creation of NetworkPolicy resources | `false` |
285-
| [networkPolicy.externalAgents.except](./values.yaml#L1285) | list | A list of IP sub-ranges to be excluded from the allowlisted IP range | `[]` |
286-
| [networkPolicy.externalAgents.ipCIDR](./values.yaml#L1283) | string | The IP range from which external agents are allowed to connect to controller, i.e., 172.17.0.0/16 | `nil` |
287-
| [networkPolicy.internalAgents.allowed](./values.yaml#L1275) | bool | Allow internal agents (from the same cluster) to connect to controller. Agent pods will be filtered based on PodLabels | `true` |
288-
| [networkPolicy.internalAgents.namespaceLabels](./values.yaml#L1279) | object | A map of labels (keys/values) that agents namespaces must have to be able to connect to controller | `{}` |
289-
| [networkPolicy.internalAgents.podLabels](./values.yaml#L1277) | object | A map of labels (keys/values) that agent pods must have to be able to connect to controller | `{}` |
290-
| [persistence.accessMode](./values.yaml#L1241) | string | The PVC access mode | `"ReadWriteOnce"` |
291-
| [persistence.annotations](./values.yaml#L1237) | object | Annotations for the PVC | `{}` |
292-
| [persistence.dataSource](./values.yaml#L1247) | object | Existing data source to clone PVC from | `{}` |
293-
| [persistence.enabled](./values.yaml#L1221) | bool | Enable the use of a Jenkins PVC | `true` |
294-
| [persistence.existingClaim](./values.yaml#L1227) | string | Provide the name of a PVC | `nil` |
295-
| [persistence.labels](./values.yaml#L1239) | object | Labels for the PVC | `{}` |
296-
| [persistence.mounts](./values.yaml#L1259) | list | Additional mounts | `[]` |
297-
| [persistence.size](./values.yaml#L1243) | string | The size of the PVC | `"8Gi"` |
298-
| [persistence.storageClass](./values.yaml#L1235) | string | Storage class for the PVC | `nil` |
299-
| [persistence.subPath](./values.yaml#L1252) | string | SubPath for jenkins-home mount | `nil` |
300-
| [persistence.volumes](./values.yaml#L1254) | list | Additional volumes | `[]` |
301-
| [rbac.create](./values.yaml#L1291) | bool | Whether RBAC resources are created | `true` |
302-
| [rbac.readSecrets](./values.yaml#L1293) | bool | Whether the Jenkins service account should be able to read Kubernetes secrets | `false` |
286+
| [networkPolicy.apiVersion](./values.yaml#L1283) | string | NetworkPolicy ApiVersion | `"networking.k8s.io/v1"` |
287+
| [networkPolicy.enabled](./values.yaml#L1278) | bool | Enable the creation of NetworkPolicy resources | `false` |
288+
| [networkPolicy.externalAgents.except](./values.yaml#L1297) | list | A list of IP sub-ranges to be excluded from the allowlisted IP range | `[]` |
289+
| [networkPolicy.externalAgents.ipCIDR](./values.yaml#L1295) | string | The IP range from which external agents are allowed to connect to controller, i.e., 172.17.0.0/16 | `nil` |
290+
| [networkPolicy.internalAgents.allowed](./values.yaml#L1287) | bool | Allow internal agents (from the same cluster) to connect to controller. Agent pods will be filtered based on PodLabels | `true` |
291+
| [networkPolicy.internalAgents.namespaceLabels](./values.yaml#L1291) | object | A map of labels (keys/values) that agents namespaces must have to be able to connect to controller | `{}` |
292+
| [networkPolicy.internalAgents.podLabels](./values.yaml#L1289) | object | A map of labels (keys/values) that agent pods must have to be able to connect to controller | `{}` |
293+
| [persistence.accessMode](./values.yaml#L1253) | string | The PVC access mode | `"ReadWriteOnce"` |
294+
| [persistence.annotations](./values.yaml#L1249) | object | Annotations for the PVC | `{}` |
295+
| [persistence.dataSource](./values.yaml#L1259) | object | Existing data source to clone PVC from | `{}` |
296+
| [persistence.enabled](./values.yaml#L1233) | bool | Enable the use of a Jenkins PVC | `true` |
297+
| [persistence.existingClaim](./values.yaml#L1239) | string | Provide the name of a PVC | `nil` |
298+
| [persistence.labels](./values.yaml#L1251) | object | Labels for the PVC | `{}` |
299+
| [persistence.mounts](./values.yaml#L1271) | list | Additional mounts | `[]` |
300+
| [persistence.size](./values.yaml#L1255) | string | The size of the PVC | `"8Gi"` |
301+
| [persistence.storageClass](./values.yaml#L1247) | string | Storage class for the PVC | `nil` |
302+
| [persistence.subPath](./values.yaml#L1264) | string | SubPath for jenkins-home mount | `nil` |
303+
| [persistence.volumes](./values.yaml#L1266) | list | Additional volumes | `[]` |
304+
| [rbac.create](./values.yaml#L1303) | bool | Whether RBAC resources are created | `true` |
305+
| [rbac.readSecrets](./values.yaml#L1305) | bool | Whether the Jenkins service account should be able to read Kubernetes secrets | `false` |
303306
| [renderHelmLabels](./values.yaml#L30) | bool | Enables rendering of the helm.sh/chart label to the annotations | `true` |
304-
| [serviceAccount.annotations](./values.yaml#L1303) | object | Configures annotations for the ServiceAccount | `{}` |
305-
| [serviceAccount.create](./values.yaml#L1297) | bool | Configures if a ServiceAccount with this name should be created | `true` |
306-
| [serviceAccount.extraLabels](./values.yaml#L1305) | object | Configures extra labels for the ServiceAccount | `{}` |
307-
| [serviceAccount.imagePullSecretName](./values.yaml#L1307) | string | Controller ServiceAccount image pull secret | `nil` |
308-
| [serviceAccount.name](./values.yaml#L1301) | string | | `nil` |
309-
| [serviceAccountAgent.annotations](./values.yaml#L1318) | object | Configures annotations for the agent ServiceAccount | `{}` |
310-
| [serviceAccountAgent.create](./values.yaml#L1312) | bool | Configures if an agent ServiceAccount should be created | `false` |
311-
| [serviceAccountAgent.extraLabels](./values.yaml#L1320) | object | Configures extra labels for the agent ServiceAccount | `{}` |
312-
| [serviceAccountAgent.imagePullSecretName](./values.yaml#L1322) | string | Agent ServiceAccount image pull secret | `nil` |
313-
| [serviceAccountAgent.name](./values.yaml#L1316) | string | The name of the agent ServiceAccount to be used by access-controlled resources | `nil` |
307+
| [serviceAccount.annotations](./values.yaml#L1315) | object | Configures annotations for the ServiceAccount | `{}` |
308+
| [serviceAccount.create](./values.yaml#L1309) | bool | Configures if a ServiceAccount with this name should be created | `true` |
309+
| [serviceAccount.extraLabels](./values.yaml#L1317) | object | Configures extra labels for the ServiceAccount | `{}` |
310+
| [serviceAccount.imagePullSecretName](./values.yaml#L1319) | string | Controller ServiceAccount image pull secret | `nil` |
311+
| [serviceAccount.name](./values.yaml#L1313) | string | | `nil` |
312+
| [serviceAccountAgent.annotations](./values.yaml#L1330) | object | Configures annotations for the agent ServiceAccount | `{}` |
313+
| [serviceAccountAgent.create](./values.yaml#L1324) | bool | Configures if an agent ServiceAccount should be created | `false` |
314+
| [serviceAccountAgent.extraLabels](./values.yaml#L1332) | object | Configures extra labels for the agent ServiceAccount | `{}` |
315+
| [serviceAccountAgent.imagePullSecretName](./values.yaml#L1334) | string | Agent ServiceAccount image pull secret | `nil` |
316+
| [serviceAccountAgent.name](./values.yaml#L1328) | string | The name of the agent ServiceAccount to be used by access-controlled resources | `nil` |

charts/jenkins/templates/_helpers.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ jenkins:
140140
clouds:
141141
- kubernetes:
142142
containerCapStr: "{{ .Values.agent.containerCap }}"
143+
{{- if .Values.agent.garbageCollection.enabled }}
144+
garbageCollection:
145+
{{- if .Values.agent.garbageCollection.namespaces }}
146+
namespaces: |-
147+
{{- .Values.agent.garbageCollection.namespaces | nindent 10 }}
148+
{{- end }}
149+
timeout: "{{ .Values.agent.garbageCollection.timeout }}"
150+
{{- end }}
143151
{{- if .Values.agent.jnlpregistry }}
144152
jnlpregistry: "{{ .Values.agent.jnlpregistry }}"
145153
{{- end }}

0 commit comments

Comments
 (0)