# Copyright 2021 The Knative 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: batch/v1
kind: Job
metadata:
  name: v0.22.0-pingsource-cleanup
  namespace: knative-eventing
  labels:
    eventing.knative.dev/release: devel
spec:
  ttlSecondsAfterFinished: 600
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "false"
    spec:
      serviceAccountName: knative-eventing-post-install-job
      restartPolicy: Never
      containers:
        - name: pingsource
          image: ko://knative.dev/eventing/cmd/v0.22/pingsource-cleanup
          env:
            - name: SYSTEM_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace

# Note the following ENVVAR settings exist:
# SYSTEM_NAMESPACE - the namespace of the control plane, defaults to knative-eventing
# DRY_RUN - a flag to run the script without deleting or updating, defaults to false.
