From 2b8ab5bcac25943af692dbdddeb6bcb24c465822 Mon Sep 17 00:00:00 2001 From: Jian Zhang Date: Fri, 7 Feb 2025 13:28:33 +0800 Subject: [PATCH] overwrites the CA directory only when pullCasDir is not empty --- catalogd/cmd/catalogd/main.go | 7 ++++--- cmd/operator-controller/main.go | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/catalogd/cmd/catalogd/main.go b/catalogd/cmd/catalogd/main.go index 7ba03fb5e1..90bde00ab8 100644 --- a/catalogd/cmd/catalogd/main.go +++ b/catalogd/cmd/catalogd/main.go @@ -272,9 +272,10 @@ func main() { unpacker := &source.ContainersImageRegistry{ BaseCachePath: unpackCacheBasePath, SourceContextFunc: func(logger logr.Logger) (*types.SystemContext, error) { - srcContext := &types.SystemContext{ - DockerCertPath: pullCasDir, - OCICertPath: pullCasDir, + srcContext := &types.SystemContext{} + if pullCasDir != "" { + srcContext.DockerCertPath = pullCasDir + srcContext.OCICertPath = pullCasDir } if _, err := os.Stat(authFilePath); err == nil && globalPullSecretKey != nil { logger.Info("using available authentication information for pulling image") diff --git a/cmd/operator-controller/main.go b/cmd/operator-controller/main.go index d9a5443717..f76e63f031 100644 --- a/cmd/operator-controller/main.go +++ b/cmd/operator-controller/main.go @@ -309,9 +309,10 @@ func main() { unpacker := &source.ContainersImageRegistry{ BaseCachePath: filepath.Join(cachePath, "unpack"), SourceContextFunc: func(logger logr.Logger) (*types.SystemContext, error) { - srcContext := &types.SystemContext{ - DockerCertPath: pullCasDir, - OCICertPath: pullCasDir, + srcContext := &types.SystemContext{} + if pullCasDir != "" { + srcContext.DockerCertPath = pullCasDir + srcContext.OCICertPath = pullCasDir } if _, err := os.Stat(authFilePath); err == nil && globalPullSecretKey != nil { logger.Info("using available authentication information for pulling image")