{ "kind": "Template", "apiVersion": "v1", "metadata": { "name": "ruby-helloworld-sample-with-resources", "creationTimestamp": null, "annotations": { "description": "This example shows how to create a simple ruby application in openshift origin v3", "iconClass": "icon-ruby", "tags": "instant-app,ruby,mysql" } }, "objects": [ { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "frontend", "creationTimestamp": null }, "spec": { "ports": [ { "name": "web", "protocol": "TCP", "port": 5432, "targetPort": 8080, "nodePort": 0 } ], "selector": { "name": "frontend" }, "type": "ClusterIP", "sessionAffinity": "None" }, "status": { "loadBalancer": {} } }, { "kind": "Route", "apiVersion": "v1", "metadata": { "name": "route-edge", "creationTimestamp": null }, "spec": { "host": "www.example.com", "to": { "kind": "Service", "name": "frontend" }, "tls": { "termination": "edge" } }, "status": {} }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "origin-ruby-sample", "creationTimestamp": null }, "spec": {}, "status": { "dockerImageRepository": "" } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "ruby-20-centos7", "creationTimestamp": null }, "spec": { "dockerImageRepository": "openshift/ruby-20-centos7" }, "status": { "dockerImageRepository": "" } }, { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "ruby-sample-build", "namespace": "quota-demo", "selfLink": "/osapi/v1/namespaces/quota-demo/buildconfigs/ruby-sample-build", "uid": "bf2174b3-fe5e-11e4-8f83-080027893417", "creationTimestamp": "2015-05-19T19:39:21Z", "labels": { "name": "ruby-sample-build", "template": "application-template-stibuild" } }, "spec": { "triggers": [ { "type": "github", "github": { "secret": "secret101" } }, { "type": "generic", "generic": { "secret": "secret101" } }, { "type": "imageChange", "imageChange": { "lastTriggeredImageID": "openshift/ruby-20-centos7:latest" } } ], "source": { "type": "Git", "git": { "uri": "git://github.com/openshift/ruby-hello-world.git" } }, "strategy": { "type": "Source", "sourceStrategy": { "from": { "kind": "ImageStreamTag", "name": "ruby-20-centos7:latest" }, "incremental": true } }, "output": { "to": { "kind": "ImageStreamTag", "name": "origin-ruby-sample:latest" } }, "resources": { "limits": { "cpu": "${BUILD_RUBY_RESOURCES_LIMITS_CPU}", "memory": "${BUILD_RUBY_RESOURCES_LIMITS_MEMORY}" } } }, "status": { "lastVersion": 1 } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "frontend", "namespace": "test", "creationTimestamp": "2015-05-01T20:22:22Z", "labels": { "template": "application-template-stibuild" } }, "spec": { "strategy": { "type": "Recreate", "recreateParams": { "pre": { "failurePolicy": "Abort", "execNewPod": { "command": [ "/bin/true" ], "env": [ { "name": "CUSTOM_VAR1", "value": "custom_value1" } ], "containerName": "ruby-helloworld" } }, "post": { "failurePolicy": "Ignore", "execNewPod": { "command": [ "/bin/false" ], "env": [ { "name": "CUSTOM_VAR2", "value": "custom_value2" } ], "containerName": "ruby-helloworld" } } }, "resources": { "limits": { "cpu": "${DEPLOY_FRONTEND_RESOURCES_LIMITS_CPU}", "memory": "${DEPLOY_FRONTEND_RESOURCES_LIMITS_MEMORY}" } } }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": true, "containerNames": [ "ruby-helloworld" ], "from": { "kind": "ImageStreamTag", "name": "origin-ruby-sample:latest" }, "lastTriggeredImage": "" } } ], "replicas": 1, "selector": { "name": "frontend" }, "template": { "metadata": { "creationTimestamp": null, "labels": { "name": "frontend" } }, "spec": { "containers": [ { "name": "ruby-helloworld", "image": "origin-ruby-sample", "ports": [ { "containerPort": 8080, "protocol": "TCP" } ], "env": [ { "name": "ADMIN_USERNAME", "value": "${ADMIN_USERNAME}" }, { "name": "ADMIN_PASSWORD", "value": "${ADMIN_PASSWORD}" }, { "name": "MYSQL_USER", "value": "${MYSQL_USER}" }, { "name": "MYSQL_PASSWORD", "value": "${MYSQL_PASSWORD}" }, { "name": "MYSQL_DATABASE", "value": "${MYSQL_DATABASE}" } ], "resources": { "limits": { "cpu": "${FRONTEND_RESOURCES_LIMITS_CPU}", "memory": "${FRONTEND_RESOURCES_LIMITS_MEMORY}" } }, "terminationMessagePath": "/dev/termination-log", "imagePullPolicy": "IfNotPresent", "capabilities": {}, "securityContext": { "capabilities": {}, "privileged": false } } ], "restartPolicy": "Always", "dnsPolicy": "ClusterFirst" } } }, "status": {} }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "database", "creationTimestamp": null }, "spec": { "ports": [ { "name": "db", "protocol": "TCP", "port": 5434, "targetPort": 3306, "nodePort": 0 } ], "selector": { "name": "database" }, "type": "ClusterIP", "sessionAffinity": "None" }, "status": { "loadBalancer": {} } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "database", "namespace": "test", "creationTimestamp": "2015-05-01T20:22:22Z", "labels": { "template": "application-template-stibuild" } }, "spec": { "strategy": { "type": "Recreate", "resources": { "limits": { "cpu": "${DEPLOY_MYSQL_RESOURCES_LIMITS_CPU}", "memory": "${DEPLOY_MYSQL_RESOURCES_LIMITS_MEMORY}" } } }, "triggers": [ { "type": "ConfigChange" } ], "replicas": 1, "selector": { "name": "database" }, "template": { "metadata": { "creationTimestamp": null, "labels": { "name": "database" } }, "spec": { "volumes": [ { "name": "data", "emptyDir": {} } ], "containers": [ { "name": "ruby-helloworld-database", "image": "openshift/mysql-55-centos7", "ports": [ { "containerPort": 3306, "protocol": "TCP" } ], "env": [ { "name": "MYSQL_USER", "value": "${MYSQL_USER}" }, { "name": "MYSQL_PASSWORD", "value": "${MYSQL_PASSWORD}" }, { "name": "MYSQL_DATABASE", "value": "${MYSQL_DATABASE}" } ], "volumeMounts": [ { "name": "data", "mountPath": "/var/lib/mysql/data" } ], "resources": { "limits": { "cpu": "${MYSQL_RESOURCES_LIMITS_CPU}", "memory": "${MYSQL_RESOURCES_LIMITS_MEMORY}" } }, "terminationMessagePath": "/dev/termination-log", "imagePullPolicy": "IfNotPresent", "capabilities": {}, "securityContext": { "capabilities": {}, "privileged": false } } ], "restartPolicy": "Always", "dnsPolicy": "ClusterFirst" } } }, "status": { "latestVersion": 1, "details": { "causes": [ { "type": "ConfigChange" } ] } } } ], "parameters": [ { "name": "ADMIN_USERNAME", "description": "administrator username", "generate": "expression", "from": "admin[A-Z0-9]{3}" }, { "name": "ADMIN_PASSWORD", "description": "administrator password", "generate": "expression", "from": "[a-zA-Z0-9]{8}" }, { "name": "MYSQL_USER", "description": "database username", "generate": "expression", "from": "user[A-Z0-9]{3}" }, { "name": "MYSQL_PASSWORD", "description": "database password", "generate": "expression", "from": "[a-zA-Z0-9]{8}" }, { "name": "MYSQL_DATABASE", "description": "database name", "value": "root" }, { "name": "MYSQL_RESOURCES_LIMITS_MEMORY", "description": "database memory limit", "value": "200Mi" }, { "name": "MYSQL_RESOURCES_LIMITS_CPU", "description": "database cpu limit", "value": "400m" }, { "name": "DEPLOY_MYSQL_RESOURCES_LIMITS_MEMORY", "description": "deploy database memory limit", "value": "50Mi" }, { "name": "DEPLOY_MYSQL_RESOURCES_LIMITS_CPU", "description": "deploy database cpu limit", "value": "20m" }, { "name": "FRONTEND_RESOURCES_LIMITS_MEMORY", "description": "frontend memory limit", "value": "100Mi" }, { "name": "FRONTEND_RESOURCES_LIMITS_CPU", "description": "frontend cpu limit", "value": "200m" }, { "name": "DEPLOY_FRONTEND_RESOURCES_LIMITS_MEMORY", "description": "deploy frontend memory limit", "value": "50Mi" }, { "name": "DEPLOY_FRONTEND_RESOURCES_LIMITS_CPU", "description": "deploy frontend cpu limit", "value": "20m" }, { "name": "BUILD_RUBY_RESOURCES_LIMITS_MEMORY", "description": "build ruby memory limit", "value": "50Mi" }, { "name": "BUILD_RUBY_RESOURCES_LIMITS_CPU", "description": "build ruby cpu limit", "value": "20m" } ], "labels": { "template": "application-template-stibuild" } }