fix(clustertool): leave containerdcaching setup to spegel

This commit is contained in:
Kjeld Schouten
2024-10-23 17:44:14 +02:00
parent 3baa3750cb
commit 6037a1e4b6
2 changed files with 2 additions and 166 deletions
+2 -163
View File
@@ -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"