|
5 | 5 | config, |
6 | 6 | ... |
7 | 7 | }: { |
8 | | - templates.pgboss-deployment = lib.mkIf values.pg-boss-worker.enabled { |
9 | | - apiVersion = "apps/v1"; |
10 | | - kind = "Deployment"; |
| 8 | + resources.deployments.pgboss = lib.mkIf values.pg-boss-worker.enabled { |
11 | 9 | metadata = { |
12 | 10 | name = "${config.name}-pg-boss-worker"; |
13 | 11 | labels = utils.appLabels "pg-boss-worker"; |
|
17 | 15 | template = { |
18 | 16 | metadata.labels = utils.appLabels "pg-boss-worker"; |
19 | 17 | spec = { |
20 | | - imagePullSecrets = [ |
21 | | - { |
22 | | - name = "dockerconfigjson"; |
23 | | - } |
24 | | - ]; |
25 | | - containers = [ |
26 | | - { |
27 | | - inherit (values.cardano-services) image; |
28 | | - inherit (values.pg-boss-worker) resources; |
29 | | - name = "pg-boss-worker"; |
30 | | - ports = [ |
31 | | - { |
32 | | - containerPort = 3000; |
33 | | - name = "http"; |
34 | | - } |
35 | | - ]; |
36 | | - startupProbe = { |
37 | | - httpGet = { |
38 | | - path = "${values.cardano-services.httpPrefix}/ready"; |
39 | | - port = 3000; |
40 | | - }; |
41 | | - initialDelaySeconds = 80; |
42 | | - periodSeconds = 5; |
43 | | - }; |
44 | | - livenessProbe = { |
45 | | - httpGet = { |
46 | | - path = "${values.cardano-services.httpPrefix}/health"; |
47 | | - port = 3000; |
48 | | - }; |
| 18 | + imagePullSecrets.dockerconfigjson = {}; |
| 19 | + containers.pg-boss-worker = { |
| 20 | + inherit (values.cardano-services) image; |
| 21 | + inherit (values.pg-boss-worker) resources; |
| 22 | + ports.http.containerPort = 3000; |
| 23 | + startupProbe = { |
| 24 | + httpGet = { |
| 25 | + path = "${values.cardano-services.httpPrefix}/ready"; |
| 26 | + port = 3000; |
49 | 27 | }; |
50 | | - securityContext = { |
51 | | - runAsUser = 0; |
52 | | - runAsGroup = 0; |
| 28 | + initialDelaySeconds = 80; |
| 29 | + periodSeconds = 5; |
| 30 | + }; |
| 31 | + livenessProbe = { |
| 32 | + httpGet = { |
| 33 | + path = "${values.cardano-services.httpPrefix}/health"; |
| 34 | + port = 3000; |
53 | 35 | }; |
54 | | - args = ["start-pg-boss-worker"]; |
55 | | - env = utils.mkPodEnv ({ |
56 | | - NETWORK = config.network; |
57 | | - LOGGER_MIN_SEVERITY = values.cardano-services.loggingLevel; |
58 | | - QUEUES = values.pg-boss-worker.queues; |
59 | | - NODE_ENV = values.cardano-services.nodeEnv; |
| 36 | + }; |
| 37 | + securityContext = { |
| 38 | + runAsUser = 0; |
| 39 | + runAsGroup = 0; |
| 40 | + }; |
| 41 | + args = ["start-pg-boss-worker"]; |
| 42 | + env = utils.mkPodEnv ({ |
| 43 | + NETWORK = config.network; |
| 44 | + LOGGER_MIN_SEVERITY = values.cardano-services.loggingLevel; |
| 45 | + QUEUES = values.pg-boss-worker.queues; |
| 46 | + NODE_ENV = values.cardano-services.nodeEnv; |
60 | 47 |
|
61 | | - METADATA_FETCH_MODE = values.pg-boss-worker.metadata-fetch-mode; |
| 48 | + METADATA_FETCH_MODE = values.pg-boss-worker.metadata-fetch-mode; |
62 | 49 |
|
63 | | - STAKE_POOL_PROVIDER_URL = "http://${config.name}-backend.${config.namespace}.svc.cluster.local"; |
64 | | - NETWORK_INFO_PROVIDER_URL = "http://${config.name}-backend.${config.namespace}.svc.cluster.local"; |
| 50 | + STAKE_POOL_PROVIDER_URL = "http://${config.name}-backend.${config.namespace}.svc.cluster.local"; |
| 51 | + NETWORK_INFO_PROVIDER_URL = "http://${config.name}-backend.${config.namespace}.svc.cluster.local"; |
65 | 52 |
|
66 | | - POSTGRES_POOL_MAX_STAKE_POOL = "5"; |
67 | | - POSTGRES_HOST_STAKE_POOL = values.postgresName; |
68 | | - POSTGRES_PORT_STAKE_POOL = "5432"; |
69 | | - POSTGRES_DB_STAKE_POOL = values.stakepool.databaseName; |
70 | | - POSTGRES_PASSWORD_STAKE_POOL = { |
71 | | - valueFrom.secretKeyRef = { |
72 | | - name = "${values.stakepool.databaseName}-owner-user.${values.postgresName}.credentials.postgresql.acid.zalan.do"; |
73 | | - key = "password"; |
74 | | - }; |
| 53 | + POSTGRES_POOL_MAX_STAKE_POOL = "5"; |
| 54 | + POSTGRES_HOST_STAKE_POOL = values.postgresName; |
| 55 | + POSTGRES_PORT_STAKE_POOL = "5432"; |
| 56 | + POSTGRES_DB_STAKE_POOL = values.stakepool.databaseName; |
| 57 | + POSTGRES_PASSWORD_STAKE_POOL = { |
| 58 | + valueFrom.secretKeyRef = { |
| 59 | + name = "${values.stakepool.databaseName}-owner-user.${values.postgresName}.credentials.postgresql.acid.zalan.do"; |
| 60 | + key = "password"; |
75 | 61 | }; |
76 | | - POSTGRES_USER_STAKE_POOL = { |
77 | | - valueFrom.secretKeyRef = { |
78 | | - name = "${values.stakepool.databaseName}-owner-user.${values.postgresName}.credentials.postgresql.acid.zalan.do"; |
79 | | - key = "username"; |
80 | | - }; |
| 62 | + }; |
| 63 | + POSTGRES_USER_STAKE_POOL = { |
| 64 | + valueFrom.secretKeyRef = { |
| 65 | + name = "${values.stakepool.databaseName}-owner-user.${values.postgresName}.credentials.postgresql.acid.zalan.do"; |
| 66 | + key = "username"; |
81 | 67 | }; |
82 | | - POSTGRES_SSL_STAKE_POOL = "true"; |
83 | | - POSTGRES_SSL_CA_FILE_STAKE_POOL = "/tls/ca.crt"; |
| 68 | + }; |
| 69 | + POSTGRES_SSL_STAKE_POOL = "true"; |
| 70 | + POSTGRES_SSL_CA_FILE_STAKE_POOL = "/tls/ca.crt"; |
84 | 71 |
|
85 | | - POSTGRES_POOL_MAX_DB_SYNC = "5"; |
86 | | - POSTGRES_HOST_DB_SYNC = values.postgresName; |
87 | | - POSTGRES_PORT_DB_SYNC = "5432"; |
88 | | - POSTGRES_DB_DB_SYNC = "cardano"; |
89 | | - POSTGRES_PASSWORD_DB_SYNC = { |
90 | | - valueFrom.secretKeyRef = { |
91 | | - name = "cardano-owner-user.${values.postgresName}.credentials.postgresql.acid.zalan.do"; |
92 | | - key = "password"; |
93 | | - }; |
| 72 | + POSTGRES_POOL_MAX_DB_SYNC = "5"; |
| 73 | + POSTGRES_HOST_DB_SYNC = values.postgresName; |
| 74 | + POSTGRES_PORT_DB_SYNC = "5432"; |
| 75 | + POSTGRES_DB_DB_SYNC = "cardano"; |
| 76 | + POSTGRES_PASSWORD_DB_SYNC = { |
| 77 | + valueFrom.secretKeyRef = { |
| 78 | + name = "cardano-owner-user.${values.postgresName}.credentials.postgresql.acid.zalan.do"; |
| 79 | + key = "password"; |
94 | 80 | }; |
95 | | - POSTGRES_USER_DB_SYNC = { |
96 | | - valueFrom.secretKeyRef = { |
97 | | - name = "cardano-owner-user.${values.postgresName}.credentials.postgresql.acid.zalan.do"; |
98 | | - key = "username"; |
99 | | - }; |
| 81 | + }; |
| 82 | + POSTGRES_USER_DB_SYNC = { |
| 83 | + valueFrom.secretKeyRef = { |
| 84 | + name = "cardano-owner-user.${values.postgresName}.credentials.postgresql.acid.zalan.do"; |
| 85 | + key = "username"; |
100 | 86 | }; |
101 | | - POSTGRES_SSL_DB_SYNC = "true"; |
102 | | - POSTGRES_SSL_CA_FILE_DB_SYNC = "/tls/ca.crt"; |
103 | | - } |
104 | | - // lib.optionalAttrs (values.pg-boss-worker ? env) values.pg-boss-worker.env |
105 | | - // lib.optionalAttrs (values.pg-boss-worker.metadata-fetch-mode == "smash") { |
106 | | - SMASH_URL = values.pg-boss-worker.smash-url; |
107 | | - }); |
108 | | - volumeMounts = [ |
109 | | - { |
110 | | - mountPath = "/tls"; |
111 | | - name = "tls"; |
112 | | - } |
113 | | - ]; |
114 | | - } |
115 | | - ]; |
116 | | - volumes = [ |
117 | | - { |
118 | | - name = "tls"; |
119 | | - secret.secretName = "postgresql-server-cert"; |
120 | | - } |
121 | | - ]; |
| 87 | + }; |
| 88 | + POSTGRES_SSL_DB_SYNC = "true"; |
| 89 | + POSTGRES_SSL_CA_FILE_DB_SYNC = "/tls/ca.crt"; |
| 90 | + } |
| 91 | + // lib.optionalAttrs (values.pg-boss-worker ? env) values.pg-boss-worker.env |
| 92 | + // lib.optionalAttrs (values.pg-boss-worker.metadata-fetch-mode == "smash") { |
| 93 | + SMASH_URL = values.pg-boss-worker.smash-url; |
| 94 | + }); |
| 95 | + volumeMounts = [ |
| 96 | + { |
| 97 | + mountPath = "/tls"; |
| 98 | + name = "tls"; |
| 99 | + } |
| 100 | + ]; |
| 101 | + }; |
| 102 | + volumes.tls.secret.secretName = "postgresql-server-cert"; |
122 | 103 | }; |
123 | 104 | }; |
124 | 105 | }; |
|
0 commit comments