ctrlconfig

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: Apache-2.0, BSD-3-Clause, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigVersion  string
	ConfigFileName string
	KubeAPIVersion csiv1.K8sVersion

	DriverType    csiv1.DriverType
	DriverVersion string
	DriverConfig  *DriverConfig
	StrictCheck   bool
	Log           logr.Logger
	IsOpenShift   bool
	// contains filtered or unexported fields
}

Config - Represents overall configuration including driver specific configuration

func (*Config) GetAllInitContainers

func (c *Config) GetAllInitContainers() []string

GetAllInitContainers - Returns a slice of all init container names

func (*Config) GetAllSideCars

func (c *Config) GetAllSideCars() []string

GetAllSideCars - Returns a slice of all side car container names

func (*Config) GetControllerEnvs

func (c *Config) GetControllerEnvs() []corev1.EnvVar

GetControllerEnvs - Returns an array of corev1.EnvVar

func (*Config) GetControllerInitContainers

func (c *Config) GetControllerInitContainers() []string

GetControllerInitContainers - Returns a slice of all init container names for controller

func (*Config) GetControllerVolumeMounts

func (c *Config) GetControllerVolumeMounts() []corev1.VolumeMount

GetControllerVolumeMounts - Returns an array of corev1.VolumeMount for the Controller

func (*Config) GetControllerVolumes

func (c *Config) GetControllerVolumes() []corev1.Volume

GetControllerVolumes - Returns an array of corev1.Volume for the Controller

func (*Config) GetDefaultImageTag

func (c *Config) GetDefaultImageTag(imageName string) (string, error)

GetDefaultImageTag - Returns the default image tag for a given image name

func (*Config) GetDriverArgs

func (c *Config) GetDriverArgs() []string

GetDriverArgs - Returns arguments for the driver container

func (*Config) GetDriverControllerTolerations

func (c *Config) GetDriverControllerTolerations() []corev1.Toleration

GetDriverControllerTolerations - Returns tolerations for the controller

func (*Config) GetDriverNodeTolerations

func (c *Config) GetDriverNodeTolerations() []corev1.Toleration

GetDriverNodeTolerations - Returns tolerations for the node

func (*Config) GetInitContainerArgs

func (c *Config) GetInitContainerArgs(InitContainerType csiv1.ImageType) []string

GetInitContainerArgs - Returns a slice of arguments (strings) for an Init Container

func (*Config) GetInitContainerEnvs

func (c *Config) GetInitContainerEnvs(InitContainerType csiv1.ImageType) []corev1.EnvVar

GetInitContainerEnvs - Returns a slice of Envs for initContainer

func (*Config) GetInitContainerVolMounts

func (c *Config) GetInitContainerVolMounts(InitContainerType csiv1.ImageType) []corev1.VolumeMount

GetInitContainerVolMounts - Returns a slice of volume mounts for a initContainers

func (*Config) GetMandatoryEnvNames

func (c *Config) GetMandatoryEnvNames(driverContainerType string) []string

GetMandatoryEnvNames - Returns a slice of mandatory environments for each type of driver container - controller/node

func (*Config) GetMandatorySideCars

func (c *Config) GetMandatorySideCars() []string

GetMandatorySideCars - Returns a slice of side car container names which are marked as default

func (*Config) GetMandatoryStorageClassParams

func (c *Config) GetMandatoryStorageClassParams() []string

GetMandatoryStorageClassParams - Returns a (string) slice of mandatory storage class parameters

func (*Config) GetNodeEnvs

func (c *Config) GetNodeEnvs() []corev1.EnvVar

GetNodeEnvs - Returns an array of corev1.EnvVar for the Node

func (*Config) GetNodeInitContainers

func (c *Config) GetNodeInitContainers() []string

GetNodeInitContainers - Returns a slice of all init container names for nodes

func (*Config) GetNodeVolumeMounts

func (c *Config) GetNodeVolumeMounts() []corev1.VolumeMount

GetNodeVolumeMounts - Returns an array of corev1.VolumeMount for the Node

func (*Config) GetNodeVolumes

func (c *Config) GetNodeVolumes() []corev1.Volume

GetNodeVolumes - Returns an array of corev1.Volume for the Node

