88* Multiple user roles can own one database
99* Creates Kubernetes secret with postgres_uri in the same namespace as CR
1010* Support for AWS RDS and Azure Database for PostgresSQL
11+ * Support for managing CRs in dynamically created namespaces
1112
1213## Cloud specific configuration
1314
@@ -34,6 +35,15 @@ To have operator work with GCP properly you have to:
3435
3536DropRole method will check for db owner and will skip master role dropping
3637
38+ ## General Configuration
39+ These environment variables are embedded in [ deploy/operator.yaml] ( deploy/operator.yaml ) , ` env ` section.
40+
41+ * ` WATCH_NAMESPACE ` - which namespace to watch. Defaults to empty string for all namespaces
42+ * ` OPERATOR_NAME ` - name of the operator, defaults to ` ext-postgres-operator `
43+ * ` POSTGRES_INSTANCE ` - identity of operator, this matched with ` postgres.db.movetokube.com/instance ` in CRs. Default is empty
44+
45+ ` POSTGRES_INSTANCE ` is only available since version 1.2.0
46+
3747## Installation
3848
3949This operator requires a Kubernetes Secret to be created in the same namespace as operator itself.
@@ -78,6 +88,10 @@ kind: Postgres
7888metadata:
7989 name: my-db
8090 namespace: app
91+ annotations:
92+ # OPTIONAL
93+ # use this to target which instance of operator should process this CR. See General config
94+ postgres.db.movetokube.com/instance: POSTGRES_INSTANCE
8195spec:
8296 database: test-db # Name of database created in PostgreSQL
8397 dropOnDelete: false # Set to true if you want the operator to drop the database and role when this CR is deleted (optional)
@@ -101,6 +115,10 @@ kind: PostgresUser
101115metadata:
102116 name: my-db-user
103117 namespace: app
118+ annotations:
119+ # OPTIONAL
120+ # use this to target which instance of operator should process this CR. See general config
121+ postgres.db.movetokube.com/instance: POSTGRES_INSTANCE
104122spec:
105123 role: username
106124 database: my-db # This references the Postgres CR
@@ -127,6 +145,11 @@ Every PostgresUser has a generated Kubernetes secret attached to it, which conta
127145| `POSTGRES_URL` | Connection string for Posgres, could be used for Go applications |
128146| `POSTGRES_JDBC_URL` | JDBC compatible Postgres URI, formatter as `jdbc:postgresql://{POSTGRES_HOST}/{DATABASE_NAME}` |
129147
148+ # ## Multiple operator support
149+ Since version 1.2 it is possible to use many instances of postgres-operator to control different databases based on annotations in CRs.
150+ Follow the steps below to enable multi-operator support.
151+ 1. Add POSTGRES_INSTANCE
152+
130153# ### Annotations Use Case
131154
132155With the help of annotations it is possible to create annotation-based copies of secrets in other namespaces.
@@ -153,9 +176,9 @@ can be found [here](https://github.com/kubernetes/client-go/blob/master/README.m
153176
154177Postgres operator compatibility with Operator SDK version is in the table below
155178
156- | | Operator SDK version | apiextensions.k8s.io |
157- |------------------------------- |----------------------|----------------------|
158- | `postgres-operator 0.4.x` | v0.17 | v1beta1 |
159- | `postgres-operator 1.0 .x` | v0.18 | v1 |
160- | `HEAD` | v0.18 | v1 |
179+ | | Operator SDK version | apiextensions.k8s.io |
180+ |---------------------------|----------------------|----------------------|
181+ | `postgres-operator 0.4.x` | v0.17 | v1beta1 |
182+ | `postgres-operator 1.x .x` | v0.18 | v1 |
183+ | `HEAD` | v0.18 | v1 |
161184
0 commit comments