Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kubernetes): install zot #743

Merged
merged 1 commit into from
Apr 28, 2024
Merged

feat(kubernetes): install zot #743

merged 1 commit into from
Apr 28, 2024

Conversation

martinohmann
Copy link
Owner

Updates #741

@github-actions github-actions bot added area/kubernetes Changes made in the kubernetes directory cluster/main cluster/storage labels Apr 28, 2024
Copy link

--- kubernetes/storage/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/zot

+++ kubernetes/storage/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/zot

@@ -0,0 +1,34 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: zot
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: zot
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  interval: 2h
+  path: ./kubernetes/storage/apps/default/zot/app
+  postBuild:
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-settings
+    - kind: Secret
+      name: cluster-secrets
+  prune: true
+  retryInterval: 1m
+  sourceRef:
+    kind: GitRepository
+    name: home-kubernetes
+  targetNamespace: default
+  timeout: 5m
+  wait: false
+
--- kubernetes/storage/apps/default/zot/app Kustomization: flux-system/zot HelmRelease: default/zot

+++ kubernetes/storage/apps/default/zot/app Kustomization: flux-system/zot HelmRelease: default/zot

@@ -0,0 +1,115 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2beta2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: zot
+    kustomize.toolkit.fluxcd.io/name: zot
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: zot
+  namespace: default
+spec:
+  chart:
+    spec:
+      chart: app-template
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s
+        namespace: flux-system
+      version: 3.1.0
+  install:
+    remediation:
+      retries: 3
+  interval: 2h
+  maxHistory: 2
+  uninstall:
+    keepHistory: false
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+  values:
+    controllers:
+      zot:
+        annotations:
+          reloader.stakater.com/auto: 'true'
+        containers:
+          app:
+            env:
+              TZ: Europe/Berlin
+            image:
+              repository: ghcr.io/project-zot/zot-linux-amd64
+              tag: v2.0.4@sha256:e102152bbe51cc7aa6f14fcd71df094a761be240426a6bf0c72e7cd05e0e36c5
+            probes:
+              liveness:
+                custom: true
+                enabled: true
+                spec:
+                  httpGet:
+                    path: /v2/
+                    port: 5000
+                  initialDelaySeconds: 5
+              readiness:
+                custom: true
+                enabled: true
+                spec:
+                  httpGet:
+                    path: /v2/
+                    port: 5000
+                  initialDelaySeconds: 5
+              startup:
+                enabled: false
+            securityContext:
+              allowPrivilegeEscalation: false
+              capabilities:
+                drop:
+                - ALL
+              readOnlyRootFilesystem: true
+    defaultPodOptions:
+      securityContext:
+        fsGroup: 1000
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+        seccompProfile:
+          type: RuntimeDefault
+    ingress:
+      app:
+        annotations:
+          nginx.ingress.kubernetes.io/proxy-body-size: '0'
+          nginx.ingress.kubernetes.io/proxy-read-timeout: '600'
+          nginx.ingress.kubernetes.io/proxy-send-timeout: '600'
+        className: internal
+        enabled: true
+        hosts:
+        - host: zot.storage.18b.haus
+          paths:
+          - path: /
+            service:
+              identifier: app
+              port: http
+        tls:
+        - hosts:
+          - zot.storage.18b.haus
+    persistence:
+      config:
+        globalMounts:
+        - path: /etc/zot/config.json
+          readOnly: true
+          subPath: config.json
+        name: zot
+        type: configMap
+      registry:
+        globalMounts:
+        - path: /var/lib/registry
+        hostPath: /io/zot
+        hostPathType: Directory
+        type: hostPath
+    service:
+      app:
+        controller: zot
+        ports:
+          http:
+            port: 5000
+
--- kubernetes/storage/apps/default/zot/app Kustomization: flux-system/zot ConfigMap: default/zot

+++ kubernetes/storage/apps/default/zot/app Kustomization: flux-system/zot ConfigMap: default/zot

@@ -0,0 +1,143 @@

+---
+apiVersion: v1
+data:
+  config.json: |
+    {
+      "distSpecVersion": "1.0.1",
+      "storage": {
+        "rootDirectory": "/var/lib/registry",
+        "dedupe": true,
+        "gc": true,
+        "gcDelay": "1h",
+        "gcInterval": "24h",
+        "retention": {
+          "dryRun": false,
+          "delay": "24h",
+          "policies": [
+            {
+              "repositories": ["**"],
+              "deleteReferrers": true,
+              "deleteUntagged": true,
+              "keepTags": [
+                {
+                  "mostRecentlyPushedCount": 5,
+                  "mostRecentlyPulledCount": 5,
+                  "pulledWithin": "720h",
+                  "pushedWithin": "720h"
+                }
+              ]
+            }
+          ]
+        }
+      },
+      "http": {
+        "address": "0.0.0.0",
+        "port": "5000"
+      },
+      "log": {
+        "level": "info"
+      },
+      "extensions": {
+        "ui": {
+          "enable": true
+        },
+        "search": {
+          "enable": true
+        },
+        "scrub": {
+          "enable": false,
+          "interval": "24h"
+        },
+        "sync": {
+          "enable": true,
+          "registries": [
+            {
+              "urls": ["https://index.docker.io"],
+              "content": [
+                {
+                  "prefix": "**",
+                  "destination": "/docker.io"
+                }
+              ],
+              "onDemand": true,
+              "tlsVerify": true
+            },
+            {
+              "urls": ["https://gcr.io"],
+              "content": [
+                {
+                  "prefix": "**",
+                  "destination": "/gcr.io"
+                }
+              ],
+              "onDemand": true,
+              "tlsVerify": true
+            },
+            {
+              "urls": ["https://ghcr.io"],
+              "content": [
+                {
+                  "prefix": "**",
+                  "destination": "/ghcr.io"
+                }
+              ],
+              "onDemand": true,
+              "tlsVerify": true
+            },
+            {
+              "urls": ["https://quay.io"],
+              "content": [
+                {
+                  "prefix": "**",
+                  "destination": "/quay.io"
+                }
+              ],
+              "onDemand": true,
+              "tlsVerify": true
+            },
+            {
+              "urls": ["https://registry.k8s.io"],
+              "content": [
+                {
+                  "prefix": "**",
+                  "destination": "/registry.k8s.io"
+                }
+              ],
+              "onDemand": true,
+              "tlsVerify": true
+            },
+            {
+              "urls": ["https://public.ecr.aws"],
+              "content": [
+                {
+                  "prefix": "**",
+                  "destination": "/public.ecr.aws"
+                }
+              ],
+              "onDemand": true,
+              "tlsVerify": true
+            },
+            {
+              "urls": ["https://cgr.dev"],
+              "content": [
+                {
+                  "prefix": "**",
+                  "destination": "/cgr.dev"
+                }
+              ],
+              "onDemand": true,
+              "tlsVerify": true
+            }
+          ]
+        }
+      }
+    }
+kind: ConfigMap
+metadata:
+  labels:
+    app.kubernetes.io/name: zot
+    kustomize.toolkit.fluxcd.io/name: zot
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: zot
+  namespace: default
+

