From 63dd27ceb4bdfe90c9fe95c73ac02ce3acae02de Mon Sep 17 00:00:00 2001 From: a8s-ci Date: Tue, 2 Apr 2024 13:20:44 +0000 Subject: [PATCH 1/2] Bump manifest and update API documentation --- deploy/a8s/manifests/postgresql-operator.yaml | 12 ++++++------ .../api-documentation/postgresql-operator/v1beta3.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deploy/a8s/manifests/postgresql-operator.yaml b/deploy/a8s/manifests/postgresql-operator.yaml index 82c0a831..de6a4615 100644 --- a/deploy/a8s/manifests/postgresql-operator.yaml +++ b/deploy/a8s/manifests/postgresql-operator.yaml @@ -67,20 +67,20 @@ spec: extensions: description: |- Extensions defines a list of PostgreSQL extensions which should be installed. Extensions can - be installed from the supported list of extensions. NOTE: This implementation of extensions - will enabled in a up coming feature PR. Remove note once PR is merged. + be installed from the supported list of extensions. The currently supported extensions are: + postgis, uuid-ossp, ltree, pgcrypto, pg_stat_statements, fuzzystrmatch, pg_trgm, hstore items: type: string - maxItems: 9 + maxItems: 8 type: array x-kubernetes-list-type: set x-kubernetes-validations: - message: 'Only the following extensions are supported: ''postgis'', ''uuid-ossp'', ''ltree'', ''pgcrypto'', ''pg_stat_statements'', - ''fuzzystrmatch'', ''pg_trgm'', ''hstore'', ''mobilitydb''.' + ''fuzzystrmatch'', ''pg_trgm'', ''hstore''.' rule: self.all(extension, extension in ['postgis', 'uuid-ossp', 'ltree', 'pgcrypto', 'pg_stat_statements', 'fuzzystrmatch', 'pg_trgm', - 'hstore', 'mobilitydb']) + 'hstore']) parameters: properties: archiveTimeoutSeconds: @@ -1602,7 +1602,7 @@ spec: - --leader-elect command: - ./manager - image: public.ecr.aws/w5n9a2g2/a9s-ds-for-k8s/dev/postgresql-operator:58ff6eb0a92442340005c9a6f957589ef35e1e07 + image: public.ecr.aws/w5n9a2g2/a9s-ds-for-k8s/dev/postgresql-operator:553cc3f68aff84f4f2081cee951d7eb707d0f410 livenessProbe: httpGet: path: /healthz diff --git a/docs/application-developers/api-documentation/postgresql-operator/v1beta3.md b/docs/application-developers/api-documentation/postgresql-operator/v1beta3.md index 12898d05..e9ba78ad 100644 --- a/docs/application-developers/api-documentation/postgresql-operator/v1beta3.md +++ b/docs/application-developers/api-documentation/postgresql-operator/v1beta3.md @@ -95,7 +95,7 @@ _Appears in:_ | `volumeSize` _Quantity_ | VolumeSize sets the size of the persistent volume of the PostgreSQL instance, the minimum size is 0.5Gi. The size is to be specified as a plain integer or as a fixed-point number using one of these suffixes: E, P, T, G, M, K, corresponding to kilo-, mega-, gigabytes, etc. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki, corresponding to kibi-, mebi-, gibibytes, etc. For example a value of "0.5Gi" corresponds to an instance with a persistent volume of 0.5 gibibytes. | | `parameters` _[PostgresqlParameters](#postgresqlparameters)_ | | | `schedulingConstraints` _[PostgresqlSchedulingConstraints](#postgresqlschedulingconstraints)_ | SchedulingConstraints contains subfields that affect how the Pods of the Postgresql instance will be scheduled onto Kubernetes cluster nodes. The subfields map directly to Kubernetes API primitives such as node taints, tolerations, affinity and (anti)affinity. See the documentation of each subfield for more details. Together, the subfields of SchedulingConstraints allow you to express constraints such as "Pods of this Postgresql instance MUST be scheduled to different availability zones", or "Pods of this Postgresql instance SHOULD preferably (but not mandatorily) be scheduled to nodes that have a SSD", and many more. As a warning, the subfields of SchedulingConstraints can interfere with each other, so when you set one of them you should consider how it will interact with the values that you set for other subfields. | -| `extensions` _string array_ | Extensions defines a list of PostgreSQL extensions which should be installed. Extensions can be installed from the supported list of extensions. NOTE: This implementation of extensions will enabled in a up coming feature PR. Remove note once PR is merged. | +| `extensions` _string array_ | Extensions defines a list of PostgreSQL extensions which should be installed. Extensions can be installed from the supported list of extensions. The currently supported extensions are: postgis, uuid-ossp, ltree, pgcrypto, pg_stat_statements, fuzzystrmatch, pg_trgm, hstore. | | `enableReadOnlyService` _boolean_ | EnableReadOnlyService enables the creation of a read-only service. A read-only service is meant for read operations and allows for load-balancing across different PostgreSQL cluster members. Stale reads are possible when reading from this service. By default this feature is disabled. | | `readOnlyTargetNodes` _string_ | ReadOnlyTargetNodes specifies the target PostgreSQL cluster members which the read-only service points to. "replicas" means that only the PostgreSQL cluster replicas are used for the read-only service. "all" means that the read-only service points to all PostgreSQL cluster members. By default this feature only points to the PostgreSQL cluster replicas. | | `expose` _[ExposeOption](#exposeoption)_ | Expose determines where (and how) the DSI can be accessed from. Currently supported values are - "Internal": the DSI will be accessible only from inside the K8s cluster - "LoadBalancer": the DSI will receive dedicated load balancers with reachable IP addresses that can be used from external locations . This is only supported on K8s clusters that support external load balancers. This field applies to all the services backed by the DSI, that is, both the master-only one and the read-only one; the "LoadBalancer" value means that each service will get a dedicated LoadBalancer. | From 3e9b8d42807f8bc2376f708fa704aeb0a7af90c8 Mon Sep 17 00:00:00 2001 From: Matthew Doherty Date: Thu, 25 Apr 2024 09:23:30 +0200 Subject: [PATCH 2/2] Add PostgreSQL Extensions documentation --- docs/application-developers/usage_overview.md | 10 +++++++++ docs/current_limitations.md | 8 +++---- examples/postgresql-extensions-instance.yaml | 22 +++++++++++++++++++ test/e2e/postgresql/postgresql_test.go | 3 +++ 4 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 examples/postgresql-extensions-instance.yaml diff --git a/docs/application-developers/usage_overview.md b/docs/application-developers/usage_overview.md index f275b229..c295b52a 100644 --- a/docs/application-developers/usage_overview.md +++ b/docs/application-developers/usage_overview.md @@ -233,6 +233,16 @@ When you want to delete a `Restore`, run: kubectl delete restore ``` +## Install/Uninstall PostgreSQL Extensions + +PostgreSQL is designed to be easily extensible. For this reason, extensions loaded into the database can function just like features that are built in. Application developers can enable extensions by adding the desired extensions to the extensions field as a list. Likewise, extensions can be uninstalled by removing them from the extensions list. Extensions can be installed on new instances as well as on running instances. + +WARNING: Extensions cannot be removed if they have dependencies on other objects in the database. If you are using features of an extension in your database tables, the removal operation will not succeed. Users must remove these blocking dependencies for the extension to be cleanly removed from the database. The PostgreSQL operator will not forcibly remove extensions with dependencies to avoid unexpected data loss. + +The extensions currently supported are: postgis, uuid-ossp, ltree, pgcrypto, pg_stat_statements, fuzzystrmatch, pg_trgm, hstore. + +See [examples/postgresql-extensions-instance.yaml](examples/postgresql-extensions-instance.yaml) for an example manifest containing a list of desired extensions to be installed. + ## Visualize the Logs of the PostgreSQL Instance Application developers should be aware that all pods with the label field `app` diff --git a/docs/current_limitations.md b/docs/current_limitations.md index 3c6b61f4..b8a528d6 100644 --- a/docs/current_limitations.md +++ b/docs/current_limitations.md @@ -59,6 +59,10 @@ to force the deletion. +## PostgreSQL Extensions + +- Status on extension state, required for informing user of unresolvable dependencies on extensions that block their removal. + ## Service Bindings - Custom parameters for configuring the permissions are not supported. @@ -67,10 +71,6 @@ reason behind that is that the secrets, where the password and username are stored, are limited to a single namespace (see [Kubernetes Secrets][k8s-secrets]) -## PostgreSQL Extensions - -- Extensions validation does implement extension installation. - ## Logging - OpenDashboards has the authentication disabled, this means that the dashboard diff --git a/examples/postgresql-extensions-instance.yaml b/examples/postgresql-extensions-instance.yaml new file mode 100644 index 00000000..d4fee833 --- /dev/null +++ b/examples/postgresql-extensions-instance.yaml @@ -0,0 +1,22 @@ +apiVersion: postgresql.anynines.com/v1beta3 +kind: Postgresql +metadata: + name: sample-pg-cluster +spec: + extensions: + - postgis + - uuid-ossp + - ltree + - pgcrypto + - pg_stat_statements + - fuzzystrmatch + - pg_trgm + - hstore + replicas: 3 + volumeSize: 1Gi + version: 14 + resources: + requests: + cpu: 100m + limits: + memory: 200Mi diff --git a/test/e2e/postgresql/postgresql_test.go b/test/e2e/postgresql/postgresql_test.go index 831d0265..54953707 100644 --- a/test/e2e/postgresql/postgresql_test.go +++ b/test/e2e/postgresql/postgresql_test.go @@ -1321,6 +1321,7 @@ var _ = Describe("PostgreSQL Operator end-to-end tests", func() { }) It("Provisions the PostgreSQL instance with one PostgreSQL extension", func() { + Skip("Skip MobilityDB related tests until we support arbitrary extensions") extensions := []string{"mobilitydb"} instance, err = dsi.New( @@ -1404,6 +1405,7 @@ var _ = Describe("PostgreSQL Operator end-to-end tests", func() { }) It("Adds one PostgreSQL extension on update", func() { + Skip("Skip MobilityDB related tests until we support arbitrary extensions") instance, err = dsi.New( dataservice, testingNamespace, @@ -1547,6 +1549,7 @@ var _ = Describe("PostgreSQL Operator end-to-end tests", func() { }) It("Removes all PostgreSQL extensions on update", func() { + Skip("Skip MobilityDB related tests until we support arbitrary extensions") extensions := []string{"mobilitydb"} instance, err = dsi.New( dataservice,