Skip to content

Commit 0f4a89d

Browse files
committed
Update README for 2.0 release
1 parent 79abd78 commit 0f4a89d

File tree

5 files changed

+96
-87
lines changed

5 files changed

+96
-87
lines changed

CONTRIBUTING.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# CONTRIBUTING
2+
3+
You can contribute to this project by opening a PR to merge to `master`, or one of the `vX.X.X` branches.
4+
5+
## Branching
6+
7+
`master` branch contains the latest source code with all the features. `vX.X.X` contains code for the specific major versions.
8+
i.e. `v0.4.x` contains the latest code for 0.4 version of the operator. See compatibility matrix below.
9+
10+
## Tests
11+
12+
Please write tests and fix any broken tests before you open a PR. Tests should cover at least 80% of your code.
13+
14+
## e2e-tests
15+
16+
End-to-end tests are implemented using [kuttl](https://kuttl.dev/), a Kubernetes test framework. To execute these tests locally, first install kuttl on your system, then run the command `make e2e` from the project root directory.

Makefile

+4-15
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,6 @@ vet: ## Run go vet against code.
114114
test: manifests generate fmt vet envtest ## Run tests.
115115
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
116116

117-
.PHONY: lint
118-
lint: golangci-lint ## Run golangci-lint linter
119-
$(GOLANGCI_LINT) run
120-
121-
.PHONY: lint-fix
122-
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
123-
$(GOLANGCI_LINT) run --fix
124-
125117
##@ Build
126118

127119
.PHONY: build
@@ -201,13 +193,11 @@ KUBECTL ?= kubectl
201193
KUSTOMIZE ?= $(LOCALBIN)/kustomize
202194
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
203195
ENVTEST ?= $(LOCALBIN)/setup-envtest
204-
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
205196

206197
## Tool Versions
207198
KUSTOMIZE_VERSION ?= v5.4.3
208199
CONTROLLER_TOOLS_VERSION ?= v0.16.1
209200
ENVTEST_VERSION ?= release-0.19
210-
GOLANGCI_LINT_VERSION ?= v1.59.1
211201

212202
.PHONY: kustomize
213203
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -224,11 +214,6 @@ envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
224214
$(ENVTEST): $(LOCALBIN)
225215
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))
226216

227-
.PHONY: golangci-lint
228-
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
229-
$(GOLANGCI_LINT): $(LOCALBIN)
230-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
231-
232217
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
233218
# $1 - target path with name of binary
234219
# $2 - package url which can be installed
@@ -317,3 +302,7 @@ catalog-build: opm ## Build a catalog image.
317302
.PHONY: catalog-push
318303
catalog-push: ## Push a catalog image.
319304
$(MAKE) docker-push IMG=$(CATALOG_IMG)
305+
306+
.PHONY: e2e
307+
e2e:
308+
kubectl kuttl test --config ./tests/kuttl-test-self-hosted-postgres.yaml

README.md

