csi

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 45 Imported by: 55

Documentation

Index

Constants

View Source
const (
	CsiRBDNodeSecret        = "rook-csi-rbd-node"
	CsiRBDProvisionerSecret = "rook-csi-rbd-provisioner"
)
View Source
const (
	CsiCephFSNodeSecret        = "rook-csi-cephfs-node"
	CsiCephFSProvisionerSecret = "rook-csi-cephfs-provisioner"
)
View Source
const (
	KubeMinMajor                     = "1"
	KubeMinVerForOIDCTokenProjection = "20"

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

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

	RBDDriverShortName    = "rbd"
	CephFSDriverShortName = "cephfs"
	NFSDriverShortName    = "nfs"
)

Variables

View Source
var (
	CSIParam Param

	EnableRBD                 = false
	EnableCephFS              = false
	EnableNFS                 = false
	EnableCSIGRPCMetrics      = false
	AllowUnsupported          = false
	CustomCSICephConfigExists = false

	//driver names
	CephFSDriverName string
	NFSDriverName    string
	RBDDriverName    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:v3.7.0"
	DefaultRegistrarImage   = "registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.5.1"
	DefaultProvisionerImage = "registry.k8s.io/sig-storage/csi-provisioner:v3.2.1"
	DefaultAttacherImage    = "registry.k8s.io/sig-storage/csi-attacher:v3.5.0"
	DefaultSnapshotterImage = "registry.k8s.io/sig-storage/csi-snapshotter:v6.0.1"
	DefaultResizerImage     = "registry.k8s.io/sig-storage/csi-resizer:v1.5.0"
	DefaultCSIAddonsImage   = "quay.io/csiaddons/k8s-sidecar:v0.5.0"

	// Local package template path for RBD
	//go:embed template/rbd/csi-rbdplugin.yaml
	RBDPluginTemplatePath string
	//go:embed template/rbd/csi-rbdplugin-holder.yaml
	RBDPluginHolderTemplatePath string
	//go:embed template/rbd/csi-rbdplugin-provisioner-dep.yaml
	RBDProvisionerDepTemplatePath string
	//go:embed template/rbd/csi-rbdplugin-svc.yaml
	RBDPluginServiceTemplatePath string

	// Local package template path for CephFS
	//go:embed template/cephfs/csi-cephfsplugin.yaml
	CephFSPluginTemplatePath string
	//go:embed template/cephfs/csi-cephfsplugin-holder.yaml
	CephFSPluginHolderTemplatePath string
	//go:embed template/cephfs/csi-cephfsplugin-provisioner-dep.yaml
	CephFSProvisionerDepTemplatePath string
	//go:embed template/cephfs/csi-cephfsplugin-svc.yaml
	CephFSPluginServiceTemplatePath string

	// Local package template path for NFS
	//go:embed template/nfs/csi-nfsplugin.yaml
	NFSPluginTemplatePath string
	//go:embed template/nfs/csi-nfsplugin-provisioner-dep.yaml
	NFSProvisionerDepTemplatePath string
	//go:embed template/nfs/csi-nfsplugin-holder.yaml
	NFSPluginHolderTemplatePath string
)

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 Add added in v1.8.0

func Add(mgr manager.Manager, context *clusterd.Context, opManagerContext context.Context, opConfig opcontroller.OperatorConfig) error

Add creates a new Ceph CSI Controller and adds it to the Manager. The Manager will set fields on the Controller and Start it when the Manager is Started.

func CSIEnabled

func CSIEnabled() bool

func CreateCSISecrets added in v1.1.3

func CreateCSISecrets(context *clusterd.Context, clusterInfo *client.ClusterInfo) error

CreateCSISecrets creates all the Kubernetes CSI Secrets

func CreateCsiConfigMap added in v1.1.0

func CreateCsiConfigMap(ctx context.Context, namespace string, clientset kubernetes.Interface, ownerInfo *k8sutil.OwnerInfo) 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 added in v1.1.0

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

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

func GenerateNetNamespaceFilePath added in v1.9.2

func GenerateNetNamespaceFilePath(ctx context.Context, client client.Client, clusterNamespace, opNamespace, driverName string) (string, error)

func GetPodAntiAffinity added in v1.4.0

func GetPodAntiAffinity(key, value string) corev1.PodAntiAffinity

Get PodAntiAffinity from a key and value pair

func MonEndpoints added in v1.8.3

func MonEndpoints(mons map[string]*cephclient.MonInfo) []string

func SaveClusterConfig added in v1.1.0

