apiVersion: apps/v1 kind: Deployment metadata: name: ttl-registry labels: app: ttl-registry spec: replicas: 1 selector: matchLabels: app: ttl-registry template: metadata: labels: app: ttl-registry spec: containers: - name: ttl-registry image: registry:2 command: ["/entrypoint.sh"] ports: - containerPort: 5000 volumeMounts: - name: registry-data mountPath: /var/lib/registry - name: registry-scripts mountPath: /entrypoint.sh subPath: entrypoint.sh - name: registry-scripts mountPath: /garbage-collect.sh subPath: garbage-collect.sh - name: registry-config mountPath: /etc/docker/registry/config.yml subPath: config.yml readinessProbe: failureThreshold: 3 initialDelaySeconds: 10 periodSeconds: 1 successThreshold: 2 timeoutSeconds: 1 httpGet: path: / port: 5000 scheme: HTTP volumes: - name: registry-data emptyDir: {} - name: registry-config configMap: name: ttl-registry-config - name: registry-scripts configMap: name: ttl-registry-scripts defaultMode: 0755 --- apiVersion: v1 kind: ConfigMap metadata: name: ttl-registry-scripts labels: app: ttl-registry data: entrypoint.sh: | #!/bin/sh set -e # /garbage-collect.sh & registry serve /etc/docker/registry/config.yml garbage-collect.sh: | #!/bin/sh while true; do sleep 1m if [ ! -d "/var/lib/registry/docker" ]; then echo "No registry data found, skipping garbage collection" else echo "Starting garbage collection..." registry garbage-collect /etc/docker/registry/config.yml || true fi done --- apiVersion: v1 kind: ConfigMap metadata: name: ttl-registry-config labels: app: ttl-registry data: config.yml: | version: 0.1 log: level: debug storage: delete: enabled: true filesystem: rootdirectory: /var/lib/registry http: addr: 0.0.0.0:5000 headers: X-Content-Type-Options: [nosniff] notifications: endpoints: - name: ttl-hooks url: http://ttl-hooks:8000/v1/hook/registry-event headers: Authorization: ["Token dev-hook-token"] timeout: 200ms threshold: 3 backoff: 5s --- apiVersion: v1 kind: Service metadata: name: ttl-registry labels: app: ttl-registry annotations: dev.okteto.com/auto-ingress: "true" spec: type: ClusterIP ports: - protocol: TCP port: 5000 targetPort: 5000 selector: app: ttl-registry