Documentation
¶
Index ¶
- Constants
- Variables
- func Add(mgr manager.Manager, context *clusterd.Context, ...) error
- func CSIEnabled() bool
- func CreateCSISecrets(context *clusterd.Context, clusterInfo *client.ClusterInfo) error
- func CreateCsiConfigMap(ctx context.Context, namespace string, clientset kubernetes.Interface, ...) error
- func CreateDefaultClientProfile(c client.Client, clusterInfo *cephclient.ClusterInfo, ...) error
- func CreateUpdateCephConnection(c client.Client, clusterInfo *cephclient.ClusterInfo, ...) error
- func CreateUpdateClientProfileRadosNamespace(ctx context.Context, c client.Client, clusterInfo *cephclient.ClusterInfo, ...) error
- func CreateUpdateClientProfileSubVolumeGroup(ctx context.Context, c client.Client, clusterInfo *cephclient.ClusterInfo, ...) error
- func EnableCSIOperator() bool
- func FormatCsiClusterConfig(clusterKey string, mons map[string]*cephclient.MonInfo) (string, error)
- func GetPodAntiAffinity(key, value string) corev1.PodAntiAffinity
- func IsHolderEnabled() bool
- func MonEndpoints(mons map[string]*cephclient.MonInfo, requireMsgr2 bool) []string
- func SaveCSIDriverOptions(clientset kubernetes.Interface, clusterNamespace string, ...) error
- func SaveClusterConfig(clientset kubernetes.Interface, clusterID, clusterNamespace string, ...) error
- type CSIClusterConfigEntry
- type Param
- type ReconcileCSI
Constants ¶
const ( CsiRBDNodeSecret = "rook-csi-rbd-node" CsiRBDProvisionerSecret = "rook-csi-rbd-provisioner" )
const ( CsiCephFSNodeSecret = "rook-csi-cephfs-node" CsiCephFSProvisionerSecret = "rook-csi-cephfs-provisioner" )
const ( // 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 DefaultCSIAddonsRBDProvisionerPort uint16 = 9070 DefaultCSIAddonsCephFSProvisionerPort uint16 = 9070 // driver daemonset names CsiRBDPlugin = "csi-rbdplugin" CsiCephFSPlugin = "csi-cephfsplugin" CsiNFSPlugin = "csi-nfsplugin" RBDDriverShortName = "rbd" CephFSDriverShortName = "cephfs" NFSDriverShortName = "nfs" )
Variables ¶
var ( CSIParam Param EnableRBD = false EnableCephFS = false EnableNFS = 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" )
var ( // image names DefaultCSIPluginImage = "quay.io/cephcsi/cephcsi:v3.14.0" DefaultRegistrarImage = "registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.13.0" DefaultProvisionerImage = "registry.k8s.io/sig-storage/csi-provisioner:v5.1.0" DefaultAttacherImage = "registry.k8s.io/sig-storage/csi-attacher:v4.8.0" DefaultSnapshotterImage = "registry.k8s.io/sig-storage/csi-snapshotter:v8.2.0" DefaultResizerImage = "registry.k8s.io/sig-storage/csi-resizer:v1.13.1" DefaultCSIAddonsImage = "quay.io/csiaddons/k8s-sidecar:v0.12.0" // image pull policy DefaultCSIImagePullPolicy = string(corev1.PullIfNotPresent) // Local package template path for RBD //go:embed template/rbd/csi-rbdplugin.yaml RBDPluginTemplatePath 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-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/csi-logrotate-sidecar.yaml LogrotateTemplatePath 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 CreateDefaultClientProfile ¶ added in v1.15.0
func CreateDefaultClientProfile(c client.Client, clusterInfo *cephclient.ClusterInfo, namespaced types.NamespacedName) error
CreateDefaultClientProfile creates a default client profile for csi-operator to connect driver
func CreateUpdateCephConnection ¶ added in v1.15.0
func CreateUpdateCephConnection(c client.Client, clusterInfo *cephclient.ClusterInfo, clusterSpec cephv1.ClusterSpec) error
func CreateUpdateClientProfileRadosNamespace ¶ added in v1.15.0
func CreateUpdateClientProfileRadosNamespace(ctx context.Context, c client.Client, clusterInfo *cephclient.ClusterInfo, cephBlockPoolRadosNamespaceName, clusterID, clusterName string) error
func CreateUpdateClientProfileSubVolumeGroup ¶ added in v1.15.0
func CreateUpdateClientProfileSubVolumeGroup(ctx context.Context, c client.Client, clusterInfo *cephclient.ClusterInfo, cephFilesystemSubVolumeGroupName, clusterID, clusterName string) error
func EnableCSIOperator ¶ added in v1.15.0
func EnableCSIOperator() bool
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 GetPodAntiAffinity ¶ added in v1.4.0
func GetPodAntiAffinity(key, value string) corev1.PodAntiAffinity
Get PodAntiAffinity from a key and value pair
func IsHolderEnabled ¶ added in v1.14.0
func IsHolderEnabled() bool
func MonEndpoints ¶ added in v1.8.3
func MonEndpoints(mons map[string]*cephclient.MonInfo, requireMsgr2 bool) []string
func SaveCSIDriverOptions ¶ added in v1.13.0
func SaveCSIDriverOptions(clientset kubernetes.Interface, clusterNamespace string, clusterInfo *cephclient.ClusterInfo) error
SaveCSIDriverOptions, similar to SaveClusterConfig, updates the config map used by ceph-csi with CSI driver options such as read affinity, kernel mount options and fuse mount options.
func SaveClusterConfig ¶ added in v1.1.0
func SaveClusterConfig(clientset kubernetes.Interface, clusterID, clusterNamespace string, clusterInfo *cephclient.ClusterInfo, newCsiClusterConfigEntry *CSIClusterConfigEntry) error
SaveClusterConfig updates the config map used to provide ceph-csi with basic cluster configuration. The clusterID, clusterNamespace, and clusterInfo are used to determine what "cluster" in the config map will be updated. clusterID should be the same as clusterNamespace for CephClusters, but for other resources (e.g., CephBlockPoolRadosNamespace, CephFilesystemSubVolumeGroup) or for other supplementary entries, the clusterID should be unique and different from the namespace so as not to disrupt CephCluster configurations.
Types ¶
type CSIClusterConfigEntry ¶ added in v1.14.0
type CSIClusterConfigEntry struct {
cephcsi.ClusterInfo
Namespace string `json:"namespace"`
}
type Param ¶
type Param struct {
CSIPluginImage string
RegistrarImage string
ProvisionerImage string
AttacherImage string
SnapshotterImage string
ResizerImage string
DriverNamePrefix string
KubeletDirPath string
CsiLogRootPath string
ForceCephFSKernelClient string
CephFSKernelMountOptions string
CephFSPluginUpdateStrategy string
NFSPluginUpdateStrategy string
RBDPluginUpdateStrategy string
PluginPriorityClassName string
ProvisionerPriorityClassName string
VolumeReplicationImage string
CSIAddonsImage string
ImagePullPolicy 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
EnableCSIEncryption bool
EnableCSITopology bool
EnableLiveness bool
CephFSAttachRequired bool
RBDAttachRequired bool
NFSAttachRequired bool
VolumeGroupSnapshotCLIFlag string
VolumeGroupSnapshotSupported bool
LogLevel uint8
SidecarLogLevel uint8
CephFSLivenessMetricsPort uint16
CSIAddonsPort uint16
CSIAddonsRBDProvisionerPort uint16
CSIAddonsCephFSProvisionerPort uint16
RBDLivenessMetricsPort uint16
KubeApiBurst uint16
KubeApiQPS float32
LeaderElectionLeaseDuration time.Duration
LeaderElectionRenewDeadline time.Duration
LeaderElectionRetryPeriod time.Duration
ProvisionerReplicas int32
CSICephFSPodLabels map[string]string
CSINFSPodLabels map[string]string
CSIRBDPodLabels map[string]string
CSILogRotation bool
CsiComponentName string
CSILogRotationMaxSize string
CSILogRotationPeriod string
Privileged bool
}
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.