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

PWX-32580: Do not create pre-flight storage node objects for nodes wh… #1222

Merged
merged 7 commits into from
Aug 26, 2023
14 changes: 9 additions & 5 deletions pkg/controller/storagecluster/storagecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"github.com/libopenstorage/operator/pkg/preflight"
"github.com/libopenstorage/operator/pkg/util"
"github.com/libopenstorage/operator/pkg/util/k8s"
coreops "github.com/portworx/sched-ops/k8s/core"
)

const (
Expand Down Expand Up @@ -447,11 +446,16 @@
if err == nil {
// Create StorageNodes to return pre-flight checks used by c.Driver.Validate().
for _, node := range k8sNodeList.Items {
if !coreops.Instance().IsNodeMaster(node) {
logrus.Infof("Create pre-flight storage node entry for node: %s", node.Name)
c.createStorageNode(toUpdate, node.Name)
shouldRun, _, err := c.nodeShouldRunStoragePod(&node, toUpdate)
if err == nil {
if shouldRun {
logrus.Infof("Create pre-flight storage node entry for node: %s", node.Name)
c.createStorageNode(toUpdate, node.Name)
} else {
logrus.Infof("Skipping pre-flight storage node entry for node: %s", node.Name)

Check warning on line 455 in pkg/controller/storagecluster/storagecluster.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/storagecluster/storagecluster.go#L449-L455

Added lines #L449 - L455 were not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add UTs to cover the diff here.

}
} else {
logrus.Infof("Skipping pre-flight storage node entry for master node: %s", node.Name)
logrus.Infof("Skipping pre-flight storage node entry for %s node. Error: %v", node.Name, err)

Check warning on line 458 in pkg/controller/storagecluster/storagecluster.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/storagecluster/storagecluster.go#L458

Added line #L458 was not covered by tests
}
}
} else {
Expand Down
Loading