Skip to content

Commit

Permalink
Convert self management options to config
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Jul 10, 2024
1 parent 2e600a8 commit a337109
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions apis/config/v1alpha1/setupconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
cloudv1alpha1 "go.bytebuilders.dev/resource-model/apis/cloud/v1alpha1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
)

// AceSetupConfig is the Schema for the kubestashconfigs API
Expand Down Expand Up @@ -104,6 +105,24 @@ type SelfManagementOptions struct {
DisableFeatures map[string][]string `json:"disableFeatures"`
}

func (opt SelfManagementOptions) ToConfig() SelfManagement {
enableFeatures := sets.Set[string]{}
for _, features := range opt.EnableFeatures {
enableFeatures.Insert(features...)
}

disableFeatures := sets.Set[string]{}
for _, features := range opt.DisableFeatures {
disableFeatures.Insert(features...)
}

return SelfManagement{
Import: opt.Import,
EnableFeatures: sets.List(enableFeatures),
DisableFeatures: sets.List(disableFeatures),
}
}

type CAPIClusterConfig struct {
ClusterName string `json:"clusterName,omitempty"`
Region string `json:"region,omitempty"`
Expand Down

0 comments on commit a337109

Please sign in to comment.