# Copyright 2020 The Kubernetes Authors.
#
# 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: apps/v1
kind: Deployment
metadata:
  name: boskos
  namespace: boskos
spec:
  replicas: 3
  selector:
    matchLabels:
      app: boskos
  template:
    metadata:
      labels:
        app: boskos
    spec:
      serviceAccountName: boskos
      terminationGracePeriodSeconds: 30
      containers:
        - name: boskos
          image: gcr.io/k8s-staging-boskos/boskos:v20200617-f289ba6
          args:
            - --config=/etc/config/boskos-resources.yaml
            - --namespace=$(NAMESPACE)
            - --pod-name=$(POD_NAME)
            - --boskos-label-selector=app=boskos
            - --enable-leader-election=true
          env:
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          ports:
            - containerPort: 8080
              protocol: TCP
          readinessProbe:
            httpGet:
              path: /healthz/ready
              port: 8081
          volumeMounts:
            - name: boskos-config
              mountPath: /etc/config
              readOnly: true
      volumes:
        - name: boskos-config
          configMap:
            name: boskos-resources
