-
Notifications
You must be signed in to change notification settings - Fork 25
/
config.go
32 lines (27 loc) · 949 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package config
import (
"github.com/fluxninja/aperture/v2/pkg/config"
"github.com/fluxninja/aperture/v2/pkg/log"
"go.uber.org/fx"
)
// Module returns the fx options for autoscale config.
func Module() fx.Option {
return fx.Provide(provideConfig)
}
// ConfigKey is config path where FlowPreviewConfig is located.
const ConfigKey = "auto_scale.kubernetes"
// AutoScaleKubernetesConfig is the configuration for the flow preview service.
// swagger:model
// +kubebuilder:object:generate=true
type AutoScaleKubernetesConfig struct {
// Enables the Kubernetes auto-scale capability.
Enabled bool `json:"enabled" default:"true"`
}
func provideConfig(unmarshaller config.Unmarshaller) (AutoScaleKubernetesConfig, error) {
var cfg AutoScaleKubernetesConfig
if err := unmarshaller.UnmarshalKey(ConfigKey, &cfg); err != nil {
log.Error().Err(err).Msg("Unable to deserialize K8S discovery configuration!")
return cfg, err
}
return cfg, nil
}