service

package
v0.0.0-...-091666d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineServicePort

func DefineServicePort(port, targetPort int32, protocol corev1.Protocol) (*corev1.ServicePort, error)

DefineServicePort helper for creating a Service with a ServicePort.

func GetServiceGVR

func GetServiceGVR() schema.GroupVersionResource

GetServiceGVR returns service's GroupVersionResource which could be used for Clean function.

Types

type AdditionalOptions

type AdditionalOptions func(builder *Builder) (*Builder, error)

AdditionalOptions additional options for service object.

type Builder

type Builder struct {
	// Service definition. Used to create a service object
	Definition *corev1.Service
	// Created service object
	Object *corev1.Service
	// contains filtered or unexported fields
}

Builder provides struct for service object containing connection to the cluster and the service definitions.

func NewBuilder

func NewBuilder(
	apiClient *clients.Settings,
	name string,
	nsname string,
	labels map[string]string,
	servicePort corev1.ServicePort) *Builder

NewBuilder creates a new instance of Builder Default type of service is ClusterIP Use WithNodePort() for setting the NodePort type.

func Pull

func Pull(apiClient *clients.Settings, name, nsname string) (*Builder, error)

Pull loads an existing service into Builder struct.

func (*Builder) Create

func (builder *Builder) Create() (*Builder, error)

Create the service in the cluster and store the created object in Object.

func (*Builder) Delete

func (builder *Builder) Delete() error

Delete a service.

func (*Builder) Exists

func (builder *Builder) Exists() bool

Exists checks whether the given service exists.

func (*Builder) WithAnnotation

func (builder *Builder) WithAnnotation(annotation map[string]string) *Builder

WithAnnotation redefines the service with Annotation type.

func (*Builder) WithExternalTrafficPolicy

func (builder *Builder) WithExternalTrafficPolicy(policyType corev1.ServiceExternalTrafficPolicyType) *Builder

WithExternalTrafficPolicy redefines the service with ServiceExternalTrafficPolicy type.

func (*Builder) WithIPFamily

func (builder *Builder) WithIPFamily(ipFamily []corev1.IPFamily, ipStackPolicy corev1.IPFamilyPolicyType) *Builder

WithIPFamily redefines the service with IPFamilies type.

func (*Builder) WithNodePort

func (builder *Builder) WithNodePort() *Builder

WithNodePort redefines the service with NodePort service type.

func (*Builder) WithOptions

func (builder *Builder) WithOptions(options ...AdditionalOptions) *Builder

WithOptions creates service with generic mutation options.

Jump to

Keyboard shortcuts

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