common

package
v0.0.0-...-8216aeb Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2016 Authors of Cilium

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.

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.

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

View Source
const (

	// Version number.
	Version = "0.0.1"
	// CiliumPath is the path where cilium operational files are running.
	CiliumPath    = "/var/run/cilium"
	DefaultLibDir = "/usr/lib/cilium"
	CiliumUIPath  = DefaultLibDir + "/ui"
	// CiliumSock is the cilium socket for the communication between the daemon and cilium client.
	CiliumSock = CiliumPath + "/cilium.sock"
	// DefaultContainerMAC represents a dummy MAC address for the containers.
	DefaultContainerMAC = "AA:BB:CC:DD:EE:FF"
	// BPFMap is the file that contains the BPF Map for the host.
	BPFMapRoot    = "/sys/fs/bpf"
	BPFCiliumMaps = BPFMapRoot + "/tc/globals"
	BPFMap        = BPFCiliumMaps + "/cilium_lxc"
	// PolicyMapPath is the base path for the cilium policy for each local container.
	PolicyMapPath = BPFCiliumMaps + "/cilium_policy_"
	BPFMapCT6     = BPFCiliumMaps + "/cilium_ct6_"
	BPFMapCT4     = BPFCiliumMaps + "/cilium_ct4_"
	// RFC3339Milli is the RFC3339 with milliseconds for the default timestamp format
	// log files.
	RFC3339Milli = "2006-01-02T15:04:05.000Z07:00"

	// OperationalPath is the base path to store the operational details in consul.
	OperationalPath = "cilium-net/operational"
	// LastFreeIDKeyPath is the path where the Last free UUID is stored in consul.
	LastFreeIDKeyPath = OperationalPath + "/LastUUID"
	// LabelsKeyPath is the base path where labels are stored in consul.
	LabelsKeyPath = OperationalPath + "/SHA256SUMLabels"
	// IDKeyPath is the base path where the IDs are stored in consul.
	IDKeyPath = OperationalPath + "/ID"
	// MaxSetOfLabels is maximum number of set of labels that can be stored in consul.
	MaxSetOfLabels = uint32(0xFFFF)
	// FirstFreeID is the first ID for which the labels should be assigned.
	FirstFreeID = uint32(256)
	// SecCtxFromHost represents reserved security context IDs reserved for special
	// purposes.
	SecCtxFromHost = 1

	// GlobalLabelPrefix is the default root path for the policy.
	GlobalLabelPrefix = "io.cilium"
	// CiliumLabelSource is the default label source for the labels read from containers.
	CiliumLabelSource = "cilium"
	// K8sLabelSource is the default label source for the labels read from kubernetes.
	K8sLabelSource = "k8s"
	// K8sAnnotationName is the annotation name used for the cilium policy name in the
	// kubernetes network policy.
	K8sAnnotationName = "io.cilium.name"
	// K8sPodNamespaceLabel is the label used in kubernetes containers to specify
	// which namespace they belong to.
	K8sPodNamespaceLabel = "io.kubernetes.pod.namespace"
	// K8sAnnotationParentName is the annotation name used for the cilium policy
	// parent name in the kubernetes network policy.
	K8sAnnotationParentName = "io.cilium.parent"
	// Label source for reserved types
	ReservedLabelSource = "reserved"
	// Label used to represent the reserved source
	ReservedLabelKey = GlobalLabelPrefix + "." + ReservedLabelSource
	// EndpointsPerHost is the maximum number of endpoints allowed per host. It should
	// represent the same number of IPv6 addresses supported on each node.
	EndpointsPerHost = 0xFFFF
	// GroupFilePath is the unix group file path.
	GroupFilePath = "/etc/group"
	// CiliumGroupName is the cilium's unix group name.
	CiliumGroupName = "cilium"

	// CHeaderFileName is the name of the C header file for BPF programs for a
	// particular endpoint.
	CHeaderFileName = "lxc_config.h"
	// Name of the header file used for bpf_netdev.c and bpf_overlay.c
	NetdevHeaderFileName = "netdev_config.h"
	// CiliumCHeaderPrefix is the prefix using when printing/writing an endpoint in a
	// base64 form.
	CiliumCHeaderPrefix = "CILIUM_BASE64_"
)

Variables

View Source
var (
	Green = color.New(color.FgGreen).SprintFunc()
	Red   = color.New(color.FgRed).SprintFunc()
)

Functions

func FindEPConfigCHeader

func FindEPConfigCHeader(basePath string, epFiles []os.FileInfo) string

FindEPConfigCHeader returns the full path of the file that is the CHeaderFileName from the slice of files

func FmtDefineAddress

func FmtDefineAddress(name string, addr []byte) string

FmtDefineAddress returns the a define string from the given name and addr. Example: fmt.Print(FmtDefineAddress("foo", []byte{1, 2, 3})) // "#define foo { .addr = { 0x1, 0x2, 0x3 } }\n"

func FmtDefineArray

func FmtDefineArray(name string, array []byte) string

FmtDefineArray returns the a define string from the given name and array. Example: fmt.Print(FmtDefineArray("foo", []byte{1, 2, 3})) // "#define foo { 0x1, 0x2, 0x3 }\n"

func GetCiliumVersionString

func GetCiliumVersionString(epCHeaderFilePath string) (string, error)

GetCiliumVersionString returns the first line containing CiliumCHeaderPrefix.

func GetGroupIDByName

func GetGroupIDByName(grpName string) (int, error)

GetGroupIDByName returns the group ID for the given grpName.

func GetLockPath

func GetLockPath(path string) string

GetLockPath returns the lock path representation of the given path.

func ParseHost

func ParseHost(host string) (string, *net.TCPAddr, error)

func SetupLOG

func SetupLOG(logger *l.Logger, logLevel string)

SetupLOG sets up logger with the correct parameters for the whole cilium architecture.

func Swab16

func Swab16(n uint16) uint16

Swab16 swaps the endianness of n.

func Swab32

func Swab32(n uint32) uint32

Swab32 swaps the endianness of n.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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