Merge pull request #6095 from mattfarina/remove-stable

Removing the stable repository
pull/6106/head
Matt Farina 5 years ago committed by GitHub
commit 095ba431aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,7 +43,6 @@ func newHomeCmd(out io.Writer) *cobra.Command {
fmt.Fprintf(out, "Repository: %s\n", h.Repository())
fmt.Fprintf(out, "RepositoryFile: %s\n", h.RepositoryFile())
fmt.Fprintf(out, "Cache: %s\n", h.Cache())
fmt.Fprintf(out, "Stable CacheIndex: %s\n", h.CacheIndex("stable"))
fmt.Fprintf(out, "Starters: %s\n", h.Starters())
fmt.Fprintf(out, "Plugins: %s\n", h.Plugins())
}

@ -28,7 +28,6 @@ import (
"sigs.k8s.io/yaml"
"helm.sh/helm/cmd/helm/require"
"helm.sh/helm/pkg/getter"
"helm.sh/helm/pkg/helmpath"
"helm.sh/helm/pkg/plugin"
"helm.sh/helm/pkg/plugin/installer"
@ -39,15 +38,9 @@ const initDesc = `
This command sets up local configuration in $HELM_HOME (default ~/.helm/).
`
const (
stableRepository = "stable"
defaultStableRepositoryURL = "https://kubernetes-charts.storage.googleapis.com"
)
type initOptions struct {
skipRefresh bool // --skip-refresh
stableRepositoryURL string // --stable-repo-url
pluginsFilename string // --plugins
skipRefresh bool // --skip-refresh
pluginsFilename string // --plugins
home helmpath.Home
}
@ -77,7 +70,6 @@ func newInitCmd(out io.Writer) *cobra.Command {
f := cmd.Flags()
f.BoolVar(&o.skipRefresh, "skip-refresh", false, "do not refresh (download) the local repository cache")
f.StringVar(&o.stableRepositoryURL, "stable-repo-url", defaultStableRepositoryURL, "URL for stable repository")
f.StringVar(&o.pluginsFilename, "plugins", "", "a YAML file specifying plugins to install")
return cmd
@ -88,7 +80,7 @@ func (o *initOptions) run(out io.Writer) error {
if err := ensureDirectories(o.home, out); err != nil {
return err
}
if err := ensureDefaultRepos(o.home, out, o.skipRefresh, o.stableRepositoryURL); err != nil {
if err := ensureReposFile(o.home, out, o.skipRefresh); err != nil {
return err
}
if err := ensureRepoFileFormat(o.home.RepositoryFile(), out); err != nil {
@ -130,16 +122,11 @@ func ensureDirectories(home helmpath.Home, out io.Writer) error {
return nil
}
func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool, url string) error {
func ensureReposFile(home helmpath.Home, out io.Writer, skipRefresh bool) error {
repoFile := home.RepositoryFile()
if fi, err := os.Stat(repoFile); err != nil {
fmt.Fprintf(out, "Creating %s \n", repoFile)
f := repo.NewFile()
sr, err := initRepo(url, home.CacheIndex(stableRepository), out, skipRefresh, home)
if err != nil {
return err
}
f.Add(sr)
if err := f.WriteFile(repoFile, 0644); err != nil {
return err
}
@ -149,31 +136,6 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool, url
return nil
}
func initRepo(url, cacheFile string, out io.Writer, skipRefresh bool, home helmpath.Home) (*repo.Entry, error) {
fmt.Fprintf(out, "Adding %s repo with URL: %s \n", stableRepository, url)
c := repo.Entry{
Name: stableRepository,
URL: url,
Cache: cacheFile,
}
r, err := repo.NewChartRepository(&c, getter.All(settings))
if err != nil {
return nil, err
}
if skipRefresh {
return &c, nil
}
// In this case, the cacheFile is always absolute. So passing empty string
// is safe.
if err := r.DownloadIndexFile(""); err != nil {
return nil, errors.Wrapf(err, "%s is not a valid chart repository or cannot be reached", url)
}
return &c, nil
}
func ensureRepoFileFormat(file string, out io.Writer) error {
r, err := repo.LoadFile(file)
if err == repo.ErrRepoOutOfDate {

@ -34,10 +34,10 @@ func TestEnsureHome(t *testing.T) {
if err := ensureDirectories(hh, b); err != nil {
t.Error(err)
}
if err := ensureDefaultRepos(hh, b, false, defaultStableRepositoryURL); err != nil {
if err := ensureReposFile(hh, b, false); err != nil {
t.Error(err)
}
if err := ensureDefaultRepos(hh, b, true, defaultStableRepositoryURL); err != nil {
if err := ensureReposFile(hh, b, true); err != nil {
t.Error(err)
}
if err := ensureRepoFileFormat(hh.RepositoryFile(), b); err != nil {

@ -75,7 +75,7 @@ file MUST pass all verification steps.
There are five different ways you can express the chart you want to install:
1. By chart reference: helm install stable/mariadb
1. By chart reference: helm install example/mariadb
2. By path to a packaged chart: helm install ./nginx-1.2.3.tgz
3. By path to an unpacked chart directory: helm install ./nginx
4. By absolute URL: helm install https://example.com/charts/nginx-1.2.3.tgz
@ -85,8 +85,8 @@ CHART REFERENCES
A chart reference is a convenient way of reference a chart in a chart repository.
When you use a chart reference with a repo prefix ('stable/mariadb'), Helm will look in the local
configuration for a chart repository named 'stable', and will then look for a
When you use a chart reference with a repo prefix ('example/mariadb'), Helm will look in the local
configuration for a chart repository named 'example', and will then look for a
chart in that repository whose name is 'mariadb'. It will install the latest
version of that chart unless you also supply a version number with the
'--version' flag.

@ -28,7 +28,7 @@ import (
const showDesc = `
This command inspects a chart and displays information. It takes a chart reference
('stable/drupal'), a full path to a directory or packaged chart, or a URL.
('example/drupal'), a full path to a directory or packaged chart, or a URL.
Inspect prints the contents of the Chart.yaml file and the values.yaml file.
`

@ -34,7 +34,7 @@ const upgradeDesc = `
This command upgrades a release to a new version of a chart.
The upgrade arguments must be a release and chart. The chart
argument can be either: a chart reference('stable/mariadb'), a path to a chart directory,
argument can be either: a chart reference('example/mariadb'), a path to a chart directory,
a packaged chart, or a fully qualified URL. For chart references, the latest
version will be specified unless the '--version' flag is set.

@ -404,9 +404,9 @@ func (m *Manager) getRepoNames(deps []*chart.Dependency) (map[string]string, err
}
if containsNonURL {
errorMessage += `
Note that repositories must be URLs or aliases. For example, to refer to the stable
repository, use "https://kubernetes-charts.storage.googleapis.com/" or "@stable" instead of
"stable". Don't forget to add the repo, too ('helm repo add').`
Note that repositories must be URLs or aliases. For example, to refer to the "example"
repository, use "https://charts.example.com/" or "@example" instead of
"example". Don't forget to add the repo, too ('helm repo add').`
}
return nil, errors.New(errorMessage)
}

@ -654,8 +654,6 @@ _helm_init()
local_nonpersistent_flags+=("--service-account=")
flags+=("--skip-refresh")
local_nonpersistent_flags+=("--skip-refresh")
flags+=("--stable-repo-url=")
local_nonpersistent_flags+=("--stable-repo-url=")
flags+=("--tiller-image=")
two_word_flags+=("-i")
local_nonpersistent_flags+=("--tiller-image=")

Loading…
Cancel
Save