func SaveClusterConfig(clientset kubernetes.Interface, clusterNamespace string, clusterInfo *cephclient.ClusterInfo, newCsiClusterConfigEntry *CsiClusterConfigEntry) 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.

Types

type CephCSIVersion added in v1.3.0

type CephCSIVersion struct {
	Major  int
	Minor  int
	Bugfix int
}

CephCSIVersion represents the Ceph CSI version format

func (*CephCSIVersion) String added in v1.3.0

func (v *CephCSIVersion) String() string

func (*CephCSIVersion) Supported added in v1.3.0

func (v *CephCSIVersion) Supported() bool

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

func (*CephCSIVersion) SupportsCustomCephConf added in v1.9.0

func (v *CephCSIVersion) SupportsCustomCephConf() bool

SupportsCustomCephConf checks if the detected version supports custom ceph.conf

func (*CephCSIVersion) SupportsNsenter added in v1.9.5

func (v *CephCSIVersion) SupportsNsenter() bool

SupportsNsenter checks if the csi image has support for calling "nsenter" while executing mount/map commands. This is needed for Multus scenarios.

type ClusterDetail added in v1.9.2

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

ClusterDetail is a struct that holds the information of a cluster, it knows its internals (like FSID through clusterInfo) and the Kubernetes object that represents it (like the CephCluster CRD)

type CsiCephFSSpec added in v1.8.3

type CsiCephFSSpec struct {
	NetNamespaceFilePath string `json:"netNamespaceFilePath,omitempty"`
	SubvolumeGroup       string `json:"subvolumeGroup,omitempty"`
}

type CsiClusterConfigEntry added in v1.8.3

type CsiClusterConfigEntry struct {
	ClusterID      string         `json:"clusterID"`
	Monitors       []string       `json:"monitors"`
	Namespace      string         `json:"namespace"`
	CephFS         *CsiCephFSSpec `json:"cephFS,omitempty"`
	NFS            *CsiNFSSpec    `json:"nfs,omitempty"`
	RBD            *CsiRBDSpec    `json:"rbd,omitempty"`
	RadosNamespace string         `json:"radosNamespace,omitempty"`
}

type CsiNFSSpec added in v1.10.1

type CsiNFSSpec struct {
	NetNamespaceFilePath string `json:"netNamespaceFilePath,omitempty"`
}

type CsiRBDSpec added in v1.9.2

type CsiRBDSpec struct {
	NetNamespaceFilePath string `json:"netNamespaceFilePath,omitempty"`
	RadosNamespace       string `json:"radosNamespace,omitempty"`
}

type Param

type Param struct {
	CSIPluginImage               string
	RegistrarImage               string
	ProvisionerImage             string
	AttacherImage                string
	SnapshotterImage             string
	ResizerImage                 string
	DriverNamePrefix             string
	EnableCSIGRPCMetrics         string
	KubeletDirPath               string
	ForceCephFSKernelClient      string
	CephFSPluginUpdateStrategy   string
	NFSPluginUpdateStrategy      string
	RBDPluginUpdateStrategy      string
	PluginPriorityClassName      string
	ProvisionerPriorityClassName string
	VolumeReplicationImage       string
	CSIAddonsImage               string
	CSIClusterName               string
	CSIDomainLabels              string
	GRPCTimeout                  time.Duration
	CSIEnableMetadata            bool
	EnablePluginSelinuxHostMount bool
	EnableCSIHostNetwork         bool
	EnableOMAPGenerator          bool
	EnableRBDSnapshotter         bool
	EnableCephFSSnapshotter      bool
	EnableNFSSnapshotter         bool
	EnableCSIAddonsSideCar       bool
	MountCustomCephConf          bool
	EnableOIDCTokenProjection    bool
	EnableCSIEncryption          bool
	EnableCSITopology            bool
	EnableLiveness               bool
	LogLevel                     uint8
	SidecarLogLevel              uint8
	CephFSGRPCMetricsPort        uint16
	CephFSLivenessMetricsPort    uint16
	RBDGRPCMetricsPort           uint16
	CSIAddonsPort                uint16
	RBDLivenessMetricsPort       uint16
	ProvisionerReplicas          int32
	CSICephFSPodLabels           map[string]string
	CSINFSPodLabels              map[string]string
	CSIRBDPodLabels              map[string]string
}

type ReconcileCSI added in v1.8.0

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

ReconcileCSI reconciles a ceph-csi driver

func (*ReconcileCSI) Reconcile added in v1.8.0

func (r *ReconcileCSI) Reconcile(context context.Context, request reconcile.Request) (reconcile.Result, error)

Reconcile reads that state of the operator config map and makes changes based on the state read The Controller will requeue the Request to be processed again if the returned error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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