Skip to content

Commit

Permalink
Merge pull request #4618 from manuelbuil/caliconodelog126
Browse files Browse the repository at this point in the history
[Release 1.26] Fix repeating "cannot find file" error
  • Loading branch information
manuelbuil committed Aug 14, 2023
2 parents 9fd737c + 7a7e8a7 commit 7ea5d8f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/windows/calico.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ func (c *Calico) writeConfigFiles(CNIConfDir string, NodeName string) error {

// renderCalicoConfig creates the file and then renders the template using Calico Config parameters
func (c *Calico) renderCalicoConfig(path string, toRender *template.Template) error {
os.MkdirAll(filepath.Dir(path), 0755)
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
return err
}
output, err := os.Create(path)
if err != nil {
return err
Expand Down Expand Up @@ -263,6 +265,9 @@ func (c *Calico) createKubeConfig(ctx context.Context, restConfig *rest.Config)

// Start starts the CNI services on the Windows node.
func (c *Calico) Start(ctx context.Context) error {
if err := os.MkdirAll(calicoLogPath, 0755); err != nil {
return fmt.Errorf("error creating %s directory: %v", calicoLogPath, err)
}
for {
if err := startCalico(ctx, c.CNICfg); err != nil {
continue
Expand Down Expand Up @@ -444,8 +449,7 @@ func startFelix(ctx context.Context, config *CalicoConfig) {
func startCalico(ctx context.Context, config *CalicoConfig) error {
outputFile, err := os.Create(calicoLogPath + "calico-node.log")
if err != nil {
logrus.Errorf("error creating calico-node.log: %v", err)
return err
return fmt.Errorf("error creating calico-node.log: %v", err)
}
defer outputFile.Close()
specificEnvs := []string{
Expand Down

0 comments on commit 7ea5d8f

Please sign in to comment.