Skip to content

Commit ccdcb66

Browse files
pvalenapkubatrh
authored andcommitted
Add templates from openshift/origin. (sclorg#188)
* Add templates from openshift/origin. * Update common commit. * Add symlink to test-lib-openshift.sh in test dir
1 parent b4ef66f commit ccdcb66

File tree

4 files changed

+532
-1
lines changed

4 files changed

+532
-1
lines changed
+253
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
{
2+
"kind": "Template",
3+
"apiVersion": "v1",
4+
"metadata": {
5+
"name": "postgresql-ephemeral",
6+
"annotations": {
7+
"openshift.io/display-name": "PostgreSQL (Ephemeral)",
8+
"description": "PostgreSQL database service, without persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/blob/master/9.5.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
9+
"iconClass": "icon-postgresql",
10+
"tags": "database,postgresql",
11+
"template.openshift.io/long-description": "This template provides a standalone PostgreSQL server with a database created. The database is not stored on persistent storage, so any restart of the service will result in all data being lost. The database name, username, and password are chosen via parameters when provisioning this service.",
12+
"template.openshift.io/provider-display-name": "Red Hat, Inc.",
13+
"template.openshift.io/documentation-url": "https://docs.openshift.org/latest/using_images/db_images/postgresql.html",
14+
"template.openshift.io/support-url": "https://access.redhat.com"
15+
}
16+
},
17+
"message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n Username: ${POSTGRESQL_USER}\n Password: ${POSTGRESQL_PASSWORD}\n Database Name: ${POSTGRESQL_DATABASE}\n Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/blob/master/9.5.",
18+
"labels": {
19+
"template": "postgresql-ephemeral-template"
20+
},
21+
"objects": [
22+
{
23+
"kind": "Secret",
24+
"apiVersion": "v1",
25+
"metadata": {
26+
"name": "${DATABASE_SERVICE_NAME}",
27+
"annotations": {
28+
"template.openshift.io/expose-username": "{.data['database-user']}",
29+
"template.openshift.io/expose-password": "{.data['database-password']}",
30+
"template.openshift.io/expose-database_name": "{.data['database-name']}"
31+
}
32+
},
33+
"stringData" : {
34+
"database-user" : "${POSTGRESQL_USER}",
35+
"database-password" : "${POSTGRESQL_PASSWORD}",
36+
"database-name" : "${POSTGRESQL_DATABASE}"
37+
}
38+
},
39+
{
40+
"kind": "Service",
41+
"apiVersion": "v1",
42+
"metadata": {
43+
"name": "${DATABASE_SERVICE_NAME}",
44+
"annotations": {
45+
"template.openshift.io/expose-uri": "postgres://{.spec.clusterIP}:{.spec.ports[?(.name==\"postgresql\")].port}"
46+
}
47+
},
48+
"spec": {
49+
"ports": [
50+
{
51+
"name": "postgresql",
52+
"protocol": "TCP",
53+
"port": 5432,
54+
"targetPort": 5432,
55+
"nodePort": 0
56+
}
57+
],
58+
"selector": {
59+
"name": "${DATABASE_SERVICE_NAME}"
60+
},
61+
"type": "ClusterIP",
62+
"sessionAffinity": "None"
63+
},
64+
"status": {
65+
"loadBalancer": {}
66+
}
67+
},
68+
{
69+
"kind": "DeploymentConfig",
70+
"apiVersion": "v1",
71+
"metadata": {
72+
"name": "${DATABASE_SERVICE_NAME}",
73+
"annotations": {
74+
"template.alpha.openshift.io/wait-for-ready": "true"
75+
}
76+
},
77+
"spec": {
78+
"strategy": {
79+
"type": "Recreate"
80+
},
81+
"triggers": [
82+
{
83+
"type": "ImageChange",
84+
"imageChangeParams": {
85+
"automatic": true,
86+
"containerNames": [
87+
"postgresql"
88+
],
89+
"from": {
90+
"kind": "ImageStreamTag",
91+
"name": "postgresql:${POSTGRESQL_VERSION}",
92+
"namespace": "${NAMESPACE}"
93+
},
94+
"lastTriggeredImage": ""
95+
}
96+
},
97+
{
98+
"type": "ConfigChange"
99+
}
100+
],
101+
"replicas": 1,
102+
"selector": {
103+
"name": "${DATABASE_SERVICE_NAME}"
104+
},
105+
"template": {
106+
"metadata": {
107+
"labels": {
108+
"name": "${DATABASE_SERVICE_NAME}"
109+
}
110+
},
111+
"spec": {
112+
"containers": [
113+
{
114+
"name": "postgresql",
115+
"image": " ",
116+
"ports": [
117+
{
118+
"containerPort": 5432,
119+
"protocol": "TCP"
120+
}
121+
],
122+
"readinessProbe": {
123+
"timeoutSeconds": 1,
124+
"initialDelaySeconds": 5,
125+
"exec": {
126+
"command": [ "/bin/sh", "-i", "-c", "psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c 'SELECT 1'"]
127+
}
128+
},
129+
"livenessProbe": {
130+
"timeoutSeconds": 1,
131+
"initialDelaySeconds": 30,
132+
"tcpSocket": {
133+
"port": 5432
134+
}
135+
},
136+
"env": [
137+
{
138+
"name": "POSTGRESQL_USER",
139+
"valueFrom": {
140+
"secretKeyRef" : {
141+
"name" : "${DATABASE_SERVICE_NAME}",
142+
"key" : "database-user"
143+
}
144+
}
145+
},
146+
{
147+
"name": "POSTGRESQL_PASSWORD",
148+
"valueFrom": {
149+
"secretKeyRef" : {
150+
"name" : "${DATABASE_SERVICE_NAME}",
151+
"key" : "database-password"
152+
}
153+
}
154+
},
155+
{
156+
"name": "POSTGRESQL_DATABASE",
157+
"valueFrom": {
158+
"secretKeyRef" : {
159+
"name" : "${DATABASE_SERVICE_NAME}",
160+
"key" : "database-name"
161+
}
162+
}
163+
}
164+
],
165+
"resources": {
166+
"limits": {
167+
"memory": "${MEMORY_LIMIT}"
168+
}
169+
},
170+
"volumeMounts": [
171+
{
172+
"name": "${DATABASE_SERVICE_NAME}-data",
173+
"mountPath": "/var/lib/pgsql/data"
174+
}
175+
],
176+
"terminationMessagePath": "/dev/termination-log",
177+
"imagePullPolicy": "IfNotPresent",
178+
"capabilities": {},
179+
"securityContext": {
180+
"capabilities": {},
181+
"privileged": false
182+
}
183+
}
184+
],
185+
"volumes": [
186+
{
187+
"name": "${DATABASE_SERVICE_NAME}-data",
188+
"emptyDir": {
189+
"medium": ""
190+
}
191+
}
192+
],
193+
"restartPolicy": "Always",
194+
"dnsPolicy": "ClusterFirst"
195+
}
196+
}
197+
},
198+
"status": {}
199+
}
200+
],
201+
"parameters": [
202+
{
203+
"name": "MEMORY_LIMIT",
204+
"displayName": "Memory Limit",
205+
"description": "Maximum amount of memory the container can use.",
206+
"value": "512Mi",
207+
"required": true
208+
},
209+
{
210+
"name": "NAMESPACE",
211+
"displayName": "Namespace",
212+
"description": "The OpenShift Namespace where the ImageStream resides.",
213+
"value": "openshift"
214+
},
215+
{
216+
"name": "DATABASE_SERVICE_NAME",
217+
"displayName": "Database Service Name",
218+
"description": "The name of the OpenShift Service exposed for the database.",
219+
"value": "postgresql",
220+
"required": true
221+
},
222+
{
223+
"name": "POSTGRESQL_USER",
224+
"displayName": "PostgreSQL Connection Username",
225+
"description": "Username for PostgreSQL user that will be used for accessing the database.",
226+
"generate": "expression",
227+
"from": "user[A-Z0-9]{3}",
228+
"required": true
229+
},
230+
{
231+
"name": "POSTGRESQL_PASSWORD",
232+
"displayName": "PostgreSQL Connection Password",
233+
"description": "Password for the PostgreSQL connection user.",
234+
"generate": "expression",
235+
"from": "[a-zA-Z0-9]{16}",
236+
"required": true
237+
},
238+
{
239+
"name": "POSTGRESQL_DATABASE",
240+
"displayName": "PostgreSQL Database Name",
241+
"description": "Name of the PostgreSQL database accessed.",
242+
"value": "sampledb",
243+
"required": true
244+
},
245+
{
246+
"name": "POSTGRESQL_VERSION",
247+
"displayName": "Version of PostgreSQL Image",
248+
"description": "Version of PostgreSQL image to be used (9.2, 9.4, 9.5 or latest).",
249+
"value": "9.5",
250+
"required": true
251+
}
252+
]
253+
}

0 commit comments

Comments
 (0)