func (*Config) GetSideCarArgs

func (c *Config) GetSideCarArgs(sidecarType csiv1.ImageType) []string

GetSideCarArgs - Returns a slice of arguments (strings) for a side car

func (*Config) GetSideCarEnvs

func (c *Config) GetSideCarEnvs(sidecarType csiv1.ImageType) []corev1.EnvVar

GetSideCarEnvs - Returns a slice of env variables for a side car

func (*Config) GetSideCarVolMounts

func (c *Config) GetSideCarVolMounts(sidecarType csiv1.ImageType) []corev1.VolumeMount

GetSideCarVolMounts - Returns a slice of volume mounts for a side car

func (*Config) InitDriverConfig

func (c *Config) InitDriverConfig(configDirectory string) error

InitDriverConfig - Initializes driver config by reading files in a config directory

func (*Config) IsControllerHAEnabled

func (c *Config) IsControllerHAEnabled(imageName string) bool

IsControllerHAEnabled - Determines whether Controller HA is enabled or not

func (*Config) ValidateEnvironmentVarType

func (c *Config) ValidateEnvironmentVarType(envFromSpec corev1.EnvVar) (bool, error)

ValidateEnvironmentVarType - Used to validate environment variables specified via the user We dont expect the user to ever specify EnvVarReference & SecretReferenceType as that is always done via the config

type ConfigVersionParams

type ConfigVersionParams struct {
	ConfigVersion     string                   `yaml:"configVersion"`
	UseDefaults       bool                     `yaml:"useDefaults,omitempty"`
	SupportedVersions []SupportedVersionParams `yaml:"supportedVersions"`
	Attacher          string                   `yaml:"attacher,omitempty"`
	Provisoner        string                   `yaml:"provisioner,omitempty"`
	Resizer           string                   `yaml:"resizer,omitempty"`
	Snapshotter       string                   `yaml:"snapshotter,omitempty"`
	Registrar         string                   `yaml:"registrar,omitempty"`
	Healthmonitor     string                   `yaml:"external-health-monitor,omitempty"`
}

ConfigVersionParams - Represents a specific config version of the driver

type ContainerApp

type ContainerApp struct {
	Name   string     `yaml:"name"`
	Images []ImageTag `yaml:"images"`
}

ContainerApp - Represents any other container

type DriverConfig

type DriverConfig struct {
	ControllerHA           bool                  `json:"controllerHA,omitempty"`
	EnableEphemeralVolumes bool                  `json:"enableEphemeralVolumes,omitempty"`
	DriverEnvs             []DriverEnv           `json:"driverEnvs"`
	NodeVolumes            []corev1.Volume       `json:"driverNodeVolumes"`
	ControllerVolumes      []corev1.Volume       `json:"driverControllerVolumes"`
	NodeVolumeMounts       []corev1.VolumeMount  `json:"driverNodeVolumeMounts"`
	ControllerVolumeMounts []corev1.VolumeMount  `json:"driverControllerVolumeMounts"`
	DriverArgs             []string              `json:"driverArgs"`
	ControllerTolerations  []corev1.Toleration   `json:"controllerTolerations"`
	NodeTolerations        []corev1.Toleration   `json:"nodeTolerations"`
	SidecarParams          []SidecarParams       `json:"sidecarParams"`
	InitContainerParams    []InitContainerParams `json:"initContainerParams"`
	StorageClassParams     []StorageClassParam   `json:"storageClassParams"`
	StorageClassAttrs      []StorageClassAttr    `json:"storageClassAttrs"`
}

DriverConfig - Type representing the default configuration of the driver

type DriverConfigMap

type DriverConfigMap struct {
	DriverConfig DriverConfig `json:"driverConfig"`
}

DriverConfigMap - Top level structure for reading from json

type DriverConfigParams

type DriverConfigParams struct {
	Name           csiv1.DriverType      `yaml:"name"`
	ConfigVersions []ConfigVersionParams `yaml:"configVersions"`
}

DriverConfigParams - Represents the driver and its config versions

type DriverEnv

