Skip to content

Commit fd9f8fa

Browse files
committed
Added config_local.py support, helm/README.md Update, Changed default port
1 parent 94c4b30 commit fd9f8fa

File tree

6 files changed

+55
-11
lines changed

6 files changed

+55
-11
lines changed

helm/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ The majority of features and values are covered in the helm chart but always can
1414
### Important Values
1515
| Value | Description | Default |
1616
| --------- | ----------- | ------- |
17-
| `containerPort` | Internal PgAdmin4 Port | `8080` |
17+
| `containerPort` | Internal PgAdmin4 Port | `5050` |
1818
| `image.registry` | Image registry | `"docker.io"` |
1919
| `image.repository` | Image Repository | `"dpage/pgadmin4"` |
2020
| `image.tag` | Image tag (If empty, will use .Chart.AppVersion) | `""` |
2121
| `auth.email` | Admin Email | `"[email protected]"` |
2222
| `auth.password` | Admin password (If both auth.password and auth.existingSecret are empty, the password will be randomly generated) | `""` |
2323
| `auth.existingSecret` | Existing secret name for admin password (If both auth.password and auth.existingSecret are empty, the password will be randomly generated) | `""` |
2424
| `extraEnvVars` | Extra environment variables | `[]` |
25-
| `serverDefinitions.enabled` | Do predefined server definitions should be created | `false` |
26-
| `serverDefinitions.servers` | Server definitions to load | `{}` |
27-
| `preferences.enabled` | Do preferences should be initialized | `false` |
25+
| `config_local.enabled` | Whether to mount config_local.py file | `false` |
26+
| `config_local.data` | config_local.py configuration content | `""` |
27+
| `config_local.existingSecret` | Existing secret name containing config_local.py file | `""` |
28+
| `serverDefinitions.enabled` | Whether to mount servers.json | `false` |
29+
| `serverDefinitions.data` | Server definitions to import | `{}` |
30+
| `preferences.enabled` | Whether to mount preferences.json | `false` |
2831
| `preferences.data` | Preferences to load | `{}` |
2932
| `resources.*` | Allocated requests and limits resources | `{"requests": {...}, "limits": {...}}` |
3033
| `persistence.enabled` | PVC resource creation | `false` |

helm/templates/NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Image: {{ template "pgadmin4.image" . }}
44

55
Credentials:
66
Email: {{ .Values.auth.email }}
7-
Password: {{ printf "$(kubectl get secret %s -n %s -o jsonpath='{.data.%s}' | base64 -d)" (include "pgadmin4.fullname" .) .Release.Namespace .Values.auth.passwordKey }}
7+
Password: {{ printf "kubectl get secret %s -n %s -o jsonpath='{.data.%s}' | base64 -d" (include "pgadmin4.fullname" .) .Release.Namespace .Values.auth.passwordKey }}
88

99
Ingress: {{ ternary (tpl .Values.ingress.hostname .) "DISABLED" .Values.ingress.enabled }}
1010

helm/templates/configmap-serverDefinitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ metadata:
1010
annotations: {{ . | toYaml | nindent 4 }}
1111
{{- end }}
1212
data:
13-
servers.json: | {{ tpl (dict "Servers" .Values.serverDefinitions.servers | toYaml) . | fromYaml | toPrettyJson | nindent 4 }}
13+
servers.json: | {{ tpl (dict "Servers" .Values.serverDefinitions.data | toYaml) . | fromYaml | toPrettyJson | nindent 4 }}
1414
{{- end }}

helm/templates/deployment.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ spec:
3131
{{- if not .Values.existingSecret }}
3232
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
3333
{{- end }}
34-
{{- if .Values.preferences.enabled }}
35-
checksum/configmap-preferences: {{ include (print $.Template.BasePath "/configmap-preferences.yaml") . | sha256sum }}
34+
{{- if and .Values.config_local.enabled (empty .Values.config_local.existingSecret) }}
35+
checksum/secret-config: {{ include (print $.Template.BasePath "/secret-config.yaml") . | sha256sum }}
3636
{{- end }}
3737
{{- if .Values.serverDefinitions.enabled }}
3838
checksum/configmap-server-definitions: {{ include (print $.Template.BasePath "/configmap-serverDefinitions.yaml") . | sha256sum }}
3939
{{- end }}
40+
{{- if .Values.preferences.enabled }}
41+
checksum/configmap-preferences: {{ include (print $.Template.BasePath "/configmap-preferences.yaml") . | sha256sum }}
42+
{{- end }}
4043
{{- end }}
4144
spec:
4245
{{- if or .Values.global.imagePullSecrets .Values.image.pullSecrets }}
@@ -55,6 +58,14 @@ spec:
5558
persistentVolumeClaim:
5659
claimName: {{ template "pgadmin4.fullname" . }}
5760
{{- end }}
61+
{{- if .Values.config_local.enabled }}
62+
- name: config-local
63+
secret:
64+
secretName: {{ default (printf "%s-config" (include "pgadmin4.fullname" .)) .Values.config_local.existingSecret }}
65+
items:
66+
- key: {{ .Values.config_local.configKey }}
67+
path: {{ .Values.config_local.configKey }}
68+
{{- end }}
5869
{{- if .Values.serverDefinitions.enabled }}
5970
- name: server-definitions
6071
configMap:
@@ -127,6 +138,11 @@ spec:
127138
- name: empty-dir
128139
mountPath: /var/log/pgadmin
129140
subPath: logs
141+
{{- if .Values.config_local.enabled }}
142+
- name: config-local
143+
mountPath: /pgadmin4/config_local.py
144+
subPath: {{ .Values.config_local.configKey }}
145+
{{- end }}
130146
{{- if .Values.serverDefinitions.enabled }}
131147
- name: server-definitions
132148
mountPath: /pgadmin4/servers.json

helm/templates/secret-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if and .Values.config_local.enabled (empty .Values.config_local.existingSecret) }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ template "pgadmin4.fullname" . }}-config
6+
{{- with .Values.commonLabels }}
7+
labels: {{ . | toYaml | nindent 4 }}
8+
{{- end }}
9+
{{- with .Values.commonAnnotations }}
10+
annotations: {{ . | toYaml | nindent 4 }}
11+
{{- end }}
12+
type: Opaque
13+
stringData:
14+
{{ .Values.config_local.configKey }}: | {{ tpl .Values.config_local.data . | nindent 4 }}
15+
{{- end }}

helm/values.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extraDeploy: []
2525

2626
replicas: 1
2727

28-
containerPort: 8080
28+
containerPort: 5050
2929
disablePostfix: true
3030
auth:
3131
@@ -38,9 +38,19 @@ extraEnvVars: []
3838
extraVolumes: []
3939
extraVolumeMounts: []
4040

41+
config_local:
42+
enabled: false
43+
existingSecret: ""
44+
configKey: config_local.py
45+
data: ""
46+
# data: |
47+
# DEBUG = True
48+
# JSON_LOGGER = True
49+
# AUTHENTICATION_SOURCES = ['oauth2', 'internal']
50+
4151
serverDefinitions:
4252
enabled: false
43-
servers: {}
53+
data: {}
4454
# "1":
4555
# Name: Minimally Defined Server
4656
# Group: Servers
@@ -67,7 +77,7 @@ resources:
6777
memory: 512Mi
6878

6979
persistence:
70-
enabled: false
80+
enabled: true
7181
size: 1Gi
7282
storageClass: ""
7383
accessModes: ["ReadWriteOnce"]

0 commit comments

Comments
 (0)