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

Add support for generic ephemeral storage #983

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions charts/jenkins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Use the following links to reference issues, PRs, and commits prior to v2.6.0.
The changelog until v1.5.7 was auto-generated based on git commits.
Those entries include a reference to the git commit to be able to get more details.

## 4.12.0

Add support for [generic ephemeral storage](https://github.com/jenkinsci/kubernetes-plugin/pull/1489) in `agent.volumes` and `agents.workspaceVolume`.

| plugin | old version | new version |
|------------|---------------------|--------------------|
| kubernetes | 4029.v5712230ccb_f8 | 4174.v4230d0ccd951 |

## 4.11.2

Fixed documentation for controller.initScripts.
Expand Down
2 changes: 1 addition & 1 deletion charts/jenkins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: jenkins
home: https://jenkins.io/
version: 4.11.2
version: 4.12.0
appVersion: 2.426.2
description: Jenkins - Build great things at any scale! The leading open source automation server, Jenkins provides over 1800 plugins to support building, deploying and automating any project.
sources:
Expand Down
3 changes: 3 additions & 0 deletions charts/jenkins/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ Returns kubernetes pod template configuration as code
{{- range $index, $volume := .Values.agent.volumes }}
-{{- if (eq $volume.type "ConfigMap") }} configMapVolume:
{{- else if (eq $volume.type "EmptyDir") }} emptyDirVolume:
{{- else if (eq $volume.type "EphemeralVolume") }} genericEphemeralVolume:
{{- else if (eq $volume.type "HostPath") }} hostPathVolume:
{{- else if (eq $volume.type "Nfs") }} nfsVolume:
{{- else if (eq $volume.type "PVC") }} persistentVolumeClaim:
Expand All @@ -481,6 +482,8 @@ Returns kubernetes pod template configuration as code
dynamicPVC:
{{- else if (eq .Values.agent.workspaceVolume.type "EmptyDir") }}
emptyDirWorkspaceVolume:
{{- else if (eq .Values.agent.workspaceVolume.type "EphemeralVolume") }}
genericEphemeralVolume:
{{- else if (eq .Values.agent.workspaceVolume.type "HostPath") }}
hostPathWorkspaceVolume:
{{- else if (eq .Values.agent.workspaceVolume.type "Nfs") }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
render pod annotations:
1: |
checksum/config: ce69b63eb27efd6e89b22eeaf52dbe7fe3a319b4178f4de5a66077e50ccf50df
checksum/config: d07ed80fe87695afb403730897369275917d5984231041cbd3b8960d6b230aa2
fixed-annotation: some-fixed-annotation
templated-annotations: my-release
4 changes: 2 additions & 2 deletions charts/jenkins/unittests/config-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tests:
- equal:
path: data["plugins.txt"]
value: |-
kubernetes:4029.v5712230ccb_f8
kubernetes:4174.v4230d0ccd951
workflow-aggregator:596.v8c21c963d92d
git:5.1.0
configuration-as-code:1670.v564dc8b_982d0
Expand Down Expand Up @@ -69,7 +69,7 @@ tests:
- equal:
path: data["plugins.txt"]
value: |-
kubernetes:4029.v5712230ccb_f8
kubernetes:4174.v4230d0ccd951
workflow-aggregator:596.v8c21c963d92d
git:5.1.0
configuration-as-code:1670.v564dc8b_982d0
Expand Down
121 changes: 120 additions & 1 deletion charts/jenkins/unittests/jcasc-config-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ tests:
defaultMode: "600"
mountPath: /var/myapp/mysecret
secretName: mysecret
- type: EphemeralVolume
mountPath: /var/myapp/myephemeralvolume
accessModes: ReadWriteOnce
requestsSize: 2Gi
storageClassName: test-storageclass
annotations:
ci.jenkins-agent/test: "custom"
yamlTemplate: |-
Expand Down Expand Up @@ -494,7 +499,7 @@ tests:
annotations:
- key: ci.jenkins-agent/test
value: "custom"
id: 6de9914dfb9678a4f580464e046eea7dabd8ade25357bdbe43447cf3be2264ae
id: 8d8b353b1f27b74148ea53bdafaa66c35d1f18a4d1f9bf7eb119fbcc3d0ae4f4
containers:
- name: "sideContainer"
alwaysPullImage: true
Expand Down Expand Up @@ -554,6 +559,11 @@ tests:
defaultMode: "600"
mountPath: "/var/myapp/mysecret"
secretName: "mysecret"
- genericEphemeralVolume:
accessModes: "ReadWriteOnce"
mountPath: "/var/myapp/myephemeralvolume"
requestsSize: "2Gi"
storageClassName: "test-storageclass"
yaml: |-
apiVersion: v1
kind: Pod
Expand All @@ -575,6 +585,115 @@ tests:
location:
adminAddress: [email protected]
url: https://jenkins.example.com
- it: custom ephemeral storage workspace volume
set:
agent:
workspaceVolume:
type: "EphemeralVolume"
accessModes: "ReadWriteOnce"
requestsSize: "2Gi"
storageClassName: "test-storageclass"
release:
namespace: default
asserts:
- isKind:
of: ConfigMap
- hasDocuments:
count: 1
- isNotEmpty:
path: data["jcasc-default-config.yaml"]
- matchRegex:
path: metadata.labels["helm.sh/chart"]
pattern: ^jenkins-
- equal:
path: data["jcasc-default-config.yaml"]
value: |-
jenkins:
authorizationStrategy:
loggedInUsersCanDoAnything:
allowAnonymousRead: false
securityRealm:
local:
allowsSignup: false
enableCaptcha: false
users:
- id: "${chart-admin-username}"
name: "Jenkins Admin"
password: "${chart-admin-password}"
disableRememberMe: false
mode: NORMAL
numExecutors: 0
labelString: ""
projectNamingStrategy: "standard"
markupFormatter:
plainText
clouds:
- kubernetes:
containerCapStr: "10"
defaultsProviderTemplate: ""
connectTimeout: "5"
readTimeout: "15"
jenkinsUrl: "http://RELEASE-NAME-jenkins.default.svc.cluster.local:8080"
jenkinsTunnel: "RELEASE-NAME-jenkins-agent.default.svc.cluster.local:50000"
maxRequestsPerHostStr: "32"
retentionTimeout: "5"
waitForPodSec: "600"
name: "kubernetes"
namespace: "default"
serverUrl: "https://kubernetes.default"
credentialsId: ""
podLabels:
- key: "jenkins/RELEASE-NAME-jenkins-agent"
value: "true"
templates:
- name: "default"
namespace: "default"
id: ea5eb73a5f6e8914d92a87ba9567e3253aa768f60ec4cddb6a7d4c9189ba0889
containers:
- name: "jnlp"
alwaysPullImage: false
args: "^${computer.jnlpmac} ^${computer.name}"
command:
envVars:
- envVar:
key: "JENKINS_URL"
value: "http://RELEASE-NAME-jenkins.default.svc.cluster.local:8080/"
image: "jenkins/inbound-agent:3192.v713e3b_039fb_e-5"
privileged: "false"
resourceLimitCpu: 512m
resourceLimitMemory: 512Mi
resourceRequestCpu: 512m
resourceRequestMemory: 512Mi
runAsUser:
runAsGroup:
ttyEnabled: false
workingDir: /home/jenkins/agent
idleMinutes: 0
instanceCap: 2147483647
label: "RELEASE-NAME-jenkins-agent "
nodeUsageMode: "NORMAL"
podRetention: Never
showRawYaml: true
serviceAccount: "default"
slaveConnectTimeoutStr: "100"
workspaceVolume:
genericEphemeralVolume:
accessModes: "ReadWriteOnce"
requestsSize: "2Gi"
storageClassName: "test-storageclass"
yamlMergeStrategy: override
crumbIssuer:
standard:
excludeClientIPFromCrumb: true
security:
apiToken:
creationOfLegacyTokenEnabled: false
tokenGenerationOnCreationEnabled: false
usageStatisticsEnabled: true
unclassified:
location:
adminAddress:
url: http://RELEASE-NAME-jenkins:8080
- it: custom dynamic pvc workspace volume
set:
agent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tests:
template:
metadata:
annotations:
checksum/config: ce69b63eb27efd6e89b22eeaf52dbe7fe3a319b4178f4de5a66077e50ccf50df
checksum/config: d07ed80fe87695afb403730897369275917d5984231041cbd3b8960d6b230aa2
labels:
app.kubernetes.io/component: jenkins-controller
app.kubernetes.io/instance: my-release
Expand Down
16 changes: 13 additions & 3 deletions charts/jenkins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ controller:

# List of plugins to be install during Jenkins controller start
installPlugins:
- kubernetes:4029.v5712230ccb_f8
- kubernetes:4174.v4230d0ccd951
- workflow-aggregator:596.v8c21c963d92d
- git:5.1.0
- configuration-as-code:1670.v564dc8b_982d0
Expand Down Expand Up @@ -678,7 +678,7 @@ agent:
# or simply to clean up the output to make it easier to read.
showRawYaml: true
# You can define the volumes that you want to mount for this container
# Allowed types are: ConfigMap, EmptyDir, HostPath, Nfs, PVC, Secret
# Allowed types are: ConfigMap, EmptyDir, EphemeralVolume, HostPath, Nfs, PVC, Secret
# Configure the attributes as they appear in the corresponding Java class for that type
# https://github.com/jenkinsci/kubernetes-plugin/tree/master/src/main/java/org/csanchez/jenkins/plugins/kubernetes/volumes
volumes: []
Expand All @@ -688,6 +688,11 @@ agent:
# - type: EmptyDir
# mountPath: /var/myapp/myemptydir
# memory: false
# - type: EphemeralVolume
# mountPath: /var/myapp/myephemeralvolume
# accessModes: ReadWriteOnce
# requestsSize: 10Gi
# storageClassName: mystorageclass
# - type: HostPath
# hostPath: /var/lib/containers
# mountPath: /var/myapp/myhostpath
Expand All @@ -707,7 +712,7 @@ agent:
# Pod-wide environment, these vars are visible to any container in the agent pod

# You can define the workspaceVolume that you want to mount for this container
# Allowed types are: DynamicPVC, EmptyDir, HostPath, Nfs, PVC
# Allowed types are: DynamicPVC, EmptyDir, EphemeralVolume, HostPath, Nfs, PVC
# Configure the attributes as they appear in the corresponding Java class for that type
# https://github.com/jenkinsci/kubernetes-plugin/tree/master/src/main/java/org/csanchez/jenkins/plugins/kubernetes/volumes/workspace
workspaceVolume: {}
Expand All @@ -717,6 +722,11 @@ agent:
## EmptyDir example
# type: EmptyDir
# memory: false
## EphemeralVolume example
# type: EphemeralVolume
# accessModes: ReadWriteOnce
# requestsSize: 10Gi
# storageClassName: mystorageclass
## HostPath example
# type: HostPath
# hostPath: /var/lib/containers
Expand Down