Standardize templates across examples

This commit is contained in:
Rodolfo Carvalho 2015-06-11 21:05:29 +02:00
parent 505ff52a05
commit 67470cb254
2 changed files with 127 additions and 154 deletions

View file

@ -2,24 +2,24 @@
"kind": "Template", "kind": "Template",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-quickstart-source-postgresql", "name": "django-postgresql-example",
"annotations": { "annotations": {
"description": "Django application template that uses the Source build strategy and includes a PostgreSQL database server for storage.", "description": "An example Django application with a PostgreSQL database",
"tags": "instant-app,python,django,postgresql", "tags": "instant-app,python,django,postgresql",
"iconClass" : "icon-python" "iconClass": "icon-python"
} }
}, },
"labels": { "labels": {
"template": "django-quickstart-source-postgresql" "template": "django-postgresql-example"
}, },
"objects": [ "objects": [
{ {
"kind": "Service", "kind": "Service",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}", "name": "django-frontend",
"annotations": { "annotations": {
"description": "Exposes and load balances the Django app instances." "description": "Exposes and load balances the application pods"
} }
}, },
"spec": { "spec": {
@ -31,29 +31,7 @@
} }
], ],
"selector": { "selector": {
"name": "${FRONTEND_SERVICE_NAME}" "name": "django-frontend"
}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "${DATABASE_SERVICE_NAME}",
"annotations": {
"description": "Exposes the PostgreSQL database server."
}
},
"spec": {
"ports": [
{
"name": "postgresql",
"port": 5432,
"targetPort": 5432
}
],
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
} }
} }
}, },
@ -61,30 +39,40 @@
"kind": "Route", "kind": "Route",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}-route" "name": "django-route"
}, },
"spec": { "spec": {
"host" : "${FRONTEND_ROUTE}", "host": "${FRONTEND_ROUTE}",
"to": { "to": {
"kind" : "Service", "kind": "Service",
"name" : "${FRONTEND_SERVICE_NAME}" "name": "django-frontend"
} }
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "django-example",
"annotations": {
"description": "Keeps track of changes in the application image"
}
} }
}, },
{ {
"kind": "BuildConfig", "kind": "BuildConfig",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-quickstart-source", "name": "django-example",
"annotations": { "annotations": {
"description": "Defines how to build the Django app." "description": "Defines how to build the application"
} }
}, },
"spec": { "spec": {
"source": { "source": {
"type": "Git", "type": "Git",
"git": { "git": {
"uri": "${GIT_REPOSITORY}" "uri": "${SOURCE_REPOSITORY_URL}"
}, },
"contextDir": "${CONTEXT_DIR}" "contextDir": "${CONTEXT_DIR}"
}, },
@ -92,15 +80,16 @@
"type": "Source", "type": "Source",
"sourceStrategy": { "sourceStrategy": {
"from": { "from": {
"kind": "ImageStream", "kind": "ImageStreamTag",
"name": "python-33-centos7" "namespace": "openshift",
"name": "python:3.3"
} }
} }
}, },
"output": { "output": {
"to": { "to": {
"kind": "ImageStream", "kind": "ImageStream",
"name": "django-quickstart-source" "name": "django-example"
} }
}, },
"triggers": [ "triggers": [
@ -110,13 +99,7 @@
{ {
"type": "GitHub", "type": "GitHub",
"github": { "github": {
"secret": "secret123" "secret": "${GITHUB_WEBHOOK_SECRET}"
}
},
{
"type": "Generic",
"generic": {
"secret": "secret123"
} }
} }
] ]
@ -126,9 +109,9 @@
"kind": "DeploymentConfig", "kind": "DeploymentConfig",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}", "name": "django-frontend",
"annotations": { "annotations": {
"description": "Defines how to deploy the Django app." "description": "Defines how to deploy the application server"
} }
}, },
"spec": { "spec": {
@ -141,10 +124,11 @@
"imageChangeParams": { "imageChangeParams": {
"automatic": true, "automatic": true,
"containerNames": [ "containerNames": [
"django-quickstart" "django-example"
], ],
"from": { "from": {
"name": "django-quickstart-source:latest" "kind": "ImageStreamTag",
"name": "django-example:latest"
} }
} }
}, },
@ -154,20 +138,20 @@
], ],
"replicas": 1, "replicas": 1,
"selector": { "selector": {
"name": "${FRONTEND_SERVICE_NAME}" "name": "django-frontend"
}, },
"template": { "template": {
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}", "name": "django-frontend",
"labels": { "labels": {
"name": "${FRONTEND_SERVICE_NAME}" "name": "django-frontend"
} }
}, },
"spec": { "spec": {
"containers": [ "containers": [
{ {
"name": "django-quickstart", "name": "django-example",
"image": "django-quickstart-source", "image": "django-example",
"ports": [ "ports": [
{ {
"containerPort": 8080 "containerPort": 8080
@ -209,16 +193,35 @@
} }
} }
}, },
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "${DATABASE_SERVICE_NAME}",
"annotations": {
"description": "Exposes the database server"
}
},
"spec": {
"ports": [
{
"name": "postgresql",
"port": 5432,
"targetPort": 5432
}
],
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
}
}
},
{ {
"kind": "DeploymentConfig", "kind": "DeploymentConfig",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "${DATABASE_SERVICE_NAME}", "name": "${DATABASE_SERVICE_NAME}",
"labels": {
"name": "${DATABASE_SERVICE_NAME}"
},
"annotations": { "annotations": {
"description": "Defines how to deploy the database." "description": "Defines how to deploy the database"
} }
}, },
"spec": { "spec": {
@ -270,50 +273,28 @@
} }
} }
} }
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "django-quickstart-source",
"annotations": {
"description": "Keeps track of changes in the Django app image."
}
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "python-33-centos7",
"annotations": {
"description": "Keeps track of changes in the Python base image."
}
},
"spec": {
"dockerImageRepository": "openshift/python-33-centos7"
}
} }
], ],
"parameters": [ "parameters": [
{ {
"name": "GIT_REPOSITORY", "name": "SOURCE_REPOSITORY_URL",
"description": "Change this to match your project's Git repository", "description": "The URL of the repository with your application source code",
"value": "git://github.com/openshift/django-ex.git" "value": "https://github.com/openshift/django-ex.git"
}, },
{ {
"name": "CONTEXT_DIR", "name": "CONTEXT_DIR",
"description": "Set this to the relative path to your project if it is not in the root of your repository" "description": "Set this to the relative path to your project if it is not in the root of your repository"
}, },
{ {
"name": "FRONTEND_SERVICE_NAME", "name": "FRONTEND_ROUTE",
"description": "Frontend service name", "description": "The exposed hostname that will route to the Django service",
"value": "django" "value": "django.app"
}, },
{ {
"name": "FRONTEND_ROUTE", "name": "GITHUB_WEBHOOK_SECRET",
"description": "The exposed hostname that will route to the frontend service", "description": "A secret string used to configure the GitHub webhook",
"value": "django-frontend.apps" "generate": "expression",
"from": "[a-zA-Z0-9]{40}"
}, },
{ {
"name": "DATABASE_SERVICE_NAME", "name": "DATABASE_SERVICE_NAME",

View file

@ -2,24 +2,24 @@
"kind": "Template", "kind": "Template",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-quickstart-source", "name": "django-example",
"annotations": { "annotations": {
"description": "Django application template that uses the Source build strategy.", "description": "An example Django application with no database",
"tags": "instant-app,python,django", "tags": "instant-app,python,django",
"iconClass" : "icon-python" "iconClass": "icon-python"
} }
}, },
"labels": { "labels": {
"template": "django-quickstart-source" "template": "django-example"
}, },
"objects": [ "objects": [
{ {
"kind": "Service", "kind": "Service",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}", "name": "django-frontend",
"annotations": { "annotations": {
"description": "Exposes and load balances the Django app instances." "description": "Exposes and load balances the application pods"
} }
}, },
"spec": { "spec": {
@ -31,7 +31,7 @@
} }
], ],
"selector": { "selector": {
"name": "${FRONTEND_SERVICE_NAME}" "name": "django-frontend"
} }
} }
}, },
@ -39,30 +39,40 @@
"kind": "Route", "kind": "Route",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}-route" "name": "django-route"
}, },
"spec": { "spec": {
"host" : "${FRONTEND_ROUTE}", "host": "${FRONTEND_ROUTE}",
"to": { "to": {
"kind" : "Service", "kind": "Service",
"name" : "${FRONTEND_SERVICE_NAME}" "name": "django-frontend"
} }
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "django-example",
"annotations": {
"description": "Keeps track of changes in the application image"
}
} }
}, },
{ {
"kind": "BuildConfig", "kind": "BuildConfig",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "django-quickstart-source", "name": "django-example",
"annotations": { "annotations": {
"description": "Defines how to build the Django app." "description": "Defines how to build the application"
} }
}, },
"spec": { "spec": {
"source": { "source": {
"type": "Git", "type": "Git",
"git": { "git": {
"uri": "${GIT_REPOSITORY}" "uri": "${SOURCE_REPOSITORY_URL}"
}, },
"contextDir": "${CONTEXT_DIR}" "contextDir": "${CONTEXT_DIR}"
}, },
@ -70,15 +80,16 @@
"type": "Source", "type": "Source",
"sourceStrategy": { "sourceStrategy": {
"from": { "from": {
"kind": "ImageStream", "kind": "ImageStreamTag",
"name": "${BUILDER_IMAGE_STREAM}" "namespace": "openshift",
"name": "python:3.3"
} }
} }
}, },
"output": { "output": {
"to": { "to": {
"kind": "ImageStream", "kind": "ImageStream",
"name": "django-quickstart-source" "name": "django-example"
} }
}, },
"triggers": [ "triggers": [
@ -88,13 +99,7 @@
{ {
"type": "GitHub", "type": "GitHub",
"github": { "github": {
"secret": "secret123" "secret": "${GITHUB_WEBHOOK_SECRET}"
}
},
{
"type": "Generic",
"generic": {
"secret": "secret123"
} }
} }
] ]
@ -104,9 +109,9 @@
"kind": "DeploymentConfig", "kind": "DeploymentConfig",
"apiVersion": "v1", "apiVersion": "v1",
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}", "name": "django-frontend",
"annotations": { "annotations": {
"description": "Defines how to deploy the Django app." "description": "Defines how to deploy the application server"
} }
}, },
"spec": { "spec": {
@ -119,10 +124,11 @@
"imageChangeParams": { "imageChangeParams": {
"automatic": true, "automatic": true,
"containerNames": [ "containerNames": [
"django-quickstart" "django-example"
], ],
"from": { "from": {
"name": "django-quickstart-source:latest" "kind": "ImageStreamTag",
"name": "django-example:latest"
} }
} }
}, },
@ -132,20 +138,20 @@
], ],
"replicas": 1, "replicas": 1,
"selector": { "selector": {
"name": "${FRONTEND_SERVICE_NAME}" "name": "django-frontend"
}, },
"template": { "template": {
"metadata": { "metadata": {
"name": "${FRONTEND_SERVICE_NAME}", "name": "django-frontend",
"labels": { "labels": {
"name": "${FRONTEND_SERVICE_NAME}" "name": "django-frontend"
} }
}, },
"spec": { "spec": {
"containers": [ "containers": [
{ {
"name": "django-quickstart", "name": "django-example",
"image": "django-quickstart-source", "image": "django-example",
"ports": [ "ports": [
{ {
"containerPort": 8080 "containerPort": 8080
@ -186,42 +192,33 @@
} }
} }
} }
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "django-quickstart-source",
"annotations": {
"description": "Keeps track of changes in the Django app image."
}
}
} }
], ],
"parameters": [ "parameters": [
{ {
"name": "GIT_REPOSITORY", "name": "SOURCE_REPOSITORY_URL",
"description": "Change this to match your project's Git repository", "description": "The URL of the repository with your application source code",
"value": "git://github.com/openshift/django-ex.git" "value": "https://github.com/openshift/django-ex.git"
}, },
{ {
"name": "CONTEXT_DIR", "name": "CONTEXT_DIR",
"description": "Set this to the relative path to your project if it is not in the root of your repository" "description": "Set this to the relative path to your project if it is not in the root of your repository"
}, },
{ {
"name": "FRONTEND_SERVICE_NAME", "name": "FRONTEND_ROUTE",
"description": "Frontend service name", "description": "The exposed hostname that will route to the Django service",
"value": "django" "value": "django.app"
},
{
"name": "GITHUB_WEBHOOK_SECRET",
"description": "A secret string used to configure the GitHub webhook",
"generate": "expression",
"from": "[a-zA-Z0-9]{40}"
}, },
{ {
"name": "DATABASE_SERVICE_NAME", "name": "DATABASE_SERVICE_NAME",
"description": "Database service name" "description": "Database service name"
}, },
{
"name": "FRONTEND_ROUTE",
"description": "The exposed hostname that will route to the frontend service",
"value": "django-frontend.apps"
},
{ {
"name": "DATABASE_ENGINE", "name": "DATABASE_ENGINE",
"description": "Database engine: postgresql, mysql or sqlite (default)" "description": "Database engine: postgresql, mysql or sqlite (default)"
@ -238,11 +235,6 @@
"name": "DATABASE_PASSWORD", "name": "DATABASE_PASSWORD",
"description": "Database user password" "description": "Database user password"
}, },
{
"name": "BUILDER_IMAGE_STREAM",
"description": "Image Stream of the builder image",
"value": "python-33-centos7"
},
{ {
"name": "APP_CONFIG", "name": "APP_CONFIG",
"description": "Relative path to Gunicorn configuration file (optional)" "description": "Relative path to Gunicorn configuration file (optional)"