INNER CODE UNIT · Go
newCacheFunc
open-policy-agent/gatekeeper · main.go:687
func newCacheFunc(scheme *runtime.Scheme, localClusterConfig *rest.Config) cache.NewCacheFunc {
if localClusterConfig == nil {
return nil
}
return func(config *rest.Config, opts cache.Options) (cache.Cache, error) {
// standard behavior
remoteClusterCache, err := cache.New(config, opts)
if err != nil {
return nil, fmt.Errorf("creating remote cluster cache: %w", err)
}
// local cluster cache
localClusterOpts := cache.Options{
Scheme: opts.Scheme,
SyncPeriod: opts.SyncPeriod,
ReaderFailOnMissingInformer: opts.ReaderFailOnMissingInformer,
DefaultWatchErrorHandler: opts.DefaultWatchErrorHandler,
DefaultNamespaces: map[string]cache.Config{