Browse code

Add persistent volume claims to database example templates

Also add mandatory MONGODB_ADMIN_PASSWORD and make descriptions better.

Martin Nagy authored on 2015/06/02 01:27:55
Showing 10 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,159 @@
0
+{
1
+  "kind": "Template",
2
+  "apiVersion": "v1beta3",
3
+  "metadata": {
4
+    "name": "mongodb-ephemeral",
5
+    "creationTimestamp": null,
6
+    "annotations": {
7
+      "description": "MongoDB database service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
8
+      "iconClass": "icon-mongodb",
9
+      "tags": "database,mongodb"
10
+    }
11
+  },
12
+  "objects": [
13
+    {
14
+      "kind": "Service",
15
+      "apiVersion": "v1beta3",
16
+      "metadata": {
17
+        "name": "mongodb",
18
+        "creationTimestamp": null
19
+      },
20
+      "spec": {
21
+        "ports": [
22
+          {
23
+            "name": "mongo",
24
+            "protocol": "TCP",
25
+            "port": 27017,
26
+            "targetPort": 27017,
27
+            "nodePort": 0
28
+          }
29
+        ],
30
+        "selector": {
31
+          "name": "mongodb"
32
+        },
33
+        "portalIP": "",
34
+        "type": "ClusterIP",
35
+        "sessionAffinity": "None"
36
+      },
37
+      "status": {
38
+        "loadBalancer": {}
39
+      }
40
+    },
41
+    {
42
+      "kind": "DeploymentConfig",
43
+      "apiVersion": "v1beta3",
44
+      "metadata": {
45
+        "name": "mongodb",
46
+        "creationTimestamp": null
47
+      },
48
+      "spec": {
49
+        "strategy": {
50
+          "type": "Recreate",
51
+          "resources": {}
52
+        },
53
+        "triggers": [
54
+          {
55
+            "type": "ImageChange",
56
+            "imageChangeParams": {
57
+              "automatic": true,
58
+              "containerNames": [
59
+                "mongodb"
60
+              ],
61
+              "from": {
62
+                "kind": "ImageStreamTag",
63
+                "name": "mongodb:latest"
64
+              },
65
+              "lastTriggeredImage": ""
66
+            }
67
+          },
68
+          {
69
+            "type": "ConfigChange"
70
+          }
71
+        ],
72
+        "replicas": 1,
73
+        "selector": {
74
+          "name": "mongodb"
75
+        },
76
+        "template": {
77
+          "metadata": {
78
+            "creationTimestamp": null,
79
+            "labels": {
80
+              "name": "mongodb"
81
+            }
82
+          },
83
+          "spec": {
84
+            "containers": [
85
+              {
86
+                "name": "mongodb",
87
+                "image": "mongodb",
88
+                "ports": [
89
+                  {
90
+                    "containerPort": 27017,
91
+                    "protocol": "TCP"
92
+                  }
93
+                ],
94
+                "env": [
95
+                  {
96
+                    "name": "MONGODB_USER",
97
+                    "value": "${MONGODB_USER}"
98
+                  },
99
+                  {
100
+                    "name": "MONGODB_PASSWORD",
101
+                    "value": "${MONGODB_PASSWORD}"
102
+                  },
103
+                  {
104
+                    "name": "MONGODB_DATABASE",
105
+                    "value": "${MONGODB_DATABASE}"
106
+                  },
107
+                  {
108
+                    "name": "MONGODB_ADMIN_PASSWORD",
109
+                    "value": "${MONGODB_ADMIN_PASSWORD}"
110
+                  }
111
+                ],
112
+                "resources": {},
113
+                "terminationMessagePath": "/dev/termination-log",
114
+                "imagePullPolicy": "IfNotPresent",
115
+                "capabilities": {},
116
+                "securityContext": {
117
+                  "capabilities": {},
118
+                  "privileged": false
119
+                }
120
+              }
121
+            ],
122
+            "restartPolicy": "Always",
123
+            "dnsPolicy": "ClusterFirst"
124
+          }
125
+        }
126
+      },
127
+      "status": {}
128
+    }
129
+  ],
130
+  "parameters": [
131
+    {
132
+      "name": "MONGODB_USER",
133
+      "description": "Username for MongoDB user that will be used for accessing the database",
134
+      "generate": "expression",
135
+      "from": "user[A-Z0-9]{3}"
136
+    },
137
+    {
138
+      "name": "MONGODB_PASSWORD",
139
+      "description": "Password for the MongoDB user",
140
+      "generate": "expression",
141
+      "from": "[a-zA-Z0-9]{16}"
142
+    },
143
+    {
144
+      "name": "MONGODB_DATABASE",
145
+      "description": "Database name",
146
+      "value": "sampledb"
147
+    },
148
+    {
149
+      "name": "MONGODB_ADMIN_PASSWORD",
150
+      "description": "Password for the database admin user",
151
+      "generate": "expression",
152
+      "from": "[a-zA-Z0-9]{16}"
153
+    }
154
+  ],
155
+  "labels": {
156
+    "template": "mongodb-ephemeral-template"
157
+  }
158
+}
0 159
new file mode 100644
... ...
@@ -0,0 +1,195 @@
0
+{
1
+  "kind": "Template",
2
+  "apiVersion": "v1beta3",
3
+  "metadata": {
4
+    "name": "mongodb-persistent",
5
+    "creationTimestamp": null,
6
+    "annotations": {
7
+      "description": "MongoDB database service, with persistent storage. Scaling to more than one replica is not supported",
8
+      "iconClass": "icon-mongodb",
9
+      "tags": "database,mongodb"
10
+    }
11
+  },
12
+  "objects": [
13
+    {
14
+      "kind": "Service",
15
+      "apiVersion": "v1beta3",
16
+      "metadata": {
17
+        "name": "mongodb",
18
+        "creationTimestamp": null
19
+      },
20
+      "spec": {
21
+        "ports": [
22
+          {
23
+            "name": "mongo",
24
+            "protocol": "TCP",
25
+            "port": 27017,
26
+            "targetPort": 27017,
27
+            "nodePort": 0
28
+          }
29
+        ],
30
+        "selector": {
31
+          "name": "mongodb"
32
+        },
33
+        "portalIP": "",
34
+        "type": "ClusterIP",
35
+        "sessionAffinity": "None"
36
+      },
37
+      "status": {
38
+        "loadBalancer": {}
39
+      }
40
+    },
41
+    {
42
+      "kind": "PersistentVolumeClaim",
43
+      "apiVersion": "v1beta3",
44
+      "metadata": {
45
+        "name": "mongodb"
46
+      },
47
+      "spec": {
48
+        "accessModes": [
49
+          "ReadWriteMany"
50
+        ],
51
+        "resources": {
52
+          "requests": {
53
+            "storage": "${VOLUME_CAPACITY}"
54
+          }
55
+        }
56
+      }
57
+    },
58
+    {
59
+      "kind": "DeploymentConfig",
60
+      "apiVersion": "v1beta3",
61
+      "metadata": {
62
+        "name": "mongodb",
63
+        "creationTimestamp": null
64
+      },
65
+      "spec": {
66
+        "strategy": {
67
+          "type": "Recreate",
68
+          "resources": {}
69
+        },
70
+        "triggers": [
71
+          {
72
+            "type": "ImageChange",
73
+            "imageChangeParams": {
74
+              "automatic": true,
75
+              "containerNames": [
76
+                "mongodb"
77
+              ],
78
+              "from": {
79
+                "kind": "ImageStreamTag",
80
+                "name": "mongodb:latest"
81
+              },
82
+              "lastTriggeredImage": ""
83
+            }
84
+          },
85
+          {
86
+            "type": "ConfigChange"
87
+          }
88
+        ],
89
+        "replicas": 1,
90
+        "selector": {
91
+          "name": "mongodb"
92
+        },
93
+        "template": {
94
+          "metadata": {
95
+            "creationTimestamp": null,
96
+            "labels": {
97
+              "name": "mongodb"
98
+            }
99
+          },
100
+          "spec": {
101
+            "containers": [
102
+              {
103
+                "name": "mongodb",
104
+                "image": "mongodb",
105
+                "ports": [
106
+                  {
107
+                    "containerPort": 27017,
108
+                    "protocol": "TCP"
109
+                  }
110
+                ],
111
+                "env": [
112
+                  {
113
+                    "name": "MONGODB_USER",
114
+                    "value": "${MONGODB_USER}"
115
+                  },
116
+                  {
117
+                    "name": "MONGODB_PASSWORD",
118
+                    "value": "${MONGODB_PASSWORD}"
119
+                  },
120
+                  {
121
+                    "name": "MONGODB_DATABASE",
122
+                    "value": "${MONGODB_DATABASE}"
123
+                  },
124
+                  {
125
+                    "name": "MONGODB_ADMIN_PASSWORD",
126
+                    "value": "${MONGODB_ADMIN_PASSWORD}"
127
+                  }
128
+                ],
129
+                "resources": {},
130
+                "volumeMounts": [
131
+                  {
132
+                    "name": "mongodb-data",
133
+                    "mountPath": "/var/lib/mongodb/data"
134
+                  }
135
+                ],
136
+                "terminationMessagePath": "/dev/termination-log",
137
+                "imagePullPolicy": "IfNotPresent",
138
+                "capabilities": {},
139
+                "securityContext": {
140
+                  "capabilities": {},
141
+                  "privileged": false
142
+                }
143
+              }
144
+            ],
145
+            "volumes": [
146
+              {
147
+                "name": "mongodb-data",
148
+                "persistentVolumeClaim": {
149
+                  "claimName": "mongodb"
150
+                }
151
+              }
152
+            ],
153
+            "restartPolicy": "Always",
154
+            "dnsPolicy": "ClusterFirst"
155
+          }
156
+        }
157
+      },
158
+      "status": {}
159
+    }
160
+  ],
161
+  "parameters": [
162
+    {
163
+      "name": "MONGODB_USER",
164
+      "description": "Username for MongoDB user that will be used for accessing the database",
165
+      "generate": "expression",
166
+      "from": "user[A-Z0-9]{3}"
167
+    },
168
+    {
169
+      "name": "MONGODB_PASSWORD",
170
+      "description": "Password for the MongoDB user",
171
+      "generate": "expression",
172
+      "from": "[a-zA-Z0-9]{16}"
173
+    },
174
+    {
175
+      "name": "MONGODB_DATABASE",
176
+      "description": "Database name",
177
+      "value": "sampledb"
178
+    },
179
+    {
180
+      "name": "MONGODB_ADMIN_PASSWORD",
181
+      "description": "Password for the database admin user",
182
+      "generate": "expression",
183
+      "from": "[a-zA-Z0-9]{16}"
184
+    },
185
+    {
186
+      "name": "VOLUME_CAPACITY",
187
+      "description": "Volume space available for data, e.g. 512Mi, 2Gi",
188
+      "value": "512Mi"
189
+    }
190
+  ],
191
+  "labels": {
192
+    "template": "mongodb-persistent-template"
193
+  }
194
+}
0 195
deleted file mode 100644
... ...
@@ -1,150 +0,0 @@
1
-{
2
-  "kind": "Template",
3
-  "apiVersion": "v1beta3",
4
-  "metadata": {
5
-    "name": "mongodb",
6
-    "creationTimestamp": null,
7
-    "annotations": {
8
-      "description": "This template creates a basic MongoDB database service",
9
-      "iconClass": "icon-mongodb",
10
-      "tags": "database,mongodb"
11
-    }
12
-  },
13
-  "objects": [
14
-    {
15
-      "kind": "Service",
16
-      "apiVersion": "v1beta3",
17
-      "metadata": {
18
-        "name": "mongodb",
19
-        "creationTimestamp": null
20
-      },
21
-      "spec": {
22
-        "ports": [
23
-          {
24
-            "name": "mongo",
25
-            "protocol": "TCP",
26
-            "port": 27017,
27
-            "targetPort": 27017,
28
-            "nodePort": 0
29
-          }
30
-        ],
31
-        "selector": {
32
-          "name": "mongodb"
33
-        },
34
-        "portalIP": "",
35
-        "type": "ClusterIP",
36
-        "sessionAffinity": "None"
37
-      },
38
-      "status": {
39
-        "loadBalancer": {}
40
-      }
41
-    },
42
-    {
43
-      "kind": "DeploymentConfig",
44
-      "apiVersion": "v1beta3",
45
-      "metadata": {
46
-        "name": "mongodb",
47
-        "creationTimestamp": null
48
-      },
49
-      "spec": {
50
-        "strategy": {
51
-          "type": "Recreate",
52
-          "resources": {}
53
-        },
54
-        "triggers": [
55
-          {
56
-            "type": "ImageChange",
57
-            "imageChangeParams": {
58
-              "automatic": true,
59
-              "containerNames": [
60
-                "mongodb"
61
-              ],
62
-              "from": {
63
-                "kind": "ImageStreamTag",
64
-                "name": "mongodb:latest"
65
-              },
66
-              "lastTriggeredImage": ""
67
-            }
68
-          },
69
-          {
70
-            "type": "ConfigChange"
71
-          }
72
-        ],
73
-        "replicas": 1,
74
-        "selector": {
75
-          "name": "mongodb"
76
-        },
77
-        "template": {
78
-          "metadata": {
79
-            "creationTimestamp": null,
80
-            "labels": {
81
-              "name": "mongodb"
82
-            }
83
-          },
84
-          "spec": {
85
-            "containers": [
86
-              {
87
-                "name": "mongodb",
88
-                "image": "mongodb",
89
-                "ports": [
90
-                  {
91
-                    "containerPort": 27017,
92
-                    "protocol": "TCP"
93
-                  }
94
-                ],
95
-                "env": [
96
-                  {
97
-                    "name": "MONGODB_USER",
98
-                    "value": "${MONGODB_USER}"
99
-                  },
100
-                  {
101
-                    "name": "MONGODB_PASSWORD",
102
-                    "value": "${MONGODB_PASSWORD}"
103
-                  },
104
-                  {
105
-                    "name": "MONGODB_DATABASE",
106
-                    "value": "${MONGODB_DATABASE}"
107
-                  }
108
-                ],
109
-                "resources": {},
110
-                "terminationMessagePath": "/dev/termination-log",
111
-                "imagePullPolicy": "IfNotPresent",
112
-                "capabilities": {},
113
-                "securityContext": {
114
-                  "capabilities": {},
115
-                  "privileged": false
116
-                }
117
-              }
118
-            ],
119
-            "restartPolicy": "Always",
120
-            "dnsPolicy": "ClusterFirst",
121
-            "serviceAccount": ""
122
-          }
123
-        }
124
-      },
125
-      "status": {}
126
-    }
127
-  ],
128
-  "parameters": [
129
-    {
130
-      "name": "MONGODB_USER",
131
-      "description": "database username",
132
-      "generate": "expression",
133
-      "from": "user[A-Z0-9]{3}"
134
-    },
135
-    {
136
-      "name": "MONGODB_PASSWORD",
137
-      "description": "database password",
138
-      "generate": "expression",
139
-      "from": "[a-zA-Z0-9]{8}"
140
-    },
141
-    {
142
-      "name": "MONGODB_DATABASE",
143
-      "description": "database name",
144
-      "value": "sampledb"
145
-    }
146
-  ],
147
-  "labels": {
148
-    "template": "mongodb-template"
149
-  }
150
-}
151 1
\ No newline at end of file
152 2
new file mode 100644
... ...
@@ -0,0 +1,149 @@
0
+{
1
+  "kind": "Template",
2
+  "apiVersion": "v1beta3",
3
+  "metadata": {
4
+    "name": "mysql-ephemeral",
5
+    "creationTimestamp": null,
6
+    "annotations": {
7
+      "description": "MySQL database service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
8
+      "iconClass": "icon-mysql-database",
9
+      "tags": "database,mysql"
10
+    }
11
+  },
12
+  "objects": [
13
+    {
14
+      "kind": "Service",
15
+      "apiVersion": "v1beta3",
16
+      "metadata": {
17
+        "name": "mysql",
18
+        "creationTimestamp": null
19
+      },
20
+      "spec": {
21
+        "ports": [
22
+          {
23
+            "name": "mysql",
24
+            "protocol": "TCP",
25
+            "port": 3306,
26
+            "targetPort": 3306,
27
+            "nodePort": 0
28
+          }
29
+        ],
30
+        "selector": {
31
+          "name": "mysql"
32
+        },
33
+        "portalIP": "",
34
+        "type": "ClusterIP",
35
+        "sessionAffinity": "None"
36
+      },
37
+      "status": {
38
+        "loadBalancer": {}
39
+      }
40
+    },
41
+    {
42
+      "kind": "DeploymentConfig",
43
+      "apiVersion": "v1beta3",
44
+      "metadata": {
45
+        "name": "mysql",
46
+        "creationTimestamp": null
47
+      },
48
+      "spec": {
49
+        "strategy": {
50
+          "type": "Recreate",
51
+          "resources": {}
52
+        },
53
+        "triggers": [
54
+          {
55
+            "type": "ImageChange",
56
+            "imageChangeParams": {
57
+              "automatic": true,
58
+              "containerNames": [
59
+                "mysql"
60
+              ],
61
+              "from": {
62
+                "kind": "ImageStreamTag",
63
+                "name": "mysql:latest"
64
+              },
65
+              "lastTriggeredImage": ""
66
+            }
67
+          },
68
+          {
69
+            "type": "ConfigChange"
70
+          }
71
+        ],
72
+        "replicas": 1,
73
+        "selector": {
74
+          "name": "mysql"
75
+        },
76
+        "template": {
77
+          "metadata": {
78
+            "creationTimestamp": null,
79
+            "labels": {
80
+              "name": "mysql"
81
+            }
82
+          },
83
+          "spec": {
84
+            "containers": [
85
+              {
86
+                "name": "mysql",
87
+                "image": "mysql",
88
+                "ports": [
89
+                  {
90
+                    "containerPort": 3306,
91
+                    "protocol": "TCP"
92
+                  }
93
+                ],
94
+                "env": [
95
+                  {
96
+                    "name": "MYSQL_USER",
97
+                    "value": "${MYSQL_USER}"
98
+                  },
99
+                  {
100
+                    "name": "MYSQL_PASSWORD",
101
+                    "value": "${MYSQL_PASSWORD}"
102
+                  },
103
+                  {
104
+                    "name": "MYSQL_DATABASE",
105
+                    "value": "${MYSQL_DATABASE}"
106
+                  }
107
+                ],
108
+                "resources": {},
109
+                "terminationMessagePath": "/dev/termination-log",
110
+                "imagePullPolicy": "IfNotPresent",
111
+                "capabilities": {},
112
+                "securityContext": {
113
+                  "capabilities": {},
114
+                  "privileged": false
115
+                }
116
+              }
117
+            ],
118
+            "restartPolicy": "Always",
119
+            "dnsPolicy": "ClusterFirst"
120
+          }
121
+        }
122
+      },
123
+      "status": {}
124
+    }
125
+  ],
126
+  "parameters": [
127
+    {
128
+      "name": "MYSQL_USER",
129
+      "description": "Username for MySQL user that will be used for accessing the database",
130
+      "generate": "expression",
131
+      "from": "user[A-Z0-9]{3}"
132
+    },
133
+    {
134
+      "name": "MYSQL_PASSWORD",
135
+      "description": "Password for the MySQL user",
136
+      "generate": "expression",
137
+      "from": "[a-zA-Z0-9]{16}"
138
+    },
139
+    {
140
+      "name": "MYSQL_DATABASE",
141
+      "description": "Database name",
142
+      "value": "sampledb"
143
+    }
144
+  ],
145
+  "labels": {
146
+    "template": "mysql-ephemeral-template"
147
+  }
148
+}
0 149
new file mode 100644
... ...
@@ -0,0 +1,185 @@
0
+{
1
+  "kind": "Template",
2
+  "apiVersion": "v1beta3",
3
+  "metadata": {
4
+    "name": "mysql-persistent",
5
+    "creationTimestamp": null,
6
+    "annotations": {
7
+      "description": "MySQL database service, with persistent storage. Scaling to more than one replica is not supported",
8
+      "iconClass": "icon-mysql-database",
9
+      "tags": "database,mysql"
10
+    }
11
+  },
12
+  "objects": [
13
+    {
14
+      "kind": "Service",
15
+      "apiVersion": "v1beta3",
16
+      "metadata": {
17
+        "name": "mysql",
18
+        "creationTimestamp": null
19
+      },
20
+      "spec": {
21
+        "ports": [
22
+          {
23
+            "name": "mysql",
24
+            "protocol": "TCP",
25
+            "port": 3306,
26
+            "targetPort": 3306,
27
+            "nodePort": 0
28
+          }
29
+        ],
30
+        "selector": {
31
+          "name": "mysql"
32
+        },
33
+        "portalIP": "",
34
+        "type": "ClusterIP",
35
+        "sessionAffinity": "None"
36
+      },
37
+      "status": {
38
+        "loadBalancer": {}
39
+      }
40
+    },
41
+    {
42
+      "kind": "PersistentVolumeClaim",
43
+      "apiVersion": "v1beta3",
44
+      "metadata": {
45
+        "name": "mysql"
46
+      },
47
+      "spec": {
48
+        "accessModes": [
49
+          "ReadWriteMany"
50
+        ],
51
+        "resources": {
52
+          "requests": {
53
+            "storage": "${VOLUME_CAPACITY}"
54
+          }
55
+        }
56
+      }
57
+    },
58
+    {
59
+      "kind": "DeploymentConfig",
60
+      "apiVersion": "v1beta3",
61
+      "metadata": {
62
+        "name": "mysql",
63
+        "creationTimestamp": null
64
+      },
65
+      "spec": {
66
+        "strategy": {
67
+          "type": "Recreate",
68
+          "resources": {}
69
+        },
70
+        "triggers": [
71
+          {
72
+            "type": "ImageChange",
73
+            "imageChangeParams": {
74
+              "automatic": true,
75
+              "containerNames": [
76
+                "mysql"
77
+              ],
78
+              "from": {
79
+                "kind": "ImageStreamTag",
80
+                "name": "mysql:latest"
81
+              },
82
+              "lastTriggeredImage": ""
83
+            }
84
+          },
85
+          {
86
+            "type": "ConfigChange"
87
+          }
88
+        ],
89
+        "replicas": 1,
90
+        "selector": {
91
+          "name": "mysql"
92
+        },
93
+        "template": {
94
+          "metadata": {
95
+            "creationTimestamp": null,
96
+            "labels": {
97
+              "name": "mysql"
98
+            }
99
+          },
100
+          "spec": {
101
+            "containers": [
102
+              {
103
+                "name": "mysql",
104
+                "image": "mysql",
105
+                "ports": [
106
+                  {
107
+                    "containerPort": 3306,
108
+                    "protocol": "TCP"
109
+                  }
110
+                ],
111
+                "env": [
112
+                  {
113
+                    "name": "MYSQL_USER",
114
+                    "value": "${MYSQL_USER}"
115
+                  },
116
+                  {
117
+                    "name": "MYSQL_PASSWORD",
118
+                    "value": "${MYSQL_PASSWORD}"
119
+                  },
120
+                  {
121
+                    "name": "MYSQL_DATABASE",
122
+                    "value": "${MYSQL_DATABASE}"
123
+                  }
124
+                ],
125
+                "resources": {},
126
+                "volumeMounts": [
127
+                  {
128
+                    "name": "mysql-data",
129
+                    "mountPath": "/var/lib/mysql/data"
130
+                  }
131
+                ],
132
+                "terminationMessagePath": "/dev/termination-log",
133
+                "imagePullPolicy": "IfNotPresent",
134
+                "capabilities": {},
135
+                "securityContext": {
136
+                  "capabilities": {},
137
+                  "privileged": false
138
+                }
139
+              }
140
+            ],
141
+            "volumes": [
142
+              {
143
+                "name": "mysql-data",
144
+                "persistentVolumeClaim": {
145
+                  "claimName": "mysql"
146
+                }
147
+              }
148
+            ],
149
+            "restartPolicy": "Always",
150
+            "dnsPolicy": "ClusterFirst"
151
+          }
152
+        }
153
+      },
154
+      "status": {}
155
+    }
156
+  ],
157
+  "parameters": [
158
+    {
159
+      "name": "MYSQL_USER",
160
+      "description": "Username for MySQL user that will be used for accessing the database",
161
+      "generate": "expression",
162
+      "from": "user[A-Z0-9]{3}"
163
+    },
164
+    {
165
+      "name": "MYSQL_PASSWORD",
166
+      "description": "Password for the MySQL user",
167
+      "generate": "expression",
168
+      "from": "[a-zA-Z0-9]{16}"
169
+    },
170
+    {
171
+      "name": "MYSQL_DATABASE",
172
+      "description": "Database name",
173
+      "value": "sampledb"
174
+    },
175
+    {
176
+      "name": "VOLUME_CAPACITY",
177
+      "description": "Volume space available for data, e.g. 512Mi, 2Gi",
178
+      "value": "512Mi"
179
+    }
180
+  ],
181
+  "labels": {
182
+    "template": "mysql-persistent-template"
183
+  }
184
+}
0 185
deleted file mode 100644
... ...
@@ -1,150 +0,0 @@
1
-{
2
-  "kind": "Template",
3
-  "apiVersion": "v1beta3",
4
-  "metadata": {
5
-    "name": "mysql",
6
-    "creationTimestamp": null,
7
-    "annotations": {
8
-      "description": "This template creates a basic MySQL database service",
9
-      "iconClass": "icon-mysql-database",
10
-      "tags": "database,mysql"
11
-    }
12
-  },
13
-  "objects": [
14
-    {
15
-      "kind": "Service",
16
-      "apiVersion": "v1beta3",
17
-      "metadata": {
18
-        "name": "mysql",
19
-        "creationTimestamp": null
20
-      },
21
-      "spec": {
22
-        "ports": [
23
-          {
24
-            "name": "mysql",
25
-            "protocol": "TCP",
26
-            "port": 3306,
27
-            "targetPort": 3306,
28
-            "nodePort": 0
29
-          }
30
-        ],
31
-        "selector": {
32
-          "name": "mysql"
33
-        },
34
-        "portalIP": "",
35
-        "type": "ClusterIP",
36
-        "sessionAffinity": "None"
37
-      },
38
-      "status": {
39
-        "loadBalancer": {}
40
-      }
41
-    },
42
-    {
43
-      "kind": "DeploymentConfig",
44
-      "apiVersion": "v1beta3",
45
-      "metadata": {
46
-        "name": "mysql",
47
-        "creationTimestamp": null
48
-      },
49
-      "spec": {
50
-        "strategy": {
51
-          "type": "Recreate",
52
-          "resources": {}
53
-        },
54
-        "triggers": [
55
-          {
56
-            "type": "ImageChange",
57
-            "imageChangeParams": {
58
-              "automatic": true,
59
-              "containerNames": [
60
-                "mysql"
61
-              ],
62
-              "from": {
63
-                "kind": "ImageStreamTag",
64
-                "name": "mysql:latest"
65
-              },
66
-              "lastTriggeredImage": ""
67
-            }
68
-          },
69
-          {
70
-            "type": "ConfigChange"
71
-          }
72
-        ],
73
-        "replicas": 1,
74
-        "selector": {
75
-          "name": "mysql"
76
-        },
77
-        "template": {
78
-          "metadata": {
79
-            "creationTimestamp": null,
80
-            "labels": {
81
-              "name": "mysql"
82
-            }
83
-          },
84
-          "spec": {
85
-            "containers": [
86
-              {
87
-                "name": "mysql",
88
-                "image": "mysql",
89
-                "ports": [
90
-                  {
91
-                    "containerPort": 3306,
92
-                    "protocol": "TCP"
93
-                  }
94
-                ],
95
-                "env": [
96
-                  {
97
-                    "name": "MYSQL_USER",
98
-                    "value": "${MYSQL_USER}"
99
-                  },
100
-                  {
101
-                    "name": "MYSQL_PASSWORD",
102
-                    "value": "${MYSQL_PASSWORD}"
103
-                  },
104
-                  {
105
-                    "name": "MYSQL_DATABASE",
106
-                    "value": "${MYSQL_DATABASE}"
107
-                  }
108
-                ],
109
-                "resources": {},
110
-                "terminationMessagePath": "/dev/termination-log",
111
-                "imagePullPolicy": "IfNotPresent",
112
-                "capabilities": {},
113
-                "securityContext": {
114
-                  "capabilities": {},
115
-                  "privileged": false
116
-                }
117
-              }
118
-            ],
119
-            "restartPolicy": "Always",
120
-            "dnsPolicy": "ClusterFirst",
121
-            "serviceAccount": ""
122
-          }
123
-        }
124
-      },
125
-      "status": {}
126
-    }
127
-  ],
128
-  "parameters": [
129
-    {
130
-      "name": "MYSQL_USER",
131
-      "description": "database username",
132
-      "generate": "expression",
133
-      "from": "user[A-Z0-9]{3}"
134
-    },
135
-    {
136
-      "name": "MYSQL_PASSWORD",
137
-      "description": "database password",
138
-      "generate": "expression",
139
-      "from": "[a-zA-Z0-9]{8}"
140
-    },
141
-    {
142
-      "name": "MYSQL_DATABASE",
143
-      "description": "database name",
144
-      "value": "sampledb"
145
-    }
146
-  ],
147
-  "labels": {
148
-    "template": "mysql-template"
149
-  }
150
-}
151 1
\ No newline at end of file
152 2
new file mode 100644
... ...
@@ -0,0 +1,149 @@
0
+{
1
+  "kind": "Template",
2
+  "apiVersion": "v1beta3",
3
+  "metadata": {
4
+    "name": "postgresql-ephemeral",
5
+    "creationTimestamp": null,
6
+    "annotations": {
7
+      "description": "PostgreSQL database service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
8
+      "iconClass": "icon-postgresql",
9
+      "tags": "database,postgresql"
10
+    }
11
+  },
12
+  "objects": [
13
+    {
14
+      "kind": "Service",
15
+      "apiVersion": "v1beta3",
16
+      "metadata": {
17
+        "name": "postgresql",
18
+        "creationTimestamp": null
19
+      },
20
+      "spec": {
21
+        "ports": [
22
+          {
23
+            "name": "postgresql",
24
+            "protocol": "TCP",
25
+            "port": 5432,
26
+            "targetPort": 5432,
27
+            "nodePort": 0
28
+          }
29
+        ],
30
+        "selector": {
31
+          "name": "postgresql"
32
+        },
33
+        "portalIP": "",
34
+        "type": "ClusterIP",
35
+        "sessionAffinity": "None"
36
+      },
37
+      "status": {
38
+        "loadBalancer": {}
39
+      }
40
+    },
41
+    {
42
+      "kind": "DeploymentConfig",
43
+      "apiVersion": "v1beta3",
44
+      "metadata": {
45
+        "name": "postgresql",
46
+        "creationTimestamp": null
47
+      },
48
+      "spec": {
49
+        "strategy": {
50
+          "type": "Recreate",
51
+          "resources": {}
52
+        },
53
+        "triggers": [
54
+          {
55
+            "type": "ImageChange",
56
+            "imageChangeParams": {
57
+              "automatic": true,
58
+              "containerNames": [
59
+                "postgresql"
60
+              ],
61
+              "from": {
62
+                "kind": "ImageStreamTag",
63
+                "name": "postgresql:latest"
64
+              },
65
+              "lastTriggeredImage": ""
66
+            }
67
+          },
68
+          {
69
+            "type": "ConfigChange"
70
+          }
71
+        ],
72
+        "replicas": 1,
73
+        "selector": {
74
+          "name": "postgresql"
75
+        },
76
+        "template": {
77
+          "metadata": {
78
+            "creationTimestamp": null,
79
+            "labels": {
80
+              "name": "postgresql"
81
+            }
82
+          },
83
+          "spec": {
84
+            "containers": [
85
+              {
86
+                "name": "postgresql",
87
+                "image": "postgresql",
88
+                "ports": [
89
+                  {
90
+                    "containerPort": 5432,
91
+                    "protocol": "TCP"
92
+                  }
93
+                ],
94
+                "env": [
95
+                  {
96
+                    "name": "POSTGRESQL_USER",
97
+                    "value": "${POSTGRESQL_USER}"
98
+                  },
99
+                  {
100
+                    "name": "POSTGRESQL_PASSWORD",
101
+                    "value": "${POSTGRESQL_PASSWORD}"
102
+                  },
103
+                  {
104
+                    "name": "POSTGRESQL_DATABASE",
105
+                    "value": "${POSTGRESQL_DATABASE}"
106
+                  }
107
+                ],
108
+                "resources": {},
109
+                "terminationMessagePath": "/dev/termination-log",
110
+                "imagePullPolicy": "IfNotPresent",
111
+                "capabilities": {},
112
+                "securityContext": {
113
+                  "capabilities": {},
114
+                  "privileged": false
115
+                }
116
+              }
117
+            ],
118
+            "restartPolicy": "Always",
119
+            "dnsPolicy": "ClusterFirst"
120
+          }
121
+        }
122
+      },
123
+      "status": {}
124
+    }
125
+  ],
126
+  "parameters": [
127
+    {
128
+      "name": "POSTGRESQL_USER",
129
+      "description": "Username for PostgreSQL user that will be used for accessing the database",
130
+      "generate": "expression",
131
+      "from": "user[A-Z0-9]{3}"
132
+    },
133
+    {
134
+      "name": "POSTGRESQL_PASSWORD",
135
+      "description": "Password for the PostgreSQL user",
136
+      "generate": "expression",
137
+      "from": "[a-zA-Z0-9]{16}"
138
+    },
139
+    {
140
+      "name": "POSTGRESQL_DATABASE",
141
+      "description": "Database name",
142
+      "value": "sampledb"
143
+    }
144
+  ],
145
+  "labels": {
146
+    "template": "postgresql-ephemeral-template"
147
+  }
148
+}
0 149
new file mode 100644
... ...
@@ -0,0 +1,185 @@
0
+{
1
+  "kind": "Template",
2
+  "apiVersion": "v1beta3",
3
+  "metadata": {
4
+    "name": "postgresql-persistent",
5
+    "creationTimestamp": null,
6
+    "annotations": {
7
+      "description": "PostgreSQL database service, with persistent storage. Scaling to more than one replica is not supported",
8
+      "iconClass": "icon-postgresql",
9
+      "tags": "database,postgresql"
10
+    }
11
+  },
12
+  "objects": [
13
+    {
14
+      "kind": "Service",
15
+      "apiVersion": "v1beta3",
16
+      "metadata": {
17
+        "name": "postgresql",
18
+        "creationTimestamp": null
19
+      },
20
+      "spec": {
21
+        "ports": [
22
+          {
23
+            "name": "postgresql",
24
+            "protocol": "TCP",
25
+            "port": 5432,
26
+            "targetPort": 5432,
27
+            "nodePort": 0
28
+          }
29
+        ],
30
+        "selector": {
31
+          "name": "postgresql"
32
+        },
33
+        "portalIP": "",
34
+        "type": "ClusterIP",
35
+        "sessionAffinity": "None"
36
+      },
37
+      "status": {
38
+        "loadBalancer": {}
39
+      }
40
+    },
41
+    {
42
+      "kind": "PersistentVolumeClaim",
43
+      "apiVersion": "v1beta3",
44
+      "metadata": {
45
+        "name": "postgresql"
46
+      },
47
+      "spec": {
48
+        "accessModes": [
49
+          "ReadWriteMany"
50
+        ],
51
+        "resources": {
52
+          "requests": {
53
+            "storage": "${VOLUME_CAPACITY}"
54
+          }
55
+        }
56
+      }
57
+    },
58
+    {
59
+      "kind": "DeploymentConfig",
60
+      "apiVersion": "v1beta3",
61
+      "metadata": {
62
+        "name": "postgresql",
63
+        "creationTimestamp": null
64
+      },
65
+      "spec": {
66
+        "strategy": {
67
+          "type": "Recreate",
68
+          "resources": {}
69
+        },
70
+        "triggers": [
71
+          {
72
+            "type": "ImageChange",
73
+            "imageChangeParams": {
74
+              "automatic": true,
75
+              "containerNames": [
76
+                "postgresql"
77
+              ],
78
+              "from": {
79
+                "kind": "ImageStreamTag",
80
+                "name": "postgresql:latest"
81
+              },
82
+              "lastTriggeredImage": ""
83
+            }
84
+          },
85
+          {
86
+            "type": "ConfigChange"
87
+          }
88
+        ],
89
+        "replicas": 1,
90
+        "selector": {
91
+          "name": "postgresql"
92
+        },
93
+        "template": {
94
+          "metadata": {
95
+            "creationTimestamp": null,
96
+            "labels": {
97
+              "name": "postgresql"
98
+            }
99
+          },
100
+          "spec": {
101
+            "containers": [
102
+              {
103
+                "name": "postgresql",
104
+                "image": "postgresql",
105
+                "ports": [
106
+                  {
107
+                    "containerPort": 5432,
108
+                    "protocol": "TCP"
109
+                  }
110
+                ],
111
+                "env": [
112
+                  {
113
+                    "name": "POSTGRESQL_USER",
114
+                    "value": "${POSTGRESQL_USER}"
115
+                  },
116
+                  {
117
+                    "name": "POSTGRESQL_PASSWORD",
118
+                    "value": "${POSTGRESQL_PASSWORD}"
119
+                  },
120
+                  {
121
+                    "name": "POSTGRESQL_DATABASE",
122
+                    "value": "${POSTGRESQL_DATABASE}"
123
+                  }
124
+                ],
125
+                "resources": {},
126
+                "volumeMounts": [
127
+                  {
128
+                    "name": "postgresql-data",
129
+                    "mountPath": "/var/lib/pgsql/data"
130
+                  }
131
+                ],
132
+                "terminationMessagePath": "/dev/termination-log",
133
+                "imagePullPolicy": "IfNotPresent",
134
+                "capabilities": {},
135
+                "securityContext": {
136
+                  "capabilities": {},
137
+                  "privileged": false
138
+                }
139
+              }
140
+            ],
141
+            "volumes": [
142
+              {
143
+                "name": "postgresql-data",
144
+                "persistentVolumeClaim": {
145
+                  "claimName": "postgresql"
146
+                }
147
+              }
148
+            ],
149
+            "restartPolicy": "Always",
150
+            "dnsPolicy": "ClusterFirst"
151
+          }
152
+        }
153
+      },
154
+      "status": {}
155
+    }
156
+  ],
157
+  "parameters": [
158
+    {
159
+      "name": "POSTGRESQL_USER",
160
+      "description": "Username for PostgreSQL user that will be used for accessing the database",
161
+      "generate": "expression",
162
+      "from": "user[A-Z0-9]{3}"
163
+    },
164
+    {
165
+      "name": "POSTGRESQL_PASSWORD",
166
+      "description": "Password for the PostgreSQL user",
167
+      "generate": "expression",
168
+      "from": "[a-zA-Z0-9]{16}"
169
+    },
170
+    {
171
+      "name": "POSTGRESQL_DATABASE",
172
+      "description": "Database name",
173
+      "value": "sampledb"
174
+    },
175
+    {
176
+      "name": "VOLUME_CAPACITY",
177
+      "description": "Volume space available for data, e.g. 512Mi, 2Gi",
178
+      "value": "512Mi"
179
+    }
180
+  ],
181
+  "labels": {
182
+    "template": "postgresql-persistent-template"
183
+  }
184
+}
0 185
deleted file mode 100644
... ...
@@ -1,150 +0,0 @@
1
-{
2
-  "kind": "Template",
3
-  "apiVersion": "v1beta3",
4
-  "metadata": {
5
-    "name": "postgresql",
6
-    "creationTimestamp": null,
7
-    "annotations": {
8
-      "description": "This template creates a basic PostgreSQL database service",
9
-      "iconClass": "icon-postgresql",
10
-      "tags": "database,postgresql"
11
-    }
12
-  },
13
-  "objects": [
14
-    {
15
-      "kind": "Service",
16
-      "apiVersion": "v1beta3",
17
-      "metadata": {
18
-        "name": "postgresql",
19
-        "creationTimestamp": null
20
-      },
21
-      "spec": {
22
-        "ports": [
23
-          {
24
-            "name": "postgresql",
25
-            "protocol": "TCP",
26
-            "port": 5432,
27
-            "targetPort": 5432,
28
-            "nodePort": 0
29
-          }
30
-        ],
31
-        "selector": {
32
-          "name": "postgresql"
33
-        },
34
-        "portalIP": "",
35
-        "type": "ClusterIP",
36
-        "sessionAffinity": "None"
37
-      },
38
-      "status": {
39
-        "loadBalancer": {}
40
-      }
41
-    },
42
-    {
43
-      "kind": "DeploymentConfig",
44
-      "apiVersion": "v1beta3",
45
-      "metadata": {
46
-        "name": "postgresql",
47
-        "creationTimestamp": null
48
-      },
49
-      "spec": {
50
-        "strategy": {
51
-          "type": "Recreate",
52
-          "resources": {}
53
-        },
54
-        "triggers": [
55
-          {
56
-            "type": "ImageChange",
57
-            "imageChangeParams": {
58
-              "automatic": true,
59
-              "containerNames": [
60
-                "postgresql"
61
-              ],
62
-              "from": {
63
-                "kind": "ImageStreamTag",
64
-                "name": "postgresql:latest"
65
-              },
66
-              "lastTriggeredImage": ""
67
-            }
68
-          },
69
-          {
70
-            "type": "ConfigChange"
71
-          }
72
-        ],
73
-        "replicas": 1,
74
-        "selector": {
75
-          "name": "postgresql"
76
-        },
77
-        "template": {
78
-          "metadata": {
79
-            "creationTimestamp": null,
80
-            "labels": {
81
-              "name": "postgresql"
82
-            }
83
-          },
84
-          "spec": {
85
-            "containers": [
86
-              {
87
-                "name": "postgresql",
88
-                "image": "postgresql",
89
-                "ports": [
90
-                  {
91
-                    "containerPort": 5432,
92
-                    "protocol": "TCP"
93
-                  }
94
-                ],
95
-                "env": [
96
-                  {
97
-                    "name": "POSTGRESQL_USER",
98
-                    "value": "${POSTGRESQL_USER}"
99
-                  },
100
-                  {
101
-                    "name": "POSTGRESQL_PASSWORD",
102
-                    "value": "${POSTGRESQL_PASSWORD}"
103
-                  },
104
-                  {
105
-                    "name": "POSTGRESQL_DATABASE",
106
-                    "value": "${POSTGRESQL_DATABASE}"
107
-                  }
108
-                ],
109
-                "resources": {},
110
-                "terminationMessagePath": "/dev/termination-log",
111
-                "imagePullPolicy": "IfNotPresent",
112
-                "capabilities": {},
113
-                "securityContext": {
114
-                  "capabilities": {},
115
-                  "privileged": false
116
-                }
117
-              }
118
-            ],
119
-            "restartPolicy": "Always",
120
-            "dnsPolicy": "ClusterFirst",
121
-            "serviceAccount": ""
122
-          }
123
-        }
124
-      },
125
-      "status": {}
126
-    }
127
-  ],
128
-  "parameters": [
129
-    {
130
-      "name": "POSTGRESQL_USER",
131
-      "description": "database username",
132
-      "generate": "expression",
133
-      "from": "user[A-Z0-9]{3}"
134
-    },
135
-    {
136
-      "name": "POSTGRESQL_PASSWORD",
137
-      "description": "database password",
138
-      "generate": "expression",
139
-      "from": "[a-zA-Z0-9]{8}"
140
-    },
141
-    {
142
-      "name": "POSTGRESQL_DATABASE",
143
-      "description": "database name",
144
-      "value": "sampledb"
145
-    }
146
-  ],
147
-  "labels": {
148
-    "template": "postgresql-template"
149
-  }
150
-}
151 1
\ No newline at end of file
... ...
@@ -78,9 +78,12 @@ func TestExampleObjectSchemas(t *testing.T) {
78 78
 			"image-streams-rhel7":   &imageapi.ImageStreamList{},
79 79
 		},
80 80
 		"../examples/db-templates": {
81
-			"mysql-template":      &templateapi.Template{},
82
-			"postgresql-template": &templateapi.Template{},
83
-			"mongodb-template":    &templateapi.Template{},
81
+			"mysql-persistent-template":      &templateapi.Template{},
82
+			"postgresql-persistent-template": &templateapi.Template{},
83
+			"mongodb-persistent-template":    &templateapi.Template{},
84
+			"mysql-ephemeral-template":       &templateapi.Template{},
85
+			"postgresql-ephemeral-template":  &templateapi.Template{},
86
+			"mongodb-ephemeral-template":     &templateapi.Template{},
84 87
 		},
85 88
 		"../test/integration/fixtures": {
86 89
 			"test-deployment-config":    &deployapi.DeploymentConfig{},