|
| 1 | +{{- if .Values.cronjob.enabled }} |
| 2 | +apiVersion: batch/v1 |
| 3 | +kind: CronJob |
| 4 | +metadata: |
| 5 | + name: {{ include "zama-protocol-pause.fullname" . }} |
| 6 | + namespace: {{ include "zama-protocol-pause.namespace" . }} |
| 7 | + labels: |
| 8 | + {{- include "zama-protocol-pause.labels" . | nindent 4 }} |
| 9 | + {{- with .Values.cronjob.annotations }} |
| 10 | + annotations: |
| 11 | + {{- toYaml . | nindent 4 }} |
| 12 | + {{- end }} |
| 13 | +spec: |
| 14 | + schedule: {{ .Values.cronjob.schedule | quote }} |
| 15 | + {{- with .Values.cronjob.concurrencyPolicy }} |
| 16 | + concurrencyPolicy: {{ . }} |
| 17 | + {{- end }} |
| 18 | + {{- with .Values.cronjob.failedJobsHistoryLimit }} |
| 19 | + failedJobsHistoryLimit: {{ . }} |
| 20 | + {{- end }} |
| 21 | + {{- with .Values.cronjob.successfulJobsHistoryLimit }} |
| 22 | + successfulJobsHistoryLimit: {{ . }} |
| 23 | + {{- end }} |
| 24 | + {{- with .Values.cronjob.startingDeadlineSeconds }} |
| 25 | + startingDeadlineSeconds: {{ . }} |
| 26 | + {{- end }} |
| 27 | + {{- with .Values.cronjob.suspend }} |
| 28 | + suspend: {{ . }} |
| 29 | + {{- end }} |
| 30 | + jobTemplate: |
| 31 | + spec: |
| 32 | + {{- with .Values.cronjob.ttlSecondsAfterFinished }} |
| 33 | + ttlSecondsAfterFinished: {{ . }} |
| 34 | + {{- end }} |
| 35 | + {{- with .Values.cronjob.backoffLimit }} |
| 36 | + backoffLimit: {{ . }} |
| 37 | + {{- end }} |
| 38 | + {{- with .Values.cronjob.activeDeadlineSeconds }} |
| 39 | + activeDeadlineSeconds: {{ . }} |
| 40 | + {{- end }} |
| 41 | + template: |
| 42 | + metadata: |
| 43 | + {{- with .Values.podAnnotations }} |
| 44 | + annotations: |
| 45 | + {{- toYaml . | nindent 12 }} |
| 46 | + {{- end }} |
| 47 | + labels: |
| 48 | + {{- include "zama-protocol-pause.selectorLabels" . | nindent 12 }} |
| 49 | + {{- with .Values.podLabels }} |
| 50 | + {{- toYaml . | nindent 12 }} |
| 51 | + {{- end }} |
| 52 | + spec: |
| 53 | + {{- with .Values.imagePullSecrets }} |
| 54 | + imagePullSecrets: |
| 55 | + {{- toYaml . | nindent 12 }} |
| 56 | + {{- end }} |
| 57 | + {{- if .Values.serviceAccount.create }} |
| 58 | + serviceAccountName: {{ include "zama-protocol-pause.serviceAccountName" . }} |
| 59 | + {{- end }} |
| 60 | + {{- with .Values.podSecurityContext }} |
| 61 | + securityContext: |
| 62 | + {{- toYaml . | nindent 12 }} |
| 63 | + {{- end }} |
| 64 | + restartPolicy: {{ .Values.cronjob.restartPolicy | default "Never" }} |
| 65 | + containers: |
| 66 | + - name: {{ .Chart.Name }} |
| 67 | + {{- with .Values.securityContext }} |
| 68 | + securityContext: |
| 69 | + {{- toYaml . | nindent 16 }} |
| 70 | + {{- end }} |
| 71 | + image: "{{ .Values.image.repository | default .Values.image.repository }}:{{ .Values.image.tag | default .Values.image.tag | default .Chart.AppVersion }}" |
| 72 | + imagePullPolicy: {{ .Values.image.pullPolicy | default .Values.image.pullPolicy }} |
| 73 | + command: |
| 74 | + - /bin/sh |
| 75 | + - -c |
| 76 | + args: |
| 77 | + {{- if .Values.wallet.awsKMS.enabled }} |
| 78 | + - PAUSER_ADDRESS=$(cast wallet address --aws ${WALLET_PRIVATE_KEY}) |
| 79 | + {{- else }} |
| 80 | + - PAUSER_ADDRESS=$(cast wallet address --private-key ${WALLET_PRIVATE_KEY}) |
| 81 | + {{- end }} |
| 82 | + - echo "Pauser job is configured for address:${PAUSER_ADDRESS}" |
| 83 | + {{- if .Values.dryRun }} |
| 84 | + - echo "Running in dry-run mode, no transactions will be sent." |
| 85 | + {{- else }} |
| 86 | + - echo "Pause Zama Protocol on Ethereum (Host) {{ .Values.network | title }}" |
| 87 | + - cast send {{ if .Values.wallet.awsKMS.enabled }}--aws{{ else }}--private-key ${WALLET_PRIVATE_KEY}{{ end }} ${ETHEREUM_ACL_CONTRACT_ADDRESS} ${ETHEREUM_ACL_CONTRACT_PAUSE_METHOD_ID} --rpc-url ${ETHEREUM_RPC_URL} |
| 88 | + - echo "Pause Zama Protocol on Gateway {{ .Values.network | title }}" |
| 89 | + - cast send {{ if .Values.wallet.awsKMS.enabled }}--aws{{ else }}--private-key ${WALLET_PRIVATE_KEY}{{ end }} ${GATEWAY_CONFIG_CONTRACT_ADDRESS} ${GATEWAY_CONFIG_CONTRACT_PAUSE_METHOD_ID} --rpc-url ${ETHEREUM_RPC_URL} |
| 90 | + {{- end }} |
| 91 | + env: |
| 92 | + {{- if .Values.wallet.awsKMS.enabled }} |
| 93 | + - name: AWS_KMS_KEY_ID |
| 94 | + valueFrom: |
| 95 | + configMapKeyRef: |
| 96 | + name: {{ .Values.wallet.awsKMS.configmap.name }} |
| 97 | + key: {{ .Values.wallet.awsKMS.configmap.key }} |
| 98 | + {{- else }} |
| 99 | + - name: WALLET_PRIVATE_KEY |
| 100 | + valueFrom: |
| 101 | + secretKeyRef: |
| 102 | + name: {{ .Values.wallet.secret.name }} |
| 103 | + key: {{ .Values.wallet.secret.key }} |
| 104 | + {{- end }} |
| 105 | + {{- with index .Values.config .Values.network }} |
| 106 | + - name: ETHEREUM_ACL_CONTRACT_ADDRESS |
| 107 | + value: {{ .ethereumAclContractAddress }} |
| 108 | + - name: GATEWAY_CONFIG_CONTRACT_ADDRESS |
| 109 | + value: {{ .gatewayConfigContractAddress }} |
| 110 | + {{- end }} |
| 111 | + - name: ETHEREUM_ACL_CONTRACT_PAUSE_METHOD_ID |
| 112 | + value: {{ .Values.config.pauseMethodIds.ethereumAclContract }} |
| 113 | + - name: GATEWAY_CONFIG_CONTRACT_PAUSE_METHOD_ID |
| 114 | + value: {{ .Values.config.pauseMethodIds.gatewayConfigContract }} |
| 115 | + {{- with .Values.env }} |
| 116 | + {{- toYaml . | nindent 16 }} |
| 117 | + {{- end }} |
| 118 | + {{- with .Values.cronjob.envFrom }} |
| 119 | + envFrom: |
| 120 | + {{- toYaml . | nindent 16 }} |
| 121 | + {{- end }} |
| 122 | + {{- if .Values.cronjob.resources }} |
| 123 | + resources: |
| 124 | + {{- toYaml .Values.cronjob.resources | nindent 16 }} |
| 125 | + {{- else }} |
| 126 | + {{- with .Values.resources }} |
| 127 | + resources: |
| 128 | + {{- toYaml . | nindent 16 }} |
| 129 | + {{- end }} |
| 130 | + {{- end }} |
| 131 | + {{- with .Values.volumeMounts }} |
| 132 | + volumeMounts: |
| 133 | + {{- toYaml . | nindent 16 }} |
| 134 | + {{- end }} |
| 135 | + {{- with .Values.volumes }} |
| 136 | + volumes: |
| 137 | + {{- toYaml . | nindent 12 }} |
| 138 | + {{- end }} |
| 139 | + {{- with .Values.nodeSelector }} |
| 140 | + nodeSelector: |
| 141 | + {{- toYaml . | nindent 12 }} |
| 142 | + {{- end }} |
| 143 | + {{- with .Values.affinity }} |
| 144 | + affinity: |
| 145 | + {{- toYaml . | nindent 12 }} |
| 146 | + {{- end }} |
| 147 | + {{- with .Values.tolerations }} |
| 148 | + tolerations: |
| 149 | + {{- toYaml . | nindent 12 }} |
| 150 | + {{- end }} |
| 151 | +{{- end }} |
0 commit comments