Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow externalTrafficPolicy: Cluster on multinetworking services #2685

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pkg/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ func (nr *NetworksResolver) ServiceNetwork(service *apiv1.Service) (*NetworkInfo
return DefaultNetwork(nr.cloudProvider), nil
}

// TODO: remove this check once DPv2 supports externalTrafficPolicy=Cluster services.
if service.Spec.ExternalTrafficPolicy != apiv1.ServiceExternalTrafficPolicyLocal {
return nil, utils.NewUserError(fmt.Errorf("multinetwork services with externalTrafficPolicy='%s' are not supported, only externalTrafficPolicy=Local services are supported", service.Spec.ExternalTrafficPolicy))
}

obj, exists, err := nr.networkLister.GetByKey(networkName)
if err != nil {
return nil, err
Expand Down
29 changes: 0 additions & 29 deletions pkg/network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,35 +195,6 @@ func TestServiceNetwork(t *testing.T) {
service: serviceWithSecondaryNet,
wantErr: "network.Spec.Type=Device is not supported for multinetwork LoadBalancer services, the only supported network type is L3",
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this was a special case we should now change it to expect a valid result

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

desc: "service with externalTrafficPolicy=Cluster",
network: testNetwork("secondary-network", "secondary-network-params"),
gkeNetworkParamSet: testGKENetworkParamSet("secondary-network-params", "secondary-vpc", "secondary-subnet"),
service: &apiv1.Service{
ObjectMeta: metav1.ObjectMeta{Name: "testService"},
Spec: apiv1.ServiceSpec{
Selector: map[string]string{
networkSelector: "secondary-network",
},
ExternalTrafficPolicy: apiv1.ServiceExternalTrafficPolicyCluster,
},
},
wantErr: "multinetwork services with externalTrafficPolicy='Cluster' are not supported, only externalTrafficPolicy=Local services are supported",
},
{
desc: "service with externalTrafficPolicy default",
network: testNetwork("secondary-network", "secondary-network-params"),
gkeNetworkParamSet: testGKENetworkParamSet("secondary-network-params", "secondary-vpc", "secondary-subnet"),
service: &apiv1.Service{
ObjectMeta: metav1.ObjectMeta{Name: "testService"},
Spec: apiv1.ServiceSpec{
Selector: map[string]string{
networkSelector: "secondary-network",
},
},
},
wantErr: "multinetwork services with externalTrafficPolicy='' are not supported, only externalTrafficPolicy=Local services are supported",
},
}

for _, tc := range cases {
Expand Down