Skip to content

Commit

Permalink
feat(charts/prow): add kubeconfig secret support (#632)
Browse files Browse the repository at this point in the history
Signed-off-by: wuhuizuo <[email protected]>
  • Loading branch information
wuhuizuo authored Jul 2, 2023
1 parent 93b33da commit 1a5f70c
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 58 deletions.
2 changes: 1 addition & 1 deletion charts/prow/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type: application
# time you make changes to the chart and its templates,
# including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "0.9.3"
version: "0.9.4"

# This is the version number of the application being deployed.
# This version number should be incremented each time you make changes to the
Expand Down
39 changes: 25 additions & 14 deletions charts/prow/templates/components/crier/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,35 @@ spec:
mountPath: /etc/persistent-credentials
readOnly: true
{{- end }}
{{- if .Values.crier.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.crier.resources | nindent 12 }}

volumes:
- name: prow-config
configMap:
name: {{ default (printf "%s-config" (include "prow.fullname" .)) .Values.prow.configs.prow.configMapName }}
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
- name: github
secret:
secretName: {{ default (printf "%s-github" (include "prow.fullname" .)) .Values.prow.github.secretName }}
{{- if include "prow.persistent.needCredentials" . }}
- name: persistent-credentials
secret:
secretName: {{ default (printf "%s-%s-credentials" (include "prow.fullname" .) .Values.persistent.type) .Values.persistent.credentials.secretName }}
{{- end }}
- name: prow-config
configMap:
name: {{ default (printf "%s-config" (include "prow.fullname" .)) .Values.prow.configs.prow.configMapName }}
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
- name: github
secret:
secretName: {{ default (printf "%s-github" (include "prow.fullname" .)) .Values.prow.github.secretName }}
{{- if include "prow.persistent.needCredentials" . }}
- name: persistent-credentials
secret:
secretName: {{ default (printf "%s-%s-credentials" (include "prow.fullname" .) .Values.persistent.type) .Values.persistent.credentials.secretName }}
{{- end }}
{{- with .Values.crier.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
49 changes: 30 additions & 19 deletions charts/prow/templates/components/deck/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ spec:
readOnly: true
- name: oauth-cookie
mountPath: /etc/oauth-cookie
{{- if .Values.deck.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
{{- if include "prow.persistent.needCredentials" . }}
- name: persistent-credentials
mountPath: /etc/persistent-credentials
Expand All @@ -99,25 +104,31 @@ spec:
periodSeconds: 3
timeoutSeconds: 600
volumes:
- name: prow-config
configMap:
name: {{ default (printf "%s-config" (include "prow.fullname" .)) .Values.prow.configs.prow.configMapName }}
- name: prow-plugin
configMap:
name: {{ default (printf "%s-plugin" (include "prow.fullname" .)) .Values.prow.configs.plugin.configMapName }}
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
- name: github
secret:
secretName: {{ default (printf "%s-github" (include "prow.fullname" .)) .Values.prow.github.secretName }}
- name: oauth-cookie
secret:
secretName: {{ default (printf "%s-oauth-cookie" (include "prow.fullname" .)) .Values.prow.oauth.cookie.secretName }}
{{- if include "prow.persistent.needCredentials" . }}
- name: persistent-credentials
secret:
secretName: {{ default (printf "%s-%s-credentials" (include "prow.fullname" .) .Values.persistent.type) .Values.persistent.credentials.secretName }}
- name: prow-config
configMap:
name: {{ default (printf "%s-config" (include "prow.fullname" .)) .Values.prow.configs.prow.configMapName }}
- name: prow-plugin
configMap:
name: {{ default (printf "%s-plugin" (include "prow.fullname" .)) .Values.prow.configs.plugin.configMapName }}
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
- name: github
secret:
secretName: {{ default (printf "%s-github" (include "prow.fullname" .)) .Values.prow.github.secretName }}
- name: oauth-cookie
secret:
secretName: {{ default (printf "%s-oauth-cookie" (include "prow.fullname" .)) .Values.prow.oauth.cookie.secretName }}
{{- if include "prow.persistent.needCredentials" . }}
- name: persistent-credentials
secret:
secretName: {{ default (printf "%s-%s-credentials" (include "prow.fullname" .) .Values.persistent.type) .Values.persistent.credentials.secretName }}
{{- end }}
{{- with .Values.deck.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
11 changes: 11 additions & 0 deletions charts/prow/templates/components/hook/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ spec:
- name: prow-jobs
mountPath: /etc/prow-jobs
readOnly: true
{{- if .Values.hook.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
livenessProbe:
httpGet:
path: /healthz
Expand Down Expand Up @@ -105,6 +110,12 @@ spec:
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
{{- with .Values.hook.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
25 changes: 18 additions & 7 deletions charts/prow/templates/components/horologium/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "prow.serviceAccountName.horologium" . }}
terminationGracePeriodSeconds: 30
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
terminationGracePeriodSeconds: 30
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand All @@ -48,12 +48,17 @@ spec:
containerPort: 80
protocol: TCP
volumeMounts:
- name: prow-config
mountPath: /etc/prow-config
readOnly: true
- name: prow-jobs
mountPath: /etc/prow-jobs
readOnly: true
- name: prow-config
mountPath: /etc/prow-config
readOnly: true
- name: prow-jobs
mountPath: /etc/prow-jobs
readOnly: true
{{- if .Values.horologium.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.horologium.resources | nindent 12 }}
volumes:
Expand All @@ -63,6 +68,12 @@ spec:
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
{{- with .Values.horologium.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
11 changes: 11 additions & 0 deletions charts/prow/templates/components/jenkins-operator/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ spec:
mountPath: /etc/jenkins
readOnly: true
{{- end }}
{{- if .Values.jenkinsOperator.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.jenkinsOperator.resources | nindent 12 }}
volumes:
Expand All @@ -134,6 +139,12 @@ spec:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.jenkinsOperator.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ spec:
- name: prow-jobs
mountPath: /etc/prow-jobs
readOnly: true
{{- if .Values.pcm.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.pcm.resources | nindent 12 }}
volumes:
Expand All @@ -72,6 +77,12 @@ spec:
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
{{- with .Values.pcm.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
11 changes: 11 additions & 0 deletions charts/prow/templates/components/sinker/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ spec:
- name: prow-jobs
mountPath: /etc/prow-jobs
readOnly: true
{{- if .Values.sinker.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.sinker.resources | nindent 12 }}
volumes:
Expand All @@ -56,6 +61,12 @@ spec:
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
{{- with .Values.sinker.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
45 changes: 28 additions & 17 deletions charts/prow/templates/components/status-reconciler/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,37 @@ spec:
mountPath: /etc/persistent-credentials
readOnly: true
{{- end }}
{{- if .Values.statusReconciler.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.statusReconciler.resources | nindent 12 }}
volumes:
- name: github
secret:
secretName: {{ default (printf "%s-github" (include "prow.fullname" .)) .Values.prow.github.secretName }}
- name: prow-config
configMap:
name: {{ default (printf "%s-config" (include "prow.fullname" .)) .Values.prow.configs.prow.configMapName }}
- name: prow-plugin
configMap:
name: {{ default (printf "%s-plugin" (include "prow.fullname" .)) .Values.prow.configs.plugin.configMapName }}
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
{{- if include "prow.persistent.needCredentials" . }}
- name: persistent-credentials
secret:
secretName: {{ default (printf "%s-%s-credentials" (include "prow.fullname" .) .Values.persistent.type) .Values.persistent.credentials.secretName }}
{{- end }}
- name: github
secret:
secretName: {{ default (printf "%s-github" (include "prow.fullname" .)) .Values.prow.github.secretName }}
- name: prow-config
configMap:
name: {{ default (printf "%s-config" (include "prow.fullname" .)) .Values.prow.configs.prow.configMapName }}
- name: prow-plugin
configMap:
name: {{ default (printf "%s-plugin" (include "prow.fullname" .)) .Values.prow.configs.plugin.configMapName }}
- name: prow-jobs
configMap:
name: {{ default (printf "%s-job" (include "prow.fullname" .)) .Values.prow.configs.job.configMapName }}
{{- if include "prow.persistent.needCredentials" . }}
- name: persistent-credentials
secret:
secretName: {{ default (printf "%s-%s-credentials" (include "prow.fullname" .) .Values.persistent.type) .Values.persistent.credentials.secretName }}
{{- end }}
{{- with .Values.statusReconciler.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
11 changes: 11 additions & 0 deletions charts/prow/templates/components/tide/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ spec:
mountPath: /etc/persistent-credentials
readOnly: true
{{- end }}
{{- if .Values.tide.kubeconfigSecret }}
- mountPath: /etc/kubeconfig
name: kubeconfig
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.tide.resources | nindent 12 }}
volumes:
Expand All @@ -92,6 +97,12 @@ spec:
secret:
secretName: {{ default (printf "%s-%s-credentials" (include "prow.fullname" .) .Values.persistent.type) .Values.persistent.credentials.secretName }}
{{- end }}
{{- with .Values.tide.kubeconfigSecret }}
- name: kubeconfig
secret:
secretName: {{ . }}
optional: true
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
Loading

0 comments on commit 1a5f70c

Please sign in to comment.