utils

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: Apache-2.0 Imports: 5 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractNamespace

func ExtractNamespace(np NamespaceNameGetter) string

ExtractNamespace extracts the namespace of ObjectMeta. For cluster scoped objects the Namespace field is empty and this function assumes that the object is returned from kubernetes itself implying that the namespace is empty only and only when the Object is cluster scoped and thus returns empty namespace for such objects.

func ExtractNamespaceOrDefault

func ExtractNamespaceOrDefault(np NamespaceNameGetter) string

ExtractNamespaceOrDefault extracts the namespace of ObjectMeta, it returns default namespace if the namespace field in the ObjectMeta is empty.

func GetObjNamespaceName

func GetObjNamespaceName(obj NamespaceNameGetter) string

GetObjNamespaceName returns the object's namespace and name. If the object is cluster scoped then the function returns only the object name without any namespace prefix.

func GetServiceListOptionsModifier added in v1.8.4

func GetServiceListOptionsModifier() (func(options *v1meta.ListOptions), error)

GetServiceListOptionsModifier returns the options modifier for service object list. This methods returns a ListOptions modifier which adds a label selector to only select services that are in context of Cilium. Like kube-proxy Cilium does not select services containing k8s headless service label. We honor service.kubernetes.io/service-proxy-name label in the service object and only handle services that match our service proxy name. If the service proxy name for Cilium is an empty string, we assume that Cilium is the default service handler in which case we select all services that don't have the above mentioned label.

Types

type NamespaceNameGetter

type NamespaceNameGetter interface {
	GetNamespace() string
	GetName() string
}

Jump to

Keyboard shortcuts

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