|
| 1 | +initContainers: |
| 2 | + # The regsync container does not fail when it cannot connect to the destination registry. |
| 3 | + # In the case when it runs as a Job, it will prematurely exit. |
| 4 | + # This init container will wait for the destination registry to be ready. |
| 5 | + - name: wait-for-registry |
| 6 | + image: ghcr.io/d2iq-labs/kubectl-betterwait:{{ .KubernetesVersion }} |
| 7 | + args: |
| 8 | + - --for=condition=Ready |
| 9 | + - --timeout=-1s # a negative number here means wait forever |
| 10 | + - --interval=5s # poll every 5 seconds to the resources to be created |
| 11 | + - --namespace={{ .DestinationRegistryHeadlessServiceNamespace }} |
| 12 | + - --kubeconfig=/kubeconfig/admin.conf |
| 13 | + # Ideally we would wait for the Service to be ready, but Kubernetes does not have a condition for that. |
| 14 | + - pod/{{ .DestinationRegistryAnyPodName }} |
| 15 | + volumeMounts: |
| 16 | + - mountPath: /kubeconfig |
| 17 | + name: kubeconfig |
| 18 | + readOnly: true |
| 19 | + - name: port-forward-registry |
| 20 | + image: ghcr.io/d2iq-labs/kubectl-betterwait:{{ .KubernetesVersion }} |
| 21 | + command: |
| 22 | + - /bin/kubectl |
| 23 | + args: |
| 24 | + - port-forward |
| 25 | + - --address=127.0.0.1 |
| 26 | + - --namespace={{ .DestinationRegistryHeadlessServiceNamespace }} |
| 27 | + - --kubeconfig=/kubeconfig/admin.conf |
| 28 | + # This will port-forward to a single Pod in the Service. |
| 29 | + - service/{{ .DestinationRegistryHeadlessServiceName }} |
| 30 | + - 5000:{{ .DestinationRegistryHeadlessServicePort }} |
| 31 | + resources: |
| 32 | + requests: |
| 33 | + cpu: 25m |
| 34 | + memory: 32Mi |
| 35 | + limits: |
| 36 | + cpu: 100m |
| 37 | + memory: 50Mi |
| 38 | + volumeMounts: |
| 39 | + - mountPath: /kubeconfig |
| 40 | + name: kubeconfig |
| 41 | + readOnly: true |
| 42 | + # Kubernetes will treat this as a Sidecar container |
| 43 | + # https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/ |
| 44 | + restartPolicy: Always |
| 45 | + |
| 46 | +extraVolumes: |
| 47 | + - name: kubeconfig |
| 48 | + secret: |
| 49 | + items: |
| 50 | + - key: value |
| 51 | + path: admin.conf |
| 52 | + secretName: {{ .CusterName }}-kubeconfig |
| 53 | + - name: ca-cert |
| 54 | + secret: |
| 55 | + secretName: {{ .RegistryCASecretName }} |
| 56 | + |
| 57 | +extraVolumeMounts: |
| 58 | + # Assume both the source and the target registries have the same CA. |
| 59 | + # Source registry running in the cluster. |
| 60 | + - mountPath: /etc/docker/certs.d/{{ .SourceRegistryAddress }}/ |
| 61 | + name: ca-cert |
| 62 | + readOnly: true |
| 63 | + # Destination registry running in the remote cluster being port-forwarded. |
| 64 | + - mountPath: /etc/docker/certs.d/127.0.0.1:5000/ |
| 65 | + name: ca-cert |
| 66 | + readOnly: true |
| 67 | + |
| 68 | +deployment: |
| 69 | + config: |
| 70 | + creds: |
| 71 | + - registry: {{ .SourceRegistryAddress }} |
| 72 | + reqPerSec: 1 |
| 73 | + sync: |
| 74 | + - source: {{ .SourceRegistryAddress }} |
| 75 | + target: 127.0.0.1:5000 |
| 76 | + type: registry |
| 77 | + interval: 1m |
| 78 | + |
| 79 | +job: |
| 80 | + enabled: true |
| 81 | + config: |
| 82 | + sync: |
| 83 | + - source: {{ .SourceRegistryAddress }} |
| 84 | + target: 127.0.0.1:5000 |
| 85 | + type: registry |
| 86 | + interval: 1m |
0 commit comments