blob: 103b9471733eb9a4dd1c72d1a4187eec8b98c0b6 [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04001apiVersion: rbac.authorization.k8s.io/v1
2kind: ClusterRole
3metadata:
4 name: {{ .Values.clusterRoleName }}
5rules:
6- apiGroups:
7 - ""
8 resources:
9 - namespaces
10 verbs:
11 - create
12- apiGroups:
13 - "batch"
14 resources:
15 - jobs
16 verbs:
17 - create
18- apiGroups:
19 - "helm.toolkit.fluxcd.io"
20 resources:
21 - helmreleases
22 verbs:
23 - get
24---
25apiVersion: rbac.authorization.k8s.io/v1
26kind: ClusterRoleBinding
27metadata:
28 name: {{ .Values.clusterRoleName }}
29roleRef:
30 apiGroup: rbac.authorization.k8s.io
31 kind: ClusterRole
32 name: {{ .Values.clusterRoleName }}
33subjects:
34- kind: ServiceAccount
35 name: default
36 namespace: {{ .Release.Namespace }}
37---
38apiVersion: v1
39kind: Secret
40metadata:
41 name: ssh-key
42type: Opaque
43data:
44 private: {{ .Values.sshPrivateKey }}
45---
46apiVersion: v1
47kind: Service
48metadata:
49 name: api
Giorgi Lekveishvili24820312024-10-06 21:54:48 +040050{{- if .Values.serviceAPI.annotations }}
51 annotations:
52{{ toYaml .Values.serviceAPI.annotations | indent 4 }}
53{{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040054spec:
Giorgi Lekveishvili24820312024-10-06 21:54:48 +040055 type: {{ .Values.serviceAPI.type }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040056 selector:
57 app: dodo-app
58 ports:
59 - name: http
60 port: 80
61 targetPort: api
62 protocol: TCP
63---
64apiVersion: v1
65kind: Service
66metadata:
67 name: web
68spec:
69 type: ClusterIP
70 selector:
71 app: dodo-app
72 ports:
73 - name: http
74 port: 80
75 targetPort: http
76 protocol: TCP
77---
78apiVersion: apps/v1
79kind: Deployment
80metadata:
81 name: dodo-app
82spec:
83 selector:
84 matchLabels:
85 app: dodo-app
86 replicas: 1
87 template:
88 metadata:
89 labels:
90 app: dodo-app
91 spec:
92 volumes:
93 - name: ssh-key
94 secret:
95 secretName: ssh-key
96 - name: env-config
97 secret:
98 secretName: env-config
99 - name: db
100 persistentVolumeClaim:
101 claimName: {{ .Values.persistentVolumeClaimName }}
102 initContainers:
103 - name: volume-permissions
104 image: busybox:latest
105 command: ["sh", "-c", "chmod -Rv 777 /dodo-app/db"]
106 volumeMounts:
107 - name: db
108 mountPath: /dodo-app/db
109 containers:
110 - name: dodo-app
111 image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
112 imagePullPolicy: {{ .Values.image.pullPolicy }}
113 ports:
114 - name: http
115 containerPort: {{ .Values.port }}
116 protocol: TCP
117 - name: api
118 containerPort: {{ .Values.apiPort }}
119 protocol: TCP
120 command:
121 - pcloud-installer
122 - dodo-app
123 - --repo-addr={{ .Values.repoAddr }}
124 - --ssh-key=/pcloud/ssh-key/private
125 - --port={{ .Values.port }}
126 - --api-port={{ .Values.apiPort }}
127 - --self={{ .Values.self }}
Giorgi Lekveishvili27d58732024-09-25 10:30:06 +0200128 - --self-public={{ .Values.selfPublic }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400129 - --repo-public-addr={{ .Values.repoPublicAddr }}
130 - --namespace={{ .Values.namespace }} # TODO(gio): maybe use .Release.Namespace ?
131 - --env-app-manager-addr={{ .Values.envAppManagerAddr }}
132 - --env-config=/pcloud/env-config/config.json
133 - --git-repo-public-key={{ .Values.gitRepoPublicKey }}
134 - --db=/dodo-app/db/apps.db
135 - --networks={{ .Values.allowedNetworks }}
136 - --external={{ .Values.external }}
137 - --fetch-users-addr={{ .Values.fetchUsersAddr }}
Giorgi Lekveishvili2c5b94a2024-08-27 14:34:01 +0400138 - --headscale-api-addr={{ .Values.headscaleAPIAddr }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400139 volumeMounts:
140 - name: ssh-key
141 readOnly: true
142 mountPath: /pcloud/ssh-key
143 - name: env-config
144 readOnly: true
145 mountPath: /pcloud/env-config
146 - name: db
147 mountPath: /dodo-app/db
148---
149apiVersion: v1
150kind: Secret
151metadata:
152 name: env-config
153type: Opaque
154data:
155 config.json: {{ .Values.envConfig }}