blob: 3279d4b9209ecffdc9f2314e5819276b64e967e9 [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04001{{ $runCfg := .Values.runCfg | b64dec }}
2---
Giorgi Lekveishvili89cb44f2025-03-28 15:36:20 +04003{{- if .Values.sshPrivateKey }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04004apiVersion: v1
5kind: Secret
6metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +04007 name: {{ .Values.name }}-ssh-key
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04008type: Opaque
9data:
10 private: {{ .Values.sshPrivateKey }}
Giorgi Lekveishvili89cb44f2025-03-28 15:36:20 +040011{{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040012---
13apiVersion: v1
14kind: ConfigMap
15metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040016 name: {{ .Values.name }}-run-cfg
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040017data:
18 run: |
19{{ indent 4 $runCfg }}
20---
Giorgi Lekveishvilicfa3ae92024-10-27 22:00:03 +040021{{- if .Values.appPorts }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040022apiVersion: v1
23kind: Service
24metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040025 name: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040026 namespace: {{ .Release.Namespace }}
27spec:
28 type: ClusterIP
29 selector:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040030 app: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040031 ports:
Giorgi Lekveishvilicfa3ae92024-10-27 22:00:03 +040032 {{- range .Values.appPorts }}
33 - name: {{ .name }}
Giorgi Lekveishvili287fa312024-10-27 22:43:52 +040034 port: {{ .containerPort }}
Giorgi Lekveishvilicfa3ae92024-10-27 22:00:03 +040035 targetPort: {{ .name }}
36 protocol: {{ .protocol }}
37 {{- end }}
38{{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040039---
40apiVersion: v1
41kind: Service
42metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040043 name: {{ .Values.name }}-api
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040044 namespace: {{ .Release.Namespace }}
45spec:
46 type: ClusterIP
47 selector:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040048 app: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040049 ports:
50 - name: api
Giorgi Lekveishvili96cf7452024-10-30 07:50:32 +040051 port: 80
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040052 targetPort: api
53 protocol: TCP
54---
55apiVersion: apps/v1
56kind: Deployment
57metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040058 name: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040059 namespace: {{ .Release.Namespace }}
Giorgi Lekveishvili34f4f942024-08-18 18:30:34 +040060 annotations:
61 dodo.cloud/config-checksum: {{ sha256sum .Values.runCfg }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040062spec:
63 selector:
64 matchLabels:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040065 app: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040066 replicas: 1
67 template:
68 metadata:
69 labels:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040070 app: {{ .Values.name }}-app
Giorgi Lekveishvili128b11a2024-08-18 18:47:13 +040071 annotations:
72 dodo.cloud/config-checksum: {{ sha256sum .Values.runCfg }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040073 spec:
74 runtimeClassName: {{ .Values.runtimeClassName }}
75 volumes:
Giorgi Lekveishvilif7dd50e2025-03-28 15:55:14 +040076 {{- if .Values.sshPrivateKey }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040077 - name: ssh-key
78 secret:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040079 secretName: {{ .Values.name }}-ssh-key
Giorgi Lekveishvilif7dd50e2025-03-28 15:55:14 +040080 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040081 - name: run-cfg
82 configMap:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040083 name: {{ .Values.name }}-run-cfg
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040084 {{- range .Values.volumes }}
85 - name: volume-{{ .name }}
86 persistentVolumeClaim:
87 claimName: {{ .name }}
88 {{- end }}
89 containers:
90 - name: app
91 image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
92 imagePullPolicy: {{ .Values.image.pullPolicy }}
93 ports:
94 - name: api
Giorgi Lekveishvili96cf7452024-10-30 07:50:32 +040095 containerPort: {{ .Values.apiPort }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040096 protocol: TCP
Giorgi Lekveishvilib46e2a62024-10-27 18:39:30 +040097 {{- if .Values.appPorts }}
98 {{ toYaml .Values.appPorts | nindent 8 }}
99 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400100 env:
101 - name: SELF_IP
102 valueFrom:
103 fieldRef:
104 fieldPath: status.podIP
105 command:
106 - app-runner
Giorgi Lekveishvili96cf7452024-10-30 07:50:32 +0400107 - --port={{ .Values.apiPort }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400108 - --app-id={{ .Values.appId }}
Giorgi Lekveishvilifd87cbd2025-05-12 17:33:26 +0400109 - --service={{ .Values.name }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400110 - --app-dir={{ .Values.appDir }}
111 - --repo-addr={{ .Values.repoAddr }}
Giorgi Lekveishvili971aa302024-10-24 08:56:18 +0400112 - --branch={{ .Values.branch }}
Giorgi Lekveishvilic7a424a2025-03-28 15:37:19 +0400113 - --root-dir={{ .Values.rootDir }}
Giorgi Lekveishvilif7dd50e2025-03-28 15:55:14 +0400114 {{- if .Values.sshPrivateKey }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400115 - --ssh-key=/pcloud/ssh-key/private
Giorgi Lekveishvilif7dd50e2025-03-28 15:55:14 +0400116 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400117 - --run-cfg=/pcloud/config/run
118 - --manager-addr={{ .Values.managerAddr }}
119 volumeMounts:
Giorgi Lekveishvili4cc30382025-03-28 16:02:04 +0400120 {{- if .Values.sshPrivateKey }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400121 - name: ssh-key
122 readOnly: true
123 mountPath: /pcloud/ssh-key
Giorgi Lekveishvili4cc30382025-03-28 16:02:04 +0400124 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400125 - name: run-cfg
126 readOnly: true
127 mountPath: /pcloud/config
128 {{- range .Values.volumes }}
129 - name: volume-{{ .name }}
130 mountPath: {{ .mountPath }}
131 {{- end }}
Giorgi Lekveishvili7ef0ff12024-09-21 10:27:57 +0400132 {{- if .Values.extraContainers }}
133 {{ toYaml .Values.extraContainers | nindent 6 }}
134 {{- end }}