Skip to content

Commit

Permalink
Update go version to 1.19. Run go mod tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
panslava committed Aug 12, 2022
1 parent c926ab5 commit 4a6d2df
Show file tree
Hide file tree
Showing 62 changed files with 205 additions and 2,294 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ARCH ?= amd64
ALL_ARCH := amd64

# Image to use for building.
BUILD_IMAGE ?= golang:1.16-alpine
BUILD_IMAGE ?= golang:1.19-alpine
# Containers will be named: $(CONTAINER_PREFIX)-$(BINARY)-$(ARCH):$(VERSION).
CONTAINER_PREFIX ?= ingress-gce

Expand Down
16 changes: 8 additions & 8 deletions cmd/e2e-test/neg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ func TestNegCRDTransitions(t *testing.T) {
annotations: annotations.NegAnnotation{
Ingress: false,
ExposedPorts: map[int32]annotations.NegAttributes{
port80.Number: annotations.NegAttributes{Name: expectedNEGName},
port443.Number: annotations.NegAttributes{},
port80.Number: {Name: expectedNEGName},
port443.Number: {},
}},
replicas: 2,
expectedNegAttrs: map[string]string{strconv.Itoa(int(port80.Number)): expectedNEGName, strconv.Itoa(int(port443.Number)): ""},
Expand All @@ -420,8 +420,8 @@ func TestNegCRDTransitions(t *testing.T) {
annotations: annotations.NegAnnotation{
Ingress: false,
ExposedPorts: map[int32]annotations.NegAttributes{
port80.Number: annotations.NegAttributes{},
port443.Number: annotations.NegAttributes{},
port80.Number: {},
port443.Number: {},
}},
replicas: 2,
expectedNegAttrs: map[string]string{strconv.Itoa(int(port80.Number)): "", strconv.Itoa(int(port443.Number)): ""},
Expand All @@ -431,8 +431,8 @@ func TestNegCRDTransitions(t *testing.T) {
annotations: annotations.NegAnnotation{
Ingress: false,
ExposedPorts: map[int32]annotations.NegAttributes{
port80.Number: annotations.NegAttributes{},
port443.Number: annotations.NegAttributes{Name: expectedNEGName},
port80.Number: {},
port443.Number: {Name: expectedNEGName},
}},
replicas: 2,
expectedNegAttrs: map[string]string{strconv.Itoa(int(port80.Number)): "", strconv.Itoa(int(port443.Number)): expectedNEGName},
Expand Down Expand Up @@ -492,7 +492,7 @@ func TestNegCRDErrorEvents(t *testing.T) {
annotation := annotations.NegAnnotation{
Ingress: true,
ExposedPorts: map[int32]annotations.NegAttributes{
port80.Number: annotations.NegAttributes{Name: expectedNEGName},
port80.Number: {Name: expectedNEGName},
},
}

Expand Down Expand Up @@ -567,7 +567,7 @@ func TestNegDisruptive(t *testing.T) {

annotation := annotations.NegAnnotation{
ExposedPorts: map[int32]annotations.NegAttributes{
port80.Number: annotations.NegAttributes{},
port80.Number: {},
},
}

Expand Down
7 changes: 5 additions & 2 deletions cmd/glbc/app/namer.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ func NewStaticNamer(kubeClient kubernetes.Interface, clusterName, fwName string)
// a name from a ConfigMap. The returned value follows this priority:
//
// If the provided 'defaultName' is not empty, that name is used.
// This is effectively a client override via a command line flag.
//
// This is effectively a client override via a command line flag.
//
// else, check cfgVault with 'configMapKey' as a key and if found, use the associated value
// else, return an empty 'name' and pass along an error iff the configmap lookup is erroneous.
func useDefaultOrLookupVault(cfgVault *storage.ConfigMapVault, configMapKey, defaultName string) (string, error) {
Expand Down Expand Up @@ -150,7 +152,8 @@ func getFirewallName(kubeClient kubernetes.Interface, name, clusterUID string) (
// If the user specifies a --cluster-uid param it overwrites everything
// else, check UID config map for a previously recorded uid
// else, check if there are any working Ingresses
// - remember that "" is the cluster uid
// - remember that "" is the cluster uid
//
// else, allocate a new uid
func getClusterUID(kubeClient kubernetes.Interface, name string) (string, error) {
cfgVault := storage.NewConfigMapVault(kubeClient, metav1.NamespaceSystem, uidConfigMapName)
Expand Down
63 changes: 57 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
module k8s.io/ingress-gce

go 1.16
go 1.19

require (
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.1-0.20220218231025-f11817397a1b
github.com/go-openapi/spec v0.19.3
github.com/google/go-cmp v0.5.6
github.com/imdario/mergo v0.3.7 // indirect
github.com/kr/pretty v0.2.0
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/client_model v0.2.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
google.golang.org/api v0.60.0
gopkg.in/gcfg.v1 v1.2.3 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
istio.io/api v0.0.0-20190809125725-591cf32c1d0e
k8s.io/api v0.22.2
k8s.io/apiextensions-apiserver v0.20.0
Expand All @@ -29,3 +24,59 @@ require (
k8s.io/legacy-cloud-providers v0.20.0
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
)

require (
cloud.google.com/go v0.97.0 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403 // indirect
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0 // indirect
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.3 // indirect
github.com/go-openapi/swag v0.19.5 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mailru/easyjson v0.7.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/common v0.10.0 // indirect
github.com/prometheus/procfs v0.2.0 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211021150943-2b146023228c // indirect
google.golang.org/grpc v1.40.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/gcfg.v1 v1.2.3 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20200415212048-7901bc822317/go.mod h1:DF8FZRxMHMGv/vP2lQP6h+dYzzjpuRn24VeRiYn3qjQ=
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.0 h1:bmLVE4VV8Zcx5iRDkCVsWhP3DOQHfnkUs8jGp3kOJKc=
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.0/go.mod h1:FNj4KYEAAHfYu68kRYolGoxkaJn+6mdEsaM12VTwuI0=
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.1-0.20220218231025-f11817397a1b h1:Heo1J/ttaQFgGJSVnCZquy3e5eH5j1nqxBuomztB3P0=
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.18.1-0.20220218231025-f11817397a1b/go.mod h1:FNj4KYEAAHfYu68kRYolGoxkaJn+6mdEsaM12VTwuI0=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
Expand Down Expand Up @@ -982,8 +980,6 @@ k8s.io/client-go v0.22.2 h1:DaSQgs02aCC1QcwUdkKZWOeaVsQjYvWv8ZazcZ6JcHc=
k8s.io/client-go v0.22.2/go.mod h1:sAlhrkVDf50ZHx6z4K0S40wISNTarf1r800F+RlCF6U=
k8s.io/cloud-provider v0.20.0 h1:CVPQ66iyfNgeGomUq2jE/TWrfzE77bdCpemhFS8955U=
k8s.io/cloud-provider v0.20.0/go.mod h1:Lz/luSVD5BrHDDhtVdjFh0C2qQCRYdf0b9BHQ9L+bXc=
k8s.io/cloud-provider-gcp v0.21.0 h1:dZUWxMltT/PLYmvmA00O5M4ug+8bDFmA054aVa9tna0=
k8s.io/cloud-provider-gcp/providers v0.21.1 h1:eUgGWakdxS7+yNrldf5zcY+3SfFRiVltnV/mBof/fsw=
k8s.io/code-generator v0.20.0/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg=
k8s.io/component-base v0.20.0 h1:BXGL8iitIQD+0NgW49UsM7MraNUUGDU3FBmrfUAtmVQ=
k8s.io/component-base v0.20.0/go.mod h1:wKPj+RHnAr8LW2EIBIK7AxOHPde4gme2lzXwVSoRXeA=
Expand Down
2 changes: 1 addition & 1 deletion pkg/backends/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
}
// TODO: (shance) refactor all scope to be above the serviceport level
scopeToFeatures = map[meta.KeyType][]string{
meta.Regional: []string{FeatureL7ILB, FeatureVMIPNEG},
meta.Regional: {FeatureL7ILB, FeatureVMIPNEG},
}
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/backends/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newPortset(ports []utils.ServicePort) *portset {

func (p *portset) existingPorts() []utils.ServicePort {
var result []utils.ServicePort
for sp, _ := range p.existing {
for sp := range p.existing {
result = append(result, sp)
}
return result
Expand Down Expand Up @@ -93,7 +93,7 @@ func (p *portset) del(ports []utils.ServicePort) error {
// check() iterates through all and checks that the ports in 'existing' exist in gce, and that those
// that are not in 'existing' do not exist
func (p *portset) check(fakeGCE *gce.Cloud) error {
for sp, _ := range p.all {
for sp := range p.all {
_, found := p.existing[sp]
beName := sp.BackendName()
key, err := composite.CreateKey(fakeGCE, beName, features.ScopeFromServicePort(&sp))
Expand Down
2 changes: 1 addition & 1 deletion pkg/composite/meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type GroupResourceInfo struct {
// GroupResourceServices support adding/removing objects from them. Examples are Instance Groups, NetworkEndpointGroups.
// Additional APIs to Attach/Detach objects will be created for these services.
var GroupResourceServices = map[string]*GroupResourceInfo{
"NetworkEndpointGroup": &GroupResourceInfo{
"NetworkEndpointGroup": {
AttachFuncName: "AttachNetworkEndpoints",
DetachFuncName: "DetachNetworkEndpoints",
AttachReqName: "NetworkEndpointGroupsAttachEndpointsRequest",
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ func TestMCIngressIG(t *testing.T) {
func TestToRuntimeInfoCerts(t *testing.T) {
lbc := newLoadBalancerController()
secretsMap := map[string]*api_v1.Secret{
"tlsCert": &api_v1.Secret{
"tlsCert": {
ObjectMeta: meta_v1.ObjectMeta{
Name: "tlsCert",
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/translator/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ func TestGatherEndpointPorts(t *testing.T) {
},
endpointSlices: []*discoveryapi.EndpointSlice{
createEndpointSlice(serviceName1, "-1", emptyPortName, 12345),
&discoveryapi.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: serviceName2 + "-1",
Namespace: "ns",
Expand All @@ -912,7 +912,7 @@ func TestGatherEndpointPorts(t *testing.T) {
createEndpointSlice(serviceName2, "-2", "", 6101),
createEndpointSlice(serviceName2, "-3", testPortName, 6201),
createEndpointSlice(serviceName3, "-1", "", 23456),
&discoveryapi.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: serviceName4 + "-1",
Namespace: "ns",
Expand Down
4 changes: 2 additions & 2 deletions pkg/crd/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

var metav1OpenAPISpec = map[string]common.OpenAPIDefinition{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time": common.OpenAPIDefinition{
"k8s.io/apimachinery/pkg/apis/meta/v1.Time": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: metav1.Time{}.OpenAPISchemaType(),
Expand All @@ -36,7 +36,7 @@ var metav1OpenAPISpec = map[string]common.OpenAPIDefinition{
},
},
},
"k8s.io/api/core/v1.TypedLocalObjectReference": common.OpenAPIDefinition{
"k8s.io/api/core/v1.TypedLocalObjectReference": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Expand Down
6 changes: 3 additions & 3 deletions pkg/firewalls/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ func TestGetCustomHealthCheckPorts(t *testing.T) {
}{
{
desc: "One service port with custom port",
svcPorts: []utils.ServicePort{utils.ServicePort{BackendConfig: &v1.BackendConfig{Spec: v1.BackendConfigSpec{HealthCheck: &v1.HealthCheckConfig{Port: utils.NewInt64Pointer(8000)}}}}},
svcPorts: []utils.ServicePort{{BackendConfig: &v1.BackendConfig{Spec: v1.BackendConfigSpec{HealthCheck: &v1.HealthCheckConfig{Port: utils.NewInt64Pointer(8000)}}}}},
expect: []string{"8000"},
},
{
desc: "Two service ports with custom port",
svcPorts: []utils.ServicePort{utils.ServicePort{BackendConfig: &v1.BackendConfig{Spec: v1.BackendConfigSpec{HealthCheck: &v1.HealthCheckConfig{Port: utils.NewInt64Pointer(8000)}}}},
utils.ServicePort{BackendConfig: &v1.BackendConfig{Spec: v1.BackendConfigSpec{HealthCheck: &v1.HealthCheckConfig{Port: utils.NewInt64Pointer(9000)}}}}},
svcPorts: []utils.ServicePort{{BackendConfig: &v1.BackendConfig{Spec: v1.BackendConfigSpec{HealthCheck: &v1.HealthCheckConfig{Port: utils.NewInt64Pointer(8000)}}}},
{BackendConfig: &v1.BackendConfig{Spec: v1.BackendConfigSpec{HealthCheck: &v1.HealthCheckConfig{Port: utils.NewInt64Pointer(9000)}}}}},
expect: []string{"8000", "9000"},
},
{
Expand Down
4 changes: 2 additions & 2 deletions pkg/healthchecks/healthchecks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func init() {
for _, mode := range []string{"reg", "neg", "ilb"} {
for bck, bc := range map[string]*backendconfigv1.HealthCheckConfig{
"nil": nil,
"bc": &backendconfigv1.HealthCheckConfig{RequestPath: &path},
"bcall": &backendconfigv1.HealthCheckConfig{
"bc": {RequestPath: &path},
"bcall": {
RequestPath: &path,
CheckIntervalSec: &num,
TimeoutSec: &num,
Expand Down
4 changes: 2 additions & 2 deletions pkg/neg/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ func TestSyncNodesConditions(t *testing.T) {
expectSync: true,
negType: negtypes.VmIpPortEndpointType,
addZones: map[string][]string{
"zoneA": []string{"added-instance"},
"zoneA": {"added-instance"},
},
},
{
Expand All @@ -1448,7 +1448,7 @@ func TestSyncNodesConditions(t *testing.T) {
expectSync: true,
negType: negtypes.VmIpEndpointType,
addZones: map[string][]string{
"zoneA": []string{"added-instance"},
"zoneA": {"added-instance"},
},
},
{
Expand Down
6 changes: 3 additions & 3 deletions pkg/neg/syncers/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1321,19 +1321,19 @@ func TestUnknownNodes(t *testing.T) {
testEndpointSlices := getTestEndpointSlices(testService, testNamespace)
testEndpointSlices[0].Endpoints[0].NodeName = utilpointer.StringPtr("unknown-node")
testEndpointMap := map[string]*composite.NetworkEndpoint{
negtypes.TestZone1: &composite.NetworkEndpoint{
negtypes.TestZone1: {
Instance: negtypes.TestInstance1,
IpAddress: testIP1,
Port: testPort,
},

negtypes.TestZone2: &composite.NetworkEndpoint{
negtypes.TestZone2: {
Instance: negtypes.TestInstance3,
IpAddress: testIP2,
Port: testPort,
},

negtypes.TestZone4: &composite.NetworkEndpoint{
negtypes.TestZone4: {
Instance: negtypes.TestUpgradeInstance1,
IpAddress: testIP3,
Port: testPort,
Expand Down
6 changes: 3 additions & 3 deletions pkg/neg/types/fakes.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ func (f *FakeZoneGetter) ListZones(predicate utils.NodeConditionPredicate) ([]st
for zone := range f.zoneInstanceMap {
node := &v1.Node{
Status: v1.NodeStatus{
Conditions: []v1.NodeCondition{v1.NodeCondition{Type: v1.NodeReady, Status: v1.ConditionTrue}}}}
Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}}}}
if predicate(node) {
ret = append(ret, zone)
}
}
for zone := range f.unreadyInstancesMap {
node := &v1.Node{
Status: v1.NodeStatus{
Conditions: []v1.NodeCondition{v1.NodeCondition{Type: v1.NodeReady, Status: v1.ConditionFalse}}}}
Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionFalse}}}}
if predicate(node) {
ret = append(ret, zone)
}
Expand All @@ -93,7 +93,7 @@ func (f *FakeZoneGetter) ListZones(predicate utils.NodeConditionPredicate) ([]st
Labels: map[string]string{utils.GKECurrentOperationLabel: utils.NodeDrain},
},
Status: v1.NodeStatus{
Conditions: []v1.NodeCondition{v1.NodeCondition{Type: v1.NodeReady, Status: v1.ConditionTrue}}}}
Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}}}}
if predicate(node) {
ret = append(ret, zone)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/neg/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func TestPortInfoMapMerge(t *testing.T) {
},
{
"error on inconsistent neg name",
NewPortInfoMap(namespace, name, NewSvcPortTupleSet(SvcPortTuple{Port: 80, Name: "foo", TargetPort: "3000"}), namer, false, map[SvcPortTuple]string{SvcPortTuple{Port: 80, Name: "foo", TargetPort: "3000"}: "neg-1"}),
NewPortInfoMap(namespace, name, NewSvcPortTupleSet(SvcPortTuple{Port: 80, Name: "foo", TargetPort: "3000"}), namer, false, map[SvcPortTuple]string{{Port: 80, Name: "foo", TargetPort: "3000"}: "neg-1"}),
NewPortInfoMap(namespace, name, NewSvcPortTupleSet(SvcPortTuple{Port: 80, Name: "bar", TargetPort: "3000"}, SvcPortTuple{Port: 8000, TargetPort: "9000"}), namer, false, nil),
PortInfoMap{},
true,
Expand Down Expand Up @@ -345,9 +345,9 @@ func TestPortInfoMapDifference(t *testing.T) {
},
{
"difference of two non-empty maps with a key in common but different neg names",
NewPortInfoMap(namespace, name, NewSvcPortTupleSet(SvcPortTuple{Port: 80, TargetPort: "8080"}), namer, true, map[SvcPortTuple]string{SvcPortTuple{Port: 80, TargetPort: "8080"}: "neg-1"}),
NewPortInfoMap(namespace, name, NewSvcPortTupleSet(SvcPortTuple{Port: 80, TargetPort: "8080"}), namer, true, map[SvcPortTuple]string{{Port: 80, TargetPort: "8080"}: "neg-1"}),
NewPortInfoMap(namespace, name, NewSvcPortTupleSet(SvcPortTuple{Port: 80, TargetPort: "8080"}, SvcPortTuple{Port: 8080, TargetPort: "9000"}), namer, false, nil),
NewPortInfoMap(namespace, name, NewSvcPortTupleSet(SvcPortTuple{Port: 80, TargetPort: "8080"}), namer, true, map[SvcPortTuple]string{SvcPortTuple{Port: 80, TargetPort: "8080"}: "neg-1"}),
NewPortInfoMap(namespace, name, NewSvcPortTupleSet(SvcPortTuple{Port: 80, TargetPort: "8080"}), namer, true, map[SvcPortTuple]string{{Port: 80, TargetPort: "8080"}: "neg-1"}),
},
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/neg/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestNEGServicePorts(t *testing.T) {
},
},
expectedCustomNameMap: map[types.SvcPortTuple]string{
types.SvcPortTuple{Name: portName0, Port: 80, TargetPort: "namedport"}: "neg-name",
{Name: portName0, Port: 80, TargetPort: "namedport"}: "neg-name",
},
},
}
Expand Down
Loading

0 comments on commit 4a6d2df

Please sign in to comment.