-
Notifications
You must be signed in to change notification settings - Fork 756
Expand file tree
/
Copy pathfeatures.go
More file actions
90 lines (77 loc) · 2.85 KB
/
features.go
File metadata and controls
90 lines (77 loc) · 2.85 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package features
import (
"testing"
"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/util/runtime"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/component-base/featuregate"
featuregatetesting "k8s.io/component-base/featuregate/testing"
)
const (
// owner: @rueian @kevin85421 @andrewsykim
// rep: https://github.com/ray-project/enhancements/pull/54
// alpha: v1.2
// beta: v1.3
//
// Enables new conditions in RayCluster status
RayClusterStatusConditions featuregate.Feature = "RayClusterStatusConditions"
// owner: @andrewsykim @seanlaii
// rep: N/A
// alpha: v1.3
// beta: v1.6
// Enables new deletion policy API in RayJob
RayJobDeletionPolicy featuregate.Feature = "RayJobDeletionPolicy"
// owner: @aaronliang @ryanaoleary
// rep: N/A
// alpha: v1.5
// beta: v1.6
//
// Enables multi-host worker indexing
RayMultiHostIndexing featuregate.Feature = "RayMultiHostIndexing"
// owner: @ryanaoleary
// rep: https://github.com/ray-project/enhancements/pull/58
// alpha: v1.5
//
// Enabled NewClusterWithIncrementalUpgrade type for RayService zero-downtime upgrades.
RayServiceIncrementalUpgrade featuregate.Feature = "RayServiceIncrementalUpgrade"
// owner: @machichima
// rep: N/A
// alpha: v1.6
//
// Enables RayCronJob controller for scheduled RayJob execution.
RayCronJob featuregate.Feature = "RayCronJob"
// owner: @fscnick
// rep: N/A
// alpha: v1.6
//
// Enables asynchronous job info querying.
AsyncJobInfoQuery featuregate.Feature = "AsyncJobInfoQuery"
)
func init() {
runtime.Must(utilfeature.DefaultMutableFeatureGate.Add(defaultFeatureGates))
}
var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
RayClusterStatusConditions: {Default: true, PreRelease: featuregate.Beta},
RayJobDeletionPolicy: {Default: true, PreRelease: featuregate.Beta},
RayMultiHostIndexing: {Default: true, PreRelease: featuregate.Beta},
RayServiceIncrementalUpgrade: {Default: false, PreRelease: featuregate.Alpha},
RayCronJob: {Default: false, PreRelease: featuregate.Alpha},
AsyncJobInfoQuery: {Default: false, PreRelease: featuregate.Alpha},
}
// SetFeatureGateDuringTest is a helper method to override feature gates in tests.
func SetFeatureGateDuringTest(tb testing.TB, f featuregate.Feature, value bool) {
featuregatetesting.SetFeatureGateDuringTest(tb, utilfeature.DefaultFeatureGate, f, value)
}
// Enabled is helper for `utilfeature.DefaultFeatureGate.Enabled()`
func Enabled(f featuregate.Feature) bool {
return utilfeature.DefaultFeatureGate.Enabled(f)
}
func LogFeatureGates(log logr.Logger) {
features := make(map[featuregate.Feature]bool, len(defaultFeatureGates))
for f := range utilfeature.DefaultMutableFeatureGate.GetAll() {
if _, ok := defaultFeatureGates[f]; ok {
features[f] = Enabled(f)
}
}
log.Info("Loaded feature gates", "featureGates", features)
}