Merge pull request #6118 from travisn/osd-prepare-resources

ceph: Set the OSD prepare resources
This commit is contained in:
Sébastien Han authored and GitHub committed 2020-08-19 15:38:06 +02:00
commit d5b1e89ce2
3 files changed
+24 -5

No files matched your search

@@ -102,6 +102,7 @@ spec:
values:
- rook-ceph-osd-prepare
resources:
# These are the OSD daemon limits. For OSD prepare limits, see the separate section below for "prepareosd" resources
# limits:
# cpu: "500m"
# memory: "4Gi"
@@ -151,6 +152,14 @@ spec:
# - ReadWriteOnce
# Scheduler name for OSD pod placement
# schedulerName: osd-scheduler
resources:
# prepareosd:
# limits:
# cpu: "200m"
# memory: "200Mi"
# requests:
# cpu: "200m"
# memory: "200Mi"
disruptionManagement:
managePodBudgets: false
osdMaintenanceTimeout: 30
+2 -5
View File
@@ -263,18 +263,15 @@ func (c *Cluster) startProvisioningOverPVCs(config *provisionConfig) {
logger.Debugf("osdProps are %+v", osdProps)
// If the deviceSet template has "encrypted" but the Ceph version is not compatible
if osdProps.encrypted {
// If the deviceSet template has "encrypted" but the Ceph version is not compatible
if !c.isCephVolumeRawModeSupported() {
errMsg := fmt.Sprintf("failed to validate storageClassDeviceSet %q. min required ceph version to support encryption is %q or %q", volume.Name, cephVolumeRawEncryptionModeMinNautilusCephVersion.String(), cephVolumeRawEncryptionModeMinOctopusCephVersion.String())
config.addError(errMsg)
continue
}
}
// create encryption Kubernetes Secret if the PVC is encrypted
if osdProps.encrypted {
// Generate dmcrypt key
// create encryption Kubernetes Secret if the PVC is encrypted
key, err := generateDmCryptKey()
if err != nil {
errMsg := fmt.Sprintf("failed to generate dmcrypt key for osd claim %q. %v", osdProps.pvc.ClaimName, err)
@@ -72,9 +72,22 @@ func (c *Cluster) makeJob(osdProps osdProperties, provisionConfig *provisionConf
k8sutil.AddRookVersionLabelToJob(job)
controller.AddCephVersionLabelToJob(c.clusterInfo.CephVersion, job)
k8sutil.SetOwnerRef(&job.ObjectMeta, &c.clusterInfo.OwnerRef)
// override the resources of all the init containers and main container with the expected osd prepare resources
c.applyResourcesToAllContainers(&podSpec.Spec, cephv1.GetPrepareOSDResources(c.spec.Resources))
return job, nil
}
// applyResourcesToAllContainers applies consistent resource requests for all containers and all init containers in the pod
func (c *Cluster) applyResourcesToAllContainers(spec *v1.PodSpec, resources v1.ResourceRequirements) {
for i := range spec.InitContainers {
spec.InitContainers[i].Resources = resources
}
for i := range spec.Containers {
spec.Containers[i].Resources = resources
}
}
func (c *Cluster) provisionPodTemplateSpec(osdProps osdProperties, restart v1.RestartPolicy, provisionConfig *provisionConfig) (*v1.PodTemplateSpec, error) {
copyBinariesVolume, copyBinariesContainer := c.getCopyBinariesContainer()