blob: 00ba74ee907d20e5b3b40ca3ce6dc2c3a5ef725a [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04001{{ $runCfg := .Values.runCfg | b64dec }}
2---
3apiVersion: v1
4kind: Secret
5metadata:
6 name: app-ssh-key
7type: Opaque
8data:
9 private: {{ .Values.sshPrivateKey }}
10---
11apiVersion: v1
12kind: ConfigMap
13metadata:
14 name: app-run-cfg
15data:
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:
23 name: app-app
24 namespace: {{ .Release.Namespace }}
25spec:
26 type: ClusterIP
27 selector:
28 app: app-app
29 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:
41 name: app-api
42 namespace: {{ .Release.Namespace }}
43spec:
44 type: ClusterIP
45 selector:
46 app: app-app
47 ports:
48 - name: api
49 port: 3000
50 targetPort: api
51 protocol: TCP
52---
53apiVersion: apps/v1
54kind: Deployment
55metadata:
56 name: app-app
57 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:
63 app: app-app
64 replicas: 1
65 template:
66 metadata:
67 labels:
68 app: app-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:
76 secretName: app-ssh-key
77 - name: run-cfg
78 configMap:
79 name: app-run-cfg
80 {{- 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
91 containerPort: 3000
92 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
103 - --port=3000
104 - --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 }}