conversion

package
v0.0.0-...-bdd73da Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VethNameForWorkload

func VethNameForWorkload(workload string) string

VethNameForWorkload returns a deterministic veth name for the given Kubernetes workload.

Types

type Converter

type Converter struct {
}

TODO: make this private and expose a public conversion interface instead

func (Converter) HasIPAddress

func (c Converter) HasIPAddress(pod *kapiv1.Pod) bool

func (Converter) IsHostNetworked

func (c Converter) IsHostNetworked(pod *kapiv1.Pod) bool

func (Converter) IsReadyCalicoPod

func (c Converter) IsReadyCalicoPod(pod *kapiv1.Pod) bool

IsReadyCalicoPod returns true if the pod should be shown as a workloadEndpoint in the Calico API and false otherwise.

func (Converter) IsScheduled

func (c Converter) IsScheduled(pod *kapiv1.Pod) bool

func (Converter) K8sNetworkPolicyToCalico

func (c Converter) K8sNetworkPolicyToCalico(np *extensions.NetworkPolicy) (*model.KVPair, error)

K8sNetworkPolicyToCalico converts a k8s NetworkPolicy to a model.KVPair.

func (Converter) NamespaceToProfile

func (c Converter) NamespaceToProfile(ns *kapiv1.Namespace) (*model.KVPair, error)

NamespaceToProfile converts a Namespace to a Calico Profile. The Profile stores labels from the Namespace which are inherited by the WorkloadEndpoints within the Profile. This Profile also has the default ingress and egress rules, which are both 'allow'.

func (Converter) ParsePolicyNameNetworkPolicy

func (c Converter) ParsePolicyNameNetworkPolicy(name string) (string, string, error)

ParsePolicyNameNetworkPolicy extracts the Kubernetes Namespace and NetworkPolicy that backs the given Policy.

func (Converter) ParseWorkloadEndpointName

func (c Converter) ParseWorkloadEndpointName(workloadName string) (names.WorkloadEndpointIdentifiers, error)

ParseWorkloadName extracts the Node name, Orchestrator, Pod name and endpoint from the given WorkloadEndpoint name. The expected format for k8s is <node>-k8s-<pod>-<endpoint>

func (Converter) PodToWorkloadEndpoint

func (c Converter) PodToWorkloadEndpoint(pod *kapiv1.Pod) (*model.KVPair, error)

PodToWorkloadEndpoint converts a Pod to a WorkloadEndpoint. It assumes the calling code has verified that the provided Pod is valid to convert to a WorkloadEndpoint. PodToWorkloadEndpoint requires a Pods Name and Node Name to be populated. It will fail to convert from a Pod to WorkloadEndpoint otherwise.

func (Converter) ProfileNameToNamespace

func (c Converter) ProfileNameToNamespace(profileName string) (string, error)

ProfileNameToNamespace extracts the Namespace name from the given Profile name.

Jump to

Keyboard shortcuts

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