util

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KumaSidecarContainerName = "kuma-sidecar"
	KumaGatewayContainerName = "kuma-gateway"
	KumaInitContainerName    = "kuma-init"
)

Variables

This section is empty.

Functions

func CopyStringMap

func CopyStringMap(in map[string]string) map[string]string

func FindContainerStatus

func FindContainerStatus(pod *kube_core.Pod, containerName string) *kube_core.ContainerStatus

func FindPort

func FindPort(pod *kube_core.Pod, svcPort *kube_core.ServicePort) (int, *kube_core.Container, error)

FindPort locates the container port for the given pod and portName. If the targetPort is a number, use that. If the targetPort is a string, look that string up in all named ports in all containers in the target pod. If no match is found, fail.

func FindServices

func FindServices(svcs *kube_core.ServiceList, predicates ...ServicePredicate) []*kube_core.Service

func MeshOf added in v1.8.1

func MeshOf(obj kube_meta.Object, namespace *kube_core.Namespace) string

MeshOf returns the mesh of the given object according to its own annotations or those of its namespace.

func ServiceTagFor added in v1.8.1

func ServiceTagFor(svc *kube_core.Service, svcPort *int32) string

ServiceTagFor returns the canonical service name for a Kubernetes service, optionally with a specific port.

Types

type ServicePredicate

type ServicePredicate func(*kube_core.Service) bool

func AnySelector

func AnySelector() ServicePredicate

According to K8S docs about Service#selector: Route service traffic to pods with label keys and values matching this selector. If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: https://kubernetes.io/docs/concepts/services-networking/service/

When converting Pod to Dataplane, we don't want to take into account Services that has no Selector, otherwise any Pod will match this service and since we just take any int target port in #util.FindPort every Dataplane in the same namespace as this service would get an extra inbound for it.

func Ignored added in v1.8.1

func Ignored() ServicePredicate

func MatchServiceThatSelectsPod

func MatchServiceThatSelectsPod(pod *kube_core.Pod) ServicePredicate

func Not added in v1.8.1

func Not(predicate ServicePredicate) ServicePredicate

Jump to

Keyboard shortcuts

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