{
    "apiVersion": "v1",
    "kind": "Template",
    "labels": {
        "template": "eap-cd-starter-s2i",
        "xpaas": "17.0"
    },
    "message": "A new JBoss EAP CD based application has been created in your project.",
    "metadata": {
        "annotations": {
            "description": "An example JBoss Enterprise Application Platform continuous delivery application. For more information about using this template, see https://github.com/jboss-container-images/jboss-eap-7-openshift-image/blob/eap-cd/README.adoc",
            "iconClass": "icon-eap",
            "openshift.io/display-name": "JBoss EAP CD 17 Starter",
            "openshift.io/provider-display-name": "Red Hat, Inc.",
            "tags": "eap,javaee,java,jboss",
            "template.openshift.io/documentation-url": "https://access.redhat.com/documentation/en/red-hat-jboss-enterprise-application-platform/",
            "template.openshift.io/long-description": "This template defines resources needed to develop a JBoss Enterprise Application Platform continuous delivery based application, including a build configuration, application deployment configuration and secure communication using edge TLS.",
            "template.openshift.io/support-url": "https://access.redhat.com",
            "version": "17.0"
        },
        "name": "eap-cd-starter-s2i"
    },
    "objects": [
        {
            "apiVersion": "v1",
            "kind": "Service",
            "metadata": {
                "annotations": {
                    "description": "The web server's http port."
                },
                "labels": {
                    "application": "${APPLICATION_NAME}"
                },
                "name": "${APPLICATION_NAME}"
            },
            "spec": {
                "ports": [
                    {
                        "port": 8080,
                        "targetPort": 8080
                    }
                ],
                "selector": {
                    "deploymentConfig": "${APPLICATION_NAME}"
                }
            }
        },
        {
            "apiVersion": "v1",
            "id": "${APPLICATION_NAME}-https",
            "kind": "Route",
            "metadata": {
                "annotations": {
                    "description": "Route for application's https service."
                },
                "labels": {
                    "application": "${APPLICATION_NAME}"
                },
                "name": "${APPLICATION_NAME}"
            },
            "spec": {
                "tls": {
                    "insecureEdgeTerminationPolicy": "Redirect",
                    "termination": "edge"
                },
                "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": "MAVEN_ARGS_APPEND",
                                "value": "${MAVEN_ARGS_APPEND}"
                            },
                            {
                                "name": "ARTIFACT_DIR",
                                "value": "${ARTIFACT_DIR}"
                            }
                        ],
                        "forcePull": true,
                        "from": {
                            "kind": "ImageStreamTag",
                            "name": "eap-cd-openshift:17",
                            "namespace": "${IMAGE_STREAM_NAMESPACE}"
                        },
                        "incremental": true
                    },
                    "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": "AUTO_DEPLOY_EXPLODED",
                                        "value": "${AUTO_DEPLOY_EXPLODED}"
                                    }
                                ],
                                "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"
                                    }
                                ],
                                "readinessProbe": {
                                    "exec": {
                                        "command": [
                                            "/bin/bash",
                                            "-c",
                                            "/opt/eap/bin/readinessProbe.sh"
                                        ]
                                    },
                                    "initialDelaySeconds": 10
                                },
                                "resources": {
                                    "limits": {
                                        "memory": "${MEMORY_LIMIT}"
                                    }
                                }
                            }
                        ],
                        "terminationGracePeriodSeconds": 75
                    }
                },
                "triggers": [
                    {
                        "imageChangeParams": {
                            "automatic": true,
                            "containerNames": [
                                "${APPLICATION_NAME}"
                            ],
                            "from": {
                                "kind": "ImageStreamTag",
                                "name": "${APPLICATION_NAME}:latest"
                            }
                        },
                        "type": "ImageChange"
                    },
                    {
                        "type": "ConfigChange"
                    }
                ]
            }
        }
    ],
    "parameters": [
        {
            "description": "The name for the application.",
            "displayName": "Application Name",
            "name": "APPLICATION_NAME",
            "required": true,
            "value": "eap-app"
        },
        {
            "description": "Git source URI for application",
            "displayName": "Git Repository URL",
            "name": "SOURCE_REPOSITORY_URL",
            "required": true,
            "value": "https://github.com/jboss-developer/jboss-eap-quickstarts.git"
        },
        {
            "description": "Git branch/tag reference",
            "displayName": "Git Reference",
            "name": "SOURCE_REPOSITORY_REF",
            "required": false,
            "value": "openshift"
        },
        {
            "description": "Path within Git project to build; empty for root project directory.",
            "displayName": "Context Directory",
            "name": "CONTEXT_DIR",
            "required": false,
            "value": "kitchensink"
        },
        {
            "description": "GitHub trigger secret",
            "displayName": "Github Webhook Secret",
            "from": "[a-zA-Z0-9]{8}",
            "generate": "expression",
            "name": "GITHUB_WEBHOOK_SECRET",
            "required": true
        },
        {
            "description": "Generic build trigger secret",
            "displayName": "Generic Webhook Secret",
            "from": "[a-zA-Z0-9]{8}",
            "generate": "expression",
            "name": "GENERIC_WEBHOOK_SECRET",
            "required": true
        },
        {
            "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.",
            "displayName": "ImageStream Namespace",
            "name": "IMAGE_STREAM_NAMESPACE",
            "required": true,
            "value": "openshift"
        },
        {
            "description": "Controls whether exploded deployment content should be automatically deployed",
            "displayName": "Deploy Exploded Archives",
            "name": "AUTO_DEPLOY_EXPLODED",
            "required": false,
            "value": "false"
        },
        {
            "description": "Maven mirror to use for S2I builds",
            "displayName": "Maven mirror URL",
            "name": "MAVEN_MIRROR_URL",
            "required": false,
            "value": ""
        },
        {
            "description": "Maven additional arguments to use for S2I builds",
            "displayName": "Maven Additional Arguments",
            "name": "MAVEN_ARGS_APPEND",
            "required": false,
            "value": "-Dcom.redhat.xpaas.repo.jbossorg"
        },
        {
            "description": "List of directories from which archives will be copied into the deployment folder. If unspecified, all archives in /target will be copied.",
            "name": "ARTIFACT_DIR",
            "required": false,
            "value": ""
        },
        {
            "description": "Container memory limit",
            "name": "MEMORY_LIMIT",
            "required": false,
            "value": "1Gi"
        }
    ]
}