201 lines
5.2 KiB
JSON
201 lines
5.2 KiB
JSON
{
|
|
"kind": "Template",
|
|
"apiVersion": "v1beta3",
|
|
"metadata": {
|
|
"name": "mongodb-persistent",
|
|
"creationTimestamp": null,
|
|
"annotations": {
|
|
"description": "MongoDB database service, with persistent storage. Scaling to more than one replica is not supported",
|
|
"iconClass": "icon-mongodb",
|
|
"tags": "database,mongodb"
|
|
}
|
|
},
|
|
"objects": [
|
|
{
|
|
"kind": "Service",
|
|
"apiVersion": "v1beta3",
|
|
"metadata": {
|
|
"name": "${DATABASE_SERVICE_NAME}",
|
|
"creationTimestamp": null
|
|
},
|
|
"spec": {
|
|
"ports": [
|
|
{
|
|
"name": "mongo",
|
|
"protocol": "TCP",
|
|
"port": 27017,
|
|
"targetPort": 27017,
|
|
"nodePort": 0
|
|
}
|
|
],
|
|
"selector": {
|
|
"name": "${DATABASE_SERVICE_NAME}"
|
|
},
|
|
"portalIP": "",
|
|
"type": "ClusterIP",
|
|
"sessionAffinity": "None"
|
|
},
|
|
"status": {
|
|
"loadBalancer": {}
|
|
}
|
|
},
|
|
{
|
|
"kind": "PersistentVolumeClaim",
|
|
"apiVersion": "v1beta3",
|
|
"metadata": {
|
|
"name": "${DATABASE_SERVICE_NAME}"
|
|
},
|
|
"spec": {
|
|
"accessModes": [
|
|
"ReadWriteOnce"
|
|
],
|
|
"resources": {
|
|
"requests": {
|
|
"storage": "${VOLUME_CAPACITY}"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"kind": "DeploymentConfig",
|
|
"apiVersion": "v1beta3",
|
|
"metadata": {
|
|
"name": "${DATABASE_SERVICE_NAME}",
|
|
"creationTimestamp": null
|
|
},
|
|
"spec": {
|
|
"strategy": {
|
|
"type": "Recreate",
|
|
"resources": {}
|
|
},
|
|
"triggers": [
|
|
{
|
|
"type": "ImageChange",
|
|
"imageChangeParams": {
|
|
"automatic": true,
|
|
"containerNames": [
|
|
"mongodb"
|
|
],
|
|
"from": {
|
|
"kind": "ImageStreamTag",
|
|
"name": "mongodb:latest",
|
|
"namespace": "openshift"
|
|
},
|
|
"lastTriggeredImage": ""
|
|
}
|
|
},
|
|
{
|
|
"type": "ConfigChange"
|
|
}
|
|
],
|
|
"replicas": 1,
|
|
"selector": {
|
|
"name": "${DATABASE_SERVICE_NAME}"
|
|
},
|
|
"template": {
|
|
"metadata": {
|
|
"creationTimestamp": null,
|
|
"labels": {
|
|
"name": "${DATABASE_SERVICE_NAME}"
|
|
}
|
|
},
|
|
"spec": {
|
|
"containers": [
|
|
{
|
|
"name": "mongodb",
|
|
"image": "mongodb",
|
|
"ports": [
|
|
{
|
|
"containerPort": 27017,
|
|
"protocol": "TCP"
|
|
}
|
|
],
|
|
"env": [
|
|
{
|
|
"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": {},
|
|
"volumeMounts": [
|
|
{
|
|
"name": "${DATABASE_SERVICE_NAME}-data",
|
|
"mountPath": "/var/lib/mongodb/data"
|
|
}
|
|
],
|
|
"terminationMessagePath": "/dev/termination-log",
|
|
"imagePullPolicy": "IfNotPresent",
|
|
"capabilities": {},
|
|
"securityContext": {
|
|
"capabilities": {},
|
|
"privileged": false
|
|
}
|
|
}
|
|
],
|
|
"volumes": [
|
|
{
|
|
"name": "${DATABASE_SERVICE_NAME}-data",
|
|
"persistentVolumeClaim": {
|
|
"claimName": "${DATABASE_SERVICE_NAME}"
|
|
}
|
|
}
|
|
],
|
|
"restartPolicy": "Always",
|
|
"dnsPolicy": "ClusterFirst"
|
|
}
|
|
}
|
|
},
|
|
"status": {}
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "DATABASE_SERVICE_NAME",
|
|
"description": "Database service name",
|
|
"value": "mongodb"
|
|
},
|
|
{
|
|
"name": "MONGODB_USER",
|
|
"description": "Username for MongoDB user that will be used for accessing the database",
|
|
"generate": "expression",
|
|
"from": "user[A-Z0-9]{3}"
|
|
},
|
|
{
|
|
"name": "MONGODB_PASSWORD",
|
|
"description": "Password for the MongoDB user",
|
|
"generate": "expression",
|
|
"from": "[a-zA-Z0-9]{16}"
|
|
},
|
|
{
|
|
"name": "MONGODB_DATABASE",
|
|
"description": "Database name",
|
|
"value": "sampledb"
|
|
},
|
|
{
|
|
"name": "MONGODB_ADMIN_PASSWORD",
|
|
"description": "Password for the database admin user",
|
|
"generate": "expression",
|
|
"from": "[a-zA-Z0-9]{16}"
|
|
},
|
|
{
|
|
"name": "VOLUME_CAPACITY",
|
|
"description": "Volume space available for data, e.g. 512Mi, 2Gi",
|
|
"value": "512Mi"
|
|
}
|
|
],
|
|
"labels": {
|
|
"template": "mongodb-persistent-template"
|
|
}
|
|
}
|