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