GetFencedInstances gets the set of fenced servers from the annotations
(annotations map[string]string)
| 50 | |
| 51 | // GetFencedInstances gets the set of fenced servers from the annotations |
| 52 | func GetFencedInstances(annotations map[string]string) (*stringset.Data, error) { |
| 53 | fencedInstances, ok := annotations[FencedInstanceAnnotation] |
| 54 | if !ok { |
| 55 | return stringset.New(), nil |
| 56 | } |
| 57 | |
| 58 | var fencedInstancesList []string |
| 59 | if err := json.Unmarshal([]byte(fencedInstances), &fencedInstancesList); err != nil { |
| 60 | return nil, ErrorFencedInstancesSyntax |
| 61 | } |
| 62 | |
| 63 | return stringset.From(fencedInstancesList), nil |
| 64 | } |
| 65 | |
| 66 | // setFencedInstances sets the list of fenced servers inside the annotations |
| 67 | func setFencedInstances(object metav1.Object, data *stringset.Data) error { |
no outgoing calls
no test coverage detected