{
  "kind": "Template",
  "apiVersion": "v1",
  "metadata": {
    "annotations": {
      "openshift.io/display-name": "Red Hat Fuse 7.8 Camel CXF JAX-RS with EAP",
      "openshift.io/provider-display-name": "Red Hat, Inc.",
      "description": "Red Hat Fuse on EAP Camel CXF JAX-RS quickstart. This example demonstrates using the camel-cxf component to produce and consume JAX-RS REST services.",
      "tags": "quickstart,javaee,java,jboss-fuse,fis",
      "iconClass": "icon-rh-integration",
      "version": "1.8"
    },
    "name": "s2i-fuse78-eap-camel-cxf-jaxrs"
  },
  "labels": {
    "template": "s2i-fuse78-eap-camel-cxf-jaxrs"
  },
  "parameters": [
    {
      "displayName": "Application Name",
      "description": "The name for the application.",
      "name": "APP_NAME",
      "value": "s2i-fuse78-eap-camel-cxf-jaxrs",
      "required": true
    },
    {
      "displayName": "Application Version",
      "description": "The application version.",
      "name": "APP_VERSION",
      "value": "5.6.0.fuse-780029-redhat-00001",
      "required": true
    },
    {
      "displayName": "Custom http Route Hostname.",
      "description": "Custom hostname for http service route.  Leave blank for default hostname, e.g.: <application-name>-<project>.<default-domain-suffix>",
      "name": "HOSTNAME_HTTP",
      "value": "",
      "required": false
    },
    {
      "displayName": "Git Repository URL",
      "description": "Git source URI for application.",
      "name": "GIT_REPO",
      "value": "https://github.com/wildfly-extras/wildfly-camel-examples.git",
      "required": true
    },
    {
      "displayName": "Git Reference",
      "description": "Git branch/tag reference",
      "name": "GIT_REF",
      "value": "wildfly-camel-examples-5.6.0.fuse-780029-redhat-00001",
      "required": false
    },
    {
      "displayName": "Context Directory",
      "description": "Path within Git project to build; empty for root project directory.",
      "name": "CONTEXT_DIR",
      "value": "",
      "required": false
    },
    {
      "displayName": "Builder version",
      "description": "The version of the FIS S2I builder image to use.",
      "name": "BUILDER_VERSION",
      "value": "1.8"
    },
    {
      "displayName": "Queues",
      "description": "Queue names.",
      "name": "MQ_QUEUES",
      "value": "",
      "required": false
    },
    {
      "displayName": "Topics",
      "description": "Topic names.",
      "name": "MQ_TOPICS",
      "value": "",
      "required": false
    },
    {
      "displayName": "A-MQ cluster password",
      "description": "A-MQ cluster admin password.",
      "name": "MQ_CLUSTER_PASSWORD",
      "from": "[a-zA-Z0-9]{8}",
      "generate": "expression",
      "required": true
    },
    {
      "displayName": "Github Webhook Secret",
      "description": "GitHub trigger secret.",
      "name": "GITHUB_WEBHOOK_SECRET",
      "from": "[a-zA-Z0-9]{8}",
      "generate": "expression",
      "required": true
    },
    {
      "displayName": "Generic Webhook Secret",
      "description": "Generic build trigger secret.",
      "name": "GENERIC_WEBHOOK_SECRET",
      "from": "[a-zA-Z0-9]{8}",
      "generate": "expression",
      "required": true
    },
    {
      "displayName": "ImageStream Namespace",
      "description": "Namespace in which the Fuse ImageStreams 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.",
      "name": "IMAGE_STREAM_NAMESPACE",
      "value": "openshift",
      "required": true
    },
    {
      "displayName": "JGroups Cluster Password",
      "description": "JGroups cluster password.",
      "name": "JGROUPS_CLUSTER_PASSWORD",
      "from": "[a-zA-Z0-9]{8}",
      "generate": "expression",
      "required": true
    },
    {
      "displayName": "Deploy Exploded Archives",
      "description": "Controls whether exploded deployment content should be automatically deployed.",
      "name": "AUTO_DEPLOY_EXPLODED",
      "value": "false",
      "required": false
    },
    {
      "displayName": "Maven Arguments To Append",
      "description": "Additional arguments passed to mvn, e.g. for multi-module builds.",
      "name": "MAVEN_ARGS_APPEND",
      "value": "-pl camel-cxf-jaxrs -am",
      "required": false
    },
    {
      "displayName": "Maven mirror URL",
      "description": "Maven mirror to use for S2I builds.",
      "name": "MAVEN_MIRROR_URL",
      "value": "",
      "required": false
    },
    {
      "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": "ARTIFACT_DIR",
      "value": "camel-cxf-jaxrs/target",
      "required": false
    },
    {
      "displayName": "CPU request",
      "description": "The amount of CPU to request.",
      "name": "CPU_REQUEST",
      "value": "0.2",
      "required": true
    },
    {
      "displayName": "CPU limit",
      "description": "The amount of CPU the container is limited to use.",
      "name": "CPU_LIMIT",
      "value": "1.0",
      "required": true
    },
    {
      "name": "MEMORY_REQUEST",
      "displayName": "Memory request",
      "value": "256Mi",
      "required": true,
      "description": "The amount of memory required for the container to run."
    },
    {
      "name": "MEMORY_LIMIT",
      "displayName": "Memory limit",
      "value": "1Gi",
      "required": true,
      "description": "The amount of memory the container is limited to use."
    },
    {
      "name": "BUILD_MEMORY_REQUEST",
      "displayName": "Build Memory request",
      "value": "0.7G",
      "required": true,
      "description": "The amount of memory to request for builds."
    },
    {
      "name": "BUILD_MEMORY_LIMIT",
      "displayName": "Build Memory limit",
      "value": "1G",
      "required": true,
      "description": "The amount of memory the build container is limited to use."
    }
  ],
  "objects": [
    {
      "kind": "Service",
      "apiVersion": "v1",
      "spec": {
        "ports": [
          {
            "port": 8080,
            "targetPort": 8080
          }
        ],
        "selector": {
          "deploymentConfig": "${APP_NAME}"
        }
      },
      "metadata": {
        "name": "${APP_NAME}",
        "labels": {
          "app": "${APP_NAME}",
          "container": "eap",
          "component": "${APP_NAME}",
          "provider": "s2i",
          "version": "${APP_VERSION}",
          "group": "quickstarts"
        },
        "annotations": {
          "description": "The web server's http port."
        }
      }
    },
    {
      "kind": "Service",
      "apiVersion": "v1",
      "spec": {
          "clusterIP": "None",
          "ports": [
              {
                  "name": "ping",
                  "port": 8888
              }
          ],
          "selector": {
              "deploymentConfig": "${APP_NAME}"
          }
      },
      "metadata": {
          "name": "${APP_NAME}-ping",
          "labels": {
            "app": "${APP_NAME}",
            "container": "eap",
            "component": "${APP_NAME}",
            "provider": "s2i",
            "version": "${APP_VERSION}",
            "group": "quickstarts"
          },
          "annotations": {
              "service.alpha.kubernetes.io/tolerate-unready-endpoints": "true",
              "description": "The JGroups ping port for clustering."
          }
      }
    },
    {
      "kind": "Route",
      "apiVersion": "v1",
      "id": "${APP_NAME}-http",
      "metadata": {
        "name": "${APP_NAME}",
        "labels": {
          "app": "${APP_NAME}",
          "container": "eap",
          "component": "${APP_NAME}",
          "provider": "s2i",
          "version": "${APP_VERSION}",
          "group": "quickstarts"
        },
        "annotations": {
          "description": "Route for application's http service."
        }
      },
      "spec": {
        "host": "${HOSTNAME_HTTP}",
        "to": {
          "name": "${APP_NAME}"
        }
      }
    },
    {
      "kind": "ImageStream",
      "apiVersion": "v1",
      "metadata": {
        "name": "${APP_NAME}",
        "labels": {
          "app": "${APP_NAME}",
          "container": "eap",
          "component": "${APP_NAME}",
          "provider": "s2i",
          "version": "${APP_VERSION}",
          "group": "quickstarts"
        }
      }
    },
    {
      "kind": "BuildConfig",
      "apiVersion": "v1",
      "metadata": {
        "name": "${APP_NAME}",
        "labels": {
          "app": "${APP_NAME}",
          "container": "eap",
          "component": "${APP_NAME}",
          "provider": "s2i",
          "version": "${APP_VERSION}",
          "group": "quickstarts"
        }
      },
      "spec": {
        "source": {
          "type": "Git",
          "git": {
            "uri": "${GIT_REPO}",
            "ref": "${GIT_REF}"
          },
          "contextDir": "${CONTEXT_DIR}"
        },
        "strategy": {
          "type": "Source",
          "sourceStrategy": {
            "env": [
              {
                "name": "MAVEN_ARGS_APPEND",
                "value": "${MAVEN_ARGS_APPEND}"
              },
              {
                "name": "MAVEN_MIRROR_URL",
                "value": "${MAVEN_MIRROR_URL}"
              },
              {
                "name": "ARTIFACT_DIR",
                "value": "${ARTIFACT_DIR}"
              }
            ],
            "forcePull": true,
            "incremental": true,
            "from": {
              "kind": "ImageStreamTag",
              "namespace": "${IMAGE_STREAM_NAMESPACE}",
              "name": "fuse7-eap-openshift:${BUILDER_VERSION}"
            }
          }
        },
        "output": {
          "to": {
            "kind": "ImageStreamTag",
            "name": "${APP_NAME}:latest"
          }
        },
        "resources": {
          "requests": {
            "memory": "${BUILD_MEMORY_REQUEST}"
          },
          "limits": {
            "memory": "${BUILD_MEMORY_LIMIT}"
          }
        },
        "triggers": [
          {
            "type": "GitHub",
            "github": {
              "secret": "${GITHUB_WEBHOOK_SECRET}"
            }
          },
          {
            "type": "Generic",
            "generic": {
              "secret": "${GENERIC_WEBHOOK_SECRET}"
            }
          },
          {
            "type": "ImageChange",
            "imageChange": {}
          },
          {
            "type": "ConfigChange"
          }
        ]
      }
    },
    {
      "kind": "DeploymentConfig",
      "apiVersion": "v1",
      "metadata": {
        "name": "${APP_NAME}",
        "labels": {
          "app": "${APP_NAME}",
          "container": "eap",
          "component": "${APP_NAME}",
          "provider": "s2i",
          "version": "${APP_VERSION}",
          "group": "quickstarts"
        }
      },
      "spec": {
        "strategy": {
          "type": "Recreate"
        },
        "triggers": [
          {
            "type": "ImageChange",
            "imageChangeParams": {
              "automatic": true,
              "containerNames": [
                "${APP_NAME}"
              ],
              "from": {
                "kind": "ImageStreamTag",
                "name": "${APP_NAME}:latest"
              }
            }
          },
          {
            "type": "ConfigChange"
          }
        ],
        "replicas": 1,
        "selector": {
          "deploymentConfig": "${APP_NAME}"
        },
        "template": {
          "metadata": {
            "name": "${APP_NAME}",
            "labels": {
              "deploymentConfig": "${APP_NAME}",
              "app": "${APP_NAME}",
              "container": "eap",
              "component": "${APP_NAME}",
              "provider": "s2i",
              "version": "${APP_VERSION}",
              "group": "quickstarts",
              "com.company": "Red_Hat",
              "rht.prod_name": "Red_Hat_Integration",
              "rht.prod_ver": "7.8",
              "rht.comp": "${APP_NAME}",
              "rht.comp_ver": "${APP_VERSION}"
            }
          },
          "spec": {
            "terminationGracePeriodSeconds": 75,
            "containers": [
              {
                "name": "${APP_NAME}",
                "image": "${APP_NAME}",
                "imagePullPolicy": "Always",
                "livenessProbe": {
                  "exec": {
                    "command": [
                      "/bin/bash",
                      "-c",
                      "/opt/eap/bin/livenessProbe.sh"
                    ]
                  },
                  "initialDelaySeconds": 60
                },
                "readinessProbe": {
                  "exec": {
                    "command": [
                      "/bin/bash",
                      "-c",
                      "/opt/eap/bin/readinessProbe.sh"
                    ]
                  }
                },
                "ports": [
                  {
                    "name": "jolokia",
                    "containerPort": 8778,
                    "protocol": "TCP"
                  },
                  {
                    "name": "http",
                    "containerPort": 8080,
                    "protocol": "TCP"
                  },
                  {
                    "name": "ping",
                    "containerPort": 8888,
                    "protocol": "TCP"
                  }
                ],
                "env": [
                  {
                    "name": "JGROUPS_PING_PROTOCOL",
                    "value": "openshift.DNS_PING"
                  },
                  {
                    "name": "OPENSHIFT_DNS_PING_SERVICE_NAME",
                    "value": "${APP_NAME}-ping"
                  },
                  {
                    "name": "OPENSHIFT_DNS_PING_SERVICE_PORT",
                    "value": "8888"
                  },
                  {
                    "name": "MQ_CLUSTER_PASSWORD",
                    "value": "${MQ_CLUSTER_PASSWORD}"
                  },
                  {
                    "name": "MQ_QUEUES",
                    "value": "${MQ_QUEUES}"
                  },
                  {
                    "name": "MQ_TOPICS",
                    "value": "${MQ_TOPICS}"
                  },
                  {
                    "name": "JGROUPS_CLUSTER_PASSWORD",
                    "value": "${JGROUPS_CLUSTER_PASSWORD}"
                  },
                  {
                    "name": "AUTO_DEPLOY_EXPLODED",
                    "value": "${AUTO_DEPLOY_EXPLODED}"
                  }
                ],
                "resources": {
                  "requests": {
                    "cpu": "${CPU_REQUEST}",
                    "memory": "${MEMORY_REQUEST}"
                  },
                  "limits": {
                    "cpu": "${CPU_LIMIT}",
                    "memory": "${MEMORY_LIMIT}"
                  }
                }
              }
            ]
          }
        }
      }
    }
  ]
}
