Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kj54321/77b1602a996b3f402c7c11f56a5793d5 to your computer and use it in GitHub Desktop.
Save kj54321/77b1602a996b3f402c7c11f56a5793d5 to your computer and use it in GitHub Desktop.
OSEv3 sample template definition
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"name": "a-quickstart-keyvalue-application",
"creationTimestamp": null,
"annotations": {
"description": "This is an example of a Ruby and MySQL application on OpenShift 3",
"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"
},
"portalIP": "",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Route",
"apiVersion": "v1",
"metadata": {
"name": "example-route",
"creationTimestamp": null
},
"spec": {
"host": "REPLACEME.com",
"to": {
"kind": "Service",
"name": "frontend"
}
},
"spec": {
"to": {
"kind": "Service",
"name": "frontend"
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "ruby-sample",
"creationTimestamp": null
},
"spec": {},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "ruby-20-rhel7",
"creationTimestamp": null
},
"spec": {
"dockerImageRepository": "registry.access.redhat.com/openshift3/ruby-20-rhel7"
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "ruby-sample-build",
"creationTimestamp": null,
"labels": {
"name": "ruby-sample-build"
}
},
"spec": {
"triggers": [
{
"type": "github",
"github": {
"secret": "secret101"
}
},
{
"type": "generic",
"generic": {
"secret": "secret101"
}
},
{
"type": "imageChange",
"imageChange": {}
}
],
"source": {
"type": "Git",
"git": {
"uri": "git://github.com/openshift/ruby-hello-world.git",
"ref": "master"
}
},
"strategy": {
"type": "Source",
"sourceStrategy": {
"from": {
"kind": "ImageStreamTag",
"name": "ruby:latest",
"namespace": "openshift"
},
"incremental": true
}
},
"output": {
"to": {
"kind": "ImageStreamTag",
"name": "ruby-sample:latest"
}
},
"resources": {}
},
"status": {
"lastVersion": 0
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "frontend",
"creationTimestamp": null
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"ruby-helloworld"
],
"from": {
"kind": "ImageStreamTag",
"name": "ruby-sample:latest"
},
"lastTriggeredImage": ""
}
},
{
"type": "ConfigChange"
}
],
"replicas": 2,
"selector": {
"name": "frontend"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"name": "frontend"
}
},
"nodeSelector": {
"region": "primary"
},
"spec": {
"containers": [
{
"name": "ruby-helloworld",
"image": "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": {},
"terminationMessagePath": "/dev/termination-log",
"imagePullPolicy": "IfNotPresent",
"capabilities": {},
"securityContext": {
"capabilities": {},
"privileged": false
}
}
],
"restartPolicy": "Always",
"dnsPolicy": "ClusterFirst",
"serviceAccount": ""
}
}
},
"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"
},
"portalIP": "",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "database",
"creationTimestamp": null
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"name": "database"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"name": "database"
}
},
"nodeSelector": {
"region": "primary"
},
"spec": {
"containers": [
{
"name": "ruby-helloworld-database",
"image": "registry.access.redhat.com/openshift3/mysql-55-rhel7:latest",
"ports": [
{
"containerPort": 3306,
"protocol": "TCP"
}
],
"env": [
{
"name": "MYSQL_USER",
"value": "${MYSQL_USER}"
},
{
"name": "MYSQL_PASSWORD",
"value": "${MYSQL_PASSWORD}"
},
{
"name": "MYSQL_DATABASE",
"value": "${MYSQL_DATABASE}"
}
],
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"imagePullPolicy": "Always",
"capabilities": {},
"securityContext": {
"capabilities": {},
"privileged": false
}
}
],
"restartPolicy": "Always",
"dnsPolicy": "ClusterFirst",
"serviceAccount": ""
}
}
},
"status": {}
}
],
"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"
}
],
"labels": {
"template": "application-template-stibuild"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment