getActiveNodes returns all nodes that are currently not in status [swarm.NodeStateDown]. TODO(thaJeztah): this should really be a filter on [apiClient.NodeList] instead of being filtered on the client side.
(ctx context.Context, apiClient client.NodeAPIClient)
| 217 | // |
| 218 | // TODO(thaJeztah): this should really be a filter on [apiClient.NodeList] instead of being filtered on the client side. |
| 219 | func getActiveNodes(ctx context.Context, apiClient client.NodeAPIClient) (map[string]struct{}, error) { |
| 220 | res, err := apiClient.NodeList(ctx, client.NodeListOptions{}) |
| 221 | if err != nil { |
| 222 | return nil, err |
| 223 | } |
| 224 | |
| 225 | activeNodes := make(map[string]struct{}) |
| 226 | for _, n := range res.Items { |
| 227 | if n.Status.State != swarm.NodeStateDown { |
| 228 | activeNodes[n.ID] = struct{}{} |
| 229 | } |
| 230 | } |
| 231 | return activeNodes, nil |
| 232 | } |
| 233 | |
| 234 | func initializeUpdater(service swarm.Service, progressOut progress.Output) (progressUpdater, error) { |
| 235 | if service.Spec.Mode.Replicated != nil && service.Spec.Mode.Replicated.Replicas != nil { |
no test coverage detected
searching dependent graphs…