Skip to content

Commit

Permalink
Fix NSG e2e error
Browse files Browse the repository at this point in the history
  • Loading branch information
nwnt committed Sep 11, 2023
1 parent da0aa0c commit eb9df50
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 34 deletions.
68 changes: 34 additions & 34 deletions pkg/validate/openshiftcluster_validatedynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,40 +172,6 @@ func (dv *openShiftClusterDynamicValidator) Dynamic(ctx context.Context) error {
)
}

// FP validation
fpDynamic := dynamic.NewValidator(
dv.log,
dv.env,
dv.env.Environment(),
dv.subscriptionDoc.ID,
dv.fpAuthorizer,
dv.env.FPClientID(),
dynamic.AuthorizerFirstParty,
fpClientCred,
pdpClient,
)

err = fpDynamic.ValidateVnet(
ctx,
dv.oc.Location,
subnets,
dv.oc.Properties.NetworkProfile.PodCIDR,
dv.oc.Properties.NetworkProfile.ServiceCIDR,
)
if err != nil {
return err
}

err = fpDynamic.ValidateDiskEncryptionSets(ctx, dv.oc)
if err != nil {
return err
}

err = fpDynamic.ValidatePreConfiguredNSGs(ctx, dv.oc, subnets)
if err != nil {
return err
}

tenantID := dv.subscriptionDoc.Subscription.Properties.TenantID
options := dv.env.Environment().ClientSecretCredentialOptions()
spTokenCredential, err := azidentity.NewClientSecretCredential(
Expand Down Expand Up @@ -275,5 +241,39 @@ func (dv *openShiftClusterDynamicValidator) Dynamic(ctx context.Context) error {
return err
}

// FP validation
fpDynamic := dynamic.NewValidator(
dv.log,
dv.env,
dv.env.Environment(),
dv.subscriptionDoc.ID,
dv.fpAuthorizer,
dv.env.FPClientID(),
dynamic.AuthorizerFirstParty,
fpClientCred,
pdpClient,
)

err = fpDynamic.ValidateVnet(
ctx,
dv.oc.Location,
subnets,
dv.oc.Properties.NetworkProfile.PodCIDR,
dv.oc.Properties.NetworkProfile.ServiceCIDR,
)
if err != nil {
return err
}

err = fpDynamic.ValidateDiskEncryptionSets(ctx, dv.oc)
if err != nil {
return err
}

err = fpDynamic.ValidatePreConfiguredNSGs(ctx, dv.oc, subnets)
if err != nil {
return err
}

return nil
}
9 changes: 9 additions & 0 deletions test/e2e/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,15 @@ var _ = Describe("ARO Operator - Azure Subnet Reconciler", func() {
}

BeforeEach(func(ctx context.Context) {
// TODO remove this when GA
By("checking if preconfiguredNSG is enabled")
co, err := clients.AROClusters.AroV1alpha1().Clusters().Get(ctx, "cluster", metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
if co.Spec.OperatorFlags["aro.azuresubnets.nsg.managed"] == "false" {
Skip("preconfiguredNSG is enabled, skipping test")
}
By("preconfiguredNSG is disabled")

gatherNetworkInfo(ctx)
createE2ENSG(ctx)
})
Expand Down

0 comments on commit eb9df50

Please sign in to comment.