#
# Copyright © 2015-2020 Santer Reply S.p.A.
#
# Licensed 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
#

apiVersion: v1
kind: ReplicationController
metadata:
  name: orchestrator
  labels:
    service: orchestrator
    component: backend
spec:
  replicas: 1
  selector:
    service: orchestrator
    component: backend
  template:
    metadata:
      labels:
        service: orchestrator
        component: backend
    spec:
      containers:
      - name: orchestrator
        image: albertobrigandi/orchestrator:demo-0.0.3-SNAPSHOT
        imagePullPolicy: Always
        env:
          - name: ENABLE_DEBUG
            value: 'true'
          - name: ORCHESTRATOR_DB_ENDPOINT
            value: 'orchestrator-database:3306'
          - name: ORCHESTRATOR_DB_USER
            value: orchestrator
          - name: ORCHESTRATOR_DB_PWD
            value: password
          - name: WORKFLOW_DB_ENDPOINT
            value: 'workflow-database:3306'
          - name: WORKFLOW_DB_USER
            value: orchestrator
          - name: WORKFLOW_DB_PWD
            value: password
#          - name: IM_URL
#            value: "https://im:8800"
          - name: OPENNEBULA_AUTH_FILE_PATH
            value: "file:/secrets/opennebula-auth.dat"
          - name: OPENSTACK_AUTH_FILE_PATH
            value: "file:/secrets/openstack-auth.dat"
          - name: ONEDOCK_AUTH_FILE_PATH
            value: "file:/secrets/onedock-auth.dat"
        volumeMounts:
          - name: secrets
            mountPath: "/secrets"
            readOnly: true
        livenessProbe:
          httpGet:
            path: /orchestrator
            port: 8080
          initialDelaySeconds: 240
          timeoutSeconds: 5
        ports:
        - containerPort: 8080
        - containerPort: 8787
      volumes:
        - name: secrets
          secret:
            secretName: "orchestrator-deploy-secrets"
