Skip to content

Commit

Permalink
Merge pull request rancher#4609 from manuelbuil/fixMkdirProblem
Browse files Browse the repository at this point in the history
Fix calico-node.log problem
  • Loading branch information
manuelbuil authored Aug 10, 2023
2 parents ec6317e + 3187dc2 commit 000ce7f
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 000ce7f

Please sign in to comment.