forked from bcgov/hets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostgresql-deploy-config.yaml
188 lines (188 loc) · 5.49 KB
/
postgresql-deploy-config.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
kind: Template
apiVersion: v1
metadata:
name: ${PROJECT_NAME}
objects:
- apiVersion: v1
kind: DeploymentConfig
metadata:
name: ${NAME}-${ENV}
labels:
shared: "true"
spec:
replicas: 1
selector:
deploymentconfig: ${NAME}-${ENV}
strategy:
activeDeadlineSeconds: 21600
resources: {}
type: Recreate
recreateParams:
timeoutSeconds: 600
template:
metadata:
name: ${NAME}-${ENV}
labels:
deploymentconfig: ${NAME}-${ENV}
spec:
containers:
- image: image-registry.openshift-image-registry.svc:5000/e0cee6-tools/${IMAGE_STREAM_TAG}
imagePullPolicy: IfNotPresent
name: ${NAME}-${ENV}
env:
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
name: ${NAME}-${ENV}
key: database-user
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ENV}
key: database-password
- name: POSTGRESQL_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ENV}
key: admin-password
- name: POSTGRESQL_DATABASE
value: ${POSTGRESQL_DATABASE_NAME}
ports:
- containerPort: 5432
protocol: TCP
resources:
requests:
cpu: ${CPU}
memory: ${MEMORY}
limits:
cpu: ${CPU}
memory: ${MEMORY}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- name: "${NAME}-${ENV}-data"
mountPath: "/var/lib/pgsql/data"
livenessProbe:
tcpSocket:
port: 5432
initialDelaySeconds: 30
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
readinessProbe:
exec:
command:
- "/bin/sh"
- "-i"
- "-c"
- psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c
'SELECT 1'
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: "${NAME}-${ENV}-data"
persistentVolumeClaim:
claimName: ${NAME}-${ENV}-pvc
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- ${NAME}-${ENV}
from:
kind: ImageStreamTag
name: ${IMAGE_STREAM_TAG}
namespace: e0cee6-tools
type: ImageChange
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: ${NAME}-${ENV}-pvc
labels:
shared: "true"
spec:
storageClassName: "${PERSISTENT_VOLUME_CLASS}"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "${PERSISTENT_VOLUME_SIZE}"
- kind: Service
apiVersion: v1
metadata:
name: ${NAME}-${ENV}
labels:
shared: "true"
spec:
ports:
- name: postgresql
protocol: TCP
port: 5432
targetPort: 5432
selector:
deploymentconfig: ${NAME}-${ENV}
parameters:
- description: Name of the project (HETS)
displayName: PROJECT_NAME
name: PROJECT_NAME
required: true
value: "het"
- name: NAME
displayName: Name
description: The name assigned to all of the OpenShift resources associated to the PostgreSQL instance.
required: true
value: db
- description: A name suffix used for all objects
displayName: Suffix
name: SUFFIX
required: false
value: "-dev"
- description: Environment short name (dev,test,uat,prod)
displayName: ENV
name: ENV
required: false
value: "dev"
- description: A version used for the image tags
displayName: version
name: VERSION
required: true
value: "v1.0.0"
- description: ImageStreamTag
displayName: ImageStreamTag
name: IMAGE_STREAM_TAG
value: "postgresql-10-rhel8:1"
- name: POSTGRESQL_DATABASE_NAME
displayName: PostgreSQL Database Name
description: The name of the PostgreSQL database.
required: true
value: schoolbus
- name: PERSISTENT_VOLUME_SIZE
displayName: Persistent Volume Size
description: The size of the persistent volume , e.g. 512Mi, 1Gi, 2Gi.
required: true
value: 5Gi
- name: PERSISTENT_VOLUME_CLASS
displayName: Persistent Volume Class name
description: The class of the volume; netapp-file-standard, netapp-file-block
required: false
value: netapp-file-standard
- description: CPU
displayName: CPU Request
name: CPU
required: true
value: ""
- description: MEMORY
displayName: MEMORY Request
name: MEMORY
required: true
value: ""