-
Notifications
You must be signed in to change notification settings - Fork 64
/
rollout_qualifier.go
55 lines (43 loc) · 1.66 KB
/
rollout_qualifier.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2024, Unikraft GmbH and The KraftKit Authors.
// Licensed under the BSD-3-Clause License (the "License").
// You may not use this file except in compliance with the License.
package create
import "fmt"
// RolloutQualifier is the detection mechanism used to determine whether the
// specific instance should be affected by the rollout strategy.
type RolloutQualifier string
const (
// The 'image' qualifier is used to capture instances which have the same
// image (ignoring digest).
RolloutQualifierImageName = RolloutQualifier("image")
// The 'name' qualifier is used to capture instances which have the same name.
RolloutQualifierInstanceName = RolloutQualifier("name")
// The 'all' qualifier matches all instances in the service group.
RolloutQualifierAll = RolloutQualifier("all")
// The 'none' qualifier prevents matching any instances in the service group.
RolloutQualifierNone = RolloutQualifier("none")
)
var _ fmt.Stringer = (*RolloutQualifier)(nil)
// String implements fmt.Stringer
func (strategy RolloutQualifier) String() string {
return string(strategy)
}
// RolloutQualifiers returns the list of possible rollout qualifier.
func RolloutQualifiers() []RolloutQualifier {
return []RolloutQualifier{
RolloutQualifierImageName,
RolloutQualifierInstanceName,
RolloutQualifierAll,
RolloutQualifierNone,
}
}
// RolloutQualifierNames returns the string representation of all possible
// rollout qualifiers.
func RolloutQualifierNames() []string {
qualifiers := []string{}
for _, strategy := range RolloutQualifiers() {
qualifiers = append(qualifiers, strategy.String())
}
return qualifiers
}