# 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.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: probe-helper
  namespace: cloud-run-events-probe
spec:
  replicas: 1
  selector:
    matchLabels:
      app: probe-helper
  template:
    metadata:
      labels:
        app: probe-helper
    spec:
      containers:
        - name: probe-helper
          image: ko://github.com/google/knative-gcp/test/test_images/probe_helper
          env:
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: /var/secrets/google/key.json
            - name: BROKER_CELL_INGRESS_BASE_URL
              value: "http://default-brokercell-ingress.cloud-run-events.svc.cluster.local"
            - name: PROBE_PORT
              value: "8070"
            - name: RECEIVER_PORT
              value: "8080"
            - name: DEFAULT_TIMEOUT_DURATION
              value: "2m"
            - name: MAX_TIMEOUT_DURATION
              value: "30m"
            - name: LIVENESS_STALE_DURATION
              value: "5m"
            - name: CRON_STALE_DURATION
              value: "3m"
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 125
            successThreshold: 1
            timeoutSeconds: 10
          volumeMounts:
          - name: probe-helper-key
            mountPath: /var/secrets/google
      volumes:
      - name: probe-helper-key
        secret:
          secretName: probe-helper-key
          optional: true
