Documentation
¶
Index ¶
- Constants
- Variables
- func AddAnnotation(obj metav1.Object, key string, value string) bool
- func Call[T any](fn func() T) T
- func ChannelToSlice[T any](c chan T) []T
- func Clamp[T cmp.Ordered](val, low, high T) T
- func ClusterNameContainerArg(name string) string
- func ContainerPortArg(port corev1.ContainerPort) string
- func CsiMountInfoVolume(kubeletDirPath string, driverName string) corev1.Volume
- func DeleteZeroValues[T comparable](slice []T) []T
- func DomainLabelsContainerArg(options []string) string
- func DriverNameContainerArg(name string) string
- func EventTypePredicate(create, update, del, generic bool) predicate.Predicate
- func FuseMountOptionsContainerArg(options map[string]string) string
- func GetOperatorNamespace() (string, error)
- func If[T any](cond bool, trueVal, falseVal T) T
- func IsOwnedBy(obj, owner metav1.Object) bool
- func KernelMountOptionsContainerArg(options map[string]string) string
- func KmsConfigVolume(configRef *corev1.LocalObjectReference) corev1.Volume
- func KubeletRegistrationPathContainerArg(kubeletDirPath string, driverName string) string
- func LeaderElectionLeaseDurationContainerArg(duration int) string
- func LeaderElectionNamespaceContainerArg(ns string) string
- func LeaderElectionRenewDeadlineContainerArg(deadline int) string
- func LeaderElectionRetryPeriodContainerArg(period int) string
- func LogFileContainerArg(containerName string) string
- func LogRotateConfigMapName(driverName string) string
- func LogRotateDirVolumeName(driverName string) corev1.Volume
- func LogVerbosityContainerArg(level int) string
- func LogsDirVolume(logHostPath, pluginName string) corev1.Volume
- func MapSlice[T, K any](in []T, mapper func(item T) K) []K
- func MapToString[K, T ~string](m map[K]T, keyValueSeperator, itemSeperator string) string
- func MetricsPortContainerArg(port int) string
- func NamePredicate(name string) predicate.Predicate
- func PluginDirVolume(kubeletDirPath string, driverNamePrefix string) corev1.Volume
- func PluginMountDirVolume(kubeletDirPath string) corev1.Volume
- func PluginMountDirVolumeMount(kubletDirPath string) corev1.VolumeMount
- func PodsMountDirVolume(kubeletDirPath string) corev1.Volume
- func PodsMountDirVolumeMount(kubletDirPath string) corev1.VolumeMount
- func RegistrationDirVolume(kubeletDirPath string) corev1.Volume
- func RunConcurrently(fnList ...func() error) chan error
- func SetFencingContainerArg(on bool) string
- func SetMetadataContainerArg(on bool) string
- func StagingPathContainerArg(kubeletDirPath string) string
- func TimeoutContainerArg(timeout int) string
- func ToggleOwnerReference(on bool, obj, owner metav1.Object, scheme *runtime.Scheme) (bool, error)
- func TopologyContainerArg(topology bool) string
- func TypeContainerArg(t string) string
Constants ¶
const ( SocketDir = "/csi" CsiConfigMapConfigKey = "config.json" CsiConfigMapMappingKey = "cluster-mapping.json" )
Variables ¶
var AlsoLogToStdErrContainerArg = "--alsologtostderr=true"
var ControllerPluginCsiAddonsContainerCephFsPort = corev1.ContainerPort{ ContainerPort: int32(9080), }
var ControllerPluginCsiAddonsContainerRbdPort = corev1.ContainerPort{ ContainerPort: int32(9070), }
CSI Addons container port definitions
var ControllerServerContainerArg = "--controllerserver=true"
var CsiAddonsAddressContainerArg = fmt.Sprintf("--csi-addons-address=%s", csiAddonsEndpoint)
var CsiAddonsEndpointContainerArg = fmt.Sprintf("--csi-addons-endpoint=%s", csiAddonsEndpoint)
var CsiAddonsNodeIdContainerArg = fmt.Sprintf("--node-id=$(%s)", NodeIdEnvVar.Name)
var CsiAddonsVolumeConditionArg = "--enable-volume-condition=true"
var CsiAddressContainerArg = fmt.Sprintf("--csi-address=%s", csiEndpoint)
Ceph CSI common container arguments
var CsiConfigVolume = corev1.Volume{ Name: "ceph-csi-config", VolumeSource: corev1.VolumeSource{ ConfigMap: &corev1.ConfigMapVolumeSource{ LocalObjectReference: corev1.LocalObjectReference{ Name: "ceph-csi-config", }, }, }, }
var CsiConfigVolumeMount = corev1.VolumeMount{ Name: CsiConfigVolume.Name, MountPath: "/etc/ceph-csi-config", }
var CsiMountInfoVolumeMount = corev1.VolumeMount{
Name: csiMountInfoVolumeName,
MountPath: "/csi/mountinfo",
}
var DefaultFsTypeContainerArg = "--default-fstype=ext4"
var DriverNamespaceContainerArg = fmt.Sprintf("--drivernamespace=$(%s)", DriverNamespaceEnvVar.Name)
var DriverNamespaceEnvVar = corev1.EnvVar{ Name: "DRIVER_NAMESPACE", ValueFrom: &corev1.EnvVarSource{ FieldRef: &corev1.ObjectFieldSelector{ FieldPath: "metadata.namespace", }, }, }
var EnableVolumeGroupSnapshotsContainerArg = "--feature-gates=CSIVolumeGroupSnapshot=true"
var EndpointContainerArg = fmt.Sprintf("--endpoint=%s", csiEndpoint)
var EtcSelinuxVolume = corev1.Volume{ Name: "etc-selinux", VolumeSource: corev1.VolumeSource{ HostPath: &corev1.HostPathVolumeSource{ Path: "/etc/selinux", }, }, }
var EtcSelinuxVolumeMount = corev1.VolumeMount{ Name: EtcSelinuxVolume.Name, MountPath: "/etc/selinux", ReadOnly: true, }
var ExtraCreateMetadataContainerArg = "--extra-create-metadata=true"
var ForceCephKernelClientContainerArg = "--forcecephkernelclient=true"
var HandleVolumeInuseErrorContainerArg = "--handle-volume-inuse-error=false"
var HonorPVReclaimPolicyContainerArg = "--feature-gates=HonorPVReclaimPolicy=true"
var HostDevVolume = corev1.Volume{ Name: "host-dev", VolumeSource: corev1.VolumeSource{ HostPath: &corev1.HostPathVolumeSource{ Path: "/dev", }, }, }
var HostDevVolumeMount = corev1.VolumeMount{ Name: HostDevVolume.Name, MountPath: "/dev", }
var HostRunMountVolume = corev1.Volume{ Name: "host-run-mount", VolumeSource: corev1.VolumeSource{ HostPath: &corev1.HostPathVolumeSource{ Path: "/run/mount", }, }, }
var HostRunMountVolumeMount = corev1.VolumeMount{ Name: HostRunMountVolume.Name, MountPath: "/run/mount", }
var HostSysVolume = corev1.Volume{ Name: "host-sys", VolumeSource: corev1.VolumeSource{ HostPath: &corev1.HostPathVolumeSource{ Path: "/sys", }, }, }
var HostSysVolumeMount = corev1.VolumeMount{ Name: HostSysVolume.Name, MountPath: "/sys", }
var KeysTmpDirVolume = corev1.Volume{ Name: "keys-tmp-dir", VolumeSource: corev1.VolumeSource{ EmptyDir: &corev1.EmptyDirVolumeSource{ Medium: corev1.StorageMediumMemory, }, }, }
var KeysTmpDirVolumeMount = corev1.VolumeMount{ Name: KeysTmpDirVolume.Name, MountPath: "/tmp/csi/keys", }
var KmsConfigVolumeMount = corev1.VolumeMount{ Name: kmsConfigVolumeName, MountPath: "/etc/ceph-csi-encryption-kms-config/", ReadOnly: true, }
var LeaderElectionContainerArg = "--leader-election=true"
var LibModulesVolume = corev1.Volume{ Name: "lib-modules", VolumeSource: corev1.VolumeSource{ HostPath: &corev1.HostPathVolumeSource{ Path: "/lib/modules", }, }, }
var LibModulesVolumeMount = corev1.VolumeMount{ Name: LibModulesVolume.Name, MountPath: "/lib/modules", ReadOnly: true, }
var LogRotateDirVolumeMount = corev1.VolumeMount{
Name: logRotateDirVolumeName,
MountPath: "/logrotate-config",
}
var LogToStdErrContainerArg = "--logtostderr=false"
var LogsDirVolumeMount = corev1.VolumeMount{
Name: logsDirVolumeName,
MountPath: "/csi-logs",
}
var MetricsPathContainerArg = "--metricspath=/metrics"
var NamespaceContainerArg = fmt.Sprintf("--namespace=$(%s)", PodNamespaceEnvVar.Name)
var NodeIdContainerArg = fmt.Sprintf("--nodeid=$(%s)", NodeIdEnvVar.Name)
var NodeIdEnvVar = corev1.EnvVar{ Name: "NODE_ID", ValueFrom: &corev1.EnvVarSource{ FieldRef: &corev1.ObjectFieldSelector{ FieldPath: "spec.nodeName", }, }, }
var NodePluginCsiAddonsContainerPort = corev1.ContainerPort{ ContainerPort: int32(9071), }
var NodeServerContainerArg = "--nodeserver=true"
var OidcTokenVolume = corev1.Volume{ Name: "oidc-token", VolumeSource: corev1.VolumeSource{ Projected: &corev1.ProjectedVolumeSource{ Sources: []corev1.VolumeProjection{ { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Path: "oidc-token", ExpirationSeconds: ptr.To(int64(3600)), Audience: "ceph-csi-kms", }, }, }, }, }, }
var OidcTokenVolumeMount = corev1.VolumeMount{ Name: OidcTokenVolume.Name, MountPath: "/run/secrets/tokens", ReadOnly: true, }
var PidlimitContainerArg = "--pidlimit=-1"
var PluginDirVolumeMount = corev1.VolumeMount{
Name: pluginDirVolumeName,
MountPath: "/csi",
}
var PodContainerArg = fmt.Sprintf("--pod=$(%s)", PodNameEnvVar.Name)
var PodIpEnvVar = corev1.EnvVar{ Name: "POD_IP", ValueFrom: &corev1.EnvVarSource{ FieldRef: &corev1.ObjectFieldSelector{ FieldPath: "status.podIP", }, }, }
Ceph CSI Common env var definition
var PodNameEnvVar = corev1.EnvVar{ Name: "POD_NAME", ValueFrom: &corev1.EnvVarSource{ FieldRef: &corev1.ObjectFieldSelector{ FieldPath: "metadata.name", }, }, }
var PodNamespaceEnvVar = corev1.EnvVar{ Name: "POD_NAMESPACE", ValueFrom: &corev1.EnvVarSource{ FieldRef: &corev1.ObjectFieldSelector{ FieldPath: "metadata.namespace", }, }, }
var PodUidContainerArg = fmt.Sprintf("--pod-uid=$(%s)", PodUidEnvVar.Name)
var PodUidEnvVar = corev1.EnvVar{ Name: "POD_UID", ValueFrom: &corev1.EnvVarSource{ FieldRef: &corev1.ObjectFieldSelector{ FieldPath: "metadata.uid", }, }, }
var PoolTimeContainerArg = "--polltime=60s"
var PreventVolumeModeConversionContainerArg = "--prevent-volume-mode-conversion=true"
var RecoverVolumeExpansionFailureContainerArg = "--feature-gates=RecoverVolumeExpansionFailure=true"
var RegistrationDirVolumeMount = corev1.VolumeMount{
Name: registrationVolumeName,
MountPath: "/registration",
}
var RetryIntervalStartContainerArg = "--retry-interval-start=500ms"
var SnapshotMetadataGrpcPort = corev1.ContainerPort{ ContainerPort: int32(50051), }
CSI snapshot-metadata sidecar container port definitions
var SnapshotMetadataGrpcServicePortArg = fmt.Sprintf("--port=%d", SnapshotMetadataGrpcPort.ContainerPort)
var SnapshotMetadataTlsCertArg = "--tls-cert=/tmp/certificates/tls.crt"
var SnapshotMetadataTlsKeyArg = "--tls-key=/tmp/certificates/tls.key"
var SocketDirVolume = corev1.Volume{ Name: "socket-dir", VolumeSource: corev1.VolumeSource{ EmptyDir: &corev1.EmptyDirVolumeSource{ Medium: corev1.StorageMediumMemory, }, }, }
Ceph CSI common volumes
var SocketDirVolumeMount = corev1.VolumeMount{ Name: SocketDirVolume.Name, MountPath: SocketDir, }
Ceph CSI common volume Mounts
Functions ¶
func AddAnnotation ¶
AddAnnotation adds an annotation to a resource metadata, returns true if added else false
func Call ¶
func Call[T any](fn func() T) T
Call calls the provided zero-argument function. This util is used whenever we need to define a function and call it immediately and only once, as a more readable alternative to (func() { ... })(). The common use case is "inline" func invoation as part of a data staructure initializtaoin code.
func ChannelToSlice ¶
func ChannelToSlice[T any](c chan T) []T
ChannelToSlice consumes a channel return values in a slice
func ClusterNameContainerArg ¶
func ContainerPortArg ¶ added in v0.3.0
func ContainerPortArg(port corev1.ContainerPort) string
func CsiMountInfoVolume ¶ added in v0.3.0
func DeleteZeroValues ¶
func DeleteZeroValues[T comparable](slice []T) []T
RemoveZeroValues return a new slice form the provided slice where all zero-valued items are removed
func DriverNameContainerArg ¶
func EventTypePredicate ¶
EventTypePredicate return a predicate the filter events based on their respective event type. This helper allows for the selection of multiple types resulting in a predicate that can filter in more then a single event type
func GetOperatorNamespace ¶ added in v0.2.0
func KmsConfigVolume ¶
func KmsConfigVolume(configRef *corev1.LocalObjectReference) corev1.Volume
func LogFileContainerArg ¶
func LogRotateConfigMapName ¶
func LogRotateDirVolumeName ¶
func LogsDirVolume ¶
func MapSlice ¶
func MapSlice[T, K any](in []T, mapper func(item T) K) []K
MapSlice maps the iteas of a given slice into a new slice using a mapper function
func MapToString ¶
MapToString serializes the provided map into a a string.
func MetricsPortContainerArg ¶
func NamePredicate ¶
Name Predicate return a predicate the filter events produced by resources that matches the given name
func PluginDirVolume ¶
func PluginMountDirVolume ¶
func PluginMountDirVolumeMount ¶
func PluginMountDirVolumeMount(kubletDirPath string) corev1.VolumeMount
func PodsMountDirVolume ¶
func PodsMountDirVolumeMount ¶
func PodsMountDirVolumeMount(kubletDirPath string) corev1.VolumeMount
func RegistrationDirVolume ¶
func RunConcurrently ¶
RunConcurrently runs all the of the given functions concurrently returning a channel with the functions' return values (of type error) then closes the channel when all functions return.
func SetFencingContainerArg ¶ added in v0.4.0
func SetMetadataContainerArg ¶
func StagingPathContainerArg ¶
func TimeoutContainerArg ¶
func ToggleOwnerReference ¶
ToggleOwnerReference adds or remove an owner reference for the given owner based on the first argument. The function return true if the owner reference list had changed and false it it didn't
func TopologyContainerArg ¶ added in v0.3.0
func TypeContainerArg ¶
Types ¶
This section is empty.