-
Notifications
You must be signed in to change notification settings - Fork 40
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: mark the topolvm storageclass as default #210
Conversation
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.
nit
controllers/topolvm_storageclass.go
Outdated
sc := []*storagev1.StorageClass{} | ||
allowVolumeExpansion := true | ||
volumeBindingMode := storagev1.VolumeBindingWaitForFirstConsumer | ||
// defaultStorageClass := false |
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.
// defaultStorageClass := false | |
// defaultStorageClass := false |
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.
Removed.
controllers/topolvm_storageclass.go
Outdated
r.Log.Error(err, "failed to list storage classes. Not setting any storageclass as the default") | ||
} else { | ||
if len(scList.Items) == 0 { | ||
//defaultStorageClass = true |
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.
//defaultStorageClass = true | |
// defaultStorageClass = true |
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.
Removed.
controllers/topolvm_storageclass.go
Outdated
//defaultStorageClass = true | ||
} else { | ||
for _, sc := range scList.Items { | ||
v := sc.Annotations["storageclass.kubernetes.io/is-default-class"] |
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.
could move storageclass.kubernetes.io/is-default-class
out as a variable as its used in more than one place.
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.
controllers/topolvm_storageclass.go
Outdated
|
||
// Mark the first lvmo storage class default if no other storageclasses exist on the cluster | ||
scList := &storagev1.StorageClassList{} | ||
err := r.Client.List(context.TODO(), scList) |
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.
err := r.Client.List(context.TODO(), scList) | |
err := r.Client.List(ctx, scList) |
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.
Making lvmo storage class as default seems like an important detail that user should know about. Are there plans to update the docs to reflect this? |
scList := &storagev1.StorageClassList{} | ||
err := r.Client.List(context.TODO(), scList) | ||
|
||
if err != nil { |
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.
This if else
block can be removed and only for
loop can be used.
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.
updated to set a new var in the if block.
controllers/topolvm_storageclass.go
Outdated
@@ -106,6 +129,11 @@ func getTopolvmStorageClasses(lvmCluster *lvmv1alpha1.LVMCluster) []*storagev1.S | |||
"csi.storage.k8s.io/fstype": TopolvmFilesystemType, | |||
}, | |||
} | |||
// reconcile will pick up any existing LVMO storage classes as well | |||
if defaultStorageClassName == "" || defaultStorageClassName == storageClass.Name { |
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.
won't defaultStorageClassName == ""
condition be enough even if the reconciler picks up existing lvmo storage classes ?
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.
This is to handle a scenario where multiple VGs may be supported.
controllers/topolvm_storageclass.go
Outdated
if len(scList.Items) != 0 { | ||
for _, sc := range scList.Items { |
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 len(scList.Items) != 0 { | |
for _, sc := range scList.Items { | |
for _, sc := range scList.Items { |
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.
for _, deviceClass := range lvmCluster.Spec.Storage.DeviceClasses { | ||
scName := "odf-lvm-" + deviceClass.Name |
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.
Should we define a new variable called scPrefix := "odf-lvm-"
and use it everywhere in place of this string?
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.
That would need to be done in a separate PR.
This commit marks the topolvm storageClass as default if there are no other storageClasses that are present or is no other class is marked default. Signed-off-by: N Balachandran <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nbalacha, sp98 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cherry-pick release-4.11 |
@nbalacha: new pull request created: #214 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Operations require a default storage class to function properly, since we are installing those, we can also mark them default: - Set HPP storage class as default - LVM Operator takes care of creating and setting its storage class to default: openshift/lvm-operator#210 So no action required. Signed-off-by: Alex Kalenyuk <[email protected]>
Operations require a default storage class to function properly, since we are installing those, we can also mark them default: - Set HPP storage class as default - LVM Operator takes care of creating and setting its storage class to default: openshift/lvm-operator#210 So no action required. Signed-off-by: Alex Kalenyuk <[email protected]> Signed-off-by: Alex Kalenyuk <[email protected]>
Operations require a default storage class to function properly, since we are installing those, we can also mark them default: - Set HPP storage class as default - LVM Operator takes care of creating and setting its storage class to default: openshift/lvm-operator#210 So no action required. Signed-off-by: Alex Kalenyuk <[email protected]> Signed-off-by: Alex Kalenyuk <[email protected]>
This commit marks the topolvm storageClass as the default
if there are no other storageClasses that are present or
is no other class is marked default.
Signed-off-by: N Balachandran [email protected]