testing

package
v1.26.10 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 SetHeadless added in v1.23.0

func SetHeadless(svc *api.Service)

SetHeadless sets the service as headless and clears other fields.

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.

func SetUniqueNodePorts added in v1.23.0

func SetUniqueNodePorts(svc *api.Service)

SetUniqueNodePorts sets all nodeports to unique values.

Types

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 SetClusterIP added in v1.23.0

func SetClusterIP(ip string) Tweak

SetClusterIP sets the service ClusterIP fields.

func SetClusterIPs

func SetClusterIPs(ips ...string) Tweak

SetClusterIPs sets the service ClusterIP and ClusterIPs fields.

func SetExternalName added in v1.23.0

func SetExternalName(val string) Tweak

SetExternalName sets the ExternalName field.

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.IPFamilyPolicy) 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.

func SetSelector added in v1.23.0

func SetSelector(sel map[string]string) Tweak

SetSelector sets the service selector.

func SetSessionAffinity added in v1.23.0

func SetSessionAffinity(affinity api.ServiceAffinity) Tweak

SetSessionAffinity sets the SessionAffinity field.

Jump to

Keyboard shortcuts

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