Files
my-rook-config/pkg/operator/ceph/cluster/mon/node.go
T
Travis Nielsen 6a00b4d296 ceph: remove obsolete NodeUsage type
The node usage was used for the obsolete mon selection algorithm, which
was replaced long ago with placement via canary pods.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-12-04 16:02:25 -07:00

42 lines
1.1 KiB
Go

/*
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package mon
import (
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
)
func getNodeInfoFromNode(n v1.Node) (*MonScheduleInfo, error) {
nr := &MonScheduleInfo{
Name: n.Name,
Hostname: n.Labels[v1.LabelHostname],
}
for _, ip := range n.Status.Addresses {
if ip.Type == v1.NodeInternalIP {
logger.Debugf("using internal IP %s for node %s", ip.Address, n.Name)
nr.Address = ip.Address
break
}
}
if nr.Address == "" {
return nil, errors.Errorf("failed to find any internal IP on node %s", nr.Name)
}
return nr, nil
}