Merge pull request #8942 from blackpiglet/fix_migration_fail_with_bsl_vsl_creation_in_standby
Some checks failed
Run the E2E test on kind / build (push) Failing after 6m34s
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 32s
Close stale issues and PRs / stale (push) Successful in 9s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 2m34s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 1m31s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 48s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 44s

Add velero.io APIs availability check in Velero E2E install function.
This commit is contained in:
Daniel Jiang
2025-05-19 14:19:50 +08:00
committed by GitHub

View File

@@ -183,7 +183,7 @@ func VeleroInstall(ctx context.Context, veleroCfg *test.VeleroConfig, isStandbyC
WithoutDisableInformerCacheParam: veleroCfg.WithoutDisableInformerCacheParam,
},
); err != nil {
time.Sleep(9 * time.Hour)
time.Sleep(1 * time.Minute)
RunDebug(context.Background(), veleroCfg.VeleroCLI, veleroCfg.VeleroNamespace, "", "")
return errors.WithMessagef(err, "Failed to install Velero in the cluster")
}
@@ -433,6 +433,26 @@ func createVeleroResources(ctx context.Context, cli, namespace string, args []st
return errors.Wrapf(err, "failed to wait the CRDs be ready")
}
// Wait the Velero CRD API endpoint is ready
wait.PollUntilContextTimeout(ctx, k8s.PollInterval, time.Minute, true, func(ctx context.Context) (bool, error) {
v1VerifyCmd := exec.CommandContext(ctx, "kubectl", "get", "--raw", "/apis/velero.io/v1")
v1VerifyCmd.Stdout = os.Stdout
v1VerifyCmd.Stderr = os.Stderr
if err := v1VerifyCmd.Run(); err != nil {
fmt.Printf("/apis/velero.io/v1 is not ready: %s.\n", err.Error())
return false, nil
}
v2alpha1VerifyCmd := exec.CommandContext(ctx, "kubectl", "get", "--raw", "/apis/velero.io/v2alpha1")
v2alpha1VerifyCmd.Stdout = os.Stdout
v2alpha1VerifyCmd.Stderr = os.Stderr
if err := v2alpha1VerifyCmd.Run(); err != nil {
fmt.Printf("/apis/velero.io/v2alpha1 is not ready: %s.\n", err.Error())
return false, nil
}
return true, nil
})
// remove the "--crds-only" option from the args
args = args[:len(args)-1]
cmd = exec.CommandContext(ctx, cli, args...)