Skip to content

Commit 7b90443

Browse files
author
OpenShift Bot
authored
Merge pull request #12055 from jupierce/quickstart_passwords_in_secrets
Merged by openshift-bot
2 parents 82b0df4 + 0d886ad commit 7b90443

16 files changed

+1008
-158
lines changed

examples/db-templates/mariadb-ephemeral-template.json

+41-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
"template": "mariadb-persistent-template"
1616
},
1717
"objects": [
18+
{
19+
"kind": "Secret",
20+
"apiVersion": "v1",
21+
"metadata": {
22+
"name": "${DATABASE_SERVICE_NAME}"
23+
},
24+
"stringData" : {
25+
"databaseUser" : "${MYSQL_USER}",
26+
"databasePassword" : "${MYSQL_PASSWORD}",
27+
"databaseRootPassword" : "${MYSQL_ROOT_PASSWORD}"
28+
}
29+
},
1830
{
1931
"kind": "Service",
2032
"apiVersion": "v1",
@@ -100,11 +112,30 @@
100112
"env": [
101113
{
102114
"name": "MYSQL_USER",
103-
"value": "${MYSQL_USER}"
115+
"valueFrom": {
116+
"secretKeyRef" : {
117+
"name" : "${DATABASE_SERVICE_NAME}",
118+
"key" : "databaseUser"
119+
}
120+
}
104121
},
105122
{
106123
"name": "MYSQL_PASSWORD",
107-
"value": "${MYSQL_PASSWORD}"
124+
"valueFrom": {
125+
"secretKeyRef" : {
126+
"name" : "${DATABASE_SERVICE_NAME}",
127+
"key" : "databasePassword"
128+
}
129+
}
130+
},
131+
{
132+
"name": "MYSQL_ROOT_PASSWORD",
133+
"valueFrom": {
134+
"secretKeyRef" : {
135+
"name" : "${DATABASE_SERVICE_NAME}",
136+
"key" : "databaseRootPassword"
137+
}
138+
}
108139
},
109140
{
110141
"name": "MYSQL_DATABASE",
@@ -175,6 +206,14 @@
175206
"from": "[a-zA-Z0-9]{16}",
176207
"required": true
177208
},
209+
{
210+
"name": "MYSQL_ROOT_PASSWORD",
211+
"displayName": "MariaDB root Password",
212+
"description": "Password for the MariaDB root user.",
213+
"generate": "expression",
214+
"from": "[a-zA-Z0-9]{16}",
215+
"required": true
216+
},
178217
{
179218
"name": "MYSQL_DATABASE",
180219
"displayName": "MariaDB Database Name",

examples/db-templates/mariadb-persistent-template.json

+41-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
"template": "mariadb-persistent-template"
1616
},
1717
"objects": [
18+
{
19+
"kind": "Secret",
20+
"apiVersion": "v1",
21+
"metadata": {
22+
"name": "${DATABASE_SERVICE_NAME}"
23+
},
24+
"stringData" : {
25+
"databaseUser" : "${MYSQL_USER}",
26+
"databasePassword" : "${MYSQL_PASSWORD}",
27+
"databaseRootPassword" : "${MYSQL_ROOT_PASSWORD}"
28+
}
29+
},
1830
{
1931
"kind": "Service",
2032
"apiVersion": "v1",
@@ -117,11 +129,30 @@
117129
"env": [
118130
{
119131
"name": "MYSQL_USER",
120-
"value": "${MYSQL_USER}"
132+
"valueFrom": {
133+
"secretKeyRef" : {
134+
"name" : "${DATABASE_SERVICE_NAME}",
135+
"key" : "databaseUser"
136+
}
137+
}
121138
},
122139
{
123140
"name": "MYSQL_PASSWORD",
124-
"value": "${MYSQL_PASSWORD}"
141+
"valueFrom": {
142+
"secretKeyRef" : {
143+
"name" : "${DATABASE_SERVICE_NAME}",
144+
"key" : "databasePassword"
145+
}
146+
}
147+
},
148+
{
149+
"name": "MYSQL_ROOT_PASSWORD",
150+
"valueFrom": {
151+
"secretKeyRef" : {
152+
"name" : "${DATABASE_SERVICE_NAME}",
153+
"key" : "databaseRootPassword"
154+
}
155+
}
125156
},
126157
{
127158
"name": "MYSQL_DATABASE",
@@ -192,6 +223,14 @@
192223
"from": "[a-zA-Z0-9]{16}",
193224
"required": true
194225
},
226+
{
227+
"name": "MYSQL_ROOT_PASSWORD",
228+
"displayName": "MariaDB root Password",
229+
"description": "Password for the MariaDB root user.",
230+
"generate": "expression",
231+
"from": "[a-zA-Z0-9]{16}",
232+
"required": true
233+
},
195234
{
196235
"name": "MYSQL_DATABASE",
197236
"displayName": "MariaDB Database Name",

examples/db-templates/mongodb-ephemeral-template.json

+33-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@
1616
"template": "mongodb-ephemeral-template"
1717
},
1818
"objects": [
19+
{
20+
"kind": "Secret",
21+
"apiVersion": "v1",
22+
"metadata": {
23+
"name": "${DATABASE_SERVICE_NAME}"
24+
},
25+
"stringData" : {
26+
"databaseUser" : "${MONGODB_USER}",
27+
"databasePassword" : "${MONGODB_PASSWORD}",
28+
"databaseAdminPassword" : "${MONGODB_ADMIN_PASSWORD}"
29+
}
30+
},
1931
{
2032
"kind": "Service",
2133
"apiVersion": "v1",
@@ -113,19 +125,34 @@
113125
"env": [
114126
{
115127
"name": "MONGODB_USER",
116-
"value": "${MONGODB_USER}"
128+
"valueFrom": {
129+
"secretKeyRef" : {
130+
"name" : "${DATABASE_SERVICE_NAME}",
131+
"key" : "databaseUser"
132+
}
133+
}
117134
},
118135
{
119136
"name": "MONGODB_PASSWORD",
120-
"value": "${MONGODB_PASSWORD}"
137+
"valueFrom": {
138+
"secretKeyRef" : {
139+
"name" : "${DATABASE_SERVICE_NAME}",
140+
"key" : "databasePassword"
141+
}
142+
}
121143
},
122144
{
123-
"name": "MONGODB_DATABASE",
124-
"value": "${MONGODB_DATABASE}"
145+
"name": "MONGODB_ADMIN_PASSWORD",
146+
"valueFrom": {
147+
"secretKeyRef" : {
148+
"name" : "${DATABASE_SERVICE_NAME}",
149+
"key" : "databaseAdminPassword"
150+
}
151+
}
125152
},
126153
{
127-
"name": "MONGODB_ADMIN_PASSWORD",
128-
"value": "${MONGODB_ADMIN_PASSWORD}"
154+
"name": "MONGODB_DATABASE",
155+
"value": "${MONGODB_DATABASE}"
129156
}
130157
],
131158
"resources": {

examples/db-templates/mongodb-persistent-template.json

+33-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@
1616
"template": "mongodb-persistent-template"
1717
},
1818
"objects": [
19+
{
20+
"kind": "Secret",
21+
"apiVersion": "v1",
22+
"metadata": {
23+
"name": "${DATABASE_SERVICE_NAME}"
24+
},
25+
"stringData" : {
26+
"databaseUser" : "${MONGODB_USER}",
27+
"databasePassword" : "${MONGODB_PASSWORD}",
28+
"databaseAdminPassword" : "${MONGODB_ADMIN_PASSWORD}"
29+
}
30+
},
1931
{
2032
"kind": "Service",
2133
"apiVersion": "v1",
@@ -130,19 +142,34 @@
130142
"env": [
131143
{
132144
"name": "MONGODB_USER",
133-
"value": "${MONGODB_USER}"
145+
"valueFrom": {
146+
"secretKeyRef" : {
147+
"name" : "${DATABASE_SERVICE_NAME}",
148+
"key" : "databaseUser"
149+
}
150+
}
134151
},
135152
{
136153
"name": "MONGODB_PASSWORD",
137-
"value": "${MONGODB_PASSWORD}"
154+
"valueFrom": {
155+
"secretKeyRef" : {
156+
"name" : "${DATABASE_SERVICE_NAME}",
157+
"key" : "databasePassword"
158+
}
159+
}
138160
},
139161
{
140-
"name": "MONGODB_DATABASE",
141-
"value": "${MONGODB_DATABASE}"
162+
"name": "MONGODB_ADMIN_PASSWORD",
163+
"valueFrom": {
164+
"secretKeyRef" : {
165+
"name" : "${DATABASE_SERVICE_NAME}",
166+
"key" : "databaseAdminPassword"
167+
}
168+
}
142169
},
143170
{
144-
"name": "MONGODB_ADMIN_PASSWORD",
145-
"value": "${MONGODB_ADMIN_PASSWORD}"
171+
"name": "MONGODB_DATABASE",
172+
"value": "${MONGODB_DATABASE}"
146173
}
147174
],
148175
"resources": {

examples/db-templates/mysql-ephemeral-template.json

+41-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
"template": "mysql-ephemeral-template"
1616
},
1717
"objects": [
18+
{
19+
"kind": "Secret",
20+
"apiVersion": "v1",
21+
"metadata": {
22+
"name": "${DATABASE_SERVICE_NAME}"
23+
},
24+
"stringData" : {
25+
"databaseUser" : "${MYSQL_USER}",
26+
"databasePassword" : "${MYSQL_PASSWORD}",
27+
"databaseRootPassword" : "${MYSQL_ROOT_PASSWORD}"
28+
}
29+
},
1830
{
1931
"kind": "Service",
2032
"apiVersion": "v1",
@@ -113,11 +125,30 @@
113125
"env": [
114126
{
115127
"name": "MYSQL_USER",
116-
"value": "${MYSQL_USER}"
128+
"valueFrom": {
129+
"secretKeyRef" : {
130+
"name" : "${DATABASE_SERVICE_NAME}",
131+
"key" : "databaseUser"
132+
}
133+
}
117134
},
118135
{
119136
"name": "MYSQL_PASSWORD",
120-
"value": "${MYSQL_PASSWORD}"
137+
"valueFrom": {
138+
"secretKeyRef" : {
139+
"name" : "${DATABASE_SERVICE_NAME}",
140+
"key" : "databasePassword"
141+
}
142+
}
143+
},
144+
{
145+
"name": "MYSQL_ROOT_PASSWORD",
146+
"valueFrom": {
147+
"secretKeyRef" : {
148+
"name" : "${DATABASE_SERVICE_NAME}",
149+
"key" : "databaseRootPassword"
150+
}
151+
}
121152
},
122153
{
123154
"name": "MYSQL_DATABASE",
@@ -196,6 +227,14 @@
196227
"from": "[a-zA-Z0-9]{16}",
197228
"required": true
198229
},
230+
{
231+
"name": "MYSQL_ROOT_PASSWORD",
232+
"displayName": "MySQL root user Password",
233+
"description": "Password for the MySQL root user.",
234+
"generate": "expression",
235+
"from": "[a-zA-Z0-9]{16}",
236+
"required": true
237+
},
199238
{
200239
"name": "MYSQL_DATABASE",
201240
"displayName": "MySQL Database Name",

examples/db-templates/mysql-persistent-template.json

+41-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
"template": "mysql-persistent-template"
1616
},
1717
"objects": [
18+
{
19+
"kind": "Secret",
20+
"apiVersion": "v1",
21+
"metadata": {
22+
"name": "${DATABASE_SERVICE_NAME}"
23+
},
24+
"stringData" : {
25+
"databaseUser" : "${MYSQL_USER}",
26+
"databasePassword" : "${MYSQL_PASSWORD}",
27+
"databaseRootPassword" : "${MYSQL_ROOT_PASSWORD}"
28+
}
29+
},
1830
{
1931
"kind": "Service",
2032
"apiVersion": "v1",
@@ -117,11 +129,30 @@
117129
"env": [
118130
{
119131
"name": "MYSQL_USER",
120-
"value": "${MYSQL_USER}"
132+
"valueFrom": {
133+
"secretKeyRef" : {
134+
"name" : "${DATABASE_SERVICE_NAME}",
135+
"key" : "databaseUser"
136+
}
137+
}
121138
},
122139
{
123140
"name": "MYSQL_PASSWORD",
124-
"value": "${MYSQL_PASSWORD}"
141+
"valueFrom": {
142+
"secretKeyRef" : {
143+
"name" : "${DATABASE_SERVICE_NAME}",
144+
"key" : "databasePassword"
145+
}
146+
}
147+
},
148+
{
149+
"name": "MYSQL_ROOT_PASSWORD",
150+
"valueFrom": {
151+
"secretKeyRef" : {
152+
"name" : "${DATABASE_SERVICE_NAME}",
153+
"key" : "databaseRootPassword"
154+
}
155+
}
125156
},
126157
{
127158
"name": "MYSQL_DATABASE",
@@ -192,6 +223,14 @@
192223
"from": "[a-zA-Z0-9]{16}",
193224
"required": true
194225
},
226+
{
227+
"name": "MYSQL_ROOT_PASSWORD",
228+
"displayName": "MySQL root user Password",
229+
"description": "Password for the MySQL root user.",
230+
"generate": "expression",
231+
"from": "[a-zA-Z0-9]{16}",
232+
"required": true
233+
},
195234
{
196235
"name": "MYSQL_DATABASE",
197236
"displayName": "MySQL Database Name",

0 commit comments

Comments
 (0)