Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDashSeparatedParms ¶
Extract the dash separated parms from the name. Each parm will have had their dashes escaped, this also removes that escaping. Returns nil if the parameters could not be extracted.
Types ¶
type WorkloadEndpointIdentifiers ¶
type WorkloadEndpointIdentifiers struct { Node string Orchestrator string Endpoint string Workload string Pod string ContainerID string }
WorkloadEndpointIdentifiers is a collection of identifiers that are used to uniquely identify a WorkloadEndpoint resource. Since a resource is identified by a single name field, Calico requires the name to be constructed in a very specific format. The format is dependent on the Orchestrator type: - k8s: <node>-k8s-<pod>-<endpoint> - cni: <node>-cni-<containerID>-<endpoint> - libnetwork: <node>-libnetwork-libnetwork-<endpoint> - (other): <node>-<orchestrator>-<workload>-<endpoint>
Each parameter cannot start or end with a dash (-), and dashes within the parameter will be escaped to a double-dash (--) in the constructed name.
List queries allow for prefix lists (for non-KDD), the client should verify that then items returned in the list match the supplied identifiers using the NameMatches() method. This is necessary because a prefix match may return endpoints that do not exactly match the required identifiers. For example , suppose you are querying endpoints with node=node1, orch=k8s, pod=pod and endpoints is wild carded:
- The name prefix would be `node1-k8s-pod-`
- A list query using that prefix would also return endpoints with, for example, a pod call "pod-1", because the name of the endpoint might be `node1-k8s-pod--1-eth0` which matches the required name prefix.
The Node and Orchestrator are always required for both prefix and non-prefix name construction.
func ParseWorkloadEndpointName ¶
func ParseWorkloadEndpointName(wepName string) (WorkloadEndpointIdentifiers, error)
ParseWorkloadEndpointName parses a given name and returns a WorkloadEndpointIdentifiers instance with fields populated according to the WorkloadEndpoint name format.
func (WorkloadEndpointIdentifiers) CalculateWorkloadEndpointName ¶
func (ids WorkloadEndpointIdentifiers) CalculateWorkloadEndpointName(allowPrefix bool) (string, error)
CalculateWorkloadEndpointName calculates the expected name for a workload endpoint given the supplied Spec. Calico requires a precise naming convention for workload endpoints that is based on orchestrator and various other orchestrator specific parameters.
If allowPrefix is true, we construct the name prefix up to the last specified index and terminate with a dash.
func (WorkloadEndpointIdentifiers) NameMatches ¶
func (ids WorkloadEndpointIdentifiers) NameMatches(name string) (bool, error)
NameMatches returns true if the supplied WorkloadEndpoint name matches the supplied identifiers. This will return an error if the identifiers are not valid.