Skip to content

Commit

Permalink
Merge pull request #294 from anynines/a8s_1867_extensions_new_api
Browse files Browse the repository at this point in the history
A8s 1867 extensions new api
  • Loading branch information
abdulhaseeb3 authored May 3, 2024
2 parents ed4b1df + 3e9b8d4 commit 07e9a08
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 11 deletions.
12 changes: 6 additions & 6 deletions deploy/a8s/manifests/postgresql-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
10 changes: 10 additions & 0 deletions docs/application-developers/usage_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ When you want to delete a `Restore`, run:
kubectl delete restore <restore-name>
```

## 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`
Expand Down
8 changes: 4 additions & 4 deletions docs/current_limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
22 changes: 22 additions & 0 deletions examples/postgresql-extensions-instance.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions test/e2e/postgresql/postgresql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 07e9a08

Please sign in to comment.