install

package
v0.0.0-...-8e9ddbd Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MountedCNINetDir     = "mounted-cni-net-dir"
	CNINetDir            = "cni-net-dir"
	CNIConfName          = "cni-conf-name"
	ChainedCNIPlugin     = "chained-cni-plugin"
	CNINetworkConfigFile = "cni-network-config-file"
	CNINetworkConfig     = "cni-network-config"
	LogLevel             = "log-level"
	KubeconfigFilename   = "kubecfg-file-name"
	KubeconfigMode       = "kubeconfig-mode"
	KubeCAFile           = "kube-ca-file"
	SkipTLSVerify        = "skip-tls-verify"
	SkipCNIBinaries      = "skip-cni-binaries"
	UpdateCNIBinaries    = "update-cni-binaries"
)

Variables

View Source
var (
	CNIBinDir             = "/opt/cni/bin"
	HostCNIBinDir         = "/host/opt/cni/bin"
	SecondaryBinDir       = "/host/secondary-bin-dir"
	ServiceAccountPath    = "/var/run/secrets/kubernetes.io/serviceaccount"
	DefaultKubeconfigMode = 0o600

	// K8s liveness and readiness endpoints
	LivenessEndpoint  = "/healthz"
	ReadinessEndpoint = "/readyz"
	Port              = "8000"
)

Internal constants

Functions

func GetCommand

func GetCommand() *cobra.Command

GetCommand returns the main cobra.Command object for this application

func SetNotReady

func SetNotReady(isReady *atomic.Value)

Sets isReady to false.

func SetReady

func SetReady(isReady *atomic.Value)

Sets isReady to true.

func StartServer

func StartServer() *atomic.Value

StartServer initializes and starts a web server that exposes liveness and readiness endpoints at port 8000.

Types

type Config

type Config struct {
	// Location of the CNI config files in the host's filesystem
	CNINetDir string
	// Location of the CNI config files in the container's filesystem (mount location of the CNINetDir)
	MountedCNINetDir string
	// Name of the CNI config file
	CNIConfName string
	// Whether to install CNI plugin as a chained or standalone
	ChainedCNIPlugin bool

	// CNI config template file
	CNINetworkConfigFile string
	// CNI config template string
	CNINetworkConfig string

	// Logging level
	LogLevel string
	// Name of the kubeconfig file used by the CNI plugin
	KubeconfigFilename string
	// The file mode to set when creating the kubeconfig file
	KubeconfigMode int
	// CA file for kubeconfig
	KubeCAFile string
	// Whether to use insecure TLS in the kubeconfig file
	SkipTLSVerify bool

	// KUBERNETES_SERVICE_PROTOCOL
	K8sServiceProtocol string
	// KUBERNETES_SERVICE_HOST
	K8sServiceHost string
	// KUBERNETES_SERVICE_PORT
	K8sServicePort string
	// KUBERNETES_NODE_NAME
	K8sNodeName string

	// Directory from where the CNI binaries should be copied
	CNIBinSourceDir string
	// Directories into which to copy the CNI binaries
	CNIBinTargetDirs []string
	// Whether to override existing CNI binaries
	UpdateCNIBinaries bool

	// The names of binaries to skip when copying
	SkipCNIBinaries []string
}

Config struct defines the MSM CNI installation options

func (*Config) String

func (c *Config) String() string

type Installer

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

func NewInstaller

func NewInstaller(cfg *Config, isReady *atomic.Value) *Installer

NewInstaller returns an instance of Installer with the given config

func (*Installer) Cleanup

func (in *Installer) Cleanup() error

Cleanup remove MSM CNI's config, kubeconfig file, and binaries.

func (*Installer) Run

func (in *Installer) Run(ctx context.Context) (err error)

Run starts the installation process, verifies the configuration, then sleeps. If an invalid configuration is detected, the installation process will restart to restore a valid state.

Jump to

Keyboard shortcuts

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