FeatureFlags: Add helper to check against a set of flags (#97240)
This commit is contained in:
@@ -3,6 +3,7 @@ package scope
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
@@ -12,8 +13,6 @@ import (
|
||||
"k8s.io/kube-openapi/pkg/spec3"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
scope "github.com/grafana/grafana/pkg/apis/scope/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/builder"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
@@ -29,8 +28,9 @@ func NewScopeAPIBuilder() *ScopeAPIBuilder {
|
||||
}
|
||||
|
||||
func RegisterAPIService(features featuremgmt.FeatureToggles, apiregistration builder.APIRegistrar, reg prometheus.Registerer) *ScopeAPIBuilder {
|
||||
if !(features.IsEnabledGlobally(featuremgmt.FlagScopeApi) ||
|
||||
features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs)) {
|
||||
if !featuremgmt.AnyEnabled(features,
|
||||
featuremgmt.FlagScopeApi,
|
||||
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs) {
|
||||
return nil // skip registration unless opting into experimental apis
|
||||
}
|
||||
builder := NewScopeAPIBuilder()
|
||||
|
||||
Reference in New Issue
Block a user