Skip to content

Commit 348c420

Browse files
misc: Shifted the dbConfigs under global (#6621)
* Shifted the dbConfigs under global * updated the configurations for external database support * handled casbin migration case for database name * added support for custom annotations for ci-runner cd-runner and devtron * switched the conditioning to handle devtron-bom.yaml * removed check of values.global from postgresql.yaml
1 parent 41efa0a commit 348c420

15 files changed

Lines changed: 122 additions & 134 deletions

charts/devtron/devtron-bom.yaml

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ global:
88
runAsUser: 1000
99
runAsNonRoot: true
1010
containerRegistry: "quay.io/devtron"
11+
dbConfig:
12+
PG_ADDR: postgresql-postgresql.devtroncd
13+
PG_PORT: "5432"
14+
PG_USER: postgres
15+
PG_DATABASE: orchestrator
1116
extraManifests: []
1217
installer:
1318
release: "v1.6.0"
@@ -72,11 +77,7 @@ components:
7277
MANIFEST_FETCH_BATCH_SIZE: "2"
7378
NATS_MSG_PROCESSING_BATCH_SIZE: "1"
7479
NATS_SERVER_HOST: nats://devtron-nats.devtroncd:4222
75-
PG_ADDR: postgresql-postgresql.devtroncd
76-
PG_DATABASE: orchestrator
7780
PG_LOG_QUERY: "true"
78-
PG_PORT: "5432"
79-
PG_USER: postgres
8081
dbconfig:
8182
secretName: postgresql-postgresql
8283
keyName: postgresql-password
@@ -101,11 +102,7 @@ components:
101102
ACD_NAMESPACE: "devtroncd"
102103
ACD_INFORMER: "true"
103104
NATS_STREAM_MAX_AGE: "10800"
104-
PG_ADDR: postgresql-postgresql.devtroncd
105-
PG_DATABASE: orchestrator
106105
PG_LOG_QUERY: "true"
107-
PG_PORT: "5432"
108-
PG_USER: postgres
109106
CLUSTER_ARGO_CD_TYPE: "ALL_CLUSTER"
110107
dbconfig:
111108
secretName: postgresql-postgresql
@@ -126,8 +123,7 @@ components:
126123
persistence:
127124
volumeSize: 2Gi
128125
configs:
129-
PG_ADDR: postgresql-postgresql.devtroncd
130-
PG_USER: postgres
126+
PG_DATABASE: git_sensor
131127
COMMIT_STATS_TIMEOUT_IN_SEC: "2"
132128
ENABLE_FILE_STATS: "true"
133129
USE_GIT_CLI: "true"
@@ -144,9 +140,6 @@ components:
144140
GIT_SENSOR_PROTOCOL: GRPC
145141
GIT_SENSOR_URL: git-sensor-service.devtroncd:90
146142
NATS_SERVER_HOST: nats://devtron-nats.devtroncd:4222
147-
PG_ADDR: postgresql-postgresql.devtroncd
148-
PG_PORT: "5432"
149-
PG_USER: postgres
150143
PG_DATABASE: lens
151144
dbconfig:
152145
secretName: postgresql-postgresql
@@ -174,23 +167,10 @@ components:
174167
kubectlImage: "kubectl:latest"
175168
duplicateChartImage: devtron-utils:dup-chart-repo-v1.1.0
176169
entMigratorImage: "devtron-utils:geni-v1.1.4"
177-
configs:
178-
PG_ADDR: postgresql-postgresql.devtroncd
179-
envVars:
180-
devtron:
181-
DB_NAME: "orchestrator"
182-
casbin:
183-
DB_NAME: "casbin"
184-
gitsensor:
185-
DB_NAME: "git_sensor"
186-
lens:
187-
DB_NAME: "lens"
188170
chartSync:
189171
registry: ""
190172
image: chart-sync:da156379-836-32914
191173
schedule: "0 19 * * *"
192-
extraConfigs:
193-
PG_ADDR: postgresql-postgresql.devtroncd
194174
podSecurityContext:
195175
fsGroup: 1001
196176
runAsGroup: 1001
@@ -256,10 +236,7 @@ devtronEnterprise:
256236
image: "casbin:f6ff5f74-064b67e5-462-30822"
257237
imagePullPolicy: IfNotPresent
258238
configs:
259-
PG_ADDR: postgresql-postgresql.devtroncd
260239
PG_DATABASE: casbin
261-
PG_PORT: "5432"
262-
PG_USER: postgres
263240
dbconfig:
264241
secretName: postgresql-postgresql
265242
keyName: postgresql-password

charts/devtron/templates/app-sync-job.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ spec:
3131
- name: chart-sync
3232
image: {{ include "common.image" (dict "component" $.Values.components.chartSync "global" $.Values.global ) }}
3333
{{- include "common.containerSecurityContext" (dict "containerSecurityContext" $.Values.components.chartSync.containerSecurityContext "global" $.Values.global) | indent 8 }}
34-
env:
35-
- name: PG_DATABASE
36-
value: orchestrator
37-
- name: PG_USER
38-
value: postgres
3934
envFrom:
4035
- configMapRef:
4136
name: app-sync-cm
@@ -79,11 +74,6 @@ spec:
7974
- name: chart-sync
8075
image: {{ include "common.image" (dict "component" $.Values.components.chartSync "global" $.Values.global ) }}
8176
{{- include "common.containerSecurityContext" (dict "containerSecurityContext" $.Values.components.chartSync.containerSecurityContext "global" $.Values.global) | indent 12 }}
82-
env:
83-
- name: PG_DATABASE
84-
value: orchestrator
85-
- name: PG_USER
86-
value: postgres
8777
envFrom:
8878
- secretRef:
8979
name: devtron-secret
@@ -110,6 +100,7 @@ metadata:
110100
app: app-sync-cronjob
111101
release: devtron
112102
data:
103+
{{ toYaml $.Values.global.dbConfig | indent 2 }}
113104
{{- if $.Values.components.chartSync.extraConfigs }}
114105
{{ toYaml $.Values.components.chartSync.extraConfigs | indent 2 }}
115106
{{- end }}

charts/devtron/templates/casbin.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ metadata:
9696
release: casbin
9797
{{- if .configs }}
9898
data:
99+
{{ toYaml $.Values.global.dbConfig | indent 2 }}
99100
{{ toYaml .configs | indent 2 }}
100101
{{- end }}
101102
---

charts/devtron/templates/configmap-secret.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,13 @@ data:
206206
apiVersion: v1
207207
kind: Secret
208208
data:
209+
{{- if and $.Values.global.externalPostgres $.Values.global.externalPostgres.enabled }}
210+
postgresql-password: {{ $.Values.global.externalPostgres.PG_PASSWORD | b64enc }}
211+
{{- else }}
209212
postgresql-password: {{ $postgresPwd }}
210-
POSTGRES_USER: cG9zdGdyZXM=
211-
POSTGRES_DB: b3JjaGVzdHJhdG9y
213+
{{- end }}
214+
POSTGRES_USER: {{ $.Values.global.dbConfig.PG_USER | b64enc }}
215+
POSTGRES_DB: {{ $.Values.global.dbConfig.PG_DATABASE | b64enc }}
212216
metadata:
213217
name: postgresql-postgresql
214218
labels:
@@ -224,7 +228,11 @@ type: Opaque
224228
apiVersion: v1
225229
kind: Secret
226230
data:
231+
{{- if and $.Values.global.externalPostgres $.Values.global.externalPostgres.enabled }}
232+
DB_PASSWORD: {{ $.Values.global.externalPostgres.PG_PASSWORD | b64enc }}
233+
{{- else }}
227234
DB_PASSWORD: {{ $postgresPwd }}
235+
{{- end }}
228236
metadata:
229237
name: postgresql-migrator
230238
labels:
@@ -248,7 +256,11 @@ metadata:
248256
"helm.sh/hook-weight": "-3"
249257
"helm.sh/resource-policy": keep
250258
data:
259+
{{- if and $.Values.global.externalPostgres $.Values.global.externalPostgres.enabled }}
260+
PG_PASSWORD: {{ $.Values.global.externalPostgres.PG_PASSWORD | b64enc }}
261+
{{- else }}
251262
PG_PASSWORD: {{ $postgresPwd }}
263+
{{- end }}
252264
{{- if $.Values.installer.modules }}
253265
{{- if has "cicd" $.Values.installer.modules }}
254266
EXTERNAL_CI_API_SECRET: {{ $EXTERNAL_CI_API_SECRET }}

charts/devtron/templates/devtron.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@ data:
1313
DEVTRON_HELM_RELEASE_NAME: {{ $.Release.Name }}
1414
DEVTRON_HELM_RELEASE_NAMESPACE: {{ $.Release.Namespace }}
1515
FEATURE_MIGRATE_ARGOCD_APPLICATION_ENABLE: "true"
16-
PG_USER: postgres
17-
{{- if not $.Values.devtronEnterprise.enabled }}
18-
PG_ADDR: postgresql-postgresql.devtroncd
19-
{{- end }}
20-
PG_PORT: "5432"
16+
{{ toYaml $.Values.global.dbConfig | indent 2 }}
2117
HELM_CLIENT_URL: kubelink-service-headless:50051
2218
DASHBOARD_PORT: "80"
2319
DASHBOARD_HOST: dashboard-service.devtroncd
24-
PG_DATABASE: orchestrator
2520
DEX_HOST: http://argocd-dex-server.devtroncd
2621
DEX_PORT: "5556"
2722
APP_SYNC_IMAGE: {{ include "common.image" (dict "component" $.Values.components.chartSync "global" $.Values.global ) }}

charts/devtron/templates/gitsensor.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ metadata:
2525
release: devtron
2626
{{- if .configs }}
2727
data:
28+
{{ toYaml $.Values.global.dbConfig | indent 2 }}
2829
{{ toYaml .configs | indent 2 }}
2930
{{- end }}
3031

charts/devtron/templates/kubelink.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ metadata:
2727
"helm.sh/resource-policy": keep
2828
{{- if .configs }}
2929
data:
30+
{{ toYaml $.Values.global.dbConfig | indent 2 }}
3031
{{ toYaml .configs | indent 2 }}
3132
{{- if $.Values.installer.modules }}
3233
{{- if has "cicd" $.Values.installer.modules }}

charts/devtron/templates/kubewatch.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ rules:
3131
- events
3232
- workflows
3333
- secrets
34+
- configmaps
3435
verbs:
3536
- list
3637
- watch
@@ -144,6 +145,7 @@ metadata:
144145
release: devtron
145146
app: kubewatch
146147
data:
148+
{{ toYaml $.Values.global.dbConfig | indent 2 }}
147149
{{- if .configs}}
148150
{{ toYaml .configs | indent 2 }}
149151
{{- end }}

charts/devtron/templates/lens.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ metadata:
2525
release: devtron
2626
{{- if .configs }}
2727
data:
28+
{{ toYaml $.Values.global.dbConfig | indent 2 }}
2829
{{ toYaml .configs | indent 2 }}
2930
{{- end }}
3031
---

0 commit comments

Comments
 (0)