()
| 61 | } |
| 62 | |
| 63 | func (e *Helper) GetWorkerNodes() (nodes []corev1.Node, err error) { |
| 64 | var ( |
| 65 | nodeList = &corev1.NodeList{} |
| 66 | // runtimeLabel indicates the specific runtime pod is on the node |
| 67 | // e.g. fluid.io/s-alluxio-default-hbase=true |
| 68 | runtimeLabelKey = e.runtimeInfo.GetRuntimeLabelName() |
| 69 | ) |
| 70 | |
| 71 | labelNames := []string{runtimeLabelKey} |
| 72 | e.log.Info("check node labels", "labelNames", labelNames) |
| 73 | runtimeLabelSelector, err := labels.Parse(fmt.Sprintf("%s=true", runtimeLabelKey)) |
| 74 | if err != nil { |
| 75 | return |
| 76 | } |
| 77 | |
| 78 | err = e.client.List(context.TODO(), nodeList, &client.ListOptions{ |
| 79 | LabelSelector: runtimeLabelSelector, |
| 80 | }) |
| 81 | if err != nil { |
| 82 | return nodes, err |
| 83 | } |
| 84 | |
| 85 | nodes = nodeList.Items |
| 86 | if len(nodes) == 0 { |
| 87 | e.log.Info("No node with runtime label is found") |
| 88 | return |
| 89 | } else { |
| 90 | e.log.Info("Find the runtime label for nodes", "len", len(nodes)) |
| 91 | } |
| 92 | |
| 93 | return |
| 94 | } |
| 95 | |
| 96 | // GetIpAddressesOfWorker gets Ipaddresses from the Worker Node |
| 97 | func (e *Helper) GetIpAddressesOfWorker() (ipAddresses []string, err error) { |
no test coverage detected