mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Svc REST: Overhaul Create test wrt dual-stack
This includes a few cases. 1) TestCreateIgnoresIPFamilyForExternalName: Prove that ExternalName is ignored for dual-stack. A small set of test cases were chosen to demonstrate. 2) TestCreateIgnoresIPFamilyWithoutDualStack: Prove that when the dual-stack gate is off, all services are ignored for dual-stack. A small set of test cases were chosen to demonstrate 3) TestCreateInitIPFields: Run over a huge array of test cases for dual-stack. This was generated by this program: https://gist.github.com/thockin/cccc9c9a580b4830ee0946ddd43eeafe and then updated by hand.
This commit is contained in:
parent
e4c6d0837e
commit
237434bd42
@ -113,6 +113,29 @@ 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
|
||||
}
|
||||
|
||||
// SetSelector sets the service selector.
|
||||
func SetSelector(sel map[string]string) Tweak {
|
||||
return func(svc *api.Service) {
|
||||
svc.Spec.Selector = map[string]string{}
|
||||
for k, v := range sel {
|
||||
svc.Spec.Selector[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SetClusterIP sets the service ClusterIP fields.
|
||||
func SetClusterIP(ip string) Tweak {
|
||||
return func(svc *api.Service) {
|
||||
svc.Spec.ClusterIP = ip
|
||||
}
|
||||
}
|
||||
|
||||
// SetClusterIPs sets the service ClusterIP and ClusterIPs fields.
|
||||
func SetClusterIPs(ips ...string) Tweak {
|
||||
return func(svc *api.Service) {
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user