# Copyright Istio 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: v1
kind: Service
metadata:
  name: registry-redirector
  labels:
    app: registry-redirector
spec:
  ports:
  - name: http
    port: 1338
  selector:
    app: registry-redirector
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: registry-redirector
spec:
  replicas: 1
  selector:
    matchLabels:
      app: registry-redirector
  template:
    metadata:
      labels:
        app: registry-redirector
    spec:
      containers:
      - image: {{ or .Image "gcr.io/istio-testing/fake-registry:1.3"}}
        name: registry-redirector
        {{- if .TargetRegistry }}
        args: ["--registry", {{ .TargetRegistry }}]
        {{- end }}
        ports:
        - containerPort: 1338
        readinessProbe:
          httpGet:
            path: /ready
            port: 1338
          initialDelaySeconds: 1
          periodSeconds: 1
          failureThreshold: 10
---
