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

fix: validate deviceClass name to be usable in storageClass #47

Merged
merged 1 commit into from
Dec 27, 2021
Merged

fix: validate deviceClass name to be usable in storageClass #47

merged 1 commit into from
Dec 27, 2021

Conversation

leelavg
Copy link
Contributor

@leelavg leelavg commented Dec 24, 2021

Fixes: #40

Signed-off-by: Leela Venkaiah G lgangava@redhat.com

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 24, 2021
// ref: https://github.com/kubernetes/apimachinery/blob/de7147/pkg/util/validation/validation.go#L209
// +kubebuilder:validation:MaxLength=245
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
Name string `json:"name,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should have a "." in the name. The first part - "^a-z0-9?" - is sufficient.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should follow this pattern:
const dns1123LabelFmt string = "a-z0-9?"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack, I'll drop the subdomain format.

Fixes: #40

Signed-off-by: Leela Venkaiah G <lgangava@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 27, 2021
Copy link
Contributor

@nbalacha nbalacha left a comment

Choose a reason for hiding this comment

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

From man lvm: The valid characters for VG and LV names are: a-z A-Z 0-9 + _ . -
However, the operator will restrict the name to characters such that it can be used to generate valid kubernetes resource names

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 27, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jmolmo, leelavg, nbalacha

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 27, 2021
@nbalacha nbalacha merged commit 5680a87 into openshift:main Dec 27, 2021
@leelavg leelavg deleted the sc-name branch December 29, 2021 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deviceClass to storage class mapping
3 participants