# Copyright 2019 Mulesoft.
#
# 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

# This file configures the API components autotest CI application frontend.
# The frontend serves public web traffic.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: apiconsole-frontend
  labels:
    app: apiconsole-www
spec:
  selector:
    matchLabels:
      app: apiconsole
      tier: frontend
  replicas: 2
  template:
    metadata:
      labels:
        app: apiconsole
        tier: frontend
    spec:
      volumes:
      - name: google-cloud-key
        secret:
          secretName: api-console-sa-key
      containers:
      - name: apiconsole-www
        image: gcr.io/api-console-a6952/api-console-io:0.2.9
        volumeMounts:
        - name: google-cloud-key
          mountPath: /var/secrets/google
        env:
        - name: SCRIPT
          value: app.js
        - name: PORT
          value: "50001"
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/key.json
        - name: PROJECT_ID
          value: api-console-a6952
      - name: apiconsole-demo-pages
        image: gcr.io/api-console-a6952/api-console-io:0.2.9
        volumeMounts:
        - name: google-cloud-key
          mountPath: /var/secrets/google
        env:
        - name: SCRIPT
          value: demos.js
        - name: PORT
          value: "50002"
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/key.json
        - name: PROJECT_ID
          value: api-console-a6952
      - name: apiconsole-docs-pages
        image: gcr.io/api-console-a6952/api-console-io:0.2.9
        volumeMounts:
        - name: google-cloud-key
          mountPath: /var/secrets/google
        env:
        - name: SCRIPT
          value: docs.js
        - name: PORT
          value: "50003"
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/key.json
        - name: PROJECT_ID
          value: api-console-a6952
