Skip to content

Commit

Permalink
Modify CRD cached path directory logging
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Apr 22, 2024
1 parent 6bd6271 commit ecb8480
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/helmutil/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"context"
"fmt"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -46,7 +47,7 @@ func (u *Upgrader) Upgrade(ctx context.Context, chartVersion string) ([]unstruct
return nil, err
}

if _, err := os.Stat(chartDir); os.IsNotExist(err) {
if fs, err := os.Stat(chartDir); os.IsNotExist(err) {
log.Info("Downloading chart release from remote repository", "repoURL", u.repoURL, "chartName", u.chartName, "chartVersion", chartVersion)
downloadDir, err := DownloadChartRelease(u.repoName, u.repoURL, u.chartName, chartVersion)
if err != nil {
Expand All @@ -58,6 +59,13 @@ func (u *Upgrader) Upgrade(ctx context.Context, chartVersion string) ([]unstruct
return nil, err
}
chartDir = extractDir
} else if err != nil {
log.Error("Failed to check chart release directory", "error", err)
return nil, err
} else if !fs.IsDir() {
err := fmt.Errorf("chart release is not a directory: %s", chartDir)
log.Error("Target chart release path is not a directory", "directory", chartDir, "error", err)
return nil, err
} else {
log.Info("Using cached chart release", "directory", chartDir)
}
Expand Down

0 comments on commit ecb8480

Please sign in to comment.