Documentation ¶
Index ¶
- func MakeService(name string, tweaks ...Tweak) *api.Service
- func MakeServicePort(name string, port int, tgtPort intstr.IntOrString, proto api.Protocol) api.ServicePort
- func SetHeadless(svc *api.Service)
- func SetTypeClusterIP(svc *api.Service)
- func SetTypeExternalName(svc *api.Service)
- func SetTypeLoadBalancer(svc *api.Service)
- func SetTypeNodePort(svc *api.Service)
- func SetUniqueNodePorts(svc *api.Service)
- type Tweak
- func SetAllocateLoadBalancerNodePorts(val bool) Tweak
- func SetClusterIP(ip string) Tweak
- func SetClusterIPs(ips ...string) Tweak
- func SetExternalName(val string) Tweak
- func SetExternalTrafficPolicy(policy api.ServiceExternalTrafficPolicy) Tweak
- func SetHealthCheckNodePort(value int32) Tweak
- func SetIPFamilies(families ...api.IPFamily) Tweak
- func SetIPFamilyPolicy(policy api.IPFamilyPolicy) Tweak
- func SetInternalTrafficPolicy(policy api.ServiceInternalTrafficPolicy) Tweak
- func SetNodePorts(values ...int) Tweak
- func SetPorts(ports ...api.ServicePort) Tweak
- func SetSelector(sel map[string]string) Tweak
- func SetSessionAffinity(affinity api.ServiceAffinity) Tweak
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeService ¶
MakeService helps construct Service objects (which pass API validation) more legibly and tersely than a Go struct definition. By default this produces a ClusterIP service with a single port and a trivial selector. The caller can pass any number of tweak functions to further modify the result.
func MakeServicePort ¶
func MakeServicePort(name string, port int, tgtPort intstr.IntOrString, proto api.Protocol) api.ServicePort
MakeServicePort helps construct ServicePort objects which pass API validation.
func SetHeadless ¶ added in v1.23.0
SetHeadless sets the service as headless and clears other fields.
func SetTypeClusterIP ¶
SetTypeClusterIP sets the service type to ClusterIP and clears other fields.
func SetTypeExternalName ¶
SetTypeExternalName sets the service type to ExternalName and clears other fields.
func SetTypeLoadBalancer ¶
SetTypeLoadBalancer sets the service type to LoadBalancer and clears other fields.
func SetTypeNodePort ¶
SetTypeNodePort sets the service type to NodePort and clears other fields.
func SetUniqueNodePorts ¶ added in v1.23.0
SetUniqueNodePorts sets all nodeports to unique values.
Types ¶
type Tweak ¶
Tweak is a function that modifies a Service.
func SetAllocateLoadBalancerNodePorts ¶
SetAllocateLoadBalancerNodePorts sets the allocate LB node port field.
func SetClusterIP ¶ added in v1.23.0
SetClusterIP sets the service ClusterIP fields.
func SetClusterIPs ¶
SetClusterIPs sets the service ClusterIP and ClusterIPs fields.
func SetExternalName ¶ added in v1.23.0
SetExternalName sets the ExternalName field.
func SetExternalTrafficPolicy ¶
func SetExternalTrafficPolicy(policy api.ServiceExternalTrafficPolicy) Tweak
SetExternalTrafficPolicy sets the externalTrafficPolicy field for a Service.
func SetHealthCheckNodePort ¶
SetHealthCheckNodePort sets the healthCheckNodePort field for a Service.
func SetIPFamilies ¶
SetIPFamilies sets the service IPFamilies field.
func SetIPFamilyPolicy ¶
func SetIPFamilyPolicy(policy api.IPFamilyPolicy) Tweak
SetIPFamilyPolicy sets the service IPFamilyPolicy field.
func SetInternalTrafficPolicy ¶ added in v1.21.5
func SetInternalTrafficPolicy(policy api.ServiceInternalTrafficPolicy) Tweak
SetInternalTrafficPolicy sets the internalTrafficPolicy field for a Service.
func SetNodePorts ¶
SetNodePorts sets the values for each node port, in order. If less values are specified than there are ports, the rest are untouched.
func SetSelector ¶ added in v1.23.0
SetSelector sets the service selector.
func SetSessionAffinity ¶ added in v1.23.0
func SetSessionAffinity(affinity api.ServiceAffinity) Tweak
SetSessionAffinity sets the SessionAffinity field.