From 6037a1e4b66f6a64f94d2d8f6a887790a7b883ab Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Wed, 23 Oct 2024 17:44:14 +0200 Subject: [PATCH] fix(clustertool): leave containerdcaching setup to spegel --- clustertool/embed/generic/patches/all.yaml | 3 - clustertool/pkg/initfiles/initfiles.go | 165 +-------------------- 2 files changed, 2 insertions(+), 166 deletions(-) diff --git a/clustertool/embed/generic/patches/all.yaml b/clustertool/embed/generic/patches/all.yaml index e6d5c6d800a..4e6997c748d 100644 --- a/clustertool/embed/generic/patches/all.yaml +++ b/clustertool/embed/generic/patches/all.yaml @@ -74,6 +74,3 @@ machine: rsize=131072 wsize=131072 nconnect=8 - - registries: - config: diff --git a/clustertool/pkg/initfiles/initfiles.go b/clustertool/pkg/initfiles/initfiles.go index 57dea66d23e..8be085915b4 100644 --- a/clustertool/pkg/initfiles/initfiles.go +++ b/clustertool/pkg/initfiles/initfiles.go @@ -277,8 +277,6 @@ func GenPatches() error { setDocker() - setSpegel() - // Read the content of the talenv.yaml file talenvContent, err := os.ReadFile(helper.ClusterPath + "/clusterenv.yaml") if err != nil { @@ -310,6 +308,8 @@ func setDocker() { if helper.TalEnv["DOCKERHUB_USER"] != "" && helper.TalEnv["DOCKERHUB_PASSWORD"] != "" { // Prepare the content to append configContent := fmt.Sprintf(`# Add Dockerhub Login + registries: + config: registry-1.docker.io: auth: username: %s @@ -348,167 +348,6 @@ func setDocker() { } } -func setSpegel() { - // Assuming this is part of your function - if helper.TalEnv["SPEGEL_IP"] != "" && helper.TalEnv["SPEGEL_IP"] != "" { - // Prepare the content to append - configContent := fmt.Sprintf(`# Add Dockerhub Login - mirrors: - cgr.dev: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://cgr.dev - docker.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://registry-1.docker.io - ghcr.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://ghcr.io - quay.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://quay.io - mcr.microsoft.com: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://mcr.microsoft.com - public.ecr.aws: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://public.ecr.aws - gcr.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://gcr.io - registry.k8s.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://registry.k8s.io - k8s.gcr.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://k8s.gcr.io - tccr.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - http://%s:5000 - - https://tccr.io - # factory.talos.dev: - # endpoints: - # - http://127.0.0.1:30020 - # - http://127.0.0.1:30021 - # - http://%s:5000 - # - https://factory.talos.dev - - -`, helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"]) - - // Open the file in append mode or create it if it doesn't exist - file, err := os.OpenFile(filepath.Join(helper.ClusterPath+"/talos/patches", "all.yaml"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - if err != nil { - log.Fatal().Err(err).Msg("Error opening file: %s") - } - defer file.Close() - - // Write the content to the file - if _, err := file.Write([]byte(configContent)); err != nil { - log.Fatal().Err(err).Msg("Error writing to file: %s") - } - } else { - // Optional: Append a note if the environment variables are not set - configContent := fmt.Sprintf(`# No Spegel_IP provide - mirrors: - cgr.dev: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://cgr.dev - docker.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://registry-1.docker.io - ghcr.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://ghcr.io - quay.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://quay.io - mcr.microsoft.com: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://mcr.microsoft.com - public.ecr.aws: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://public.ecr.aws - gcr.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://gcr.io - registry.k8s.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://registry.k8s.io - k8s.gcr.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://k8s.gcr.io - tccr.io: - endpoints: - - http://127.0.0.1:30020 - - http://127.0.0.1:30021 - - https://tccr.io - # factory.talos.dev: - # endpoints: - # - http://127.0.0.1:30020 - # - http://127.0.0.1:30021 - # - https://factory.talos.dev - -`) - - file, err := os.OpenFile(filepath.Join(helper.ClusterPath+"/talos/patches", "all.yaml"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - if err != nil { - log.Fatal().Err(err).Msg("Error opening file: %s") - } - defer file.Close() - - if _, err := file.Write([]byte(configContent)); err != nil { - log.Fatal().Err(err).Msg("Error writing to file: %s") - } - } -} - func ageGen() error { outFlag := "age.agekey"