Skip to content

Commit

Permalink
Change EnableFeatures option schema (#107)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Oct 12, 2024
1 parent 94c489b commit 627173c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
12 changes: 9 additions & 3 deletions apis/config/v1alpha1/setupconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ type AcePlatformAdmin struct {
Email string `json:"email"`
// +optional
DisplayName string `json:"displayName"`

// +optional
// Organization name should contain only alphanumeric, dash ('-'), underscore ('_') and dot ('.') characters.
Orgname string `json:"orgname"`
Expand All @@ -117,15 +116,22 @@ type SelfManagementOptions struct {
// +optional
CreateCAPICluster bool `json:"createCAPICluster"`
// +optional
EnableFeatures map[string][]string `json:"enableFeatures"`
EnableFeatures map[string]FeatureSetOptions `json:"enableFeatures"`
// +optional
DisableFeatures []string `json:"disableFeatures"`
}

type FeatureSetOptions struct {
Enabled bool `json:"enabled"`
Features []string `json:"features"`
}

func (opt SelfManagementOptions) ToConfig() SelfManagement {
enableFeatures := sets.Set[string]{}
for _, features := range opt.EnableFeatures {
enableFeatures.Insert(features...)
if features.Enabled {
enableFeatures.Insert(features.Features...)
}
}
return SelfManagement{
Import: opt.Import,
Expand Down
33 changes: 23 additions & 10 deletions apis/config/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 627173c

Please sign in to comment.