|
| 1 | +{{- if .Values.dbconnector.enabled }} |
| 2 | +apiVersion: apps/v1 |
| 3 | +kind: Deployment |
| 4 | +metadata: |
| 5 | + name: {{ include "retool.dbconnector.name" . }} |
| 6 | + labels: |
| 7 | + {{- include "retool.dbconnector.selectorLabels" . | nindent 4 }} |
| 8 | + {{- include "retool.dbconnector.labels" . | nindent 4 }} |
| 9 | + {{- include "retool.labels" . | nindent 4 }} |
| 10 | + {{- if .Values.deployment.annotations }} |
| 11 | + annotations: |
| 12 | + {{- toYaml .Values.deployment.annotations | nindent 4 }} |
| 13 | + {{- end }} |
| 14 | +spec: |
| 15 | + replicas: {{ .Values.dbconnector.replicas }} |
| 16 | + selector: |
| 17 | + matchLabels: |
| 18 | + {{- include "retool.dbconnector.selectorLabels" . | nindent 6 }} |
| 19 | + template: |
| 20 | + metadata: |
| 21 | + annotations: |
| 22 | + {{- if .Values.podAnnotations }} |
| 23 | + {{ toYaml .Values.podAnnotations | indent 8 }} |
| 24 | + {{- end }} |
| 25 | + {{- if .Values.backend.annotations }} |
| 26 | + {{ toYaml .Values.backend.annotations | indent 8 }} |
| 27 | + {{- end }} |
| 28 | + labels: |
| 29 | + {{- include "retool.dbconnector.selectorLabels" . | nindent 8 }} |
| 30 | + {{- include "retool.dbconnector.labels" . | nindent 8 }} |
| 31 | + {{- include "retool.labels" . | nindent 8 }} |
| 32 | + spec: |
| 33 | + {{- if .Values.dbconnector.terminationGracePeriodSeconds }} |
| 34 | + terminationGracePeriodSeconds: {{ .Values.dbconnector.terminationGracePeriodSeconds }} |
| 35 | + {{- end }} |
| 36 | + containers: |
| 37 | + - args: |
| 38 | + - bash |
| 39 | + - -c |
| 40 | + - chmod -R +x ./docker_scripts; sync; ./docker_scripts/start_api.sh |
| 41 | + image: "{{ .Values.image.repository }}:{{ required "Please set a value for .Values.image.tag" .Values.image.tag }}" |
| 42 | + name: {{ include "retool.dbconnector.name" . }} |
| 43 | + readinessProbe: |
| 44 | + httpGet: |
| 45 | + path: {{ .Values.readinessProbe.path }} |
| 46 | + port: {{ .Values.dbconnector.port }} |
| 47 | + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} |
| 48 | + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} |
| 49 | + successThreshold: {{ .Values.readinessProbe.successThreshold }} |
| 50 | + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} |
| 51 | + livenessProbe: |
| 52 | + httpGet: |
| 53 | + path: {{ .Values.livenessProbe.path }} |
| 54 | + port: {{ .Values.dbconnector.port }} |
| 55 | + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} |
| 56 | + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} |
| 57 | + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} |
| 58 | + resources: |
| 59 | + {{- if .Values.dbconnector.resources }} |
| 60 | + {{- toYaml .Values.dbconnector.resources | nindent 10 }} |
| 61 | + {{- else }} |
| 62 | + {{- toYaml .Values.resources | nindent 10 }} |
| 63 | + {{- end }} |
| 64 | + env: |
| 65 | + {{- if $.Values.dbconnector.java.enabled }} |
| 66 | + - name: SERVICE_TYPE |
| 67 | + value: DB_CONNECTOR,DB_SSH_CONNECTOR,JAVA_DBCONNECTOR |
| 68 | + {{- else }} |
| 69 | + - name: SERVICE_TYPE |
| 70 | + value: DB_CONNECTOR,DB_SSH_CONNECTOR |
| 71 | + {{- end }} |
| 72 | + - name: DEPLOYMENT_TEMPLATE_TYPE |
| 73 | + value: {{ template "retool.deploymentTemplateType" . }} |
| 74 | + - name: DEPLOYMENT_TEMPLATE_VERSION |
| 75 | + value: {{ template "retool.deploymentTemplateVersion" . }} |
| 76 | + - name: NODE_ENV |
| 77 | + value: production |
| 78 | + - name: NODE_OPTIONS |
| 79 | + value: {{ .Values.dbconnector.config.nodeOptions }} |
| 80 | + - name: DBCONNECTOR_HTTP_AGENT_MAX_SOCKETS |
| 81 | + value: {{ .Values.dbconnector.config.httpAgentMaxSockets | quote }} |
| 82 | + - name: DBCONNECTOR_POSTGRES_POOL_MAX_SIZE |
| 83 | + value: {{ .Values.dbconnector.config.postgresPoolMaxSize | quote }} |
| 84 | + - name: DISABLE_DATABASE_MIGRATIONS |
| 85 | + value: "true" |
| 86 | + - name: WORKFLOW_BACKEND_HOST |
| 87 | + value: http://{{ template "retool.fullname" . }}-workflow-backend |
| 88 | + - name: CLIENT_ID |
| 89 | + value: {{ default "" .Values.config.auth.google.clientId }} |
| 90 | + - name: COOKIE_INSECURE |
| 91 | + value: {{ .Values.config.useInsecureCookies | quote }} |
| 92 | + {{- if and (not .Values.externalSecrets.enabled) (not .Values.externalSecrets.externalSecretsOperator.enabled) }} |
| 93 | + - name: LICENSE_KEY |
| 94 | + valueFrom: |
| 95 | + secretKeyRef: |
| 96 | + {{- if .Values.config.licenseKeySecretName }} |
| 97 | + name: {{ .Values.config.licenseKeySecretName }} |
| 98 | + key: {{ .Values.config.licenseKeySecretKey | default "license-key" }} |
| 99 | + {{- else }} |
| 100 | + name: {{ template "retool.fullname" . }} |
| 101 | + key: license-key |
| 102 | + {{- end }} |
| 103 | + - name: JWT_SECRET |
| 104 | + valueFrom: |
| 105 | + secretKeyRef: |
| 106 | + {{- if .Values.config.jwtSecretSecretName }} |
| 107 | + name: {{ .Values.config.jwtSecretSecretName }} |
| 108 | + key: {{ .Values.config.jwtSecretSecretKey | default "jwt-secret" }} |
| 109 | + {{- else }} |
| 110 | + name: {{ template "retool.fullname" . }} |
| 111 | + key: jwt-secret |
| 112 | + {{- end }} |
| 113 | + - name: ENCRYPTION_KEY |
| 114 | + valueFrom: |
| 115 | + secretKeyRef: |
| 116 | + {{- if .Values.config.encryptionKeySecretName }} |
| 117 | + name: {{ .Values.config.encryptionKeySecretName }} |
| 118 | + key: {{ .Values.config.encryptionKeySecretKey | default "encryption-key" }} |
| 119 | + {{- else }} |
| 120 | + name: {{ template "retool.fullname" . }} |
| 121 | + key: encryption-key |
| 122 | + {{- end }} |
| 123 | + - name: POSTGRES_PASSWORD |
| 124 | + valueFrom: |
| 125 | + secretKeyRef: |
| 126 | + {{- if .Values.postgresql.enabled }} |
| 127 | + name: {{ template "retool.postgresql.fullname" . }} |
| 128 | + # `postgres` is the default admin username for postgres in the subchart we use, so it needs the admin password |
| 129 | + # if a different username is picked, then it needs the custom password instead. |
| 130 | + {{- if eq .Values.postgresql.auth.username "postgres" }} |
| 131 | + key: postgres-password |
| 132 | + {{- else }} |
| 133 | + key: password |
| 134 | + {{- end }} |
| 135 | + {{- else }} |
| 136 | + {{- if .Values.config.postgresql.passwordSecretName }} |
| 137 | + name: {{ .Values.config.postgresql.passwordSecretName }} |
| 138 | + key: {{ .Values.config.postgresql.passwordSecretKey | default "postgresql-password" }} |
| 139 | + {{- else }} |
| 140 | + name: {{ template "retool.fullname" . }} |
| 141 | + key: postgresql-password |
| 142 | + {{- end }} |
| 143 | + {{- end }} |
| 144 | + - name: CLIENT_SECRET |
| 145 | + valueFrom: |
| 146 | + secretKeyRef: |
| 147 | + {{- if .Values.config.auth.google.clientSecretSecretName }} |
| 148 | + name: {{ .Values.config.auth.google.clientSecretSecretName }} |
| 149 | + key: {{ .Values.config.auth.google.clientSecretSecretKey | default "google-client-secret" }} |
| 150 | + {{- else }} |
| 151 | + name: {{ template "retool.fullname" . }} |
| 152 | + key: google-client-secret |
| 153 | + {{- end }} |
| 154 | + {{- end }} |
| 155 | + {{- range $key, $value := .Values.env }} |
| 156 | + - name: "{{ $key }}" |
| 157 | + value: "{{ $value }}" |
| 158 | + {{- end }} |
| 159 | + {{- range .Values.environmentSecrets }} |
| 160 | + - name: {{ .name }} |
| 161 | + valueFrom: |
| 162 | + secretKeyRef: |
| 163 | + name: {{ .secretKeyRef.name }} |
| 164 | + key: {{ .secretKeyRef.key }} |
| 165 | + {{- end }} |
| 166 | + {{- with .Values.environmentVariables }} |
| 167 | +{{ toYaml . | indent 10 }} |
| 168 | + {{- end }} |
| 169 | + {{- if .Values.externalSecrets.enabled }} |
| 170 | + envFrom: |
| 171 | + - secretRef: |
| 172 | + name: {{ .Values.externalSecrets.name }} |
| 173 | + {{- range .Values.externalSecrets.secrets }} |
| 174 | + - secretRef: |
| 175 | + name: {{ .name }} |
| 176 | + {{- end }} |
| 177 | + {{- end }} |
| 178 | + {{- if .Values.externalSecrets.externalSecretsOperator.enabled }} |
| 179 | + envFrom: |
| 180 | + {{- range .Values.externalSecrets.externalSecretsOperator.secretRef }} |
| 181 | + - secretRef: |
| 182 | + name: {{ .name }} |
| 183 | + {{- end }} |
| 184 | + {{- end }} |
| 185 | + volumeMounts: |
| 186 | + {{- range $configFile := (keys .Values.files) }} |
| 187 | + - name: {{ template "retool.name" $ }} |
| 188 | + mountPath: "/usr/share/retool/config/{{ $configFile }}" |
| 189 | + subPath: {{ $configFile }} |
| 190 | + {{- end }} |
| 191 | + {{- if and .Values.persistentVolumeClaim.enabled .Values.persistentVolumeClaim.mountPath }} |
| 192 | + - name: retool-pv |
| 193 | + mountPath: {{ .Values.persistentVolumeClaim.mountPath }} |
| 194 | + {{- end }} |
| 195 | + {{- if .Values.extraVolumeMounts }} |
| 196 | + {{- toYaml .Values.extraVolumeMounts | nindent 8 }} |
| 197 | + {{- end }} |
| 198 | + {{- with .Values.extraContainers }} |
| 199 | + {{- tpl . $ | indent 8 }} |
| 200 | + {{- end }} |
| 201 | + {{- range .Values.extraConfigMapMounts }} |
| 202 | + - name: {{ .name }} |
| 203 | + mountPath: {{ .mountPath }} |
| 204 | + subPath: {{ .subPath }} |
| 205 | + {{- end }} |
| 206 | + {{- if .Values.image.pullSecrets }} |
| 207 | + imagePullSecrets: |
| 208 | + {{- toYaml .Values.image.pullSecrets | nindent 8 }} |
| 209 | + {{- end }} |
| 210 | + {{- if .Values.affinity }} |
| 211 | + affinity: |
| 212 | + {{- toYaml .Values.affinity | nindent 8 }} |
| 213 | + {{- end }} |
| 214 | + {{- if .Values.nodeSelector }} |
| 215 | + nodeSelector: |
| 216 | + {{- toYaml .Values.nodeSelector | nindent 8 }} |
| 217 | + {{- end }} |
| 218 | + tolerations: |
| 219 | + {{- toYaml .Values.tolerations | nindent 8 }} |
| 220 | + {{- if .Values.securityContext.enabled }} |
| 221 | + securityContext: |
| 222 | + runAsUser: {{ .Values.securityContext.runAsUser }} |
| 223 | + fsGroup: {{ .Values.securityContext.fsGroup }} |
| 224 | + {{- end }} |
| 225 | + volumes: |
| 226 | + {{- range .Values.extraConfigMapMounts }} |
| 227 | + - name: {{ .name }} |
| 228 | + configMap: |
| 229 | + name: {{ .configMap }} |
| 230 | + {{- end }} |
| 231 | + {{- if .Values.persistentVolumeClaim.enabled }} |
| 232 | + - name: retool-pv |
| 233 | + persistentVolumeClaim: |
| 234 | + claimName: {{ default (include "retool.fullname" .) .Values.persistentVolumeClaim.existingClaim }} |
| 235 | + {{- end }} |
| 236 | + {{- if .Values.extraVolumes }} |
| 237 | + {{- toYaml .Values.extraVolumes | nindent 8 }} |
| 238 | + {{- end }} |
| 239 | +--- |
| 240 | + |
| 241 | +{{- if .Values.podDisruptionBudget }} |
| 242 | +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.Version -}} |
| 243 | +apiVersion: policy/v1 |
| 244 | +{{- else -}} |
| 245 | +apiVersion: policy/v1beta1 |
| 246 | +{{- end }} |
| 247 | +kind: PodDisruptionBudget |
| 248 | +metadata: |
| 249 | + name: {{ include "retool.dbconnector.name" . }} |
| 250 | +spec: |
| 251 | + {{ toYaml .Values.podDisruptionBudget }} |
| 252 | + selector: |
| 253 | + matchLabels: |
| 254 | + {{- include "retool.dbconnector.selectorLabels" . | nindent 6 }} |
| 255 | +--- |
| 256 | +{{- end }} |
| 257 | + |
| 258 | +apiVersion: v1 |
| 259 | +kind: Service |
| 260 | +metadata: |
| 261 | + name: {{ include "retool.dbconnector.name" . }} |
| 262 | +spec: |
| 263 | + selector: |
| 264 | + retoolService: {{ include "retool.dbconnector.name" . }} |
| 265 | + ports: |
| 266 | + - protocol: TCP |
| 267 | + name: http-server |
| 268 | + port: {{ .Values.dbconnector.port }} |
| 269 | + targetPort: {{ .Values.dbconnector.port }} |
| 270 | +{{- end }} |
0 commit comments