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

kind: Deployment
metadata:
  namespace: acumos
  name: onboarding
  labels:
    app: onboarding
spec:
  replicas: 1
  selector:
    matchLabels:
      app: onboarding
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: onboarding
    spec:
      imagePullSecrets:
      - name: acumos-registry
      containers:
      - name: onboarding
        image: <ONBOARDING_IMAGE>
        env:
        env:
        - name: SPRING_APPLICATION_JSON
          value: '{
                   "server":{
                     "port": 8090
                   },
                   "docker": {
                     "host": "<ACUMOS_DOMAIN>",
                     "port": "<ACUMOS_DOCKER_API_PORT>",
                     "config": "/docker_host/.docker",
                     "registry":{
                       "url": "http://<ACUMOS_NEXUS_HOST>:<ACUMOS_DOCKER_MODEL_PORT>/",
                       "username": "<ACUMOS_RW_USER>",
                       "password": "<ACUMOS_RW_USER_PASSWORD>",
                       "email": "acumos@example.com"
                     },
                     "tls": {
                       "verify": "false"
                     },
                     "api": {
                       "version": "1.23"
                     },
                     "imagetag": {
                       "prefix": "<ACUMOS_NEXUS_HOST>:<ACUMOS_DOCKER_MODEL_PORT>"
                     },
                     "max_total_connections": "1",
                     "max_per_route_connections": "1"
                   },
                   "http_proxy": "\"\"",
                   "nexus": {
                     "nexusEndPointURL": "http://<ACUMOS_NEXUS_HOST>:<ACUMOS_NEXUS_API_PORT>/repository/acumos_model_maven/",
                     "nexusUserName": "<ACUMOS_RW_USER>",
                     "nexusPassword": "<ACUMOS_RW_USER_PASSWORD>",
                     "nexusproxy": "",
                     "nexusGroupId": "com.artifact"
                   },
                   "cmndatasvc": {
                     "cmnDataSvcEndPoinURL": "http://cds-service:8000/ccds",
                     "cmnDataSvcUser": "<ACUMOS_CDS_USER>",
                     "cmnDataSvcPwd": "<ACUMOS_CDS_PASSWORD>"
                   },
                   "mktPlace": {
                     "mktPlaceEndPointURL": "http://portal-be-service:8083"
                   },
                   "microService": {
                     "microServiceEndPointURL": "http://msg-service:8336/microservice-generation"
                   },
                   "requirements": {
                     "extraIndexURL": "",
                     "trustedHost": ""
                   },
                   "base_image": {
                     "rimage": "<ONBOARDING_BASE_IMAGE>",
                     "dockerusername": "<ACUMOS_PROJECT_NEXUS_USERNAME>",
                     "dockerpassword": "<ACUMOS_PROJECT_NEXUS_PASSWORD>"
                   },
                   "tosca": {
                     "OutputFolder": "/temp/",
                     "GeneratorEndPointURL": "http://delete-me/model_create"
                   },
                   "spring": {
                     "http": {
                       "multipart": {
                          "max-file-size": "1024MB",
                          "max-request-size": "1024MB"
                       }
                     }
                   }
                 }'
        ports:
        - containerPort: 8090
        volumeMounts:
        - mountPath: /maven/logs
          name: acumos-logs
        - mountPath: /temp
          name: acumos-output
      restartPolicy: Always
      volumes:
      - name: acumos-logs
        hostPath:
          path: /var/acumos/logs
      - name: acumos-output
        hostPath:
          path: /var/acumos/output
      hostAliases:
      - ip: "<ACUMOS_HOST>"
        hostnames:
        - "<ACUMOS_DOMAIN>"
