Add --chart-cache config option

Signed-off-by: Reinaldo de Souza Jr <github@rei.nal.do>
pull/8831/head
Reinaldo de Souza Jr 5 years ago
parent 6aa54eacc5
commit 705a4d71ac

@ -86,6 +86,7 @@ func TestLoadPlugins(t *testing.T) {
settings.PluginsDirectory = "testdata/helmhome/helm/plugins"
settings.RepositoryConfig = "testdata/helmhome/helm/repositories.yaml"
settings.RepositoryCache = "testdata/helmhome/helm/repository"
settings.ChartCache = "testdata/helmhome/helm/charts"
var (
out bytes.Buffer
@ -99,6 +100,7 @@ func TestLoadPlugins(t *testing.T) {
"testdata/helmhome/helm/plugins",
"testdata/helmhome/helm/repositories.yaml",
"testdata/helmhome/helm/repository",
"testdata/helmhome/helm/charts",
os.Args[0],
}, "\n")

@ -54,6 +54,7 @@ Environment variables:
| $HELM_MAX_HISTORY | set the maximum number of helm release history. |
| $HELM_NAMESPACE | set the namespace used for the helm operations. |
| $HELM_NO_PLUGINS | disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. |
| $HELM_CHART_CACHE | set the path to the chart cache directory |
| $HELM_PLUGINS | set the path to the plugins directory |
| $HELM_REGISTRY_CONFIG | set the path to the registry config file. |
| $HELM_REPOSITORY_CACHE | set the path to the repository cache directory |

@ -4,4 +4,5 @@ echo $HELM_PLUGIN_DIR
echo $HELM_PLUGINS
echo $HELM_REPOSITORY_CONFIG
echo $HELM_REPOSITORY_CACHE
echo $HELM_CHART_CACHE
echo $HELM_BIN

@ -1,5 +1,6 @@
HELM_BIN
HELM_CACHE_HOME
HELM_CHART_CACHE
HELM_CONFIG_HOME
HELM_DATA_HOME
HELM_DEBUG

@ -62,6 +62,8 @@ type EnvSettings struct {
RepositoryConfig string
// RepositoryCache is the path to the repository cache directory.
RepositoryCache string
// ChartCache is the path to the chart cache directory.
ChartCache string
// PluginsDirectory is the path to the plugins directory.
PluginsDirectory string
// MaxHistory is the max release history maintained.
@ -81,6 +83,7 @@ func New() *EnvSettings {
RegistryConfig: envOr("HELM_REGISTRY_CONFIG", helmpath.ConfigPath("registry.json")),
RepositoryConfig: envOr("HELM_REPOSITORY_CONFIG", helmpath.ConfigPath("repositories.yaml")),
RepositoryCache: envOr("HELM_REPOSITORY_CACHE", helmpath.CachePath("repository")),
ChartCache: envOr("HELM_CHART_CACHE", helmpath.CachePath("charts")),
}
env.Debug, _ = strconv.ParseBool(os.Getenv("HELM_DEBUG"))
@ -110,6 +113,7 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.RegistryConfig, "registry-config", s.RegistryConfig, "path to the registry config file")
fs.StringVar(&s.RepositoryConfig, "repository-config", s.RepositoryConfig, "path to the file containing repository names and URLs")
fs.StringVar(&s.RepositoryCache, "repository-cache", s.RepositoryCache, "path to the file containing cached repository indexes")
fs.StringVar(&s.ChartCache, "chart-cache", s.ChartCache, "path to the chart cache directory")
}
func envOr(name, def string) string {
@ -146,6 +150,7 @@ func (s *EnvSettings) EnvVars() map[string]string {
"HELM_CONFIG_HOME": helmpath.ConfigPath(""),
"HELM_DATA_HOME": helmpath.DataPath(""),
"HELM_DEBUG": fmt.Sprint(s.Debug),
"HELM_CHART_CACHE": s.ChartCache,
"HELM_PLUGINS": s.PluginsDirectory,
"HELM_REGISTRY_CONFIG": s.RegistryConfig,
"HELM_REPOSITORY_CACHE": s.RepositoryCache,

Loading…
Cancel
Save