{ "kind": "Template", "apiVersion": "v1", "metadata": { "name": "jumpbox-server-development", "annotations": { "openshift.io/display-name": "Jumpbox Server (Development)" } }, "parameters": [ { "name": "APPLICATION_NAME", "value": "jumpbox", "required": true }, { "name": "GIT_REPOSITORY_URL", "value": "https://github.com/openshift-labs/workshop-spawner.git", "required": true }, { "name": "GIT_REPOSITORY_REF", "value": "develop", "required": true }, { "name": "WORKSHOP_MEMORY", "value": "512Mi" }, { "name": "VOLUME_SIZE", "value": "" }, { "name": "ADMIN_USERS", "value": "" }, { "name": "IDLE_TIMEOUT", "value": "7200" }, { "name": "TERMINAL_IMAGE", "value": "", "required": false }, { "name": "JUPYTERHUB_IMAGE", "value": "quay.io/jupyteronopenshift/jupyterhub:3.0.7", "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": "KEYCLOAK_USER", "generate": "expression", "from": "[a-zA-Z0-9]{8}", "required": true }, { "name": "KEYCLOAK_PASSWORD", "generate": "expression", "from": "[a-zA-Z0-9]{16}", "required": true }, { "name": "KEYCLOAK_DB_VOLUME_SIZE", "value": "1Gi", "required": true }, { "name": "KEYCLOAK_DB_PASSWORD", "generate": "expression", "from": "[a-zA-Z0-9]{16}", "required": true }, { "name": "OAUTH_CLIENT_SECRET", "generate": "expression", "from": "[a-f0-9]{32}", "required": true }, { "name": "JUPYTERHUB_HOST", "value": "" }, { "name": "KEYCLOAK_HOST", "value": "" }, { "name": "LETS_ENCRYPT", "value": "false", "required": true } ], "objects": [ { "kind": "ServiceAccount", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-hub", "labels": { "app": "${APPLICATION_NAME}" } } }, { "kind": "RoleBinding", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-edit", "labels": { "app": "${APPLICATION_NAME}" } }, "subjects": [ { "kind": "ServiceAccount", "name": "${APPLICATION_NAME}-hub" } ], "roleRef": { "name": "edit" } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-hub", "labels": { "app": "${APPLICATION_NAME}" } } }, { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-hub", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "triggers": [ { "type": "ConfigChange" }, { "type": "ImageChange" } ], "source": { "type": "Git", "git": { "uri": "${GIT_REPOSITORY_URL}", "ref": "${GIT_REPOSITORY_REF}" }, "contextDir": "jupyterhub" }, "strategy": { "type": "Source", "sourceStrategy": { "from": { "kind": "DockerImage", "name": "${JUPYTERHUB_IMAGE}" } } }, "output": { "to": { "kind": "ImageStreamTag", "name": "${APPLICATION_NAME}-hub:latest" } } } }, { "kind": "ConfigMap", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-cfg", "labels": { "app": "${APPLICATION_NAME}" } }, "data": { "jupyterhub_config.py": "${JUPYTERHUB_CONFIG}" } }, { "kind": "ConfigMap", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-env", "labels": { "app": "${APPLICATION_NAME}" } }, "data": { "terminal.sh": "${TERMINAL_ENVVARS}", "workshop.sh": "${WORKSHOP_ENVVARS}" } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "labels": { "app": "${APPLICATION_NAME}" } }, "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}", "deploymentconfig": "${APPLICATION_NAME}" }, "template": { "metadata": { "labels": { "app": "${APPLICATION_NAME}", "deploymentconfig": "${APPLICATION_NAME}" } }, "spec": { "serviceAccountName": "${APPLICATION_NAME}-hub", "containers": [ { "name": "spawner", "ports": [ { "containerPort": 8080, "protocol": "TCP" } ], "env": [ { "name": "CONFIGURATION_TYPE", "value": "jumpbox-server" }, { "name": "APPLICATION_NAME", "value": "${APPLICATION_NAME}" }, { "name": "TERMINAL_IMAGE", "value": "${TERMINAL_IMAGE}" }, { "name": "WORKSHOP_MEMORY", "value": "${WORKSHOP_MEMORY}" }, { "name": "VOLUME_SIZE", "value": "${VOLUME_SIZE}" }, { "name": "ADMIN_USERS", "value": "${ADMIN_USERS}" }, { "name": "IDLE_TIMEOUT", "value": "${IDLE_TIMEOUT}" }, { "name": "OC_VERSION", "value": "${OC_VERSION}" }, { "name": "ODO_VERSION", "value": "${ODO_VERSION}" }, { "name": "KUBECTL_VERSION", "value": "${KUBECTL_VERSION}" }, { "name": "OAUTH_CLIENT_SECRET", "value": "${OAUTH_CLIENT_SECRET}" } ], "volumeMounts": [ { "mountPath": "/opt/app-root/data", "name": "data" }, { "name": "config", "mountPath": "/opt/app-root/configs" } ] } ], "volumes": [ { "name": "data", "persistentVolumeClaim": { "claimName": "${APPLICATION_NAME}-hub-data" } }, { "name": "config", "configMap": { "name": "${APPLICATION_NAME}-cfg", "defaultMode": 420 } } ] } } } }, { "apiVersion": "v1", "kind": "PersistentVolumeClaim", "metadata": { "name": "${APPLICATION_NAME}-hub-data", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "accessModes": [ "ReadWriteOnce" ], "resources": { "requests": { "storage": "1Gi" } } } }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "ports": [ { "name": "8080-tcp", "protocol": "TCP", "port": 8080, "targetPort": 8080 }, { "name": "8081-tcp", "protocol": "TCP", "port": 8081, "targetPort": 8081 } ], "selector": { "app": "${APPLICATION_NAME}", "deploymentconfig": "${APPLICATION_NAME}" } } }, { "kind": "Route", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "annotations": { "kubernetes.io/tls-acme": "${LETS_ENCRYPT}" }, "labels": { "app": "${APPLICATION_NAME}" } }, "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}" } }, "spec": { "lookupPolicy": { "local": true }, "tags": [ { "name": "latest", "from": { "kind": "DockerImage", "name": "quay.io/openshiftlabs/workshop-terminal:2.6.1" } } ] } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-keycloak", "labels": { "app": "${APPLICATION_NAME}" } } }, { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-keycloak", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "triggers": [ { "type": "ConfigChange" }, { "type": "ImageChange" } ], "source": { "type": "Git", "git": { "uri": "${GIT_REPOSITORY_URL}", "ref": "${GIT_REPOSITORY_REF}" }, "contextDir": "keycloak" }, "strategy": { "type": "Source", "sourceStrategy": { "from": { "kind": "DockerImage", "name": "jboss/keycloak-openshift:4.0.0.Final" } } }, "output": { "to": { "kind": "ImageStreamTag", "name": "${APPLICATION_NAME}-keycloak:latest" } } } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-keycloak", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "strategy": { "type": "Recreate" }, "triggers": [ { "imageChangeParams": { "automatic": true, "containerNames": [ "keycloak" ], "from": { "kind": "ImageStreamTag", "name": "${APPLICATION_NAME}-keycloak:latest" } }, "type": "ImageChange" }, { "type": "ConfigChange" } ], "replicas": 1, "selector": { "app": "${APPLICATION_NAME}", "deploymentconfig": "${APPLICATION_NAME}-keycloak" }, "template": { "metadata": { "name": "${APPLICATION_NAME}-keycloak", "labels": { "app": "${APPLICATION_NAME}", "deploymentconfig": "${APPLICATION_NAME}-keycloak" } }, "spec": { "serviceAccountName": "${APPLICATION_NAME}-hub", "containers": [ { "name": "keycloak", "ports": [ { "containerPort": 8080, "protocol": "TCP" }, { "containerPort": 8443, "protocol": "TCP" } ], "resources": { "limits": { "memory": "1Gi" } }, "env": [ { "name": "JUPYTERHUB_SERVICE_NAME", "value": "${APPLICATION_NAME}" }, { "name": "OAUTH_CLIENT_SECRET", "value": "${OAUTH_CLIENT_SECRET}" }, { "name": "KEYCLOAK_USER", "value": "${KEYCLOAK_USER}" }, { "name": "KEYCLOAK_PASSWORD", "value": "${KEYCLOAK_PASSWORD}" }, { "name": "DB_VENDOR", "value": "postgres" }, { "name": "DB_ADDR", "value": "${APPLICATION_NAME}-keycloak-db" }, { "name": "DB_PORT", "value": "5432" }, { "name": "DB_DATABASE", "value": "keycloak" }, { "name": "DB_USER", "value": "keycloak" }, { "name": "DB_PASSWORD", "value": "${KEYCLOAK_DB_PASSWORD}" }, { "name": "PROXY_ADDRESS_FORWARDING", "value": "true" } ] } ] } } } }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-keycloak", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "ports": [ { "name": "8080-tcp", "protocol": "TCP", "port": 8080, "targetPort": 8080 }, { "name": "8443-tcp", "protocol": "TCP", "port": 8443, "targetPort": 8443 } ], "selector": { "app": "${APPLICATION_NAME}", "deploymentconfig": "${APPLICATION_NAME}-keycloak" } } }, { "kind": "Route", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-keycloak", "annotations": { "kubernetes.io/tls-acme": "${LETS_ENCRYPT}" }, "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "host": "${KEYCLOAK_HOST}", "to": { "kind": "Service", "name": "${APPLICATION_NAME}-keycloak", "weight": 100 }, "port": { "targetPort": "8080-tcp" }, "tls": { "termination": "edge" } } }, { "kind": "PersistentVolumeClaim", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-keycloak-data", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "accessModes": [ "ReadWriteOnce" ], "resources": { "requests": { "storage": "${KEYCLOAK_DB_VOLUME_SIZE}" } } } }, { "apiVersion": "v1", "kind": "DeploymentConfig", "metadata": { "name": "${APPLICATION_NAME}-keycloak-db", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "replicas": 1, "selector": { "app": "${APPLICATION_NAME}", "deploymentconfig": "${APPLICATION_NAME}-keycloak-db" }, "strategy": { "type": "Recreate" }, "template": { "metadata": { "labels": { "app": "${APPLICATION_NAME}", "deploymentconfig": "${APPLICATION_NAME}-keycloak-db" } }, "spec": { "containers": [ { "name": "postgresql", "env": [ { "name": "POSTGRESQL_USER", "value": "keycloak" }, { "name": "POSTGRESQL_PASSWORD", "value": "${KEYCLOAK_DB_PASSWORD}" }, { "name": "POSTGRESQL_DATABASE", "value": "keycloak" } ], "livenessProbe": { "tcpSocket": { "port": 5432 } }, "ports": [ { "containerPort": 5432, "protocol": "TCP" } ], "readinessProbe": { "exec": { "command": [ "/bin/sh", "-i", "-c", "psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c 'SELECT 1'" ] } }, "volumeMounts": [ { "mountPath": "/var/lib/pgsql/data", "name": "data" } ] } ], "volumes": [ { "name": "data", "persistentVolumeClaim": { "claimName": "${APPLICATION_NAME}-keycloak-data" } } ] } }, "triggers": [ { "imageChangeParams": { "automatic": true, "containerNames": [ "postgresql" ], "from": { "kind": "ImageStreamTag", "name": "postgresql:9.6", "namespace": "openshift" } }, "type": "ImageChange" }, { "type": "ConfigChange" } ] } }, { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}-keycloak-db", "labels": { "app": "${APPLICATION_NAME}" } }, "spec": { "ports": [ { "name": "5432-tcp", "protocol": "TCP", "port": 5432, "targetPort": 5432 } ], "selector": { "app": "${APPLICATION_NAME}", "deploymentconfig": "${APPLICATION_NAME}-keycloak-db" } } } ] }