|
8 | 8 | . "github.com/onsi/ginkgo/v2"
|
9 | 9 | . "github.com/onsi/gomega"
|
10 | 10 |
|
| 11 | + configv1 "github.com/openshift/api/config/v1" |
11 | 12 | machinev1 "github.com/openshift/api/machine/v1beta1"
|
12 | 13 | corev1 "k8s.io/api/core/v1"
|
13 | 14 | policyv1 "k8s.io/api/policy/v1"
|
@@ -386,6 +387,19 @@ var _ = Describe("Managed cluster should", framework.LabelMachines, func() {
|
386 | 387 | // Machines required for test: 0
|
387 | 388 | // Reason: The machineSet creation is rejected by the webhook.
|
388 | 389 | It("reject invalid machinesets", func() {
|
| 390 | + client, err := framework.LoadClient() |
| 391 | + Expect(err).ToNot(HaveOccurred(), "Controller-runtime client should be able to be created") |
| 392 | + // Only run on platforms that have webhooks |
| 393 | + clusterInfra, err := framework.GetInfrastructure(ctx, client) |
| 394 | + Expect(err).NotTo(HaveOccurred(), "Should be able to get Infrastructure") |
| 395 | + platform := clusterInfra.Status.PlatformStatus.Type |
| 396 | + switch platform { |
| 397 | + case configv1.AWSPlatformType, configv1.AzurePlatformType, configv1.GCPPlatformType, configv1.VSpherePlatformType, configv1.PowerVSPlatformType, configv1.NutanixPlatformType: |
| 398 | + // Do Nothing |
| 399 | + default: |
| 400 | + Skip(fmt.Sprintf("Platform %s does not have webhooks, skipping.", platform)) |
| 401 | + } |
| 402 | + |
389 | 403 | By("Creating invalid machineset")
|
390 | 404 | invalidMachineSet := invalidMachinesetWithEmptyProviderConfig()
|
391 | 405 | expectedAdmissionWebhookErr := "admission webhook \"default.machineset.machine.openshift.io\" denied the request: providerSpec.value: Required value: a value must be provided"
|
|
0 commit comments