Version: v1.22.2 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 4 Imported by: 0




This section is empty.


This section is empty.


func MakeService

func MakeService(name string, tweaks ...Tweak) *api.Service

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 SetTypeClusterIP

func SetTypeClusterIP(svc *api.Service)

SetTypeClusterIP sets the service type to ClusterIP and clears other fields.

func SetTypeExternalName

func SetTypeExternalName(svc *api.Service)

SetTypeExternalName sets the service type to ExternalName and clears other fields.

func SetTypeLoadBalancer

func SetTypeLoadBalancer(svc *api.Service)

SetTypeLoadBalancer sets the service type to LoadBalancer and clears other fields.

func SetTypeNodePort

func SetTypeNodePort(svc *api.Service)

SetTypeNodePort sets the service type to NodePort and clears other fields.


type Tweak

type Tweak func(*api.Service)

Tweak is a function that modifies a Service.

func SetAllocateLoadBalancerNodePorts

func SetAllocateLoadBalancerNodePorts(val bool) Tweak

SetAllocateLoadBalancerNodePorts sets the allocate LB node port field.

func SetClusterIPs

func SetClusterIPs(ips ...string) Tweak

SetClusterIPs sets the service ClusterIP and ClusterIPs fields.

func SetExternalTrafficPolicy

func SetExternalTrafficPolicy(policy api.ServiceExternalTrafficPolicyType) Tweak

SetExternalTrafficPolicy sets the externalTrafficPolicy field for a Service.

func SetHealthCheckNodePort

func SetHealthCheckNodePort(value int32) Tweak

SetHealthCheckNodePort sets the healthCheckNodePort field for a Service.

func SetIPFamilies

func SetIPFamilies(families ...api.IPFamily) Tweak

SetIPFamilies sets the service IPFamilies field.

func SetIPFamilyPolicy

func SetIPFamilyPolicy(policy api.IPFamilyPolicyType) Tweak

SetIPFamilyPolicy sets the service IPFamilyPolicy field.

func SetInternalTrafficPolicy added in v1.21.5

func SetInternalTrafficPolicy(policy api.ServiceInternalTrafficPolicyType) Tweak

SetInternalTrafficPolicy sets the internalTrafficPolicy field for a Service.

func SetNodePorts

func SetNodePorts(values ...int) Tweak

SetNodePorts sets the values for each node port, in order. If less values are specified than there are ports, the rest are untouched.

func SetPorts

func SetPorts(ports ...api.ServicePort) Tweak

SetPorts sets the service ports list.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL