Skip to content

Commit

Permalink
feat: support PG4K namespaces installations
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Cecchi <[email protected]>
  • Loading branch information
leonardoce committed Mar 25, 2024
1 parent d676968 commit 8194293
Show file tree
Hide file tree
Showing 6 changed files with 407 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ edb-pg4k-edb-postgres-for-kubernetes 1/1 1 1 11s
Once it is ready, you can verify that you can deploy the sample cluster
suggested by the helm chart.

It is possible to limit the operator's capabilities to solely the namespace in
which it has been set up. By implementing this restriction, the cluster-level
permissions required by the operator will be substantially minimized:

```console
helm upgrade --install edb-pg4k \
--namespace postgresql-operator-system \
--create-namespace \
--set config.clusterWide=false \
edb/edb-postgres-for-kubernetes
```

### Deploying EDB Postgres for Kubernetes (PG4K) operator from EDB's private registry

By default, PG4K will be deployed using [images publicly hosted on Quay.io](https://quay.io/repository/enterprisedb/cloud-native-postgresql),
Expand Down
5 changes: 4 additions & 1 deletion charts/edb-postgres-for-kubernetes/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: Cluster
metadata:
name: cluster-example
{{if not .Values.config.clusterWide -}}
namespace: {{ .Release.Namespace }}
{{- end }}
spec:
instances: 3
storage:
size: 1Gi
EOF

kubectl get cluster
kubectl get -A cluster

6 changes: 6 additions & 0 deletions charts/edb-postgres-for-kubernetes/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
{{- if .Values.config.clusterWide -}}
{{- toYaml .Values.config.data | nindent 2 }}
{{- else -}}
{{- $watchNamespaceMap := dict "WATCH_NAMESPACE" .Release.Namespace -}}
{{- $fullConfiguration := merge .Values.config.data $watchNamespaceMap -}}
{{- toYaml $fullConfiguration | nindent 2 }}
{{- end -}}
{{- end }}
{{- else -}}
apiVersion: v1
Expand Down
4 changes: 4 additions & 0 deletions charts/edb-postgres-for-kubernetes/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ spec:
fieldPath: metadata.namespace
- name: MONITORING_QUERIES_CONFIGMAP
value: "{{ .Values.monitoringQueriesConfigMap.name }}"
{{ if not .Values.config.clusterWide -}}
- name: WATCH_NAMESPACE
value: "{{ .Release.Namespace }}"
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
livenessProbe:
Expand Down
Loading

0 comments on commit 8194293

Please sign in to comment.