Skip to content

Commit

Permalink
Add --options-config-file flag
Browse files Browse the repository at this point in the history
--options-config-file flag defines the path to the kube-state-metrics
options config file.
  • Loading branch information
rexagod committed Nov 6, 2022
1 parent 0f48343 commit bf06d7d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ type Options struct {
TotalShards int
Pod string
Namespace string
MetricDenylist MetricSet
MetricAllowlist MetricSet
MetricDenylist MetricSet `yaml:"metric_denylist"`
MetricAllowlist MetricSet `yaml:"metric_allowlist"`
MetricOptInList MetricSet
Version bool
AnnotationsAllowList LabelsAllowList
Expand All @@ -57,9 +57,15 @@ type Options struct {
CustomResourceConfig string
CustomResourceConfigFile string

optsConfigFile string

flags *pflag.FlagSet
}

func GetOptsConfigFile(opt Options) string {
return opt.optsConfigFile
}

// NewOptions returns a new instance of `Options`.
func NewOptions() *Options {
return &Options{
Expand Down Expand Up @@ -120,6 +126,7 @@ func (o *Options) AddFlags() {

o.flags.StringVar(&o.CustomResourceConfig, "custom-resource-state-config", "", "Inline Custom Resource State Metrics config YAML (experimental)")
o.flags.StringVar(&o.CustomResourceConfigFile, "custom-resource-state-config-file", "", "Path to a Custom Resource State Metrics config file (experimental)")
o.flags.StringVar(&o.optsConfigFile, "options-config-file", "", "Path to the kube-state-metrics options config file")
}

// Parse parses the flag definitions from the argument list.
Expand Down

0 comments on commit bf06d7d

Please sign in to comment.