Skip to content

Commit 9da0573

Browse files
authored
Merge pull request #623 from sdmodi/gnp-xpn-fix
Skip the VPC validation for XPN clusters in GNP controller
2 parents cba227b + b91cec7 commit 9da0573

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

pkg/controller/gkenetworkparamset/gnpcontroller_validations.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ func (c *Controller) validateGKENetworkParamSet(ctx context.Context, params *net
8383
}, nil
8484
}
8585

86-
network, err := c.gceCloud.GetNetwork(params.Spec.VPC)
87-
if err != nil || network == nil {
88-
return &gnpValidation{
89-
IsValid: false,
90-
ErrorReason: networkv1.VPCNotFound,
91-
ErrorMessage: fmt.Sprintf("VPC: %s not found", params.Spec.VPC),
92-
}, nil
86+
if !c.gceCloud.OnXPN() {
87+
network, err := c.gceCloud.GetNetwork(params.Spec.VPC)
88+
if err != nil || network == nil {
89+
return &gnpValidation{
90+
IsValid: false,
91+
ErrorReason: networkv1.VPCNotFound,
92+
ErrorMessage: fmt.Sprintf("VPC: %s not found", params.Spec.VPC),
93+
}, nil
94+
}
9395
}
9496

9597
//check if both deviceMode and secondary ranges are unspecified

providers/gce/support.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type gceProjectRouter struct {
3434
// ProjectID returns the project ID to be used for the given operation.
3535
func (r *gceProjectRouter) ProjectID(ctx context.Context, version meta.Version, service string) string {
3636
switch service {
37-
case "Firewalls", "Routes", "Subnetworks":
37+
case "Firewalls", "Routes", "Subnetworks", "Networks":
3838
return r.gce.NetworkProjectID()
3939
default:
4040
return r.gce.projectID

0 commit comments

Comments
 (0)