mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
815f4bb09d
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com>
20 lines
811 B
Go
20 lines
811 B
Go
package internal
|
|
|
|
import (
|
|
"github.com/go-logr/logr"
|
|
"github.com/kyverno/kyverno/pkg/imageverifycache"
|
|
)
|
|
|
|
func setupImageVerifyCache(logger logr.Logger) imageverifycache.Client {
|
|
logger = logger.WithName("image-verify-cache").WithValues("enabled", imageVerifyCacheEnabled, "maxsize", imageVerifyCacheMaxSize, "ttl", imageVerifyCacheTTLDuration)
|
|
logger.Info("setup image verify cache...")
|
|
opts := []imageverifycache.Option{
|
|
imageverifycache.WithLogger(logger),
|
|
imageverifycache.WithCacheEnableFlag(imageVerifyCacheEnabled),
|
|
imageverifycache.WithMaxSize(imageVerifyCacheMaxSize),
|
|
imageverifycache.WithTTLDuration(imageVerifyCacheTTLDuration),
|
|
}
|
|
imageVerifyCache, err := imageverifycache.New(opts...)
|
|
checkError(logger, err, "failed to create image verify cache client")
|
|
return imageVerifyCache
|
|
}
|