Repository: helm/helm
Pull request #6835 (2019-10-30 17:37:21)

Updating the usage language for search repo


Patch:
diff --git a/cmd/helm/list.go b/cmd/helm/list.go
index 7e04e64a9..a3003e219 100644
--- a/cmd/helm/list.go
+++ b/cmd/helm/list.go
@@ -100,7 +100,7 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
 	f.BoolVar(&client.Deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled")
 	f.BoolVar(&client.Failed, "failed", false, "show failed releases")
 	f.BoolVar(&client.Pending, "pending", false, "show pending releases")
-	f.BoolVarP(&client.AllNamespaces, "all-namespaces", "A", false, "list releases across all namespaces")
+	f.BoolVar(&client.AllNamespaces, "all-namespaces", false, "list releases across all namespaces")
 	f.IntVarP(&client.Limit, "max", "m", 256, "maximum number of releases to fetch")
 	f.IntVar(&client.Offset, "offset", 0, "next release name in the list, used to offset from start value")
 	f.StringVarP(&client.Filter, "filter", "f", "", "a regular expression (Perl compatible). Any releases that match the expression will be included in the results")
diff --git a/cmd/helm/root.go b/cmd/helm/root.go
index fac0dc062..54b4ef59a 100644
--- a/cmd/helm/root.go
+++ b/cmd/helm/root.go
@@ -286,7 +286,7 @@ __helm_custom_func()
             __helm_list_repos
             return
             ;;
-        helm_plugin_uninstall | helm_plugin_update)
+        helm_plugin_remove | helm_plugin_update)
             __helm_list_plugins
             return
             ;;
diff --git a/cmd/helm/search_repo.go b/cmd/helm/search_repo.go
index 1bc279050..68d0135c7 100644
--- a/cmd/helm/search_repo.go
+++ b/cmd/helm/search_repo.go
@@ -50,7 +50,7 @@ Examples:
     # Search for release versions matching the keyword "nginx", including pre-release versions
     $ helm search repo nginx --devel
 
-    # Search for the latest patch release for nginx-ingress 1.x
+    # Search for the latest stable release for nginx-ingress with a major version of 1
     $ helm search repo nginx-ingress --version ^1.0.0
 
 Repositories are managed with 'helm repo' commands.
diff --git a/pkg/action/install.go b/pkg/action/install.go
index 8f1b5528b..606226500 100644
--- a/pkg/action/install.go
+++ b/pkg/action/install.go
@@ -564,10 +564,6 @@ func (i *Install) NameAndChart(args []string) (string, string, error) {
 	if base == "." || base == "" {
 		base = "chart"
 	}
-	// if present, strip out the file extension from the name
-	if idx := strings.Index(base, "."); idx != -1 {
-		base = base[0:idx]
-	}
 
 	return fmt.Sprintf("%s-%d", base, time.Now().Unix()), args[0], nil
 }
diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go
index c67cde04f..6f0b38c05 100644
--- a/pkg/chartutil/create.go
+++ b/pkg/chartutil/create.go
@@ -324,7 +324,7 @@ const defaultNotes = `1. Get the application URL by running these commands:
 {{- else if contains "ClusterIP" .Values.service.type }}
   export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "<CHARTNAME>.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
   echo "Visit http://127.0.0.1:8080 to use your application"
-  kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
+  kubectl port-forward $POD_NAME 8080:80
 {{- end }}
 `
 
diff --git a/pkg/kube/client.go b/pkg/kube/client.go
index 2a5661306..06df8490e 100644
--- a/pkg/kube/client.go
+++ b/pkg/kube/client.go
@@ -401,7 +401,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
 		// send patch to server
 		obj, err = helper.Patch(target.Namespace, target.Name, patchType, patch, nil)
 		if err != nil {
-			return errors.Wrapf(err, "cannot patch %q with kind %s", target.Name, kind)
+			log.Printf("Cannot patch %s: %q (%v)", kind, target.Name, err)
 		}
 	}
 
diff --git a/pkg/repo/index.go b/pkg/repo/index.go
index a7fea673b..b3703304f 100644
--- a/pkg/repo/index.go
+++ b/pkg/repo/index.go
@@ -169,15 +169,6 @@ func (i IndexFile) Get(name, version string) (*ChartVersion, error) {
 		}
 	}
 
