Skip to content

Commit 72c8810

Browse files
committed
fix the secret label watch to work without child resource watch
Signed-off-by: Peter Wilcsinszky <[email protected]>
1 parent 711715d commit 72c8810

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

main.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,18 @@ func main() {
161161
}
162162

163163
customMgrOptions, err := setupCustomCache(&mgrOptions, syncPeriod, namespace, loggingRef, watchLabeledChildren)
164+
if err != nil {
165+
setupLog.Error(err, "unable to set up custom cache settings")
166+
os.Exit(1)
167+
}
164168
if watchLabeledSecrets {
169+
if customMgrOptions.Cache.ByObject == nil {
170+
customMgrOptions.Cache.ByObject = make(map[client.Object]cache.ByObject)
171+
}
165172
customMgrOptions.Cache.ByObject[&corev1.Secret{}] = cache.ByObject{
166173
Label: labels.Set{"logging.banzaicloud.io/watch": "enabled"}.AsSelector(),
167174
}
168175
}
169-
if err != nil {
170-
setupLog.Error(err, "unable to set up custom cache settings")
171-
os.Exit(1)
172-
}
173176

174177
if enableprofile {
175178
setupLog.Info("enabling pprof")

0 commit comments

Comments
 (0)