cloud-providerk8s.io/cloud-provider/service/helpers Index | Files

package helpers

import "k8s.io/cloud-provider/service/helpers"

Index

Constants

const (

	// LoadBalancerCleanupFinalizer is the finalizer added to load balancer
	// services to ensure the Service resource is not fully deleted until
	// the correlating load balancer resources are deleted.
	LoadBalancerCleanupFinalizer = "service.kubernetes.io/load-balancer-cleanup"
)

Functions

func GetLoadBalancerSourceRanges

func GetLoadBalancerSourceRanges(service *v1.Service) (utilnet.IPNetSet, error)

GetLoadBalancerSourceRanges first try to parse and verify LoadBalancerSourceRanges field from a service. If the field is not specified, turn to parse and verify the AnnotationLoadBalancerSourceRangesKey annotation from a service, extracting the source ranges to allow, and if not present returns a default (allow-all) value.

func GetServiceHealthCheckPathPort

func GetServiceHealthCheckPathPort(service *v1.Service) (string, int32)

GetServiceHealthCheckPathPort returns the path and nodePort programmed into the Cloud LB Health Check

func HasLBFinalizer

func HasLBFinalizer(service *v1.Service) bool

HasLBFinalizer checks if service contains LoadBalancerCleanupFinalizer.

func IsAllowAll

func IsAllowAll(ipnets utilnet.IPNetSet) bool

IsAllowAll checks whether the utilnet.IPNet allows traffic from 0.0.0.0/0

func LoadBalancerStatusEqual

func LoadBalancerStatusEqual(l, r *v1.LoadBalancerStatus) bool

LoadBalancerStatusEqual checks if load balancer status are equal

func NeedsHealthCheck

func NeedsHealthCheck(service *v1.Service) bool

NeedsHealthCheck checks if service needs health check.

func PatchService

func PatchService(c corev1.CoreV1Interface, oldSvc, newSvc *v1.Service) (*v1.Service, error)

PatchService patches the given service's Status or ObjectMeta based on the original and updated ones. Change to spec will be ignored.

func RequestsOnlyLocalTraffic

func RequestsOnlyLocalTraffic(service *v1.Service) bool

RequestsOnlyLocalTraffic checks if service requests OnlyLocal traffic.

Source Files

helper.go

Version
v0.32.2 (latest)
Published
Feb 13, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
2 months ago

Tools for package owners.