Skip to content

Commit

Permalink
feat: add namespace explicitly
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolò Ciraci <[email protected]>
  • Loading branch information
CiraciNicolo committed Dec 5, 2024
1 parent 7b388ba commit cc154e3
Show file tree
Hide file tree
Showing 30 changed files with 59 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/cloudnative-pg/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name: cloudnative-pg
description: CloudNativePG Operator Helm Chart
icon: https://raw.githubusercontent.com/cloudnative-pg/artwork/main/cloudnativepg-logo.svg
type: application
version: "0.22.1"
version: "0.22.2"
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning, they should reflect the version the application is using.
Expand Down
5 changes: 4 additions & 1 deletion 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
1 change: 1 addition & 0 deletions charts/cloudnative-pg/templates/monitoring-configmap.yaml
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
2 changes: 1 addition & 1 deletion charts/cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name: cluster
description: Deploys and manages a CloudNativePG cluster and its associated resources.
icon: https://raw.githubusercontent.com/cloudnative-pg/artwork/main/cloudnativepg-logo.svg
type: application
version: 0.1.0
version: 0.1.1
sources:
- https://github.com/cloudnative-pg/charts
keywords:
Expand Down
5 changes: 4 additions & 1 deletion charts/cluster/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cluster

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

> **Warning**
> ### This chart is under active development.
Expand Down Expand Up @@ -191,6 +191,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 @@ -275,3 +276,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
1 change: 1 addition & 0 deletions charts/cluster/templates/image-catalog-timescaledb-ha.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" . }}-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

0 comments on commit cc154e3

Please sign in to comment.