{
  "apiVersion": "v1",
  "kind": "Template",
  "metadata": {
    "annotations": {
      "openshift.io/display-name": "Red Hat Fuse 7.8 Console (cluster)",
      "openshift.io/provider-display-name": "Red Hat, Inc.",
      "description": "The Red Hat Fuse Console eases the discovery and management of Fuse applications deployed on OpenShift.",
      "tags": "hawtio,java,fis,jboss-fuse",
      "iconClass": "icon-rh-integration",
      "version": "1.8"
    },
    "labels": {
      "template": "fuse-console"
    },
    "name": "fuse78-console-cluster"
  },
  "parameters": [
    {
      "name": "APP_NAME",
      "displayName": "Application Name",
      "required": true,
      "value": "fuse78-console",
      "description": "The name assigned to the application."
    },
    {
      "name": "APP_VERSION",
      "displayName": "Application Version",
      "required": true,
      "value": "1.8",
      "description": "The application version."
    },
    {
      "name": "IMAGE_STREAM_NAMESPACE",
      "displayName": "Image Stream Namespace",
      "value": "openshift",
      "required": true,
      "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": "ROUTE_HOSTNAME",
      "description": "The externally-reachable host name that routes to the Red Hat Fuse console service",
      "required": true
    },
    {
      "name": "CPU_REQUEST",
      "displayName": "CPU request",
      "value": "0.2",
      "required": true,
      "description": "The amount of CPU to request."
    },
    {
      "name": "MEMORY_REQUEST",
      "displayName": "Memory request",
      "value": "32Mi",
      "required": true,
      "description": "The amount of memory required for the container to run."
    },
    {
      "name": "CPU_LIMIT",
      "displayName": "CPU limit",
      "value": "1.0",
      "required": true,
      "description": "The amount of CPU the container is limited to use."
    },
    {
      "name": "MEMORY_LIMIT",
      "displayName": "Memory limit",
      "value": "200Mi",
      "required": true,
      "description": "The amount of memory the container is limited to use."
    }
  ],
  "objects": [
    {
      "apiVersion": "v1",
      "kind": "ConfigMap",
      "metadata": {
        "name": "${APP_NAME}-config"
      },
      "data": {
        "hawtconfig.json": "{\n  \"about\": {\n    \"title\": \"Red Hat Fuse Console\",\n    \"productInfo\": [],\n    \"additionalInfo\": \"The Red Hat Fuse Console eases the discovery and management of Fuse applications deployed on OpenShift.\",\n    \"copyright\": \"\",\n    \"imgSrc\": \"../online/img/Logo-RedHat-A-Reverse-RGB.png\"\n  },\n  \"branding\": {\n    \"appName\": \"Fuse Console\",\n    \"appLogoUrl\": \"../online/img/Logo-Red_Hat-Fuse-A-Reverse-RGB.png\"\n  },\n  \"disabledRoutes\": []\n}\n"
      }
    },
    {
      "kind": "Route",
      "apiVersion": "v1",
      "metadata": {
        "name": "${APP_NAME}-route",
        "labels": {
          "component": "${APP_NAME}",
          "group": "console",
          "app": "${APP_NAME}",
          "version": "${APP_VERSION}"
        }
      },
      "spec": {
        "host": "${ROUTE_HOSTNAME}",
        "to": {
          "kind": "Service",
          "name": "${APP_NAME}-service"
        },
        "tls": {
          "insecureEdgeTerminationPolicy": "Redirect",
          "termination": "reencrypt"
        }
      }
    },
    {
      "kind": "Service",
      "apiVersion": "v1",
      "metadata": {
        "name": "${APP_NAME}-service",
        "labels": {
          "component": "${APP_NAME}",
          "group": "console",
          "app": "${APP_NAME}",
          "version": "${APP_VERSION}"
        },
        "annotations": {
          "service.alpha.openshift.io/serving-cert-secret-name": "${APP_NAME}-tls"
        }
      },
      "spec": {
        "ports": [
          {
            "port": 443,
            "protocol": "TCP",
            "targetPort": "nginx"
          }
        ],
        "selector": {
          "component": "${APP_NAME}",
          "group": "console",
          "app": "${APP_NAME}"
        }
      }
    },
    {
      "kind": "OAuthClient",
      "apiVersion": "v1",
      "metadata": {
        "name": "${APP_NAME}-oauth-client"
      },
      "redirectURIs": [
        "https://${ROUTE_HOSTNAME}"
      ]
    },
    {
      "kind": "DeploymentConfig",
      "apiVersion": "v1",
      "metadata": {
        "name": "${APP_NAME}",
        "creationTimestamp": null,
        "labels": {
          "component": "${APP_NAME}",
          "group": "console",
          "app": "${APP_NAME}",
          "version": "${APP_VERSION}"
        }
      },
      "spec": {
        "triggers": [
          {
            "type": "ConfigChange"
          },
          {
            "type": "ImageChange",
            "imageChangeParams": {
              "automatic": true,
              "containerNames": [
                "${APP_NAME}"
              ],
              "from": {
                "kind": "ImageStreamTag",
                "namespace": "${IMAGE_STREAM_NAMESPACE}",
                "name": "fuse7-console:${APP_VERSION}"
              }
            }
          }
        ],
        "replicas": 1,
        "selector": {
          "component": "${APP_NAME}",
          "deploymentconfig": "${APP_NAME}",
          "group": "console",
          "app": "${APP_NAME}",
          "version": "${APP_VERSION}"
        },
        "template": {
          "metadata": {
            "creationTimestamp": null,
            "labels": {
              "component": "${APP_NAME}",
              "deploymentconfig": "${APP_NAME}",
              "group": "console",
              "app": "${APP_NAME}",
              "version": "${APP_VERSION}",
              "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": {
            "containers": [
              {
                "name": "${APP_NAME}",
                "image": "fuse7-console:${APP_VERSION}",
                "readinessProbe": {
                  "httpGet": {
                    "path": "/online",
                    "port": "nginx",
                    "scheme": "HTTPS"
                  },
                  "initialDelaySeconds": 5
                },
                "livenessProbe": {
                  "httpGet": {
                    "path": "/online",
                    "port": "nginx",
                    "scheme": "HTTPS"
                  },
                  "initialDelaySeconds": 10,
                  "periodSeconds": 10
                },
                "ports": [
                  {
                    "containerPort": 8443,
                    "name": "nginx"
                  }
                ],
                "env": [
                  {
                    "name": "HAWTIO_ONLINE_MODE",
                    "value": "cluster"
                  },
                  {
                    "name": "HAWTIO_OAUTH_CLIENT_ID",
                    "value": "${APP_NAME}-oauth-client"
                  }
                ],
                "volumeMounts": [
                  {
                    "name": "${APP_NAME}-config",
                    "mountPath": "/opt/app-root/src/online/hawtconfig.json",
                    "subPath": "hawtconfig.json"
                  },
                  {
                    "name": "${APP_NAME}-config",
                    "mountPath": "/opt/app-root/src/integration/hawtconfig.json",
                    "subPath": "hawtconfig.json"
                  },
                  {
                    "mountPath": "/etc/tls/private/serving",
                    "name": "${APP_NAME}-tls"
                  }
                ],
                "resources": {
                  "requests": {
                    "cpu": "${CPU_REQUEST}",
                    "memory": "${MEMORY_REQUEST}"
                  },
                  "limits": {
                    "cpu": "${CPU_LIMIT}",
                    "memory": "${MEMORY_LIMIT}"
                  }
                }
              }
            ],
            "volumes": [
              {
                "name": "${APP_NAME}-config",
                "configMap": {
                  "name": "${APP_NAME}-config"
                }
              },
              {
                "name": "${APP_NAME}-tls",
                "secret": {
                  "secretName": "${APP_NAME}-tls"
                }
              }
            ]
          }
        }
      }
    }
  ]
}
