apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: cdi-docker-registry-host
  namespace: cdi
  labels:
    cdi.kubevirt.io/testing: ""
spec:
  selector:
    matchLabels:
      name: cdi-docker-registry-host
  replicas: 1
  template:
    metadata:
      labels:
        name: cdi-docker-registry-host
        cdi.kubevirt.io/testing: ""
    spec:
      securityContext:
        runAsUser: 0
      serviceAccountName: cdi-sa
      initContainers:
      - name: registry-init
        image: kubevirt/cdi-func-test-registry-init:v1.10.9
        imagePullPolicy: IfNotPresent
        args: ["-certDir", "/tmp/shared/certs", "-inFile", "/tmp/source/tinyCore.iso", "-outDir", "/tmp/shared/images"]
        volumeMounts:
        - name: "images"
          mountPath: "/tmp/shared"
      containers:
      - name: registry
        image: kubevirt/cdi-func-test-registry:v1.10.9
        imagePullPolicy: IfNotPresent
        ports:
          - name: sec-docker-reg
            containerPort: 443
        resources: {}
        volumeMounts:
        - name: "health"
          mountPath: "/tmp/health"
        - name: "images"
          mountPath: "/tmp/shared"
        readinessProbe:
          exec:
            command:
             - cat
             - /tmp/health/ready
          initialDelaySeconds: 20
          periodSeconds: 20
      - name: registry-populate
        image: kubevirt/cdi-func-test-registry-populate:v1.10.9
        imagePullPolicy: IfNotPresent
        args: [ "/tmp/shared/images/", "/tmp/docker-images", "127.0.0.1", "443", "/tmp/health/healthy", "15", "/tmp/health/ready", "15"]
        volumeMounts:
        - name: "images"
          mountPath: "/tmp/shared"
        - name: "health"
          mountPath: "/tmp/health"
        readinessProbe:
          exec:
            command:
             - cat
             - /tmp/health/ready
          initialDelaySeconds: 20
          periodSeconds: 20
        livenessProbe:
          exec:
            command:
             - cat
             - /tmp/health/healthy
          initialDelaySeconds: 20
          periodSeconds: 20
      volumes:
      - name: "images"
        emptyDir: {}
      - name: "health"
        emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: cdi-docker-registry-host
  namespace: cdi
  labels:
    cdi.kubevirt.io/testing: ""
spec:
  selector:
    name: cdi-docker-registry-host
  ports:
  - name: sec-docker-reg
    port: 443
    targetPort: 443
  - name: alt-sec-docker-reg
    port: 5000
    targetPort: 443
