Svc REST: clean up defaultOnRead to be consistent

Headless+selectorless -> RequireDualStack

Headless+selector -> SingleStack

Add test cases to cover this and ExternalName and dual-stack init (which
I think can never trigger, but best to be safe).
This commit is contained in:
Tim Hockin
2021-09-13 17:08:03 -07:00
parent 6a49ed41ea
commit 52f54ce90d
3 changed files with 119 additions and 70 deletions

View File

@@ -117,7 +117,7 @@ func MakeServicePort(name string, port int, tgtPort intstr.IntOrString, proto ap
// SetHeadless sets the service as headless and clears other fields.
func SetHeadless(svc *api.Service) {
SetTypeClusterIP(svc)
svc.Spec.ClusterIP = api.ClusterIPNone
SetClusterIPs(api.ClusterIPNone)(svc)
}
// SetSelector sets the service selector.