Skip to content
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: limit storageClassDeviceSets to 63 chars #14134

Merged
merged 1 commit into from
May 3, 2024

Conversation

subhamkrai
Copy link
Contributor

there are some cases where storageClassDeviceSets length are more 63 chars and osd provisioned failed due to this. with error

 failed to run osd provisioning job for PVC "ocs-deviceset-*-local-volume-storageclass-0-data-*": Job.batch "rook-ceph-osd-prepare-*" is invalid: [spec.template.spec.volumes[10].name: Invalid value: "ocs-deviceset-*-local-volume-storageclass-0-data-*": must be no more than 63 characters, spec.template.spec.containers[0].volumeMounts[9].name: Not found: "ocs-deviceset-*-local-volume-storageclass-0-data-*",

Using x-validator to limit the maxLength to 63 chars.

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Reviewed the developer guide on Submitting a Pull Request
  • Pending release notes updated with breaking and/or notable changes for the next minor release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

@subhamkrai
Copy link
Contributor Author

testing result

ka cluster-on-pvc.yaml 
The CephCluster "rook-ceph" is invalid: 
* spec.storage.storageClassDeviceSets[0].name: Too long: may not be longer than 63
* <nil>: Invalid value: "null": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation

@subhamkrai subhamkrai requested a review from travisn April 29, 2024 09:02
@@ -2937,6 +2937,7 @@ type PriorityClassNamesSpec map[KeyType]string
// +nullable
type StorageClassDeviceSet struct {
// Name is a unique identifier for the set
// +kubebuilder:validation:MaxLength=63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 63 the length that actually causes the issue? Or is it actually shorter because the name of the device set is concatenated with something else to create the resource name?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that true it adds the *-local-volume-storageclass-0-data-* which should have a check on total length too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That quite a lot of characters added. Are the asterisks also added? I'm a bit confused. I don't think asterisks are allowed characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually asterisks are placeholder here for the real names

return fmt.Sprintf("%s-%s-%d", deviceSetName, cleanName, setIndex)
pvcID := fmt.Sprintf("%s-%s-%d", deviceSetName, cleanName, setIndex)
if len(pvcID) > 62 {
return "", fmt.Errorf("length of generate pvc should be less the 63 as the 'volumeMount[*].Name' has limit of 63 char. Current length' %d", len(pvcID))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this message so it is clear what they need to change?

Suggested change
return "", fmt.Errorf("length of generate pvc should be less the 63 as the 'volumeMount[*].Name' has limit of 63 char. Current length' %d", len(pvcID))
return "", fmt.Errorf("the OSD PVC name requested is %q (length %d) is too long and must be less than 63 characters, shorten either the storageClassDeviceSet name or the storage class name", pvcID, len(pvcID))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

there are some cases where storageClassDeviceSets length
are more 63 chars and osd provisioned failed due to this.
with error
```
 failed to run osd provisioning job for PVC "ocs-deviceset-*-local-volume-storageclass-0-data-*": Job.batch "rook-ceph-osd-prepare-*" is invalid: [spec.template.spec.volumes[10].name: Invalid value: "ocs-deviceset-*-local-volume-storageclass-0-data-*": must be no more than 63 characters, spec.template.spec.containers[0].volumeMounts[9].name: Not found: "ocs-deviceset-*-local-volume-storageclass-0-data-*",
```

Using x-validator to limit the maxLength to the deviceClassSet.Name to
40 chars and adding code check that overall pvc name should be less than
63 chars.

Signed-off-by: subhamkrai <[email protected]>
@travisn travisn merged commit 3364bd6 into rook:master May 3, 2024
53 checks passed
travisn added a commit that referenced this pull request May 3, 2024
osd: limit storageClassDeviceSets to 63 chars (backport #14134)
@anthonyeleven
Copy link
Contributor

Is a "deviceset" a Rook-internal thing?

@subhamkrai
Copy link
Contributor Author

Is a "deviceset" a Rook-internal thing?

@anthonyeleven yess

@travisn
Copy link
Member

travisn commented May 6, 2024

@anthonyeleven For an example of the storageClassDeviceSets, see the PVC-based clusters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants