Skip to content

Commit

Permalink
fix(clustertool): leave containerdcaching setup to spegel
Browse files Browse the repository at this point in the history
  • Loading branch information
PrivatePuffin committed Oct 23, 2024
1 parent 3baa375 commit 6037a1e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 166 deletions.
3 changes: 0 additions & 3 deletions clustertool/embed/generic/patches/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,3 @@ machine:
rsize=131072
wsize=131072
nconnect=8
registries:
config:
165 changes: 2 additions & 163 deletions clustertool/pkg/initfiles/initfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit 6037a1e

Please sign in to comment.