Skip to content

Commit 402bb16

Browse files
synaretephlogistonjohn
authored andcommitted
conf: control metrics-exporter image
Added two new options to global config: 1) 'smbd-metrics-container-image' defines the metrics-exporter container image. 2) 'metrics-exporter-mode' indicates if and how a metrics-exporter container should be used along-side samba-server. Valid values: "enable", "disable" or empty string (default). Signed-off-by: Shachar Sharon <[email protected]>
1 parent c994fd9 commit 402bb16

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

internal/conf/config.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ import (
1010

1111
// DefaultOperatorConfig holds the default values of OperatorConfig.
1212
var DefaultOperatorConfig = OperatorConfig{
13-
SmbdContainerImage: "quay.io/samba.org/samba-server:latest",
14-
SvcWatchContainerImage: "quay.io/samba.org/svcwatch:latest",
15-
SmbdContainerName: "samba",
16-
WinbindContainerName: "wb",
17-
WorkingNamespace: "",
18-
SambaDebugLevel: "",
19-
StatePVCSize: "1Gi",
20-
ClusterSupport: "",
21-
SmbServicePort: 445,
22-
SmbdPort: 445,
13+
SmbdContainerImage: "quay.io/samba.org/samba-server:latest",
14+
SmbdMetricsContainerImage: "quay.io/samba.org/samba-metrics:latest",
15+
SvcWatchContainerImage: "quay.io/samba.org/svcwatch:latest",
16+
SmbdContainerName: "samba",
17+
WinbindContainerName: "wb",
18+
WorkingNamespace: "",
19+
SambaDebugLevel: "",
20+
StatePVCSize: "1Gi",
21+
ClusterSupport: "",
22+
SmbServicePort: 445,
23+
SmbdPort: 445,
24+
MetricsExporterMode: "disabled",
2325
}
2426

2527
// OperatorConfig is a type holding general configuration values.
@@ -28,6 +30,9 @@ var DefaultOperatorConfig = OperatorConfig{
2830
type OperatorConfig struct {
2931
// SmbdContainerImage can be used to select alternate container sources.
3032
SmbdContainerImage string `mapstructure:"smbd-container-image"`
33+
// SmbdMetricsContainerImage can be used to select alternate
34+
// metrics-exporter container sources.
35+
SmbdMetricsContainerImage string `mapstructure:"smbd-metrics-container-image"`
3136
// SvcWatchContainerImage can be used to select alternate container image
3237
// for the service watch utility.
3338
SvcWatchContainerImage string `mapstructure:"svc-watch-container-image"`
@@ -58,6 +63,10 @@ type OperatorConfig struct {
5863
// ServiceAccountName is a (string) which overrides the default service
5964
// account associated with child pods. Required in OpenShift.
6065
ServiceAccountName string `mapstructure:"service-account-name"`
66+
// MetricsExporterMode is a (string) flag which indicates if and how the
67+
// operator should run metrics-exporter container within samba-server pod.
68+
// Valid values are "enabled", "disabled" or empty string (default).
69+
MetricsExporterMode string `mapstructure:"metrics-exporter-mode"`
6170
}
6271

6372
// Validate the OperatorConfig returning an error if the config is not
@@ -92,6 +101,7 @@ func NewSource() *Source {
92101
d := DefaultOperatorConfig
93102
v := viper.New()
94103
v.SetDefault("smbd-container-image", d.SmbdContainerImage)
104+
v.SetDefault("smbd-metrics-container-image", d.SmbdMetricsContainerImage)
95105
v.SetDefault("smbd-container-name", d.SmbdContainerName)
96106
v.SetDefault("winbind-container-name", d.WinbindContainerName)
97107
v.SetDefault("working-namespace", d.WorkingNamespace)
@@ -102,6 +112,7 @@ func NewSource() *Source {
102112
v.SetDefault("smb-service-port", d.SmbServicePort)
103113
v.SetDefault("smbd-port", d.SmbdPort)
104114
v.SetDefault("service-account-name", d.ServiceAccountName)
115+
v.SetDefault("metrics-exporter-mode", d.MetricsExporterMode)
105116
return &Source{v: v}
106117
}
107118

0 commit comments

Comments
 (0)