Skip to content

Commit

Permalink
Move the dynamic validator out of api/
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl committed Jul 10, 2023
1 parent 629913b commit c7a5fa4
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/api/openshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ type MasterProfile struct {
type VMSize string

// VMSize constants
// add required resources in pkg/api/validate/dynamic/quota.go when adding a new VMSize
// add required resources in pkg/validate/dynamic/quota.go when adding a new VMSize
const (
VMSizeStandardD2sV3 VMSize = "Standard_D2s_v3"
VMSizeStandardD4sV3 VMSize = "Standard_D4s_v3"
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"context"

"github.com/Azure/ARO-RP/pkg/api"
"github.com/Azure/ARO-RP/pkg/api/validate"
"github.com/Azure/ARO-RP/pkg/validate"
)

func (m *manager) validateResources(ctx context.Context) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/sirupsen/logrus"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/Azure/ARO-RP/pkg/api/validate/dynamic"
"github.com/Azure/ARO-RP/pkg/util/azureclient"
"github.com/Azure/ARO-RP/pkg/util/clusterauthorizer"
"github.com/Azure/ARO-RP/pkg/validate/dynamic"
)

type servicePrincipalChecker interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"github.com/golang/mock/gomock"
"github.com/sirupsen/logrus"

"github.com/Azure/ARO-RP/pkg/api/validate/dynamic"
"github.com/Azure/ARO-RP/pkg/util/azureclient"
"github.com/Azure/ARO-RP/pkg/util/clusterauthorizer"
mock_dynamic "github.com/Azure/ARO-RP/pkg/util/mocks/dynamic"
"github.com/Azure/ARO-RP/pkg/validate/dynamic"
utilerror "github.com/Azure/ARO-RP/test/util/error"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/util/mocks/dynamic/dynamic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"

"github.com/Azure/ARO-RP/pkg/api"
api_subnet "github.com/Azure/ARO-RP/pkg/api/util/subnet"
"github.com/Azure/ARO-RP/pkg/env"
"github.com/Azure/ARO-RP/pkg/util/azureclient"
"github.com/Azure/ARO-RP/pkg/util/azureclient/authz/remotepdp"
Expand All @@ -29,7 +30,6 @@ import (
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/network"
"github.com/Azure/ARO-RP/pkg/util/permissions"
"github.com/Azure/ARO-RP/pkg/util/steps"
"github.com/Azure/ARO-RP/pkg/util/subnet"
"github.com/Azure/ARO-RP/pkg/util/token"
)

Expand Down Expand Up @@ -160,7 +160,7 @@ func (dv *dynamic) ValidateVnet(
// get unique vnets from subnets
vnets := make(map[string]azure.Resource)
for _, s := range subnets {
vnetID, _, err := subnet.Split(s.ID)
vnetID, _, err := api_subnet.Split(s.ID)
if err != nil {
return err
}
Expand Down Expand Up @@ -260,7 +260,7 @@ func (dv *dynamic) validateVnetPermissions(ctx context.Context, vnet azure.Resou
func (dv *dynamic) validateRouteTablePermissions(ctx context.Context, s Subnet) error {
dv.log.Printf("validateRouteTablePermissions")

vnetID, _, err := subnet.Split(s.ID)
vnetID, _, err := api_subnet.Split(s.ID)
if err != nil {
return err
}
Expand Down Expand Up @@ -322,7 +322,7 @@ func (dv *dynamic) validateRouteTablePermissions(ctx context.Context, s Subnet)
func (dv *dynamic) validateNatGatewayPermissions(ctx context.Context, s Subnet) error {
dv.log.Printf("validateNatGatewayPermissions")

vnetID, _, err := subnet.Split(s.ID)
vnetID, _, err := api_subnet.Split(s.ID)
if err != nil {
return err
}
Expand Down Expand Up @@ -530,7 +530,7 @@ func (dv *dynamic) validateCIDRRanges(ctx context.Context, subnets []Subnet, add

// unique names of subnets from all node pools
for _, s := range subnets {
vnetID, _, err := subnet.Split(s.ID)
vnetID, _, err := api_subnet.Split(s.ID)
if err != nil {
return err
}
Expand Down Expand Up @@ -619,7 +619,7 @@ func (dv *dynamic) createSubnetMapByID(ctx context.Context, subnets []Subnet) (m
subnetByID := make(map[string]*mgmtnetwork.Subnet)

for _, s := range subnets {
vnetID, _, err := subnet.Split(s.ID)
vnetID, _, err := api_subnet.Split(s.ID)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -709,7 +709,7 @@ func (dv *dynamic) ValidateSubnets(ctx context.Context, oc *api.OpenShiftCluster

if oc.Properties.ProvisioningState == api.ProvisioningStateCreating {
if subnetHasNSGAttached(ss) && oc.Properties.NetworkProfile.PreconfiguredNSG != api.PreconfiguredNSGEnabled {
expectedNsgID, err := subnet.NetworkSecurityGroupID(oc, s.ID)
expectedNsgID, err := api_subnet.NetworkSecurityGroupID(oc, s.ID)
if err != nil {
return err
}
Expand All @@ -721,7 +721,7 @@ func (dv *dynamic) ValidateSubnets(ctx context.Context, oc *api.OpenShiftCluster
}
}
} else {
nsgID, err := subnet.NetworkSecurityGroupID(oc, *ss.ID)
nsgID, err := api_subnet.NetworkSecurityGroupID(oc, *ss.ID)
if err != nil {
return err
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"k8s.io/apimachinery/pkg/util/wait"

"github.com/Azure/ARO-RP/pkg/api"
"github.com/Azure/ARO-RP/pkg/api/validate/dynamic"
"github.com/Azure/ARO-RP/pkg/env"
"github.com/Azure/ARO-RP/pkg/util/azureclient/authz/remotepdp"
"github.com/Azure/ARO-RP/pkg/util/feature"
"github.com/Azure/ARO-RP/pkg/validate/dynamic"
)

// OpenShiftClusterDynamicValidator is the dynamic validator interface
Expand Down

0 comments on commit c7a5fa4

Please sign in to comment.