config

package
v0.0.0-...-58e557b Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MultusDefaultNetworkName = "multus-cni-network"
)

MultusDefaultNetworkName holds the default name of the multus network

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager monitors the configuration of the primary CNI plugin, and regenerates multus configuration whenever it gets updated.

func NewManager

func NewManager(config MultusConf, multusAutoconfigDir string) (*Manager, error)

NewManager returns a config manager object, configured to persist the configuration to `multusAutoconfigDir`. This constructor will auto-discover the primary CNI for which it will delegate.

func NewManagerWithExplicitPrimaryCNIPlugin

func NewManagerWithExplicitPrimaryCNIPlugin(config MultusConf, multusAutoconfigDir string, primaryCNIPluginName string) (*Manager, error)

NewManagerWithExplicitPrimaryCNIPlugin returns a config manager object, configured to persist the configuration to `multusAutoconfigDir`. This constructor will use the primary CNI plugin indicated by the user, via the primaryCNIPluginName variable.

func (Manager) GenerateConfig

func (m Manager) GenerateConfig() (string, error)

GenerateConfig generates a multus configuration from its current state

func (Manager) MonitorDelegatedPluginConfiguration

func (m Manager) MonitorDelegatedPluginConfiguration(shutDown chan struct{}, done chan struct{}) error

MonitorDelegatedPluginConfiguration monitors the configuration file pointed to by the primaryCNIPluginName attribute, and re-generates the multus configuration whenever the primary CNI config is updated.

func (*Manager) OverrideNetworkName

func (m *Manager) OverrideNetworkName() error

OverrideNetworkName overrides the name of the multus configuration with the name of the delegated primary CNI.

func (Manager) PersistMultusConfig

func (m Manager) PersistMultusConfig(config string) error

PersistMultusConfig persists the provided configuration to the disc, with Read / Write permissions. The output file path is `<multus auto config dir>/00-multus.conf`

type MultusConf

type MultusConf struct {
	BinDir                   string          `json:"binDir,omitempty"`
	Capabilities             map[string]bool `json:"capabilities,omitempty"`
	CNIVersion               string          `json:"cniVersion"`
	Delegates                []interface{}   `json:"delegates"`
	LogFile                  string          `json:"logFile,omitempty"`
	LogLevel                 string          `json:"logLevel,omitempty"`
	LogToStderr              bool            `json:"logToStderr,omitempty"`
	Kubeconfig               string          `json:"kubeconfig"`
	Name                     string          `json:"name"`
	NamespaceIsolation       bool            `json:"namespaceIsolation,omitempty"`
	RawNonIsolatedNamespaces string          `json:"globalNamespaces,omitempty"`
	ReadinessIndicatorFile   string          `json:"readinessindicatorfile,omitempty"`
	Type                     string          `json:"type"`
	PodCIDR                  string          `json:"podCIDR,omitempty"`
	ServiceCIDR              string          `json:"serviceCIDR,omitempty"`
}

MultusConf holds the multus configuration, and persists it to disk

func NewMultusConfig

func NewMultusConfig(pluginName string, cniVersion string, kubeconfig string, configurationOptions ...Option) *MultusConf

NewMultusConfig creates a basic configuration generator. It can be mutated via the `With...` methods.

func (*MultusConf) Generate

func (mc *MultusConf) Generate() (string, error)

Generate generates the multus configuration from whatever state is currently held

func (*MultusConf) Mutate

func (mc *MultusConf) Mutate(configurationOptions ...Option)

Mutate updates the MultusConf attributes according to the provided configuration `Option`s

type Option

type Option func(conf *MultusConf)

Option mutates the `conf` object

func WithAdditionalBinaryFileDir

func WithAdditionalBinaryFileDir(directoryPath string) Option

WithAdditionalBinaryFileDir mutates the inner state to set the BinDir attribute

func WithGlobalNamespaces

func WithGlobalNamespaces(globalNamespaces string) Option

WithGlobalNamespaces mutates the inner state to set the RawNonIsolatedNamespaces attribute

func WithLogFile

func WithLogFile(logFile string) Option

WithLogFile mutates the inner state to set the logFile attribute

func WithLogLevel

func WithLogLevel(logLevel string) Option

WithLogLevel mutates the inner state to set the LogLevel attribute

func WithLogToStdErr

func WithLogToStdErr() Option

WithLogToStdErr mutates the inner state to enable the WithLogToStdErr attribute

func WithNamespaceIsolation

func WithNamespaceIsolation() Option

WithNamespaceIsolation mutates the inner state to enable the NamespaceIsolation attribute

func WithOverriddenName

func WithOverriddenName(networkName string) Option

WithOverriddenName mutates the inner state to set the Name attribute

func WithPodCIDR

func WithPodCIDR(podCIDR string) Option

WithPodCIDR mutates the inner state to set the PodCIDR attribute

func WithReadinessFileIndicator

func WithReadinessFileIndicator(path string) Option

WithReadinessFileIndicator mutates the inner state to set the ReadinessIndicatorFile attribute

func WithServiceCIDR

func WithServiceCIDR(serviceCIDR string) Option

WithServiceCIDR mutates the inner state to set the ServiceCIDR attribute

Jump to

Keyboard shortcuts

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