Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add namespace explicitly #461

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/cloudnative-pg/README.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions charts/cloudnative-pg/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "cloudnative-pg.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/*
Expand the name of the chart.
*/}}
Expand Down
1 change: 1 addition & 0 deletions charts/cloudnative-pg/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.config.name }}
namespace: {{ include "cloudnative-pg.namespace" . }}
labels:
{{- include "cloudnative-pg.labels" . | nindent 4 }}
{{- with .Values.commonAnnotations }}
Expand Down
1 change: 1 addition & 0 deletions charts/cloudnative-pg/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cloudnative-pg.fullname" . }}
namespace: {{ include "cloudnative-pg.namespace" . }}
labels:
{{- include "cloudnative-pg.labels" . | nindent 4 }}
{{- with .Values.commonAnnotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.monitoringQueriesConfigMap.name }}
namespace: {{ include "cloudnative-pg.namespace" . }}
labels:
{{- include "cloudnative-pg.labels" . | nindent 4 }}
cnpg.io/reload: ""
Expand Down
1 change: 1 addition & 0 deletions charts/cloudnative-pg/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "cloudnative-pg.fullname" . }}
namespace: {{ include "cloudnative-pg.namespace" . }}
labels:
{{- include "cloudnative-pg.labels" . | nindent 4 }}
{{- with .Values.monitoring.podMonitorAdditionalLabels }}
Expand Down
3 changes: 3 additions & 0 deletions charts/cloudnative-pg/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "cloudnative-pg.serviceAccountName" . }}
namespace: {{ include "cloudnative-pg.namespace" . }}
labels:
{{- include "cloudnative-pg.labels" . | nindent 4 }}
{{- with .Values.commonAnnotations }}
Expand Down Expand Up @@ -79,6 +80,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "cloudnative-pg.fullname" . }}
namespace: {{ include "cloudnative-pg.namespace" . }}
labels:
{{- include "cloudnative-pg.labels" . | nindent 4 }}
{{- with .Values.commonAnnotations }}
Expand All @@ -92,6 +94,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "cloudnative-pg.fullname" . }}
namespace: {{ include "cloudnative-pg.namespace" . }}
labels:
{{- include "cloudnative-pg.labels" . | nindent 4 }}
{{- with .Values.commonAnnotations }}
Expand Down
1 change: 1 addition & 0 deletions charts/cloudnative-pg/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}
namespace: {{ include "cloudnative-pg.namespace" . }}
labels:
{{- include "cloudnative-pg.labels" . | nindent 4 }}
{{- with .Values.commonAnnotations }}
Expand Down
1 change: 1 addition & 0 deletions charts/cloudnative-pg/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ image:
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
namespaceOverride: ""

hostNetwork: false
dnsPolicy: ""
Expand Down
3 changes: 3 additions & 0 deletions charts/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| imageCatalog.images | list | `[]` | List of images to be provisioned in an image catalog. |
| mode | string | `"standalone"` | Cluster mode of operation. Available modes: * `standalone` - default mode. Creates new or updates an existing CNPG cluster. * `replica` - Creates a replica cluster from an existing CNPG cluster. # TODO * `recovery` - Same as standalone but creates a cluster from a backup, object store or via pg_basebackup. |
| nameOverride | string | `""` | Override the name of the chart |
| namespaceOverride | string | `""` | Override the namespace of the chart |
| poolers | list | `[]` | List of PgBouncer poolers |
| recovery.azure.connectionString | string | `""` | |
| recovery.azure.containerName | string | `""` | |
Expand Down Expand Up @@ -277,3 +278,5 @@ TODO
* IAM Role for S3 Service Account
* Automatic provisioning of a Alert Manager configuration

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
11 changes: 11 additions & 0 deletions charts/cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "cluster.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/*
Expand the name of the chart.
*/}}
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/backup-azure-creds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ default (printf "%s-backup-azure-creds" (include "cluster.fullname" .)) .Values.backups.secret.name }}
namespace: {{ include "cluster.namespace" . }}
data:
AZURE_CONNECTION_STRING: {{ .Values.backups.azure.connectionString | b64enc | quote }}
AZURE_STORAGE_ACCOUNT: {{ .Values.backups.azure.storageAccount | b64enc | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/backup-google-creds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ default (printf "%s-backup-google-creds" (include "cluster.fullname" .)) .Values.backups.secret.name }}
namespace: {{ include "cluster.namespace" . }}
data:
APPLICATION_CREDENTIALS: {{ .Values.backups.google.applicationCredentials | b64enc | quote }}
{{- end }}
1 change: 1 addition & 0 deletions charts/cluster/templates/backup-s3-creds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ default (printf "%s-backup-s3-creds" (include "cluster.fullname" .)) .Values.backups.secret.name }}
namespace: {{ include "cluster.namespace" . }}
data:
ACCESS_KEY_ID: {{ required ".Values.backups.s3.accessKey is required, but not specified." .Values.backups.s3.accessKey | b64enc | quote }}
ACCESS_SECRET_KEY: {{ required ".Values.backups.s3.secretKey is required, but not specified." .Values.backups.s3.secretKey | b64enc | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/ca-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.backups.endpointCA.name | default (printf "%s-ca-bundle" (include "cluster.fullname" .)) | quote }}
namespace: {{ include "cluster.namespace" . }}
data:
{{ .Values.backups.endpointCA.key | default "ca-bundle.crt" | quote }}: {{ .Values.backups.endpointCA.value }}

Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: {{ include "cluster.fullname" . }}
namespace: {{ include "cluster.namespace" . }}
{{- with .Values.cluster.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: postgresql.cnpg.io/v1
kind: ImageCatalog
metadata:
name: {{ include "cluster.fullname" . }}-timescaledb-ha
namespace: {{ include "cluster.namespace" . }}
spec:
images:
- major: 12
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/image-catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: postgresql.cnpg.io/v1
kind: ImageCatalog
metadata:
name: {{ include "cluster.fullname" . }}
namespace: {{ include "cluster.namespace" . }}
spec:
images:
{{- range $image := .Values.imageCatalog.images }}
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/pooler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: postgresql.cnpg.io/v1
kind: Pooler
metadata:
name: {{ include "cluster.fullname" $ }}-pooler-{{ .name }}
namespace: {{ include "cluster.namespace" $ }}
spec:
cluster:
name: {{ include "cluster.fullname" $ }}
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/prometheus-rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
{{ toYaml . | nindent 4 }}
{{- end }}
name: {{ include "cluster.fullname" . }}-alert-rules
namespace: {{ include "cluster.namespace" . }}
spec:
groups:
- name: cloudnative-pg/{{ include "cluster.fullname" . }}
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/recovery-azure-creds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ default (printf "%s-recovery-azure-creds" (include "cluster.fullname" .)) .Values.recovery.secret.name }}
namespace: {{ include "cluster.namespace" . }}
data:
AZURE_CONNECTION_STRING: {{ .Values.recovery.azure.connectionString | b64enc | quote }}
AZURE_STORAGE_ACCOUNT: {{ .Values.recovery.azure.storageAccount | b64enc | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/recovery-google-creds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ default (printf "%s-recovery-google-creds" (include "cluster.fullname" .)) .Values.recovery.secret.name }}
namespace: {{ include "cluster.namespace" . }}
data:
APPLICATION_CREDENTIALS: {{ .Values.recovery.google.applicationCredentials | b64enc | quote }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ default (printf "%s-pg-basebackup-password" (include "cluster.fullname" .)) .Values.recovery.pgBaseBackup.source.passwordSecret.name }}
namespace: {{ include "cluster.namespace" . }}
data:
{{ .Values.recovery.pgBaseBackup.source.passwordSecret.key }}: {{ required ".Values.recovery.pgBaseBackup.source.passwordSecret.value required when creating a password secret." .Values.recovery.pgBaseBackup.source.passwordSecret.value | b64enc | quote }}
{{- end }}
1 change: 1 addition & 0 deletions charts/cluster/templates/recovery-s3-creds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ default (printf "%s-recovery-s3-creds" (include "cluster.fullname" .)) .Values.recovery.secret.name }}
namespace: {{ include "cluster.namespace" . }}
data:
ACCESS_KEY_ID: {{ required ".Values.recovery.s3.accessKey is required, but not specified." .Values.recovery.s3.accessKey | b64enc | quote }}
ACCESS_SECRET_KEY: {{ required ".Values.recovery.s3.secretKey is required, but not specified." .Values.recovery.s3.secretKey | b64enc | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/scheduled-backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: {{ include "cluster.fullname" $context }}-{{ .name }}
namespace: {{ include "cluster.namespace" . }}
labels: {{ include "cluster.labels" $context | nindent 4 }}
spec:
immediate: true
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/tests/ping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "cluster.fullname" . }}-ping-test
namespace: {{ include "cluster.namespace" . }}
labels:
app.kubernetes.io/component: database-ping-test
annotations:
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/templates/user-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "cluster.fullname" . }}-monitoring
namespace: {{ include "cluster.namespace" . }}
labels:
cnpg.io/reload: ""
{{- include "cluster.labels" . | nindent 4 }}
Expand Down
2 changes: 2 additions & 0 deletions charts/cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
nameOverride: ""
# -- Override the full name of the chart
fullnameOverride: ""
# -- Override the namespace of the chart
namespaceOverride: ""

###
# -- Type of the CNPG database. Available types:
Expand Down