Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AvailableIcons = func(chart *models.ChartPackage, prefix string) []*IconOutput { var res []*IconOutput for _, format := range availableFormats { exist, err := iconExist(chart, format.Name) if err != nil { log.WithFields(log.Fields{ "error": err, "chart": *chart.Name, "format": format.Name, }).Error("Error on IconExists") continue } if !exist { continue } path, _ := iconPath(chart, format.Name) res = append(res, &IconOutput{ Name: format.Name, Path: staticUrl(path, prefix), }) } return res }
AvailableIcons returns the list of supported icons and existing in the FS
var ChartDataExists = func(chart *models.ChartPackage) (bool, error) { _, err := os.Stat(chartDataDir(chart)) if err == nil { return true, nil } else if os.IsNotExist(err) { return false, nil } return false, err }
ChartDataExists checks if the chart cache directory is present
DataDirBase is the directory used to store cached data like readme files Variable so it can be mocked
var DownloadAndExtractChartTarball = func(chart *models.ChartPackage, repoURL string) (err error) { if err := ensureChartDataDir(chart); err != nil { return err } defer func() { if err != nil { cleanChartDataDir(chart) } }() if !tarballExists(chart) { if err := downloadTarball(chart, repoURL); err != nil { return err } } if err := extractFilesFromTarball(chart); err != nil { return err } return nil }
DownloadAndExtractChartTarball the chart tar file linked by metadata.Urls and store the wanted files (i.e README.md) under chartDataDir
var DownloadAndProcessChartIcon = func(chart *models.ChartPackage) error { if chart.Icon == "" { return nil } if err := ensureChartDataDir(chart); err != nil { return err } if err := downloadIcon(chart); err != nil { return err } if err := processIcon(chart); err != nil { return err } return nil }
DownloadAndProcessChartIcon the chart icon and process it
var ReadFromCache = func(chart *models.ChartPackage, filename string) (string, error) { fileToLoad := filepath.Join(chartDataDir(chart), filename) dat, err := ioutil.ReadFile(fileToLoad) if err != nil { return "", fmt.Errorf("Can't find local file %s", fileToLoad) } return string(dat), nil }
ReadFromCache reads a file from the local cache based on the chart and filename provided
var TarballPath = func(chart *models.ChartPackage) string { return filepath.Join(chartDataDir(chart), "chart.tgz") }
TarballPath returns the location of the chart package in the local cache
Functions ¶
func ReadmeStaticUrl ¶
func ReadmeStaticUrl(chart *models.ChartPackage, prefix string) string
ReadmeStaticUrl returns the static path for the README.md file
Types ¶
type IconOutput ¶
IconOutput defines the output used by the consumer