Added portable and failure-domain label to the OSD deployment
Signed-off-by: rohan47 <rohgupta@redhat.com>
This commit is contained in:
1 parent
b3f58863e9
commit
7307575637
4 files changed
+22
-11
No files matched your search
@@ -137,6 +137,7 @@ type StorageClassDeviceSet struct {
|
||||
Placement Placement `json:"placement,omitempty"` // Placement constraints for the devices
|
||||
Config map[string]string `json:"config,omitempty"` // Provider-specific device configuration
|
||||
VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"` // List of PVC templates for the underlying storage devices
|
||||
Portable bool `json:"portable,omitempty"` // OSD portablity across the hosts
|
||||
}
|
||||
|
||||
type VolumeSource struct {
|
||||
@@ -145,4 +146,5 @@ type VolumeSource struct {
|
||||
Resources v1.ResourceRequirements `json:"resources,omitempty"`
|
||||
Placement Placement `json:"placement,omitempty"`
|
||||
Config map[string]string `json:"config,omitempty"`
|
||||
Portable bool `json:"portable,omitempty"` // OSD portablity across the hosts
|
||||
}
|
||||
@@ -49,6 +49,7 @@ func (c *Cluster) prepareStorageClassDeviceSets(config *provisionConfig) []rooka
|
||||
ClaimName: pvc.GetName(),
|
||||
ReadOnly: false,
|
||||
},
|
||||
Portable: storageClassDeviceSet.Portable,
|
||||
})
|
||||
logger.Infof("successfully provisioned osd for storageClassDeviceSet %s of set %v", storageClassDeviceSet.Name, i)
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ const (
|
||||
clusterAvailableSpaceReserve = 0.05
|
||||
serviceAccountName = "rook-ceph-osd"
|
||||
unknownID = -1
|
||||
portableKey = "portable"
|
||||
failureDomainKey = "failure-domain"
|
||||
cephOsdPodMinimumMemory uint64 = 4096 // minimum amount of memory in MB to run the pod
|
||||
)
|
||||
|
||||
@@ -143,6 +145,7 @@ type osdProperties struct {
|
||||
placement rookalpha.Placement
|
||||
metadataDevice string
|
||||
location string
|
||||
portable bool
|
||||
}
|
||||
|
||||
// Start the osd management
|
||||
@@ -233,6 +236,7 @@ func (c *Cluster) startProvisioningOverPVCs(config *provisionConfig) {
|
||||
pvc: volume.PersistentVolumeClaimSource,
|
||||
resources: volume.Resources,
|
||||
placement: volume.Placement,
|
||||
portable: volume.Portable,
|
||||
}
|
||||
|
||||
// update the orchestration status of this pvc to the starting state
|
||||
@@ -719,6 +723,7 @@ func (c *Cluster) getOSDPropsForPVC(pvcName string) (osdProperties, error) {
|
||||
pvc: volumeSource.PersistentVolumeClaimSource,
|
||||
resources: volumeSource.Resources,
|
||||
placement: volumeSource.Placement,
|
||||
portable: volumeSource.Portable,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ func (c *Cluster) makeDeployment(osdProps osdProperties, osd OSDInfo) (*apps.Dep
|
||||
volumeMounts := opspec.CephVolumeMounts()
|
||||
configVolumeMounts := opspec.RookVolumeMounts()
|
||||
volumes := opspec.PodVolumes(c.dataDirHostPath, c.Namespace)
|
||||
failureDomainValue := osdProps.crushHostname
|
||||
|
||||
var dataDir string
|
||||
if osd.IsDirectory {
|
||||
@@ -286,11 +287,7 @@ func (c *Cluster) makeDeployment(osdProps osdProperties, osd OSDInfo) (*apps.Dep
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf(osdAppNameFmt, osd.ID),
|
||||
Namespace: c.Namespace,
|
||||
Labels: map[string]string{
|
||||
k8sutil.AppAttr: appName,
|
||||
k8sutil.ClusterAttr: c.Namespace,
|
||||
osdLabelKey: fmt.Sprintf("%d", osd.ID),
|
||||
},
|
||||
Labels: c.getOSDLabels(osd.ID, failureDomainValue, osdProps.portable),
|
||||
},
|
||||
Spec: apps.DeploymentSpec{
|
||||
Selector: &metav1.LabelSelector{
|
||||
@@ -305,12 +302,8 @@ func (c *Cluster) makeDeployment(osdProps osdProperties, osd OSDInfo) (*apps.Dep
|
||||
},
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: appName,
|
||||
Labels: map[string]string{
|
||||
k8sutil.AppAttr: appName,
|
||||
k8sutil.ClusterAttr: c.Namespace,
|
||||
osdLabelKey: fmt.Sprintf("%d", osd.ID),
|
||||
},
|
||||
Name: appName,
|
||||
Labels: c.getOSDLabels(osd.ID, failureDomainValue, osdProps.portable),
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
RestartPolicy: v1.RestartPolicyAlways,
|
||||
@@ -758,3 +751,13 @@ func makeStorageClassDeviceSetPVCLabel(storageClassDeviceSetName, pvcStorageClas
|
||||
CephDeviceSetPVCIDLabelKey: pvcStorageClassDeviceSetPVCId,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Cluster) getOSDLabels(osdID int, failureDomainValue string, portable bool) map[string]string {
|
||||
return map[string]string{
|
||||
k8sutil.AppAttr: appName,
|
||||
k8sutil.ClusterAttr: c.Namespace,
|
||||
osdLabelKey: fmt.Sprintf("%d", osdID),
|
||||
failureDomainKey: failureDomainValue,
|
||||
portableKey: strconv.FormatBool(portable),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user