From 1b3c529b0c07905dc1252e0dee54452c03546a74 Mon Sep 17 00:00:00 2001 From: rmweir Date: Tue, 11 Jun 2019 18:02:14 -0700 Subject: [PATCH] Add feature type Added feature type, which will be used by rancher to toggle whether features are enabled. This is part of the feature flagging feature. --- apis/management.cattle.io/v3/global_types.go | 8 ++++++++ apis/management.cattle.io/v3/schema/schema.go | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/apis/management.cattle.io/v3/global_types.go b/apis/management.cattle.io/v3/global_types.go index adb54706..ec564c91 100644 --- a/apis/management.cattle.io/v3/global_types.go +++ b/apis/management.cattle.io/v3/global_types.go @@ -14,6 +14,14 @@ type Setting struct { Source string `json:"source" norman:"nocreate,noupdate,options=db|default|env"` } +type Feature struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Value *bool `json:"value" norman:"required"` + Default bool `json:"default" norman:"nocreate,noupdate"` +} + type ListenConfig struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 89b3381a..c308b957 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -613,6 +613,12 @@ func globalTypes(schema *types.Schemas) *types.Schemas { f.Required = true return f }) + }). + MustImportAndCustomize(&Version, v3.Feature{}, func(schema *types.Schema) { + schema.MustCustomizeField("name", func(f types.Field) types.Field { + f.Required = true + return f + }) }) }