diff --git a/.github/workflows/update-volcano-version.yml b/.github/workflows/update-volcano-version.yml new file mode 100644 index 0000000000..ba171db12c --- /dev/null +++ b/.github/workflows/update-volcano-version.yml @@ -0,0 +1,49 @@ +name: "update-volcano-version" +on: + workflow_dispatch: + schedule: + # every Monday at around 3 am pacific/10 am UTC + - cron: "0 10 * * 1" +env: + GOPROXY: https://proxy.golang.org + GO_VERSION: '1.22.1' +permissions: + contents: read + +jobs: + bump-volcano-version: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 + with: + go-version: ${{env.GO_VERSION}} + cache-dependency-path: ./go.sum + - name: Bump volcano version + id: bumpVolcano + run: | + echo "OLD_VERSION=$(DEP=volcano make get-dependency-version)" >> "$GITHUB_OUTPUT" + make update-volcano-version + echo "NEW_VERSION=$(DEP=volcano make get-dependency-version)" >> "$GITHUB_OUTPUT" + # The following is to support multiline with GITHUB_OUTPUT, see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings + echo "changes<> "$GITHUB_OUTPUT" + echo "$(git status --porcelain)" >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + - name: Create PR + if: ${{ steps.bumpVolcano.outputs.changes != '' }} + uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e + with: + token: ${{ secrets.MINIKUBE_BOT_PAT }} + commit-message: 'Addon Volcano: Update volcano images from ${{ steps.bumpVolcano.outputs.OLD_VERSION }} to ${{ steps.bumpVolcano.outputs.NEW_VERSION }}' + committer: minikube-bot + author: minikube-bot + branch: auto_bump_volcano_version + push-to-fork: minikube-bot/minikube + base: master + delete-branch: true + title: 'Addon Volcano: Update volcano images from ${{ steps.bumpVolcano.outputs.OLD_VERSION }} to ${{ steps.bumpVolcano.outputs.NEW_VERSION }}' + labels: ok-to-test + body: | + The [Volcano](https://github.com/volcano-sh/volcano) project made a new release + + This PR was auto-generated by `make update-volcano-version` using [update-volcano-version.yml](https://github.com/kubernetes/minikube/tree/master/.github/workflows/update-volcano-version.yml) CI Workflow. diff --git a/Makefile b/Makefile index a5bb239afd..8a5aea6ff9 100644 --- a/Makefile +++ b/Makefile @@ -1197,6 +1197,11 @@ update-registry-version: (cd hack/update/registry_version && \ go run update_registry_version.go) +.PHONY: update-volcano-version +update-volcano-version: + (cd hack/update/volcano_version && \ + go run update_volcano_version.go) + .PHONY: update-kong-version update-kong-version: (cd hack/update/kong_version && \ diff --git a/hack/update/get_version/get_version.go b/hack/update/get_version/get_version.go index 7f6e121401..4224f851bd 100644 --- a/hack/update/get_version/get_version.go +++ b/hack/update/get_version/get_version.go @@ -59,6 +59,7 @@ var dependencies = map[string]dependency{ "istio-operator": {addonsFile, `istio/operator:(.*)@`}, "kindnetd": {"pkg/minikube/bootstrapper/images/images.go", `kindnetd:(.*)"`}, "kong": {addonsFile, `kong:(.*)@`}, + "volcano": {addonsFile, `volcanosh/vc-webhook-manager:(.*)@`}, "kong-ingress-controller": {addonsFile, `kong/kubernetes-ingress-controller:(.*)@`}, "kubectl": {addonsFile, `bitnami/kubectl:(.*)@`}, "metrics-server": {addonsFile, `metrics-server/metrics-server:(.*)@`}, diff --git a/hack/update/volcano_version/update_volcano_version.go b/hack/update/volcano_version/update_volcano_version.go new file mode 100644 index 0000000000..b0929b9c75 --- /dev/null +++ b/hack/update/volcano_version/update_volcano_version.go @@ -0,0 +1,77 @@ +/* +Copyright 2023 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "fmt" + "time" + + "k8s.io/klog/v2" + "k8s.io/minikube/hack/update" +) + +var schema = map[string]update.Item{ + "pkg/minikube/assets/addons.go": { + Replace: map[string]string{ + `vc-webhook-manager:.*`: `vc-webhook-manager:{{.Version}}@{{.SHAWebhookManager}}",`, + `vc-controller-manager:.*`: `vc-controller-manager:{{.Version}}@{{.SHAControllerManager}}",`, + `vc-scheduler:.*`: `vc-scheduler:{{.Version}}@{{.SHAScheduler}}",`, + }, + }, +} + +type Data struct { + Version string + SHAWebhookManager string + SHAControllerManager string + SHAScheduler string +} + +func main() { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + + stable, _, _, err := update.GHReleases(ctx, "volcano-sh", "volcano") + if err != nil { + klog.Fatalf("Unable to get stable version: %v", err) + } + version := stable.Tag + shaWebhookManager, err := update.GetImageSHA(fmt.Sprintf("docker.io/volcanosh/vc-webhook-manager:%s", version)) + if err != nil { + klog.Fatalf("failed to get manifest digest for docker.io/volcanosh/vc-webhook-manager: %v", err) + } + + shaControllerManager, err := update.GetImageSHA(fmt.Sprintf("docker.io/volcanosh/vc-controller-manager:%s", version)) + if err != nil { + klog.Fatalf("failed to get manifest digest for docker.io/volcanosh/vc-controller-manager: %v", err) + } + + shaScheduler, err := update.GetImageSHA(fmt.Sprintf("docker.io/volcanosh/vc-scheduler:%s", version)) + if err != nil { + klog.Fatalf("failed to get manifest digest for docker.io/volcanosh/vc-scheduler: %v", err) + } + + data := Data{ + Version: version, + SHAWebhookManager: shaWebhookManager, + SHAControllerManager: shaControllerManager, + SHAScheduler: shaScheduler, + } + + update.Apply(schema, data) +} diff --git a/pkg/addons/addons.go b/pkg/addons/addons.go index 6d5145bf98..4029555bd7 100644 --- a/pkg/addons/addons.go +++ b/pkg/addons/addons.go @@ -356,6 +356,11 @@ func addonSpecificChecks(cc *config.ClusterConfig, name string, enable bool, run } } + // we cannot use volcano for crio + if name == "volcano" && cc.KubernetesConfig.ContainerRuntime == constants.CRIO && enable { + return false, fmt.Errorf("volcano addon does not support crio") + } + return false, nil } diff --git a/test/integration/addons_test.go b/test/integration/addons_test.go index caadfb0a34..8f0ec96f9e 100644 --- a/test/integration/addons_test.go +++ b/test/integration/addons_test.go @@ -867,6 +867,9 @@ func validateCloudSpannerAddon(ctx context.Context, t *testing.T, profile string // validateVolcanoAddon tests the Volcano addon, makes sure the Volcano is installed into cluster. func validateVolcanoAddon(ctx context.Context, t *testing.T, profile string) { defer PostMortemLogs(t, profile) + if ContainerRuntime() == "crio" { + t.Skipf("skipping: crio not supported") + } volcanoNamespace := "volcano-system"