apiVersion: v1
kind: Namespace
metadata:
  name: container-registry
  labels:
    name: container-registry
---
# might need to 'microk8s enable registry' first?
apiVersion: v1
kind: PersistentVolume
metadata:
  name: registry-nfs
  namespace: container-registry
spec:
  capacity:
    storage: 20Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain # Keep 4eva
  storageClassName: default
  mountOptions:
    - hard
    - nfsvers=3
  nfs:
    path: /mnt/DroboFS/Shares/Kubernetes/volumes/static/registry-nfs
    server: 10.42.42.10
  claimRef:
    name: registry-nfs
    namespace: container-registry
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: registry-nfs
  namespace: container-registry
spec:
  storageClassName: default
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 20Gi
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
#  annotations:
#    deployment.kubernetes.io/revision: "1"
#    kubectl.kubernetes.io/last-applied-configuration: |
#      {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"registry"},"name":"registry","namespace":"container-registry"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"registry"}},"template":{"metadata":{"labels":{"app":"registry"}},"spec":{"containers":[{"env":[{"name":"REGISTRY_HTTP_ADDR","value":":5000"},{"name":"REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY","value":"/var/lib/registry"},{"name":"REGISTRY_STORAGE_DELETE_ENABLED","value":"yes"}],"image":"registry:2.7.1","name":"registry","ports":[{"containerPort":5000,"name":"registry","protocol":"TCP"}],"volumeMounts":[{"mountPath":"/var/lib/registry","name":"registry-data"}]}],"volumes":[{"name":"registry-data","persistentVolumeClaim":{"claimName":"registry-claim"}}]}}}}
#  creationTimestamp: "2023-01-29T15:40:09Z"
  generation: 1
  labels:
    app: registry
  name: registry
  namespace: container-registry
  resourceVersion: "117176758"
  uid: 82184fdc-ab8f-4ec8-9d27-f5820dcdee8f
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: registry
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: registry
    spec:
      containers:
      - env:
        - name: REGISTRY_HTTP_ADDR
          value: :5000
        - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
          value: /var/lib/registry
        - name: REGISTRY_STORAGE_DELETE_ENABLED
          value: "yes"
        image: registry:2.7.1
        imagePullPolicy: IfNotPresent
        name: registry
        ports:
        - containerPort: 5000
          name: registry
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/lib/registry
          name: registry-nfs
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: registry-nfs
        persistentVolumeClaim:
          claimName: registry-nfs
status:
  conditions:
  - lastTransitionTime: "2023-01-29T15:40:09Z"
    lastUpdateTime: "2023-01-29T15:40:09Z"
    message: Deployment does not have minimum availability.
    reason: MinimumReplicasUnavailable
    status: "False"
    type: Available
  - lastTransitionTime: "2023-01-29T15:40:09Z"
    lastUpdateTime: "2023-01-29T15:40:09Z"
    message: ReplicaSet "registry-c68d59984" is progressing.
    reason: ReplicaSetUpdated
    status: "True"
    type: Progressing
  observedGeneration: 1
  replicas: 1
  unavailableReplicas: 1
  updatedReplicas: 1
