Skip to content

Instantly share code, notes, and snippets.

@wgordon17
Created April 25, 2019 18:30
Show Gist options
  • Save wgordon17/127c6456b71041606365646ec1994bad to your computer and use it in GitHub Desktop.
Save wgordon17/127c6456b71041606365646ec1994bad to your computer and use it in GitHub Desktop.
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"name": "learning-portal-production",
"annotations": {
"openshift.io/display-name": "Learning Portal (Production)"
}
},
"parameters": [
{
"name": "PROJECT_NAME",
"value": "",
"required": true
},
{
"name": "APPLICATION_NAME",
"value": "portal",
"required": true
},
{
"name": "WORKSHOP_MEMORY",
"value": "512Mi"
},
{
"name": "CONSOLE_MEMORY",
"value": "128Mi"
},
{
"name": "SERVER_LIMIT",
"value": "8"
},
{
"name": "IDLE_TIMEOUT",
"value": "300"
},
{
"name": "MAX_SESSION_AGE",
"value": "3600"
},
{
"name": "RESOURCE_BUDGET",
"value": "default",
"required": true
},
{
"name": "TERMINAL_IMAGE",
"value": "",
"required": false
},
{
"name": "SPAWNER_IMAGE",
"value": "quay.io/openshiftlabs/workshop-spawner:3.0.5",
"required": true
},
{
"name": "TERMINAL_ENVVARS",
"value": ""
},
{
"name": "WORKSHOP_ENVVARS",
"value": ""
},
{
"name": "OC_VERSION",
"value": ""
},
{
"name": "ODO_VERSION",
"value": ""
},
{
"name": "KUBECTL_VERSION",
"value": ""
},
{
"name": "JUPYTERHUB_CONFIG",
"value": "",
"required": false
},
{
"name": "SPAWNER_RULES",
"value": "[]",
"required": true
},
{
"name": "EXTRA_RESOURCES",
"value": ""
},
{
"name": "SESSION_RULES",
"value": "[]",
"required": true
},
{
"name": "EXPOSED_PORTS",
"value": ""
},
{
"name": "HOMEROOM_LINK",
"value": ""
},
{
"name": "JUPYTERHUB_HOST",
"value": ""
},
{
"name": "LETS_ENCRYPT",
"value": "false",
"required": true
}
],
"objects": [
{
"kind": "ServiceAccount",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-${PROJECT_NAME}-hub",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
}
},
{
"kind": "RoleBinding",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-edit",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "${APPLICATION_NAME}-${PROJECT_NAME}-hub"
}
],
"roleRef": {
"name": "edit"
}
},
{
"kind": "ClusterRoleBinding",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-${PROJECT_NAME}-spawner",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "${APPLICATION_NAME}-${PROJECT_NAME}-hub",
"namespace": "${PROJECT_NAME}"
}
],
"roleRef": {
"name": "dedicated-cluster-admin"
}
},
{
"kind": "ClusterRoleBinding",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-${PROJECT_NAME}-spawner-rules",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "${APPLICATION_NAME}-${PROJECT_NAME}-hub",
"namespace": "${PROJECT_NAME}"
}
],
"roleRef": {
"name": "dedicated-cluster-admin"
}
},
{
"kind": "ClusterRoleBinding",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-${PROJECT_NAME}-session-rules",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"subjects": [
{
"kind": "ServiceAccount",
"name": "${APPLICATION_NAME}-${PROJECT_NAME}-hub",
"namespace": "${PROJECT_NAME}"
}
],
"roleRef": {
"name": "dedicated-cluster-admin"
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-hub",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"spec": {
"tags": [
{
"name": "latest",
"from": {
"kind": "DockerImage",
"name": "${SPAWNER_IMAGE}"
}
}
]
}
},
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-cfg",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"data": {
"jupyterhub_config.py": "${JUPYTERHUB_CONFIG}"
}
},
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-res",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"data": {
"extra_resources.json": "${EXTRA_RESOURCES}"
}
},
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-env",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"data": {
"terminal.sh": "${TERMINAL_ENVVARS}",
"workshop.sh": "${WORKSHOP_ENVVARS}"
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"spawner"
],
"from": {
"kind": "ImageStreamTag",
"name": "${APPLICATION_NAME}-hub:latest"
}
}
}
],
"replicas": 1,
"selector": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"deploymentconfig": "${APPLICATION_NAME}"
},
"template": {
"metadata": {
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"deploymentconfig": "${APPLICATION_NAME}"
}
},
"spec": {
"serviceAccountName": "${APPLICATION_NAME}-${PROJECT_NAME}-hub",
"containers": [
{
"name": "spawner",
"ports": [
{
"containerPort": 8080,
"protocol": "TCP"
}
],
"env": [
{
"name": "CONFIGURATION_TYPE",
"value": "learning-portal"
},
{
"name": "APPLICATION_NAME",
"value": "${APPLICATION_NAME}"
},
{
"name": "TERMINAL_IMAGE",
"value": "${TERMINAL_IMAGE}"
},
{
"name": "SERVER_LIMIT",
"value": "${SERVER_LIMIT}"
},
{
"name": "WORKSHOP_MEMORY",
"value": "${WORKSHOP_MEMORY}"
},
{
"name": "CONSOLE_MEMORY",
"value": "${CONSOLE_MEMORY}"
},
{
"name": "IDLE_TIMEOUT",
"value": "${IDLE_TIMEOUT}"
},
{
"name": "MAX_SESSION_AGE",
"value": "${MAX_SESSION_AGE}"
},
{
"name": "RESOURCE_BUDGET",
"value": "${RESOURCE_BUDGET}"
},
{
"name": "OC_VERSION",
"value": "${OC_VERSION}"
},
{
"name": "ODO_VERSION",
"value": "${ODO_VERSION}"
},
{
"name": "KUBECTL_VERSION",
"value": "${KUBECTL_VERSION}"
},
{
"name": "EXPOSED_PORTS",
"value": "${EXPOSED_PORTS}"
},
{
"name": "HOMEROOM_LINK",
"value": "${HOMEROOM_LINK}"
}
],
"volumeMounts": [
{
"mountPath": "/opt/app-root/data",
"name": "data"
},
{
"name": "config",
"mountPath": "/opt/app-root/configs"
},
{
"name": "resources",
"mountPath": "/opt/app-root/resources"
}
]
}
],
"volumes": [
{
"name": "data",
"persistentVolumeClaim": {
"claimName": "${APPLICATION_NAME}-hub-data"
}
},
{
"name": "config",
"configMap": {
"name": "${APPLICATION_NAME}-cfg",
"defaultMode": 420
}
},
{
"name": "resources",
"configMap": {
"name": "${APPLICATION_NAME}-res",
"defaultMode": 420
}
}
]
}
}
}
},
{
"apiVersion": "v1",
"kind": "PersistentVolumeClaim",
"metadata": {
"name": "${APPLICATION_NAME}-hub-data",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "1Gi"
}
}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"spec": {
"ports": [
{
"name": "8080-tcp",
"protocol": "TCP",
"port": 8080,
"targetPort": 8080
},
{
"name": "8081-tcp",
"protocol": "TCP",
"port": 8081,
"targetPort": 8081
}
],
"selector": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"deploymentconfig": "${APPLICATION_NAME}"
}
}
},
{
"kind": "Route",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}",
"annotations": {
"kubernetes.io/tls-acme": "${LETS_ENCRYPT}"
},
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"spec": {
"host": "${JUPYTERHUB_HOST}",
"to": {
"kind": "Service",
"name": "${APPLICATION_NAME}",
"weight": 100
},
"port": {
"targetPort": "8080-tcp"
},
"tls": {
"termination": "edge",
"insecureEdgeTerminationPolicy": "Redirect"
}
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-app",
"labels": {
"app": "${APPLICATION_NAME}-${PROJECT_NAME}",
"spawner": "learning-portal"
}
},
"spec": {
"lookupPolicy": {
"local": true
},
"tags": [
{
"name": "latest",
"from": {
"kind": "DockerImage",
"name": "quay.io/openshiftlabs/workshop-dashboard:2.10.2"
}
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment