diff --git a/charts/accountapp/Chart.yaml b/charts/accountapp/Chart.yaml index 2317d5414..453135be2 100644 --- a/charts/accountapp/Chart.yaml +++ b/charts/accountapp/Chart.yaml @@ -3,4 +3,4 @@ description: A Helm chart for accounts.jenkins.io maintainers: - name: timja name: accountapp -version: 0.7.3 +version: 0.8.1 diff --git a/charts/accountapp/templates/_helpers.tpl b/charts/accountapp/templates/_helpers.tpl index 6093258d6..4ac303e71 100644 --- a/charts/accountapp/templates/_helpers.tpl +++ b/charts/accountapp/templates/_helpers.tpl @@ -31,13 +31,20 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Selector labels +*/}} +{{- define "accountapp.selectorLabels" -}} +app.kubernetes.io/name: {{ include "accountapp.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + {{/* Common labels */}} {{- define "accountapp.labels" -}} -app.kubernetes.io/name: {{ include "accountapp.name" . }} +{{ include "accountapp.selectorLabels" . }} helm.sh/chart: {{ include "accountapp.chart" . }} -app.kubernetes.io/instance: {{ .Release.Name }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} diff --git a/charts/accountapp/templates/pdb.yaml b/charts/accountapp/templates/pdb.yaml new file mode 100644 index 000000000..7110d0208 --- /dev/null +++ b/charts/accountapp/templates/pdb.yaml @@ -0,0 +1,18 @@ +{{- if (gt (int .Values.replicaCount) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "accountapp.fullname" . }} + labels: + {{- include "accountapp.labels" . | nindent 4 }} +spec: + {{- with .Values.poddisruptionbudget.minAvailable }} + minAvailable: {{ . }} + {{- end }} + {{- with .Values.poddisruptionbudget.maxUnavailable }} + maxUnavailable: {{ . }} + {{- end }} + selector: + matchLabels: + {{- include "accountapp.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/accountapp/tests/custom_values_test.yaml b/charts/accountapp/tests/custom_values_test.yaml index 5deeb477a..efd80ec10 100644 --- a/charts/accountapp/tests/custom_values_test.yaml +++ b/charts/accountapp/tests/custom_values_test.yaml @@ -3,6 +3,7 @@ templates: - deployment.yaml - ingress.yaml - secret.yaml # Direct dependency of deployment.yaml + - pdb.yaml tests: - it: should create a Secret with the correct value set: @@ -51,3 +52,18 @@ tests: - equal: path: spec.template.spec.containers[0].resources.requests.cpu value: 500m + - it: should ensure the pdb has correct spec + template: pdb.yaml + set: + replicaCount: 2 + poddisruptionbudget.minAvailable: 2 + poddisruptionbudget.maxUnavailable: 1 + asserts: + - isKind: + of: PodDisruptionBudget + - equal: + path: spec.minAvailable + value: 2 + - equal: + path: spec.selector.matchLabels['app.kubernetes.io/name'] + value: "accountapp" diff --git a/charts/accountapp/tests/defaults_test.yaml b/charts/accountapp/tests/defaults_test.yaml index d663044bd..9db42b55b 100644 --- a/charts/accountapp/tests/defaults_test.yaml +++ b/charts/accountapp/tests/defaults_test.yaml @@ -3,6 +3,7 @@ templates: - deployment.yaml - ingress.yaml - secret.yaml # Direct dependency of deployment.yaml + - pdb.yaml tests: - it: should create an ingress by default template: ingress.yaml @@ -21,3 +22,14 @@ tests: value: IfNotPresent - notExists: path: spec.template.spec.containers[0].resources + - equal: + path: metadata.labels["app.kubernetes.io/name"] + value: accountapp + - equal: + path: metadata.labels["app.kubernetes.io/managed-by"] + value: Helm + - it: should not generate any pdb with default values + template: pdb.yaml + asserts: + - hasDocuments: + count: 0 diff --git a/charts/accountapp/values.yaml b/charts/accountapp/values.yaml index 6ecf4a23b..1b2097757 100644 --- a/charts/accountapp/values.yaml +++ b/charts/accountapp/values.yaml @@ -4,7 +4,7 @@ replicaCount: 1 image: repository: jenkinsciinfra/account-app - tag: 0.4.50 + tag: 0.4.51 pullPolicy: IfNotPresent imagePullSecrets: [] nameOverride: "" @@ -66,3 +66,5 @@ election: close: 1970-01-02 logDir: /var/log/accountapp/elections candidates: bob,alice +poddisruptionbudget: + minAvailable: 1 diff --git a/charts/artifact-caching-proxy/Chart.yaml b/charts/artifact-caching-proxy/Chart.yaml index 7450319dd..2c7dae32c 100644 --- a/charts/artifact-caching-proxy/Chart.yaml +++ b/charts/artifact-caching-proxy/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 description: artifact-caching-proxy is a Nginx caching proxy in front of repo.jenkins-ci.org name: artifact-caching-proxy type: application -version: 0.14.0 +version: 0.15.0 diff --git a/charts/artifact-caching-proxy/templates/pdb.yaml b/charts/artifact-caching-proxy/templates/pdb.yaml new file mode 100644 index 000000000..aa564df5f --- /dev/null +++ b/charts/artifact-caching-proxy/templates/pdb.yaml @@ -0,0 +1,18 @@ +{{- if (gt (int .Values.replicaCount) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "artifact-caching-proxy.fullname" . }} + labels: + {{- include "artifact-caching-proxy.labels" . | nindent 4 }} +spec: + {{- with .Values.poddisruptionbudget.minAvailable }} + minAvailable: {{ . }} + {{- end }} + {{- with .Values.poddisruptionbudget.maxUnavailable }} + maxUnavailable: {{ . }} + {{- end }} + selector: + matchLabels: + {{- include "artifact-caching-proxy.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/artifact-caching-proxy/tests/custom_values_test.yaml b/charts/artifact-caching-proxy/tests/custom_values_test.yaml index 4230e35be..9bc7e1bca 100644 --- a/charts/artifact-caching-proxy/tests/custom_values_test.yaml +++ b/charts/artifact-caching-proxy/tests/custom_values_test.yaml @@ -2,6 +2,7 @@ suite: Tests with custom values templates: - ingress-health.yaml - ingress.yaml + - pdb.yaml tests: - it: Should set a custom health check path when specified by values template: ingress.yaml @@ -50,3 +51,19 @@ tests: path: metadata.annotations value: a-custom/annotation: "hello world" + + - it: should ensure the pdb has correct spec + template: pdb.yaml + set: + replicaCount: 2 + poddisruptionbudget.minAvailable: 2 + poddisruptionbudget.maxUnavailable: 1 + asserts: + - isKind: + of: PodDisruptionBudget + - equal: + path: spec.minAvailable + value: 2 + - equal: + path: spec.selector.matchLabels['app.kubernetes.io/name'] + value: "artifact-caching-proxy" diff --git a/charts/artifact-caching-proxy/tests/defaults_test.yaml b/charts/artifact-caching-proxy/tests/defaults_test.yaml index a9cbdd25d..f1c2e4c96 100644 --- a/charts/artifact-caching-proxy/tests/defaults_test.yaml +++ b/charts/artifact-caching-proxy/tests/defaults_test.yaml @@ -5,6 +5,7 @@ templates: - nginx-proxy-configmap.yaml - nginx-default-configmap.yaml - statefulset.yaml + - pdb.yaml tests: - it: should not generate any ingress with default values template: ingress.yaml @@ -36,3 +37,14 @@ tests: of: StatefulSet - notExists: path: spec.affinity + - equal: + path: metadata.labels["app.kubernetes.io/name"] + value: artifact-caching-proxy + - equal: + path: metadata.labels["app.kubernetes.io/managed-by"] + value: Helm + - it: should not generate any pdb with default values + template: pdb.yaml + asserts: + - hasDocuments: + count: 0 diff --git a/charts/jenkinsio/Chart.yaml b/charts/jenkinsio/Chart.yaml index 5975fd52c..07c8591da 100644 --- a/charts/jenkinsio/Chart.yaml +++ b/charts/jenkinsio/Chart.yaml @@ -4,4 +4,4 @@ maintainers: - name: timja - name: dduportal name: jenkinsio -version: 0.6.0 +version: 1.0.0 diff --git a/charts/jenkinsio/templates/deployment.yaml b/charts/jenkinsio/templates/deployment.yaml index a10808ad0..2bbf5abab 100644 --- a/charts/jenkinsio/templates/deployment.yaml +++ b/charts/jenkinsio/templates/deployment.yaml @@ -57,7 +57,7 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.affinity.jenkinsio }} affinity: {{- toYaml . | nindent 8 }} {{- end }} @@ -67,7 +67,11 @@ spec: {{- end }} volumes: - name: html -{{ toYaml .Values.htmlVolume | indent 10 }} +{{- if .Values.htmlVolume -}} +{{- toYaml .Values.htmlVolume | nindent 10 }} +{{- else }} + emptyDir: {} +{{- end }} - name: config configMap: name: jenkinsio diff --git a/charts/jenkinsio/templates/zh-deployment.yaml b/charts/jenkinsio/templates/zh-deployment.yaml index e23cd04f7..3e4cdb095 100644 --- a/charts/jenkinsio/templates/zh-deployment.yaml +++ b/charts/jenkinsio/templates/zh-deployment.yaml @@ -56,7 +56,7 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with index .Values.affinity "jenkinsio-zh" }} affinity: {{- toYaml . | nindent 8 }} {{- end }} @@ -66,7 +66,11 @@ spec: {{- end }} volumes: - name: html -{{ toYaml .Values.zhHtmlVolume | indent 10 }} +{{- if .Values.zhHtmlVolume -}} +{{- toYaml .Values.zhHtmlVolume | nindent 10 }} +{{- else }} + emptyDir: {} +{{- end }} - name: config configMap: name: jenkinsio diff --git a/charts/jenkinsio/tests/custom_values_test.yaml b/charts/jenkinsio/tests/custom_values_test.yaml new file mode 100644 index 000000000..d92f71f06 --- /dev/null +++ b/charts/jenkinsio/tests/custom_values_test.yaml @@ -0,0 +1,68 @@ +suite: Test with custom values +templates: + - deployment.yaml + - zh-deployment.yaml + - zh-configmap.yaml + - nginx-configmap.yaml +set: + htmlVolume: + azureFile: + secretName: jenkinsio + shareName: jenkinsio + readOnly: true + affinity: + jenkinsio: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: "app.kubernetes.io/name" + operator: In + values: + - jenkinsio + topologyKey: "kubernetes.io/hostname" + jenkinsio-zh: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: "app.kubernetes.io/name" + operator: In + values: + - jenkinsio-zh + topologyKey: "kubernetes.io/hostname" +tests: + - it: should create a deployment for jenkins.io with specified custom values + template: deployment.yaml + asserts: + - hasDocuments: + count: 1 + - isKind: + of: Deployment + - equal: + path: metadata.name + value: RELEASE-NAME-jenkinsio + - equal: + path: spec.template.spec.volumes[0].name + value: html + - notExists: + path: spec.template.spec.volumes[0].emptyDir + - equal: + path: spec.template.spec.volumes[0].azureFile.shareName + value: jenkinsio + - equal: + path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution[0].labelSelector.matchExpressions[0].values[0] + value: jenkinsio + - it: should create a deployment for zh.jenkins.io with specified custom values + template: zh-deployment.yaml + asserts: + - hasDocuments: + count: 1 + - isKind: + of: Deployment + - equal: + path: metadata.name + value: RELEASE-NAME-jenkinsio-zh + - equal: + path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution[0].labelSelector.matchExpressions[0].values[0] + value: jenkinsio-zh diff --git a/charts/jenkinsio/tests/defaults_values_test.yaml b/charts/jenkinsio/tests/defaults_values_test.yaml new file mode 100644 index 000000000..57b51de02 --- /dev/null +++ b/charts/jenkinsio/tests/defaults_values_test.yaml @@ -0,0 +1,36 @@ +suite: Test with default values +templates: + - deployment.yaml + - zh-deployment.yaml + - zh-configmap.yaml + - nginx-configmap.yaml +tests: + - it: should create a deployment for jenkins.io with default values + template: deployment.yaml + asserts: + - hasDocuments: + count: 1 + - isKind: + of: Deployment + - equal: + path: metadata.name + value: RELEASE-NAME-jenkinsio + - equal: + path: spec.template.spec.volumes[0].name + value: html + - exists: + path: spec.template.spec.volumes[0].emptyDir + - notExists: + path: spec.template.spec.affinity + - it: should create a deployment for zh.jenkins.io with default values + template: zh-deployment.yaml + asserts: + - hasDocuments: + count: 1 + - isKind: + of: Deployment + - equal: + path: metadata.name + value: RELEASE-NAME-jenkinsio-zh + - notExists: + path: spec.template.spec.affinity diff --git a/charts/jenkinsio/values.yaml b/charts/jenkinsio/values.yaml index ed7c161a4..d36d594d9 100644 --- a/charts/jenkinsio/values.yaml +++ b/charts/jenkinsio/values.yaml @@ -35,7 +35,7 @@ ingress: # - secretName: plugins-tls # hosts: # - plugins.jenkins.io -resources: +resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following @@ -48,7 +48,9 @@ resources: # memory: 128Mi nodeSelector: {} tolerations: [] -affinity: {} -htmlVolume: -zhHtmlVolume: +affinity: + jenkinsio: {} + jenkinsio-zh: {} +htmlVolume: {} +zhHtmlVolume: {} forceJenkinsIoHost: false diff --git a/charts/wiki/Chart.yaml b/charts/wiki/Chart.yaml index 3bd6cb1e7..5596056cf 100644 --- a/charts/wiki/Chart.yaml +++ b/charts/wiki/Chart.yaml @@ -3,4 +3,4 @@ appVersion: 0.0.7 description: A Helm chart for wiki static content name: wiki type: application -version: 0.6.2 +version: 0.6.3 diff --git a/charts/wiki/values.yaml b/charts/wiki/values.yaml index 069e86e1c..b9c3c233c 100644 --- a/charts/wiki/values.yaml +++ b/charts/wiki/values.yaml @@ -6,7 +6,7 @@ image: repository: jenkinsciinfra/wiki pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: 0.1.9 + tag: 0.1.10 imagePullSecrets: [] nameOverride: "" fullnameOverride: ""