github.com/wtfutil/wtf@v0.43.0/modules/kubernetes/settings.go (about) 1 package kubernetes 2 3 import ( 4 "github.com/olebedev/config" 5 "github.com/wtfutil/wtf/cfg" 6 "github.com/wtfutil/wtf/utils" 7 ) 8 9 const ( 10 defaultFocusable = false 11 defaultTitle = "Kubernetes" 12 ) 13 14 type Settings struct { 15 *cfg.Common 16 17 objects []string `help:"Kubernetes objects to show. Options are: [nodes, pods, deployments]."` 18 title string `help:"Override the title of widget."` 19 kubeconfig string `help:"Location of a kubeconfig file."` 20 namespaces []string `help:"List of namespaces to watch. If blank, defaults to all namespaces."` 21 context string `help:"Kubernetes context to use. If blank, uses default context"` 22 } 23 24 func NewSettingsFromYAML(name string, moduleConfig *config.Config, globalConfig *config.Config) *Settings { 25 26 settings := Settings{ 27 Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, moduleConfig, globalConfig), 28 29 objects: utils.ToStrs(moduleConfig.UList("objects")), 30 title: moduleConfig.UString("title"), 31 kubeconfig: moduleConfig.UString("kubeconfig"), 32 namespaces: utils.ToStrs(moduleConfig.UList("namespaces")), 33 context: moduleConfig.UString("context"), 34 } 35 36 return &settings 37 }