Copy link

--- HelmRelease: default/zot Service: default/zot

+++ HelmRelease: default/zot Service: default/zot

@@ -0,0 +1,22 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: zot
+  labels:
+    app.kubernetes.io/instance: zot
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: zot
+    app.kubernetes.io/service: zot
+spec:
+  type: ClusterIP
+  ports:
+  - port: 5000
+    targetPort: 5000
+    protocol: TCP
+    name: http
+  selector:
+    app.kubernetes.io/component: zot
+    app.kubernetes.io/instance: zot
+    app.kubernetes.io/name: zot
+
--- HelmRelease: default/zot Deployment: default/zot

+++ HelmRelease: default/zot Deployment: default/zot

@@ -0,0 +1,82 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: zot
+  labels:
+    app.kubernetes.io/component: zot
+    app.kubernetes.io/instance: zot
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: zot
+  annotations:
+    reloader.stakater.com/auto: 'true'
+spec:
+  revisionHistoryLimit: 3
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: zot
+      app.kubernetes.io/name: zot
+      app.kubernetes.io/instance: zot
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: zot
+        app.kubernetes.io/instance: zot
+        app.kubernetes.io/name: zot
+    spec:
+      enableServiceLinks: false
+      serviceAccountName: default
+      automountServiceAccountToken: true
+      securityContext:
+        fsGroup: 1000
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+        seccompProfile:
+          type: RuntimeDefault
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      containers:
+      - env:
+        - name: TZ
+          value: Europe/Berlin
+        image: ghcr.io/project-zot/zot-linux-amd64:v2.0.4@sha256:e102152bbe51cc7aa6f14fcd71df094a761be240426a6bf0c72e7cd05e0e36c5
+        livenessProbe:
+          httpGet:
+            path: /v2/
+            port: 5000
+          initialDelaySeconds: 5
+        name: app
+        readinessProbe:
+          httpGet:
+            path: /v2/
+            port: 5000
+          initialDelaySeconds: 5
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+        volumeMounts:
+        - mountPath: /etc/zot/config.json
+          name: config
+          readOnly: true
+          subPath: config.json
+        - mountPath: /var/lib/registry
+          name: registry
+      volumes:
+      - configMap:
+          name: zot
+        name: config
+      - hostPath:
+          path: /io/zot
+          type: Directory
+        name: registry
+
--- HelmRelease: default/zot Ingress: default/zot

+++ HelmRelease: default/zot Ingress: default/zot

@@ -0,0 +1,30 @@

+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: zot
+  labels:
+    app.kubernetes.io/instance: zot
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: zot
+  annotations:
+    nginx.ingress.kubernetes.io/proxy-body-size: '0'
+    nginx.ingress.kubernetes.io/proxy-read-timeout: '600'
+    nginx.ingress.kubernetes.io/proxy-send-timeout: '600'
+spec:
+  ingressClassName: internal
+  tls:
+  - hosts:
+    - zot.storage.18b.haus
+  rules:
+  - host: zot.storage.18b.haus
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: zot
+            port:
+              number: 5000
+

Copy link

--- kubernetes/main/apps/default/homepage/app Kustomization: flux-system/homepage ConfigMap: default/homepage

+++ kubernetes/main/apps/default/homepage/app Kustomization: flux-system/homepage ConfigMap: default/homepage

@@ -36,12 +36,16 @@

         - Kopia:
             href: https://kopia.storage.18b.haus
             icon: kopia.png
         - Minio:
             href: https://minio.storage.18b.haus
             icon: minio.png
+    - Tools:
+        - Zot Registry:
+            href: https://zot.storage.18b.haus
+            icon: https://zotregistry.dev/v2.0.4/assets/images/logo.svg
   settings.yaml: |
     background:
       image: https://static.18b.haus/img/wooden-floor.jpg
       opacity: 10
     fiveColumns: true
     headerStyle: clean

@martinohmann martinohmann merged commit 2add8c9 into main Apr 28, 2024
8 checks passed
@martinohmann martinohmann deleted the zot/install branch April 28, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes Changes made in the kubernetes directory cluster/main cluster/storage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant