ceph: query the latest list of nodes for osd orchestration

The list of nodes to be queried for configuring OSDs
should include all of the K8s nodes before the placement
or other filters are applied. The operator was sometimes
missing configuring OSDs on nodes if the discover pod
hadn't finished running on a node. Now the osd prepare
job will be triggered on a node even if the discover pod
hasn't yet run there.

Signed-off-by: travisn <tnielsen@redhat.com>
This commit is contained in:
travisn committed 2019-04-30 17:07:12 -06:00
1 parent a9388ff101
commit 77c7eb52f9
1 file changed
+3 -17
+3 -17
View File
@@ -19,7 +19,6 @@ package osd
import (
"fmt"
"os"
"strconv"
"strings"
@@ -31,7 +30,6 @@ import (
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
osdconfig "github.com/rook/rook/pkg/operator/ceph/cluster/osd/config"
opspec "github.com/rook/rook/pkg/operator/ceph/spec"
"github.com/rook/rook/pkg/operator/discover"
"github.com/rook/rook/pkg/operator/k8sutil"
"github.com/rook/rook/pkg/util/display"
apps "k8s.io/api/apps/v1"
@@ -143,26 +141,14 @@ func (c *Cluster) Start() error {
}
if c.DesiredStorage.UseAllNodes {
// resolve all storage nodes
c.DesiredStorage.Nodes = nil
rookSystemNS := os.Getenv(k8sutil.PodNamespaceEnvVar)
allNodeDevices, err := discover.ListDevices(c.context, rookSystemNS, "" /* all nodes */)
if err != nil {
logger.Warningf("failed to get storage nodes from namespace %s: %v", rookSystemNS, err)
return err
}
// Get the list of all nodes in the cluster. The placement settings will be applied below.
hostnameMap, err := k8sutil.GetNodeHostNames(c.context.Clientset)
if err != nil {
logger.Warningf("failed to get node hostnames: %v", err)
return err
}
for nodeName := range allNodeDevices {
hostname, ok := hostnameMap[nodeName]
if !ok || nodeName == "" {
// fall back to the node name if no hostname is set
logger.Warningf("failed to get hostname for node %s. %+v", nodeName, err)
hostname = nodeName
}
c.DesiredStorage.Nodes = nil
for _, hostname := range hostnameMap {
storageNode := rookalpha.Node{
Name: hostname,
}