Skip to content

Instantly share code, notes, and snippets.

@tqvarnst
Last active September 16, 2018 19:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tqvarnst/c90c345593c882d21671 to your computer and use it in GitHub Desktop.
Save tqvarnst/c90c345593c882d21671 to your computer and use it in GitHub Desktop.
An example template for accessing JBoss Data Grid via Hot Rod using a JBoss EAP application
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"annotations": {
"iconClass": "icon-jboss",
"description": "Application template Todo task list application",
"tags": "datagrid,jboss,xpaas",
"version": "1.2.0"
},
"name": "todo"
},
"labels": {
"template": "todo",
"xpaas": "1.2.0"
},
"parameters": [
{
"description": "The name for the application.",
"name": "APPLICATION_NAME",
"value": "todo",
"required": true
}
],
"objects": [
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "jboss-datagrid65-openshift"
},
"spec": {
"dockerImageRepository": "registry.access.redhat.com/jboss-datagrid-6/datagrid65-openshift",
"tags": [
{
"name": "1.2",
"annotations": {
"description": "JBoss JDG 6.5 S2I images.",
"iconClass": "icon-jboss",
"tags": "datagrid,java,jboss,xpaas",
"supports":"datagrid:6.5,java:8,xpaas:1.2",
"version": "1.2"
}
}
]
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "jboss-eap64-openshift"
},
"spec": {
"dockerImageRepository": "registry.access.redhat.com/jboss-eap-6/eap64-openshift",
"tags": [
{
"name": "1.2",
"annotations": {
"description": "JBoss EAP 6.4 S2I images.",
"iconClass": "icon-jboss",
"supports": "eap:6.4,javaee:6,java:8,xpaas:1.2",
"tags": "builder,eap,javaee,java,jboss,xpaas",
"version": "1.2"
}
}
]
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-app",
"labels": {
"application": "${APPLICATION_NAME}-app"
}
}
},
{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-app",
"creationTimestamp": null,
"labels": {
"application": "${APPLICATION_NAME}-app"
}
},
"spec": {
"triggers": [
{
"type": "GitHub",
"github": {
"secret": "LBTFDkC4poV1nRcAx8v-"
}
},
{
"type": "Generic",
"generic": {
"secret": "z7m4q9VVEhRsuBwcBG1M"
}
},
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChange": {}
}
],
"source": {
"type": "Git",
"git": {
"uri": "https://github.com/tqvarnst/datagrid-xpaas-demo-app.git",
"ref": "master"
}
},
"strategy": {
"type": "Source",
"sourceStrategy": {
"from": {
"kind": "ImageStreamTag",
"name": "jboss-eap64-openshift:1.2"
}
}
},
"output": {
"to": {
"kind": "ImageStreamTag",
"name": "${APPLICATION_NAME}-app:latest"
}
}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-app",
"labels": {
"application": "${APPLICATION_NAME}-app"
},
"annotations": {
"description": "The application server's http port."
}
},
"spec": {
"ports": [
{
"port": 8080,
"targetPort": 8080
}
],
"selector": {
"application": "${APPLICATION_NAME}-app",
"deploymentConfig": "${APPLICATION_NAME}-app"
},
"type": "ClusterIP",
"sessionAffinity": "None"
}
},
{
"kind": "Route",
"apiVersion": "v1",
"id": "${APPLICATION_NAME}-http",
"metadata": {
"name": "${APPLICATION_NAME}-app",
"labels": {
"application": "${APPLICATION_NAME}-app"
},
"annotations": {
"description": "Route for application's http service."
}
},
"spec": {
"host": "",
"to": {
"name": "${APPLICATION_NAME}-app"
}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"spec": {
"ports": [
{
"port": 11333,
"targetPort": 11333
}
],
"selector": {
"deploymentConfig": "${APPLICATION_NAME}-datagrid"
}
},
"metadata": {
"name": "${APPLICATION_NAME}-datagrid-hotrod",
"labels": {
"application": "${APPLICATION_NAME}-datagrid"
},
"annotations": {
"description": "Hot Rod service for clustered applications."
}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-app",
"labels": {
"application": "${APPLICATION_NAME}-app"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"${APPLICATION_NAME}-app"
],
"from": {
"kind": "ImageStreamTag",
"name": "${APPLICATION_NAME}-app:latest"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"deploymentConfig": "${APPLICATION_NAME}-app"
},
"template": {
"metadata": {
"name": "${APPLICATION_NAME}-app",
"labels": {
"application": "${APPLICATION_NAME}-app",
"deploymentConfig": "${APPLICATION_NAME}-app"
}
},
"spec": {
"terminationGracePeriodSeconds": 60,
"containers": [
{
"name": "${APPLICATION_NAME}-app",
"image": "${APPLICATION_NAME}-app",
"imagePullPolicy": "Always",
"livenessProbe": {
"exec": {
"command": [
"/bin/bash",
"-c",
"/opt/eap/bin/livenessProbe.sh"
]
}
},
"readinessProbe": {
"exec": {
"command": [
"/bin/bash",
"-c",
"/opt/eap/bin/readinessProbe.sh"
]
}
},
"ports": [
{
"containerPort": 8080,
"protocol": "TCP"
},
{
"containerPort": 8443,
"protocol": "TCP"
}
],
"env": [
{
"name": "OPENSHIFT_KUBE_PING_LABELS",
"value": "application=${APPLICATION_NAME}-app"
},
{
"name": "OPENSHIFT_KUBE_PING_NAMESPACE",
"valueFrom": {
"fieldRef": {
"fieldPath": "metadata.namespace"
}
}
},
{
"name": "JDG_SERVICE_NAME",
"value": "${APPLICATION_NAME}_DATAGRID"
}
]
}
]
}
}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "${APPLICATION_NAME}-datagrid",
"labels": {
"application": "${APPLICATION_NAME}-datagrid"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"${APPLICATION_NAME}-datagrid"
],
"from": {
"kind": "ImageStreamTag",
"name": "jboss-datagrid65-openshift:1.2"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"deploymentConfig": "${APPLICATION_NAME}-datagrid"
},
"template": {
"metadata": {
"name": "${APPLICATION_NAME}-datagrid",
"labels": {
"deploymentConfig": "${APPLICATION_NAME}-datagrid",
"application": "${APPLICATION_NAME}-datagrid"
}
},
"spec": {
"terminationGracePeriodSeconds": 60,
"containers": [
{
"name": "${APPLICATION_NAME}-datagrid",
"image": "jboss-datagrid65-openshift",
"imagePullPolicy": "Always",
"livenessProbe": {
"exec": {
"command": [
"/bin/bash",
"-c",
"/opt/datagrid/bin/livenessProbe.sh"
]
}
},
"readinessProbe": {
"exec": {
"command": [
"/bin/bash",
"-c",
"/opt/datagrid/bin/readinessProbe.sh"
]
}
},
"ports": [
{
"name": "jolokia",
"containerPort": 8778,
"protocol": "TCP"
},
{
"name": "http",
"containerPort": 8080,
"protocol": "TCP"
},
{
"name": "ping",
"containerPort": 8888,
"protocol": "TCP"
},
{
"name": "memcached",
"containerPort": 11211,
"protocol": "TCP"
},
{
"name": "hotrod",
"containerPort": 11222,
"protocol": "TCP"
}
],
"env": [
{
"name": "USERNAME",
"value": ""
},
{
"name": "PASSWORD",
"value": ""
},
{
"name": "OPENSHIFT_KUBE_PING_LABELS",
"value": "application=${APPLICATION_NAME}-datagrid"
},
{
"name": "OPENSHIFT_KUBE_PING_NAMESPACE",
"valueFrom": {
"fieldRef": {
"fieldPath": "metadata.namespace"
}
}
},
{
"name": "INFINISPAN_CONNECTORS",
"value": "hotrod"
},
{
"name": "CACHE_NAMES",
"value": ""
},
{
"name": "ENCRYPTION_REQUIRE_SSL_CLIENT_AUTH",
"value": ""
},
{
"name": "HOTROD_SERVICE_NAME",
"value": "${APPLICATION_NAME}-datagrid-hotrod"
},
{
"name": "MEMCACHED_CACHE",
"value": "SYNC"
},
{
"name": "REST_SECURITY_DOMAIN",
"value": ""
},
{
"name": "JGROUPS_CLUSTER_PASSWORD",
"value": "jgroups-123"
}
]
}
]
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment