Skip to content

Commit

Permalink
Merge pull request kubernetes#19180 from spowelljr/updateVolcanoYAML
Browse files Browse the repository at this point in the history
CI: Auto update volcano addon YAML
  • Loading branch information
spowelljr authored Jul 2, 2024
2 parents 3182771 + f2e0dc1 commit fa7e938
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions hack/update/volcano_version/update_volcano_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"regexp"
"time"

"k8s.io/klog/v2"
Expand Down Expand Up @@ -74,4 +78,29 @@ func main() {
}

update.Apply(schema, data)

updateYAML(version)
}

func updateYAML(version string) {
res, err := http.Get(fmt.Sprintf("https://raw.githubusercontent.com/volcano-sh/volcano/%s/installer/volcano-development.yaml", version))
if err != nil {
klog.Fatalf("failed to get yaml file: %v", err)
}
defer res.Body.Close()
yaml, err := io.ReadAll(res.Body)
if err != nil {
klog.Fatalf("failed to read body: %v", err)
}
replacements := map[string]string{
`volcanosh\/vc-webhook-manager:.*`: "{{.CustomRegistries.vc_webhook_manager | default .ImageRepository | default .Registries.vc_webhook_manager}}{{.Images.vc_webhook_manager}}",
`volcanosh\/vc-controller-manager:.*`: "{{.CustomRegistries.vc_controller_manager | default .ImageRepository | default .Registries.vc_controller_manager}}{{.Images.vc_controller_manager}}",
`volcanosh\/vc-scheduler:.*`: "{{.CustomRegistries.vc_scheduler | default .ImageRepository | default .Registries.vc_scheduler}}{{.Images.vc_scheduler}}",
}
for re, repl := range replacements {
yaml = regexp.MustCompile(re).ReplaceAll(yaml, []byte(repl))
}
if err := os.WriteFile("../../../deploy/addons/volcano/volcano-development.yaml.tmpl", yaml, 0644); err != nil {
klog.Fatalf("failed to write to YAML file: %v", err)
}
}

0 comments on commit fa7e938

Please sign in to comment.