File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments