# Copyright 2020 Google LLC
#
# 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.

# Define deployment and service for icdemo.
#
# !!! Do not apply this to production

apiVersion: apps/v1
kind: Deployment
metadata:
  name: icdemo
  labels:
    name: icdemo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: icdemo
      tier: web
  template:
    metadata:
      labels:
        app: icdemo
        tier: web
    spec:
      containers:
        - name: icdemo
          image: gcr.io/${YOUR_PROJECT_ID}/hcls-fa-gke-icdemo:latest
          ports:
            - containerPort: 8080
          env:
            - name: URL
              value: https://${DOMAIN_FOR_IC}
            - name: PROJECT
              value: ${YOUR_PROJECT_ID}
            - name: TYPE
              value: icdemo
          readinessProbe:
            httpGet:
              port: 8080
              path: /liveness_check
---
apiVersion: v1
kind: Service
metadata:
  name: icdemo-service
  labels:
    app: icdemo
spec:
  type: NodePort
  selector:
    app: icdemo
    tier: web
  ports:
    - name: public
      port: 8080
      targetPort: 8080
