cni

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package cni configures the Container Networking Interface

Index

Constants

View Source
const (
	// DefaultPodCIDR is the default CIDR to use in minikube CNI's.
	DefaultPodCIDR = "10.244.0.0/16"

	// DefaultConfDir is the default CNI Config Directory path
	DefaultConfDir = "/etc/cni/net.d"
	// CustomConfDir is the custom CNI Config Directory path used to avoid conflicting CNI configs
	// ref: https://github.com/kubernetes/minikube/issues/10984 and https://github.com/kubernetes/minikube/pull/11106
	CustomConfDir = "/etc/cni/net.mk"
)

Variables

View Source
var (
	// ConfDir is the CNI Config Directory path that can be customised, defaulting to DefaultConfDir
	ConfDir = DefaultConfDir

	// Network is the network name that CNI should use (eg, "kindnet").
	// Currently, only crio (and podman) can use it, so that setting custom ConfDir is not necessary.
	// ref: https://github.com/cri-o/cri-o/issues/2121 (and https://github.com/containers/podman/issues/2370)
	// ref: https://github.com/cri-o/cri-o/blob/master/docs/crio.conf.5.md#crionetwork-table
	Network = ""
)

Functions

func GenerateCiliumYAML added in v1.24.0

func GenerateCiliumYAML() ([]byte, error)

GenerateCiliumYAML generates the .yaml file

func IsDisabled added in v1.16.0

func IsDisabled(cc config.ClusterConfig) bool

IsDisabled checks if CNI is disabled

Types

type Bridge

type Bridge struct {
	// contains filtered or unexported fields
}

Bridge is a simple CNI manager for single-node usage

func (Bridge) Apply

func (c Bridge) Apply(r Runner) error

Apply enables the CNI

func (Bridge) CIDR

func (c Bridge) CIDR() string

CIDR returns the default CIDR used by this CNI

func (Bridge) String

func (c Bridge) String() string

String returns a string representation of this CNI

type Calico added in v1.12.1

type Calico struct {
	// contains filtered or unexported fields
}

Calico is the Calico CNI manager

func (Calico) Apply added in v1.12.1

func (c Calico) Apply(r Runner) error

Apply enables the CNI

func (Calico) CIDR added in v1.12.1

func (c Calico) CIDR() string

CIDR returns the default CIDR used by this CNI

func (Calico) String added in v1.12.1

func (c Calico) String() string

String returns a string representation of this CNI

type Cilium added in v1.12.1

type Cilium struct {
	// contains filtered or unexported fields
}

Cilium is the Cilium CNI manager

func (Cilium) Apply added in v1.12.1

func (c Cilium) Apply(r Runner) error

Apply enables the CNI

func (Cilium) CIDR added in v1.12.1

func (c Cilium) CIDR() string

CIDR returns the default CIDR used by this CNI

func (Cilium) String added in v1.12.1

func (c Cilium) String() string

String returns a string representation of this CNI

type Custom

type Custom struct {
	// contains filtered or unexported fields
}

Custom is a CNI manager than applies a user-specified manifest

func NewCustom

func NewCustom(cc config.ClusterConfig, manifest string) (Custom, error)

NewCustom returns a well-formed Custom CNI manager

func (Custom) Apply

func (c Custom) Apply(r Runner) error

Apply enables the CNI

func (Custom) CIDR

func (c Custom) CIDR() string

CIDR returns the default CIDR used by this CNI

func (Custom) String

func (c Custom) String() string

String returns a string representation of this CNI

type Disabled

type Disabled struct {
	// contains filtered or unexported fields
}

Disabled is a CNI manager than does nothing

func (Disabled) Apply

func (c Disabled) Apply(r Runner) error

Apply enables the CNI

func (Disabled) CIDR

func (c Disabled) CIDR() string

CIDR returns the default CIDR used by this CNI

func (Disabled) String

func (c Disabled) String() string

String returns a string representation

type Flannel

type Flannel struct {
	// contains filtered or unexported fields
}

Flannel is the Flannel CNI manager

func (Flannel) Apply

func (c Flannel) Apply(r Runner) error

Apply enables the CNI

func (Flannel) CIDR

func (c Flannel) CIDR() string

CIDR returns the default CIDR used by this CNI

func (Flannel) String

func (c Flannel) String() string

String returns a string representation of this CNI

type KindNet

type KindNet struct {
	// contains filtered or unexported fields
}

KindNet is the KindNet CNI manager

func (KindNet) Apply

func (c KindNet) Apply(r Runner) error

Apply enables the CNI

func (KindNet) CIDR

func (c KindNet) CIDR() string

CIDR returns the default CIDR used by this CNI

func (KindNet) String

func (c KindNet) String() string

String returns a string representation of this CNI

type Manager

type Manager interface {
	// Apply a CNI. The provided runner is for the control plane
	Apply(Runner) error

	// CIDR returns the default CIDR used by this CNI
	CIDR() string

	// String representation
	String() string
}

Manager is a common interface for CNI

func New

func New(cc *config.ClusterConfig) (Manager, error)

New returns a new CNI manager

type Runner

type Runner interface {
	RunCmd(cmd *exec.Cmd) (*command.RunResult, error)
	Copy(assets.CopyableFile) error
}

Runner is the subset of command.Runner this package consumes

Jump to

Keyboard shortcuts

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