add volcano addons
parent
03c6a47a29
commit
136428f13c
|
@ -132,6 +132,10 @@ var (
|
|||
//go:embed gcp-auth/*.tmpl
|
||||
GcpAuthAssets embed.FS
|
||||
|
||||
// Volcano assets for volcano addon
|
||||
//go:embed volcano/*.tmpl
|
||||
VolcanoAssets embed.FS
|
||||
|
||||
// VolumeSnapshotsAssets assets for volumesnapshots addon
|
||||
//go:embed volumesnapshots/*.tmpl
|
||||
VolumeSnapshotsAssets embed.FS
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -186,6 +186,11 @@ var Addons = []*Addon{
|
|||
set: SetBool,
|
||||
callbacks: []setFn{enableOrDisableGCPAuth, EnableOrDisableAddon, verifyGCPAuthAddon},
|
||||
},
|
||||
{
|
||||
name: "volcano",
|
||||
set: SetBool,
|
||||
callbacks: []setFn{EnableOrDisableAddon},
|
||||
},
|
||||
{
|
||||
name: "volumesnapshots",
|
||||
set: SetBool,
|
||||
|
|
|
@ -602,6 +602,21 @@ var Addons = map[string]*Addon{
|
|||
"GCPAuthWebhook": "gcr.io",
|
||||
"KubeWebhookCertgen": "registry.k8s.io",
|
||||
}),
|
||||
"volcano": NewAddon([]*BinAsset{
|
||||
MustBinAsset(addons.VolcanoAssets,
|
||||
"volcano/volcano-development.yaml.tmpl",
|
||||
vmpath.GuestAddonsDir,
|
||||
"volcano-deployment.yaml",
|
||||
"0640"),
|
||||
}, false, "volcano", "third-party (volcano)", "hwdef", "", map[string]string{
|
||||
"vc_webhook_manager": "volcanosh/vc-webhook-manager:v1.7.0@sha256:75adf0548e998e08c0d2e85a9b02a159a7cc21794e04f58abbae8c316a253615",
|
||||
"vc_controller_manager": "volcanosh/vc-controller-manager:v1.7.0@sha256:4b18a03b04bcf47aa7230f472c904480757c42d906e468067c06eeaf7d22e9c5",
|
||||
"vc_scheduler": "volcanosh/vc-scheduler:v1.7.0@sha256:72a507f8c4d5f26103e061bfeb8bb40bb8093c263837f6ac55c8e6bf7403778b",
|
||||
}, map[string]string{
|
||||
"vc_webhook_manager": "docker.io",
|
||||
"vc_controller_manager": "docker.io",
|
||||
"vc_scheduler": "docker.io",
|
||||
}),
|
||||
"volumesnapshots": NewAddon([]*BinAsset{
|
||||
// make sure the order of apply. `csi-hostpath-snapshotclass` must be the first position, because it depends on `snapshot.storage.k8s.io_volumesnapshotclasses`
|
||||
// if user disable volumesnapshots addon and delete `csi-hostpath-snapshotclass` after `snapshot.storage.k8s.io_volumesnapshotclasses`, kubernetes will return the error
|
||||
|
|
|
@ -53,6 +53,9 @@ tests the inspektor-gadget addon by ensuring the pod has come up and addon disab
|
|||
#### validateCloudSpannerAddon
|
||||
tests the cloud-spanner addon by ensuring the deployment and pod come up and addon disables
|
||||
|
||||
#### validateVolcanoAddon
|
||||
tests the Volcano addon, makes sure the Volcano is installed into cluster.
|
||||
|
||||
## TestCertOptions
|
||||
makes sure minikube certs respect the --apiserver-ips and --apiserver-names parameters
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import (
|
|||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -78,7 +79,7 @@ func TestAddons(t *testing.T) {
|
|||
// so we override that here to let minikube auto-detect appropriate cgroup driver
|
||||
os.Setenv(constants.MinikubeForceSystemdEnv, "")
|
||||
|
||||
args := append([]string{"start", "-p", profile, "--wait=true", "--memory=4000", "--alsologtostderr", "--addons=registry", "--addons=metrics-server", "--addons=volumesnapshots", "--addons=csi-hostpath-driver", "--addons=gcp-auth", "--addons=cloud-spanner", "--addons=inspektor-gadget"}, StartArgs()...)
|
||||
args := append([]string{"start", "-p", profile, "--wait=true", "--memory=4000", "--alsologtostderr", "--addons=registry", "--addons=metrics-server", "--addons=volumesnapshots", "--addons=csi-hostpath-driver", "--addons=gcp-auth", "--addons=cloud-spanner", "--addons=inspektor-gadget", "--addons=volcano"}, StartArgs()...)
|
||||
if !NoneDriver() { // none driver does not support ingress
|
||||
args = append(args, "--addons=ingress", "--addons=ingress-dns")
|
||||
}
|
||||
|
@ -111,6 +112,7 @@ func TestAddons(t *testing.T) {
|
|||
{"CSI", validateCSIDriverAndSnapshots},
|
||||
{"Headlamp", validateHeadlampAddon},
|
||||
{"CloudSpanner", validateCloudSpannerAddon},
|
||||
{"Volcano", validateVolcanoAddon},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
|
@ -837,3 +839,94 @@ func validateCloudSpannerAddon(ctx context.Context, t *testing.T, profile string
|
|||
t.Errorf("failed to disable cloud-spanner addon: args %q : %v", rr.Command(), err)
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
volcanoNamespace := "volcano-system"
|
||||
|
||||
client, err := kapi.Client(profile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get Kubernetes client for %s: %v", profile, err)
|
||||
}
|
||||
|
||||
// Wait for the volcano component installation to complete
|
||||
start := time.Now()
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(3)
|
||||
go func() {
|
||||
if err := kapi.WaitForDeploymentToStabilize(client, volcanoNamespace, "volcano-scheduler", Minutes(6)); err != nil {
|
||||
t.Errorf("failed waiting for volcano-scheduler deployment to stabilize: %v", err)
|
||||
} else {
|
||||
t.Logf("volcano-scheduler stabilized in %s", time.Since(start))
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
if err := kapi.WaitForDeploymentToStabilize(client, volcanoNamespace, "volcano-admission", Minutes(6)); err != nil {
|
||||
t.Errorf("failed waiting for volcano-admission deployment to stabilize: %v", err)
|
||||
} else {
|
||||
t.Logf("volcano-admission stabilized in %s", time.Since(start))
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
if err := kapi.WaitForDeploymentToStabilize(client, volcanoNamespace, "volcano-controller", Minutes(6)); err != nil {
|
||||
t.Errorf("failed waiting for volcano-controller deployment to stabilize: %v", err)
|
||||
} else {
|
||||
t.Logf("volcano-controller stabilized in %s", time.Since(start))
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
wg.Wait()
|
||||
|
||||
if _, err := PodWait(ctx, t, profile, volcanoNamespace, "app=volcano-scheduler", Minutes(6)); err != nil {
|
||||
t.Fatalf("failed waiting for app=volcano-scheduler pod: %v", err)
|
||||
}
|
||||
|
||||
if _, err := PodWait(ctx, t, profile, volcanoNamespace, "app=volcano-admission", Minutes(6)); err != nil {
|
||||
t.Fatalf("failed waiting for app=volcano-admission pod: %v", err)
|
||||
}
|
||||
|
||||
if _, err := PodWait(ctx, t, profile, volcanoNamespace, "app=volcano-controller", Minutes(6)); err != nil {
|
||||
t.Fatalf("failed waiting for app=volcano-controller pod: %v", err)
|
||||
}
|
||||
|
||||
// When the volcano deployment is complete, delete the volcano-admission-init job, it will affect the tests
|
||||
rr, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "delete", "-n", volcanoNamespace, "job", "volcano-admission-init"))
|
||||
if err != nil {
|
||||
t.Logf("vcjob creation with %s failed: %v", rr.Command(), err)
|
||||
}
|
||||
|
||||
// Create a vcjob
|
||||
rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "create", "-f", filepath.Join(*testdataDir, "vcjob.yaml")))
|
||||
if err != nil {
|
||||
t.Logf("vcjob creation with %s failed: %v", rr.Command(), err)
|
||||
}
|
||||
|
||||
want := "test-job"
|
||||
checkVolcano := func() error {
|
||||
// check the vcjob
|
||||
rr, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "vcjob", "-n", "my-volcano"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if rr.Stderr.String() != "" {
|
||||
t.Logf("%v: unexpected stderr: %s", rr.Command(), rr.Stderr)
|
||||
}
|
||||
if !strings.Contains(rr.Stdout.String(), want) {
|
||||
return fmt.Errorf("%v stdout = %q, want %q", rr.Command(), rr.Stdout, want)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := retry.Expo(checkVolcano, time.Second*3, Minutes(6)); err != nil {
|
||||
t.Errorf("failed checking volcano: %v", err.Error())
|
||||
}
|
||||
|
||||
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "addons", "disable", "volcano", "--alsologtostderr", "-v=1"))
|
||||
if err != nil {
|
||||
t.Errorf("failed to disable volcano addon: args %q: %v", rr.Command(), err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: my-volcano
|
||||
|
||||
---
|
||||
|
||||
apiVersion: batch.volcano.sh/v1alpha1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: test-job
|
||||
namespace: my-volcano
|
||||
spec:
|
||||
minAvailable: 1
|
||||
schedulerName: volcano
|
||||
queue: default
|
||||
tasks:
|
||||
- replicas: 1
|
||||
name: nginx
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx
|
||||
name: nginx
|
Loading…
Reference in New Issue