csi

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CsiRBDNodeSecret        = "rook-csi-rbd-node"
	CsiRBDProvisionerSecret = "rook-csi-rbd-provisioner"
)

#nosec because of the word `Secret`

View Source
const (
	CsiCephFSNodeSecret        = "rook-csi-cephfs-node"
	CsiCephFSProvisionerSecret = "rook-csi-cephfs-provisioner"
)

#nosec because of the word `Secret`

View Source
const (
	KubeMinMajor = "1"
	KubeMinMinor = "13"

	// kubelet directory path
	DefaultKubeletDirPath = "/var/lib/kubelet"

	// template
	DefaultRBDPluginTemplatePath         = "/etc/ceph-csi/rbd/csi-rbdplugin.yaml"
	DefaultRBDProvisionerSTSTemplatePath = "/etc/ceph-csi/rbd/csi-rbdplugin-provisioner-sts.yaml"
	DefaultRBDProvisionerDepTemplatePath = "/etc/ceph-csi/rbd/csi-rbdplugin-provisioner-dep.yaml"
	DefaultRBDPluginServiceTemplatePath  = "/etc/ceph-csi/rbd/csi-rbdplugin-svc.yaml"

	DefaultCephFSPluginTemplatePath         = "/etc/ceph-csi/cephfs/csi-cephfsplugin.yaml"
	DefaultCephFSProvisionerSTSTemplatePath = "/etc/ceph-csi/cephfs/csi-cephfsplugin-provisioner-sts.yaml"
	DefaultCephFSProvisionerDepTemplatePath = "/etc/ceph-csi/cephfs/csi-cephfsplugin-provisioner-dep.yaml"
	DefaultCephFSPluginServiceTemplatePath  = "/etc/ceph-csi/cephfs/csi-cephfsplugin-svc.yaml"

	// grpc metrics and liveness port for cephfs  and rbd
	DefaultCephFSGRPCMerticsPort     uint16 = 9091
	DefaultCephFSLivenessMerticsPort uint16 = 9081
	DefaultRBDGRPCMerticsPort        uint16 = 9090
	DefaultRBDLivenessMerticsPort    uint16 = 9080
)

Variables

View Source
var (
	CSIParam Param

	EnableRBD            = false
	EnableCephFS         = false
	EnableCSIGRPCMetrics = false
	AllowUnsupported     = false

	//driver names
	CephFSDriverName string
	RBDDriverName    string

	// template paths
	RBDPluginTemplatePath         string
	RBDProvisionerSTSTemplatePath string
	RBDProvisionerDepTemplatePath string

	CephFSPluginTemplatePath         string
	CephFSProvisionerSTSTemplatePath string
	CephFSProvisionerDepTemplatePath string

	// configuration map for csi
	ConfigName = "rook-ceph-csi-config"
	ConfigKey  = "csi-cluster-config-json"
)
View Source
var (
	// image names
	DefaultCSIPluginImage   = "quay.io/cephcsi/cephcsi:v2.1.2"
	DefaultRegistrarImage   = "quay.io/k8scsi/csi-node-driver-registrar:v1.2.0"
	DefaultProvisionerImage = "quay.io/k8scsi/csi-provisioner:v1.6.0"
	DefaultAttacherImage    = "quay.io/k8scsi/csi-attacher:v2.1.0"
	DefaultSnapshotterImage = "quay.io/k8scsi/csi-snapshotter:v2.1.1"
)

Specify default images as var instead of const so that they can be overridden with the Go linker's -X flag. This allows users to easily build images with a different opinionated set of images without having to specify them manually in charts/manifests which can make upgrades more manually challenging.

Functions

func CSIEnabled

func CSIEnabled() bool

func CreateCSISecrets

func CreateCSISecrets(context *clusterd.Context, clusterName string, ownerRef *metav1.OwnerReference) error

CreateCSISecrets creates all the Kubernetes CSI Secrets

func CreateCsiConfigMap

func CreateCsiConfigMap(namespace string, clientset kubernetes.Interface, ownerRef *metav1.OwnerReference) error

CreateCsiConfigMap creates an empty config map that will be later used to provide cluster configuration to ceph-csi. If a config map already exists, it will return it.

func FormatCsiClusterConfig

func FormatCsiClusterConfig(
	clusterKey string, mons map[string]*cephconfig.MonInfo) (string, error)

FormatCsiClusterConfig returns a json-formatted string containing the cluster-to-mon mapping required to configure ceph csi.

func GetPodAntiAffinity

func GetPodAntiAffinity(key, value string) corev1.PodAntiAffinity

Get PodAntiAffinity from a key and value pair

func SaveClusterConfig

func SaveClusterConfig(
	clientset kubernetes.Interface, clusterNamespace string,
	clusterInfo *cephconfig.ClusterInfo, l sync.Locker) error

SaveClusterConfig updates the config map used to provide ceph-csi with basic cluster configuration. The clusterNamespace and clusterInfo are used to determine what "cluster" in the config map will be updated and and the clusterNamespace value is expected to match the clusterID value that is provided to ceph-csi uses in the storage class. The locker l is typically a mutex and is used to prevent the config map from being updated for multiple clusters simultaneously.

func SetParams

func SetParams(clientset kubernetes.Interface) error

func UpdateCsiClusterConfig

func UpdateCsiClusterConfig(
	curr, clusterKey string, mons map[string]*cephconfig.MonInfo) (string, error)

UpdateCsiClusterConfig returns a json-formatted string containing the cluster-to-mon mapping required to configure ceph csi.

func ValidateAndConfigureDrivers

func ValidateAndConfigureDrivers(clientset kubernetes.Interface, namespace, rookImage, securityAccount string, serverVersion *version.Info, ownerRef *metav1.OwnerReference)

func ValidateCSIParam

func ValidateCSIParam() error

Types

type CephCSIVersion

type CephCSIVersion struct {
	Major  int
	Minor  int
	Bugfix int
}

CephCSIVersion represents the Ceph CSI version format

func (*CephCSIVersion) String

func (v *CephCSIVersion) String() string

func (*CephCSIVersion) Supported

func (v *CephCSIVersion) Supported() bool

Supported checks if the detected version is part of the known supported CSI versions

type Param

type Param struct {
	CSIPluginImage               string
	RegistrarImage               string
	ProvisionerImage             string
	AttacherImage                string
	SnapshotterImage             string
	ResizerImage                 string
	DriverNamePrefix             string
	EnableSnapshotter            string
	EnableCSIGRPCMetrics         string
	KubeletDirPath               string
	ForceCephFSKernelClient      string
	CephFSPluginUpdateStrategy   string
	RBDPluginUpdateStrategy      string
	PluginPriorityClassName      string
	ProvisionerPriorityClassName string
	LogLevel                     uint8
	CephFSGRPCMetricsPort        uint16
	CephFSLivenessMetricsPort    uint16
	RBDGRPCMetricsPort           uint16
	RBDLivenessMetricsPort       uint16
}

Jump to

Keyboard shortcuts

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