apiVersion: apps/v1
# ===============LICENSE_START=======================================================
# Acumos Apache-2.0
# ===================================================================================
# Copyright (C) 2017-2018 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
# ===================================================================================
# This Acumos software file is distributed by AT&T and Tech Mahindra
# under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============LICENSE_END=========================================================

# What this is: kubernetes template for Acumos kubernetes-client deployment
# How to use:
# - Replace fields in <> with actual values (k8s does not support env variables)

kind: Deployment
metadata:
  namespace: acumos
  name: kubernetes-client
  labels:
    app: kubernetes-client
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kubernetes-client
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: kubernetes-client
    spec:
      imagePullSecrets:
      - name: acumos-registry
      containers:
      - name: kubernetes-client
        image: <KUBERNETES_CLIENT_IMAGE>
        env:
        - name: SPRING_APPLICATION_JSON
          value: '{
                    "kube" : {
                      "incrementPort": "8557",
                      "singleModelPort": "8556",
                      "folderPath": "/maven/home",
                      "singleNodePort": "30333",
                      "singleTargetPort": "3330",
                      "dataBrokerModelPort": "8556",
                      "dataBrokerNodePort": "30556",
                      "dataBrokerTargetPort": "8556",
                      "mlTargetPort": "3330",
                      "nginxImageName": "nginx",
                      "nexusEndPointURL": "http://localhost:80"
                    },
                    "dockerproxy": {
                    "host": "<ACUMOS_DOCKER_PROXY_HOST>",
                    "port": "<ACUMOS_DOCKER_PROXY_PORT>"
                    },
                    "blueprint": {
                      "ImageName": "<BLUEPRINT_ORCHESTRATOR_IMAGE>",
                      "name": "blueprint-orchestrator",
                      "nodePort": "30555",
                      "port": "8555"
                    },
                    "nexus": {
                      "url": "http://<ACUMOS_NEXUS_HOST>:<ACUMOS_NEXUS_API_PORT>/repository/acumos_model_maven/",
                      "password": "<ACUMOS_RW_USER_PASSWORD>",
                      "username": "<ACUMOS_RW_USER>",
                      "groupid": "com.artifact"
                    },
                    "cmndatasvc": {
                      "cmndatasvcendpointurl": "http://cds-service:8000/ccds",
                      "cmndatasvcuser": "<ACUMOS_CDS_USER>",
                      "cmndatasvcpwd": "<ACUMOS_CDS_PASSWORD>"
                    },
                    "probe": {
                      "probeImageName": "<PROTO_VIEWER_IMAGE>",
                      "probeImagePORT": "5006",
                      "probeModelPort": "5006",
                      "probeNodePort": "30800",
                      "probeTargetPort": "5006",
                      "probeApiPort": "5006",
                      "probeExternalPort": "30800",
                      "probeSchemaPort": "80"
                    }
                  }'
        ports:
        - containerPort: 8082
        volumeMounts:
        - mountPath: /maven/logs
          name: acumos-logs
      restartPolicy: Always
      volumes:
      - name: acumos-logs
        hostPath:
          path: /var/acumos/logs
      hostAliases:
      - ip: "<ACUMOS_HOST>"
        hostnames:
        - "<ACUMOS_DOMAIN>"
