Skip to content

Commit 2bb3bde

Browse files
committed
Slimming out README and config map, targeting easy first time deployers to minicube.
1 parent 4c8dfd7 commit 2bb3bde

File tree

3 files changed

+47
-54
lines changed

3 files changed

+47
-54
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66

77
The Postgres operator manages PostgreSQL clusters on Kubernetes using the [operator pattern](https://coreos.com/blog/introducing-operators.html).
88
During the initial run it registers the [Custom Resource Definition (CRD)](https://kubernetes.io/docs/concepts/api-extension/custom-resources/#customresourcedefinitions) for Postgres.
9-
The PostgreSQL CRD is essentially the schema that describes the contents of the manifests for deploying individual
10-
PostgreSQL clusters using StatefulSets and [Patroni](https://github.com/zalando/patroni).
9+
The `postgresql` CRD is essentially the schema that describes the contents of the manifests for deploying individual
10+
Postgres clusters using StatefulSets and [Patroni](https://github.com/zalando/patroni).
1111

1212
Once the operator is running, it performs the following actions:
1313

14-
* watches for new PostgreSQL cluster manifests and deploys corresponding clusters
14+
* watches for new `postgresql` manifests and deploys new clusters
1515
* watches for updates to existing manifests and changes corresponding properties of the running clusters
1616
* watches for deletes of the existing manifests and deletes corresponding clusters
17-
* acts on an update to the operator definition itself and changes the running clusters when necessary
18-
(i.e. when the docker image inside the operator definition has been updated)
19-
* periodically checks running clusters against the manifests and acts on the differences found
17+
* acts on an update to the operator configuration itself and changes the running clusters when necessary
18+
(i.e. the Docker image changes for a minor release update)
19+
* periodically checks running clusters against the manifests and syncs changes
2020

21-
For instance, when the user creates a new custom object of type ``postgresql`` by submitting a new manifest with
22-
``kubectl``, the operator fetches that object and creates the corresponding Kubernetes structures
23-
(StatefulSets, Services, Secrets) according to its definition.
21+
Example: When a user creates a new custom object of type ``postgresql`` by submitting a new manifest with
22+
``kubectl``, the operator fetches that object and creates the required Kubernetes entities to spawn a new Postgres cluster
23+
(StatefulSets, Services, Secrets).
2424

25-
Another example is changing the docker image inside the operator. In this case, the operator first goes to all StatefulSets
26-
it manages and updates them with the new docker images; afterwards, all pods from each StatefulSet are killed one by one
27-
(rolling upgrade) and the replacements are spawned automatically by each StatefulSet with the new docker image.
25+
Update example: After changing the Docker image inside the operator's configuration, the operator first goes to all StatefulSets
26+
it manages and updates them with the new Docker image; afterwards, all pods from each StatefulSet are killed one by one
27+
and the replacements are spawned automatically by each StatefulSet with the new Docker image. This is called the rolling upgrade.
2828

2929
## Scope
3030

@@ -147,9 +147,9 @@ We can use the generated secret of the `postgres` robot user to connect to our `
147147
The `manifests/operator-rbac.yaml` defines cluster roles and bindings needed for the operator to function under access control restrictions. To deploy the operator with this RBAC policy use:
148148

149149
```bash
150-
kubectl create -f manifests/configmap.yaml
150+
kubectl create -f manifests/configmap.yaml
151151
kubectl create -f manifests/operator-rbac.yaml
152-
kubectl create -f manifests/postgres-operator.yaml
152+
kubectl create -f manifests/postgres-operator.yaml
153153
kubectl create -f manifests/minimal-postgres-manifest.yaml
154154
```
155155

@@ -158,7 +158,7 @@ the `operator` default that is created in the `serviceaccount.yaml`. So you will
158158

159159
This is done intentionally, as to avoid breaking those setups that
160160
already work with the default `operator` account. In the future the operator should ideally be run under the
161-
`zalando-postgres-operator` service account.
161+
`zalando-postgres-operator` service account.
162162

163163
The service account defined in `operator-rbac.yaml` acquires some privileges not really
164164
used by the operator (i.e. we only need list and watch on configmaps),
@@ -274,7 +274,7 @@ As a preventive measure, one can restrict the minimum and the maximum number of
274274
If either `min_instances` or `max_instances` is set to a non-zero value, the operator may adjust the number of instances specified in the cluster manifest to match either the min or the max boundary.
275275
For instance, of a cluster manifest has 1 instance and the min_instances is set to 3, the cluster will be created with 3 instances. By default, both parameters are set to -1.
276276
277-
### Load balancers
277+
### Load balancers
278278
279279
For any Postgresql/Spilo cluster an operator creates two separate k8s services: one for the master pod and one for replica pods. To expose these services to an outer network, one can attach load balancers to them by setting `enableMasterLoadBalancer` and/or `enableReplicaLoadBalancer` to `true` in the cluster manifest. In the case any of these variables is omitted from the manifest, the operator configmap's settings `enable_master_load_balancer` and `enable_replica_load_balancer` apply. Note that the operator settings affect all Postgresql services running in a namespace watched by the operator.
280280

manifests/configmap.yaml

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,43 @@ apiVersion: v1
22
kind: ConfigMap
33
metadata:
44
name: postgres-operator
5-
data:
6-
# the env var with the same name in the operator pod may overwrite this value
7-
# if neither is set or evaluates to the empty string, listen to the operator's own namespace
5+
data:
86
# if set to the "*", listen to all namespaces
97
# watched_namespace: development
108
cluster_labels: application:spilo
119
cluster_name_label: version
1210
pod_role_label: spilo-role
13-
db_hosted_zone: db.example.com
11+
1412
debug_logging: "true"
15-
master_dns_name_format: '{cluster}.{team}.staging.{hostedzone}'
16-
replica_dns_name_format: '{cluster}-repl.{team}.staging.{hostedzone}'
13+
workers: "4"
1714
docker_image: registry.opensource.zalan.do/acid/demospilo-10:1.3-p3
1815
secret_name_template: '{username}.{cluster}.credentials'
19-
etcd_host: ""
20-
infrastructure_roles_secret_name: postgresql-infrastructure-roles
21-
oauth_token_secret_name: postgresql-operator
22-
pam_configuration: |
23-
https://info.example.com/oauth2/tokeninfo?access_token= uid realm=/employees
24-
pam_role_name: zalandos
16+
# etcd_host: ""
17+
super_username: postgres
18+
enable_teams_api: "false"
19+
# enable_team_superuser: "false"
20+
# team_admin_role: "admin"
21+
# teams_api_url: http://fake-teams-api.default.svc.cluster.local
22+
# team_api_role_configuration: "log_statement:all"
23+
# infrastructure_roles_secret_name: postgresql-infrastructure-roles
24+
# oauth_token_secret_name: postgresql-operator
25+
# pam_role_name: zalandos
26+
# pam_configuration: |
27+
# https://info.example.com/oauth2/tokeninfo?access_token= uid realm=/employees
28+
db_hosted_zone: db.example.com
29+
master_dns_name_format: '{cluster}.{team}.staging.{hostedzone}'
30+
replica_dns_name_format: '{cluster}-repl.{team}.staging.{hostedzone}'
31+
enable_master_load_balancer: "false"
32+
enable_replica_load_balancer: "false"
33+
34+
pdb_name_format: "postgres-{cluster}-pdb"
35+
node_eol_label: "lifecycle-status:pending-decommission"
36+
node_readiness_label: ""
37+
38+
api_port: "8080"
39+
ring_log_lines: "100"
40+
cluster_history_entries: "1000"
41+
pod_terminate_grace_period: 5m
2542
pod_deletion_wait_timeout: 10m
2643
pod_label_wait_timeout: 10m
2744
ready_wait_interval: 3s
@@ -30,21 +47,3 @@ data:
3047
resource_check_interval: 3s
3148
resource_check_timeout: 10m
3249
resync_period: 5m
33-
super_username: postgres
34-
enable_teams_api: "false"
35-
enable_team_superuser: "false"
36-
team_admin_role: "admin"
37-
teams_api_url: http://fake-teams-api.default.svc.cluster.local
38-
workers: "4"
39-
# turn on/off load balancers for all Postgres clusters managed by the operator
40-
# LB settings in cluster manifests take priority over these settings
41-
enable_master_load_balancer: "true"
42-
enable_replica_load_balancer: "false"
43-
api_port: "8080"
44-
ring_log_lines: "100"
45-
cluster_history_entries: "1000"
46-
pod_terminate_grace_period: 5m
47-
pdb_name_format: "postgres-{cluster}-pdb"
48-
node_eol_label: "lifecycle-status:pending-decommission"
49-
node_readiness_label: ""
50-
team_api_role_configuration: "log_statement:all"

manifests/postgres-operator.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@ spec:
1212
serviceAccountName: operator
1313
containers:
1414
- name: postgres-operator
15-
image: registry.opensource.zalan.do/acid/postgres-operator:0f392c2
15+
image: registry.opensource.zalan.do/acid/postgres-operator:4c8dfd7
1616
imagePullPolicy: IfNotPresent
1717
env:
18-
# uncomment to overwrite a similar setting from operator configmap
19-
# if set to the empty string, watch the operator's own namespace
20-
# if set to the "*", listen to all namespaces
21-
# - name: WATCHED_NAMESPACE
22-
# valueFrom:
23-
# fieldRef:
24-
# fieldPath: metadata.namespace
18+
# provided additional ENV vars can overwrite individual config map entries
2519
- name: CONFIG_MAP_NAME
2620
value: "postgres-operator"

0 commit comments

Comments
 (0)