GetFuseNodes gets the node of fuses
()
| 127 | |
| 128 | // GetFuseNodes gets the node of fuses |
| 129 | func (e *Helper) GetFuseNodes() (nodes []corev1.Node, err error) { |
| 130 | var ( |
| 131 | nodeList = &corev1.NodeList{} |
| 132 | fuseLabelKey = utils.GetFuseLabelName(e.runtimeInfo.GetNamespace(), e.runtimeInfo.GetName(), e.runtimeInfo.GetOwnerDatasetUID()) |
| 133 | ) |
| 134 | |
| 135 | labelNames := []string{fuseLabelKey} |
| 136 | e.log.V(1).Info("check node labels", "labelNames", labelNames) |
| 137 | fuseLabelSelector, err := labels.Parse(fmt.Sprintf("%s=true", fuseLabelKey)) |
| 138 | if err != nil { |
| 139 | return |
| 140 | } |
| 141 | |
| 142 | err = e.client.List(context.TODO(), nodeList, &client.ListOptions{ |
| 143 | LabelSelector: fuseLabelSelector, |
| 144 | }) |
| 145 | if err != nil { |
| 146 | return nodes, err |
| 147 | } |
| 148 | |
| 149 | nodes = nodeList.Items |
| 150 | if len(nodes) == 0 { |
| 151 | e.log.Info("No node with fuse label is found") |
| 152 | return |
| 153 | } else { |
| 154 | e.log.Info("Find the fuse label for nodes", "len", len(nodes)) |
| 155 | } |
| 156 | |
| 157 | return |
| 158 | } |
| 159 | |
| 160 | // GetIpAddressesOfFuse gets Ipaddresses from the Fuse Node |
| 161 | func (e *Helper) GetIpAddressesOfFuse() (ipAddresses []string, err error) { |
no test coverage detected