Skip to content

Commit b38949b

Browse files
authored
Merge pull request #748 from liuyuan10/vpc
Allow multiple device networks to have the same VPC
2 parents ae239a3 + 7905a77 commit b38949b

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

pkg/controller/gkenetworkparamset/gkenetworkparamset_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,8 @@ func TestGKENetworkParamSetValidations(t *testing.T) {
667667
},
668668
expectedCondition: metav1.Condition{
669669
Type: "Ready",
670-
Status: metav1.ConditionFalse,
671-
Reason: "DeviceModeVPCAlreadyInUse",
670+
Status: metav1.ConditionTrue,
671+
Reason: "GNPReady",
672672
},
673673
},
674674
{

pkg/controller/gkenetworkparamset/gnpcontroller_validations.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,26 +227,17 @@ func (c *Controller) validateGKENetworkParamSet(ctx context.Context, params *net
227227
}
228228
}
229229

230-
//if GNP with deviceMode and referencing VPC or Subnet is referenced in any other existing GNP
230+
//if GNP with deviceMode and referencing Subnet is referenced in any other existing GNP
231231
if isDeviceModeSpecified {
232232
gnpList, err := c.networkClientset.NetworkingV1().GKENetworkParamSets().List(ctx, metav1.ListOptions{})
233233
if err != nil {
234234
return nil, err
235235
}
236236
for _, otherGNP := range gnpList.Items {
237237
isDifferentGNP := params.Name != otherGNP.Name
238-
isMatchingVPC := params.Spec.VPC == otherGNP.Spec.VPC
239238
isMatchingSubnet := params.Spec.VPCSubnet == otherGNP.Spec.VPCSubnet
240239
isParamsNewer := params.CreationTimestamp.After(otherGNP.CreationTimestamp.Time)
241240

242-
if isDifferentGNP && isMatchingVPC && isParamsNewer {
243-
return &gnpValidation{
244-
IsValid: false,
245-
ErrorReason: networkv1.DeviceModeVPCAlreadyInUse,
246-
ErrorMessage: fmt.Sprintf("GNP with deviceMode can't reference a VPC already in use. VPC '%s' is already in use by '%s'", otherGNP.Spec.VPC, otherGNP.Name),
247-
}, nil
248-
}
249-
250241
if isDifferentGNP && isMatchingSubnet && isParamsNewer {
251242
return &gnpValidation{
252243
IsValid: false,

0 commit comments

Comments
 (0)