Skip to content

Commit cb5403a

Browse files
committed
Set default for Istio collection to disabled
1 parent 9a871bb commit cb5403a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/mapper/cmd/main.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,17 @@ func main() {
225225
logrus.WithError(err).Panic("Failed to initialize cloud client")
226226
}
227227

228-
istioWatcher, err := istiowatcher.NewWatcher(resolver.Mutation())
229-
if err != nil {
230-
logrus.WithError(err).Panic("failed to initialize istio watcher")
231-
}
228+
if viper.GetBool(config.EnableIstioCollectionKey) {
229+
istioWatcher, err := istiowatcher.NewWatcher(resolver.Mutation())
230+
if err != nil {
231+
logrus.WithError(err).Panic("failed to initialize istio watcher")
232+
}
232233

233-
errgrp.Go(func() error {
234-
defer errorreporter.AutoNotify()
235-
return istioWatcher.RunForever(errGroupCtx)
236-
})
234+
errgrp.Go(func() error {
235+
defer errorreporter.AutoNotify()
236+
return istioWatcher.RunForever(errGroupCtx)
237+
})
238+
}
237239

238240
cloudUploaderConfig := clouduploader.ConfigFromViper()
239241
if cloudEnabled {

src/mapper/pkg/config/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const (
3535
DNSClientIntentsUpdateEnabledKey = "dns-client-intents-update-enabled"
3636
DNSClientIntentsUpdateEnabledDefault = false
3737

38+
EnableIstioCollectionKey = "enable-istio-collection"
39+
EnableIstioCollectionDefault = false
3840
IstioRestrictCollectionToNamespace = "istio-restrict-collection-to-namespace"
3941
IstioReportIntervalKey = "istio-report-interval"
4042
IstioReportIntervalDefault = 30 * time.Second
@@ -68,5 +70,6 @@ func init() {
6870
viper.SetDefault(MetricFetchTimeoutKey, MetricFetchTimeoutDefault)
6971
viper.SetDefault(IstioCooldownIntervalKey, IstioCooldownIntervalDefault)
7072
viper.SetDefault(IstioRestrictCollectionToNamespace, "")
73+
viper.SetDefault(EnableIstioCollectionKey, EnableIstioCollectionDefault)
7174
excludedNamespaces = goset.FromSlice(viper.GetStringSlice(ExcludedNamespacesKey))
7275
}

0 commit comments

Comments
 (0)