type DriverEnv struct {
	Name                      string      `json:"Name"`
	Mandatory                 bool        `json:"Mandatory,omitempty"`
	CSIEnvType                EnvDataType `json:",CSIEnvType"`
	SetForController          bool        `json:"SetForController"`
	SetForNode                bool        `json:"SetForNode"`
	DefaultValueForController string      `json:"DefaultValueForController"`
	DefaultValueForNode       string      `json:"DefaultValueForNode"`
}

DriverEnv - Type representing an environment variable for the drivers

type EnvDataType

type EnvDataType string

EnvDataType represents type of an environment variable

const (
	StringType          EnvDataType = "String"
	BooleanType         EnvDataType = "Boolean"
	ListType            EnvDataType = "List"
	IntType             EnvDataType = "Int"
	FloatType           EnvDataType = "FloatType"
	EnvVarReferenceType EnvDataType = "EnvVarReferenceType"
	SecretReferenceType EnvDataType = "EnvSecretReference"
)

Constants representing different types of acceptable types

type ImageTag

type ImageTag struct {
	K8sVersion csiv1.K8sVersion `yaml:"version"`
	Tag        string           `yaml:"tag,omitempty"`
}

ImageTag - Image tag with associated K8s version

type InitContainerParams

type InitContainerParams struct {
	Name             csiv1.ImageType      `json:"Name"`
	Optional         bool                 `json:"optional"`
	SetForController bool                 `json:"SetForController"`
	SetForNode       bool                 `json:"SetForNode"`
	Args             []string             `json:"args"`
	Envs             []corev1.EnvVar      `json:"envs"`
	VolumeMounts     []corev1.VolumeMount `json:"volumeMounts"`
}

InitContainerParams - represents configuration for InitContainers

type OpConfig

type OpConfig struct {
	Drivers              []DriverConfigParams `yaml:"drivers"`
	CSISideCars          []ContainerApp       `yaml:"csiSideCars"`
	Extensions           []ContainerApp       `yaml:"extensions,omitempty"`
	SupportedK8sVersions []csiv1.K8sVersion   `yaml:"supportedK8sVersions"`
}

OpConfig - Represents the image & RBAC config used by Operator

func ReadOpConfig

func ReadOpConfig(configDirectory, configFileName string) (*OpConfig, error)

ReadOpConfig - Reads Operator config

func (*OpConfig) GetDefaultImageTags

func (opConfig *OpConfig) GetDefaultImageTags(driverType csiv1.DriverType, configVersion string,
	k8sVersion csiv1.K8sVersion) (map[string]string, error)

GetDefaultImageTags - Returns an image map

func (*OpConfig) GetSupportedK8sVersions

func (opConfig *OpConfig) GetSupportedK8sVersions() []csiv1.K8sVersion

GetSupportedK8sVersions - Returns supported k8s versions

func (*OpConfig) IsSupportedVersion

func (opConfig *OpConfig) IsSupportedVersion(driverType csiv1.DriverType, driverConfigVersion string,
	version csiv1.K8sVersion) error

IsSupportedVersion - Returns if a specific driver config version is supported

type SidecarParams

type SidecarParams struct {
	Name         csiv1.ImageType      `json:"Name"`
	Optional     bool                 `json:"optional"`
	Args         []string             `json:"args"`
	Envs         []corev1.EnvVar      `json:"envs"`
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts"`
}

SidecarParams - represents configuration for a side car container

type StorageClassAttr

type StorageClassAttr struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

StorageClassAttr represents attributes of a storage class (like volume expansion)

type StorageClassParam

type StorageClassParam struct {
	Name      string `json:"Name"`
	Mandatory bool   `json:"Mandatory"`
}

StorageClassParam represents a single storage class parameter

type SupportedVersionParams

type SupportedVersionParams struct {
	Version       csiv1.K8sVersion `yaml:"version"`
	Attacher      string           `yaml:"attacher,omitempty"`
	Provisioner   string           `yaml:"provisioner,omitempty"`
	Resizer       string           `yaml:"resizer,omitempty"`
	Snapshotter   string           `yaml:"snapshotter,omitempty"`
	Registrar     string           `yaml:"registrar,omitempty"`
	Healthmonitor string           `yaml:"external-health-monitor,omitempty"`
}

SupportedVersionParams - Represents the supported versions and corresponding sidecars

Jump to

Keyboard shortcuts

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