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 azure-client deployment
# How to use:
# - Replace fields in <> with actual values (k8s does not support env variables)

kind: Deployment
metadata:
  namespace: acumos
  name: azure-client
  labels:
    app: azure-client
spec:
  replicas: 1
  selector:
    matchLabels:
      app: azure-client
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: azure-client
    spec:
      imagePullSecrets:
      - name: acumos-registry
      containers:
      - name: azure-client
        image: <AZURE_CLIENT_IMAGE>
        env:
        - name: log_level
          value: "DEBUG"
        - name: SPRING_APPLICATION_JSON
          value: '{
                    "server": {
                      "port": 9081
                    },
                    "docker": {
                      "containerNamePrefix": "E6E-NSG",
                      "host": "<ACUMOS_DOMAIN>",
                      "port": "<ACUMOS_DOCKER_API_PORT>",
                      "dockerVMUserName": "<ACUMOS_DEPLOYED_VM_USER>",
                      "dockerVMPassword": "<ACUMOS_DEPLOYED_VM_PASSWORD>",
                      "replaceChar": "^",
                      "ignordoller": "TRUE",
                      "solutionPort": "<ACUMOS_DEPLOYED_SOLUTION_PORT>",
                      "subnet": "Acumos-OAM-vsubnet",
                      "vnet": "Acumos-OAM-vnet",
                      "sleepTimeFirst": "30000",
                      "sleepTimeSecond": "50000",
                      "nexusRegistyUserName": "<ACUMOS_PROJECT_NEXUS_USERNAME>",
                      "nexusRegistyPwd": "<ACUMOS_PROJECT_NEXUS_PASSWORD>",
                      "nexusRegistyName": "nexus3.acumos.org",
                      "otherRegistyName": "<ACUMOS_NEXUS_HOST>",
                      "nginxMapFolder": "/home/artifacts",
                      "nginxWebFolder": "/usr/share/nginx/html",
                      "nginxImageName": "nginx:latest",
                      "nginxInternalPort": "80",
                      "exposeDataBrokerPort": "<ACUMOS_DATA_BROKER_PORT>",
                      "internalDataBrokerPort": "<ACUMOS_DATA_BROKER_INTERNAL_PORT>",
                      "registry": {
                        "bluePrint": {
                          "username": "<ACUMOS_RW_USER>",
                          "password": "<ACUMOS_RW_USER_PASSWORD>"
                        },
                        "probe": {
                          "username": "<ACUMOS_RW_USER>",
                          "password": "<ACUMOS_RW_USER_PASSWORD>"
                        },
                        "networkgroupName": "acumos-nsg",
                        "port": "80",
                        "name": "<ACUMOS_NEXUS_HOST>:<ACUMOS_DOCKER_MODEL_PORT>",
                        "url": "http://<ACUMOS_NEXUS_HOST>:<ACUMOS_DOCKER_MODEL_PORT>/",
                        "username": "<ACUMOS_RW_USER>",
                        "password": "<ACUMOS_RW_USER_PASSWORD>"
                      }
                    },
                    "blueprint": {
                      "ImageName": "<BLUEPRINT_ORCHESTRATOR_IMAGE>",
                      "name": "blueprint-orchestrator"
                    },
                    "nexus": {
                      "url": "http://<ACUMOS_NEXUS_HOST>:<ACUMOS_NEXUS_API_PORT>/repository/acumos_model_maven/",
                      "nexusproxy": "NA",
                      "password": "<ACUMOS_RW_USER_PASSWORD>",
                      "username": "<ACUMOS_RW_USER>",
                      "groupId": "com.artifact"
                    },
                    "cmndatasvc": {
                      "cmndatasvcendpoinurl": "http://cds-service:8000/ccds",
                      "cmndatasvcuser": "<ACUMOS_CDS_USER>",
                      "cmndatasvcpwd": "<ACUMOS_CDS_PASSWORD>"
                    },
                    "probe": {
                      "ImageName": "<PROTO_VIEWER_IMAGE>",
                      "name": "proto_viewer",
                      "internalPort": "<ACUMOS_PROBE_PORT>",
                      "probeNexusEndPoint": "http://<ACUMOS_NEXUS_HOST>:<ACUMOS_NEXUS_API_PORT>/repository/acumos_model_maven"
                    }
                  }'
        ports:
        - containerPort: 9081
        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>"
