Skip to content

Instantly share code, notes, and snippets.

@slaskawi
Created September 12, 2018 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaskawi/57ed810a7109a02a9d884b61ce2e7f13 to your computer and use it in GitHub Desktop.
Save slaskawi/57ed810a7109a02a9d884b61ce2e7f13 to your computer and use it in GitHub Desktop.
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"name": "keycloak",
"annotations": {
"iconClass": "icon-sso",
"tags": "keycloak",
"version": "4.0.0.Beta2",
"openshift.io/display-name": "Keycloak",
"description": "An example Keycloak server with HTTPS"
}
},
"parameters": [
{
"displayName": "Application Name",
"description": "The name for the application.",
"name": "APPLICATION_NAME",
"value": "keycloak",
"required": true
},
{
"displayName": "Keycloak Administrator Username",
"description": "Keycloak Server administrator username",
"name": "KEYCLOAK_USER",
"from": "[a-zA-Z0-9]{8}",
"generate": "expression",
"required": true
},
{
"displayName": "Keycloak Administrator Password",
"description": "Keycloak Server administrator password",
"name": "KEYCLOAK_PASSWORD",
"from": "[a-zA-Z0-9]{8}",
"generate": "expression",
"required": true
},
{
"displayName": "DB Vendor",
"description": "DB vendor (H2, POSTGRES, MYSQL or MARIADB)",
"name": "DB_VENDOR",
"value": "H2",
"required": true
},
{
"displayName": "Proxy Address Forwarding",
"description": "Enable proxy address forwarding",
"name": "PROXY_ADDRESS_FORWARDING",
"value": "true",
"required": true
},
{
"displayName": "Keycloak log level",
"description": "Keycloak log level",
"name": "KEYCLOAK_LOGLEVEL",
"value": "DEBUG",
"required": true
},
{
"displayName": "Custom https Route Hostname",
"description": "Custom hostname for https service route. Leave blank for default hostname, e.g.: <application-name>.<project>.<default-domain-suffix>",
"name": "HOSTNAME_HTTPS",
"value": "",
"required": false
}
],
"objects": [
{
"kind": "Service",
"apiVersion": "v1",
"spec": {
"ports": [
{
"port": 8443,
"targetPort": 8443
}
],
"selector": {
"deploymentConfig": "${APPLICATION_NAME}"
}
},
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"application": "${APPLICATION_NAME}"
},
"annotations": {
"description": "The web server's https port.",
"service.alpha.openshift.io/serving-cert-secret-name": "keycloak-x509-https-secret"
}
}
},
{
"kind": "Route",
"apiVersion": "v1",
"id": "${APPLICATION_NAME}",
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"application": "${APPLICATION_NAME}"
},
"annotations": {
"description": "Route for application's https service."
}
},
"spec": {
"host": "${HOSTNAME_HTTPS}",
"to": {
"name": "${APPLICATION_NAME}"
},
"tls": {
"termination": "passthrough"
}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"application": "${APPLICATION_NAME}"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"deploymentConfig": "${APPLICATION_NAME}"
},
"template": {
"metadata": {
"name": "${APPLICATION_NAME}",
"labels": {
"deploymentConfig": "${APPLICATION_NAME}",
"application": "${APPLICATION_NAME}"
}
},
"spec": {
"containers": [
{
"name": "${APPLICATION_NAME}",
"image": "jboss/keycloak:master",
"imagePullPolicy": "Always",
"args": ["-Djavax.net.debug=ssl:handshake:verbose", "-b", "0.0.0.0", "--debug"],
"ports": [
{
"containerPort": 8080,
"protocol": "TCP"
},
{
"name": "https",
"containerPort": 8443,
"protocol": "TCP"
}
],
"env": [
{
"name": "KEYCLOAK_USER",
"value": "${KEYCLOAK_USER}"
},
{
"name": "KEYCLOAK_PASSWORD",
"value": "${KEYCLOAK_PASSWORD}"
},
{
"name": "DB_VENDOR",
"value": "${DB_VENDOR}"
},
{
"name": "PROXY_ADDRESS_FORWARDING",
"value": "${PROXY_ADDRESS_FORWARDING}"
},
{
"name": "KEYCLOAK_LOGLEVEL",
"value": "${KEYCLOAK_LOGLEVEL}"
},
{
"name": "X509_CA_BUNDLE",
"value": "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt"
}
],
"securityContext": {
"privileged": false
},
"volumeMounts": [
{
"name": "keycloak-x509-https-volume",
"mountPath": "/etc/x509/https",
"readOnly": true
}
],
"readinessProbe": {
"httpGet": {
"path": "/auth/realms/master",
"port": 8080
},
"initialDelaySeconds": 10,
"periodSeconds": 10,
"timeoutSeconds": 1,
"failureThreshold": 5
}
}
],
"volumes": [
{
"name": "keycloak-x509-https-volume",
"secret": {
"secretName": "keycloak-x509-https-secret"
}
}
]
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment