-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcoder.yaml
428 lines (390 loc) · 14.3 KB
/
coder.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
blocks:
- name: deploy_pgadmin_application_blk
content:
targetRevision: 1.23.3
destinationNamespace: "postgres"
repoURL: "https://helm.runix.net"
chart: pgadmin4
values:
existingSecret: "pgadmin-login-password-secret"
env:
email: "{{ $cndi.get_prompt_response(pgadmin_login_email) }}"
persistentVolume:
enabled: true
size: 1Gi
serverDefinitions:
enabled: true
servers:
cndiServer:
Name: "My CNDI Server"
Group: "Servers"
Port: 5432
SSLMode: "prefer"
Username: "{{ $cndi.get_prompt_response(postgres_admin_username) }}"
Host: "coder-cluster-rw"
MaintenanceDB: coderdb
- name: deploy_pgadmin_ingress_blk
content:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: pgadmin-ingress
namespace: postgres
annotations:
cert-manager.io/cluster-issuer: cluster-issuer
kubernetes.io/tls-acme: "true"
external-dns.alpha.kubernetes.io/hostname: "{{ $cndi.get_prompt_response(pgadmin_hostname) }}"
spec:
ingressClassName: public
tls:
- hosts:
- "{{ $cndi.get_prompt_response(pgadmin_hostname) }}"
secretName: cluster-issuer-private-key
rules:
- host: "{{ $cndi.get_prompt_response(pgadmin_hostname) }}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: pgadmin-pgadmin4
port:
number: 80
- name: coder_ingress_blk
content:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: coder-ingress
namespace: coder
annotations:
cert-manager.io/cluster-issuer: cluster-issuer
kubernetes.io/tls-acme: "true"
external-dns.alpha.kubernetes.io/hostname: "{{ $cndi.get_prompt_response(coder_hostname) }}"
spec:
ingressClassName: public
tls:
- hosts:
- "{{ $cndi.get_prompt_response(coder_hostname) }}"
secretName: cluster-issuer-private-key
rules:
- host: "{{ $cndi.get_prompt_response(coder_hostname) }}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: coder
port:
number: 80
- name: pgadmin_login_password_secret_blk
content:
apiVersion: v1
kind: Secret
metadata:
name: pgadmin-login-password-secret
namespace: "{{ $cndi.get_prompt_response(pgadmin_login_password) }}"
type: Opaque
stringData:
password: $cndi_on_ow.seal_secret_from_env_var(PGADMIN_LOGIN_PASSWORD)
prompts:
- $cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/common/cluster/core-prompts.yaml):
{}
- $cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/{{ $cndi.get_prompt_response(deployment_target_provider) }}/core-prompts.yaml):
{}
- name: deploy_coder_ingress
message: >-
Do you want to expose Coder to the web?
type: Confirm
default: true
- name: coder_hostname
default: coder.example.com
message: >-
What hostname should Coder be accessible at?
type: Input
validators:
- hostname # FQDN
condition:
- "{{ $cndi.get_prompt_response(deploy_coder_ingress) }}"
- ==
- true
- name: deploy_pgadmin_application
default: true
message: >-
Do you want to install PgAdmin, a web-based database management tool?
type: Confirm
- name: deploy_pgadmin_ingress
default: true
message: >-
Do you want to expose PgAdmin to the web?
type: Confirm
condition:
- "{{ $cndi.get_prompt_response(deploy_pgadmin_application) }}"
- ==
- true
- name: pgadmin_hostname
default: pgadmin.example.com
message: >-
What hostname should PGAdmin be accessible at?
type: Input
validators:
- hostname # FQDN
condition:
- "{{ $cndi.get_prompt_response(deploy_pgadmin_ingress) }}"
- ==
- true
- name: pgadmin_login_email
default: [email protected]
message: >-
What email do you want to use for your PgAdmin login?
type: Input
condition:
- "{{ $cndi.get_prompt_response(deploy_pgadmin_application) }}"
- ==
- true
- name: pgadmin_login_password
default: postgres
message: >-
What password do you want to use for your PgAdmin login ?
type: Secret
condition:
- "{{ $cndi.get_prompt_response(deploy_pgadmin_application) }}"
- ==
- true
- name: deploy_postgres_ingress
default: true
message: >-
Do you want to expose PostgreSQL to the web?
type: Confirm
- name: postgres_hostname
default: postgres.example.com
message: >-
What hostname should PostgreSQL be accessible at?
type: Input
validators:
- hostname # FQDN
- min_length: 3
condition:
- "{{ $cndi.get_prompt_response(deploy_postgres_ingress) }}"
- ==
- true
- name: postgres_admin_username
default: postgres
message: >-
What username should be used for your PostgreSQL admin user?
type: Input
- name: postgres_admin_password
default: postgres
message: >-
What will be your default password for your PostgreSQL admin user?
type: Secret
outputs:
cndi_config:
cndi_version: v2
project_name: "{{ $cndi.get_prompt_response(project_name) }}"
provider: "{{ $cndi.get_prompt_response(deployment_target_provider) }}"
distribution: "{{ $cndi.get_prompt_response(deployment_target_distribution) }}"
# this is a Template comment
infrastructure:
cndi:
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/common/cluster/observability-config.yaml):
condition:
- "{{ $cndi.get_prompt_response(deploy_grafana_ingress) }}"
- ==
- true
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/common/cluster/argocd-config.yaml):
condition:
- "{{ $cndi.get_prompt_response(deploy_argocd_ingress) }}"
- ==
- true
external_dns:
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/external-dns/config/{{ $cndi.get_prompt_response(dns_provider) }}.yaml):
condition:
- "{{ $cndi.get_prompt_response(enable_external_dns) }}"
- ==
- true
cert_manager:
email: "{{ $cndi.get_prompt_response(cert_manager_email) }}"
open_ports:
- number: 5432
name: postgres
namespace: postgres
service: "coder-cluster-rw"
nodes:
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/{{ $cndi.get_prompt_response(deployment_target_provider) }}/basic-node-pool.yaml):
{}
cluster_manifests:
external-dns-secret:
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/external-dns/secret/{{ $cndi.get_prompt_response(dns_provider) }}.yaml):
condition:
- "{{ $cndi.get_prompt_response(enable_external_dns) }}"
- ==
- true
cnpg-namespace:
apiVersion: v1
kind: Namespace
metadata:
name: "postgres"
$cndi.comment(postgres-cluster): Configure your CNPG Cluster here
cnpg-cluster:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: "coder-cluster"
namespace: postgres
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
spec:
imageName: "ghcr.io/cloudnative-pg/postgresql:16"
instances: 3
storage:
size: 1Gi
replicationSlots:
highAvailability:
enabled: true
postgresql:
pg_hba:
- >-
hostssl coderdb {{
$cndi.get_prompt_response(postgres_admin_username) }} all password
bootstrap:
initdb:
database: coderdb
owner: "{{ $cndi.get_prompt_response(postgres_admin_username) }}"
secret:
name: cnpg-database-user-auth-secret
superuserSecret:
name: cnpg-cluster-superuser-auth-secret
$cndi.comment(postgres-auth-secret): Postgres Credentials
cnpg-cluster-superuser-auth-secret:
apiVersion: v1
kind: Secret
metadata:
name: cnpg-cluster-superuser-auth-secret
namespace: postgres
type: kubernetes.io/basic-auth
stringData:
username: $cndi_on_ow.seal_secret_from_env_var(POSTGRESQL_CLUSTER_SUPERUSER)
password: $cndi_on_ow.seal_secret_from_env_var(POSTGRESQL_PASSWORD)
cnpg-cluster-user-auth-secret:
apiVersion: v1
kind: Secret
metadata:
name: cnpg-database-user-auth-secret
namespace: postgres
type: kubernetes.io/basic-auth
stringData:
username: $cndi_on_ow.seal_secret_from_env_var(POSTGRESQL_USER)
password: $cndi_on_ow.seal_secret_from_env_var(POSTGRESQL_PASSWORD)
cnpg-connection-string-secret:
apiVersion: v1
kind: Secret
metadata:
name: cnpg-connection-string-secret
namespace: postgres
type: Opaque
stringData:
connection: $cndi_on_ow.seal_secret_from_env_var(POSTGRESQL_CONNECTION_STRING)
pgadmin-login-password-secret:
$cndi.get_block(pgadmin_login_password_secret_blk):
condition:
- "{{ $cndi.get_prompt_response(deploy_pgadmin_application) }}"
- ==
- true
postgres-ingress:
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/common/cluster/default-ingress.yaml):
args:
ingress_name: postgres-cluster-ingress
ingress_class_name: public
hostname: "{{ $cndi.get_prompt_response(postgres_hostname) }}"
service_name: "coder-cluster-rw"
service_port: 5432
namespace: postgres
condition:
- "{{ $cndi.get_prompt_response(deploy_postgres_ingress) }}"
- ==
- true
pgadmin-ingress:
$cndi.get_block(deploy_pgadmin_ingress_blk):
condition:
- "{{ $cndi.get_prompt_response(deploy_pgadmin_ingress) }}"
- ==
- true
coder-db-url-secret:
apiVersion: v1
kind: Secret
metadata:
name: coder-db-url
namespace: coder
type: Opaque
stringData:
url: $cndi_on_ow.seal_secret_from_env_var(POSTGRESQL_CONNECTION_STRING)
coder-ingress:
$cndi.get_block(coder_ingress_blk):
condition:
- "{{ $cndi.get_prompt_response(deploy_coder_ingress) }}"
- ==
- true
coder-ns:
apiVersion: v1
kind: Namespace
metadata:
name: coder
applications:
coder:
targetRevision: 2.10.2
destinationNamespace: coder
repoURL: https://helm.coder.com/v2
chart: coder
values:
env:
- name: CODER_ACCESS_URL
value: "https://{{ $cndi.get_prompt_response(coder_hostname) }}"
- name: CODER_PG_CONNECTION_URL
valueFrom:
secretKeyRef:
name: coder-db-url
key: url
cnpg:
targetRevision: 0.18.0
destinationNamespace: cnpg-system
repoURL: "https://cloudnative-pg.github.io/charts"
chart: cloudnative-pg
pgadmin:
$cndi.get_block(deploy_pgadmin_application_blk):
condition:
- "{{ $cndi.get_prompt_response(deploy_pgadmin_application) }}"
- ==
- true
env:
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/git-credentials-{{ $cndi.get_prompt_response(git_credentials_mode) }}-env.yaml):
{}
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/{{ $cndi.get_prompt_response(deployment_target_provider) }}/env.yaml):
{}
$cndi.get_block(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/common/cluster/env.yaml):
{}
$cndi.comment(neo4j-heading): Postgres Connection Parameters
POSTGRESQL_DB: "coderdb"
POSTGRESQL_USER: "{{ $cndi.get_prompt_response(postgres_admin_username) }}"
POSTGRESQL_PASSWORD: "{{ $cndi.get_prompt_response(postgres_admin_password) }}"
POSTGRES_PROTOCOL: postgresql
POSTGRESQL_HOST: "coder-cluster-rw"
POSTGRESQL_PORT: "5432"
POSTGRESQL_CONNECTION_STRING: "postgresql://{{ $cndi.get_prompt_response(postgres_admin_username) }}:{{ $cndi.get_prompt_response(postgres_admin_password) }}@{{ $cndi.get_prompt_response(postgres_hostname) }}:5432/coderdb"
POSTGRESQL_CLUSTER_SUPERUSER: "{{ $cndi.get_prompt_response(postgres_admin_username) }}"
$cndi.comment(cnpg-heading): PgAdmin Login Parameters
PGADMIN_LOGIN_PASSWORD: "{{ $cndi.get_prompt_response(pgadmin_login_password) }}"
PGADMIN_LOGIN_EMAIL: "{{ $cndi.get_prompt_response(pgadmin_login_email) }}"
readme:
project_name: "# {{ $cndi.get_prompt_response(project_name) }}"
$cndi.get_string(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/common/cluster/core-readme.md):
{}
$cndi.get_string(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/{{ $cndi.get_prompt_response(deployment_target_provider) }}/core.md):
{}
$cndi.get_string(https://raw.githubusercontent.com/polyseam/cndi/main/blocks/{{ $cndi.get_prompt_response(deployment_target_provider) }}/{{ $cndi.get_prompt_response(deployment_target_distribution) }}.md):
{}
coder: |
# Coder
Coder is a cloud-based development environment that provides a consistent and secure development environment for your team. It allows you to create, share, and manage development environments in the cloud.