Skip to content

Commit

Permalink
Merge pull request #3854 from flavianmissi/OCPBUGS-17683
Browse files Browse the repository at this point in the history
OCPBUGS-17683 replace .. with : on registry CA file paths
  • Loading branch information
openshift-merge-robot authored Aug 15, 2023
2 parents b46ed93 + cafa7d7 commit cf8e35e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/daemon/certificate_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"
"path/filepath"

"strings"
"time"

mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
Expand All @@ -15,9 +15,7 @@ import (
"k8s.io/klog/v2"
)

var (
ccRequeueDelay = 1 * time.Minute
)
var ccRequeueDelay = 1 * time.Minute

func (dn *Daemon) handleControllerConfigEvent(obj interface{}) {
controllerConfig := obj.(*mcfgv1.ControllerConfig)
Expand Down Expand Up @@ -112,19 +110,21 @@ func (dn *Daemon) syncControllerConfigHandler(key string) error {
}

for _, CA := range controllerConfig.Spec.ImageRegistryBundleData {
if err := os.MkdirAll(filepath.Join(imageCAFilePath, CA.File), defaultDirectoryPermissions); err != nil {
caFile := strings.ReplaceAll(CA.File, "..", ":")
if err := os.MkdirAll(filepath.Join(imageCAFilePath, caFile), defaultDirectoryPermissions); err != nil {
return err
}
if err := writeFileAtomicallyWithDefaults(filepath.Join(imageCAFilePath, CA.File, "ca.crt"), CA.Data); err != nil {
if err := writeFileAtomicallyWithDefaults(filepath.Join(imageCAFilePath, caFile, "ca.crt"), CA.Data); err != nil {
return err
}
}

for _, CA := range controllerConfig.Spec.ImageRegistryBundleUserData {
if err := os.MkdirAll(filepath.Join(imageCAFilePath, CA.File), defaultDirectoryPermissions); err != nil {
caFile := strings.ReplaceAll(CA.File, "..", ":")
if err := os.MkdirAll(filepath.Join(imageCAFilePath, caFile), defaultDirectoryPermissions); err != nil {
return err
}
if err := writeFileAtomicallyWithDefaults(filepath.Join(imageCAFilePath, CA.File, "ca.crt"), CA.Data); err != nil {
if err := writeFileAtomicallyWithDefaults(filepath.Join(imageCAFilePath, caFile, "ca.crt"), CA.Data); err != nil {
return err
}
}
Expand Down

0 comments on commit cf8e35e

Please sign in to comment.