-	// when customer input exact version, check whether have exact match one first
-	if len(version) != 0 {
-		for _, ver := range vs {
-			if version == ver.Version {
-				return ver, nil
-			}
-		}
-	}
-
 	for _, ver := range vs {
 		test, err := semver.NewVersion(ver.Version)
 		if err != nil {


Test patch:
diff --git a/pkg/action/install_test.go b/pkg/action/install_test.go
index bb36b843d..406574995 100644
--- a/pkg/action/install_test.go
+++ b/pkg/action/install_test.go
@@ -33,7 +33,6 @@ import (
 	kubefake "helm.sh/helm/v3/pkg/kube/fake"
 	"helm.sh/helm/v3/pkg/release"
 	"helm.sh/helm/v3/pkg/storage/driver"
-	"helm.sh/helm/v3/pkg/time"
 )
 
 type nameTemplateTestCase struct {
@@ -470,99 +469,3 @@ func TestInstallReleaseOutputDir(t *testing.T) {
 	_, err = os.Stat(filepath.Join(dir, "hello/templates/empty"))
 	is.True(os.IsNotExist(err))
 }
-
-func TestNameAndChart(t *testing.T) {
-	is := assert.New(t)
-	instAction := installAction(t)
-	chartName := "./foo"
-
-	name, chrt, err := instAction.NameAndChart([]string{chartName})
-	if err != nil {
-		t.Fatal(err)
-	}
-	is.Equal(instAction.ReleaseName, name)
-	is.Equal(chartName, chrt)
-
-	instAction.GenerateName = true
-	_, _, err = instAction.NameAndChart([]string{"foo", chartName})
-	if err == nil {
-		t.Fatal("expected an error")
-	}
-	is.Equal("cannot set --generate-name and also specify a name", err.Error())
-
-	instAction.GenerateName = false
-	instAction.NameTemplate = "{{ . }}"
-	_, _, err = instAction.NameAndChart([]string{"foo", chartName})
-	if err == nil {
-		t.Fatal("expected an error")
-	}
-	is.Equal("cannot set --name-template and also specify a name", err.Error())
-
-	instAction.NameTemplate = ""
-	instAction.ReleaseName = ""
-	_, _, err = instAction.NameAndChart([]string{chartName})
-	if err == nil {
-		t.Fatal("expected an error")
-	}
-	is.Equal("must either provide a name or specify --generate-name", err.Error())
-}
-
-func TestNameAndChartGenerateName(t *testing.T) {
-	is := assert.New(t)
-	instAction := installAction(t)
-
-	instAction.ReleaseName = ""
-	instAction.GenerateName = true
-
-	tests := []struct {
-		Name         string
-		Chart        string
-		ExpectedName string
-	}{
-		{
-			"local filepath",
-			"./chart",
-			fmt.Sprintf("chart-%d", time.Now().Unix()),
-		},
-		{
-			"dot filepath",
-			".",
-			fmt.Sprintf("chart-%d", time.Now().Unix()),
-		},
-		{
-			"empty filepath",
-			"",
-			fmt.Sprintf("chart-%d", time.Now().Unix()),
-		},
-		{
-			"packaged chart",
-			"chart.tgz",
-			fmt.Sprintf("chart-%d", time.Now().Unix()),
-		},
-		{
-			"packaged chart with .tar.gz extension",
-			"chart.tar.gz",
-			fmt.Sprintf("chart-%d", time.Now().Unix()),
-		},
-		{
-			"packaged chart with local extension",
-			"./chart.tgz",
-			fmt.Sprintf("chart-%d", time.Now().Unix()),
-		},
-	}
-
-	for _, tc := range tests {
-		tc := tc
-		t.Run(tc.Name, func(t *testing.T) {
-			t.Parallel()
-
-			name, chrt, err := instAction.NameAndChart([]string{tc.Chart})
-			if err != nil {
-				t.Fatal(err)
-			}
-
-			is.Equal(tc.ExpectedName, name)
-			is.Equal(tc.Chart, chrt)
-		})
-	}
-}
diff --git a/pkg/repo/index_test.go b/pkg/repo/index_test.go
index bc0b45e2c..d0596c219 100644
--- a/pkg/repo/index_test.go
+++ b/pkg/repo/index_test.go
@@ -20,7 +20,6 @@ import (
 	"io/ioutil"
 	"net/http"
 	"os"
-	"strings"
 	"testing"
 
 	"helm.sh/helm/v3/pkg/cli"
@@ -41,17 +40,14 @@ func TestIndexFile(t *testing.T) {
 	i.Add(&chart.Metadata{Name: "cutter", Version: "0.1.1"}, "cutter-0.1.1.tgz", "http://example.com/charts", "sha256:1234567890abc")
 	i.Add(&chart.Metadata{Name: "cutter", Version: "0.1.0"}, "cutter-0.1.0.tgz", "http://example.com/charts", "sha256:1234567890abc")
 	i.Add(&chart.Metadata{Name: "cutter", Version: "0.2.0"}, "cutter-0.2.0.tgz", "http://example.com/charts", "sha256:1234567890abc")
-	i.Add(&chart.Metadata{Name: "setter", Version: "0.1.9+alpha"}, "setter-0.1.9+alpha.tgz", "http://example.com/charts", "sha256:1234567890abc")
-	i.Add(&chart.Metadata{Name: "setter", Version: "0.1.9+beta"}, "setter-0.1.9+beta.tgz", "http://example.com/charts", "sha256:1234567890abc")
-
 	i.SortEntries()
 
 	if i.APIVersion != APIVersionV1 {
 		t.Error("Expected API version v1")
 	}
 
-	if len(i.Entries) != 3 {
-		t.Errorf("Expected 3 charts. Got %d", len(i.Entries))
+	if len(i.Entries) != 2 {
+		t.Errorf("Expected 2 charts. Got %d", len(i.Entries))
 	}
 
 	if i.Entries["clipper"][0].Name != "clipper" {
@@ -59,23 +55,13 @@ func TestIndexFile(t *testing.T) {
 	}
 
 	if len(i.Entries["cutter"]) != 3 {
-		t.Error("Expected three cutters.")
+		t.Error("Expected two cutters.")
 	}
 
 	// Test that the sort worked. 0.2 should be at the first index for Cutter.
 	if v := i.Entries["cutter"][0].Version; v != "0.2.0" {
 		t.Errorf("Unexpected first version: %s", v)
 	}
-
-	cv, err := i.Get("setter", "0.1.9")
-	if err == nil && !strings.Contains(cv.Metadata.Version, "0.1.9") {
-		t.Errorf("Unexpected version: %s", cv.Metadata.Version)
-	}
-
-	cv, err = i.Get("setter", "0.1.9+alpha")
-	if err != nil || cv.Metadata.Version != "0.1.9+alpha" {
-		t.Errorf("Expected version: 0.1.9+alpha")
-	}
 }
 
 func TestLoadIndex(t *testing.T) {