added warning each time old repository is noticed

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
pull/8901/head
Matt Butcher 5 years ago
parent 26c522edf3
commit a617b85cd6
No known key found for this signature in database
GPG Key ID: DCD5F5E5EF32C345

@ -36,6 +36,7 @@ import (
helm_env "k8s.io/helm/pkg/helm/environment" helm_env "k8s.io/helm/pkg/helm/environment"
"k8s.io/helm/pkg/helm/portforwarder" "k8s.io/helm/pkg/helm/portforwarder"
"k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/kube"
"k8s.io/helm/pkg/repo"
"k8s.io/helm/pkg/tlsutil" "k8s.io/helm/pkg/tlsutil"
) )
@ -175,6 +176,52 @@ Environment:
` `
func checkForExpiredRepos(repofile string) {
expiredRepos := []struct {
name string
old string
new string
}{
{
name: "stable",
old: "kubernetes-charts.storage.googleapis.com",
new: "https://charts.helm.sh/stable",
},
{
name: "incubator",
old: "kubernetes-charts-incubator.storage.googleapis.com",
new: "https://charts.helm.sh/incubator",
},
}
// parse repo file.
// Ignore the error because it is okay for a repo file to be unparseable at this
// stage. Later checks will trap the error and respond accordingly.
repoFile, err := repo.LoadRepositoriesFile(repofile)
if err != nil {
return
}
for _, exp := range expiredRepos {
r, ok := repoFile.Get(exp.name)
if !ok {
return
}
if url := r.URL; strings.Contains(url, exp.old) {
fmt.Fprintf(
os.Stderr,
"WARNING: %q is deprecated for %q and will be deleted Nov. 13, 2020.\nWARNING: You should switch to %q\n",
exp.old,
exp.name,
exp.new,
)
}
}
}
func newRootCmd(args []string) *cobra.Command { func newRootCmd(args []string) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "helm", Use: "helm",
@ -182,6 +229,7 @@ func newRootCmd(args []string) *cobra.Command {
Long: globalUsage, Long: globalUsage,
SilenceUsage: true, SilenceUsage: true,
PersistentPreRun: func(*cobra.Command, []string) { PersistentPreRun: func(*cobra.Command, []string) {
checkForExpiredRepos(settings.Home.RepositoryFile())
if settings.TLSCaCertFile == helm_env.DefaultTLSCaCert || settings.TLSCaCertFile == "" { if settings.TLSCaCertFile == helm_env.DefaultTLSCaCert || settings.TLSCaCertFile == "" {
settings.TLSCaCertFile = settings.Home.TLSCaCert() settings.TLSCaCertFile = settings.Home.TLSCaCert()
} else { } else {

@ -32,32 +32,33 @@ helm init [flags]
### Options ### Options
``` ```
--automount-service-account-token Auto-mount the given service account to tiller (default true) --automount-service-account-token Auto-mount the given service account to tiller (default true)
--canary-image Use the canary Tiller image --canary-image Use the canary Tiller image
-c, --client-only If set does not install Tiller -c, --client-only If set does not install Tiller
--dry-run Do not install local or remote --dry-run Do not install local or remote
--force-upgrade Force upgrade of Tiller to the current helm version --force-upgrade Force upgrade of Tiller to the current helm version
-h, --help help for init -h, --help help for init
--history-max int Limit the maximum number of revisions saved per release. Use 0 for no limit. --history-max int Limit the maximum number of revisions saved per release. Use 0 for no limit.
--local-repo-url string URL for local repository (default "http://127.0.0.1:8879/charts") --local-repo-url string URL for local repository (default "http://127.0.0.1:8879/charts")
--net-host Install Tiller with net=host --net-host Install Tiller with net=host
--node-selectors string Labels to specify the node on which Tiller is installed (app=tiller,helm=rocks) --node-selectors string Labels to specify the node on which Tiller is installed (app=tiller,helm=rocks)
-o, --output OutputFormat Skip installation and output Tiller's manifest in specified format (json or yaml) -o, --output OutputFormat Skip installation and output Tiller's manifest in specified format (json or yaml)
--override stringArray Override values for the Tiller Deployment manifest (can specify multiple or separate values with commas: key1=val1,key2=val2) --override stringArray Override values for the Tiller Deployment manifest (can specify multiple or separate values with commas: key1=val1,key2=val2)
--replicas int Amount of tiller instances to run on the cluster (default 1) --replicas int Amount of tiller instances to run on the cluster (default 1)
--service-account string Name of service account --service-account string Name of service account
--skip-refresh Do not refresh (download) the local repository cache --skip-refresh Do not refresh (download) the local repository cache
--skip-repos Skip adding the stable and local repositories --skip-repos Skip adding the stable and local repositories
--stable-repo-url string URL for stable repository (default "https://kubernetes-charts.storage.googleapis.com") --stable-repo-url string URL for stable repository (default "https://charts.helm.sh/stable")
-i, --tiller-image string Override Tiller image -i, --tiller-image string Override Tiller image
--tiller-tls Install Tiller with TLS enabled --tiller-tls Install Tiller with TLS enabled
--tiller-tls-cert string Path to TLS certificate file to install with Tiller --tiller-tls-cert string Path to TLS certificate file to install with Tiller
--tiller-tls-hostname string The server name used to verify the hostname on the returned certificates from Tiller --tiller-tls-hostname string The server name used to verify the hostname on the returned certificates from Tiller
--tiller-tls-key string Path to TLS key file to install with Tiller --tiller-tls-key string Path to TLS key file to install with Tiller
--tiller-tls-verify Install Tiller with TLS enabled and to verify remote certificates --tiller-tls-verify Install Tiller with TLS enabled and to verify remote certificates
--tls-ca-cert string Path to CA root certificate --tls-ca-cert string Path to CA root certificate
--upgrade Upgrade if Tiller is already installed --upgrade Upgrade if Tiller is already installed
--wait Block until Tiller is running and ready to receive requests --use-deprecated-stable-repository Use the old (googleapis) repository URL even though that URL is being shutdown.
--wait Block until Tiller is running and ready to receive requests
``` ```
### Options inherited from parent commands ### Options inherited from parent commands
@ -76,4 +77,4 @@ helm init [flags]
* [helm](helm.md) - The Helm package manager for Kubernetes. * [helm](helm.md) - The Helm package manager for Kubernetes.
###### Auto generated by spf13/cobra on 25-Jun-2020 ###### Auto generated by spf13/cobra on 15-Oct-2020

Loading…
Cancel
Save