Documentation ¶
Overview ¶
Package spec provides Kubernetes controller/pod/container spec items used for many Ceph daemons
Index ¶
- Constants
- func AddCephVersionLabelToDaemonSet(cephVersion version.CephVersion, d *apps.DaemonSet)
- func AddCephVersionLabelToDeployment(cephVersion version.CephVersion, d *apps.Deployment)
- func AddCephVersionLabelToJob(cephVersion version.CephVersion, j *batch.Job)
- func AddCephVersionLabelToObjectMeta(cephVersion version.CephVersion, meta *metav1.ObjectMeta)
- func AddVolumeMountSubPath(podSpec *v1.PodSpec, volumeMountName string)
- func AdminFlags(cluster *cephconfig.ClusterInfo) []string
- func AppLabels(appName, namespace string) map[string]string
- func CephVolumeMounts(dataPaths *config.DataPathMap, confGeneratedInPod bool) []v1.VolumeMount
- func CheckPodMemory(resources v1.ResourceRequirements, cephPodMinimumMemory uint64) error
- func ChownCephDataDirsInitContainer(dpm config.DataPathMap, containerImage string, volumeMounts []v1.VolumeMount, ...) v1.Container
- func ContainerEnvVarReference(envVarName string) string
- func DaemonEnvVars(image string) []v1.EnvVar
- func DaemonFlags(cluster *cephconfig.ClusterInfo, daemonID string) []string
- func DaemonVolumeMounts(dataPaths *config.DataPathMap, keyringResourceName string) []v1.VolumeMount
- func DaemonVolumes(dataPaths *config.DataPathMap, keyringResourceName string) []v1.Volume
- func DaemonVolumesBase(dataPaths *config.DataPathMap, keyringResourceName string) []v1.Volume
- func DaemonVolumesContainsPVC(volumes []v1.Volume) bool
- func DaemonVolumesDataHostPath(dataPaths *config.DataPathMap) []v1.Volume
- func DaemonVolumesDataPVC(pvcName string) v1.Volume
- func ExtractCephVersionFromLabel(labelVersion string) (*version.CephVersion, error)
- func GenerateMinimalCephConfInitContainer(username, keyringPath string, containerImage string, ...) v1.Container
- func GetCephVersionLabel(cephVersion version.CephVersion) string
- func PodLabels(appName, namespace, daemonType, daemonID string) map[string]string
- func PodVolumes(dataPaths *config.DataPathMap, dataDirHostPath string, confGeneratedInPod bool) []v1.Volume
- func RookVolumeMounts(dataPaths *config.DataPathMap, confGeneratedInPod bool) []v1.VolumeMount
- func StoredLogAndCrashVolume(hostLogDir, hostCrashDir string) []v1.Volume
- func StoredLogAndCrashVolumeMount(varLogCephDir, varLibCephCrashDir string) []v1.VolumeMount
- func ValidateCephVersionsBetweenLocalAndExternalClusters(context *clusterd.Context, namespace string, localVersion cephver.CephVersion) (cephver.CephVersion, error)
Constants ¶
const ( // CephVersionLabelKey is the key used for reporting the Ceph version which Rook has detected is // configured for the labeled resource. CephVersionLabelKey = "ceph-version" )
const ( // ConfigInitContainerName is the name which is given to the config initialization container // in all Ceph pods. ConfigInitContainerName = "config-init" )
Variables ¶
This section is empty.
Functions ¶
func AddCephVersionLabelToDaemonSet ¶
func AddCephVersionLabelToDaemonSet(cephVersion version.CephVersion, d *apps.DaemonSet)
AddCephVersionLabelToDaemonSet adds a label reporting the Ceph version which Rook has detected is running in the DaemonSet's pods.
func AddCephVersionLabelToDeployment ¶
func AddCephVersionLabelToDeployment(cephVersion version.CephVersion, d *apps.Deployment)
AddCephVersionLabelToDeployment adds a label reporting the Ceph version which Rook has detected is running in the Deployment's pods.
func AddCephVersionLabelToJob ¶
func AddCephVersionLabelToJob(cephVersion version.CephVersion, j *batch.Job)
AddCephVersionLabelToJob adds a label reporting the Ceph version which Rook has detected is running in the Job's pods.
func AddCephVersionLabelToObjectMeta ¶
func AddCephVersionLabelToObjectMeta(cephVersion version.CephVersion, meta *metav1.ObjectMeta)
func AddVolumeMountSubPath ¶
AddVolumeMountSubPath updates each init and regular container of the podspec such that each volume mount attached to a container is mounted under a subpath in the source volume. This is important because some daemons may not start if the volume mount directory is non-empty. When the volume is the root of an ext4 file system, one may find a "lost+found" directory.
func AdminFlags ¶
func AdminFlags(cluster *cephconfig.ClusterInfo) []string
AdminFlags returns the command line flags used for Ceph commands requiring admin authentication.
func AppLabels ¶
AppLabels returns labels common for all Rook-Ceph applications which may be useful for admins. App name is the name of the application: e.g., 'rook-ceph-mon', 'rook-ceph-mgr', etc.
func CephVolumeMounts ¶
func CephVolumeMounts(dataPaths *config.DataPathMap, confGeneratedInPod bool) []v1.VolumeMount
CephVolumeMounts returns the common list of Kubernetes volume mounts for Ceph containers. This function is only used for OSDs.
func CheckPodMemory ¶
func CheckPodMemory(resources v1.ResourceRequirements, cephPodMinimumMemory uint64) error
CheckPodMemory verify pod's memory limit is valid
func ChownCephDataDirsInitContainer ¶
func ChownCephDataDirsInitContainer( dpm config.DataPathMap, containerImage string, volumeMounts []v1.VolumeMount, resources v1.ResourceRequirements, securityContext *v1.SecurityContext, ) v1.Container
ChownCephDataDirsInitContainer returns an init container which `chown`s the given data directories as the `ceph:ceph` user in the container. It also `chown`s the Ceph log dir in the container automatically. Doing a chown in a post start lifecycle hook does not reliably complete before the OSD process starts, which can cause the pod to fail without the lifecycle hook's chown command completing. It can take an arbitrarily long time for a pod restart to successfully chown the directory. This is a race condition for all daemons; therefore, do this in an init container. See more discussion here: https://github.com/rook/rook/pull/3594#discussion_r312279176
func ContainerEnvVarReference ¶
ContainerEnvVarReference returns a reference to a Kubernetes container env var of the given name which can be used in command or argument fields.
func DaemonEnvVars ¶
DaemonEnvVars returns the container environment variables used by all Ceph daemons.
func DaemonFlags ¶
func DaemonFlags(cluster *cephconfig.ClusterInfo, daemonID string) []string
DaemonFlags returns the command line flags used by all Ceph daemons.
func DaemonVolumeMounts ¶
func DaemonVolumeMounts(dataPaths *config.DataPathMap, keyringResourceName string) []v1.VolumeMount
DaemonVolumeMounts returns volume mounts which correspond to the DaemonVolumes. These volume mounts are shared by most all Ceph daemon containers, both init and standard. If keyring resource name is empty, there will be no keyring mounted in the container.
func DaemonVolumes ¶
func DaemonVolumes(dataPaths *config.DataPathMap, keyringResourceName string) []v1.Volume
DaemonVolumes returns the pod volumes used by all Ceph daemons. If keyring resource name is empty, there will be no keyring volume created from a secret.
func DaemonVolumesBase ¶
func DaemonVolumesBase(dataPaths *config.DataPathMap, keyringResourceName string) []v1.Volume
DaemonVolumesBase returns the common / static set of volumes.
func DaemonVolumesContainsPVC ¶
DaemonVolumesContainsPVC returns true if a volume exists with a volume source configured with a persistent volume claim.
func DaemonVolumesDataHostPath ¶
func DaemonVolumesDataHostPath(dataPaths *config.DataPathMap) []v1.Volume
DaemonVolumesDataHostPath returns HostPath volume source for daemon container data.
func DaemonVolumesDataPVC ¶
DaemonVolumesDataPVC returns a PVC volume source for daemon container data.
func ExtractCephVersionFromLabel ¶
func ExtractCephVersionFromLabel(labelVersion string) (*version.CephVersion, error)
ExtractCephVersionFromLabel returns a CephVersion struct deserialized from a provided version label.
func GenerateMinimalCephConfInitContainer ¶
func GenerateMinimalCephConfInitContainer( username, keyringPath string, containerImage string, volumeMounts []v1.VolumeMount, resources v1.ResourceRequirements, securityContext *v1.SecurityContext, ) v1.Container
GenerateMinimalCephConfInitContainer returns an init container that will generate the most basic Ceph config for connecting non-Ceph daemons to a Ceph cluster (e.g., nfs-ganesha). Effectively what this means is that it generates '/etc/ceph/ceph.conf' with 'mon_host' populated and a keyring path associated with the user given. 'mon_host' is determined by the 'ROOK_CEPH_MON_HOST' env var present in other Ceph daemon pods, and the keyring is expected to be mounted into the container with a Kubernetes pod volume+mount.
func GetCephVersionLabel ¶
func GetCephVersionLabel(cephVersion version.CephVersion) string
GetCephVersionLabel returns a formatted serialization of a provided CephVersion for use in resource labels.
func PodLabels ¶
PodLabels returns pod labels common to all Rook-Ceph pods which may be useful for admins. App name is the name of the application: e.g., 'rook-ceph-mon', 'rook-ceph-mgr', etc. Daemon type is the Ceph daemon type: "mon", "mgr", "osd", "mds", "rgw" Daemon ID is the ID portion of the Ceph daemon name: "a" for "mon.a"; "c" for "mds.c"
func PodVolumes ¶
func PodVolumes(dataPaths *config.DataPathMap, dataDirHostPath string, confGeneratedInPod bool) []v1.Volume
PodVolumes fills in the volumes parameter with the common list of Kubernetes volumes for use in Ceph pods. This function is only used for OSDs.
func RookVolumeMounts ¶
func RookVolumeMounts(dataPaths *config.DataPathMap, confGeneratedInPod bool) []v1.VolumeMount
RookVolumeMounts returns the common list of Kubernetes volume mounts for Rook containers. This function is only used by OSDs.
func StoredLogAndCrashVolume ¶
StoredLogAndCrashVolume returns a pod volume sourced from the stored log and crashes files.
func StoredLogAndCrashVolumeMount ¶
func StoredLogAndCrashVolumeMount(varLogCephDir, varLibCephCrashDir string) []v1.VolumeMount
StoredLogAndCrashVolumeMount returns a pod volume sourced from the stored log and crashes files.
func ValidateCephVersionsBetweenLocalAndExternalClusters ¶
func ValidateCephVersionsBetweenLocalAndExternalClusters(context *clusterd.Context, namespace string, localVersion cephver.CephVersion) (cephver.CephVersion, error)
ValidateCephVersionsBetweenLocalAndExternalClusters makes sure an external cluster can be connected by checking the external ceph versions available and comparing it with the local image provided
Types ¶
This section is empty.