endpointslice: reduce visibility of vars/funcs

Reduce the visibility of various public identifiers that are only used
within the scope of a package.

This was originally motivated by KEP-3685 in order to reduce the public
API surface and improve supportability.
This commit is contained in:
Akhil Velagapudi
2023-04-16 12:47:45 -07:00
parent f3cf92b79b
commit 69eccd41b8
9 changed files with 129 additions and 120 deletions

View File

@@ -41,8 +41,8 @@ func TestNewEndpointSlice(t *testing.T) {
portName := "foo"
protocol := v1.ProtocolTCP
endpointMeta := endpointMeta{
Ports: []discovery.EndpointPort{{Name: &portName, Protocol: &protocol}},
AddressType: ipAddressType,
ports: []discovery.EndpointPort{{Name: &portName, Protocol: &protocol}},
addressType: ipAddressType,
}
service := v1.Service{
ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "test"},
@@ -76,8 +76,8 @@ func TestNewEndpointSlice(t *testing.T) {
OwnerReferences: []metav1.OwnerReference{*ownerRef},
Namespace: service.Namespace,
},
Ports: endpointMeta.Ports,
AddressType: endpointMeta.AddressType,
Ports: endpointMeta.ports,
AddressType: endpointMeta.addressType,
Endpoints: []discovery.Endpoint{},
},
},
@@ -99,8 +99,8 @@ func TestNewEndpointSlice(t *testing.T) {
OwnerReferences: []metav1.OwnerReference{*ownerRef},
Namespace: service.Namespace,
},
Ports: endpointMeta.Ports,
AddressType: endpointMeta.AddressType,
Ports: endpointMeta.ports,
AddressType: endpointMeta.addressType,
Endpoints: []discovery.Endpoint{},
},
},
@@ -124,8 +124,8 @@ func TestNewEndpointSlice(t *testing.T) {
OwnerReferences: []metav1.OwnerReference{*ownerRef},
Namespace: service.Namespace,
},
Ports: endpointMeta.Ports,
AddressType: endpointMeta.AddressType,
Ports: endpointMeta.ports,
AddressType: endpointMeta.addressType,
Endpoints: []discovery.Endpoint{},
},
},
@@ -148,8 +148,8 @@ func TestNewEndpointSlice(t *testing.T) {
OwnerReferences: []metav1.OwnerReference{*ownerRef},
Namespace: service.Namespace,
},
Ports: endpointMeta.Ports,
AddressType: endpointMeta.AddressType,
Ports: endpointMeta.ports,
AddressType: endpointMeta.addressType,
Endpoints: []discovery.Endpoint{},
},
},
@@ -175,8 +175,8 @@ func TestNewEndpointSlice(t *testing.T) {
OwnerReferences: []metav1.OwnerReference{*ownerRef},
Namespace: service.Namespace,
},
Ports: endpointMeta.Ports,
AddressType: endpointMeta.AddressType,
Ports: endpointMeta.ports,
AddressType: endpointMeta.addressType,
Endpoints: []discovery.Endpoint{},
},
},
@@ -197,8 +197,8 @@ func TestNewEndpointSlice(t *testing.T) {
OwnerReferences: []metav1.OwnerReference{*ownerRef},
Namespace: service.Namespace,
},
Ports: endpointMeta.Ports,
AddressType: endpointMeta.AddressType,
Ports: endpointMeta.ports,
AddressType: endpointMeta.addressType,
Endpoints: []discovery.Endpoint{},
},
},
@@ -981,8 +981,8 @@ func newServiceAndEndpointMeta(name, namespace string) (v1.Service, endpointMeta
addressType := discovery.AddressTypeIPv4
protocol := v1.ProtocolTCP
endpointMeta := endpointMeta{
AddressType: addressType,
Ports: []discovery.EndpointPort{{Name: &name, Port: &portNum, Protocol: &protocol}},
addressType: addressType,
ports: []discovery.EndpointPort{{Name: &name, Port: &portNum, Protocol: &protocol}},
}
return svc, endpointMeta
@@ -998,8 +998,8 @@ func newEmptyEndpointSlice(n int, namespace string, endpointMeta endpointMeta, s
Namespace: namespace,
OwnerReferences: []metav1.OwnerReference{*ownerRef},
},
Ports: endpointMeta.Ports,
AddressType: endpointMeta.AddressType,
Ports: endpointMeta.ports,
AddressType: endpointMeta.addressType,
Endpoints: []discovery.Endpoint{},
}
}