# Copyright 2020 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
#
#     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: tekton-triggers-core-interceptors
  namespace: tekton-pipelines
  labels:
    app.kubernetes.io/name: core-interceptors
    app.kubernetes.io/component: interceptors
    app.kubernetes.io/instance: default
    app.kubernetes.io/version: "v0.16.1"
    app.kubernetes.io/part-of: tekton-triggers
    # tekton.dev/release value replaced with inputs.params.versionTag in triggers/tekton/publish.yaml
    triggers.tekton.dev/release: "v0.16.1"
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: core-interceptors
      app.kubernetes.io/component: interceptors
      app.kubernetes.io/instance: default
      app.kubernetes.io/part-of: tekton-triggers
  template:
    metadata:
      labels:
        app.kubernetes.io/name: core-interceptors
        app.kubernetes.io/component: interceptors
        app.kubernetes.io/instance: default
        app.kubernetes.io/version: "v0.16.1"
        app.kubernetes.io/part-of: tekton-triggers
        app: tekton-triggers-core-interceptors
        triggers.tekton.dev/release: "v0.16.1"
        # version value replaced with inputs.params.versionTag in triggers/tekton/publish.yaml
        version: "v0.16.1"
    spec:
      serviceAccountName: tekton-triggers-core-interceptors
      containers:
        - name: tekton-triggers-core-interceptors
          image: "gcr.io/tekton-releases/github.com/tektoncd/triggers/cmd/interceptors:v0.16.1@sha256:d9086af68aaadd35359c516f8effa40f2d1e59bf96c31056feacd6a687a7f569"
          args: ["-logtostderr", "-stderrthreshold", "INFO"]
          env:
            - name: SYSTEM_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: CONFIG_LOGGING_NAME
              value: config-logging-triggers
            - name: CONFIG_OBSERVABILITY_NAME
              value: config-observability-triggers
            - name: METRICS_DOMAIN
              value: tekton.dev/triggers
          readinessProbe:
            httpGet:
              path: /ready
              port: 8082
              scheme: HTTP
            initialDelaySeconds: 5
            periodSeconds: 10
            timeoutSeconds: 5
          securityContext:
            allowPrivilegeEscalation: false
            # User 65532 is the distroless nonroot user ID
            runAsUser: 65532
            runAsGroup: 65532
            capabilities:
              drop:
                - all
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/name: tekton-triggers-core-interceptors
    app.kubernetes.io/component: interceptors
    app.kubernetes.io/instance: default
    app.kubernetes.io/version: "v0.16.1"
    app.kubernetes.io/part-of: tekton-triggers
    triggers.tekton.dev/release: "v0.16.1"
    app: tekton-triggers-core-interceptors
    version: "v0.16.1"
  name: tekton-triggers-core-interceptors
  namespace: tekton-pipelines
spec:
  ports:
    - name: "http"
      port: 80
      targetPort: 8082
  selector:
    app.kubernetes.io/name: core-interceptors
    app.kubernetes.io/component: interceptors
    app.kubernetes.io/instance: default
    app.kubernetes.io/part-of: tekton-triggers

---
# 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
#
#     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: triggers.tekton.dev/v1alpha1
kind: ClusterInterceptor
metadata:
  name: cel
spec:
  clientConfig:
    service:
      name: tekton-triggers-core-interceptors
      namespace: tekton-pipelines
      path: "cel"
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: ClusterInterceptor
metadata:
  name: bitbucket
spec:
  clientConfig:
    service:
      name: tekton-triggers-core-interceptors
      namespace: tekton-pipelines
      path: "bitbucket"
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: ClusterInterceptor
metadata:
  name: github
spec:
  clientConfig:
    service:
      name: tekton-triggers-core-interceptors
      namespace: tekton-pipelines
      path: "github"
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: ClusterInterceptor
metadata:
  name: gitlab
spec:
  clientConfig:
    service:
      name: tekton-triggers-core-interceptors
      namespace: tekton-pipelines
      path: "gitlab"

---
