blob: ff2fa6df37e1ef6a83ac939b98b26d65b747a86b [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04001{{ $runCfg := .Values.runCfg | b64dec }}
2---
3apiVersion: v1
4kind: Secret
5metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +04006 name: {{ .Values.name }}-ssh-key
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04007type: Opaque
8data:
9 private: {{ .Values.sshPrivateKey }}
10---
11apiVersion: v1
12kind: ConfigMap
13metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040014 name: {{ .Values.name }}-run-cfg
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040015data:
16 run: |
17{{ indent 4 $runCfg }}
18---
Giorgi Lekveishvilicfa3ae92024-10-27 22:00:03 +040019{{- if .Values.appPorts }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040020apiVersion: v1
21kind: Service
22metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040023 name: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040024 namespace: {{ .Release.Namespace }}
25spec:
26 type: ClusterIP
27 selector:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040028 app: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040029 ports:
Giorgi Lekveishvilicfa3ae92024-10-27 22:00:03 +040030 {{- range .Values.appPorts }}
31 - name: {{ .name }}
Giorgi Lekveishvili287fa312024-10-27 22:43:52 +040032 port: {{ .containerPort }}
Giorgi Lekveishvilicfa3ae92024-10-27 22:00:03 +040033 targetPort: {{ .name }}
34 protocol: {{ .protocol }}
35 {{- end }}
36{{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040037---
38apiVersion: v1
39kind: Service
40metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040041 name: {{ .Values.name }}-api
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040042 namespace: {{ .Release.Namespace }}
43spec:
44 type: ClusterIP
45 selector:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040046 app: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040047 ports:
48 - name: api
Giorgi Lekveishvili96cf7452024-10-30 07:50:32 +040049 port: 80
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040050 targetPort: api
51 protocol: TCP
52---
53apiVersion: apps/v1
54kind: Deployment
55metadata:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040056 name: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040057 namespace: {{ .Release.Namespace }}
Giorgi Lekveishvili34f4f942024-08-18 18:30:34 +040058 annotations:
59 dodo.cloud/config-checksum: {{ sha256sum .Values.runCfg }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040060spec:
61 selector:
62 matchLabels:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040063 app: {{ .Values.name }}-app
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040064 replicas: 1
65 template:
66 metadata:
67 labels:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040068 app: {{ .Values.name }}-app
Giorgi Lekveishvili128b11a2024-08-18 18:47:13 +040069 annotations:
70 dodo.cloud/config-checksum: {{ sha256sum .Values.runCfg }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040071 spec:
72 runtimeClassName: {{ .Values.runtimeClassName }}
73 volumes:
74 - name: ssh-key
75 secret:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040076 secretName: {{ .Values.name }}-ssh-key
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040077 - name: run-cfg
78 configMap:
Giorgi Lekveishvili93e50922024-11-21 18:28:06 +040079 name: {{ .Values.name }}-run-cfg
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040080 {{- range .Values.volumes }}
81 - name: volume-{{ .name }}
82 persistentVolumeClaim:
83 claimName: {{ .name }}
84 {{- end }}
85 containers:
86 - name: app
87 image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
88 imagePullPolicy: {{ .Values.image.pullPolicy }}
89 ports:
90 - name: api
Giorgi Lekveishvili96cf7452024-10-30 07:50:32 +040091 containerPort: {{ .Values.apiPort }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040092 protocol: TCP
Giorgi Lekveishvilib46e2a62024-10-27 18:39:30 +040093 {{- if .Values.appPorts }}
94 {{ toYaml .Values.appPorts | nindent 8 }}
95 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040096 env:
97 - name: SELF_IP
98 valueFrom:
99 fieldRef:
100 fieldPath: status.podIP
101 command:
102 - app-runner
Giorgi Lekveishvili96cf7452024-10-30 07:50:32 +0400103 - --port={{ .Values.apiPort }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400104 - --app-id={{ .Values.appId }}
105 - --app-dir={{ .Values.appDir }}
106 - --repo-addr={{ .Values.repoAddr }}
Giorgi Lekveishvili971aa302024-10-24 08:56:18 +0400107 - --branch={{ .Values.branch }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400108 - --ssh-key=/pcloud/ssh-key/private
109 - --run-cfg=/pcloud/config/run
110 - --manager-addr={{ .Values.managerAddr }}
111 volumeMounts:
112 - name: ssh-key
113 readOnly: true
114 mountPath: /pcloud/ssh-key
115 - name: run-cfg
116 readOnly: true
117 mountPath: /pcloud/config
118 {{- range .Values.volumes }}
119 - name: volume-{{ .name }}
120 mountPath: {{ .mountPath }}
121 {{- end }}
Giorgi Lekveishvili7ef0ff12024-09-21 10:27:57 +0400122 {{- if .Values.extraContainers }}
123 {{ toYaml .Values.extraContainers | nindent 6 }}
124 {{- end }}