Skip to content

Commit

Permalink
main.go: improved cache configuration for watching pull secret
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Lanford <[email protected]>
  • Loading branch information
anik120 committed Oct 7, 2024
1 parent 2afb0ae commit c1bf01a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,18 @@ func main() {
},
})

cacheOptions := crcache.Options{}
cacheOptions := crcache.Options{
ByObject: map[client.Object]crcache.ByObject{},
}
if globalPullSecretKey != nil {
cacheOptions = crcache.Options{
ByObject: map[client.Object]crcache.ByObject{
&corev1.Secret{}: {Field: fields.SelectorFromSet(map[string]string{
"metadata.name": globalPullSecretKey.Name,
})},
},
DefaultNamespaces: map[string]crcache.Config{
globalPullSecretKey.Namespace: {LabelSelector: k8slabels.Everything()},
cacheOptions.ByObject[&corev1.Secret{}] = crcache.ByObject{
Namespaces: map[string]crcache.Config{
globalPullSecretKey.Namespace: {
LabelSelector: k8slabels.Everything(),
FieldSelector: fields.SelectorFromSet(map[string]string{
"metadata.name": globalPullSecretKey.Name,
}),
},
},
}
}
Expand Down

0 comments on commit c1bf01a

Please sign in to comment.