Skip to content

Commit

Permalink
Start using alpha NEG APIs in order to support new IPv6 field
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravkghildiyal committed Apr 28, 2023
1 parent 87909fa commit 75a28a7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/neg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/ingress-gce/pkg/annotations"
"k8s.io/ingress-gce/pkg/flags"
"k8s.io/ingress-gce/pkg/network"
"k8s.io/ingress-gce/pkg/utils"
"k8s.io/ingress-gce/pkg/utils/namer"
Expand Down Expand Up @@ -287,6 +288,21 @@ func (key NegSyncerKey) String() string {
// GetAPIVersion returns the compute API version to be used in order
// to create the negType specified in the given NegSyncerKey.
func (key NegSyncerKey) GetAPIVersion() meta.Version {
if flags.F.EnableDualStackNEG {
// This condition can be removed when we're getting rid of the feature flag
// or when GCE meta.VersionGA API supports the IPv6 fields.
//
// As an exception, it's easier here to access the global flag value and not
// plumb it into the NegSyncerKey. Generally, code within the NEG controller
// tires to avoid accessing global flag values to aid with scenarios in unit
// testing -- in this case though, the actual differentiator between Alpha
// and other versions is NOT something that can (or rather should) be
// covered within unit tests.
//
// TODO(gauravkghildiyal): Start using Beta APIs once they have the
// necessary changes.
return meta.VersionAlpha
}
switch key.NegType {
case NonGCPPrivateEndpointType:
return meta.VersionAlpha
Expand Down

0 comments on commit 75a28a7

Please sign in to comment.