Skip to content

Commit

Permalink
Merge branch 'main' into fix-helm-hostpath
Browse files Browse the repository at this point in the history
  • Loading branch information
tplavcic authored Jan 31, 2024
2 parents 7f3711f + 37ea961 commit 7028aaa
Show file tree
Hide file tree
Showing 38 changed files with 14,320 additions and 10,645 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.deploy/
.idea/
4 changes: 2 additions & 2 deletions charts/pg-db/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pg-db
description: 'A Helm chart to deploy the PostgreSQL database with the Percona Operator for PostgreSQL'
type: application
version: 2.2.7
appVersion: 2.2.0
version: 2.3.2
appVersion: 2.3.1
home: https://docs.percona.com/percona-operator-for-postgresql/2.0/
maintainers:
- name: tplavcic
Expand Down
36 changes: 24 additions & 12 deletions charts/pg-db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Useful links:

## Pre-requisites
* [Percona Operator for PostgreSQL](https://hub.helm.sh/charts/percona/pg-operator) running in your Kubernetes cluster. See installation details [here](https://github.com/percona/percona-helm-charts/tree/main/charts/pg-operator) or in the [Operator Documentation](https://www.percona.com/doc/kubernetes-operator-for-postgresql/helm.html).
* Kubernetes 1.22+
* Kubernetes 1.24+
* At least `v3.2.3` version of helm

# Installation
Expand All @@ -24,20 +24,20 @@ To install the chart with the `pg` release name using a dedicated namespace (rec

```sh
helm repo add percona https://percona.github.io/percona-helm-charts/
helm install my-db percona/pg-db --version 2.2.0 --namespace my-namespace
helm install my-db percona/pg-db --version 2.3.1 --namespace my-namespace
```

The chart can be customized using the following configurable parameters:

| Parameter | Description | Default |
| ------------------------------- | ------------------------------------------------------------------------------|-------------------------------------------------------------|
| `finalizers` | Finalizers list | `{}` |
| `crVersion` | CR Cluster Manifest version | `2.2.0` |
| `crVersion` | CR Cluster Manifest version | `2.3.1` |
| `repository` | PostgreSQL container image repository | `percona/percona-postgresql-operator` |
| `image` | Postgres image | `percona/percona-postgresql-operator:2.2.0-ppg15-postgres` |
| `image` | Postgres image | `percona/percona-postgresql-operator:2.3.1-ppg16-postgres` |
| `imagePullPolicy` | image Pull Policy | `Always` |
| `port` | PostgreSQL port | `5432` |
| `postgresVersion` | PostgreSQL container version tag | `15` |
| `postgresVersion` | PostgreSQL container version tag | `16` |
| `pause` | Stop PostgreSQL Database safely | `false` |
| `unmanaged` | Start cluster and don't manage it (cross cluster replication) | `false`
| `standby.enabled` | Switch/start PostgreSQL Database in standby mode | `false` |
Expand Down Expand Up @@ -67,8 +67,10 @@ The chart can be customized using the following configurable parameters:
| `expose.annotations` | The Kubernetes annotations metadata for PostgreSQL | `{}` |
| `expose.labels` | Set labels for the PostgreSQL Service | `{}` |
| `expose.type` | Specifies the type of Kubernetes Service for PostgreSQL | `LoadBalancer` |
| `expose.loadBalancerSourceRanges` | The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations) | `[]` |
| `instances.name` | The name of the PostgreSQL instance | `instance1` |
| `instances.replicas` | The number of Replicas to create for the PostgreSQL instance | `3` |
| `instances.affinity.podAntiAffinity` | Pod anti-affinity, allows setting the standard Kubernetes affinity constraints of any complexity | `{}` |
| `instances.resources.limits.memory` | Kubernetes memory limits for a PostgreSQL instance | `4Gi` |
| `instances.resources.limits.cpu` | Kubernetes CPU limits for a PostgreSQL instance | `2.0` |
| `instances.sidecars.name` | Name of the custom sidecar container for PostgreSQL Pods | `testcontainer` |
Expand Down Expand Up @@ -114,12 +116,14 @@ The chart can be customized using the following configurable parameters:
| `backups.restore.enabled` | Enables or disables restoring a previously made backup | `false` |
| `backups.restore.repoName` | Name of the pgBackRest repository that contains the backup to be restored | `repo1` |
| `backups.restore.options` | The pgBackRest command-line options for the pgBackRest restore command | `--type=time` |
| `backups.pgbackrest.image` | Set this variable if you need to use a custom pgBackrest image | `percona/percona-postresql-operator:2.2.0-ppg15-pgbackrest` |
| `backups.pgbackrest.image` | Set this variable if you need to use a custom pgBackrest image | `percona/percona-postresql-operator:2.3.1-ppg16-pgbackrest` |
| `backups.repos.repo2.s3.bucket` | Storage bucket | `` |
| `backups.repos.repo2.s3.region` | S3-compatible storage name | `` |
| `backups.repos.repo2.s3.endpoint` | S3-compatible storage endpoint | `` |
| `proxy.pgBouncer.expose.annotations` | The Kubernetes annotations metadata for pgBouncer | `pg-cluster-annot: cluster1` |
| `proxy.pgBouncer.expose.labels` | Set labels for the pgBouncer Service | `pg-cluster-label: cluster1` |
| `proxy.pgBouncer.expose.type` | K8S service type for the pgbouncer deployment | `ClusterIP` |
| `proxy.pgBouncer.expose.loadBalancerSourceRanges` | The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations) | `[]` |
| `proxy.pgBouncer.sidecars.image` | Image for the custom sidecar container for pgBouncer Pods | `mycontainer1:latest` |
| `proxy.pgBouncer.sidecars.name` | Name of the custom sidecar container for pgBouncer Pods | `testcontainer` |
| `proxy.pgBouncer.exposeSuperusers` | Allow superusers connect via pgbouncer | `false` |
Expand All @@ -140,18 +144,26 @@ The chart can be customized using the following configurable parameters:
| `proxy.pgBouncer.resources.requests.memory` | Container resource request for RAM | `128Mi` |
| `proxy.pgBouncer.resources.limits.cpu` | Container resource limits for CPU | `2` |
| `proxy.pgBouncer.resources.limits.memory` | Container resource limits for RAM | `512Mi` |
| `proxy.pgBouncer.expose.type` | K8S service type for the pgbouncer deployment | `ClusterIP` |
| `pmm.enabled` | Enable integration with [Percona Monitoring and Management software](https://www.percona.com/blog/2020/07/23/using-percona-kubernetes-operators-with-percona-monitoring-and-management/) | `false` |
| `pmm.image.repository` | PMM Container image repository | `percona/pmm-client` |
| `pmm.image.tag` | PMM Container image tag | `2.40.1` |
| `pmm.image.tag` | PMM Container image tag | `2.41.0` |
| `pmm.serverHost` | PMM server related K8S service hostname | `monitoring-service` |
| `pmm.resources.requests.memory` | Container resource request for RAM | `200M` |
| `pmm.resources.requests.cpu` | Container resource request for CPU | `500m` |
| `patroni.dynamicConfiguration` | Add custom configuration for patroni | `{}` |
| `extensions.image` | Image for the custom PostgreSQL extension loader sidecar container | `""` |
| `extensions.imagePullPolicy` | Policy for the custom extension sidecar container | `Always` |
| `extensions.storage.type` | The cloud storage type used for backups. Only s3 type is currently supported. | `""` |
| `extensions.storage.bucket` | The Amazon S3 bucket name for prepackaged PostgreSQL custom extensions | `""` |
| `extensions.storage.region` | The AWS region to use | `""` |
| `extensions.storage.secret.name` | The Kubernetes secret for the custom extensions storage. It should contain AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY keys | `""` |
| `extensions.builtin` | The key-value pairs which enable or disable Percona Distribution for PostgreSQL builtin extensions | `{}` |
| `extensions.custom` | Array of name and versions for each PostgreSQL custom extension | `[]` |
| `secrets.name` | Database secrets object name. Object will be autogenerated if the name is not explicitly specified | `<cluster_name>-users` |
| `secrets.primaryuser` | primary user password (in use for replication only) | `autogrenerated by operator` |
| `secrets.postgres` | postges user password (superuser, not accessible via pgbouncer) | `autogrenerated by operator` |
| `secrets.pgbouncer` | pgbouncer user password | `autogrenerated by operator` |
| `secrets.<default_user>` | Default user password | `autogrenerated by operator` |
| `secrets.primaryuser` | primary user password (in use for replication only) | `autogenerated by operator` |
| `secrets.postgres` | postges user password (superuser, not accessible via pgbouncer) | `autogenerated by operator` |
| `secrets.pgbouncer` | pgbouncer user password | `autogenerated by operator` |
| `secrets.<default_user>` | Default user password | `autogenerated by operator` |

Specify parameters using `--set key=value[,key=value]` argument to `helm install`
Notice that you can use multiple replica sets only with sharding enabled.
Expand Down
2 changes: 1 addition & 1 deletion charts/pg-db/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ To get a PostgreSQL prompt inside your new cluster you can run:

And then connect to a cluster with a temporary Pod:

$ kubectl run -i --rm --tty percona-client --image=perconalab/percona-distribution-postgresql:15 --restart=Never \
$ kubectl run -i --rm --tty percona-client --image=perconalab/percona-distribution-postgresql:16 --restart=Never \
-- psql $PGBOUNCER_URI
65 changes: 48 additions & 17 deletions charts/pg-db/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,20 @@ spec:
{{ .Values.expose.annotations | toYaml | indent 6 }}
labels:
{{ .Values.expose.labels | toYaml | indent 6 }}
{{- if .Values.expose.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ .Values.expose.loadBalancerSourceRanges | toYaml | indent 6 }}
{{- end }}
{{- end }}

instances:
{{- range $instance := .Values.instances }}
- name: {{ $instance.name }}
replicas: {{ $instance.replicas }}
{{- if $instance.affinity }}
affinity:
{{ $instance.affinity | toYaml | indent 8 }}
{{- end }}
{{- if $instance.resources }}
resources:
limits:
Expand Down Expand Up @@ -184,6 +192,10 @@ spec:
{{ .Values.proxy.pgBouncer.expose.annotations | toYaml | indent 10 }}
labels:
{{.Values.proxy.pgBouncer.expose.labels | toYaml | indent 10 }}
{{- if .Values.expose.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ .Values.expose.loadBalancerSourceRanges | toYaml | indent 10 }}
{{- end }}
{{- end }}
{{- if .Values.proxy.pgBouncer.sidecars }}
sidecars:
Expand Down Expand Up @@ -215,14 +227,7 @@ spec:
{{- end }}
{{- if .Values.proxy.pgBouncer.affinity }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: {{ .Values.proxy.pgBouncer.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.weight }}
podAffinityTerm:
labelSelector:
matchLabels:
{{ .Values.proxy.pgBouncer.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.labelSelector.matchLabels | toYaml | indent 18 }}
topologyKey: {{ .Values.proxy.pgBouncer.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey }}
{{ .Values.proxy.pgBouncer.affinity | toYaml | indent 8 }}
{{- end }}
{{- if .Values.proxy.pgBouncer.tolerations }}
tolerations:
Expand Down Expand Up @@ -281,14 +286,7 @@ spec:
{{- end }}
{{- if .Values.backups.pgbackrest.repoHost.affinity }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: {{ .Values.backups.pgbackrest.repoHost.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.weight }}
podAffinityTerm:
labelSelector:
matchLabels:
{{ .Values.backups.pgbackrest.repoHost.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.labelSelector.matchLabels | toYaml | indent 18 }}
topologyKey: {{ .Values.backups.pgbackrest.repoHost.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm.topologyKey }}
{{ .Values.backups.pgbackrest.repoHost.affinity | toYaml | indent 10 }}
{{- end }}
{{- end }}
manual:
Expand Down Expand Up @@ -325,7 +323,6 @@ spec:
{{- end }}
{{- end }}


{{- if .Values.patroni }}
patroni:
dynamicConfiguration:
Expand All @@ -337,3 +334,37 @@ spec:
- {{ $pg_hba_entry }}
{{- end }}
{{- end }}

{{- if .Values.extensions }}
extensions:
{{- if .Values.extensions.image }}
image: {{ .Values.extensions.image }}
{{- end }}
{{- if .Values.extensions.imagePullPolicy }}
imagePullPolicy: {{ .Values.extensions.imagePullPolicy }}
{{- end }}
{{- if .Values.extensions.storage }}
storage:
{{- if .Values.extensions.storage.type }}
type: {{ .Values.extensions.storage.type }}
{{- end }}
{{- if .Values.extensions.storage.bucket }}
bucket: {{ .Values.extensions.storage.bucket }}
{{- end }}
{{- if .Values.extensions.storage.region }}
region: {{ .Values.extensions.storage.region }}
{{- end }}
{{- if .Values.extensions.storage.secret.name }}
secret:
name: {{ .Values.extensions.storage.secret.name }}
{{- end }}
{{- end }}
{{- if .Values.extensions.builtin }}
builtin:
{{ .Values.extensions.builtin | toYaml | indent 6 }}
{{- end }}
{{- if .Values.extensions.custom }}
custom:
{{ .Values.extensions.custom | toYaml | indent 6 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 7028aaa

Please sign in to comment.