Skip to content

Commit 9dc1a22

Browse files
author
Yannic Nevado Hidalgo
committed
add comments to manifest files for postgres operator
1 parent 50125aa commit 9dc1a22

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

manifests/minimal-postgres-manifest.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,63 @@
1+
# custom api from zalando
2+
# https://github.com/zalando/postgres-operator/tree/master/pkg/apis/acid.zalan.do/v1
13
apiVersion: "acid.zalan.do/v1"
4+
# custom api object postgresql
5+
# https://github.com/zalando/postgres-operator/blob/master/pkg/apis/acid.zalan.do/v1/postgresql_type.go
26
kind: postgresql
37
metadata:
8+
# name of the pod
9+
# podtemplate is statefulset -> every instance has the same name with own ordinalindex
410
name: acid-minimal-cluster
11+
# namespace in k82 where the pods will be created
512
namespace: zalando-postgres
613
spec:
14+
# required parameter from patroni
715
teamId: "ACID"
16+
# size and accessmode(=defined in storageclass) for persistent volume claim
817
volume:
918
size: 1Gi
1019
storageClass: standard
20+
# number of pods
21+
# 1 is master, others replicas
1122
numberOfInstances: 3
23+
# define some users with access rights
1224
users:
1325
zalando: # database owner
1426
- superuser
1527
- createdb
1628
foo_user: [] # role for application foo
29+
# define some database with its owner
1730
databases:
1831
foo: zalando # dbname: owner
1932
test: zalando
33+
# needed for shared_memory, in docker default=64mb
2034
enableShmVolume: true
2135
postgresql:
2236
version: "11"
37+
# parameters for postgresql.conf
38+
# can be edited after kubectl apply for example and restart spilo service
2339
parameters:
2440
shared_buffers: "128MB"
2541
max_connections: "10"
2642
log_statement: "all"
2743
log_destination: "stderr"
2844
log_directory: "/var/log/postgresql"
45+
# define the minimum and limit of resources of an postgres database container
2946
resources:
3047
requests:
3148
cpu: 15m
3249
memory: 150Mi
3350
limits:
3451
cpu: 300m
3552
memory: 275Mi
53+
# parameters for initializing database
3654
patroni:
3755
initdb:
3856
encoding: "UTF8"
3957
locale: "en_US.UTF-8"
4058
data-checksums: "true"
4159
auth-host: "scram-sha-256"
60+
# entries for host-based access file in postgres
4261
pg_hba:
4362
- hostssl all all 0.0.0.0/0 scram-sha-256
4463
- host all all 0.0.0.0/0 scram-sha-256

manifests/operator-service-account-rbac.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
# custom k8s ressource ServiceAccount
12
apiVersion: v1
23
kind: ServiceAccount
34
metadata:
45
name: zalando-postgres-operator
56
namespace: zalando-postgres
67

78
---
9+
# define ClusterRole for postgres-operator deployment
10+
# on which apis and resources can the operator execute which operations
811
apiVersion: rbac.authorization.k8s.io/v1beta1
912
kind: ClusterRole
1013
metadata:
@@ -161,14 +164,18 @@ rules:
161164
- patch
162165
- update
163166
---
167+
# bin clusterrole and serviceaccount from postgres-operator
168+
# custom k8s ressource
164169
apiVersion: rbac.authorization.k8s.io/v1
165170
kind: ClusterRoleBinding
166171
metadata:
167172
name: zalando-postgres-operator
173+
# reference definied ClusterRole for postgres-operator
168174
roleRef:
169175
apiGroup: rbac.authorization.k8s.io
170176
kind: ClusterRole
171177
name: zalando-postgres-operator
178+
# bin ti specified ServiceAccount
172179
subjects:
173180
- kind: ServiceAccount
174181
# note: the cluster role binding needs to be defined

manifests/postgres-operator.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,42 @@
1+
# custom k8s ressource Deployment
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
45
name: postgres-operator
56
spec:
7+
# number of replicas for postgres-operator
68
replicas: 1
9+
# specification is for evervy replica with the definied selectors
710
selector:
811
matchLabels:
912
name: postgres-operator
1013
template:
1114
metadata:
15+
# set labels for every postgres-operator replica
1216
labels:
1317
name: postgres-operator
1418
spec:
19+
# bin ServiceAccount with definied ClusterRole to every replica
1520
serviceAccountName: zalando-postgres-operator
21+
# every postgres-operator Deployment Pod contains one container
1622
containers:
1723
- name: postgres-operator
1824
image: registry.opensource.zalan.do/acid/postgres-operator:v1.2.0
1925
imagePullPolicy: IfNotPresent
26+
# set requested and limited resources for the container
2027
resources:
2128
requests:
2229
cpu: 500m
2330
memory: 250Mi
2431
limits:
2532
cpu: 2000m
2633
memory: 500Mi
34+
# define at which user the postgres-operator container will run
2735
securityContext:
2836
runAsUser: 1000
2937
runAsNonRoot: true
3038
readOnlyRootFilesystem: true
39+
# set some environment variables defined in "before" created ConfigMap with the name postgres-operator
3140
env:
3241
# provided additional ENV vars can overwrite individual config map entries
3342
- name: CONFIG_MAP_NAME

0 commit comments

Comments
 (0)