mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 13:22:21 +08:00
K8s: add server run options (#87784)
This commit is contained in:

committed by
GitHub

parent
56054e2e87
commit
bbb4323f7e
@ -15,6 +15,7 @@ type Options struct {
|
|||||||
RecommendedOptions *genericoptions.RecommendedOptions
|
RecommendedOptions *genericoptions.RecommendedOptions
|
||||||
TracingOptions *TracingOptions
|
TracingOptions *TracingOptions
|
||||||
MetricsOptions *MetricsOptions
|
MetricsOptions *MetricsOptions
|
||||||
|
ServerRunOptions *genericoptions.ServerRunOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(logger log.Logger, codec runtime.Codec) *Options {
|
func New(logger log.Logger, codec runtime.Codec) *Options {
|
||||||
@ -24,6 +25,7 @@ func New(logger log.Logger, codec runtime.Codec) *Options {
|
|||||||
RecommendedOptions: options.NewRecommendedOptions(codec),
|
RecommendedOptions: options.NewRecommendedOptions(codec),
|
||||||
TracingOptions: NewTracingOptions(logger),
|
TracingOptions: NewTracingOptions(logger),
|
||||||
MetricsOptions: NewMetrcicsOptions(logger),
|
MetricsOptions: NewMetrcicsOptions(logger),
|
||||||
|
ServerRunOptions: genericoptions.NewServerRunOptions(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +35,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
|
|||||||
o.RecommendedOptions.AddFlags(fs)
|
o.RecommendedOptions.AddFlags(fs)
|
||||||
o.TracingOptions.AddFlags(fs)
|
o.TracingOptions.AddFlags(fs)
|
||||||
o.MetricsOptions.AddFlags(fs)
|
o.MetricsOptions.AddFlags(fs)
|
||||||
|
o.ServerRunOptions.AddUniversalFlags(fs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Options) Validate() []error {
|
func (o *Options) Validate() []error {
|
||||||
@ -52,6 +55,10 @@ func (o *Options) Validate() []error {
|
|||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if errs := o.ServerRunOptions.Validate(); len(errs) != 0 {
|
||||||
|
return errs
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: we don't call validate on the top level recommended options as it doesn't like skipping etcd-servers
|
// NOTE: we don't call validate on the top level recommended options as it doesn't like skipping etcd-servers
|
||||||
// the function is left here for troubleshooting any other config issues
|
// the function is left here for troubleshooting any other config issues
|
||||||
// errors = append(errors, o.RecommendedOptions.Validate()...)
|
// errors = append(errors, o.RecommendedOptions.Validate()...)
|
||||||
@ -117,6 +124,10 @@ func (o *Options) ModifiedApplyTo(config *genericapiserver.RecommendedConfig) er
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := o.ServerRunOptions.ApplyTo(&config.Config); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,5 +166,11 @@ func (o *Options) ApplyTo(serverConfig *genericapiserver.RecommendedConfig) erro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.ServerRunOptions != nil {
|
||||||
|
if err := o.ServerRunOptions.ApplyTo(&serverConfig.Config); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user