# Copyright 2021 The Tekton 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
#
#     https://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: pipeline-to-taskrun-controller
  namespace: tekton-pipeline-to-taskrun
  labels:
    app.kubernetes.io/name: pipeline-to-taskrun-controller
    app.kubernetes.io/component: pipeline-to-taskrun-controller
    app.kubernetes.io/instance: default
    app.kubernetes.io/version: devel
    app.kubernetes.io/part-of: tekton-pipeline-to-taskrun
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: pipeline-to-taskrun-controller
      app.kubernetes.io/component: pipeline-to-taskrun-controller
      app.kubernetes.io/instance: default
      app.kubernetes.io/part-of: tekton-pipeline-to-taskrun
  template:
    metadata:
      annotations:
        cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
      labels:
        app.kubernetes.io/name: pipeline-to-taskrun-controller
        app.kubernetes.io/component: pipeline-to-taskrun-controller
        app.kubernetes.io/instance: default
        app.kubernetes.io/version: devel
        app.kubernetes.io/part-of: tekton-pipeline-to-taskrun
        app: pipeline-to-taskrun-controller
    spec:
      serviceAccountName: pipeline-to-taskrun-controller
      containers:
        - name: pipeline-to-taskrun-controller
          image: ko://github.com/tektoncd/experimental/pipeline-to-taskrun/cmd/controller
          volumeMounts:
            - name: config-logging
              mountPath: /etc/config-logging
          env:
            - name: SYSTEM_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            # If you are changing these names, you will also need to update
            # the controller's Role in 200-role.yaml to include the new
            # values in the "configmaps" "get" rule.
            - name: CONFIG_LOGGING_NAME
              value: config-logging
            - name: METRICS_DOMAIN
              value: experimental.tekton.dev/pipeline-to-taskrun
      volumes:
        - name: config-logging
          configMap:
            name: config-logging
