Documentation ¶
Index ¶
- func CopyStringMap(in map[string]string) map[string]string
- func FindContainerStatus(pod *kube_core.Pod, containerName string) *kube_core.ContainerStatus
- func FindPort(pod *kube_core.Pod, svcPort *kube_core.ServicePort) (int, *kube_core.Container, error)
- func FindServices(svcs *kube_core.ServiceList, predicates ...ServicePredicate) []*kube_core.Service
- func MeshOfByAnnotation(obj kube_meta.Object, namespace *kube_core.Namespace) string
- func MeshOfByLabelOrAnnotation(log logr.Logger, obj kube_client.Object, namespace *kube_core.Namespace) string
- func ServiceTag(name kube_types.NamespacedName, svcPort *int32) string
- type ServicePredicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 MeshOfByAnnotation ¶
MeshOfByAnnotation returns the mesh of the given object according to its own annotations or those of its namespace.
func MeshOfByLabelOrAnnotation ¶
func MeshOfByLabelOrAnnotation(log logr.Logger, obj kube_client.Object, namespace *kube_core.Namespace) string
MeshOfByLabelOrAnnotation returns the mesh of the given object according to its own annotations or labels or the annotations of its namespace. It treats the annotation directly on the object as deprecated.
func ServiceTag ¶
func ServiceTag(name kube_types.NamespacedName, svcPort *int32) string
ServiceTag returns the canonical service name for a Kubernetes service, optionally with a specific port.
Types ¶
type ServicePredicate ¶
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 MatchServiceThatSelectsPod ¶
func MatchServiceThatSelectsPod(pod *kube_core.Pod, ignoredLabels []string) ServicePredicate
func Not ¶
func Not(predicate ServicePredicate) ServicePredicate