Merge pull request #75 from jupierce/migrate-passwords-to-secrets

Moving credentials into secrets
This commit is contained in:
Ben Parees 2016-11-29 14:24:31 -05:00 committed by GitHub
commit 81e1afb25e
3 changed files with 123 additions and 72 deletions

View file

@ -15,6 +15,18 @@
"template": "nodejs-mongo-persistent" "template": "nodejs-mongo-persistent"
}, },
"objects": [ "objects": [
{
"kind": "Secret",
"apiVersion": "v1",
"metadata": {
"name": "${NAME}"
},
"stringData": {
"databaseUser": "${DATABASE_USER}",
"databasePassword": "${DATABASE_PASSWORD}",
"databaseAdminPassword" : "${DATABASE_ADMIN_PASSWORD}"
}
},
{ {
"kind": "Service", "kind": "Service",
"apiVersion": "v1", "apiVersion": "v1",
@ -186,11 +198,21 @@
}, },
{ {
"name": "MONGODB_USER", "name": "MONGODB_USER",
"value": "${DATABASE_USER}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databaseUser"
}
}
}, },
{ {
"name": "MONGODB_PASSWORD", "name": "MONGODB_PASSWORD",
"value": "${DATABASE_PASSWORD}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databasePassword"
}
}
}, },
{ {
"name": "MONGODB_DATABASE", "name": "MONGODB_DATABASE",
@ -198,7 +220,12 @@
}, },
{ {
"name": "MONGODB_ADMIN_PASSWORD", "name": "MONGODB_ADMIN_PASSWORD",
"value": "${DATABASE_ADMIN_PASSWORD}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databaseAdminPassword"
}
}
} }
], ],
"readinessProbe": { "readinessProbe": {
@ -323,11 +350,21 @@
"env": [ "env": [
{ {
"name": "MONGODB_USER", "name": "MONGODB_USER",
"value": "${DATABASE_USER}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databaseUser"
}
}
}, },
{ {
"name": "MONGODB_PASSWORD", "name": "MONGODB_PASSWORD",
"value": "${DATABASE_PASSWORD}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databasePassword"
}
}
}, },
{ {
"name": "MONGODB_DATABASE", "name": "MONGODB_DATABASE",
@ -335,14 +372,24 @@
}, },
{ {
"name": "MONGODB_ADMIN_PASSWORD", "name": "MONGODB_ADMIN_PASSWORD",
"value": "${DATABASE_ADMIN_PASSWORD}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databaseAdminPassword"
}
}
} }
], ],
"readinessProbe": { "readinessProbe": {
"timeoutSeconds": 1, "timeoutSeconds": 1,
"initialDelaySeconds": 3, "initialDelaySeconds": 3,
"exec": { "exec": {
"command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""] "command": [
"/bin/sh",
"-i",
"-c",
"mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""
]
} }
}, },
"livenessProbe": { "livenessProbe": {

View file

@ -15,6 +15,18 @@
"template": "nodejs-mongodb-example" "template": "nodejs-mongodb-example"
}, },
"objects": [ "objects": [
{
"kind": "Secret",
"apiVersion": "v1",
"metadata": {
"name": "${NAME}"
},
"stringData": {
"databaseUser": "${DATABASE_USER}",
"databasePassword": "${DATABASE_PASSWORD}",
"databaseAdminPassword" : "${DATABASE_ADMIN_PASSWORD}"
}
},
{ {
"kind": "Service", "kind": "Service",
"apiVersion": "v1", "apiVersion": "v1",
@ -186,11 +198,21 @@
}, },
{ {
"name": "MONGODB_USER", "name": "MONGODB_USER",
"value": "${DATABASE_USER}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databaseUser"
}
}
}, },
{ {
"name": "MONGODB_PASSWORD", "name": "MONGODB_PASSWORD",
"value": "${DATABASE_PASSWORD}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databasePassword"
}
}
}, },
{ {
"name": "MONGODB_DATABASE", "name": "MONGODB_DATABASE",
@ -198,7 +220,12 @@
}, },
{ {
"name": "MONGODB_ADMIN_PASSWORD", "name": "MONGODB_ADMIN_PASSWORD",
"value": "${DATABASE_ADMIN_PASSWORD}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databaseAdminPassword"
}
}
} }
], ],
"readinessProbe": { "readinessProbe": {
@ -306,11 +333,21 @@
"env": [ "env": [
{ {
"name": "MONGODB_USER", "name": "MONGODB_USER",
"value": "${DATABASE_USER}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databaseUser"
}
}
}, },
{ {
"name": "MONGODB_PASSWORD", "name": "MONGODB_PASSWORD",
"value": "${DATABASE_PASSWORD}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databasePassword"
}
}
}, },
{ {
"name": "MONGODB_DATABASE", "name": "MONGODB_DATABASE",
@ -318,14 +355,24 @@
}, },
{ {
"name": "MONGODB_ADMIN_PASSWORD", "name": "MONGODB_ADMIN_PASSWORD",
"value": "${DATABASE_ADMIN_PASSWORD}" "valueFrom": {
"secretKeyRef" : {
"name" : "${NAME}",
"key" : "databaseAdminPassword"
}
}
} }
], ],
"readinessProbe": { "readinessProbe": {
"timeoutSeconds": 1, "timeoutSeconds": 1,
"initialDelaySeconds": 3, "initialDelaySeconds": 3,
"exec": { "exec": {
"command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""] "command": [
"/bin/sh",
"-i",
"-c",
"mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""
]
} }
}, },
"livenessProbe": { "livenessProbe": {

View file

@ -200,26 +200,6 @@
} }
}, },
"env": [ "env": [
{
"name": "DATABASE_SERVICE_NAME",
"value": "${DATABASE_SERVICE_NAME}"
},
{
"name": "MONGODB_USER",
"value": "${MONGODB_USER}"
},
{
"name": "MONGODB_PASSWORD",
"value": "${MONGODB_PASSWORD}"
},
{
"name": "MONGODB_DATABASE",
"value": "${MONGODB_DATABASE}"
},
{
"name": "MONGODB_ADMIN_PASSWORD",
"value": "${MONGODB_ADMIN_PASSWORD}"
}
], ],
"resources": { "resources": {
"limits": { "limits": {
@ -292,29 +272,6 @@
"generate": "expression", "generate": "expression",
"from": "[a-zA-Z0-9]{40}" "from": "[a-zA-Z0-9]{40}"
}, },
{
"name": "DATABASE_SERVICE_NAME",
"displayName": "Database Service Name"
},
{
"name": "MONGODB_USER",
"displayName": "MongoDB Username",
"description": "Username for MongoDB user that will be used for accessing the database."
},
{
"name": "MONGODB_PASSWORD",
"displayName": "MongoDB Password",
"description": "Password for the MongoDB user."
},
{
"name": "MONGODB_DATABASE",
"displayName": "Database Name"
},
{
"name": "MONGODB_ADMIN_PASSWORD",
"displayName": "Database Administrator Password",
"description": "Password for the database admin user."
},
{ {
"name": "NPM_MIRROR", "name": "NPM_MIRROR",
"displayName": "Custom NPM Mirror URL", "displayName": "Custom NPM Mirror URL",