utils

package
v3.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Copyright 2015 Tigera Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIgnoreUnknownArgs

func AddIgnoreUnknownArgs() error

AddIgnoreUnknownArgs appends the 'IgnoreUnknown=1' option to CNI_ARGS before calling the IPAM plugin. Otherwise, it will complain about the Kubernetes arguments. See https://github.com/kubernetes/kubernetes/pull/24983

func CleanUpIPAM added in v1.7.0

func CleanUpIPAM(conf types.NetConf, args *skel.CmdArgs, logger *logrus.Entry) error

CleanUpIPAM calls IPAM plugin to release the IP address. It also contains IPAM plugin specific changes needed before calling the plugin.

func CleanUpNamespace added in v1.7.0

func CleanUpNamespace(args *skel.CmdArgs, logger *logrus.Entry) error

CleanUpNamespace deletes the devices in the network namespace.

func ConfigureLogging

func ConfigureLogging(logLevel string)

Set up logging for both Calico and libcalico using the provided log level,

func CreateClient

func CreateClient(conf types.NetConf) (client.Interface, error)

func CreateOrUpdate

func CreateOrUpdate(ctx context.Context, client client.Interface, wep *api.WorkloadEndpoint) (*api.WorkloadEndpoint, error)

CreateOrUpdate creates the WorkloadEndpoint if ResourceVersion is not specified, or Update if it's specified.

func CreateResultFromEndpoint

func CreateResultFromEndpoint(wep *api.WorkloadEndpoint) (*current.Result, error)

CreateResultFromEndpoint takes a WorkloadEndpoint, extracts IP information and populates that into a CNI Result.

func DetermineNodename

func DetermineNodename(conf types.NetConf) string

DetermineNodename gets the node name, in order of priority: 1. Hostname field in NetConf (DEPRECATED). 2. Nodename field in NetConf. 3. OS Hostname.

func DoNetworking

func DoNetworking(args *skel.CmdArgs, conf types.NetConf, result *current.Result, logger *logrus.Entry, desiredVethName string) (hostVethName, contVethMAC string, err error)

DoNetworking performs the networking for the given config and IPAM result

func GetHandleID added in v1.11.2

func GetHandleID(netName string, containerID string, workload string) (string, error)

func Min added in v1.8.0

func Min(a, b int) int

func ParsePools added in v1.6.0

func ParsePools(pools []string, isv4 bool) ([]cnet.IPNet, error)

Takes as array of IPv4 or IPv6 pools and parses them into an array of IPnet's

func PopulateEndpointNets

func PopulateEndpointNets(wep *api.WorkloadEndpoint, result *current.Result) error

PopulateEndpointNets takes a WorkloadEndpoint and a CNI Result, extracts IP address and mask and populates that information into the WorkloadEndpoint.

func ReleaseIPAllocation

func ReleaseIPAllocation(logger *logrus.Entry, ipamType string, stdinData []byte)

ReleaseIPAllocation is called to cleanup IPAM allocations if something goes wrong during CNI ADD execution.

func SanitizeMesosLabel added in v1.11.3

func SanitizeMesosLabel(s string) string

SanitizeMesosLabel converts a string from a valid mesos label to a valid Calico label. Mesos labels have no restriction outside of being unicode.

func SetupRoutes added in v1.11.1

func SetupRoutes(hostVeth netlink.Link, result *current.Result) error

SetupRoutes sets up the routes for the host side of the veth pair.

func ValidateNetworkName

func ValidateNetworkName(name string) error

ValidateNetworkName checks that the network name meets felix's expectations

Types

type WEPIdentifiers

type WEPIdentifiers struct {
	Namespace string
	WEPName   string
	names.WorkloadEndpointIdentifiers
}

func GetIdentifiers

func GetIdentifiers(args *skel.CmdArgs, nodename string) (*WEPIdentifiers, error)

GetIdentifiers takes CNI command arguments, and extracts identifiers i.e. pod name, pod namespace, container ID, endpoint(container interface name) and orchestratorID based on the orchestrator.

Jump to

Keyboard shortcuts

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