forked from AOT-Technologies/forms-flow-ai-deployment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patroni-deployment-prereq.yaml
140 lines (140 loc) · 3.32 KB
/
patroni-deployment-prereq.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
apiVersion: template.openshift.io/v1
kind: Template
metadata:
annotations:
description: |-
Patroni Postgresql database cluster (pre-requisites)
iconClass: icon-postgresql
openshift.io/display-name: Patroni Postgresql pre-requisites
openshift.io/long-description: This template deploys patroni pre-requisites for an HA DB (secret, service account, role)
tags: postgresql
name: patroni-pgsql-pre-requisite
labels:
app.kubernetes.io/component: database
app.kubernetes.io/name: patroni
app.kubernetes.io/managed-by: template
objects:
- apiVersion: v1
kind: Secret
metadata:
labels:
app: ${NAME}${SUFFIX}
cluster-name: ${NAME}${SUFFIX}
annotations:
as-copy-of: "template.${NAME}-patroni"
name: ${NAME}${SUFFIX}
stringData:
replication-username: ${PATRONI_REPLICATION_USERNAME}
replication-password: ${PATRONI_REPLICATION_PASSWORD}
superuser-username: ${PATRONI_SUPERUSER_USERNAME}
superuser-password: ${PATRONI_SUPERUSER_PASSWORD}
app-db-name: ${APP_DB_NAME}
app-db-username: ${APP_DB_USERNAME}
app-db-password: ${APP_DB_PASSWORD}
- apiVersion: v1
kind: ServiceAccount
metadata:
labels:
cluster-name: ${NAME}${SUFFIX}
name: ${NAME}${SUFFIX}
- apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
cluster-name: ${NAME}${SUFFIX}
name: ${NAME}${SUFFIX}
rules:
- apiGroups:
- ""
resources:
- services
verbs:
- create
- get
- list
- patch
- update
- watch
- delete
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- get
- list
- patch
- update
- watch
- delete
- apiGroups:
- ""
resources:
- endpoints
verbs:
- get
- patch
- update
- create
- list
- watch
- delete
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
- patch
- update
- watch
- apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
cluster-name: ${NAME}${SUFFIX}
name: ${NAME}${SUFFIX}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ${NAME}${SUFFIX}
subjects:
- kind: ServiceAccount
name: ${NAME}${SUFFIX}
parameters:
- description: The name of the application for labelling all artifacts.
displayName: Application Name
name: NAME
value: patroni
- name: SUFFIX
- description: Username of the superuser account for initialization.
displayName: Superuser Username
name: PATRONI_SUPERUSER_USERNAME
value: postgres
# generate: expression
# from: super-[a-zA-Z0-9]{6}
- description: Password of the superuser account for initialization.
displayName: Superuser Passsword
name: PATRONI_SUPERUSER_PASSWORD
generate: expression
from: '[a-zA-Z0-9]{32}'
- description: Username of the replication account for initialization.
displayName: Replication Username
name: PATRONI_REPLICATION_USERNAME
value: replication
# generate: expression
# from: rep-[a-zA-Z0-9]{6}
- description: Password of the replication account for initialization.
displayName: Repication Passsword
name: PATRONI_REPLICATION_PASSWORD
generate: expression
from: '[a-zA-Z0-9]{32}'
- name: APP_DB_USERNAME
value: app
- name: APP_DB_NAME
value: app
- name: APP_DB_PASSWORD
generate: expression
from: '[a-zA-Z0-9]{32}'