|
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"
|
@@ -383,6 +384,19 @@ var _ = Describe("Managed cluster should", framework.LabelMachines, func() {
|
383 | 384 | // Machines required for test: 0
|
384 | 385 | // Reason: The machineSet creation is rejected by the webhook.
|
385 | 386 | It("reject invalid machinesets", func() {
|
| 387 | + client, err := framework.LoadClient() |
| 388 | + Expect(err).ToNot(HaveOccurred(), "Controller-runtime client should be able to be created") |
| 389 | + // Only run on platforms that have webhooks |
| 390 | + clusterInfra, err := framework.GetInfrastructure(ctx, client) |
| 391 | + Expect(err).NotTo(HaveOccurred(), "Should be able to get Infrastructure") |
| 392 | + platform := clusterInfra.Status.PlatformStatus.Type |
| 393 | + switch platform { |
| 394 | + case configv1.AWSPlatformType, configv1.AzurePlatformType, configv1.GCPPlatformType, configv1.VSpherePlatformType, configv1.PowerVSPlatformType, configv1.NutanixPlatformType: |
| 395 | + // Do Nothing |
| 396 | + default: |
| 397 | + Skip(fmt.Sprintf("Platform %s does not have webhooks, skipping.", platform)) |
| 398 | + } |
| 399 | + |
386 | 400 | By("Creating invalid machineset")
|
387 | 401 | invalidMachineSet := invalidMachinesetWithEmptyProviderConfig()
|
388 | 402 | expectedAdmissionWebhookErr := "admission webhook \"default.machineset.machine.openshift.io\" denied the request: providerSpec.value: Required value: a value must be provided"
|
|
0 commit comments