-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ianhundere <[email protected]>
- Loading branch information
1 parent
5178832
commit 8f6fac5
Showing
7 changed files
with
285 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{{- if and .Values.copySecretJob.enabled .Values.copySecretJob.copySecretCronJob.enabled }} | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
{{ include "tuf.namespace" .Subcharts.tuf | indent 2 }} | ||
name: {{ .Values.copySecretJob.name }}-scheduled | ||
spec: | ||
schedule: "{{ .Values.copySecretJob.copySecretCronJob.schedule }}" | ||
successfulJobsHistoryLimit: {{ default 2 .Values.copySecretJob.copySecretCronJob.successfulJobsHistoryLimit }} | ||
failedJobsHistoryLimit: {{ default 2 .Values.copySecretJob.copySecretCronJob.failedJobsHistoryLimit }} | ||
jobTemplate: | ||
spec: | ||
backoffLimit: {{ default 6 .Values.copySecretJob.copySecretCronJob.backoffLimit }} | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
serviceAccountName: {{ .Values.copySecretJob.serviceaccount }} | ||
initContainers: | ||
- name: wait-for-rekor-deployment-readiness | ||
image: {{ template "scaffold.image" .Values.copySecretJob }} | ||
imagePullPolicy: {{ .Values.copySecretJob.pullPolicy }} | ||
command: ["/bin/sh"] | ||
args: [ | ||
"-c", | ||
"kubectl rollout status deployment {{ .Values.tuf.secrets.rekor.deploymentName }} --timeout=120s -n {{ .Values.tuf.secrets.rekor.namespace }}" | ||
] | ||
- name: wait-for-fulcio-deployment-readiness | ||
image: {{ template "scaffold.image" .Values.copySecretJob }} | ||
imagePullPolicy: {{ .Values.copySecretJob.pullPolicy }} | ||
command: ["/bin/sh"] | ||
args: [ | ||
"-c", | ||
"kubectl rollout status deployment {{ .Values.tuf.secrets.fulcio.deploymentName }} --timeout=120s -n {{ .Values.tuf.secrets.fulcio.namespace }}" | ||
] | ||
- name: wait-for-ctlog-deployment-readiness | ||
image: {{ template "scaffold.image" .Values.copySecretJob }} | ||
imagePullPolicy: {{ .Values.copySecretJob.pullPolicy }} | ||
command: ["/bin/sh"] | ||
args: [ | ||
"-c", | ||
"kubectl rollout status deployment {{ .Values.tuf.secrets.ctlog.deploymentName }} --timeout=120s -n {{ .Values.tuf.secrets.ctlog.namespace }}" | ||
] | ||
- name: wait-for-tsa-deployment-readiness | ||
image: {{ template "scaffold.image" .Values.copySecretJob }} | ||
imagePullPolicy: {{ .Values.copySecretJob.pullPolicy }} | ||
command: ["/bin/sh"] | ||
args: [ | ||
"-c", | ||
"kubectl rollout status deployment {{ .Values.tuf.secrets.tsa.deploymentName }} --timeout=120s -n {{ .Values.tuf.secrets.tsa.namespace }}" | ||
] | ||
containers: | ||
- name: copy-rekor-secret | ||
image: {{ template "scaffold.image" .Values.copySecretJob }} | ||
imagePullPolicy: {{ .Values.copySecretJob.pullPolicy }} | ||
command: ["/bin/sh"] | ||
args: [ | ||
"-c", | ||
"curl {{ .Values.tuf.secrets.rekor.deploymentName}}.{{ .Values.tuf.secrets.rekor.namespace }}.svc.cluster.local/api/v1/log/publicKey -o /tmp/key -v && \ | ||
kubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n name: {{ .Values.tuf.secrets.rekor.name }}\n namespace: {{ .Values.forceNamespace }}\ndata:\n key: $(cat /tmp/key | base64 -w 0)\nEOF\n" | ||
] | ||
- name: copy-fulcio-secret | ||
image: {{ template "scaffold.image" .Values.copySecretJob }} | ||
imagePullPolicy: {{ .Values.copySecretJob.pullPolicy }} | ||
command: ["/bin/sh"] | ||
args: [ | ||
"-c", | ||
"kubectl -n {{ .Values.forceNamespace }} delete secret {{ .Values.tuf.secrets.fulcio.name }} --ignore-not-found && \ | ||
kubectl -n {{ .Values.tuf.secrets.fulcio.namespace }} get secrets {{ .Values.tuf.secrets.fulcio.name }} -oyaml | sed 's/namespace: .*/namespace: {{ .Values.forceNamespace }}/' | kubectl apply -f -" | ||
] | ||
- name: copy-ctlog-secret | ||
image: {{ template "scaffold.image" .Values.copySecretJob }} | ||
imagePullPolicy: {{ .Values.copySecretJob.pullPolicy }} | ||
command: ["/bin/sh"] | ||
args: [ | ||
"-c", | ||
"kubectl -n {{ .Values.forceNamespace }} delete secret {{ .Values.tuf.secrets.ctlog.name }} --ignore-not-found && \ | ||
kubectl -n {{ .Values.tuf.secrets.ctlog.namespace }} get secrets {{ .Values.tuf.secrets.ctlog.name }} -oyaml | sed 's/namespace: .*/namespace: {{ .Values.forceNamespace }}/' | kubectl apply -f -" | ||
] | ||
- name: copy-tsa-secret | ||
image: {{ template "scaffold.image" .Values.copySecretJob }} | ||
imagePullPolicy: {{ .Values.copySecretJob.pullPolicy }} | ||
command: ["/bin/sh"] | ||
args: [ | ||
"-c", | ||
"curl {{ .Values.tuf.secrets.tsa.deploymentName}}.{{ .Values.tuf.secrets.tsa.namespace }}.svc.cluster.local/api/v1/timestamp/certchain -o /tmp/cert-chain -v && \ | ||
kubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n name: {{ .Values.tuf.secrets.tsa.name }}\n namespace: {{ .Values.forceNamespace }}\ndata:\n cert-chain: $(cat /tmp/cert-chain | base64 -w 0)\nEOF\n" | ||
] | ||
{{- if .Values.copySecretJob.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml .Values.copySecretJob.nodeSelector | indent 12 }} | ||
{{- end }} | ||
{{- if .Values.copySecretJob.tolerations }} | ||
tolerations: | ||
{{ toYaml .Values.copySecretJob.tolerations | indent 12 }} | ||
{{- end }} | ||
{{- if .Values.copySecretJob.affinity }} | ||
affinity: | ||
{{ toYaml .Values.copySecretJob.affinity | indent 12 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.