From 167ad63aa93ee2c70647aea90e7a3018a009f5c1 Mon Sep 17 00:00:00 2001 From: biersoeckli Date: Mon, 23 Dec 2024 16:12:49 +0000 Subject: [PATCH] fix/removing pvc for registry, registry should only be temp storage --- setup/setup-worker.sh | 12 +++---- setup/setup.sh | 8 ++--- src/server/services/registry.service.ts | 42 +------------------------ 3 files changed, 11 insertions(+), 51 deletions(-) diff --git a/setup/setup-worker.sh b/setup/setup-worker.sh index 0127382..8999745 100644 --- a/setup/setup-worker.sh +++ b/setup/setup-worker.sh @@ -1,6 +1,6 @@ #!/bin/bash -# curl -sfL https://get.quickstack.dev/setup-worker.sh | K3S_URL=:6443> JOIN_TOKEN= sh - +# curl -sfL https://get.quickstack.dev/setup-worker.sh | K3S_URL= JOIN_TOKEN= sh - if [ -z "${K3S_URL}" ]; then echo "Error: Missing parameter 'K3S_URL'." @@ -58,8 +58,8 @@ sudo apt-get install nfs-common -y # Installation of k3s curl -sfL https://get.k3s.io | K3S_URL=${K3S_URL} K3S_TOKEN=${JOIN_TOKEN} sh - -# Check for Ready node, takes ~30 seconds -sudo k3s kubectl get node - -echo "Waiting for Kubernetes to start..." -wait_until_all_pods_running \ No newline at end of file +echo "" +echo "-----------------------------------------------------------------------------------------------------------" +echo "* Node Setup completed. It might take a few minutes until the node is visible in the QuickStack settings. *" +echo "-----------------------------------------------------------------------------------------------------------" +echo "" \ No newline at end of file diff --git a/setup/setup.sh b/setup/setup.sh index 36c36f1..87afa41 100644 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -1,5 +1,7 @@ #!/bin/bash +# curl -sfL https://get.quickstack.dev/setup.sh | sh - + wait_until_all_pods_running() { # Waits another 5 seconds to make sure all pods are registered for the first time. @@ -117,7 +119,5 @@ wait_until_all_pods_running sudo kubectl logs -f job/quickstack-setup-job -n quickstack # evaluate url to add node to cluster -echo "To add a worker node to the cluster, run the following command on the worker node:" -echo "------------------------------------------------------------" -echo "curl -sfL https://get.quickstack.dev/setup-worker.sh | K3S_URL=https://:6443 JOIN_TOKEN=$joinTokenForOtherNodes sh -" -echo "------------------------------------------------------------" \ No newline at end of file +# echo "To add an additional node to the cluster, run the following command on the worker node:" +# echo "curl -sfL https://get.quickstack.dev/setup-worker.sh | K3S_URL=https://:6443 JOIN_TOKEN=$joinTokenForOtherNodes sh -" \ No newline at end of file diff --git a/src/server/services/registry.service.ts b/src/server/services/registry.service.ts index 4f37f44..af2af8a 100644 --- a/src/server/services/registry.service.ts +++ b/src/server/services/registry.service.ts @@ -66,8 +66,6 @@ class RegistryService { console.log("Ensuring namespace is created..."); await namespaceService.createNamespaceIfNotExists(BUILD_NAMESPACE); - await this.createPersistenvColumeCLaim(); - await this.createOrUpdateRegistryConfigMap(); await this.createOrUpdateRegistryDeployment(); @@ -152,10 +150,6 @@ class RegistryService { name: deploymentName, image: 'registry:latest', volumeMounts: [ - { - name: 'registry-data-pv', - mountPath: '/var/lib/registry', - }, { name: REGISTRY_CONFIG_MAP_NAME, mountPath: '/etc/docker/registry', @@ -165,12 +159,6 @@ class RegistryService { }, ], volumes: [ - { - name: 'registry-data-pv', - persistentVolumeClaim: { - claimName: REGISTRY_PVC_NAME, - }, - }, { name: REGISTRY_CONFIG_MAP_NAME, configMap: { @@ -194,7 +182,7 @@ class RegistryService { private async createOrUpdateRegistryConfigMap() { - // https://distribution.github.io/distribution/about/configuration/ + // Source: https://distribution.github.io/distribution/about/configuration/ console.log("Creating Registry ConfigMap..."); const configMapManifest = { apiVersion: 'v1', @@ -238,34 +226,6 @@ http: await k3s.core.createNamespacedConfigMap(BUILD_NAMESPACE, configMapManifest); } - - private async createPersistenvColumeCLaim() { - console.log("Creating Registry PVC..."); - const pvcManifest = { - apiVersion: 'v1', - kind: 'PersistentVolumeClaim', - metadata: { - name: REGISTRY_PVC_NAME, - namespace: BUILD_NAMESPACE, - }, - spec: { - accessModes: ['ReadWriteOnce'], - storageClassName: 'longhorn', - resources: { - requests: { - storage: '5Gi', - }, - }, - }, - }; - - const listRes = await k3s.core.listNamespacedPersistentVolumeClaim(BUILD_NAMESPACE); - if (listRes.body.items.find(pvc => pvc.metadata?.name === REGISTRY_PVC_NAME)) { - console.log("PVC already exists, skipping creation..."); - return; - } - await k3s.core.createNamespacedPersistentVolumeClaim(BUILD_NAMESPACE, pvcManifest); - } } const registryService = new RegistryService();