{
	"kind": "Template",
	"apiVersion": "v1",
	"metadata": {
		"name": "datavirt64-ldap-s2i",
		"creationTimestamp": null,
		"annotations": {
			"description": "Application template for JBoss Data Virtualization 6.4 services that configures security domain using S2I.",
			"iconClass": "icon-datavirt",
			"openshift.io/display-name": "JBoss Data Virtualization 6.4 defining Security Domain (no SSL)",
			"openshift.io/provider-display-name": "Red Hat, Inc.",
			"tags": "jdv,datavirt,database,jboss,ldap",
			"template.openshift.io/documentation-url": "https://access.redhat.com/documentation/en/red-hat-jboss-data-virtualization/",
			"template.openshift.io/long-description": "This template defines resources needed to develop Red Hat Data Virtualization based application, configuring security domain(s), including a build configuration and application deployment configuration.",
			"template.openshift.io/support-url": "https://access.redhat.com",
			"version": "1.7.0"
		}
	},
	"message": "A new data service has been created in your project.  The username/password for accessing the service is ${TEIID_USERNAME}/${TEIID_PASSWORD}.  Please be sure to create the secret named ${CONFIGURATION_NAME} containing the datasource configuration details required by the deployed VDB(s).",
	"objects": [
		{
			"apiVersion": "v1",
			"kind": "Service",
			"metadata": {
				"annotations": {
					"description": "The data virtualization services."
				},
				"labels": {
					"application": "${APPLICATION_NAME}"
				},
				"name": "${APPLICATION_NAME}"
			},
			"spec": {
				"ports": [
					{
						"name": "http",
						"port": 8080,
						"targetPort": "http"
					},
					{
						"name": "jdbc",
						"port": 31000,
						"targetPort": "jdbc"
					},
					{
						"name": "odbc",
						"port": 35432,
						"targetPort": "odbc"
					}
				],
				"selector": {
					"deploymentConfig": "${APPLICATION_NAME}"
				}
			}
		},
		{
			"apiVersion": "v1",
			"kind": "Service",
			"metadata": {
				"annotations": {
					"description": "The JGroups ping port for clustering.",
					"service.alpha.kubernetes.io/tolerate-unready-endpoints": "true"
				},
				"labels": {
					"application": "${APPLICATION_NAME}"
				},
				"name": "${APPLICATION_NAME}-ping"
			},
			"spec": {
				"clusterIP": "None",
				"ports": [
					{
						"name": "ping",
						"port": 8888
					}
				],
				"selector": {
					"deploymentConfig": "${APPLICATION_NAME}"
				}
			}
		},
		{
			"apiVersion": "v1",
			"id": "${APPLICATION_NAME}-http",
			"kind": "Route",
			"metadata": {
				"annotations": {
					"description": "Route for application's http (REST) service."
				},
				"labels": {
					"application": "${APPLICATION_NAME}"
				},
				"name": "${APPLICATION_NAME}"
			},
			"spec": {
				"host": "${HOSTNAME_HTTP}",
				"port": {
					"targetPort": "http"
				},
				"to": {
					"name": "${APPLICATION_NAME}"
				}
			}
		},
		{
			"apiVersion": "v1",
			"kind": "ImageStream",
			"metadata": {
				"labels": {
					"application": "${APPLICATION_NAME}"
				},
				"name": "${APPLICATION_NAME}"
			}
		},
		{
			"apiVersion": "v1",
			"kind": "BuildConfig",
			"metadata": {
				"labels": {
					"application": "${APPLICATION_NAME}"
				},
				"name": "${APPLICATION_NAME}"
			},
			"spec": {
				"output": {
					"to": {
						"kind": "ImageStreamTag",
						"name": "${APPLICATION_NAME}:latest"
					}
				},
				"source": {
					"contextDir": "${CONTEXT_DIR}",
					"git": {
						"ref": "${SOURCE_REPOSITORY_REF}",
						"uri": "${SOURCE_REPOSITORY_URL}"
					},
					"type": "Git"
				},
				"strategy": {
					"sourceStrategy": {
						"env": [
							{
								"name": "MAVEN_MIRROR_URL",
								"value": "${MAVEN_MIRROR_URL}"
							},
							{
								"name": "CUSTOM_INSTALL_DIRECTORIES",
								"value": "extensions/*"
							},
							{
								"name": "VDB_DIRS",
								"value": "${VDB_DIRS}"
							},
							{
								"name": "ARTIFACT_DIR",
								"value": "${ARTIFACT_DIR}"
							}
						],
						"forcePull": true,
						"from": {
							"kind": "ImageStreamTag",
							"name": "jboss-datavirt64-openshift:1.7",
							"namespace": "${IMAGE_STREAM_NAMESPACE}"
						}
					},
					"type": "Source"
				},
				"triggers": [
					{
						"github": {
							"secret": "${GITHUB_WEBHOOK_SECRET}"
						},
						"type": "GitHub"
					},
					{
						"generic": {
							"secret": "${GENERIC_WEBHOOK_SECRET}"
						},
						"type": "Generic"
					},
					{
						"imageChange": {},
						"type": "ImageChange"
					},
					{
						"type": "ConfigChange"
					}
				]
			}
		},
		{
			"apiVersion": "v1",
			"kind": "DeploymentConfig",
			"metadata": {
				"labels": {
					"application": "${APPLICATION_NAME}"
				},
				"name": "${APPLICATION_NAME}"
			},
			"spec": {
				"replicas": 1,
				"selector": {
					"deploymentConfig": "${APPLICATION_NAME}"
				},
				"strategy": {
					"type": "Recreate"
				},
				"template": {
					"metadata": {
						"labels": {
							"application": "${APPLICATION_NAME}",
							"deploymentConfig": "${APPLICATION_NAME}"
						},
						"name": "${APPLICATION_NAME}"
					},
					"spec": {
						"containers": [
							{
								"env": [
									{
										"name": "JGROUPS_PING_PROTOCOL",
										"value": "openshift.DNS_PING"
									},
									{
										"name": "OPENSHIFT_DNS_PING_SERVICE_NAME",
										"value": "${APPLICATION_NAME}-ping"
									},
									{
										"name": "OPENSHIFT_DNS_PING_SERVICE_PORT",
										"value": "8888"
									},
									{
										"name": "HORNETQ_CLUSTER_PASSWORD",
										"value": "${HORNETQ_CLUSTER_PASSWORD}"
									},
									{
										"name": "HORNETQ_QUEUES",
										"value": "${HORNETQ_QUEUES}"
									},
									{
										"name": "HORNETQ_TOPICS",
										"value": "${HORNETQ_TOPICS}"
									},
									{
										"name": "JGROUPS_CLUSTER_PASSWORD",
										"value": "${JGROUPS_CLUSTER_PASSWORD}"
									},
									{
										"name": "AUTO_DEPLOY_EXPLODED",
										"value": "${AUTO_DEPLOY_EXPLODED}"
									},
									{
										"name": "TEIID_USERNAME",
										"value": "${TEIID_USERNAME}"
									},
									{
										"name": "TEIID_PASSWORD",
										"value": "${TEIID_PASSWORD}"
									},
									{
										"name": "ENV_FILES",
										"value": "/etc/datavirt-environment/*,/etc/datavirt-security-environment/*"
									}
								],
								"image": "${APPLICATION_NAME}",
								"imagePullPolicy": "Always",
								"livenessProbe": {
									"exec": {
										"command": [
											"/bin/bash",
											"-c",
											"/opt/eap/bin/livenessProbe.sh"
										]
									},
									"initialDelaySeconds": 60
								},
								"name": "${APPLICATION_NAME}",
								"ports": [
									{
										"containerPort": 8778,
										"name": "jolokia",
										"protocol": "TCP"
									},
									{
										"containerPort": 8080,
										"name": "http",
										"protocol": "TCP"
									},
									{
										"containerPort": 31000,
										"name": "jdbc",
										"protocol": "TCP"
									},
									{
										"containerPort": 35432,
										"name": "odbc",
										"protocol": "TCP"
									},
									{
										"containerPort": 8888,
										"name": "ping",
										"protocol": "TCP"
									}
								],
								"readinessProbe": {
									"exec": {
										"command": [
											"/bin/bash",
											"-c",
											"/opt/eap/bin/readinessProbe.sh"
										]
									}
								},
								"resources": {
									"limits": {
										"memory": "${MEMORY_LIMIT}"
									}
								},
								"volumeMounts": [
									{
										"mountPath": "/etc/datavirt-environment",
										"name": "configuration",
										"readOnly": true
									},
									{
										"mountPath": "/etc/datavirt-security-environment",
										"name": "configuration-security-domain",
										"readOnly": true
									}
								]
							}
						],
						"terminationGracePeriodSeconds": 60,
						"volumes": [
							{
								"name": "configuration",
								"secret": {
									"secretName": "${CONFIGURATION_NAME}"
								}
							},
							{
								"name": "configuration-security-domain",
								"secret": {
									"secretName": "${CONFIG_SECURITY_DOMAIN_NAME}"
								}
							}
						]
					}
				},
				"triggers": [
					{
						"imageChangeParams": {
							"automatic": true,
							"containerNames": [
								"${APPLICATION_NAME}"
							],
							"from": {
								"kind": "ImageStreamTag",
								"name": "${APPLICATION_NAME}:latest"
							}
						},
						"type": "ImageChange"
					},
					{
						"type": "ConfigChange"
					}
				]
			}
		}
	],
	"parameters": [
		{
			"name": "APPLICATION_NAME",
			"displayName": "Application Name",
			"description": "The name for the application.",
			"value": "datavirt-app",
			"required": true
		},
		{
			"name": "CONFIGURATION_NAME",
			"displayName": "Configuration Secret Name",
			"description": "The name of the secret containing configuration properties for the data sources.",
			"value": "datavirt-app-config",
			"required": true
		},
		{
			"name": "CONFIG_SECURITY_DOMAIN_NAME",
			"displayName": "Security Domain Configuration Secret Name",
			"description": "The name of the secret containing security domain configuration properties.",
			"value": "datavirt-security-config"
		},
		{
			"name": "HOSTNAME_HTTP",
			"displayName": "Custom http Route Hostname",
			"description": "Specify a custom hostname for the http route.  Leave blank to use default hostname, e.g.: \u003cservice-name\u003e-\u003cproject\u003e.\u003cdefault-domain-suffix\u003e"
		},
		{
			"name": "SOURCE_REPOSITORY_URL",
			"displayName": "Git Repository URL",
			"description": "The URL of the repository with your application source code.",
			"value": "https://github.com/jboss-openshift/openshift-quickstarts",
			"required": true
		},
		{
			"name": "SOURCE_REPOSITORY_REF",
			"displayName": "Git Reference",
			"description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch.",
			"value": "master"
		},
		{
			"name": "CONTEXT_DIR",
			"displayName": "Context Directory",
			"description": "Set this to the relative path to your project if it is not in the root of your repository.",
			"value": "datavirt64/dynamicvdb-datafederation/app"
		},
		{
			"name": "HORNETQ_QUEUES",
			"displayName": "Queues",
			"description": "Queue names"
		},
		{
			"name": "HORNETQ_TOPICS",
			"displayName": "Topics",
			"description": "Topic names"
		},
		{
			"name": "HORNETQ_CLUSTER_PASSWORD",
			"displayName": "HornetQ Password",
			"description": "HornetQ cluster admin password",
			"generate": "expression",
			"from": "[a-zA-Z0-9]{8}",
			"required": true
		},
		{
			"name": "TEIID_USERNAME",
			"displayName": "Teiid Username",
			"description": "Username associated with Teiid data service.",
			"generate": "expression",
			"from": "[\\a]{8}",
			"required": true
		},
		{
			"name": "TEIID_PASSWORD",
			"displayName": "Teiid User Password",
			"description": "Password for Teiid user.",
			"generate": "expression",
			"from": "[\\a\\A]{8}[\\d]{1}[\\A]{1}",
			"required": true
		},
		{
			"name": "GITHUB_WEBHOOK_SECRET",
			"displayName": "Github Webhook Secret",
			"description": "A secret string used to configure the GitHub webhook.",
			"generate": "expression",
			"from": "[a-zA-Z0-9]{8}",
			"required": true
		},
		{
			"name": "GENERIC_WEBHOOK_SECRET",
			"displayName": "Generic Webhook Secret",
			"description": "A secret string used to configure the Generic webhook.",
			"generate": "expression",
			"from": "[a-zA-Z0-9]{8}",
			"required": true
		},
		{
			"name": "IMAGE_STREAM_NAMESPACE",
			"displayName": "ImageStream Namespace",
			"description": "Namespace in which the ImageStreams for Red Hat Middleware images are installed. These ImageStreams are normally installed in the openshift namespace. You should only need to modify this if you've installed the ImageStreams in a different namespace/project.",
			"value": "openshift",
			"required": true
		},
		{
			"name": "JGROUPS_CLUSTER_PASSWORD",
			"displayName": "JGroups Cluster Password",
			"description": "Password used by JGroups to authenticate nodes in the cluster.",
			"generate": "expression",
			"from": "[a-zA-Z0-9]{8}",
			"required": true
		},
		{
			"name": "AUTO_DEPLOY_EXPLODED",
			"displayName": "Deploy Exploded Archives",
			"description": "Controls whether exploded deployment content should be automatically deployed",
			"value": "false"
		},
		{
			"name": "VDB_DIRS",
			"displayName": "VDB Deployment Directories",
			"description": "Comma delimited list of source directories containing VDBs for deployment"
		},
		{
			"name": "MAVEN_MIRROR_URL",
			"displayName": "Maven mirror URL",
			"description": "Maven mirror to use for S2I builds"
		},
		{
			"name": "ARTIFACT_DIR",
			"displayName": "Artifact Directories",
			"description": "List of directories from which archives will be copied into the deployment folder. If unspecified, all archives in /target will be copied."
		},
		{
			"name": "MEMORY_LIMIT",
			"description": "Container memory limit",
			"value": "1Gi"
		}
	],
	"labels": {
		"jdv64": "1.7.0",
		"template": "datavirt64-ldap-s2i"
	}
}