Skip to content

Commit

Permalink
Merge branch 'main' into PDB/Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
dduportal authored Oct 2, 2023
2 parents 77b6099 + a2dc819 commit 3eee086
Show file tree
Hide file tree
Showing 18 changed files with 232 additions and 16 deletions.
2 changes: 1 addition & 1 deletion charts/accountapp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 9 additions & 2 deletions charts/accountapp/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
18 changes: 18 additions & 0 deletions charts/accountapp/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
16 changes: 16 additions & 0 deletions charts/accountapp/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
12 changes: 12 additions & 0 deletions charts/accountapp/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 3 additions & 1 deletion charts/accountapp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
replicaCount: 1
image:
repository: jenkinsciinfra/account-app
tag: 0.4.50
tag: 0.4.51
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -66,3 +66,5 @@ election:
close: 1970-01-02
logDir: /var/log/accountapp/elections
candidates: bob,alice
poddisruptionbudget:
minAvailable: 1
2 changes: 1 addition & 1 deletion charts/artifact-caching-proxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 18 additions & 0 deletions charts/artifact-caching-proxy/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
17 changes: 17 additions & 0 deletions charts/artifact-caching-proxy/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
12 changes: 12 additions & 0 deletions charts/artifact-caching-proxy/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion charts/jenkinsio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ maintainers:
- name: timja
- name: dduportal
name: jenkinsio
version: 0.6.0
version: 1.0.0
8 changes: 6 additions & 2 deletions charts/jenkinsio/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
{{- with .Values.affinity.jenkinsio }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -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
8 changes: 6 additions & 2 deletions charts/jenkinsio/templates/zh-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
{{- with index .Values.affinity "jenkinsio-zh" }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -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
68 changes: 68 additions & 0 deletions charts/jenkinsio/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions charts/jenkinsio/tests/defaults_values_test.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 6 additions & 4 deletions charts/jenkinsio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -48,7 +48,9 @@ resources:
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
htmlVolume:
zhHtmlVolume:
affinity:
jenkinsio: {}
jenkinsio-zh: {}
htmlVolume: {}
zhHtmlVolume: {}
forceJenkinsIoHost: false
2 changes: 1 addition & 1 deletion charts/wiki/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion charts/wiki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down

0 comments on commit 3eee086

Please sign in to comment.