Feature Toggles: Switch feature toggle admin page over to k8s API (#80854)

* add handling for legacy and k8s apis to frontend

* use backend srv directly not redux

* add unit test to make sure the correct apis are being called

* require api server flag

* fix feature toggle name

* ensure both pages work correctly

* make consistent with legacy api

* implement webhook update

* fix unit test

* remove old apis and update

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Michael Mandrus
2024-02-01 23:52:02 -05:00
committed by GitHub
co-authored by Ryan McKinley
parent 9c9e5e68c8
commit 7464ea4346
17 changed files with 348 additions and 775 deletions
+6 -3
View File
@@ -78,8 +78,11 @@ type FeatureTogglesList struct {
type ResolvedToggleState struct {
metav1.TypeMeta `json:",inline"`
// Can any flag be updated
Writeable bool `json:"writeable,omitempty"`
// The user is allowed to edit feature toggles on this system
AllowEditing bool `json:"allowEditing,omitempty"`
// The system has changes that require still require a restart
RestartRequired bool `json:"restartRequired,omitempty"`
// The currently enabled flags
Enabled map[string]bool `json:"enabled,omitempty"`
@@ -99,7 +102,7 @@ type ToggleStatus struct {
Enabled bool `json:"enabled"`
// Can this flag be updated
Writeable bool `json:"writeable,omitempty"`
Writeable bool `json:"writeable"`
// Where was the value configured
// eg: startup | tenant|org | user | browser
@@ -318,9 +318,16 @@ func schema_pkg_apis_featuretoggle_v0alpha1_ResolvedToggleState(ref common.Refer
Format: "",
},
},
"writeable": {
"allowEditing": {
SchemaProps: spec.SchemaProps{
Description: "Can any flag be updated",
Description: "The user is allowed to edit feature toggles on this system",
Type: []string{"boolean"},
Format: "",
},
},
"restartRequired": {
SchemaProps: spec.SchemaProps{
Description: "The system has changes that require still require a restart",
Type: []string{"boolean"},
Format: "",
},
@@ -395,6 +402,7 @@ func schema_pkg_apis_featuretoggle_v0alpha1_ToggleStatus(ref common.ReferenceCal
"writeable": {
SchemaProps: spec.SchemaProps{
Description: "Can this flag be updated",
Default: false,
Type: []string{"boolean"},
Format: "",
},
@@ -413,7 +421,7 @@ func schema_pkg_apis_featuretoggle_v0alpha1_ToggleStatus(ref common.ReferenceCal
},
},
},
Required: []string{"name", "enabled"},
Required: []string{"name", "enabled", "writeable"},
},
},
Dependencies: []string{