+76-72
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,78 @@
1-
# External PostgreSQL server operator for Kubernetes
1+
# External PostgreSQL Server Operator for Kubernetes
2+
3+
Manage external PostgreSQL databases in Kubernetes with ease—supporting AWS RDS, Azure Database for PostgreSQL, GCP Cloud SQL, and more.
4+
5+
---
6+
7+
## Table of Contents
8+
9+
- [Sponsors](#sponsors)
10+
- [Features](#features)
11+
- [Supported Cloud Providers](#supported-cloud-providers)
12+
- [Configuration](#configuration)
13+
- [Installation](#installation)
14+
- [Custom Resources (CRs)](#custom-resources-crs)
15+
- [Multiple Operator Support](#multiple-operator-support)
16+
- [Secret Templating](#secret-templating)
17+
- [Compatibility](#compatibility)
18+
- [Contributing](#contributing)
19+
- [License](#license)
20+
21+
---
222

323
## Sponsors
424

5-
Please consider sponsoring my work
25+
Please consider supporting this project!
626

7-
<a class="github-button" href="https://github.com/sponsors/hitman99" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @hitman99 on GitHub">Sponsor</a>
27+
[![Sponsor](https://img.shields.io/badge/Sponsor_on_GitHub-ff69b4?style=for-the-badge&logo=github)](https://github.com/sponsors/hitman99)
828

9-
### Current Sponsors
10-
None
29+
**Current Sponsors:**
30+
_None yet. [Become a sponsor!](https://github.com/sponsors/hitman99)_
1131

1232
## Features
1333

14-
* Creates a database from a CR
15-
* Creates a role with random username and password from a CR
16-
* If the database exist, it will only create a role
17-
* Multiple user roles can own one database
18-
* Creates Kubernetes secret with postgres_uri in the same namespace as CR
19-
* Support for AWS RDS and Azure Database for PostgresSQL
20-
* Support for managing CRs in dynamically created namespaces
21-
* Template secret values
34+
- Create databases and roles using Kubernetes CRs
35+
- Automatic creation of randomized usernames and passwords
36+
- Supports multiple user roles per database
37+
- Auto-generates Kubernetes secrets with PostgreSQL connection URIs
38+
- Supports AWS RDS, Azure Database for PostgreSQL, and GCP Cloud SQL
39+
- Handles CRs in dynamically created namespaces
40+
- Customizable secret values using templates
41+
42+
---
2243

23-
## Cloud specific configuration
44+
## Supported Cloud Providers
2445

2546
### AWS
2647

27-
In order for this operator to work correctly with AWS RDS, you need to set `POSTGRES_CLOUD_PROVIDER` to `AWS` either in
28-
the ext-postgres-operator kubernetes secret or directly in the deployment manifest (`operator.yaml`).
48+
Set `POSTGRES_CLOUD_PROVIDER` to `AWS` via environment variable, Kubernetes Secret, or deployment manifest (`operator.yaml`).
2949

30-
### Azure Database for PostgreSQL (both Single Server and Flexible Server)
50+
### Azure Database for PostgreSQL Flexible Server
3151

32-
In order for this operator to work correctly with Azure managed PostgreSQL database, two env variables needs to be provided for the operator:
52+
> **Note:** Azure Single Server is deprecated as of v2.x. Only Flexible Server is supported.
3353
34-
* `POSTGRES_CLOUD_PROVIDER` set to `Azure`
35-
* `POSTGRES_DEFAULT_DATABASE` set to your default database, i.e. `postgres`
54+
- `POSTGRES_CLOUD_PROVIDER=Azure`
55+
- `POSTGRES_DEFAULT_DATABASE=postgres`
3656

3757
### GCP
3858

39-
In order for this operator to work correctly with GCP, you need to set `POSTGRES_CLOUD_PROVIDER` to `GCP`
59+
- `POSTGRES_CLOUD_PROVIDER=GCP`
60+
- Configure a PostgreSQL connection secret
61+
- Manually create a Master role and reference it in your CRs
62+
- Master roles are never dropped by the operator
4063

41-
To have operator work with GCP properly you have to:
42-
* use postgresql connection in secret
43-
* manually create a Master role e.g. "devops-operators"
44-
* use such role in database CR e.g. spec.masterRole: devops-operator
64+
## Configuration
4565

46-
DropRole method will check for db owner and will skip master role dropping
66+
Set environment variables in [`config/manager/operator.yaml`](config/manager/operator.yaml):
4767

48-
## General Configuration
49-
These environment variables are embedded in [deploy/operator.yaml](deploy/operator.yaml), `env` section.
68+
| Name | Description | Default |
69+
| --- | --- | --- |
70+
| `WATCH_NAMESPACE` | Namespace to watch. Empty string = all namespaces. | (all namespaces) |
71+
| `POSTGRES_INSTANCE` | Operator identity for multi-instance deployments. | (empty) |
72+
| `KEEP_SECRET_NAME` | Use user-provided secret names instead of auto-generated ones. | disabled |
5073

51-
* `WATCH_NAMESPACE` - which namespace to watch. Defaults to empty string for all namespaces
52-
* `OPERATOR_NAME` - name of the operator, defaults to `ext-postgres-operator`
53-
* `POSTGRES_INSTANCE` - identity of operator, this matched with `postgres.db.movetokube.com/instance` in CRs. Default is empty
54-
* `KEEP_SECRET_NAME` - use secret name as provided by user (disabled by default)
55-
56-
`POSTGRES_INSTANCE` is only available since version 1.2.0
57-
58-
> While using `KEEP_SECRET_NAME` could be a convenient way to define secrets with predictable and explicit names,
59-
> the default logic reduces risk of operator from entering the endless reconcile loop as secret is very unlikely to exist.
60-
>
61-
> The administrator should ensure that the `SecretName` does not collide with other secrets in the same namespace.
62-
> If the secret already exists, the operator will never stop reconciling the CR until either offending secret is deleted
63-
> or CR is deleted or updated with another SecretName
74+
> **Note:**
75+
> If enabling `KEEP_SECRET_NAME`, ensure there are no secret name conflicts in your namespace to avoid reconcile loops.
6476
6577
## Installation
6678

@@ -86,26 +98,26 @@ data:
8698
8799
To install the operator using kustomize, follow the steps below.
88100
89-
1. Configure Postgres credentials for the operator in `deploy/secret.yaml`
101+
1. Configure Postgres credentials for the operator in `config/secret.yaml`
90102
2. Create namespace if needed with\
91-
`kubectl apply -f deploy/namespace.yaml`
103+
`kubectl apply -f config/namespace.yaml`
92104
3. Apply the secret with\
93105
`kubectl apply -f deploy/secret.yaml`
94106
4. Create the operator with either\
95-
`kubectl kustomize deploy/ | apply -f -`\
107+
`kubectl kustomize config/default/ | apply -f -`\
96108
or by using [kustomize](https://github.com/kubernetes-sigs/kustomize) directly\
97-
`kustomize build deploy/ | apply -f -`
109+
`kustomize build config/default/ | apply -f -`
98110

99-
Alternatively you can install operator using Helm Chart located in the
111+
Alternatively you can install operator using Helm Chart located in the
100112
`charts/ext-postgres-operator` subdirectory. Sample installation commands provided below:
101113

102114
```
103115
helm repo add ext-postgres-operator https://movetokube.github.io/postgres-operator/
104-
helm install -n operators ext-postgres-operator ext-postgres-operator/ext-postgres-operator
116+
helm install -n operators ext-postgres-operator ext-postgres-operator/ext-postgres-operator
105117
```
106118
See [values.yaml](charts/ext-postgres-operator/values.yaml) for the possible values to define.
107119

108-
## CRs
120+
## Custom Resources (CRs)
109121

110122
### Postgres
111123

@@ -117,7 +129,7 @@ metadata:
117129
namespace: app
118130
annotations:
119131
# OPTIONAL
120-
# use this to target which instance of operator should process this CR. See General config
132+
# use this to target which instance of operator should process this CR. See General config
121133
postgres.db.movetokube.com/instance: POSTGRES_INSTANCE
122134
spec:
123135
database: test-db # Name of database created in PostgreSQL
@@ -177,19 +189,18 @@ Every PostgresUser has a generated Kubernetes secret attached to it, which conta
177189
| `POSTGRES_JDBC_URL` | JDBC compatible Postgres URI, formatter as `jdbc:postgresql://{POSTGRES_HOST}/{DATABASE_NAME}` |
178190

179191
### Multiple operator support
180-
Since version 1.2 it is possible to use many instances of postgres-operator to control different databases based on annotations in CRs.
181-
Follow the steps below to enable multi-operator support.
182-
1. Add POSTGRES_INSTANCE
192+
193+
Run multiple operator instances by setting unique POSTGRES_INSTANCE values and using annotations in your CRs to assign them.
183194

184195
#### Annotations Use Case
185196

186197
With the help of annotations it is possible to create annotation-based copies of secrets in other namespaces.
187198

188199
For more information and an example, see [kubernetes-replicator#pull-based-replication](https://github.com/mittwald/kubernetes-replicator#pull-based-replication)
189200

190-
#### Template Use Case
201+
### Secret Templating
191202

192-
Users can specify the structure and content of secrets based on their unique requirements using standard
203+
Users can specify the structure and content of secrets based on their unique requirements using standard
193204
[Go templates](https://pkg.go.dev/text/template#hdr-Actions). This flexibility allows for a more tailored approach to
194205
meeting the specific needs of different applications.
195206

@@ -202,23 +213,6 @@ Available context:
202213
| `.Database` | Referenced database name |
203214
| `.Password` | Generated role password |
204215

205-
### Contribution
206-
207-
You can contribute to this project by opening a PR to merge to `master`, or one of the `vX.X.X` branches.
208-
209-
#### Branching
210-
211-
`master` branch contains the latest source code with all the features. `vX.X.X` contains code for the specific major versions.
212-
i.e. `v0.4.x` contains the latest code for 0.4 version of the operator. See compatibility matrix below.
213-
214-
#### Tests
215-
216-
Please write tests and fix any broken tests before you open a PR. Tests should cover at least 80% of your code.
217-
218-
#### e2e-tests
219-
220-
End-to-end tests are implemented using [kuttl](https://kuttl.dev/), a Kubernetes test framework. To execute these tests locally, first install kuttl on your system, then run the command `make e2e` from the project root directory.
221-
222216
### Compatibility
223217

224218
Postgres operator uses Operator SDK, which uses kubernetes client. Kubernetes client compatibility with Kubernetes cluster
@@ -230,4 +224,14 @@ Postgres operator compatibility with Operator SDK version is in the table below
230224
|---------------------------|----------------------|----------------------|
231225
| `postgres-operator 0.4.x` | v0.17 | v1beta1 |
232226
| `postgres-operator 1.x.x` | v0.18 | v1 |
233-
| `HEAD` | v0.18 | v1 |
227+
| `postgres-operator 2.x.x` | v1.39 | v1 |
228+
| `HEAD` | v1.39 | v1 |
229+
230+
231+
## Contributing
232+
233+
See [CONTRIBUTING.md](CONTRIBUTING.md)
234+
235+
## License
236+
237+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)