From 7400d0d4d9a622ec9bb4513c40dd935591b1dc72 Mon Sep 17 00:00:00 2001 From: Trevor Royer Date: Wed, 26 Jun 2024 09:34:52 -0600 Subject: [PATCH] update crunchy chart --- charts/crunchy-postgres/Chart.yaml | 7 +- charts/crunchy-postgres/README.md.gotmpl | 44 +++++++++++ charts/crunchy-postgres/templates/_s3.tpl | 3 + .../crunchy-postgres/templates/postgres.yaml | 17 +++- charts/crunchy-postgres/values.yaml | 77 +++++++++++-------- 5 files changed, 112 insertions(+), 36 deletions(-) create mode 100644 charts/crunchy-postgres/README.md.gotmpl diff --git a/charts/crunchy-postgres/Chart.yaml b/charts/crunchy-postgres/Chart.yaml index 0839fdb..420d926 100644 --- a/charts/crunchy-postgres/Chart.yaml +++ b/charts/crunchy-postgres/Chart.yaml @@ -1,6 +1,7 @@ apiVersion: v2 name: postgrescluster -description: A Helm chart for deploying Postgres using the Crunchy Operator +description: A Helm chart for Kubernetes type: application -version: 0.2.2 -appVersion: 5.0.5 +# The version below should match the version on the PostgresCluster CRD +version: 5.6.0 +appVersion: 5.6.0 diff --git a/charts/crunchy-postgres/README.md.gotmpl b/charts/crunchy-postgres/README.md.gotmpl new file mode 100644 index 0000000..a060f20 --- /dev/null +++ b/charts/crunchy-postgres/README.md.gotmpl @@ -0,0 +1,44 @@ +{{ template "chart.header" . }} +{{ template "chart.description" . }} + +{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} + +This chart is a fork of the upstream Crunchy examples chart found here: + +https://github.com/CrunchyData/postgres-operator-examples/tree/main/helm/postgres + +## Installing the Chart + +To access charts from this from the cli repository add it: + +```sh +helm repo add strangiato https://strangiato.github.io/helm-charts/ +helm repo update +helm upgrade -i [release-name] strangiato/{{ template "chart.name" . }} +``` + +To include a chart from this repository in an umbrella chart, include it in your dependencies in your `Chart.yaml` file. + +```yaml +apiVersion: v2 +name: example-chart +description: A Helm chart for Kubernetes +type: application + +version: 0.1.0 + +appVersion: "1.16.0" + +dependencies: + - name: "{{ template "chart.name" . }}" + version: "{{ template "chart.version" . }}" + repository: "https://strangiato.github.io/helm-charts/" +``` + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} + +{{ template "helm-docs.versionFooter" . }} diff --git a/charts/crunchy-postgres/templates/_s3.tpl b/charts/crunchy-postgres/templates/_s3.tpl index ce48ab8..7607723 100644 --- a/charts/crunchy-postgres/templates/_s3.tpl +++ b/charts/crunchy-postgres/templates/_s3.tpl @@ -7,6 +7,9 @@ repo{{ add .index 1 }}-s3-key={{ .s3.key }} {{- end }} {{- if .s3.keySecret }} repo{{ add .index 1 }}-s3-key-secret={{ .s3.keySecret }} + {{- end }} + {{- if .s3.keyType }} +repo{{ add .index 1 }}-s3-key-type={{ .s3.keyType }} {{- end }} {{- if .s3.encryptionPassphrase }} repo{{ add .index 1 }}-cipher-pass={{ .s3.encryptionPassphrase }} diff --git a/charts/crunchy-postgres/templates/postgres.yaml b/charts/crunchy-postgres/templates/postgres.yaml index ea3c56c..5326136 100644 --- a/charts/crunchy-postgres/templates/postgres.yaml +++ b/charts/crunchy-postgres/templates/postgres.yaml @@ -3,7 +3,7 @@ kind: PostgresCluster metadata: name: {{ default .Release.Name .Values.name }} spec: - postgresVersion: {{ default 13 .Values.postgresVersion }} + postgresVersion: {{ required "You must set the version of Postgres to deploy." .Values.postgresVersion }} {{- if .Values.postGISVersion }} postGISVersion: {{ quote .Values.postGISVersion }} {{- end }} @@ -21,6 +21,9 @@ spec: - name: {{ default "instance1" .Values.instanceName | quote }} replicas: {{ default 1 .Values.instanceReplicas }} dataVolumeClaimSpec: + {{- if .Values.instanceStorageClassName }} + storageClassName: {{ .Values.instanceStorageClassName | quote }} + {{- end }} accessModes: - "ReadWriteOnce" resources: @@ -56,6 +59,9 @@ spec: {{- if $repo.volume }} volume: volumeClaimSpec: + {{- if $repo.volume.backupsStorageClassName }} + storageClassName: {{ .Values.backupsStorageClassName | quote }} + {{- end }} accessModes: - "ReadWriteOnce" resources: @@ -114,6 +120,9 @@ spec: - name: repo1 volume: volumeClaimSpec: + {{- if .Values.backupsStorageClassName }} + storageClassName: {{ .Values.backupsStorageClassName | quote }} + {{- end }} accessModes: - "ReadWriteOnce" resources: @@ -145,7 +154,7 @@ spec: {{ toYaml .Values.service | indent 4 }} {{- end }} {{- if .Values.dataSource }} - service: + dataSource: {{ toYaml .Values.dataSource | indent 4 }} {{- end }} {{- if .Values.databaseInitSQL }} @@ -182,7 +191,9 @@ spec: {{- if .Values.standby }} standby: enabled: {{ .Values.standby.enabled }} - repoName: {{ required "repoName must be set when enabling standby mode." .Values.standby.repoName }} + repoName: {{ .Values.standby.repoName }} + host: {{ .Values.standby.host }} + port: {{ .Values.standby.port }} {{- end }} {{- if .Values.supplementalGroups }} supplementalGroups: diff --git a/charts/crunchy-postgres/values.yaml b/charts/crunchy-postgres/values.yaml index 494e572..38dffbd 100644 --- a/charts/crunchy-postgres/values.yaml +++ b/charts/crunchy-postgres/values.yaml @@ -14,10 +14,10 @@ # postgresVersion sets the version to deploy. This version number needs to be # available as one of the "RELATED_IMAGE_POSTGRES_..." images as part of the PGO # installation if you want to deploy the image without setting the "postgres" -# image variable. This defaults to the below value. -postgresVersion: 14 +# image variable. This value is required. +postgresVersion: 16 -# postGISVersion if sets and coupled with a PostGIS enabled container, enables +# postGISVersion if set and coupled with a PostGIS enabled container, enables # PostGIS. This version number needs to be available as one of the # "RELATED_IMAGE_POSTGRES_..." images as part of the PGO installation if you # want to deploy the image without setting the "postgres" image variable. @@ -32,10 +32,10 @@ postgresVersion: 14 # "pgBouncerConfig". Setting "pgBouncerConfig" will override the value of # pgBouncerReplicas. The "RELATED_IMAGE_PGBOUNCER" in the PGO deployment must be # set if you want to enable this without explicitly setting "pgBouncer". -pgBouncerReplicas: 2 +# pgBouncerReplicas: 1 # monitoring enables the ability to monitor the Postgres cluster through a -# metrics exporter than can be scraped by Prometheus. This defaults to the value +# metrics exporter that can be scraped by Prometheus. This defaults to the value # below. # monitoring: false @@ -47,19 +47,19 @@ pgBouncerReplicas: 2 # below value. "postgresVersion" needs to match the version of Postgres that is # used here. If using the GIS-enabled Postgres image, you need to ensure # "postGISVersion" matches the version of PostGIS used. -# imagePostgres: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:centos8-13.6-0 +# imagePostgres: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.3-1 # imagePgBackRest is the pgBackRest backup utility image. This defaults to the # below value. -# imagePgBackRest: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-2.36-1 +# imagePgBackRest: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.51-1 # imagePgBouncer is the image for the PgBouncer connection pooler. This defaults # to the below value. -# imagePgBouncer: registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:centos8-1.16-1 +# imagePgBouncer: registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.22-1 # imageExporter is the image name for the exporter used as a part of monitoring. # This defaults to the value below. -# imageExporter: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-5.0.5-0 +# imageExporter: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-0.15.0-7 ########################### # Basic Postgres Settings # @@ -73,6 +73,12 @@ pgBouncerReplicas: 2 # to the value below. Settings "instances" overrides this value. # instanceSize: 1Gi +# instanceStorageClassName sets the storage class for the volume that contains the data. +# This defaults to the "default" storage class defined in the cluster. +# See: 'kubectl get storageclasses.storage.k8s.io | grep default' +# Settings "instances" overrides this value. +# instanceStorageClassName: "hostpath" + # instanceMemory sets the memory limit for the Postgres instances. This defaults # to no limit being set, but an example value is set below. Settings "instances" # overrides this value. @@ -86,7 +92,7 @@ pgBouncerReplicas: 2 # instanceReplicas lets you set the total number of Postgres replicas. This # defaults to the value below. More than on replica enables high availability # (HA). Settings "instances" overrides this value. -instanceReplicas: 2 +# instanceReplicas: 1 ############################## # Advanced Postgres Settings # @@ -127,7 +133,7 @@ instanceReplicas: 2 # patroni: {} # users sets any custom Postgres users and databases that they have access to -# as well as any permossions assoicated with the user account. +# as well as any permissions associated with the user account. # users: {} # dataSource specifies a data source for bootstrapping a Postgres cluster. @@ -143,21 +149,23 @@ instanceReplicas: 2 # provides the information for the replication user. # customReplicationTLSSecret: {} -# databaseInitSQL referencs a ConfigMap that contains a SQL file that should be +# databaseInitSQL references a ConfigMap that contains a SQL file that should be # run a cluster bootstrap. # databaseInitSQL: # name: bootstrap-sql # key: bootstrap.sql -# standby sets whether or not to run this as a standby cluster. Both of the -# values below are required to enable a standby cluster. Setting "enabled" to -# "true" eunables the standby cluster while "repoName" points to a pgBackRest -# archive to replay WAL files from. +# standby sets whether to run this as a standby cluster. Setting "enabled" to +# "true" enables the standby cluster while "repoName" points to a pgBackRest +# archive to replay WAL files from, and "host" and "port" point to a primary +# cluster from which to stream data. # standby: # enabled: false # repoName: repo1 +# host: "192.0.2.2" +# port: 5432 -# shutdown when set scales the entire workload to zero. By default this is not +# shutdown when set scales the entire workload to zero. By default, this is not # set. # shutdown: true @@ -169,6 +177,11 @@ instanceReplicas: 2 # can be overridden by "pgBackRestConfig", if set. Defaults to the value below. # backupsSize: 1Gi +# backupsStorageClassName sets the storage class to a class existing in Kubernetes. +# Defaults to the "default" storage class defined in the cluster. +# Can be overridden by "pgBackRestConfig", if set. +# backupsStorageClassName: "hostpath" + # s3 allows for AWS S3 or an S3 compatible storage system to be used for # backups. This allows for a quick setup with S3; if you need more advanced # setup, use pgBackRestConfig. @@ -178,15 +191,18 @@ instanceReplicas: 2 # # endpoint specifies the S3 endpoint to use. # endpoint: "" # # region specifies the S3 region to use. If your S3 storage system does not -# # use "region", fill this in with a random vaule. +# # use "region", fill this in with a random value. # region: "" # # key is the S3 key. This is stored in a Secret. # key: "" -# # keySecret is the S3 key secret. This is tored in a Secret. +# # keySecret is the S3 key secret. This is stored in a Secret. # keySecret: "" +# # keyType can be configured to enable IAM integration via AssumeRole +# # For more info, see the documentation at https://access.crunchydata.com/documentation/postgres-operator/v5/tutorial/backups/#using-an-aws-integrated-identity-provider-and-role +# keyType: "" # # encryptionPassphrase is an optional parameter to enable encrypted backups # # with pgBackRest. This is encrypted by pgBackRest and does not use S3's -# # built-in encrpytion system. +# # built-in encryption system. # encryptionPassphrase: "" # gcs allows for Google Cloud Storage (GCS) to be used for backups. This allows @@ -206,7 +222,7 @@ instanceReplicas: 2 # azure: # # account is the name of the Azure account to be used. # account: "" -# # key is the Secret key used associated with the Azure acount. +# # key is the Secret key used associated with the Azure account. # key: "" # # container is the Azure container that the backups will be stored in. # container: "" @@ -219,8 +235,8 @@ instanceReplicas: 2 # You can't set "multiBackupRepos" and any of the individual quickstarts at the # same time. "multiBackupRepos" will take precedence. # -# Below is an example that enables one of each backup type. Note all of the -# available quickstart options are presented below; please see the backup types +# Below is an example that enables one of each backup type. +# All available quickstart options are presented below; please see the backup types # if you want to see how each option works. # multiBackupRepos: # - volume: @@ -231,6 +247,7 @@ instanceReplicas: 2 # region: "" # key: "" # keySecret: "" +# keyType: "" # - gcs: # bucket: "" # key: | @@ -248,7 +265,7 @@ instanceReplicas: 2 # Pooling / pgBouncer Settings # ################################ -# pgBouncerConfig sets all of the pgBouncer portion of the spec except for +# pgBouncerConfig sets all of the pgBouncer portions of the spec except for # image. To set image, you need to set the "pgBouncer" setting. # pgBouncerConfig: {} @@ -256,7 +273,7 @@ instanceReplicas: 2 # Monitoring Settings # ####################### -# monitoringConfig sets all of the monitoring portion of the spec except for the +# monitoringConfig sets all of the monitoring portions of the spec except for the # image. To set the image, which also enables monitoring, you need to set the # "monitoring" setting. # monitoringConfig: {} @@ -267,7 +284,7 @@ instanceReplicas: 2 # metadata contains any metadata that should be applied to all PGO managed # objects in this Postgres cluster. This includes "annotations" and "labels" as -# subkeys. +# sub-keys. # metadata: {} # service customizes the Service that exposes the Postgres primary. @@ -283,7 +300,7 @@ instanceReplicas: 2 # imagePullSecrets: [] # supplementalGroups sets any group IDs that should be assigned to -# Pods, particularly around file system contraints within a system +# Pods, particularly around file system constraints within a system # supplementalGroups: [] # disableDefaultPodScheduling if set to true, will disable any of the default @@ -292,8 +309,8 @@ instanceReplicas: 2 # be used in addition to any customizations that are added in. # disableDefaultPodScheduling: false -# openshift can set explicitly if this is an OpenShift cluster, or a cluster +# openshift can be set explicitly if this is an OpenShift cluster or a cluster # that uses a SecurityContextConstraint. This usually does not need to be set, -# but you may want to explicitly set it to "false" when using a SCC like +# but you may want to explicitly set it to "false" when using an SCC like # "anyuid" -openshift: true +# openshift: false