common

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FinalizerKey is the string representing the Ingress finalizer.
	FinalizerKey = "networking.gke.io/ingress-finalizer"
	// FinalizerKeyV2 is the string representing the Ingress finalizer version.
	// Ingress with V2 finalizer uses V2 frontend naming scheme.
	FinalizerKeyV2 = "networking.gke.io/ingress-finalizer-V2"
	// TODO remove the 2 definitions once they are added in legacy-cloud-providers/gce
	// LegacyILBFinalizer key is used to identify ILB services whose resources are managed by service controller.
	LegacyILBFinalizer = "gke.networking.io/l4-ilb-v1"
	// ILBFinalizerV2 is the finalizer used by newer controllers that implement Internal LoadBalancer services.
	ILBFinalizerV2 = "gke.networking.io/l4-ilb-v2"
	// NegFinalizerKey is the finalizer used by neg controller to ensure NEG CRs are deleted after corresponding negs are deleted
	NegFinalizerKey = "networking.gke.io/neg-finalizer"
	// NetLBFinalizerV2 is the finalizer used by newer controllers that manage L4 External LoadBalancer services.
	NetLBFinalizerV2 = "gke.networking.io/l4-netlb-v2"
	// NetLBFinalizerV3 is the finalizer used by the NEG backed variant of the L4 External LoadBalancer services.
	NetLBFinalizerV3 = "gke.networking.io/l4-netlb-v3"
	// LoadBalancerCleanupFinalizer added by original kubernetes service controller. This is not required in L4 RBS/ILB-subsetting services.
	LoadBalancerCleanupFinalizer = "service.kubernetes.io/load-balancer-cleanup"
)

Variables

Functions

func ContentHash

func ContentHash(s string, n int) string

ContentHash creates a content hash string of length n of s utilizing sha256. WARNING: PLEASE DO NOT CHANGE THE HASH FUNCTION.

func EnsureDeleteFinalizer

func EnsureDeleteFinalizer(ing *v1.Ingress, ingClient client.IngressInterface, finalizerKey string, ingLogger klog.Logger) error

EnsureDeleteFinalizer ensures that the specified finalizer is deleted from given Ingress.

func EnsureDeleteServiceFinalizer added in v1.9.0

func EnsureDeleteServiceFinalizer(service *corev1.Service, key string, kubeClient kubernetes.Interface, svcLogger klog.Logger) error

EnsureDeleteServiceFinalizer patches the service to remove finalizer. This function will not modify the service object passed as the argument. Instead, a deep copy will be used to do a patch.

func EnsureFinalizer

func EnsureFinalizer(ing *v1.Ingress, ingClient client.IngressInterface, finalizerKey string, ingLogger klog.Logger) (*v1.Ingress, error)

EnsureFinalizer ensures that the specified finalizer exists on given Ingress.

func EnsureServiceDeleteFinalizers added in v1.32.0

func EnsureServiceDeleteFinalizers(service *corev1.Service, ensureRemoveKeys []string, kubeClient kubernetes.Interface, svcLogger klog.Logger) error

EnsureServiceDeleteFinalizers patches the service to ensure the specified finalizers are not present in the service finalizers list. This function is needed if more than one finalizer has to be removed since you can't invoke the 1 param version multiple times. This function will not modify the service object passed as the argument. Instead, a deep copy will be used to do a patch.

func EnsureServiceFinalizer added in v1.9.0

func EnsureServiceFinalizer(service *corev1.Service, key string, kubeClient kubernetes.Interface, svcLogger klog.Logger) error

EnsureServiceFinalizer patches the service to add finalizer. This function will not modify the service object passed as the argument. Instead, a deep copy will be used to do a patch.

func HasFinalizer

func HasFinalizer(m meta_v1.ObjectMeta) bool

HasFinalizer is true if the passed in meta has an ingress finalizer.

func HasGivenFinalizer

func HasGivenFinalizer(m meta_v1.ObjectMeta, key string) bool

HasGivenFinalizer is true if the passed in meta has the specified finalizer.

func IngressKeyFunc

func IngressKeyFunc(ing *v1.Ingress, logger klog.Logger) string

IngressKeyFunc returns ingress key for given ingress as generated by Ingress Store. This falls back to utility function in case of an error. Note: Ingress Store and NamespacedName both return same key in general. But, Ingress Store returns <name> where as NamespacedName returns /<name> when <namespace> is empty.

func IsDeletionCandidate

func IsDeletionCandidate(m meta_v1.ObjectMeta) bool

IsDeletionCandidate is true if the passed in meta contains an ingress finalizer.

func IsDeletionCandidateForGivenFinalizer

func IsDeletionCandidateForGivenFinalizer(m meta_v1.ObjectMeta, key string) bool

IsDeletionCandidateForGivenFinalizer is true if the passed in meta contains the specified finalizer.

func NamespacedName

func NamespacedName(ing *v1.Ingress) string

NamespacedName returns namespaced name string of a given ingress. Note: This is used for logging.

func PatchIngressObjectMetadata added in v1.10.0

func PatchIngressObjectMetadata(ic client.IngressInterface, ing *v1.Ingress, newObjectMetadata metav1.ObjectMeta, ingLogger klog.Logger) (*v1.Ingress, error)

PatchIngressObjectMetadata patches the given ingress's metadata based on new ingress metadata.

func PatchIngressStatus added in v1.10.0

func PatchIngressStatus(ic client.IngressInterface, ing *v1.Ingress, newStatus v1.IngressStatus, ingLogger klog.Logger) (*v1.Ingress, error)

PatchIngressStatus patches the given ingress's Status based on new ingress status.

func ToIngressKeys

func ToIngressKeys(ings []*v1.Ingress, logger klog.Logger) []string

ToIngressKeys returns a list of ingress keys for given list of ingresses.

Types

This section is empty.

Jump to

Keyboard shortcuts

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