-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
osd: add deviceType label to an OSD #11159
Conversation
64d1094
to
919423c
Compare
919423c
to
c862dc4
Compare
03356cd
to
edc0b5c
Compare
Testing results:
|
@@ -52,6 +52,7 @@ func (c *Cluster) getOSDLabels(osd OSDInfo, failureDomainValue string, portable | |||
labels[OsdIdLabelKey] = stringID | |||
labels[FailureDomainKey] = failureDomainValue | |||
labels[portableKey] = strconv.FormatBool(portable) | |||
labels["device-type"] = osd.DeviceType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labels["device-type"] = osd.DeviceType | |
labels["device-type"] = osd.DeviceType |
can we not use hard-coded and declare this somewhere similar to other labels above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
@@ -67,6 +67,10 @@ jobs: | |||
# print existing client auth | |||
kubectl -n rook-ceph exec $toolbox -- ceph auth ls | |||
|
|||
- name: test OSD label | |||
run: | | |||
kubectl get pod -l ceph-osd-id=0 -nrook-ceph -o yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we should either remove this, or add a check for the label. I think unit tests will be sufficient though, not sure we need the CI test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for testing is the OSD has the label or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you'll revert this before merging?
pkg/daemon/ceph/osd/daemon.go
Outdated
@@ -229,6 +229,14 @@ func Provision(context *clusterd.Context, agent *OsdAgent, crushLocation, topolo | |||
return errors.Wrap(err, "failed to configure devices") | |||
} | |||
|
|||
for i := range deviceOSDs { | |||
if deviceOSDs[i].DeviceClass == "hdd" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few thoughts/questions about the device class:
- Is this
DeviceClass
always set for an OSD? I assume it's returned by ceph-volume and it would be set. - The user can override the device class with a setting in the cluster CR, so it might still be rotational even though the device class is not hdd
- If we're using the device class property, we should just name the OSD property as
deviceClass
instead of calling it rotational, since we don't really know if it's rotational.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umangachapagain Would the device class property be sufficient for your scenario? As long as the user doesn't override the device class and it's a rotational device, we would expect it to be set to hdd. And if that is sufficient, we already have an env var for ROOK_OSD_DEVICE_CLASS
on the OSDs. Perhaps that would already work for your scenario? If not, we could add this same device class as a label. Or if the device class is not sufficient, we need to detect the rotational property differently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If users can override it, I'd want to avoid using it. How common is it for users to override it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It totally depends on the user, if they want to override it or not, so defer from user to user on the basis of their env.
https://github.com/rook/rook/blame/master/Documentation/CRDs/Cluster/ceph-cluster-crd.md#L391
Here is the place in the Cluster CR where user can specify deviceClass
rook/deploy/examples/cluster.yaml
Line 236 in 57d6020
# Individual nodes and their config can be specified as well, but 'useAllNodes' above must be set to false. Then, only the named |
So we need a DeviceType label on the OSDs, which would be only set if the DeviceType is governed by the prepare jobs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the documentation
By default, if a device's class has not already been set, OSDs will automatically set a device's class to either `hdd`, `ssd`, or `nvme` based on the hardware properties exposed by the Linux kernel.
I think this info as label would be good enough even if device's class is already set by user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
pkg/operator/ceph/cluster/osd/osd.go
Outdated
@@ -96,6 +96,7 @@ type OSDInfo struct { | |||
UUID string `json:"uuid"` | |||
DevicePartUUID string `json:"device-part-uuid"` | |||
DeviceClass string `json:"device-class"` | |||
DeviceType string `json:"device-type"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to suggest to change this to DeviceClass, but I see that property already exists. So maybe we just need to add the label with that deviceClass property that already exists.
DeviceType string `json:"device-type"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, right but it should be device type
@@ -32,6 +32,7 @@ const ( | |||
osdWalSizeEnvVarName = "ROOK_OSD_WAL_SIZE" | |||
osdsPerDeviceEnvVarName = "ROOK_OSDS_PER_DEVICE" | |||
osdDeviceClassEnvVarName = "ROOK_OSD_DEVICE_CLASS" | |||
osdDeviceTypeEnvVarName = "ROOK_OSD_DEVICE_TYPE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of an env var, let's add a label. But I see that we already have an env var for the device class so I wonder if that will be sufficient and we don't need a separate label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess adding a label would be fine which directly says it's rotational or not fetched from the device class info,
@umangachapagain thoughts??
edc0b5c
to
35fc4bc
Compare
@@ -67,6 +67,10 @@ jobs: | |||
# print existing client auth | |||
kubectl -n rook-ceph exec $toolbox -- ceph auth ls | |||
|
|||
- name: test OSD label | |||
run: | | |||
kubectl get pod -l ceph-osd-id=0 -nrook-ceph -o yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you'll revert this before merging?
@@ -52,6 +52,11 @@ func (c *Cluster) getOSDLabels(osd OSDInfo, failureDomainValue string, portable | |||
labels[OsdIdLabelKey] = stringID | |||
labels[FailureDomainKey] = failureDomainValue | |||
labels[portableKey] = strconv.FormatBool(portable) | |||
if osd.DeviceClass == "hdd" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're basing this on the device class, I really think we should just directly add the device-class
label. Then whoever looks at the label can interpret it themselves as rotational or not.
if osd.DeviceClass == "hdd" { | |
labels["device-class"] = osd.DeviceClass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Closes: rook#11059 Signed-off-by: parth-gr <paarora@redhat.com>
35fc4bc
to
3bcc29e
Compare
@umangachapagain please review it once. |
is the result still valid? Looks like PR was updated to use deviceClass |
yaa these were the old testing result |
osd: add deviceType label to an OSD (backport #11159)
Closes:#11059
Signed-off-by: parth-gr paarora@redhat.com
Description of your changes:
Which issue is resolved by this Pull Request:
Resolves #
Checklist:
skip-ci
on the PR.