From fbe80437a499e6b5c7301588522b03dde593ce10 Mon Sep 17 00:00:00 2001 From: Justin Scott Date: Tue, 9 Jan 2018 00:51:03 -0800 Subject: [PATCH 001/449] fix(helm): fix importValues warnings from disabled charts ImportValues incorrectly processes charts that should be disabled. This patch excludes those charts. Closes #2620 --- pkg/chartutil/requirements.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pkg/chartutil/requirements.go b/pkg/chartutil/requirements.go index ce761a6fc..546160b0c 100644 --- a/pkg/chartutil/requirements.go +++ b/pkg/chartutil/requirements.go @@ -394,6 +394,21 @@ func processImportValues(c *chart.Chart) error { b := make(map[string]interface{}, 0) // import values from each dependency if specified in import-values for _, r := range reqs.Dependencies { + // only process raw requirement that is found in chart's dependencies (enabled) + found := false + name := r.Name + for _, v := range c.Dependencies { + if v.Metadata.Name == r.Name { + found = true + } + if v.Metadata.Name == r.Alias { + found = true + name = r.Alias + } + } + if !found { + continue + } if len(r.ImportValues) > 0 { var outiv []interface{} for _, riv := range r.ImportValues { @@ -404,7 +419,7 @@ func processImportValues(c *chart.Chart) error { "parent": iv["parent"].(string), } outiv = append(outiv, nm) - s := r.Name + "." + nm["child"] + s := name + "." + nm["child"] // get child table vv, err := cvals.Table(s) if err != nil { @@ -420,7 +435,7 @@ func processImportValues(c *chart.Chart) error { "parent": ".", } outiv = append(outiv, nm) - s := r.Name + "." + nm["child"] + s := name + "." + nm["child"] vm, err := cvals.Table(s) if err != nil { log.Printf("Warning: ImportValues missing table: %v", err) From 3d05da010980fd93258d4f10ff4d0dbabe53dba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Na=CC=88gele?= Date: Mon, 22 Jan 2018 14:44:30 +0100 Subject: [PATCH 002/449] Fix pod recreation --- pkg/kube/client.go | 57 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index b1ff0de0f..2cb94cd23 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -428,40 +428,39 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, if err := target.Get(); err != nil { return fmt.Errorf("error trying to refresh resource information: %v", err) } - return nil - } - - // send patch to server - helper := resource.NewHelper(target.Client, target.Mapping) - - obj, err := helper.Patch(target.Namespace, target.Name, patchType, patch) - if err != nil { - kind := target.Mapping.GroupVersionKind.Kind - log.Printf("Cannot patch %s: %q (%v)", kind, target.Name, err) + } else { + // send patch to server + helper := resource.NewHelper(target.Client, target.Mapping) - if force { - // Attempt to delete... - if err := deleteResource(c, target); err != nil { + obj, err := helper.Patch(target.Namespace, target.Name, patchType, patch) + if err != nil { + kind := target.Mapping.GroupVersionKind.Kind + log.Printf("Cannot patch %s: %q (%v)", kind, target.Name, err) + + if force { + // Attempt to delete... + if err := deleteResource(c, target); err != nil { + return err + } + log.Printf("Deleted %s: %q", kind, target.Name) + + // ... and recreate + if err := createResource(target); err != nil { + return fmt.Errorf("Failed to recreate resource: %s", err) + } + log.Printf("Created a new %s called %q\n", kind, target.Name) + + // No need to refresh the target, as we recreated the resource based + // on it. In addition, it might not exist yet and a call to `Refresh` + // may fail. + } else { + log.Print("Use --force to force recreation of the resource") return err } - log.Printf("Deleted %s: %q", kind, target.Name) - - // ... and recreate - if err := createResource(target); err != nil { - return fmt.Errorf("Failed to recreate resource: %s", err) - } - log.Printf("Created a new %s called %q\n", kind, target.Name) - - // No need to refresh the target, as we recreated the resource based - // on it. In addition, it might not exist yet and a call to `Refresh` - // may fail. } else { - log.Print("Use --force to force recreation of the resource") - return err + // When patch succeeds without needing to recreate, refresh target. + target.Refresh(obj, true) } - } else { - // When patch succeeds without needing to recreate, refresh target. - target.Refresh(obj, true) } if !recreate { From 13c539ed7a8122231d27f577eaf1a1db5292fce4 Mon Sep 17 00:00:00 2001 From: Pure White Date: Wed, 24 Jan 2018 23:38:13 +0800 Subject: [PATCH 003/449] refactor prettyError, closes #3381 --- cmd/helm/helm.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 3810cfb8e..217764937 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -17,7 +17,6 @@ limitations under the License. package main // import "k8s.io/helm/cmd/helm" import ( - "errors" "fmt" "io/ioutil" "log" @@ -25,8 +24,8 @@ import ( "strings" "github.com/spf13/cobra" - "google.golang.org/grpc" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" @@ -209,13 +208,16 @@ func checkArgsLength(argsReceived int, requiredArgs ...string) error { // prettyError unwraps or rewrites certain errors to make them more user-friendly. func prettyError(err error) error { + // Add this check can prevent the object creation if err is nil. if err == nil { return nil } - // This is ridiculous. Why is 'grpc.rpcError' not exported? The least they - // could do is throw an interface on the lib that would let us get back - // the desc. Instead, we have to pass ALL errors through this. - return errors.New(grpc.ErrorDesc(err)) + // If it's grpc's error, make it more user-friendly. + if s, ok := status.FromError(err); ok { + return s.Err() + } + // Else return the original error. + return err } // configForContext creates a Kubernetes REST client configuration for a given kubeconfig context. From 03f35cdd32fbfc41ab49a0c1106ee0e9cbf6d520 Mon Sep 17 00:00:00 2001 From: scriptonist Date: Thu, 25 Jan 2018 15:47:54 +0530 Subject: [PATCH 004/449] docs: fixed incorrect clone path in developer docs In docs/developers.md the clone path for helm was given as $GOPATH/k8s.io. This has been changed to $GOPATH/src/k8s.io. Closes #3387 --- docs/developers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developers.md b/docs/developers.md index f6261248d..a84ce8722 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -161,10 +161,10 @@ home of the current development candidate. Releases are tagged. We accept changes to the code via GitHub Pull Requests (PRs). One workflow for doing this is as follows: -1. Go to your `$GOPATH/k8s.io` directory and `git clone` the +1. Go to your `$GOPATH/src/k8s.io` directory and `git clone` the `github.com/kubernetes/helm` repository. 2. Fork that repository into your GitHub account -3. Add your repository as a remote for `$GOPATH/k8s.io/helm` +3. Add your repository as a remote for `$GOPATH/src/k8s.io/helm` 4. Create a new working branch (`git checkout -b feat/my-feature`) and do your work on that branch. 5. When you are ready for us to review, push your branch to GitHub, and From cae4b21a3df995fe70967ea608a17216147912de Mon Sep 17 00:00:00 2001 From: "jonathan.striebel" Date: Thu, 25 Jan 2018 15:52:48 +0100 Subject: [PATCH 005/449] change child-parent title & links to fix links --- docs/charts.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/charts.md b/docs/charts.md index 5627c8600..48d7cb231 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -325,7 +325,7 @@ tooling to introspect user-settable values. The keys containing the values to be imported can be specified in the parent chart's `requirements.yaml` file using a YAML list. Each item in the list is a key which is imported from the child chart's `exports` field. -To import values not contained in the `exports` key, use the [child/parent](#using-the-child/parent-format) format. +To import values not contained in the `exports` key, use the [child-parent](#using-the-child-parent-format) format. Examples of both formats are described below. ##### Using the exports format @@ -360,9 +360,9 @@ myint: 99 ``` Please note the parent key `data` is not contained in the parent's final values. If you need to specify the -parent key, use the 'child/parent' format. +parent key, use the 'child-parent' format. -##### Using the child/parent format +##### Using the child-parent format To access values that are not contained in the `exports` key of the child chart's values, you will need to specify the source key of the values to be imported (`child`) and the destination path in the parent chart's From 4947e5aaf8a5354cfada9816e837420ff7a75ca7 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 25 Jan 2018 23:16:44 -0800 Subject: [PATCH 006/449] fix helm init --upgrade logic --- cmd/helm/installer/install.go | 25 ++++-- cmd/helm/installer/install_test.go | 123 +++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 8 deletions(-) diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index f2c0d232d..230c7b39b 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -63,8 +63,8 @@ func Upgrade(client kubernetes.Interface, opts *Options) error { if err != nil { return err } - existingImage := obj.Spec.Template.Spec.Containers[0].Image - if !isNewerVersion(existingImage) && !opts.ForceUpgrade { + tillerImage := obj.Spec.Template.Spec.Containers[0].Image + if semverCompare(tillerImage) == -1 && !opts.ForceUpgrade { return errors.New("current Tiller version is newer, use --force-upgrade to downgrade") } obj.Spec.Template.Spec.Containers[0].Image = opts.selectImage() @@ -82,15 +82,24 @@ func Upgrade(client kubernetes.Interface, opts *Options) error { return err } -// isNewerVersion returns whether the current version is newer than the give image's version -func isNewerVersion(image string) bool { +// semverCompare returns whether the client's version is older, equal or newer than the given image's version. +func semverCompare(image string) int { split := strings.Split(image, ":") if len(split) < 2 { - // If we don't know the version, we consider the current version newer - return true + // If we don't know the version, we consider the client version newer. + return 1 } - imageVersion := split[1] - return semver.MustParse(version.Version).GreaterThan(semver.MustParse(imageVersion)) + tillerVersion, err := semver.NewVersion(split[1]) + if err != nil { + // same thing with unparsable tiller versions (e.g. canary releases). + return 1 + } + clientVersion, err := semver.NewVersion(version.Version) + if err != nil { + // aaaaaand same thing with unparsable helm versions (e.g. canary releases). + return 1 + } + return clientVersion.Compare(tillerVersion) } // createDeployment creates the Tiller Deployment resource. diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index 4a6f5f8eb..eaea05870 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -476,6 +476,129 @@ func TestUgrade_newerVersion(t *testing.T) { } } +func TestUpgrade_identical(t *testing.T) { + image := "gcr.io/kubernetes-helm/tiller:v2.0.0" + serviceAccount := "newServiceAccount" + existingDeployment, _ := deployment(&Options{ + Namespace: v1.NamespaceDefault, + ImageSpec: "imageToReplace:v2.0.0", + ServiceAccount: "serviceAccountToReplace", + UseCanary: false, + }) + existingService := service(v1.NamespaceDefault) + + fc := &fake.Clientset{} + fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { + return true, existingDeployment, nil + }) + fc.AddReactor("update", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { + obj := action.(testcore.UpdateAction).GetObject().(*v1beta1.Deployment) + i := obj.Spec.Template.Spec.Containers[0].Image + if i != image { + t.Errorf("expected image = '%s', got '%s'", image, i) + } + sa := obj.Spec.Template.Spec.ServiceAccountName + if sa != serviceAccount { + t.Errorf("expected serviceAccountName = '%s', got '%s'", serviceAccount, sa) + } + return true, obj, nil + }) + fc.AddReactor("get", "services", func(action testcore.Action) (bool, runtime.Object, error) { + return true, existingService, nil + }) + + opts := &Options{Namespace: v1.NamespaceDefault, ImageSpec: image, ServiceAccount: serviceAccount} + if err := Upgrade(fc, opts); err != nil { + t.Errorf("unexpected error: %#+v", err) + } + + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) + } +} + +func TestUpgrade_canaryClient(t *testing.T) { + image := "gcr.io/kubernetes-helm/tiller:canary" + serviceAccount := "newServiceAccount" + existingDeployment, _ := deployment(&Options{ + Namespace: v1.NamespaceDefault, + ImageSpec: "imageToReplace:v1.0.0", + ServiceAccount: "serviceAccountToReplace", + UseCanary: false, + }) + existingService := service(v1.NamespaceDefault) + + fc := &fake.Clientset{} + fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { + return true, existingDeployment, nil + }) + fc.AddReactor("update", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { + obj := action.(testcore.UpdateAction).GetObject().(*v1beta1.Deployment) + i := obj.Spec.Template.Spec.Containers[0].Image + if i != image { + t.Errorf("expected image = '%s', got '%s'", image, i) + } + sa := obj.Spec.Template.Spec.ServiceAccountName + if sa != serviceAccount { + t.Errorf("expected serviceAccountName = '%s', got '%s'", serviceAccount, sa) + } + return true, obj, nil + }) + fc.AddReactor("get", "services", func(action testcore.Action) (bool, runtime.Object, error) { + return true, existingService, nil + }) + + opts := &Options{Namespace: v1.NamespaceDefault, ImageSpec: image, ServiceAccount: serviceAccount} + if err := Upgrade(fc, opts); err != nil { + t.Errorf("unexpected error: %#+v", err) + } + + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) + } +} + +func TestUpgrade_canaryServer(t *testing.T) { + image := "gcr.io/kubernetes-helm/tiller:v2.0.0" + serviceAccount := "newServiceAccount" + existingDeployment, _ := deployment(&Options{ + Namespace: v1.NamespaceDefault, + ImageSpec: "imageToReplace:canary", + ServiceAccount: "serviceAccountToReplace", + UseCanary: false, + }) + existingService := service(v1.NamespaceDefault) + + fc := &fake.Clientset{} + fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { + return true, existingDeployment, nil + }) + fc.AddReactor("update", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { + obj := action.(testcore.UpdateAction).GetObject().(*v1beta1.Deployment) + i := obj.Spec.Template.Spec.Containers[0].Image + if i != image { + t.Errorf("expected image = '%s', got '%s'", image, i) + } + sa := obj.Spec.Template.Spec.ServiceAccountName + if sa != serviceAccount { + t.Errorf("expected serviceAccountName = '%s', got '%s'", serviceAccount, sa) + } + return true, obj, nil + }) + fc.AddReactor("get", "services", func(action testcore.Action) (bool, runtime.Object, error) { + return true, existingService, nil + }) + + opts := &Options{Namespace: v1.NamespaceDefault, ImageSpec: image, ServiceAccount: serviceAccount} + if err := Upgrade(fc, opts); err != nil { + t.Errorf("unexpected error: %#+v", err) + } + + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) + } +} + func tlsTestFile(t *testing.T, path string) string { const tlsTestDir = "../../../testdata" path = filepath.Join(tlsTestDir, path) From f13c4d28b5d4b93e2b9f2586d78657e43b192311 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 25 Jan 2018 23:32:42 -0800 Subject: [PATCH 007/449] Revert "feat(helm): adding kubeconfig flag" This reverts commit 371ff8f26deaf57556b35dd6c0378950ae07422e. --- cmd/helm/helm.go | 2 +- cmd/helm/install.go | 2 +- docs/helm/helm.md | 3 +-- docs/helm/helm_completion.md | 3 +-- docs/helm/helm_create.md | 3 +-- docs/helm/helm_delete.md | 3 +-- docs/helm/helm_dependency.md | 3 +-- docs/helm/helm_dependency_build.md | 3 +-- docs/helm/helm_dependency_list.md | 3 +-- docs/helm/helm_dependency_update.md | 3 +-- docs/helm/helm_fetch.md | 3 +-- docs/helm/helm_get.md | 3 +-- docs/helm/helm_get_hooks.md | 3 +-- docs/helm/helm_get_manifest.md | 3 +-- docs/helm/helm_get_values.md | 3 +-- docs/helm/helm_history.md | 3 +-- docs/helm/helm_home.md | 3 +-- docs/helm/helm_init.md | 3 +-- docs/helm/helm_inspect.md | 3 +-- docs/helm/helm_inspect_chart.md | 3 +-- docs/helm/helm_inspect_values.md | 3 +-- docs/helm/helm_install.md | 3 +-- docs/helm/helm_lint.md | 3 +-- docs/helm/helm_list.md | 3 +-- docs/helm/helm_package.md | 3 +-- docs/helm/helm_plugin.md | 3 +-- docs/helm/helm_plugin_install.md | 3 +-- docs/helm/helm_plugin_list.md | 3 +-- docs/helm/helm_plugin_remove.md | 3 +-- docs/helm/helm_plugin_update.md | 3 +-- docs/helm/helm_repo.md | 3 +-- docs/helm/helm_repo_add.md | 3 +-- docs/helm/helm_repo_index.md | 3 +-- docs/helm/helm_repo_list.md | 3 +-- docs/helm/helm_repo_remove.md | 3 +-- docs/helm/helm_repo_update.md | 3 +-- docs/helm/helm_reset.md | 3 +-- docs/helm/helm_rollback.md | 3 +-- docs/helm/helm_search.md | 3 +-- docs/helm/helm_serve.md | 3 +-- docs/helm/helm_status.md | 3 +-- docs/helm/helm_template.md | 3 +-- docs/helm/helm_test.md | 3 +-- docs/helm/helm_upgrade.md | 3 +-- docs/helm/helm_verify.md | 3 +-- docs/helm/helm_version.md | 3 +-- pkg/helm/environment/environment.go | 4 ---- pkg/kube/config.go | 7 +------ 48 files changed, 47 insertions(+), 100 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 3810cfb8e..fa916b1f2 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -220,7 +220,7 @@ func prettyError(err error) error { // configForContext creates a Kubernetes REST client configuration for a given kubeconfig context. func configForContext(context string) (*rest.Config, error) { - config, err := kube.GetConfig(context, settings.KubeConfig).ClientConfig() + config, err := kube.GetConfig(context).ClientConfig() if err != nil { return nil, fmt.Errorf("could not get Kubernetes config for context %q: %s", context, err) } diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 867c645bb..8f849a15b 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -460,7 +460,7 @@ func generateName(nameTemplate string) (string, error) { } func defaultNamespace() string { - if ns, _, err := kube.GetConfig(settings.KubeContext, settings.KubeConfig).Namespace(); err == nil { + if ns, _, err := kube.GetConfig(settings.KubeContext).Namespace(); err == nil { return ns } return "default" diff --git a/docs/helm/helm.md b/docs/helm/helm.md index caa4301a0..d3c63f56a 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -36,7 +36,6 @@ Environment: --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -68,4 +67,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_completion.md b/docs/helm/helm_completion.md index 9fe91d52a..cef6a8631 100644 --- a/docs/helm/helm_completion.md +++ b/docs/helm/helm_completion.md @@ -28,11 +28,10 @@ helm completion SHELL --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index fa047ee23..636141661 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -47,11 +47,10 @@ helm create NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index bf3adb6b2..26ac5fdac 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -38,11 +38,10 @@ helm delete [flags] RELEASE_NAME [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_dependency.md b/docs/helm/helm_dependency.md index 673c2c384..05b114b34 100644 --- a/docs/helm/helm_dependency.md +++ b/docs/helm/helm_dependency.md @@ -61,7 +61,6 @@ for this case. --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -71,4 +70,4 @@ for this case. * [helm dependency list](helm_dependency_list.md) - list the dependencies for the given chart * [helm dependency update](helm_dependency_update.md) - update charts/ based on the contents of requirements.yaml -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_dependency_build.md b/docs/helm/helm_dependency_build.md index 0c9d1f97b..70aae9a96 100644 --- a/docs/helm/helm_dependency_build.md +++ b/docs/helm/helm_dependency_build.md @@ -34,11 +34,10 @@ helm dependency build [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_dependency_list.md b/docs/helm/helm_dependency_list.md index a558356be..be5daec44 100644 --- a/docs/helm/helm_dependency_list.md +++ b/docs/helm/helm_dependency_list.md @@ -26,11 +26,10 @@ helm dependency list [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_dependency_update.md b/docs/helm/helm_dependency_update.md index 191a69644..94ddee3c5 100644 --- a/docs/helm/helm_dependency_update.md +++ b/docs/helm/helm_dependency_update.md @@ -39,11 +39,10 @@ helm dependency update [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_fetch.md b/docs/helm/helm_fetch.md index 5b4127c0a..9c8a4ec36 100644 --- a/docs/helm/helm_fetch.md +++ b/docs/helm/helm_fetch.md @@ -48,11 +48,10 @@ helm fetch [flags] [chart URL | repo/chartname] [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index ce6718b28..5b148b564 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -40,7 +40,6 @@ helm get [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -50,4 +49,4 @@ helm get [flags] RELEASE_NAME * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_get_hooks.md b/docs/helm/helm_get_hooks.md index a2fb36acd..c39c73888 100644 --- a/docs/helm/helm_get_hooks.md +++ b/docs/helm/helm_get_hooks.md @@ -33,11 +33,10 @@ helm get hooks [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 15-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_get_manifest.md b/docs/helm/helm_get_manifest.md index 1cf712d9b..144f7bf87 100644 --- a/docs/helm/helm_get_manifest.md +++ b/docs/helm/helm_get_manifest.md @@ -35,11 +35,10 @@ helm get manifest [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 15-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index 1e57a2303..eadc56a67 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -32,11 +32,10 @@ helm get values [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 15-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index d9edd85c0..119e58b69 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -44,11 +44,10 @@ helm history [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 10-Jan-2018 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_home.md b/docs/helm/helm_home.md index 069f6a162..855090a20 100644 --- a/docs/helm/helm_home.md +++ b/docs/helm/helm_home.md @@ -21,11 +21,10 @@ helm home --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index 5140a0621..856e9b565 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -63,11 +63,10 @@ helm init --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 9-Jan-2018 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index 7fc56cacc..006da7478 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -35,7 +35,6 @@ helm inspect [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -44,4 +43,4 @@ helm inspect [CHART] * [helm inspect chart](helm_inspect_chart.md) - shows inspect chart * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index e1e88fbbe..37d0eb4af 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -33,11 +33,10 @@ helm inspect chart [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index 348336b8f..2079849ff 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -33,11 +33,10 @@ helm inspect values [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index f3a8ee06d..da9b91bb8 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -102,11 +102,10 @@ helm install [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 23-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index 8ab2d9e7d..8167a46cc 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -34,11 +34,10 @@ helm lint [flags] PATH --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index 733655cb8..1ba60b912 100755 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -66,11 +66,10 @@ helm list [flags] [FILTER] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 10-Jan-2018 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index 71960f41e..85da8315e 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -40,11 +40,10 @@ helm package [flags] [CHART_PATH] [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 24-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_plugin.md b/docs/helm/helm_plugin.md index 5a636724c..f8e04f1a5 100644 --- a/docs/helm/helm_plugin.md +++ b/docs/helm/helm_plugin.md @@ -16,7 +16,6 @@ Manage client-side Helm plugins. --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -27,4 +26,4 @@ Manage client-side Helm plugins. * [helm plugin remove](helm_plugin_remove.md) - remove one or more Helm plugins * [helm plugin update](helm_plugin_update.md) - update one or more Helm plugins -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_plugin_install.md b/docs/helm/helm_plugin_install.md index f93378b7b..beb478845 100644 --- a/docs/helm/helm_plugin_install.md +++ b/docs/helm/helm_plugin_install.md @@ -29,11 +29,10 @@ helm plugin install [options] ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 20-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_plugin_list.md b/docs/helm/helm_plugin_list.md index 403ef1a6f..d363ae9b6 100644 --- a/docs/helm/helm_plugin_list.md +++ b/docs/helm/helm_plugin_list.md @@ -18,11 +18,10 @@ helm plugin list --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_plugin_remove.md b/docs/helm/helm_plugin_remove.md index 6c4530ce1..55f62514d 100644 --- a/docs/helm/helm_plugin_remove.md +++ b/docs/helm/helm_plugin_remove.md @@ -18,11 +18,10 @@ helm plugin remove ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_plugin_update.md b/docs/helm/helm_plugin_update.md index cbfe9ad5e..26a6ad270 100644 --- a/docs/helm/helm_plugin_update.md +++ b/docs/helm/helm_plugin_update.md @@ -18,11 +18,10 @@ helm plugin update ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_repo.md b/docs/helm/helm_repo.md index 3f184e875..a700f7aab 100644 --- a/docs/helm/helm_repo.md +++ b/docs/helm/helm_repo.md @@ -20,7 +20,6 @@ Example usage: --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -32,4 +31,4 @@ Example usage: * [helm repo remove](helm_repo_remove.md) - remove a chart repository * [helm repo update](helm_repo_update.md) - update information of available charts locally from chart repositories -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_repo_add.md b/docs/helm/helm_repo_add.md index c16797c63..7137c2c51 100644 --- a/docs/helm/helm_repo_add.md +++ b/docs/helm/helm_repo_add.md @@ -27,11 +27,10 @@ helm repo add [flags] [NAME] [URL] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_repo_index.md b/docs/helm/helm_repo_index.md index aece31367..7ddcf068f 100644 --- a/docs/helm/helm_repo_index.md +++ b/docs/helm/helm_repo_index.md @@ -34,11 +34,10 @@ helm repo index [flags] [DIR] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_repo_list.md b/docs/helm/helm_repo_list.md index 484ce3c68..2285a3c6e 100644 --- a/docs/helm/helm_repo_list.md +++ b/docs/helm/helm_repo_list.md @@ -18,11 +18,10 @@ helm repo list [flags] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_repo_remove.md b/docs/helm/helm_repo_remove.md index b34cee61c..d23980e73 100644 --- a/docs/helm/helm_repo_remove.md +++ b/docs/helm/helm_repo_remove.md @@ -18,11 +18,10 @@ helm repo remove [flags] [NAME] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_repo_update.md b/docs/helm/helm_repo_update.md index 0c9fb6efd..00dc6d9e2 100644 --- a/docs/helm/helm_repo_update.md +++ b/docs/helm/helm_repo_update.md @@ -24,11 +24,10 @@ helm repo update --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index dfb78c376..74a787bdc 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -34,11 +34,10 @@ helm reset --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index a2fedc559..3bd4af8bf 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -40,11 +40,10 @@ helm rollback [flags] [RELEASE] [REVISION] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_search.md b/docs/helm/helm_search.md index 1dc7e38ba..247b83f42 100644 --- a/docs/helm/helm_search.md +++ b/docs/helm/helm_search.md @@ -31,11 +31,10 @@ helm search [keyword] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index 4ce8a997a..163b24e76 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -39,11 +39,10 @@ helm serve --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_status.md b/docs/helm/helm_status.md index 52881896c..b878277ac 100644 --- a/docs/helm/helm_status.md +++ b/docs/helm/helm_status.md @@ -39,11 +39,10 @@ helm status [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Dec-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index f850fa4a8..347ba2ab4 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -43,11 +43,10 @@ helm template [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jan-2018 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index b46d43e64..89436ed60 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -35,11 +35,10 @@ helm test [RELEASE] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 5f4fde96c..290fe5921 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -70,11 +70,10 @@ helm upgrade [RELEASE] [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_verify.md b/docs/helm/helm_verify.md index 74c3ee488..2c65b3092 100644 --- a/docs/helm/helm_verify.md +++ b/docs/helm/helm_verify.md @@ -33,11 +33,10 @@ helm verify [flags] PATH --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index 1e46ceb18..18f9d261e 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -47,11 +47,10 @@ helm version --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use - --kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Nov-2017 +###### Auto generated by spf13/cobra on 25-Jan-2018 diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index b8bcf0def..49d424b33 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -47,8 +47,6 @@ type EnvSettings struct { Debug bool // KubeContext is the name of the kubeconfig context. KubeContext string - // KubeConfig is the name of the kubeconfig file. - KubeConfig string } // AddFlags binds flags to the given flagset. @@ -56,7 +54,6 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.StringVar((*string)(&s.Home), "home", DefaultHelmHome, "location of your Helm config. Overrides $HELM_HOME") fs.StringVar(&s.TillerHost, "host", "", "address of Tiller. Overrides $HELM_HOST") fs.StringVar(&s.KubeContext, "kube-context", "", "name of the kubeconfig context to use") - fs.StringVar(&s.KubeConfig, "kubeconfig", "", "path to kubeconfig file. Overrides $KUBECONFIG") fs.BoolVar(&s.Debug, "debug", false, "enable verbose output") fs.StringVar(&s.TillerNamespace, "tiller-namespace", "kube-system", "namespace of Tiller") } @@ -81,7 +78,6 @@ var envMap = map[string]string{ "debug": "HELM_DEBUG", "home": "HELM_HOME", "host": "HELM_HOST", - "kubeconfig": "KUBECONFIG", "tiller-namespace": "TILLER_NAMESPACE", } diff --git a/pkg/kube/config.go b/pkg/kube/config.go index 541d4eba6..b6560486e 100644 --- a/pkg/kube/config.go +++ b/pkg/kube/config.go @@ -19,7 +19,7 @@ package kube // import "k8s.io/helm/pkg/kube" import "k8s.io/client-go/tools/clientcmd" // GetConfig returns a Kubernetes client config for a given context. -func GetConfig(context string, kubeconfig string) clientcmd.ClientConfig { +func GetConfig(context string) clientcmd.ClientConfig { rules := clientcmd.NewDefaultClientConfigLoadingRules() rules.DefaultClientConfig = &clientcmd.DefaultClientConfig @@ -28,10 +28,5 @@ func GetConfig(context string, kubeconfig string) clientcmd.ClientConfig { if context != "" { overrides.CurrentContext = context } - - if kubeconfig != "" { - rules.ExplicitPath = kubeconfig - } - return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides) } From 588336b241566b0437247775c5a7e19d7933b746 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Fri, 26 Jan 2018 18:44:05 +0800 Subject: [PATCH 008/449] Fix typo --- docs/kubernetes_distros.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/kubernetes_distros.md b/docs/kubernetes_distros.md index ffba89384..04a86d0b4 100644 --- a/docs/kubernetes_distros.md +++ b/docs/kubernetes_distros.md @@ -42,4 +42,4 @@ Helm works straightforward on OpenShift Online, OpenShift Dedicated, OpenShift C ## Platform9 -Helm Client and Helm Server (Tiller) are pre-installed with [Platform9 Managed Kubernetes](https://platform9.com/managed-kubernetes/?utm_source=helm_distro_notes). Platform9 provides access to all official Helm charts through the App Catalog UI and native Kubernetes CLI. Additional repositories can be manually added. Further details are availble in this [Platform9 App Catalog article](https://platform9.com/support/deploying-kubernetes-apps-platform9-managed-kubernetes/?utm_source=helm_distro_notes). \ No newline at end of file +Helm Client and Helm Server (Tiller) are pre-installed with [Platform9 Managed Kubernetes](https://platform9.com/managed-kubernetes/?utm_source=helm_distro_notes). Platform9 provides access to all official Helm charts through the App Catalog UI and native Kubernetes CLI. Additional repositories can be manually added. Further details are available in this [Platform9 App Catalog article](https://platform9.com/support/deploying-kubernetes-apps-platform9-managed-kubernetes/?utm_source=helm_distro_notes). From ea520afd3e4d0eb3637a10b7443ca83bcaf340e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Na=CC=88gele?= Date: Sat, 27 Jan 2018 11:18:41 +0100 Subject: [PATCH 009/449] Fix 'getSelectorFromObject' --- pkg/kube/client.go | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 2cb94cd23..6b911c8a0 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -27,10 +27,12 @@ import ( "time" jsonpatch "github.com/evanphx/json-patch" - apps "k8s.io/api/apps/v1beta2" + appsv1 "k8s.io/api/apps/v1" + appsv1beta1 "k8s.io/api/apps/v1beta1" + appsv1beta2 "k8s.io/api/apps/v1beta2" batch "k8s.io/api/batch/v1" "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" + extv1beta1 "k8s.io/api/extensions/v1beta1" apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" @@ -507,18 +509,41 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, func getSelectorFromObject(obj runtime.Object) (map[string]string, error) { switch typed := obj.(type) { + case *v1.ReplicationController: return typed.Spec.Selector, nil - case *v1beta1.ReplicaSet: + + case *extv1beta1.ReplicaSet: + return typed.Spec.Selector.MatchLabels, nil + case *appsv1.ReplicaSet: + return typed.Spec.Selector.MatchLabels, nil + + case *extv1beta1.Deployment: + return typed.Spec.Selector.MatchLabels, nil + case *appsv1beta1.Deployment: return typed.Spec.Selector.MatchLabels, nil - case *v1beta1.Deployment: + case *appsv1beta2.Deployment: return typed.Spec.Selector.MatchLabels, nil - case *v1beta1.DaemonSet: + case *appsv1.Deployment: + return typed.Spec.Selector.MatchLabels, nil + + case *extv1beta1.DaemonSet: return typed.Spec.Selector.MatchLabels, nil + case *appsv1beta2.DaemonSet: + return typed.Spec.Selector.MatchLabels, nil + case *appsv1.DaemonSet: + return typed.Spec.Selector.MatchLabels, nil + case *batch.Job: return typed.Spec.Selector.MatchLabels, nil - case *apps.StatefulSet: + + case *appsv1beta1.StatefulSet: return typed.Spec.Selector.MatchLabels, nil + case *appsv1beta2.StatefulSet: + return typed.Spec.Selector.MatchLabels, nil + case *appsv1.StatefulSet: + return typed.Spec.Selector.MatchLabels, nil + default: return nil, fmt.Errorf("Unsupported kind when getting selector: %v", obj) } From e4d84bae2ca9a16ae5e870c6c0fa2cd4440daeba Mon Sep 17 00:00:00 2001 From: Oilbeater Date: Mon, 29 Jan 2018 16:51:16 +0800 Subject: [PATCH 010/449] Update Makefile Remove symbol table and debug info from go binary to reduce image size --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a5bdf1b8f..5801bcdbf 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PKG := $(shell glide novendor) TAGS := TESTS := . TESTFLAGS := -LDFLAGS := +LDFLAGS := -w -s GOFLAGS := BINDIR := $(CURDIR)/bin BINARIES := helm tiller From 67c190af28a2ae5b530969b3a0319d648887b78d Mon Sep 17 00:00:00 2001 From: Arnaud Rinquin Date: Mon, 29 Jan 2018 14:42:40 -0800 Subject: [PATCH 011/449] doc(tips): Add an exception to tip about quoting integers Add a sentence to balance the advice about not quoting integers as it can cause headaches when applied to env variables. --- docs/charts_tips_and_tricks.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index b1df146db..f6b482963 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -52,6 +52,16 @@ many cases, cause parsing errors inside of Kubernetes. port: {{ .Values.Port }} ``` +This remark does not apply to env variables values which are expected to be string, even if they represent integers: + +``` +env: + -name: HOST + value: "http://host" + -name: PORT + value: "1234" +``` + ## Using the 'include' Function Go provides a way of including one template in another using a built-in From a93fd47d1bcdc41b1172cf0391118adf9c771543 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Fri, 2 Feb 2018 14:59:59 -0800 Subject: [PATCH 012/449] ref(glide): remove need for scripts/setup-apimachinery.sh (#3446) --- Makefile | 1 - glide.lock | 78 ++++++++++++++++++++++++++++------- glide.yaml | 20 +++++---- scripts/setup-apimachinery.sh | 24 ----------- 4 files changed, 74 insertions(+), 49 deletions(-) delete mode 100755 scripts/setup-apimachinery.sh diff --git a/Makefile b/Makefile index a5bdf1b8f..9c780f7ec 100644 --- a/Makefile +++ b/Makefile @@ -139,6 +139,5 @@ ifndef HAS_HG endif glide install --strip-vendor go build -o bin/protoc-gen-go ./vendor/github.com/golang/protobuf/protoc-gen-go - scripts/setup-apimachinery.sh include versioning.mk diff --git a/glide.lock b/glide.lock index 4821be9f0..e14766948 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 5d2ef5e5355854c577bb3f4844228c90548629959c4c0666952bea502b14bf0f -updated: 2018-01-04T22:28:37.378122Z +hash: c4a1f6e380baf38d371d428fa5c8f7b2363663d811c728e982300692287a58e4 +updated: 2018-02-02T20:15:49.706602Z imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -52,7 +52,7 @@ imports: subpackages: - winterm - name: github.com/Azure/go-autorest - version: 58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d + version: e14a70c556c8e0db173358d1a903dca345a8e75e subpackages: - autorest - autorest/adal @@ -128,8 +128,6 @@ imports: version: ff4f55a206334ef123e4f79bbf348980da81ca46 subpackages: - log -- name: github.com/emicklei/go-restful-swagger12 - version: dcef7f55730566d41eae5db10e7d6981829720f6 - name: github.com/evanphx/json-patch version: 944e07253867aacae43c04b2e6a239005443f33a - name: github.com/exponent-io/jsonpath @@ -145,9 +143,9 @@ imports: - name: github.com/go-openapi/jsonreference version: 13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272 - name: github.com/go-openapi/spec - version: 6aced65f8501fe1217321abf0749d354824ba2ff + version: 7abd5745472fff5eb3685386d5fb8bf38683154d - name: github.com/go-openapi/swag - version: 1d0bd113de87027671077d3c71eb3ac5d7dbba72 + version: f3f9494671f93fcff853e3c6e9e948b3eb71e590 - name: github.com/gobwas/glob version: bea32b9cd2d6f55753d94a28e959b13f0244797a subpackages: @@ -188,7 +186,7 @@ imports: - compiler - extensions - name: github.com/gophercloud/gophercloud - version: 2bf16b94fdd9b01557c4d076e567fe5cbbe5a961 + version: 8183543f90d1aef267a5ecc209f2e0715b355acb subpackages: - openstack - openstack/identity/v2/tenants @@ -226,7 +224,7 @@ imports: - name: github.com/juju/ratelimit version: 5b9ff866471762aa2ab2dced63c9fb6f53921342 - name: github.com/mailru/easyjson - version: d5b7844b561a7bc640052f1b935f7b800330d7e0 + version: 2f5df55504ebc322e4d52d34df6a1f5b503bf26d subpackages: - buffer - jlexer @@ -286,7 +284,7 @@ imports: - name: github.com/russross/blackfriday version: 300106c228d52c8941d4b3de6054a6062a86dda3 - name: github.com/satori/go.uuid - version: 879c5887cd475cd7864858769793b2ceb0d44feb + version: f58768cc1a7a7e77a3bd49e98cdd21419399b6a3 - name: github.com/shurcooL/sanitized_anchor_name version: 10ef21a441db47d8b13ebcc5fd2310f636973c77 - name: github.com/sirupsen/logrus @@ -402,12 +400,45 @@ imports: version: 8a331561fe74dadba6edfc59f3be66c22c3b065d - name: gopkg.in/yaml.v2 version: 53feefa2559fb8dfa8d81baad31be332c97d6c77 +- name: k8s.io/api + version: 006a217681ae70cbacdd66a5e2fca1a61a8ff28e + subpackages: + - admission/v1beta1 + - admissionregistration/v1alpha1 + - admissionregistration/v1beta1 + - apps/v1 + - apps/v1beta1 + - apps/v1beta2 + - authentication/v1 + - authentication/v1beta1 + - authorization/v1 + - authorization/v1beta1 + - autoscaling/v1 + - autoscaling/v2beta1 + - batch/v1 + - batch/v1beta1 + - batch/v2alpha1 + - certificates/v1beta1 + - core/v1 + - events/v1beta1 + - extensions/v1beta1 + - imagepolicy/v1alpha1 + - networking/v1 + - policy/v1beta1 + - rbac/v1 + - rbac/v1alpha1 + - rbac/v1beta1 + - scheduling/v1alpha1 + - settings/v1alpha1 + - storage/v1 + - storage/v1alpha1 + - storage/v1beta1 - name: k8s.io/apiextensions-apiserver version: a5bbfd114a9b122acd741c61d88c84812375d9e1 subpackages: - pkg/features - name: k8s.io/apimachinery - version: 3b05bbfa0a45413bfa184edbf9af617e277962fb + version: 68f9c3a1feb3140df59c67ced62d3a5df8e6c9c2 subpackages: - pkg/api/equality - pkg/api/errors @@ -424,7 +455,6 @@ imports: - pkg/apis/meta/v1alpha1 - pkg/conversion - pkg/conversion/queryparams - - pkg/conversion/unstructured - pkg/fields - pkg/labels - pkg/runtime @@ -464,7 +494,7 @@ imports: - third_party/forked/golang/netutil - third_party/forked/golang/reflect - name: k8s.io/apiserver - version: c1e53d745d0fe45bf7d5d44697e6eface25fceca + version: 2a1092aaa7202e8f9b188281ff9424a014ce61c2 subpackages: - pkg/apis/audit - pkg/authentication/authenticator @@ -475,7 +505,7 @@ imports: - pkg/util/feature - pkg/util/flag - name: k8s.io/client-go - version: 82aa063804cf055e16e8911250f888bc216e8b61 + version: 78700dec6369ba22221b72770783300f143df150 subpackages: - discovery - discovery/fake @@ -483,7 +513,9 @@ imports: - informers - informers/admissionregistration - informers/admissionregistration/v1alpha1 + - informers/admissionregistration/v1beta1 - informers/apps + - informers/apps/v1 - informers/apps/v1beta1 - informers/apps/v1beta2 - informers/autoscaling @@ -497,6 +529,8 @@ imports: - informers/certificates/v1beta1 - informers/core - informers/core/v1 + - informers/events + - informers/events/v1beta1 - informers/extensions - informers/extensions/v1beta1 - informers/internalinterfaces @@ -514,12 +548,17 @@ imports: - informers/settings/v1alpha1 - informers/storage - informers/storage/v1 + - informers/storage/v1alpha1 - informers/storage/v1beta1 - kubernetes - kubernetes/fake - kubernetes/scheme - kubernetes/typed/admissionregistration/v1alpha1 - kubernetes/typed/admissionregistration/v1alpha1/fake + - kubernetes/typed/admissionregistration/v1beta1 + - kubernetes/typed/admissionregistration/v1beta1/fake + - kubernetes/typed/apps/v1 + - kubernetes/typed/apps/v1/fake - kubernetes/typed/apps/v1beta1 - kubernetes/typed/apps/v1beta1/fake - kubernetes/typed/apps/v1beta2 @@ -546,6 +585,8 @@ imports: - kubernetes/typed/certificates/v1beta1/fake - kubernetes/typed/core/v1 - kubernetes/typed/core/v1/fake + - kubernetes/typed/events/v1beta1 + - kubernetes/typed/events/v1beta1/fake - kubernetes/typed/extensions/v1beta1 - kubernetes/typed/extensions/v1beta1/fake - kubernetes/typed/networking/v1 @@ -564,9 +605,13 @@ imports: - kubernetes/typed/settings/v1alpha1/fake - kubernetes/typed/storage/v1 - kubernetes/typed/storage/v1/fake + - kubernetes/typed/storage/v1alpha1 + - kubernetes/typed/storage/v1alpha1/fake - kubernetes/typed/storage/v1beta1 - kubernetes/typed/storage/v1beta1/fake - listers/admissionregistration/v1alpha1 + - listers/admissionregistration/v1beta1 + - listers/apps/v1 - listers/apps/v1beta1 - listers/apps/v1beta2 - listers/autoscaling/v1 @@ -576,6 +621,7 @@ imports: - listers/batch/v2alpha1 - listers/certificates/v1beta1 - listers/core/v1 + - listers/events/v1beta1 - listers/extensions/v1beta1 - listers/networking/v1 - listers/policy/v1beta1 @@ -585,6 +631,7 @@ imports: - listers/scheduling/v1alpha1 - listers/settings/v1alpha1 - listers/storage/v1 + - listers/storage/v1alpha1 - listers/storage/v1beta1 - pkg/version - plugin/pkg/client/auth @@ -611,6 +658,7 @@ imports: - tools/remotecommand - transport - transport/spdy + - util/buffer - util/cert - util/exec - util/flowcontrol @@ -626,7 +674,7 @@ imports: - pkg/util/proto - pkg/util/proto/validation - name: k8s.io/kubernetes - version: 3a1c9449a956b6026f075fa3134ff92f7d55f812 + version: 5fa2db2bd46ac79e5e00a4e6ed24191080aa463b subpackages: - pkg/api/events - pkg/api/legacyscheme diff --git a/glide.yaml b/glide.yaml index 1f07f6182..81bb8ebe1 100644 --- a/glide.yaml +++ b/glide.yaml @@ -9,7 +9,6 @@ import: version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7 - package: github.com/Masterminds/vcs version: ~1.11.0 - # Pin version of mergo that is compatible with both sprig and Kubernetes - package: github.com/imdario/mergo version: 6633656539c1639d9d78127b7d47c622b5d7b6dc @@ -27,15 +26,13 @@ import: - ptypes/timestamp - package: google.golang.org/grpc version: 1.7.2 -- package: k8s.io/kubernetes - version: ~1.9.0 - package: github.com/gosuri/uitable - package: github.com/asaskevich/govalidator version: ^4.0.0 - package: golang.org/x/crypto subpackages: - openpgp - # pin version of golang.org/x/sys that is compatible with golang.org/x/crypto +# pin version of golang.org/x/sys that is compatible with golang.org/x/crypto - package: golang.org/x/sys version: 43eea11 subpackages: @@ -55,15 +52,20 @@ import: repo: https://github.com/fvbommel/util.git vcs: git -- package: k8s.io/kube-openapi - version: 39a7bf85c140f972372c2a0d1ee40adbf0c8bfe1 +- package: k8s.io/kubernetes + version: ~1.9.2 +- package: k8s.io/client-go + version: ~6.0.0 +- package: k8s.io/api + version: kubernetes-1.9.2 +- package: k8s.io/apimachinery + version: kubernetes-1.9.2 +- package: k8s.io/apiserver + version: kubernetes-1.9.2 - package: cloud.google.com/go/compute repo: https://github.com/GoogleCloudPlatform/google-cloud-go.git -ignore: - - k8s.io/api - testImports: - package: github.com/stretchr/testify version: ^1.1.4 diff --git a/scripts/setup-apimachinery.sh b/scripts/setup-apimachinery.sh deleted file mode 100755 index e6b2808a2..000000000 --- a/scripts/setup-apimachinery.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2016 The Kubernetes Authors All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Copies the current versions of apimachinery and client-go out of the -# main kubernetes repo. These repos are currently out of sync and not -# versioned. -set -euo pipefail - -rm -rf ./vendor/k8s.io/{api,kube-aggregator,apiserver,apimachinery,client-go,metrics} - -cp -r ./vendor/k8s.io/kubernetes/staging/src/k8s.io/{api,kube-aggregator,apiserver,apimachinery,client-go,metrics} ./vendor/k8s.io From 1393643a47d17c6075e5672e9da8d67b18d695d9 Mon Sep 17 00:00:00 2001 From: lihuang Date: Mon, 5 Feb 2018 13:38:22 +0800 Subject: [PATCH 013/449] Update developers.md --- docs/developers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developers.md b/docs/developers.md index a84ce8722..5095bf1a0 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -27,7 +27,7 @@ packages. This will build both Helm and Tiller. `make bootstrap` will attempt to install certain tools if they are missing. -To run all of the tests (without running the tests for `vendor/`), run +To run all the tests (without running the tests for `vendor/`), run `make test`. To run Helm and Tiller locally, you can run `bin/helm` or `bin/tiller`. From df46e2b4d634eb57deabb525bbecc10ad3ce9039 Mon Sep 17 00:00:00 2001 From: liaoj Date: Mon, 5 Feb 2018 14:09:36 +0800 Subject: [PATCH 014/449] Update charts_tips_and_tricks.md typo error comand --> command --- docs/charts_tips_and_tricks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index b1df146db..2b4caa83b 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -234,7 +234,7 @@ update of that resource. ## Upgrade a release idempotently -In order to use the same command when installing and upgrading a release, use the following comand: +In order to use the same command when installing and upgrading a release, use the following command: ```shell helm upgrade --install --values ``` From a844e99ce814931ad9650a7683809c7ac2bde069 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 5 Feb 2018 07:17:46 -0500 Subject: [PATCH 015/449] Fix subchart2 example tag --- docs/charts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/charts.md b/docs/charts.md index a9f2cdf5b..a0c93697e 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -36,7 +36,7 @@ wordpress/ Helm reserves use of the `charts/` and `templates/` directories, and of the listed file names. Other files will be left as they are. -While the `charts` and `template` directories are optional there must be at least one chart dependency or template file for the chart to be valid. +While the `charts` and `templates` directories are optional there must be at least one chart dependency or template file for the chart to be valid. ## The Chart.yaml File @@ -276,7 +276,7 @@ dependencies: condition: subchart2.enabled,global.subchart2.enabled tags: - back-end - - subchart1 + - subchart2 ```` ```` From 41cf6149fd78e9076834350d40e6c287dc70d165 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 5 Feb 2018 08:43:28 -0800 Subject: [PATCH 016/449] remove references to the term "master" --- docs/charts_tips_and_tricks.md | 2 +- docs/install_faq.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index 2b4caa83b..e77c86a9d 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -204,7 +204,7 @@ together in one GitHub repository. **Deis's [Workflow](https://github.com/deis/workflow/tree/master/charts/workflow):** This chart exposes the entire Deis PaaS system with one chart. But it's different -from the SAP chart in that this master chart is built from each component, and +from the SAP chart in that this umbrella chart is built from each component, and each component is tracked in a different Git repository. Check out the `requirements.yaml` file to see how this chart is composed by their CI/CD pipeline. diff --git a/docs/install_faq.md b/docs/install_faq.md index 4a344c2ee..ff9ee89e6 100644 --- a/docs/install_faq.md +++ b/docs/install_faq.md @@ -106,12 +106,12 @@ Error: Error forwarding ports: error upgrading connection: dial tcp: lookup kube A: We have seen this issue with Ubuntu and Kubeadm in multi-node clusters. The issue is that the nodes expect certain DNS records to be obtainable via global DNS. Until this is resolved upstream, you can work around the issue as -follows: +follows. On each of the control plane nodes: -1) Add entries to `/etc/hosts` on the master mapping your hostnames to their public IPs -2) Install `dnsmasq` on the master (e.g. `apt install -y dnsmasq`) -3) Kill the k8s api server container on master (kubelet will recreate it) -4) Then `systemctl restart docker` (or reboot the master) for it to pick up the /etc/resolv.conf changes +1) Add entries to `/etc/hosts`, mapping your hostnames to their public IPs +2) Install `dnsmasq` (e.g. `apt install -y dnsmasq`) +3) Remove the k8s api server container (kubelet will recreate it) +4) Then `systemctl restart docker` (or reboot the node) for it to pick up the /etc/resolv.conf changes See this issue for more information: https://github.com/kubernetes/helm/issues/1455 From e3dd4b3fcac056aa9ea8e57b90a0931f24cb3936 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Mon, 5 Feb 2018 15:31:15 -0500 Subject: [PATCH 017/449] fix(api-machinery): Fixes patching for unstructured objects CRDs and other objects seen as unstructured cannot use strategic merge patching. It has never been supported on CRDs. Previously, cases like unstructured objects could have caused an unregistered error. This is no longer the case. This change explicitly looks for unstructured objects and handles those using json merge patching. Closes #3382 --- pkg/kube/client.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 6b911c8a0..cd5227dd7 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -399,14 +399,25 @@ func createPatch(mapping *meta.RESTMapping, target, current runtime.Object) ([]b return nil, types.StrategicMergePatchType, fmt.Errorf("serializing target configuration: %s", err) } + // While different objects need different merge types, the parent function + // that calls this does not try to create a patch when the data (first + // returned object) is nil. We can skip calculating the the merge type as + // the returned merge type is ignored. if apiequality.Semantic.DeepEqual(oldData, newData) { return nil, types.StrategicMergePatchType, nil } // Get a versioned object versionedObject, err := mapping.ConvertToVersion(target, mapping.GroupVersionKind.GroupVersion()) + + // Unstructured objects, such as CRDs, may not have an not registered error + // returned from ConvertToVersion. Anything that's unstructured should + // use the jsonpatch.CreateMergePatch. Strategic Merge Patch is not supported + // on objects like CRDs. + _, isUnstructured := versionedObject.(runtime.Unstructured) + switch { - case runtime.IsNotRegisteredError(err): + case runtime.IsNotRegisteredError(err), isUnstructured: // fall back to generic JSON merge patch patch, err := jsonpatch.CreateMergePatch(oldData, newData) return patch, types.MergePatchType, err From e72b8c5d9fa35c913c2c3a3dbdb1905876ea1474 Mon Sep 17 00:00:00 2001 From: lihuang Date: Tue, 6 Feb 2018 10:27:42 +0800 Subject: [PATCH 018/449] Update tiller_ssl.md --- docs/tiller_ssl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tiller_ssl.md b/docs/tiller_ssl.md index 71ddd8080..db1603068 100644 --- a/docs/tiller_ssl.md +++ b/docs/tiller_ssl.md @@ -200,7 +200,7 @@ If you want to customize the manifest, you can save that output to a file and th use `kubectl create` to load it into your cluster. > We strongly recommend enabling RBAC on your cluster and adding [service accounts](rbac.md) -> with RBACS. +> with RBAC. Otherwise, you can remove the `--dry-run` and `--debug` flags. We also recommend putting Tiller in a non-system namespace (`--tiller-namespace=something`) and enable From 297ebcd838a407bd663065ad6c246dad2176e8eb Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Wed, 7 Feb 2018 12:00:13 -0500 Subject: [PATCH 019/449] fix(grpc): Fixes issue where message sending limited to 4mb Between grpc 1.2.x and 1.7.x there was an API change. The previous MaxMsgSize is now a wrapper around MaxRecvMsgSize. This change now sets the MaxRecvMsgSize and MaxSendMsgSize which need to be set independently. --- pkg/tiller/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/tiller/server.go b/pkg/tiller/server.go index 57826578e..95276018e 100644 --- a/pkg/tiller/server.go +++ b/pkg/tiller/server.go @@ -36,7 +36,8 @@ var maxMsgSize = 1024 * 1024 * 20 // DefaultServerOpts returns the set of default grpc ServerOption's that Tiller requires. func DefaultServerOpts() []grpc.ServerOption { return []grpc.ServerOption{ - grpc.MaxMsgSize(maxMsgSize), + grpc.MaxRecvMsgSize(maxMsgSize), + grpc.MaxSendMsgSize(maxMsgSize), grpc.UnaryInterceptor(newUnaryInterceptor()), grpc.StreamInterceptor(newStreamInterceptor()), } From 53d3c59e19a300f50887faccfc9862ecb153fb31 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 8 Feb 2018 13:20:37 -0800 Subject: [PATCH 020/449] use an underscore for release_checklist.md Brings it in line with the rest of the documentation in docs/ --- docs/{release-checklist.md => release_checklist.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{release-checklist.md => release_checklist.md} (100%) diff --git a/docs/release-checklist.md b/docs/release_checklist.md similarity index 100% rename from docs/release-checklist.md rename to docs/release_checklist.md From 97e67c5a63cf7680cd273f9db9683e32ca3d4794 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 8 Feb 2018 16:18:42 -0500 Subject: [PATCH 021/449] fix(helm): fix the build-time golint warning on 'cmd/helm/install.go' When building helm, golint no longer generates the following warning: cmd/helm/install.go:502:9:warning: if block ends with a return statement, so drop this else and outdent its block (golint) Signed-off-by: Arash Deshmeh --- cmd/helm/install.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 8f849a15b..55ddd8141 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -499,12 +499,12 @@ func readFile(filePath string) ([]byte, error) { if err != nil { return ioutil.ReadFile(filePath) - } else { - getter, err := getterConstructor(filePath, "", "", "") - if err != nil { - return []byte{}, err - } - data, err := getter.Get(filePath) - return data.Bytes(), err } + + getter, err := getterConstructor(filePath, "", "", "") + if err != nil { + return []byte{}, err + } + data, err := getter.Get(filePath) + return data.Bytes(), err } From 98a8414372484fbd4dc3f26bff13efc1c3b1b7d2 Mon Sep 17 00:00:00 2001 From: oilbeater Date: Wed, 7 Feb 2018 18:02:36 +0800 Subject: [PATCH 022/449] defer in loop may cause resource leak defer statement executes only when function return, and the resource still be hold during loop. Release the resource manually when not needed. --- pkg/plugin/installer/http_installer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/plugin/installer/http_installer.go b/pkg/plugin/installer/http_installer.go index 203f038f2..91d497651 100644 --- a/pkg/plugin/installer/http_installer.go +++ b/pkg/plugin/installer/http_installer.go @@ -193,10 +193,11 @@ func (g *TarGzExtractor) Extract(buffer *bytes.Buffer, targetDir string) error { if err != nil { return err } - defer outFile.Close() if _, err := io.Copy(outFile, tarReader); err != nil { + outFile.Close() return err } + outFile.Close() default: return fmt.Errorf("unknown type: %b in %s", header.Typeflag, header.Name) } From 59260191969d857230feaa98f295e68d46e9b958 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Fri, 9 Feb 2018 10:31:19 -0200 Subject: [PATCH 023/449] Tiller should only enforce what we expect from Helm https://github.com/kubernetes/helm/pull/3183 added a keepalive to the Helm client of 30s period, while Tiller was never configured to permit this, keeping the default minimum keepalive period of 5 minutes, disconnecting any clients which ping more regularly than this. This commit enforces a minimum that is lower than what Helm is configured for, preventing these disconnections, and thus fixes #3409. --- cmd/tiller/tiller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index 96eeddacb..185bf4b6c 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -161,6 +161,9 @@ func start() { MaxConnectionIdle: 10 * time.Minute, // If needed, we can configure the max connection age })) + opts = append(opts, grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ + MinTime: time.Duration(20) * time.Second, // For compatibility with the client keepalive.ClientParameters + })) } rootServer = tiller.NewServer(opts...) From 53a0ea0f6951b1edac80a9e33813a880a2502210 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Fri, 9 Feb 2018 11:11:05 -0200 Subject: [PATCH 024/449] Keepalive config should be independent of TLS --- cmd/tiller/tiller.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index 185bf4b6c..e0c10cb29 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -157,15 +157,16 @@ func start() { logger.Fatalf("Could not create server TLS configuration: %v", err) } opts = append(opts, grpc.Creds(credentials.NewTLS(cfg))) - opts = append(opts, grpc.KeepaliveParams(keepalive.ServerParameters{ - MaxConnectionIdle: 10 * time.Minute, - // If needed, we can configure the max connection age - })) - opts = append(opts, grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ - MinTime: time.Duration(20) * time.Second, // For compatibility with the client keepalive.ClientParameters - })) } + opts = append(opts, grpc.KeepaliveParams(keepalive.ServerParameters{ + MaxConnectionIdle: 10 * time.Minute, + // If needed, we can configure the max connection age + })) + opts = append(opts, grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ + MinTime: time.Duration(20) * time.Second, // For compatibility with the client keepalive.ClientParameters + })) + rootServer = tiller.NewServer(opts...) lstn, err := net.Listen("tcp", *grpcAddr) From b8576ba7a856e379837bbc80a5becc8f50174e59 Mon Sep 17 00:00:00 2001 From: Justin Scott Date: Thu, 8 Feb 2018 16:46:38 -0800 Subject: [PATCH 025/449] fix(helm): update helm reset --force tip for clarity Updates helm reset error message to clarify that --force will not remove releases. Closes #3394 --- cmd/helm/reset.go | 4 ++-- cmd/helm/reset_test.go | 2 +- docs/helm/helm_reset.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index 707c3d0be..623776729 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -77,7 +77,7 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() - f.BoolVarP(&d.force, "force", "f", false, "forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state") + f.BoolVarP(&d.force, "force", "f", false, "forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.)") f.BoolVar(&d.removeHelmHome, "remove-helm-home", false, "if set deletes $HELM_HOME") return cmd @@ -101,7 +101,7 @@ func (d *resetCmd) run() error { } if !d.force && res != nil && len(res.Releases) > 0 { - return fmt.Errorf("there are still %d deployed releases (Tip: use --force)", len(res.Releases)) + return fmt.Errorf("there are still %d deployed releases (Tip: use --force to remove Tiller. Releases will not be deleted.)", len(res.Releases)) } if err := installer.Uninstall(d.kubeClient, &installer.Options{Namespace: d.namespace}); err != nil { diff --git a/cmd/helm/reset_test.go b/cmd/helm/reset_test.go index a68f29545..458736a63 100644 --- a/cmd/helm/reset_test.go +++ b/cmd/helm/reset_test.go @@ -121,7 +121,7 @@ func TestReset_deployedReleases(t *testing.T) { namespace: core.NamespaceDefault, } err = cmd.run() - expected := "there are still 1 deployed releases (Tip: use --force)" + expected := "there are still 1 deployed releases (Tip: use --force to remove Tiller. Releases will not be deleted.)" if !strings.Contains(err.Error(), expected) { t.Errorf("unexpected error: %v", err) } diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index 74a787bdc..f6707b8bd 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -18,7 +18,7 @@ helm reset ### Options ``` - -f, --force forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state + -f, --force forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.) --remove-helm-home if set deletes $HELM_HOME --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -40,4 +40,4 @@ helm reset ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Feb-2018 From 085e7f285b0b201436340209a07c1e749bf7c094 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 9 Feb 2018 13:53:38 -0800 Subject: [PATCH 026/449] bump docker to 17.11.0-ce --- .circleci/config.yml | 3 ++- .circleci/deploy.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35e643a04..477c72f59 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,8 @@ jobs: PROJECT_NAME: "kubernetes-helm" steps: - checkout - - setup_remote_docker + - setup_remote_docker: + version: 17.11.0-ce - restore_cache: keys: - glide-{{ checksum "glide.yaml" }}-{{ checksum "glide.lock" }} diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh index 6a3b3d0a6..7f2ca7122 100755 --- a/.circleci/deploy.sh +++ b/.circleci/deploy.sh @@ -34,7 +34,7 @@ else fi echo "Install docker client" -VER="17.03.0-ce" +VER="17.11.0-ce" curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz tar -xz -C /tmp -f /tmp/docker-$VER.tgz mv /tmp/docker/* /usr/bin From 9a7d6cb5970288a0d8cd6aa2c29deb02e0f6e5ca Mon Sep 17 00:00:00 2001 From: oilbeater Date: Sat, 10 Feb 2018 16:58:39 +0800 Subject: [PATCH 027/449] defer in loop may cause resource leak --- pkg/chartutil/expand.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/chartutil/expand.go b/pkg/chartutil/expand.go index ae28f8147..126e14e80 100644 --- a/pkg/chartutil/expand.go +++ b/pkg/chartutil/expand.go @@ -63,11 +63,12 @@ func Expand(dir string, r io.Reader) error { if err != nil { return err } - defer file.Close() _, err = io.Copy(file, tr) if err != nil { + file.Close() return err } + file.Close() } return nil } From 07ef1bc2b77e05b4e7bcbbe706f8f940493c6a4a Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Sat, 10 Feb 2018 14:29:28 +0100 Subject: [PATCH 028/449] Grammar fixes and clarifications --- docs/securing_installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index 38350a922..2db2bcfb4 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -52,7 +52,7 @@ This situation may change in the future. While the community has several methods In the default installation the gRPC endpoint that Tiller offers is available inside the cluster (not external to the cluster) without authentication configuration applied. Without applying authentication, any process in the cluster can use the gRPC endpoint to perform operations inside the cluster. In a local or secured private cluster, this enables rapid usage and is normal. (When running outside the cluster, Helm authenticates through the Kubernetes API server to reach Tiller, leveraging existing Kubernetes authentication support.) -Shared and production clusters -- for the most part -- should use Helm 2.7.2 at a minimum and configure TLS for each the Tiller gRPC endpoint to ensure that within the cluster usage of gRPC endpoints is only for the properly authenticated identity for that endpoint. Doing so enables any number of Tiller instances to be deployed in any number of namespaces and yet no unauthenticated usage of any gRPC endpoint is possible. Finally, usage of Helm `init` with the `--tiller-tls-verify` option to install Tiller with TLS enabled and to verify remote certificates, and other Helm commands should use the `--tls` with all other commands. +Shared and production clusters -- for the most part -- should use Helm 2.7.2 at a minimum and configure TLS for each Tiller gRPC endpoint to ensure that within the cluster usage of gRPC endpoints is only for the properly authenticated identity for that endpoint. Doing so enables any number of Tiller instances to be deployed in any number of namespaces and yet no unauthenticated usage of any gRPC endpoint is possible. Finally, usa Helm `init` with the `--tiller-tls-verify` option to install Tiller with TLS enabled and to verify remote certificates, and all other Helm commands should use the `--tls` option. For more information about the proper steps to configure Tiller and use Helm properly with TLS configured, see [Using SSL between Helm and Tiller](tiller_ssl.md). From 81af9e861e9b30b48a4447da7b82e19d47a26f72 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Sat, 10 Feb 2018 14:39:14 +0100 Subject: [PATCH 029/449] Fix bash example --- docs/securing_installation.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index 2db2bcfb4..2233620af 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -91,13 +91,13 @@ The following guidelines reiterate the Best Practices for securing Helm and Till If these steps are followed, an example `helm init` command might look something like this: ```bash -$ helm init \ -–tiller-tls \ -–tiller-tls-verify \ -–tiller-tls-ca-cert=ca.pem \ -–tiller-tls-cert=cert.pem \ -–tiller-tls-key=key.pem \ -–service-account=accountname +$ helm init \ +--tiller-tls \ +--tiller-tls-verify \ +--tiller-tls-ca-cert=ca.pem \ +--tiller-tls-cert=cert.pem \ +--tiller-tls-key=key.pem \ +--service-account=accountname ``` This command will start Tiller with both strong authentication over gRPC, and a service account to which RBAC policies have been applied. From a069a2c0f2f5220113060eca55a6049f89e5db57 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 25 Jul 2017 19:49:23 +0530 Subject: [PATCH 030/449] feat(helm): add --template flag to `helm version` `helm version --template` prints the client and server version info in the provided template format. --- cmd/helm/version.go | 22 ++++++++++++++++++---- cmd/helm/version_test.go | 1 + docs/helm/helm_version.md | 3 ++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/cmd/helm/version.go b/cmd/helm/version.go index 69e0f3905..8eaff1ca9 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -55,6 +55,7 @@ type versionCmd struct { showClient bool showServer bool short bool + template string } func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { @@ -85,18 +86,26 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVarP(&version.showClient, "client", "c", false, "client version only") f.BoolVarP(&version.showServer, "server", "s", false, "server version only") f.BoolVar(&version.short, "short", false, "print the version number") + f.StringVar(&version.template, "template", "", "template for version string format") return cmd } func (v *versionCmd) run() error { + // Store map data for template rendering + data := map[string]interface{}{} + if v.showClient { cv := version.GetVersionProto() - fmt.Fprintf(v.out, "Client: %s\n", formatVersion(cv, v.short)) + if v.template != "" { + data["Client"] = cv + } else { + fmt.Fprintf(v.out, "Client: %s\n", formatVersion(cv, v.short)) + } } if !v.showServer { - return nil + return tpl(v.template, data, v.out) } if settings.Debug { @@ -115,8 +124,13 @@ func (v *versionCmd) run() error { debug("%s", err) return errors.New("cannot connect to Tiller") } - fmt.Fprintf(v.out, "Server: %s\n", formatVersion(resp.Version, v.short)) - return nil + + if v.template != "" { + data["Server"] = resp.Version + } else { + fmt.Fprintf(v.out, "Server: %s\n", formatVersion(resp.Version, v.short)) + } + return tpl(v.template, data, v.out) } func getK8sVersion() (*apiVersion.Info, error) { diff --git a/cmd/helm/version_test.go b/cmd/helm/version_test.go index 475200085..dbc40f401 100644 --- a/cmd/helm/version_test.go +++ b/cmd/helm/version_test.go @@ -38,6 +38,7 @@ func TestVersion(t *testing.T) { {"default", true, true, []string{}, false}, {"client", true, false, []string{"-c"}, false}, {"server", false, true, []string{"-s"}, false}, + {"template", true, true, []string{"--template='{{ .Client.SemVer }} {{ .Server.SemVer }}'"}, false}, } settings.TillerHost = "fake-localhost" diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index 18f9d261e..39b4adfab 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -33,6 +33,7 @@ helm version -c, --client client version only -s, --server server version only --short print the version number + --template string template for version string format --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") @@ -53,4 +54,4 @@ helm version ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 11-Feb-2018 From e4f22787767858445dc4cda0ecb4016820fd57c2 Mon Sep 17 00:00:00 2001 From: Thibaut Rousseau Date: Mon, 12 Feb 2018 00:33:28 +0100 Subject: [PATCH 031/449] docs: Fix FromJson comment --- pkg/chartutil/files.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index 687a9a8d6..a711a3366 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -220,10 +220,10 @@ func ToJson(v interface{}) string { return string(data) } -// FromJson converts a YAML document into a map[string]interface{}. +// FromJson converts a JSON document into a map[string]interface{}. // // This is not a general-purpose JSON parser, and will not parse all valid -// YAML documents. Additionally, because its intended use is within templates +// JSON documents. Additionally, because its intended use is within templates // it tolerates errors. It will insert the returned error message string into // m["Error"] in the returned map. func FromJson(str string) map[string]interface{} { From fe4f76c7594aeb84d6ebcab2e13faa3b6a1b260e Mon Sep 17 00:00:00 2001 From: yank1 Date: Mon, 12 Feb 2018 19:08:39 +0800 Subject: [PATCH 032/449] fix a typo in client --- pkg/helm/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index a5d44bc09..83c97f9a8 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -293,7 +293,7 @@ func (h *Client) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-ch return h.test(ctx, req) } -// PingTiller pings the Tiller pod and ensure's that it is up and runnning +// PingTiller pings the Tiller pod and ensure's that it is up and running func (h *Client) PingTiller() error { ctx := NewContext() return h.ping(ctx) From d5192f7bef53c886e31083e5cbd2a7c9124f36db Mon Sep 17 00:00:00 2001 From: Yann Coleu Date: Tue, 13 Feb 2018 12:34:59 +0100 Subject: [PATCH 033/449] fix occurences typo in charts.md --- docs/charts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/charts.md b/docs/charts.md index 00e0144f3..5cbdb79ad 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -849,7 +849,7 @@ considerations in mind: - The `Chart.yaml` will be overwritten by the generator. - Users will expect to modify such a chart's contents, so documentation should indicate how users can do so. -- All occurances of `` will be replaced with the specified chart +- All occurences of `` will be replaced with the specified chart name so that starter charts can be used as templates. Currently the only way to add a chart to `$HELM_HOME/starters` is to manually From cb3c72030d061d2b62dc9d3aa9e47d24cceb44c4 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 13 Feb 2018 11:29:23 -0500 Subject: [PATCH 034/449] fix(helm): fix the bug in test code 'cmd/helm/create_test.go' that leaves behind temp directories during build The build process no longer leaves behind 'helm-create-*' temp directories. Signed-off-by: Arash Deshmeh --- cmd/helm/create_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go index afaed6483..cb7b1d387 100644 --- a/cmd/helm/create_test.go +++ b/cmd/helm/create_test.go @@ -33,7 +33,7 @@ func TestCreateCmd(t *testing.T) { if err != nil { t.Fatal(err) } - defer os.Remove(tdir) + defer os.RemoveAll(tdir) // CD into it pwd, err := os.Getwd() @@ -79,7 +79,7 @@ func TestCreateStarterCmd(t *testing.T) { if err != nil { t.Fatal(err) } - defer os.Remove(tdir) + defer os.RemoveAll(tdir) thome, err := tempHelmHome(t) if err != nil { From 032770a539c62bc484536cdeacc4f7d2f36c8f10 Mon Sep 17 00:00:00 2001 From: Jason Murray Date: Wed, 14 Feb 2018 08:47:55 +0100 Subject: [PATCH 035/449] Typo once/one --- docs/chart_template_guide/subcharts_and_globals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/subcharts_and_globals.md b/docs/chart_template_guide/subcharts_and_globals.md index 26e9a60cb..33274effe 100644 --- a/docs/chart_template_guide/subcharts_and_globals.md +++ b/docs/chart_template_guide/subcharts_and_globals.md @@ -83,7 +83,7 @@ mysubchart: dessert: ice cream ``` -Note the last two lines. Any directives inside of the `mysubchart` section will be sent to the `mysubchart` chart. So if we run `helm install --dry-run --debug mychart`, once of the things we will see is the `mysubchart` ConfigMap: +Note the last two lines. Any directives inside of the `mysubchart` section will be sent to the `mysubchart` chart. So if we run `helm install --dry-run --debug mychart`, one of the things we will see is the `mysubchart` ConfigMap: ```yaml # Source: mychart/charts/mysubchart/templates/configmap.yaml From fa16ab0d70605ecf63943b72527eab51c77b1c05 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Wed, 14 Feb 2018 10:42:39 -0500 Subject: [PATCH 036/449] fix(helm): fix the implicit dependency of TestSetAppVersion test on previous tests, due to helm home, by explicitly creating a temporary helm directory for the test. Signed-off-by: Arash Deshmeh --- cmd/helm/package_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/helm/package_test.go b/cmd/helm/package_test.go index d338c29cd..4404586e0 100644 --- a/cmd/helm/package_test.go +++ b/cmd/helm/package_test.go @@ -205,7 +205,19 @@ func TestSetAppVersion(t *testing.T) { var ch *chart.Chart expectedAppVersion := "app-version-foo" tmp, _ := ioutil.TempDir("", "helm-package-app-version-") - defer os.RemoveAll(tmp) + + thome, err := tempHelmHome(t) + if err != nil { + t.Fatal(err) + } + cleanup := resetEnv() + defer func() { + os.RemoveAll(tmp) + os.RemoveAll(thome.String()) + cleanup() + }() + + settings.Home = helmpath.Home(thome) c := newPackageCmd(&bytes.Buffer{}) flags := map[string]string{ @@ -213,7 +225,7 @@ func TestSetAppVersion(t *testing.T) { "app-version": expectedAppVersion, } setFlags(c, flags) - err := c.RunE(c, []string{"testdata/testcharts/alpine"}) + err = c.RunE(c, []string{"testdata/testcharts/alpine"}) if err != nil { t.Errorf("unexpected error %q", err) } From a93b74e6abe1a9c2ed4cd493091f78e4ef05469b Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Thu, 15 Feb 2018 12:25:51 -0500 Subject: [PATCH 037/449] chore(README): add ref to helm mailing list --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 547839e24..6aee432aa 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,9 @@ You can reach the Helm community and developers via the following channels: - #helm-users - #helm-dev - #charts -- Mailing List: https://groups.google.com/forum/#!forum/kubernetes-sig-apps +- Mailing Lists: + - [Helm Mailing List](https://lists.cncf.io/g/cncf-kubernetes-helm) + - [Kubernetes SIG Apps Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-apps) - Developer Call: Thursdays at 9:30-10:00 Pacific. [https://zoom.us/j/4526666954](https://zoom.us/j/4526666954) ### Code of conduct From 083a276702be248749f795c99053a540d244c7b4 Mon Sep 17 00:00:00 2001 From: Liam White Date: Fri, 16 Feb 2018 10:44:47 +0000 Subject: [PATCH 038/449] Fix linting bug with charts containing more than one hyphen --- cmd/helm/lint.go | 6 +++++- cmd/helm/lint_test.go | 19 +++++++++++++----- .../compressedchart-with-hyphens-0.1.0.tgz | Bin 0 -> 548 bytes 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 cmd/helm/testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz diff --git a/cmd/helm/lint.go b/cmd/helm/lint.go index f529f8ce5..29eea1a88 100644 --- a/cmd/helm/lint.go +++ b/cmd/helm/lint.go @@ -149,7 +149,11 @@ func lintChart(path string, vals []byte, namespace string, strict bool) (support return linter, err } - base := strings.Split(filepath.Base(path), "-")[0] + lastHyphenIndex := strings.LastIndex(filepath.Base(path), "-") + if lastHyphenIndex <= 0 { + return linter, fmt.Errorf("unable to parse chart archive %q, missing '-'", filepath.Base(path)) + } + base := filepath.Base(path)[:lastHyphenIndex] chartPath = filepath.Join(tempDir, base) } else { chartPath = path diff --git a/cmd/helm/lint_test.go b/cmd/helm/lint_test.go index e52bdc056..7f045153c 100644 --- a/cmd/helm/lint_test.go +++ b/cmd/helm/lint_test.go @@ -21,11 +21,13 @@ import ( ) var ( - values = []byte{} - namespace = "testNamespace" - strict = false - archivedChartPath = "testdata/testcharts/compressedchart-0.1.0.tgz" - chartDirPath = "testdata/testcharts/decompressedchart/" + values = []byte{} + namespace = "testNamespace" + strict = false + archivedChartPath = "testdata/testcharts/compressedchart-0.1.0.tgz" + archivedChartPathWithHyphens = "testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz" + invalidArchivedChartPath = "testdata/testcharts/invalidcompressedchart0.1.0.tgz" + chartDirPath = "testdata/testcharts/decompressedchart/" ) func TestLintChart(t *testing.T) { @@ -37,4 +39,11 @@ func TestLintChart(t *testing.T) { t.Errorf("%s", err) } + if _, err := lintChart(archivedChartPathWithHyphens, values, namespace, strict); err != nil { + t.Errorf("%s", err) + } + + if _, err := lintChart(invalidArchivedChartPath, values, namespace, strict); err == nil { + t.Errorf("Expected a chart parsing error") + } } diff --git a/cmd/helm/testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz b/cmd/helm/testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..379210a92c1795429d2c4baae389f1e971f26824 GIT binary patch literal 548 zcmV+<0^9u`iwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PL4fi`y^|#dG$jc->rDXjD0A64=|)92WW)wwIoYVoz*QSrU?* zG;H^~7dcDXrjTqgP3fZFMMBsbi zPWu0B_M89nr2n%p#E0nPPIpGV%QZGNX)If*N~tSYQG5|qH0t|nfN!leE_nEwltQJ< z5{(E&Ep_!Aj+6*;9W6i9KdlR0WlY0RR8Xa#gbc6aWCh@%&~0 literal 0 HcmV?d00001 From 2965c60c18ac3d8fab43f2fd719c7153b94dc283 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Fri, 16 Feb 2018 14:32:01 +0100 Subject: [PATCH 039/449] Fix typo --- _proto/hapi/services/tiller.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 1fb6a86e9..5897676ab 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -165,7 +165,7 @@ message GetReleaseStatusResponse { // Info contains information about the release. hapi.release.Info info = 2; - // Namesapce the release was released into + // Namespace the release was released into string namespace = 3; } From 97f818079f417e6c9f4f19307f367897c816f451 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Fri, 16 Feb 2018 16:22:24 +0100 Subject: [PATCH 040/449] Add a reference to Helm.NET --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index 1a13fd5e3..826c2c3aa 100644 --- a/docs/related.md +++ b/docs/related.md @@ -62,6 +62,7 @@ Tools layered on top of Helm or Tiller. - [Helm Chart Publisher](https://github.com/luizbafilho/helm-chart-publisher) - HTTP API for publishing Helm Charts in an easy way - [Armada](https://github.com/att-comdev/armada) - Manage prefixed releases throughout various Kubernetes namespaces, and removes completed jobs for complex deployments. Used by the [Openstack-Helm](https://github.com/openstack/openstack-helm) team. - [ChartMuseum](https://github.com/chartmuseum/chartmuseum) - Helm Chart Repository with support for Amazon S3 and Google Cloud Storage +- [Helm.NET](https://github.com/qmfrederik/helm) - A .NET client for Tiller's API ## Helm Included From 6a9ee620ca428b335ad9ba0f0d1074c9c1bb9091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stevo=20Slavi=C4=87?= Date: Fri, 16 Feb 2018 22:24:46 +0100 Subject: [PATCH 041/449] Update download links to 2.8.1 binaries --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6aee432aa..039f34b38 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,10 @@ Think of it like apt/yum/homebrew for Kubernetes. Binary downloads of the Helm client can be found at the following links: -- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-darwin-amd64.tar.gz) -- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-linux-amd64.tar.gz) -- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-linux-386.tar.gz) -- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-windows-amd64.tar.gz) +- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-darwin-amd64.tar.gz) +- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-linux-amd64.tar.gz) +- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-linux-386.tar.gz) +- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-windows-amd64.tar.gz) Unpack the `helm` binary and add it to your PATH and you are good to go! macOS/[homebrew](https://brew.sh/) users can also use `brew install kubernetes-helm`. From 4995983f3b69f9f6616173507d7cd0f0776f32ed Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Fri, 16 Feb 2018 16:30:42 -0500 Subject: [PATCH 042/449] fix(helm): fix the output leak to stdout during build by tests under pkg/releasetesting, by redirecting output from mock clients. Signed-off-by: Arash Deshmeh --- pkg/releasetesting/environment_test.go | 8 ++++---- pkg/releasetesting/test_suite_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/releasetesting/environment_test.go b/pkg/releasetesting/environment_test.go index 29ca93d09..0199b74eb 100644 --- a/pkg/releasetesting/environment_test.go +++ b/pkg/releasetesting/environment_test.go @@ -20,7 +20,7 @@ import ( "bytes" "errors" "io" - "os" + "io/ioutil" "testing" "k8s.io/helm/pkg/proto/hapi/release" @@ -145,7 +145,7 @@ type getFailingKubeClient struct { func newGetFailingKubeClient() *getFailingKubeClient { return &getFailingKubeClient{ - PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: os.Stdout}, + PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: ioutil.Discard}, } } @@ -159,7 +159,7 @@ type deleteFailingKubeClient struct { func newDeleteFailingKubeClient() *deleteFailingKubeClient { return &deleteFailingKubeClient{ - PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: os.Stdout}, + PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: ioutil.Discard}, } } @@ -173,7 +173,7 @@ type createFailingKubeClient struct { func newCreateFailingKubeClient() *createFailingKubeClient { return &createFailingKubeClient{ - PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: os.Stdout}, + PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: ioutil.Discard}, } } diff --git a/pkg/releasetesting/test_suite_test.go b/pkg/releasetesting/test_suite_test.go index d83cd2666..e6cc8bcf5 100644 --- a/pkg/releasetesting/test_suite_test.go +++ b/pkg/releasetesting/test_suite_test.go @@ -18,7 +18,7 @@ package releasetesting import ( "io" - "os" + "io/ioutil" "testing" "time" @@ -320,7 +320,7 @@ type podSucceededKubeClient struct { func newPodSucceededKubeClient() *podSucceededKubeClient { return &podSucceededKubeClient{ - PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: os.Stdout}, + PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: ioutil.Discard}, } } @@ -334,7 +334,7 @@ type podFailedKubeClient struct { func newPodFailedKubeClient() *podFailedKubeClient { return &podFailedKubeClient{ - PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: os.Stdout}, + PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: ioutil.Discard}, } } From 6a981b8f2373ce2d8ae59d5a1b93bf9c5693c7c6 Mon Sep 17 00:00:00 2001 From: Mueed Chaudhry Date: Fri, 16 Feb 2018 14:26:25 -0500 Subject: [PATCH 043/449] update docs to demonstrate best practices in regards to named templates --- docs/chart_template_guide/named_templates.md | 47 ++++++++++---------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/chart_template_guide/named_templates.md b/docs/chart_template_guide/named_templates.md index 1dc9c7618..042842427 100644 --- a/docs/chart_template_guide/named_templates.md +++ b/docs/chart_template_guide/named_templates.md @@ -4,15 +4,19 @@ It is time to move beyond one template, and begin to create others. In this sect In the "Flow Control" section we introduced three actions for declaring and managing templates: `define`, `template`, and `block`. In this section, we'll cover those three actions, and also introduce a special-purpose `include` function that works similarly to the `template` action. +An important detail to keep in mind when naming templates: **template names are global**. If you declare two templates with the same name, whichever one is loaded last will be the one used. Because templates in subcharts are compiled together with top-level templates, you should be careful to name your templates with _chart-specific names_. + +One popular naming convention is to prefix each defined template with the name of the chart: `{{ define "mychart.labels" }}`. By using the specific chart name as a prefix we can avoid any conflicts that may arise due to two different charts that implement templates of the same name. + ## Partials and `_` files So far, we've used one file, and that one file has contained a single template. But Helm's template language allows you to create named embedded templates, that can be accessed by name elsewhere. Before we get to the nuts-and-bolts of writing those templates, there is file naming convention that deserves mention: -- Most files in `templates/` are treated as if they contain Kubernetes manifests -- The `NOTES.txt` is one exception -- But files whose name begins with an underscore (`_`) are assumed to _not_ have a manifest inside. These files are not rendered to Kubernetes object definitions, but are available everywhere within other chart templates for use. +* Most files in `templates/` are treated as if they contain Kubernetes manifests +* The `NOTES.txt` is one exception +* But files whose name begins with an underscore (`_`) are assumed to _not_ have a manifest inside. These files are not rendered to Kubernetes object definitions, but are available everywhere within other chart templates for use. These files are used to store partials and helpers. In fact, when we first created `mychart`, we saw a file called `_helpers.tpl`. That file is the default location for template partials. @@ -21,7 +25,7 @@ These files are used to store partials and helpers. In fact, when we first creat The `define` action allows us to create a named template inside of a template file. Its syntax goes like this: ```yaml -{{ define "MY_NAME" }} +{{ define "MY.NAME" }} # body of template here {{ end }} ``` @@ -29,7 +33,7 @@ The `define` action allows us to create a named template inside of a template fi For example, we can define a template to encapsulate a Kubernetes block of labels: ```yaml -{{- define "my_labels" }} +{{- define "mychart.labels" }} labels: generator: helm date: {{ now | htmlDate }} @@ -39,7 +43,7 @@ For example, we can define a template to encapsulate a Kubernetes block of label Now we can embed this template inside of our existing ConfigMap, and then include it with the `template` action: ```yaml -{{- define "my_labels" }} +{{- define "mychart.labels" }} labels: generator: helm date: {{ now | htmlDate }} @@ -48,7 +52,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap - {{- template "my_labels" }} + {{- template "mychart.labels" }} data: myvalue: "Hello World" {{- range $key, $val := .Values.favorite }} @@ -56,7 +60,7 @@ data: {{- end }} ``` -When the template engine reads this file, it will store away the reference to `my_labels` until `template "my_labels"` is called. Then it will render that template inline. So the result will look like this: +When the template engine reads this file, it will store away the reference to `mychart.labels` until `template "mychart.labels"` is called. Then it will render that template inline. So the result will look like this: ```yaml # Source: mychart/templates/configmap.yaml @@ -77,7 +81,7 @@ Conventionally, Helm charts put these templates inside of a partials file, usual ```yaml {{/* Generate basic labels */}} -{{- define "my_labels" }} +{{- define "mychart.labels" }} labels: generator: helm date: {{ now | htmlDate }} @@ -93,7 +97,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap - {{- template "my_labels" }} + {{- template "mychart.labels" }} data: myvalue: "Hello World" {{- range $key, $val := .Values.favorite }} @@ -101,9 +105,7 @@ data: {{- end }} ``` -There is one _really important detail_ to keep in mind when naming templates: **template names are global**. If you declare two templates with the same name, whichever one is loaded last will be the one used. Because templates in subcharts are compiled together with top-level templates, you should be careful to name your templates with chart-specific names. - -One popular naming convention is to prefix each defined template with the name of the chart: `{{ define "mychart.labels" }}` or `{{ define "mychart_labels" }}`. +As mentioned above, **template names are global**. As a result of this, if two templates are declared with the same name the last occurance will be the one that is used. Since templates in subcharts are compiled together with top-level templates, it is best to name your templates with _chart specific names_. A popular naming convention is to prefix each defined template with the name of the chart: `{{ define "mychart.labels" }}`. ## Setting the scope of a template @@ -111,7 +113,7 @@ In the template we defined above, we did not use any objects. We just used funct ```yaml {{/* Generate basic labels */}} -{{- define "my_labels" }} +{{- define "mychart.labels" }} labels: generator: helm date: {{ now | htmlDate }} @@ -138,7 +140,7 @@ metadata: What happened to the name and version? They weren't in the scope for our defined template. When a named template (created with `define`) is rendered, it will receive the scope passed in by the `template` call. In our example, we included the template like this: ```yaml -{{- template "my_labels" }} +{{- template "mychart.labels" }} ``` No scope was passed in, so within the template we cannot access anything in `.`. This is easy enough to fix, though. We simply pass a scope to the template: @@ -148,7 +150,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap - {{- template "my_labels" . }} + {{- template "mychart.labels" . }} ``` Note that we pass `.` at the end of the `template` call. We could just as easily pass `.Values` or `.Values.favorite` or whatever scope we want. But what we want is the top-level scope. @@ -174,8 +176,8 @@ Now `{{ .Chart.Name }}` resolves to `mychart`, and `{{ .Chart.Version }}` resolv Say we've defined a simple template that looks like this: -``` -{{- define "mychart_app" -}} +```yaml +{{- define "mychart.app" -}} app_name: {{ .Chart.Name }} app_version: "{{ .Chart.Version }}+{{ .Release.Time.Seconds }}" {{- end -}} @@ -189,14 +191,13 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap labels: - {{ template "mychart_app" .}} + {{ template "mychart.app" .}} data: myvalue: "Hello World" {{- range $key, $val := .Values.favorite }} {{ $key }}: {{ $val | quote }} {{- end }} - {{ template "mychart_app" . }} - +{{ template "mychart.app" . }} ``` The output will not be what we expect: @@ -230,13 +231,13 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap labels: -{{ include "mychart_app" . | indent 4 }} +{{ include "mychart.app" . | indent 4 }} data: myvalue: "Hello World" {{- range $key, $val := .Values.favorite }} {{ $key }}: {{ $val | quote }} {{- end }} -{{ include "mychart_app" . | indent 2 }} +{{ include "mychart.app" . | indent 2 }} ``` Now the produced YAML is correctly indented for each section: From 51e91a0e7ebde20eef8ac73b7dacc3f23610964e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Thu, 15 Feb 2018 14:31:18 +0100 Subject: [PATCH 044/449] Mute upgrade --install default namespace warning Initialize empty selection like in the install command to prevent: WARNING: Namespace doesn't match with previous --- cmd/helm/upgrade.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 7a7dfb0f6..7fca5af68 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -154,9 +154,15 @@ func (u *upgradeCmd) run() error { releaseHistory, err := u.client.ReleaseHistory(u.release, helm.WithMaxHistory(1)) if err == nil { + if u.namespace == "" { + u.namespace = defaultNamespace() + } previousReleaseNamespace := releaseHistory.Releases[0].Namespace if previousReleaseNamespace != u.namespace { - fmt.Fprintf(u.out, "WARNING: Namespace doesn't match with previous. Release will be deployed to %s\n", previousReleaseNamespace) + fmt.Fprintf(u.out, + "WARNING: Namespace %q doesn't match with previous. Release will be deployed to %s\n", + u.namespace, previousReleaseNamespace, + ) } } From 3d60551273acdf7f7a8db437cd38f152b5207bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Thu, 15 Feb 2018 14:02:14 +0100 Subject: [PATCH 045/449] Bump client side grpc max msg size Set it to match the server side, or the default limit of 4MB will still apply when upgrading charts. Fixes #3512 --- pkg/helm/client.go | 5 +++++ pkg/tiller/server.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 83c97f9a8..f5dc5a001 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -30,6 +30,10 @@ import ( rls "k8s.io/helm/pkg/proto/hapi/services" ) +// maxMsgSize use 20MB as the default message size limit. +// grpc library default is 4MB +const maxMsgSize = 1024 * 1024 * 20 + // Client manages client side of the Helm-Tiller protocol. type Client struct { opts options @@ -310,6 +314,7 @@ func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) // getting closed by upstreams Time: time.Duration(30) * time.Second, }), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)), } switch { case h.opts.useTLS: diff --git a/pkg/tiller/server.go b/pkg/tiller/server.go index 95276018e..818cfd47a 100644 --- a/pkg/tiller/server.go +++ b/pkg/tiller/server.go @@ -31,7 +31,7 @@ import ( // maxMsgSize use 20MB as the default message size limit. // grpc library default is 4MB -var maxMsgSize = 1024 * 1024 * 20 +const maxMsgSize = 1024 * 1024 * 20 // DefaultServerOpts returns the set of default grpc ServerOption's that Tiller requires. func DefaultServerOpts() []grpc.ServerOption { From 4cb0e3df3ecdcb59c42221e84b37a0913d98acf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Thu, 15 Feb 2018 14:19:09 +0100 Subject: [PATCH 046/449] Update deprecated grpc dial timeout The docs say: use DialContext instead. --- pkg/helm/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index f5dc5a001..c7ef4d89e 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -307,7 +307,6 @@ func (h *Client) PingTiller() error { // are constructed here. func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) { opts := []grpc.DialOption{ - grpc.WithTimeout(5 * time.Second), grpc.WithBlock(), grpc.WithKeepaliveParams(keepalive.ClientParameters{ // Send keepalive every 30 seconds to prevent the connection from @@ -322,7 +321,9 @@ func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) default: opts = append(opts, grpc.WithInsecure()) } - if conn, err = grpc.Dial(h.opts.host, opts...); err != nil { + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + if conn, err = grpc.DialContext(ctx, h.opts.host, opts...); err != nil { return nil, err } return conn, nil From 122502e8406f0381192e41b1071c568e88d8cce3 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Mon, 19 Feb 2018 12:54:45 -0500 Subject: [PATCH 047/449] fix(helm): fix the bug in test code under pkg/tiller that leaks output to stdout during build Signed-off-by: Arash Deshmeh --- pkg/tiller/release_server_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index ce95acc8f..d71e34bee 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -19,6 +19,7 @@ package tiller import ( "errors" "io" + "io/ioutil" "os" "regexp" "testing" @@ -284,7 +285,7 @@ func releaseWithKeepStub(rlsName string) *release.Release { func MockEnvironment() *environment.Environment { e := environment.New() e.Releases = storage.Init(driver.NewMemory()) - e.KubeClient = &environment.PrintingKubeClient{Out: os.Stdout} + e.KubeClient = &environment.PrintingKubeClient{Out: ioutil.Discard} return e } @@ -305,7 +306,7 @@ func (u *updateFailingKubeClient) Update(namespace string, originalReader, modif func newHookFailingKubeClient() *hookFailingKubeClient { return &hookFailingKubeClient{ - PrintingKubeClient: environment.PrintingKubeClient{Out: os.Stdout}, + PrintingKubeClient: environment.PrintingKubeClient{Out: ioutil.Discard}, } } From 4198c7ce87e48c1e0d4911b0a24ccf38a19b2594 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 20 Feb 2018 11:45:46 -0500 Subject: [PATCH 048/449] fix(helm): fix the bug in tests under cmd/helm that leaves behind temporary directories named "repo-test-*" during build. Signed-off-by: Arash Deshmeh --- cmd/helm/repo_add_test.go | 4 ++-- cmd/helm/repo_remove_test.go | 2 +- cmd/helm/repo_update_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go index 2e36decbf..1f49e45ea 100644 --- a/cmd/helm/repo_add_test.go +++ b/cmd/helm/repo_add_test.go @@ -36,7 +36,7 @@ func TestRepoAddCmd(t *testing.T) { cleanup := resetEnv() defer func() { srv.Stop() - os.Remove(thome.String()) + os.RemoveAll(thome.String()) cleanup() }() if err := ensureTestHome(thome, t); err != nil { @@ -72,7 +72,7 @@ func TestRepoAdd(t *testing.T) { hh := thome defer func() { ts.Stop() - os.Remove(thome.String()) + os.RemoveAll(thome.String()) cleanup() }() if err := ensureTestHome(hh, t); err != nil { diff --git a/cmd/helm/repo_remove_test.go b/cmd/helm/repo_remove_test.go index 84244ae98..63082b42e 100644 --- a/cmd/helm/repo_remove_test.go +++ b/cmd/helm/repo_remove_test.go @@ -37,7 +37,7 @@ func TestRepoRemove(t *testing.T) { cleanup := resetEnv() defer func() { ts.Stop() - os.Remove(thome.String()) + os.RemoveAll(thome.String()) cleanup() }() if err := ensureTestHome(hh, t); err != nil { diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go index 0d0a31350..e6f2af32f 100644 --- a/cmd/helm/repo_update_test.go +++ b/cmd/helm/repo_update_test.go @@ -75,7 +75,7 @@ func TestUpdateCharts(t *testing.T) { cleanup := resetEnv() defer func() { ts.Stop() - os.Remove(thome.String()) + os.RemoveAll(thome.String()) cleanup() }() if err := ensureTestHome(hh, t); err != nil { From 11c7370b488ecb5af9afd7af4b1b79998b836a18 Mon Sep 17 00:00:00 2001 From: EJ Etherington Date: Tue, 20 Feb 2018 08:46:44 -0800 Subject: [PATCH 049/449] Added ReactiveOps Autohelm to the related tools list --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index 826c2c3aa..a753a123c 100644 --- a/docs/related.md +++ b/docs/related.md @@ -55,6 +55,7 @@ Tools layered on top of Helm or Tiller. - [Landscaper](https://github.com/Eneco/landscaper/) - "Landscaper takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster." - [Rudder](https://github.com/AcalephStorage/rudder) - RESTful (JSON) proxy for Tiller's API - [Helmfile](https://github.com/roboll/helmfile) - Helmfile is a declarative spec for deploying helm charts +- [Autohelm](https://github.com/reactiveops/autohelm) - Autohelm is _another_ simple declarative spec for deploying helm charts. Written in python and supports git urls as a source for helm charts. - [Schelm](https://github.com/databus23/schelm) - Render a Helm manifest to a directory - [Drone.io Helm Plugin](http://plugins.drone.io/ipedrazas/drone-helm/) - Run Helm inside of the Drone CI/CD system - [Cog](https://github.com/ohaiwalt/cog-helm) - Helm chart to deploy Cog on Kubernetes From fb68a2aa6d1e21eae0f1f9f31f93668844398e76 Mon Sep 17 00:00:00 2001 From: Radu Matei Date: Tue, 20 Feb 2018 20:23:09 +0200 Subject: [PATCH 050/449] Fix minor typo --- pkg/helm/option.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 4f6924db2..a8770a488 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -375,7 +375,7 @@ func UpgradeForce(force bool) UpdateOption { type ContentOption func(*options) // ContentReleaseVersion will instruct Tiller to retrieve the content -// of a paritcular version of a release. +// of a particular version of a release. func ContentReleaseVersion(version int32) ContentOption { return func(opts *options) { opts.contentReq.Version = version From 62f4360ccc1525deb07987bad74cd80d1adbdd0f Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Tue, 20 Feb 2018 22:11:29 -0800 Subject: [PATCH 051/449] docs(related): add helm-local plugin (#3547) --- docs/related.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/related.md b/docs/related.md index a753a123c..41b5c8f33 100644 --- a/docs/related.md +++ b/docs/related.md @@ -33,6 +33,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [helm-env](https://github.com/adamreese/helm-env) - Plugin to show current environment - [helm-last](https://github.com/adamreese/helm-last) - Plugin to show the latest release - [helm-nuke](https://github.com/adamreese/helm-nuke) - Plugin to destroy all releases +- [helm-local](https://github.com/adamreese/helm-local) - Plugin to run Tiller as a local daemon - [App Registry](https://github.com/app-registry/helm-plugin) - Plugin to manage charts via the [App Registry specification](https://github.com/app-registry/spec) - [helm-secrets](https://github.com/futuresimple/helm-secrets) - Plugin to manage and store secrets safely - [helm-edit](https://github.com/mstrzele/helm-edit) - Plugin for editing release's values @@ -55,7 +56,7 @@ Tools layered on top of Helm or Tiller. - [Landscaper](https://github.com/Eneco/landscaper/) - "Landscaper takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster." - [Rudder](https://github.com/AcalephStorage/rudder) - RESTful (JSON) proxy for Tiller's API - [Helmfile](https://github.com/roboll/helmfile) - Helmfile is a declarative spec for deploying helm charts -- [Autohelm](https://github.com/reactiveops/autohelm) - Autohelm is _another_ simple declarative spec for deploying helm charts. Written in python and supports git urls as a source for helm charts. +- [Autohelm](https://github.com/reactiveops/autohelm) - Autohelm is _another_ simple declarative spec for deploying helm charts. Written in python and supports git urls as a source for helm charts. - [Schelm](https://github.com/databus23/schelm) - Render a Helm manifest to a directory - [Drone.io Helm Plugin](http://plugins.drone.io/ipedrazas/drone-helm/) - Run Helm inside of the Drone CI/CD system - [Cog](https://github.com/ohaiwalt/cog-helm) - Helm chart to deploy Cog on Kubernetes From a52c8c654ee6de75a7b8b6d283f232d3199df368 Mon Sep 17 00:00:00 2001 From: Mauricio Scheffer Date: Fri, 23 Feb 2018 14:32:46 +0000 Subject: [PATCH 052/449] Fix link to Slack --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 039f34b38..01927aff3 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ The [Helm roadmap uses Github milestones](https://github.com/kubernetes/helm/mil You can reach the Helm community and developers via the following channels: -- [Kubernetes Slack](https://slack.k8s.io): +- [Kubernetes Slack](http://slack.k8s.io): - #helm-users - #helm-dev - #charts From 6d84486a1a324fcaf7f2c64852ba03b3cfa042fe Mon Sep 17 00:00:00 2001 From: Jean-Philippe Courson Date: Sat, 24 Feb 2018 17:12:37 +0000 Subject: [PATCH 053/449] Create missing directories when saving files in chartutil.SaveDir --- pkg/chartutil/save.go | 6 ++++++ pkg/chartutil/save_test.go | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index b89917d96..bff32dde5 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -70,6 +70,12 @@ func SaveDir(c *chart.Chart, dest string) error { // Save files for _, f := range c.Files { n := filepath.Join(outdir, f.TypeUrl) + + d := filepath.Dir(n) + if err := os.MkdirAll(d, 0755); err != nil { + return err + } + if err := ioutil.WriteFile(n, f.Value, 0755); err != nil { return err } diff --git a/pkg/chartutil/save_test.go b/pkg/chartutil/save_test.go index 566999ff7..5e1564299 100644 --- a/pkg/chartutil/save_test.go +++ b/pkg/chartutil/save_test.go @@ -22,6 +22,7 @@ import ( "strings" "testing" + "github.com/golang/protobuf/ptypes/any" "k8s.io/helm/pkg/proto/hapi/chart" ) @@ -40,6 +41,9 @@ func TestSave(t *testing.T) { Values: &chart.Config{ Raw: "ship: Pequod", }, + Files: []*any.Any{ + {TypeUrl: "scheherazade/shahryar.txt", Value: []byte("1,001 Nights")}, + }, } where, err := Save(c, tmp) @@ -64,6 +68,9 @@ func TestSave(t *testing.T) { if c2.Values.Raw != c.Values.Raw { t.Fatal("Values data did not match") } + if len(c2.Files) != 1 || c2.Files[0].TypeUrl != "scheherazade/shahryar.txt" { + t.Fatal("Files data did not match") + } } func TestSaveDir(t *testing.T) { @@ -81,6 +88,9 @@ func TestSaveDir(t *testing.T) { Values: &chart.Config{ Raw: "ship: Pequod", }, + Files: []*any.Any{ + {TypeUrl: "scheherazade/shahryar.txt", Value: []byte("1,001 Nights")}, + }, } if err := SaveDir(c, tmp); err != nil { @@ -98,4 +108,7 @@ func TestSaveDir(t *testing.T) { if c2.Values.Raw != c.Values.Raw { t.Fatal("Values data did not match") } + if len(c2.Files) != 1 || c2.Files[0].TypeUrl != "scheherazade/shahryar.txt" { + t.Fatal("Files data did not match") + } } From e4d2a4f0f38f892651511d4638434e4fec002ff3 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 26 Feb 2018 15:44:32 -0800 Subject: [PATCH 054/449] fix(plugins): support newer git (#3571) Newer gits don't like checking out an empty string. ``` empty string is not a valid pathspec. please use . instead if you meant to match all paths ``` --- pkg/plugin/installer/vcs_installer.go | 7 +++--- pkg/plugin/installer/vcs_installer_test.go | 26 +++++++++++----------- pkg/storage/driver/records_test.go | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/pkg/plugin/installer/vcs_installer.go b/pkg/plugin/installer/vcs_installer.go index d2ba3aa31..0a373a971 100644 --- a/pkg/plugin/installer/vcs_installer.go +++ b/pkg/plugin/installer/vcs_installer.go @@ -78,9 +78,10 @@ func (i *VCSInstaller) Install() error { if err != nil { return err } - - if err := i.setVersion(i.Repo, ref); err != nil { - return err + if ref != "" { + if err := i.setVersion(i.Repo, ref); err != nil { + return err + } } if !isPlugin(i.Repo.LocalPath()) { diff --git a/pkg/plugin/installer/vcs_installer_test.go b/pkg/plugin/installer/vcs_installer_test.go index 4abfc4c09..453899543 100644 --- a/pkg/plugin/installer/vcs_installer_test.go +++ b/pkg/plugin/installer/vcs_installer_test.go @@ -69,20 +69,20 @@ func TestVCSInstaller(t *testing.T) { i, err := NewForSource(source, "~0.1.0", home) if err != nil { - t.Errorf("unexpected error: %s", err) + t.Fatalf("unexpected error: %s", err) } // ensure a VCSInstaller was returned vcsInstaller, ok := i.(*VCSInstaller) if !ok { - t.Error("expected a VCSInstaller") + t.Fatal("expected a VCSInstaller") } // set the testRepo in the VCSInstaller vcsInstaller.Repo = repo if err := Install(i); err != nil { - t.Error(err) + t.Fatal(err) } if repo.current != "0.1.1" { t.Errorf("expected version '0.1.1', got %q", repo.current) @@ -123,13 +123,13 @@ func TestVCSInstallerNonExistentVersion(t *testing.T) { i, err := NewForSource(source, version, home) if err != nil { - t.Errorf("unexpected error: %s", err) + t.Fatalf("unexpected error: %s", err) } // ensure a VCSInstaller was returned _, ok := i.(*VCSInstaller) if !ok { - t.Error("expected a VCSInstaller") + t.Fatal("expected a VCSInstaller") } if err := Install(i); err == nil { @@ -155,40 +155,40 @@ func TestVCSInstallerUpdate(t *testing.T) { i, err := NewForSource(source, "", home) if err != nil { - t.Errorf("unexpected error: %s", err) + t.Fatalf("unexpected error: %s", err) } // ensure a VCSInstaller was returned _, ok := i.(*VCSInstaller) if !ok { - t.Error("expected a VCSInstaller") + t.Fatal("expected a VCSInstaller") } if err := Update(i); err == nil { - t.Error("expected error for plugin does not exist, got none") + t.Fatal("expected error for plugin does not exist, got none") } else if err.Error() != "plugin does not exist" { - t.Errorf("expected error for plugin does not exist, got (%v)", err) + t.Fatalf("expected error for plugin does not exist, got (%v)", err) } // Install plugin before update if err := Install(i); err != nil { - t.Error(err) + t.Fatal(err) } // Test FindSource method for positive result pluginInfo, err := FindSource(i.Path(), home) if err != nil { - t.Error(err) + t.Fatal(err) } repoRemote := pluginInfo.(*VCSInstaller).Repo.Remote() if repoRemote != source { - t.Errorf("invalid source found, expected %q got %q", source, repoRemote) + t.Fatalf("invalid source found, expected %q got %q", source, repoRemote) } // Update plugin if err := Update(i); err != nil { - t.Error(err) + t.Fatal(err) } // Test update failure diff --git a/pkg/storage/driver/records_test.go b/pkg/storage/driver/records_test.go index 607f7c139..79380afb8 100644 --- a/pkg/storage/driver/records_test.go +++ b/pkg/storage/driver/records_test.go @@ -78,7 +78,7 @@ func TestRecordsRemove(t *testing.T) { for _, tt := range tests { if r := rs.Remove(tt.key); r == nil { if !tt.ok { - t.Fatalf("Failed to %q (key = %s). Expected nil, got %s", + t.Fatalf("Failed to %q (key = %s). Expected nil, got %v", tt.desc, tt.key, r, From eaae3d6b13b17dc658ab5a6b834fc8d3d431d77f Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 26 Feb 2018 15:49:07 -0800 Subject: [PATCH 055/449] fix(plugins): support installing plugins by relative path (#3568) Support installing plugins by relative path ``` helm plugins install . ``` --- pkg/plugin/installer/installer.go | 2 +- pkg/plugin/installer/local_installer.go | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/plugin/installer/installer.go b/pkg/plugin/installer/installer.go index 10433f4cd..02aee9f46 100644 --- a/pkg/plugin/installer/installer.go +++ b/pkg/plugin/installer/installer.go @@ -21,9 +21,9 @@ import ( "os" "path" "path/filepath" + "strings" "k8s.io/helm/pkg/helm/helmpath" - "strings" ) // ErrMissingMetadata indicates that plugin.yaml is missing. diff --git a/pkg/plugin/installer/local_installer.go b/pkg/plugin/installer/local_installer.go index 18011f8de..3cf6bb422 100644 --- a/pkg/plugin/installer/local_installer.go +++ b/pkg/plugin/installer/local_installer.go @@ -16,6 +16,7 @@ limitations under the License. package installer // import "k8s.io/helm/pkg/plugin/installer" import ( + "fmt" "path/filepath" "k8s.io/helm/pkg/helm/helmpath" @@ -28,8 +29,12 @@ type LocalInstaller struct { // NewLocalInstaller creates a new LocalInstaller. func NewLocalInstaller(source string, home helmpath.Home) (*LocalInstaller, error) { + src, err := filepath.Abs(source) + if err != nil { + return nil, fmt.Errorf("unable to get absolute path to plugin: %v", err) + } i := &LocalInstaller{ - base: newBase(source, home), + base: newBase(src, home), } return i, nil } @@ -41,11 +46,7 @@ func (i *LocalInstaller) Install() error { if !isPlugin(i.Source) { return ErrMissingMetadata } - src, err := filepath.Abs(i.Source) - if err != nil { - return err - } - return i.link(src) + return i.link(i.Source) } // Update updates a local repository From 09b14ee3545cd16d394321fc9efe6ad78ff2a6f2 Mon Sep 17 00:00:00 2001 From: Lukas Eichler Date: Tue, 27 Feb 2018 09:16:02 +0100 Subject: [PATCH 056/449] docs(helm): Added kubeVersion to documentation. docs(helm): Added kubeVersion to documentation and examples. Adjusted wording for the Chart.kubeVersion description Removing redundant wording for Chart.kubeVersion description --- docs/charts.md | 1 + docs/examples/nginx/Chart.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/charts.md b/docs/charts.md index 00e0144f3..91ead584f 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -45,6 +45,7 @@ The `Chart.yaml` file is required for a chart. It contains the following fields: ```yaml name: The name of the chart (required) version: A SemVer 2 version (required) +kubeVersion: A SemVer range of compatible Kubernetes versions (optional) description: A single-sentence description of this project (optional) keywords: - A list of keywords about this project (optional) diff --git a/docs/examples/nginx/Chart.yaml b/docs/examples/nginx/Chart.yaml index 6ca92998d..f6e2de338 100644 --- a/docs/examples/nginx/Chart.yaml +++ b/docs/examples/nginx/Chart.yaml @@ -1,6 +1,7 @@ name: nginx description: A basic NGINX HTTP server version: 0.1.0 +kubeVersion: >= 1.2.0 keywords: - http - nginx From 3f5e777fbc39348652e637de62664b14a5c54788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Tue, 27 Feb 2018 19:25:40 +0100 Subject: [PATCH 057/449] fix(tiller): Supersede multiple deployments (#3539) * add test for rolling back from a FAILED deployment * Update naming of release variables Use same naming as the rest of the file. * Update rollback test - Add logging - Verify other release names not changed * fix(tiller): Supersede multiple deployments There are cases when multiple revisions of a release has been marked with DEPLOYED status. This makes sure any previous deployment will be set to SUPERSEDED when doing rollbacks. Closes #2941 #3513 #3275 --- pkg/storage/storage.go | 24 +++++++++++---- pkg/tiller/release_rollback.go | 46 +++++++++++++++++------------ pkg/tiller/release_rollback_test.go | 31 +++++++++++++++++-- pkg/tiller/release_server.go | 1 + 4 files changed, 76 insertions(+), 26 deletions(-) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 4ac5dbf4f..f76eb09f4 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -98,7 +98,7 @@ func (s *Storage) ListDeployed() ([]*rspb.Release, error) { }) } -// ListFilterAll returns the set of releases satisfying satisfying the predicate +// ListFilterAll returns the set of releases satisfying the predicate // (filter0 && filter1 && ... && filterN), i.e. a Release is included in the results // if and only if all filters return true. func (s *Storage) ListFilterAll(fns ...relutil.FilterFunc) ([]*rspb.Release, error) { @@ -108,7 +108,7 @@ func (s *Storage) ListFilterAll(fns ...relutil.FilterFunc) ([]*rspb.Release, err }) } -// ListFilterAny returns the set of releases satisfying satisfying the predicate +// ListFilterAny returns the set of releases satisfying the predicate // (filter0 || filter1 || ... || filterN), i.e. a Release is included in the results // if at least one of the filters returns true. func (s *Storage) ListFilterAny(fns ...relutil.FilterFunc) ([]*rspb.Release, error) { @@ -118,10 +118,24 @@ func (s *Storage) ListFilterAny(fns ...relutil.FilterFunc) ([]*rspb.Release, err }) } -// Deployed returns the deployed release with the provided release name, or +// Deployed returns the last deployed release with the provided release name, or // returns ErrReleaseNotFound if not found. func (s *Storage) Deployed(name string) (*rspb.Release, error) { - s.Log("getting deployed release from %q history", name) + ls, err := s.DeployedAll(name) + if err != nil { + if strings.Contains(err.Error(), "not found") { + return nil, fmt.Errorf("%q has no deployed releases", name) + } + return nil, err + } + + return ls[0], err +} + +// DeployedAll returns all deployed releases with the provided name, or +// returns ErrReleaseNotFound if not found. +func (s *Storage) DeployedAll(name string) ([]*rspb.Release, error) { + s.Log("getting deployed releases from %q history", name) ls, err := s.Driver.Query(map[string]string{ "NAME": name, @@ -129,7 +143,7 @@ func (s *Storage) Deployed(name string) (*rspb.Release, error) { "STATUS": "DEPLOYED", }) if err == nil { - return ls[0], nil + return ls, nil } if strings.Contains(err.Error(), "not found") { return nil, fmt.Errorf("%q has no deployed releases", name) diff --git a/pkg/tiller/release_rollback.go b/pkg/tiller/release_rollback.go index e8b6435b5..fe9a6a032 100644 --- a/pkg/tiller/release_rollback.go +++ b/pkg/tiller/release_rollback.go @@ -69,46 +69,46 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (* return nil, nil, errInvalidRevision } - crls, err := s.env.Releases.Last(req.Name) + currentRelease, err := s.env.Releases.Last(req.Name) if err != nil { return nil, nil, err } - rbv := req.Version + previousVersion := req.Version if req.Version == 0 { - rbv = crls.Version - 1 + previousVersion = currentRelease.Version - 1 } - s.Log("rolling back %s (current: v%d, target: v%d)", req.Name, crls.Version, rbv) + s.Log("rolling back %s (current: v%d, target: v%d)", req.Name, currentRelease.Version, previousVersion) - prls, err := s.env.Releases.Get(req.Name, rbv) + previousRelease, err := s.env.Releases.Get(req.Name, previousVersion) if err != nil { return nil, nil, err } // Store a new release object with previous release's configuration - target := &release.Release{ + targetRelease := &release.Release{ Name: req.Name, - Namespace: crls.Namespace, - Chart: prls.Chart, - Config: prls.Config, + Namespace: currentRelease.Namespace, + Chart: previousRelease.Chart, + Config: previousRelease.Config, Info: &release.Info{ - FirstDeployed: crls.Info.FirstDeployed, + FirstDeployed: currentRelease.Info.FirstDeployed, LastDeployed: timeconv.Now(), Status: &release.Status{ Code: release.Status_PENDING_ROLLBACK, - Notes: prls.Info.Status.Notes, + Notes: previousRelease.Info.Status.Notes, }, - // Because we lose the reference to rbv elsewhere, we set the + // Because we lose the reference to previous version elsewhere, we set the // message here, and only override it later if we experience failure. - Description: fmt.Sprintf("Rollback to %d", rbv), + Description: fmt.Sprintf("Rollback to %d", previousVersion), }, - Version: crls.Version + 1, - Manifest: prls.Manifest, - Hooks: prls.Hooks, + Version: currentRelease.Version + 1, + Manifest: previousRelease.Manifest, + Hooks: previousRelease.Hooks, } - return crls, target, nil + return currentRelease, targetRelease, nil } func (s *ReleaseServer) performRollback(currentRelease, targetRelease *release.Release, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) { @@ -146,8 +146,16 @@ func (s *ReleaseServer) performRollback(currentRelease, targetRelease *release.R } } - currentRelease.Info.Status.Code = release.Status_SUPERSEDED - s.recordRelease(currentRelease, true) + deployed, err := s.env.Releases.DeployedAll(currentRelease.Name) + if err != nil { + return nil, err + } + // Supersede all previous deployments, see issue #2941. + for _, r := range deployed { + s.Log("superseding previous deployment %d", r.Version) + r.Info.Status.Code = release.Status_SUPERSEDED + s.recordRelease(r, true) + } targetRelease.Info.Status.Code = release.Status_DEPLOYED diff --git a/pkg/tiller/release_rollback_test.go b/pkg/tiller/release_rollback_test.go index aa3a764f6..b73501a36 100644 --- a/pkg/tiller/release_rollback_test.go +++ b/pkg/tiller/release_rollback_test.go @@ -139,11 +139,22 @@ func TestRollbackRelease(t *testing.T) { func TestRollbackWithReleaseVersion(t *testing.T) { c := helm.NewContext() rs := rsFixture() + rs.Log = t.Logf + rs.env.Releases.Log = t.Logf + rel2 := releaseStub() + rel2.Name = "other" + rs.env.Releases.Create(rel2) rel := releaseStub() rs.env.Releases.Create(rel) - upgradedRel := upgradeReleaseVersion(rel) + v2 := upgradeReleaseVersion(rel) rs.env.Releases.Update(rel) - rs.env.Releases.Create(upgradedRel) + rs.env.Releases.Create(v2) + v3 := upgradeReleaseVersion(v2) + // retain the original release as DEPLOYED while the update should fail + v2.Info.Status.Code = release.Status_DEPLOYED + v3.Info.Status.Code = release.Status_FAILED + rs.env.Releases.Update(v2) + rs.env.Releases.Create(v3) req := &services.RollbackReleaseRequest{ Name: rel.Name, @@ -155,6 +166,22 @@ func TestRollbackWithReleaseVersion(t *testing.T) { if err != nil { t.Fatalf("Failed rollback: %s", err) } + // check that v2 is now in a SUPERSEDED state + oldRel, err := rs.env.Releases.Get(rel.Name, 2) + if err != nil { + t.Fatalf("Failed to retrieve v1: %s", err) + } + if oldRel.Info.Status.Code != release.Status_SUPERSEDED { + t.Errorf("Expected v2 to be in a SUPERSEDED state, got %q", oldRel.Info.Status.Code) + } + // make sure we didn't update some other deployments. + otherRel, err := rs.env.Releases.Get(rel2.Name, 1) + if err != nil { + t.Fatalf("Failed to retrieve other v1: %s", err) + } + if otherRel.Info.Status.Code != release.Status_DEPLOYED { + t.Errorf("Expected other deployed release to stay untouched, got %q", otherRel.Info.Status.Code) + } } func TestRollbackReleaseNoHooks(t *testing.T) { diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index 31a043030..a96c64938 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -316,6 +316,7 @@ func (s *ReleaseServer) renderResources(ch *chart.Chart, values chartutil.Values return hooks, b, notes, nil } +// recordRelease with an update operation in case reuse has been set. func (s *ReleaseServer) recordRelease(r *release.Release, reuse bool) { if reuse { if err := s.env.Releases.Update(r); err != nil { From b643d3f33d6fe66d4ecb8eeb6049b9f539236bd2 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 27 Feb 2018 13:48:34 -0800 Subject: [PATCH 058/449] fix(circle): fix download link to download.docker.com Docker stopped releasing binaries to get.docker.com as of 17.03.0-ce. They are all hosted at download.docker.com now. I also had to downgrade docker to 17.09.0-ce because that's the only version that both download.docker.com and CircleCI support. https://download.docker.com/linux/static/stable/x86_64/ https://circleci.com/docs/2.0/building-docker-images/#docker-version --- .circleci/config.yml | 2 +- .circleci/deploy.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 477c72f59..f3c8feead 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ jobs: steps: - checkout - setup_remote_docker: - version: 17.11.0-ce + version: 17.09.0-ce - restore_cache: keys: - glide-{{ checksum "glide.yaml" }}-{{ checksum "glide.lock" }} diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh index 7f2ca7122..d29a353ee 100755 --- a/.circleci/deploy.sh +++ b/.circleci/deploy.sh @@ -34,8 +34,8 @@ else fi echo "Install docker client" -VER="17.11.0-ce" -curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz +VER="17.09.0-ce" +curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz tar -xz -C /tmp -f /tmp/docker-$VER.tgz mv /tmp/docker/* /usr/bin From b1f7dab8f7305ec99725ce03f978cce3d5601702 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 27 Feb 2018 15:15:10 -0800 Subject: [PATCH 059/449] remove deprecated -e flag to `docker login` --- .circleci/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh index d29a353ee..6ad91109d 100755 --- a/.circleci/deploy.sh +++ b/.circleci/deploy.sh @@ -48,7 +48,7 @@ echo "Configuring gcloud authentication" echo "${GCLOUD_SERVICE_KEY}" | base64 --decode > "${HOME}/gcloud-service-key.json" ${HOME}/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file "${HOME}/gcloud-service-key.json" ${HOME}/google-cloud-sdk/bin/gcloud config set project "${PROJECT_NAME}" -docker login -e 1234@5678.com -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io +docker login -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io echo "Building the tiller image" make docker-build VERSION="${VERSION}" From 0e96bd52d4012423cef109bed3f7039f334cb653 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Wed, 28 Feb 2018 16:00:35 +0000 Subject: [PATCH 060/449] Add link to securing helm docs in 'helm init' text --- cmd/helm/init.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index c8753874f..cccd8a83d 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -310,7 +310,9 @@ func (i *initCmd) run() error { if err := i.ping(); err != nil { return err } - fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.") + fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.\n\n"+ + "Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.\n"+ + "For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation") } } else { fmt.Fprintln(i.out, "Not installing Tiller due to 'client-only' flag having been set") From 35cd8cfe35a0c121bef17df49752d56a665f0b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Fri, 2 Mar 2018 12:56:34 +0100 Subject: [PATCH 061/449] Add helm-hashtag plugin https://github.com/balboah/helm-hashtag --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index 41b5c8f33..5bccaa26f 100644 --- a/docs/related.md +++ b/docs/related.md @@ -41,6 +41,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [helm-github](https://github.com/sagansystems/helm-github) - Plugin to install Helm Charts from Github repositories - [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query - [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp +- [helm-hashtag](https://github.com/balboah/helm-hashtag) - Plugin for tracking docker tag hash digests as values We also encourage GitHub authors to use the [helm-plugin](https://github.com/search?q=topic%3Ahelm-plugin&type=Repositories) tag on their plugin repositories. From b343f0457f9e963d2ae7a6e38be06dd713756cc4 Mon Sep 17 00:00:00 2001 From: Sami Alajrami Date: Fri, 2 Mar 2018 13:14:05 +0100 Subject: [PATCH 062/449] adding Helmsman in docs/related.md --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index 41b5c8f33..4623aa3f2 100644 --- a/docs/related.md +++ b/docs/related.md @@ -57,6 +57,7 @@ Tools layered on top of Helm or Tiller. - [Rudder](https://github.com/AcalephStorage/rudder) - RESTful (JSON) proxy for Tiller's API - [Helmfile](https://github.com/roboll/helmfile) - Helmfile is a declarative spec for deploying helm charts - [Autohelm](https://github.com/reactiveops/autohelm) - Autohelm is _another_ simple declarative spec for deploying helm charts. Written in python and supports git urls as a source for helm charts. +- [Helmsman](https://github.com/Praqma/helmsman) - Helmsman is a helm-charts-as-code tool which enables installing/upgrading/protecting/moving/deleting releases from version controlled desired state files (described in a simple TOML format). - [Schelm](https://github.com/databus23/schelm) - Render a Helm manifest to a directory - [Drone.io Helm Plugin](http://plugins.drone.io/ipedrazas/drone-helm/) - Run Helm inside of the Drone CI/CD system - [Cog](https://github.com/ohaiwalt/cog-helm) - Helm chart to deploy Cog on Kubernetes From a6ba3240b1cf4191b3787d1cc3701dbc506db8b8 Mon Sep 17 00:00:00 2001 From: Ryan Payton Date: Thu, 7 Sep 2017 12:57:23 -0700 Subject: [PATCH 063/449] updating DownloadIndexFile function call to pass in HELM_HOME --- cmd/helm/init.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index c8753874f..c0a7f6fcf 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -362,7 +362,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool) err if fi, err := os.Stat(repoFile); err != nil { fmt.Fprintf(out, "Creating %s \n", repoFile) f := repo.NewRepoFile() - sr, err := initStableRepo(home.CacheIndex(stableRepository), out, skipRefresh) + sr, err := initStableRepo(home.CacheIndex(stableRepository), out, skipRefresh, home) if err != nil { return err } @@ -381,7 +381,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool) err return nil } -func initStableRepo(cacheFile string, out io.Writer, skipRefresh bool) (*repo.Entry, error) { +func initStableRepo(cacheFile string, out io.Writer, skipRefresh bool, home helmpath.Home) (*repo.Entry, error) { fmt.Fprintf(out, "Adding %s repo with URL: %s \n", stableRepository, stableRepositoryURL) c := repo.Entry{ Name: stableRepository, From 13c01621f83bf4ee99a5104a50f556cb55acfb5b Mon Sep 17 00:00:00 2001 From: "Christopher A. Stelma" Date: Thu, 1 Mar 2018 14:52:11 -0800 Subject: [PATCH 064/449] pass home down through createLink --- cmd/helm/init.go | 8 +++++--- cmd/helm/init_unix.go | 6 ++++-- cmd/helm/init_windows.go | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index c0a7f6fcf..9fbd5fc89 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -366,7 +366,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool) err if err != nil { return err } - lr, err := initLocalRepo(home.LocalRepository(localRepositoryIndexFile), home.CacheIndex("local"), out) + lr, err := initLocalRepo(home.LocalRepository(localRepositoryIndexFile), home.CacheIndex("local"), out, home) if err != nil { return err } @@ -406,7 +406,7 @@ func initStableRepo(cacheFile string, out io.Writer, skipRefresh bool, home helm return &c, nil } -func initLocalRepo(indexFile, cacheFile string, out io.Writer) (*repo.Entry, error) { +func initLocalRepo(indexFile, cacheFile string, out io.Writer, home helmpath.Home) (*repo.Entry, error) { if fi, err := os.Stat(indexFile); err != nil { fmt.Fprintf(out, "Adding %s repo with URL: %s \n", localRepository, localRepositoryURL) i := repo.NewIndexFile() @@ -415,7 +415,9 @@ func initLocalRepo(indexFile, cacheFile string, out io.Writer) (*repo.Entry, err } //TODO: take this out and replace with helm update functionality - createLink(indexFile, cacheFile) + if err := createLink(indexFile, cacheFile, home); err != nil { + return nil, err + } } else if fi.IsDir() { return nil, fmt.Errorf("%s must be a file, not a directory", indexFile) } diff --git a/cmd/helm/init_unix.go b/cmd/helm/init_unix.go index ff6260434..1117dd487 100644 --- a/cmd/helm/init_unix.go +++ b/cmd/helm/init_unix.go @@ -20,8 +20,10 @@ package main import ( "os" + + "k8s.io/helm/pkg/helm/helmpath" ) -func createLink(indexFile, cacheFile string) { - os.Symlink(indexFile, cacheFile) +func createLink(indexFile, cacheFile string, home helmpath.Home) error { + return os.Symlink(indexFile, cacheFile) } diff --git a/cmd/helm/init_windows.go b/cmd/helm/init_windows.go index 73ae6c6de..be17bccda 100644 --- a/cmd/helm/init_windows.go +++ b/cmd/helm/init_windows.go @@ -20,8 +20,10 @@ package main import ( "os" + + "k8s.io/helm/pkg/helm/helmpath" ) -func createLink(indexFile, cacheFile string) { - os.Link(indexFile, cacheFile) +func createLink(indexFile, cacheFile string, home helmpath.Home) error { + return os.Link(indexFile, cacheFile) } From a3905626893705cec75a3dd534cdfaa01d4700f6 Mon Sep 17 00:00:00 2001 From: Evans Castonguay Date: Sun, 4 Mar 2018 10:06:35 -0500 Subject: [PATCH 065/449] Add instruction to support new GnuGP version The latest GnuGP tool (https://gnupg.org/download/) is now storing keyring in a new format file 'kbx' instead of 'gpg' which make the current documentation incomplete for a new user. The propose pull request consists of adding documentation to explain how to generate a gpg using the latest GnuGP tool --- docs/provenance.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/provenance.md b/docs/provenance.md index 1f1361513..fd7552657 100644 --- a/docs/provenance.md +++ b/docs/provenance.md @@ -52,6 +52,12 @@ $ helm package --sign --key 'helm signing key' --keyring path/to/keyring.secret **TIP:** for GnuPG users, your secret keyring is in `~/.gnupg/secring.gpg`. You can use `gpg --list-secret-keys` to list the keys you have. +**Warning:** the latest GnuPG version store your secret keyring using a new format 'kbx' on the default location '~/.gnupg/pubring.kbx'. Please use the following command to convert your keyring to the legacy gpg format: + +``` +$ gpg --export-secret-keys >~/.gnupg/secring.gpg +``` + At this point, you should see both `mychart-0.1.0.tgz` and `mychart-0.1.0.tgz.prov`. Both files should eventually be uploaded to your desired chart repository. From 4860eac0cc2dfd327b02632c0493545d72a033a7 Mon Sep 17 00:00:00 2001 From: Itay Shakury Date: Mon, 5 Mar 2018 22:42:01 +0200 Subject: [PATCH 066/449] added Codefresh --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index 7a8b3a70e..6fbdf7df3 100644 --- a/docs/related.md +++ b/docs/related.md @@ -67,6 +67,7 @@ Tools layered on top of Helm or Tiller. - [Armada](https://github.com/att-comdev/armada) - Manage prefixed releases throughout various Kubernetes namespaces, and removes completed jobs for complex deployments. Used by the [Openstack-Helm](https://github.com/openstack/openstack-helm) team. - [ChartMuseum](https://github.com/chartmuseum/chartmuseum) - Helm Chart Repository with support for Amazon S3 and Google Cloud Storage - [Helm.NET](https://github.com/qmfrederik/helm) - A .NET client for Tiller's API +- [Codefresh](https://codefresh.io) - Kubernetes native CI/CD and management platform with UI dashboards for managing Helm charts and releases ## Helm Included From cddc681112a96df39b2cf298f45145d48245b600 Mon Sep 17 00:00:00 2001 From: Yaroslav Molochko Date: Tue, 6 Mar 2018 02:21:17 +0200 Subject: [PATCH 067/449] Add --replicas option for HA fixes #2334 --- cmd/helm/init.go | 3 +++ cmd/helm/installer/install.go | 1 + cmd/helm/installer/install_test.go | 27 +++++++++++++++++++++++++++ cmd/helm/installer/options.go | 13 +++++++++++++ docs/helm/helm_init.md | 3 ++- 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index cccd8a83d..49adfc2c3 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -86,6 +86,7 @@ type initCmd struct { kubeClient kubernetes.Interface serviceAccount string maxHistory int + replicas int wait bool } @@ -130,6 +131,7 @@ func newInitCmd(out io.Writer) *cobra.Command { f.BoolVar(&i.opts.EnableHostNetwork, "net-host", false, "install Tiller with net=host") f.StringVar(&i.serviceAccount, "service-account", "", "name of service account") f.IntVar(&i.maxHistory, "history-max", 0, "limit the maximum number of revisions saved per release. Use 0 for no limit.") + f.IntVar(&i.replicas, "replicas", 1, "amount of tiller instances to run on the cluster") f.StringVar(&i.opts.NodeSelectors, "node-selectors", "", "labels to specify the node on which Tiller is installed (app=tiller,helm=rocks)") f.VarP(&i.opts.Output, "output", "o", "skip installation and output Tiller's manifest in specified format (json or yaml)") @@ -175,6 +177,7 @@ func (i *initCmd) run() error { i.opts.ForceUpgrade = i.forceUpgrade i.opts.ServiceAccount = i.serviceAccount i.opts.MaxHistory = i.maxHistory + i.opts.Replicas = i.replicas writeYAMLManifest := func(apiVersion, kind, body string, first, last bool) error { w := i.out diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index 230c7b39b..fc81fa26b 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -183,6 +183,7 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { Labels: labels, }, Spec: v1beta1.DeploymentSpec{ + Replicas: opts.getReplicas(), Template: v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: labels, diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index eaea05870..dbb7143e3 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -211,6 +211,10 @@ func TestInstall(t *testing.T) { if ports != 2 { t.Errorf("expected ports = 2, got '%d'", ports) } + replicas := obj.Spec.Replicas + if int(*replicas) != 1 { + t.Errorf("expected replicas = 1, got '%d'", replicas) + } return true, obj, nil }) fc.AddReactor("create", "services", func(action testcore.Action) (bool, runtime.Object, error) { @@ -236,6 +240,29 @@ func TestInstall(t *testing.T) { } } +func TestInstallHA(t *testing.T) { + image := "gcr.io/kubernetes-helm/tiller:v2.0.0" + + fc := &fake.Clientset{} + fc.AddReactor("create", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { + obj := action.(testcore.CreateAction).GetObject().(*v1beta1.Deployment) + replicas := obj.Spec.Replicas + if int(*replicas) != 2 { + t.Errorf("expected replicas = 2, got '%d'", replicas) + } + return true, obj, nil + }) + + opts := &Options{ + Namespace: v1.NamespaceDefault, + ImageSpec: image, + Replicas: 2, + } + if err := Install(fc, opts); err != nil { + t.Errorf("unexpected error: %#+v", err) + } +} + func TestInstall_WithTLS(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" name := "tiller-secret" diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index edff2740f..13cf43dcc 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -81,6 +81,11 @@ type Options struct { // Less than or equal to zero means no limit. MaxHistory int + // Replicas sets the amount of Tiller replicas to start + // + // Less than or equals to 1 means 1. + Replicas int + // NodeSelectors determine which nodes Tiller can land on. NodeSelectors string @@ -109,6 +114,14 @@ func (opts *Options) pullPolicy() v1.PullPolicy { return v1.PullIfNotPresent } +func (opts *Options) getReplicas() *int32 { + replicas := int32(1) + if opts.Replicas > 1 { + replicas = int32(opts.Replicas) + } + return &replicas +} + func (opts *Options) tls() bool { return opts.EnableTLS || opts.VerifyTLS } // valuesMap returns user set values in map format diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index 856e9b565..5ed24e60d 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -43,6 +43,7 @@ helm init --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) --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) --service-account string name of service account --skip-refresh do not refresh (download) the local repository cache --stable-repo-url string URL for stable repository (default "https://kubernetes-charts.storage.googleapis.com") @@ -69,4 +70,4 @@ helm init ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 6-Mar-2018 From 7f538546aec0badc922cd566d4dad58fecf0cc06 Mon Sep 17 00:00:00 2001 From: Chen Zhiwei Date: Mon, 5 Mar 2018 15:01:35 +0800 Subject: [PATCH 068/449] Change helm update to helm upgrade --- docs/chart_template_guide/values_files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/values_files.md b/docs/chart_template_guide/values_files.md index 31b34175a..32a178735 100644 --- a/docs/chart_template_guide/values_files.md +++ b/docs/chart_template_guide/values_files.md @@ -4,7 +4,7 @@ In the previous section we looked at the built-in objects that Helm templates of - The `values.yaml` file in the chart - If this is a subchart, the `values.yaml` file of a parent chart -- A values file if passed into `helm install` or `helm update` with the `-f` flag (`helm install -f myvals.yaml ./mychart`) +- A values file if passed into `helm install` or `helm upgrade` with the `-f` flag (`helm install -f myvals.yaml ./mychart`) - Individual parameters passed with `--set` (such as `helm install --set foo=bar ./mychart`) The list above is in order of specificity: `values.yaml` is the default, which can be overridden by a parent chart's `values.yaml`, which can in turn be overridden by a user-supplied values file, which can in turn be overridden by `--set` parameters. From 85a754ed3bab292529117aa8764bed115cb3510d Mon Sep 17 00:00:00 2001 From: Morgan Parry Date: Tue, 6 Mar 2018 11:06:50 +0000 Subject: [PATCH 069/449] fix(helm): Don't crash in search if upper case chars are encountered. Closes #3088 --- cmd/helm/search/search.go | 10 +++++----- cmd/helm/search/search_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/helm/search/search.go b/cmd/helm/search/search.go index a24208a4b..6c4cb4aa4 100644 --- a/cmd/helm/search/search.go +++ b/cmd/helm/search/search.go @@ -146,11 +146,11 @@ func (i *Index) SearchLiteral(term string, threshold int) []*Result { term = strings.ToLower(term) buf := []*Result{} for k, v := range i.lines { - k = strings.ToLower(k) - v = strings.ToLower(v) - res := strings.Index(v, term) - if score := i.calcScore(res, v); res != -1 && score < threshold { - parts := strings.Split(k, verSep) // Remove version, if it is there. + lk := strings.ToLower(k) + lv := strings.ToLower(v) + res := strings.Index(lv, term) + if score := i.calcScore(res, lv); res != -1 && score < threshold { + parts := strings.Split(lk, verSep) // Remove version, if it is there. buf = append(buf, &Result{Name: parts[0], Score: score, Chart: i.charts[k]}) } } diff --git a/cmd/helm/search/search_test.go b/cmd/helm/search/search_test.go index 949cf7be7..574f55448 100644 --- a/cmd/helm/search/search_test.go +++ b/cmd/helm/search/search_test.go @@ -91,10 +91,10 @@ var indexfileEntries = map[string]repo.ChartVersions{ }, }, { - URLs: []string{"http://example.com/charts/santa-maria-1.2.2.tgz"}, + URLs: []string{"http://example.com/charts/santa-maria-1.2.2-rc-1.tgz"}, Metadata: &chart.Metadata{ Name: "santa-maria", - Version: "1.2.2", + Version: "1.2.2-RC-1", Description: "Three boat", }, }, From 37fb0b5c121a5dac04d2ae98f7e175c810bdc809 Mon Sep 17 00:00:00 2001 From: Evans Castonguay Date: Tue, 6 Mar 2018 14:47:55 -0500 Subject: [PATCH 070/449] update the documentation to refere to GnuPG v2 update the documentation to refere to GnuPG v2 instead of latest GnuPG --- docs/provenance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/provenance.md b/docs/provenance.md index fd7552657..1eb69f8f3 100644 --- a/docs/provenance.md +++ b/docs/provenance.md @@ -52,7 +52,7 @@ $ helm package --sign --key 'helm signing key' --keyring path/to/keyring.secret **TIP:** for GnuPG users, your secret keyring is in `~/.gnupg/secring.gpg`. You can use `gpg --list-secret-keys` to list the keys you have. -**Warning:** the latest GnuPG version store your secret keyring using a new format 'kbx' on the default location '~/.gnupg/pubring.kbx'. Please use the following command to convert your keyring to the legacy gpg format: +**Warning:** the GnuPG v2 store your secret keyring using a new format 'kbx' on the default location '~/.gnupg/pubring.kbx'. Please use the following command to convert your keyring to the legacy gpg format: ``` $ gpg --export-secret-keys >~/.gnupg/secring.gpg From 7c283c183c7320b2139a711f47311f2555573399 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Wed, 14 Feb 2018 09:09:35 -0500 Subject: [PATCH 071/449] fix(helm): fix the bug in test code 'cmd/helm/init_test.go' and 'cmd/helm/repo_update_test.go' that leave behind temporary helm home directories during build. With this fix, the build process no longer leaves behind 'helm_home-*' temp directories. Signed-off-by: Arash Deshmeh --- cmd/helm/init_test.go | 8 ++++---- cmd/helm/repo_update_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/helm/init_test.go b/cmd/helm/init_test.go index 4513315b7..6a5767fca 100644 --- a/cmd/helm/init_test.go +++ b/cmd/helm/init_test.go @@ -46,7 +46,7 @@ func TestInitCmd(t *testing.T) { if err != nil { t.Fatal(err) } - defer os.Remove(home) + defer os.RemoveAll(home) var buf bytes.Buffer fc := fake.NewSimpleClientset() @@ -80,7 +80,7 @@ func TestInitCmd_exists(t *testing.T) { if err != nil { t.Fatal(err) } - defer os.Remove(home) + defer os.RemoveAll(home) var buf bytes.Buffer fc := fake.NewSimpleClientset(&v1beta1.Deployment{ @@ -113,7 +113,7 @@ func TestInitCmd_clientOnly(t *testing.T) { if err != nil { t.Fatal(err) } - defer os.Remove(home) + defer os.RemoveAll(home) var buf bytes.Buffer fc := fake.NewSimpleClientset() @@ -184,7 +184,7 @@ func TestEnsureHome(t *testing.T) { if err != nil { t.Fatal(err) } - defer os.Remove(home) + defer os.RemoveAll(home) b := bytes.NewBuffer(nil) hh := helmpath.Home(home) diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go index e6f2af32f..68f964f32 100644 --- a/cmd/helm/repo_update_test.go +++ b/cmd/helm/repo_update_test.go @@ -37,7 +37,7 @@ func TestUpdateCmd(t *testing.T) { cleanup := resetEnv() defer func() { - os.Remove(thome.String()) + os.RemoveAll(thome.String()) cleanup() }() From c4b57b501fd24958c7d34999449d4816f3d81519 Mon Sep 17 00:00:00 2001 From: bryangunn <30510064+bryangunn@users.noreply.github.com> Date: Tue, 6 Mar 2018 15:51:28 -0500 Subject: [PATCH 072/449] Fixed bad link to Issues page The link to the issues page was giving a 404 due to a malformed URL. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c98d49a05..6247f7b21 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ The Kubernetes Helm project accepts contributions via GitHub pull requests. This ## Reporting a Security Issue Most of the time, when you find a bug in Helm, it should be reported -using [GitHub issues](github.com/kubernetes/helm/issues). However, if +using [GitHub issues](https://github.com/kubernetes/helm/issues). However, if you are reporting a _security vulnerability_, please email a report to [helm-security@deis.com](mailto:helm-security@deis.com). This will give us a chance to try to fix the issue before it is exploited in the wild. From 4b274d8d4e523014f624c7b44241bae57489436c Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 6 Mar 2018 15:57:26 -0800 Subject: [PATCH 073/449] fix kubeVersion example --- docs/examples/nginx/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/nginx/Chart.yaml b/docs/examples/nginx/Chart.yaml index f6e2de338..807455210 100644 --- a/docs/examples/nginx/Chart.yaml +++ b/docs/examples/nginx/Chart.yaml @@ -1,7 +1,7 @@ name: nginx description: A basic NGINX HTTP server version: 0.1.0 -kubeVersion: >= 1.2.0 +kubeVersion: ">=1.2.0" keywords: - http - nginx From e4e11922aea6f8f62424fc8825d4fe1209ffa9c2 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 7 Mar 2018 09:55:41 -0800 Subject: [PATCH 074/449] bump go to 1.10 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f3c8feead..df9786d82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ jobs: working_directory: /go/src/k8s.io/helm parallelism: 3 docker: - - image: golang:1.8 + - image: golang:1.10 environment: PROJECT_NAME: "kubernetes-helm" steps: From 1381bc74313ee2c054f8084ce3b7c0302ae0bae4 Mon Sep 17 00:00:00 2001 From: Greg Burton Date: Wed, 7 Mar 2018 15:40:31 -0800 Subject: [PATCH 075/449] Respect env proxy settings when using custom Transport --- pkg/getter/httpgetter.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index 5a2146ec6..c86b96458 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -76,6 +76,7 @@ func newHTTPGetter(URL, CertFile, KeyFile, CAFile string) (Getter, error) { client.client = &http.Client{ Transport: &http.Transport{ TLSClientConfig: tlsConf, + Proxy: http.ProxyFromEnvironment, }, } } else { From 9d53cb90b7ee444f057b8694689b1e886580639a Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 8 Mar 2018 15:30:42 -0500 Subject: [PATCH 076/449] fix(helm): remove duplicate test code from cmd/helm/list_test. Closes #3637 Signed-off-by: Arash Deshmeh --- cmd/helm/list_test.go | 82 ++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 51 deletions(-) diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index 6e3321664..d853fa6b1 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -17,50 +17,44 @@ limitations under the License. package main import ( - "bytes" - "regexp" + "io" "testing" + "github.com/spf13/cobra" + "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/release" ) func TestListCmd(t *testing.T) { - tests := []struct { - name string - args []string - resp []*release.Release - expected string - err bool - }{ + tests := []releaseCase{ { name: "with a release", - resp: []*release.Release{ + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), }, expected: "thomas-guide", }, { name: "list", - args: []string{}, - resp: []*release.Release{ + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}), }, expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\tdefault \n", }, { - name: "list, one deployed, one failed", - args: []string{"-q"}, - resp: []*release.Release{ + name: "list, one deployed, one failed", + flags: []string{"-q"}, + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", StatusCode: release.Status_FAILED}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), }, expected: "thomas-guide\natlas-guide", }, { - name: "with a release, multiple flags", - args: []string{"--deleted", "--deployed", "--failed", "-q"}, - resp: []*release.Release{ + name: "with a release, multiple flags", + flags: []string{"--deleted", "--deployed", "--failed", "-q"}, + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", StatusCode: release.Status_DELETED}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), }, @@ -69,9 +63,9 @@ func TestListCmd(t *testing.T) { expected: "thomas-guide\natlas-guide", }, { - name: "with a release, multiple flags", - args: []string{"--all", "-q"}, - resp: []*release.Release{ + name: "with a release, multiple flags", + flags: []string{"--all", "-q"}, + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", StatusCode: release.Status_DELETED}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), }, @@ -79,9 +73,9 @@ func TestListCmd(t *testing.T) { expected: "thomas-guide\natlas-guide", }, { - name: "with a release, multiple flags, deleting", - args: []string{"--all", "-q"}, - resp: []*release.Release{ + name: "with a release, multiple flags, deleting", + flags: []string{"--all", "-q"}, + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", StatusCode: release.Status_DELETING}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), }, @@ -89,9 +83,9 @@ func TestListCmd(t *testing.T) { expected: "thomas-guide\natlas-guide", }, { - name: "namespace defined, multiple flags", - args: []string{"--all", "-q", "--namespace test123"}, - resp: []*release.Release{ + name: "namespace defined, multiple flags", + flags: []string{"--all", "-q", "--namespace test123"}, + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Namespace: "test123"}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Namespace: "test321"}), }, @@ -99,18 +93,18 @@ func TestListCmd(t *testing.T) { expected: "thomas-guide", }, { - name: "with a pending release, multiple flags", - args: []string{"--all", "-q"}, - resp: []*release.Release{ + name: "with a pending release, multiple flags", + flags: []string{"--all", "-q"}, + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", StatusCode: release.Status_PENDING_INSTALL}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), }, expected: "thomas-guide\natlas-guide", }, { - name: "with a pending release, pending flag", - args: []string{"--pending", "-q"}, - resp: []*release.Release{ + name: "with a pending release, pending flag", + flags: []string{"--pending", "-q"}, + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", StatusCode: release.Status_PENDING_INSTALL}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "wild-idea", StatusCode: release.Status_PENDING_UPGRADE}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-maps", StatusCode: release.Status_PENDING_ROLLBACK}), @@ -120,7 +114,7 @@ func TestListCmd(t *testing.T) { }, { name: "with old releases", - resp: []*release.Release{ + rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", StatusCode: release.Status_FAILED}), }, @@ -128,21 +122,7 @@ func TestListCmd(t *testing.T) { }, } - var buf bytes.Buffer - for _, tt := range tests { - c := &helm.FakeClient{ - Rels: tt.resp, - } - cmd := newListCmd(c, &buf) - cmd.ParseFlags(tt.args) - err := cmd.RunE(cmd, tt.args) - if (err != nil) != tt.err { - t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err) - } - re := regexp.MustCompile(tt.expected) - if !re.Match(buf.Bytes()) { - t.Errorf("%q. expected\n%q\ngot\n%q", tt.name, tt.expected, buf.String()) - } - buf.Reset() - } + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newListCmd(c, out) + }) } From b7165a40ef61dfbd077a35bd92527d1d2987eab1 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 6 Mar 2018 11:49:08 -0800 Subject: [PATCH 077/449] fix helm init --wait --- cmd/helm/delete.go | 2 +- cmd/helm/get.go | 2 +- cmd/helm/get_hooks.go | 2 +- cmd/helm/get_manifest.go | 2 +- cmd/helm/get_values.go | 2 +- cmd/helm/helm.go | 4 +- cmd/helm/history.go | 2 +- cmd/helm/init.go | 52 ++++++++++++++++++-- cmd/helm/install.go | 2 +- cmd/helm/list.go | 2 +- cmd/helm/load_plugins.go | 2 +- cmd/helm/release_testing.go | 2 +- cmd/helm/reset.go | 2 +- cmd/helm/rollback.go | 2 +- cmd/helm/status.go | 2 +- cmd/helm/upgrade.go | 2 +- cmd/helm/version.go | 2 +- cmd/tiller/tiller.go | 8 +++ docs/helm/helm.md | 13 ++--- docs/helm/helm_completion.md | 13 ++--- docs/helm/helm_create.md | 13 ++--- docs/helm/helm_delete.md | 13 ++--- docs/helm/helm_dependency.md | 13 ++--- docs/helm/helm_dependency_build.md | 13 ++--- docs/helm/helm_dependency_list.md | 13 ++--- docs/helm/helm_dependency_update.md | 13 ++--- docs/helm/helm_fetch.md | 13 ++--- docs/helm/helm_get.md | 13 ++--- docs/helm/helm_get_hooks.md | 13 ++--- docs/helm/helm_get_manifest.md | 13 ++--- docs/helm/helm_get_values.md | 13 ++--- docs/helm/helm_history.md | 13 ++--- docs/helm/helm_home.md | 13 ++--- docs/helm/helm_init.md | 13 ++--- docs/helm/helm_inspect.md | 13 ++--- docs/helm/helm_inspect_chart.md | 13 ++--- docs/helm/helm_inspect_values.md | 13 ++--- docs/helm/helm_install.md | 13 ++--- docs/helm/helm_lint.md | 13 ++--- docs/helm/helm_list.md | 13 ++--- docs/helm/helm_package.md | 13 ++--- docs/helm/helm_plugin.md | 13 ++--- docs/helm/helm_plugin_install.md | 13 ++--- docs/helm/helm_plugin_list.md | 13 ++--- docs/helm/helm_plugin_remove.md | 13 ++--- docs/helm/helm_plugin_update.md | 13 ++--- docs/helm/helm_repo.md | 13 ++--- docs/helm/helm_repo_add.md | 13 ++--- docs/helm/helm_repo_index.md | 13 ++--- docs/helm/helm_repo_list.md | 13 ++--- docs/helm/helm_repo_remove.md | 13 ++--- docs/helm/helm_repo_update.md | 13 ++--- docs/helm/helm_reset.md | 13 ++--- docs/helm/helm_rollback.md | 13 ++--- docs/helm/helm_search.md | 13 ++--- docs/helm/helm_serve.md | 13 ++--- docs/helm/helm_status.md | 13 ++--- docs/helm/helm_template.md | 13 ++--- docs/helm/helm_test.md | 13 ++--- docs/helm/helm_upgrade.md | 13 ++--- docs/helm/helm_verify.md | 13 ++--- docs/helm/helm_version.md | 13 ++--- pkg/helm/client.go | 19 +++++-- pkg/helm/environment/environment.go | 3 ++ pkg/helm/option.go | 10 ++++ pkg/helm/portforwarder/portforwarder.go | 7 +-- pkg/helm/portforwarder/portforwarder_test.go | 2 +- 67 files changed, 416 insertions(+), 291 deletions(-) diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go index 05c845344..e0ac8c4f6 100755 --- a/cmd/helm/delete.go +++ b/cmd/helm/delete.go @@ -57,7 +57,7 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { SuggestFor: []string{"remove", "rm"}, Short: "given a release name, delete the release from Kubernetes", Long: deleteDesc, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errors.New("command 'delete' requires a release name") diff --git a/cmd/helm/get.go b/cmd/helm/get.go index 477f730d5..a2eb1d137 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -57,7 +57,7 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command { Use: "get [flags] RELEASE_NAME", Short: "download a named release", Long: getHelp, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errReleaseRequired diff --git a/cmd/helm/get_hooks.go b/cmd/helm/get_hooks.go index ea57838af..1b6f2f8fe 100644 --- a/cmd/helm/get_hooks.go +++ b/cmd/helm/get_hooks.go @@ -47,7 +47,7 @@ func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command { Use: "hooks [flags] RELEASE_NAME", Short: "download all hooks for a named release", Long: getHooksHelp, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errReleaseRequired diff --git a/cmd/helm/get_manifest.go b/cmd/helm/get_manifest.go index 773d8003b..1c42830f0 100644 --- a/cmd/helm/get_manifest.go +++ b/cmd/helm/get_manifest.go @@ -49,7 +49,7 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command { Use: "manifest [flags] RELEASE_NAME", Short: "download the manifest for a named release", Long: getManifestHelp, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errReleaseRequired diff --git a/cmd/helm/get_values.go b/cmd/helm/get_values.go index 592f6fe61..b6ce648e5 100644 --- a/cmd/helm/get_values.go +++ b/cmd/helm/get_values.go @@ -47,7 +47,7 @@ func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { Use: "values [flags] RELEASE_NAME", Short: "download the values file for a named release", Long: getValuesHelp, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errReleaseRequired diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 4a0d10fe6..497565209 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -165,7 +165,7 @@ func markDeprecated(cmd *cobra.Command, notice string) *cobra.Command { return cmd } -func setupConnection(c *cobra.Command, args []string) error { +func setupConnection() error { if settings.TillerHost == "" { config, client, err := getKubeClient(settings.KubeContext) if err != nil { @@ -266,7 +266,7 @@ func ensureHelmClient(h helm.Interface) helm.Interface { } func newClient() helm.Interface { - options := []helm.Option{helm.Host(settings.TillerHost)} + options := []helm.Option{helm.Host(settings.TillerHost), helm.ConnectTimeout(settings.TillerConnectionTimeout)} if tlsVerify || tlsEnable { if tlsCaCertFile == "" { diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 0637eca64..659c39e81 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -61,7 +61,7 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { Long: historyHelp, Short: "fetch release history", Aliases: []string{"hist"}, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { switch { case len(args) == 0: diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 49adfc2c3..6c9cacf3b 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -23,6 +23,7 @@ import ( "fmt" "io" "os" + "time" "github.com/spf13/cobra" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -33,6 +34,7 @@ import ( "k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm/helmpath" + "k8s.io/helm/pkg/helm/portforwarder" "k8s.io/helm/pkg/repo" ) @@ -310,13 +312,13 @@ func (i *initCmd) run() error { "(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)") } } else { - if err := i.ping(); err != nil { - return err - } fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.\n\n"+ "Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.\n"+ "For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation") } + if err := i.ping(); err != nil { + return err + } } else { fmt.Fprintln(i.out, "Not installing Tiller due to 'client-only' flag having been set") } @@ -327,6 +329,19 @@ func (i *initCmd) run() error { func (i *initCmd) ping() error { if i.wait { + _, kubeClient, err := getKubeClient(settings.KubeContext) + if err != nil { + return err + } + if !watchTillerUntilReady(settings.TillerNamespace, kubeClient, settings.TillerConnectionTimeout) { + return fmt.Errorf("tiller was not found. polling deadline exceeded") + } + + // establish a connection to Tiller now that we've effectively guaranteed it's available + if err := setupConnection(); err != nil { + return err + } + i.client = newClient() if err := i.client.PingTiller(); err != nil { return fmt.Errorf("could not ping Tiller: %s", err) } @@ -443,3 +458,34 @@ func ensureRepoFileFormat(file string, out io.Writer) error { return nil } + +// watchTillerUntilReady waits for the tiller pod to become available. This is useful in situations where we +// want to wait before we call New(). +// +// Returns true if it exists. If the timeout was reached and it could not find the pod, it returns false. +func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeout int64) bool { + deadlinePollingChan := time.NewTimer(time.Duration(timeout) * time.Second).C + checkTillerPodTicker := time.NewTicker(500 * time.Millisecond) + doneChan := make(chan bool) + + defer checkTillerPodTicker.Stop() + + go func() { + for range checkTillerPodTicker.C { + _, err := portforwarder.GetTillerPodName(client.CoreV1(), namespace) + if err == nil { + doneChan <- true + break + } + } + }() + + for { + select { + case <-deadlinePollingChan: + return false + case <-doneChan: + return true + } + } +} diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 55ddd8141..da1ee52d7 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -153,7 +153,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { Use: "install [CHART]", Short: "install a chart archive", Long: installDesc, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if err := checkArgsLength(len(args), "chart name"); err != nil { return err diff --git a/cmd/helm/list.go b/cmd/helm/list.go index bf543df5e..0219d60f2 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -88,7 +88,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { Short: "list releases", Long: listHelp, Aliases: []string{"ls"}, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if len(args) > 0 { list.filter = strings.Join(args, " ") diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index 2994126cb..ef24e7883 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -103,7 +103,7 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) { if _, err := processParent(cmd, args); err != nil { return err } - return setupConnection(cmd, args) + return setupConnection() } } diff --git a/cmd/helm/release_testing.go b/cmd/helm/release_testing.go index 09a6330c6..bdfa87a60 100644 --- a/cmd/helm/release_testing.go +++ b/cmd/helm/release_testing.go @@ -51,7 +51,7 @@ func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command { Use: "test [RELEASE]", Short: "test a release", Long: releaseTestDesc, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if err := checkArgsLength(len(args), "release name"); err != nil { return err diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index 623776729..9d3e17e03 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -58,7 +58,7 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { Short: "uninstalls Tiller from a cluster", Long: resetDesc, PreRunE: func(cmd *cobra.Command, args []string) error { - if err := setupConnection(cmd, args); !d.force && err != nil { + if err := setupConnection(); !d.force && err != nil { return err } return nil diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index c55707f7c..889b6ae28 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -57,7 +57,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { Use: "rollback [flags] [RELEASE] [REVISION]", Short: "roll back a release to a previous revision", Long: rollbackDesc, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if err := checkArgsLength(len(args), "release name", "revision number"); err != nil { return err diff --git a/cmd/helm/status.go b/cmd/helm/status.go index 12cfcd59e..b73b6f56e 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -63,7 +63,7 @@ func newStatusCmd(client helm.Interface, out io.Writer) *cobra.Command { Use: "status [flags] RELEASE_NAME", Short: "displays the status of the named release", Long: statusHelp, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errReleaseRequired diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 7fca5af68..d08dd62ef 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -91,7 +91,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { Use: "upgrade [RELEASE] [CHART]", Short: "upgrade a release", Long: upgradeDesc, - PreRunE: setupConnection, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, RunE: func(cmd *cobra.Command, args []string) error { if err := checkArgsLength(len(args), "release name", "chart path"); err != nil { return err diff --git a/cmd/helm/version.go b/cmd/helm/version.go index 8eaff1ca9..d541067a0 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -76,7 +76,7 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { if version.showServer { // We do this manually instead of in PreRun because we only // need a tunnel if server version is requested. - setupConnection(cmd, args) + setupConnection() } version.client = ensureHelmClient(version.client) return version.run() diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index e0c10cb29..5d2db3816 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -33,6 +33,8 @@ import ( goprom "github.com/grpc-ecosystem/go-grpc-prometheus" "google.golang.org/grpc" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/health" + healthpb "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/keepalive" "k8s.io/helm/pkg/kube" @@ -113,6 +115,9 @@ func main() { func start() { + healthSrv := health.NewServer() + healthSrv.SetServingStatus("Tiller", healthpb.HealthCheckResponse_NOT_SERVING) + clientset, err := kube.New(nil).ClientSet() if err != nil { logger.Fatalf("Cannot initialize Kubernetes connection: %s", err) @@ -168,6 +173,7 @@ func start() { })) rootServer = tiller.NewServer(opts...) + healthpb.RegisterHealthServer(rootServer, healthSrv) lstn, err := net.Listen("tcp", *grpcAddr) if err != nil { @@ -207,6 +213,8 @@ func start() { } }() + healthSrv.SetServingStatus("Tiller", healthpb.HealthCheckResponse_SERVING) + select { case err := <-srvErrCh: logger.Fatalf("Server died: %s", err) diff --git a/docs/helm/helm.md b/docs/helm/helm.md index d3c63f56a..f470e84b2 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -32,11 +32,12 @@ Environment: ### Options ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO @@ -67,4 +68,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_completion.md b/docs/helm/helm_completion.md index cef6a8631..994205d88 100644 --- a/docs/helm/helm_completion.md +++ b/docs/helm/helm_completion.md @@ -24,14 +24,15 @@ helm completion SHELL ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index 636141661..6e0f3de78 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -43,14 +43,15 @@ helm create NAME ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index 26ac5fdac..5d41cd7ea 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -34,14 +34,15 @@ helm delete [flags] RELEASE_NAME [...] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_dependency.md b/docs/helm/helm_dependency.md index 05b114b34..34d49e20a 100644 --- a/docs/helm/helm_dependency.md +++ b/docs/helm/helm_dependency.md @@ -57,11 +57,12 @@ for this case. ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO @@ -70,4 +71,4 @@ for this case. * [helm dependency list](helm_dependency_list.md) - list the dependencies for the given chart * [helm dependency update](helm_dependency_update.md) - update charts/ based on the contents of requirements.yaml -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_dependency_build.md b/docs/helm/helm_dependency_build.md index 70aae9a96..0413a9a85 100644 --- a/docs/helm/helm_dependency_build.md +++ b/docs/helm/helm_dependency_build.md @@ -30,14 +30,15 @@ helm dependency build [flags] CHART ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_dependency_list.md b/docs/helm/helm_dependency_list.md index be5daec44..b4343081c 100644 --- a/docs/helm/helm_dependency_list.md +++ b/docs/helm/helm_dependency_list.md @@ -22,14 +22,15 @@ helm dependency list [flags] CHART ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_dependency_update.md b/docs/helm/helm_dependency_update.md index 94ddee3c5..3c90ff779 100644 --- a/docs/helm/helm_dependency_update.md +++ b/docs/helm/helm_dependency_update.md @@ -35,14 +35,15 @@ helm dependency update [flags] CHART ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_fetch.md b/docs/helm/helm_fetch.md index 9c8a4ec36..3bc3334a0 100644 --- a/docs/helm/helm_fetch.md +++ b/docs/helm/helm_fetch.md @@ -44,14 +44,15 @@ helm fetch [flags] [chart URL | repo/chartname] [...] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index 5b148b564..9cd70e520 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -36,11 +36,12 @@ helm get [flags] RELEASE_NAME ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO @@ -49,4 +50,4 @@ helm get [flags] RELEASE_NAME * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_get_hooks.md b/docs/helm/helm_get_hooks.md index c39c73888..85fa5d04b 100644 --- a/docs/helm/helm_get_hooks.md +++ b/docs/helm/helm_get_hooks.md @@ -29,14 +29,15 @@ helm get hooks [flags] RELEASE_NAME ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_get_manifest.md b/docs/helm/helm_get_manifest.md index 144f7bf87..a00c1be56 100644 --- a/docs/helm/helm_get_manifest.md +++ b/docs/helm/helm_get_manifest.md @@ -31,14 +31,15 @@ helm get manifest [flags] RELEASE_NAME ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index eadc56a67..d8944b475 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -28,14 +28,15 @@ helm get values [flags] RELEASE_NAME ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index 119e58b69..81c720021 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -40,14 +40,15 @@ helm history [flags] RELEASE_NAME ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_home.md b/docs/helm/helm_home.md index 855090a20..bdccd756f 100644 --- a/docs/helm/helm_home.md +++ b/docs/helm/helm_home.md @@ -17,14 +17,15 @@ helm home ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index 5ed24e60d..5374488af 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -60,14 +60,15 @@ helm init ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 6-Mar-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index 006da7478..df122f763 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -31,11 +31,12 @@ helm inspect [CHART] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO @@ -43,4 +44,4 @@ helm inspect [CHART] * [helm inspect chart](helm_inspect_chart.md) - shows inspect chart * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index 37d0eb4af..bfa6061c8 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -29,14 +29,15 @@ helm inspect chart [CHART] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index 2079849ff..fbf8660c2 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -29,14 +29,15 @@ helm inspect values [CHART] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index da9b91bb8..406416dc8 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -98,14 +98,15 @@ helm install [CHART] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index 8167a46cc..da3cdf945 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -30,14 +30,15 @@ helm lint [flags] PATH ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index 1ba60b912..1d5bf7ea2 100755 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -62,14 +62,15 @@ helm list [flags] [FILTER] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index 85da8315e..c51aa7032 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -36,14 +36,15 @@ helm package [flags] [CHART_PATH] [...] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_plugin.md b/docs/helm/helm_plugin.md index f8e04f1a5..cc42aa4dc 100644 --- a/docs/helm/helm_plugin.md +++ b/docs/helm/helm_plugin.md @@ -12,11 +12,12 @@ Manage client-side Helm plugins. ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO @@ -26,4 +27,4 @@ Manage client-side Helm plugins. * [helm plugin remove](helm_plugin_remove.md) - remove one or more Helm plugins * [helm plugin update](helm_plugin_update.md) - update one or more Helm plugins -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_plugin_install.md b/docs/helm/helm_plugin_install.md index beb478845..196ca97dd 100644 --- a/docs/helm/helm_plugin_install.md +++ b/docs/helm/helm_plugin_install.md @@ -25,14 +25,15 @@ helm plugin install [options] ... ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_plugin_list.md b/docs/helm/helm_plugin_list.md index d363ae9b6..ddfd04ee6 100644 --- a/docs/helm/helm_plugin_list.md +++ b/docs/helm/helm_plugin_list.md @@ -14,14 +14,15 @@ helm plugin list ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_plugin_remove.md b/docs/helm/helm_plugin_remove.md index 55f62514d..8543a367a 100644 --- a/docs/helm/helm_plugin_remove.md +++ b/docs/helm/helm_plugin_remove.md @@ -14,14 +14,15 @@ helm plugin remove ... ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_plugin_update.md b/docs/helm/helm_plugin_update.md index 26a6ad270..9e5e205f0 100644 --- a/docs/helm/helm_plugin_update.md +++ b/docs/helm/helm_plugin_update.md @@ -14,14 +14,15 @@ helm plugin update ... ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_repo.md b/docs/helm/helm_repo.md index a700f7aab..4109ceca4 100644 --- a/docs/helm/helm_repo.md +++ b/docs/helm/helm_repo.md @@ -16,11 +16,12 @@ Example usage: ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO @@ -31,4 +32,4 @@ Example usage: * [helm repo remove](helm_repo_remove.md) - remove a chart repository * [helm repo update](helm_repo_update.md) - update information of available charts locally from chart repositories -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_repo_add.md b/docs/helm/helm_repo_add.md index 7137c2c51..f0dfcbd5d 100644 --- a/docs/helm/helm_repo_add.md +++ b/docs/helm/helm_repo_add.md @@ -23,14 +23,15 @@ helm repo add [flags] [NAME] [URL] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_repo_index.md b/docs/helm/helm_repo_index.md index 7ddcf068f..14b412b29 100644 --- a/docs/helm/helm_repo_index.md +++ b/docs/helm/helm_repo_index.md @@ -30,14 +30,15 @@ helm repo index [flags] [DIR] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_repo_list.md b/docs/helm/helm_repo_list.md index 2285a3c6e..858ef957f 100644 --- a/docs/helm/helm_repo_list.md +++ b/docs/helm/helm_repo_list.md @@ -14,14 +14,15 @@ helm repo list [flags] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_repo_remove.md b/docs/helm/helm_repo_remove.md index d23980e73..801bc3c3f 100644 --- a/docs/helm/helm_repo_remove.md +++ b/docs/helm/helm_repo_remove.md @@ -14,14 +14,15 @@ helm repo remove [flags] [NAME] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_repo_update.md b/docs/helm/helm_repo_update.md index 00dc6d9e2..897ed24b7 100644 --- a/docs/helm/helm_repo_update.md +++ b/docs/helm/helm_repo_update.md @@ -20,14 +20,15 @@ helm repo update ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index f6707b8bd..ed68b1b84 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -30,14 +30,15 @@ helm reset ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Feb-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index 3bd4af8bf..4b6dcbbb2 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -36,14 +36,15 @@ helm rollback [flags] [RELEASE] [REVISION] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_search.md b/docs/helm/helm_search.md index 247b83f42..f59814b9a 100644 --- a/docs/helm/helm_search.md +++ b/docs/helm/helm_search.md @@ -27,14 +27,15 @@ helm search [keyword] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index 163b24e76..90ebb6da9 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -35,14 +35,15 @@ helm serve ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_status.md b/docs/helm/helm_status.md index b878277ac..02ec0ad66 100644 --- a/docs/helm/helm_status.md +++ b/docs/helm/helm_status.md @@ -35,14 +35,15 @@ helm status [flags] RELEASE_NAME ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index 347ba2ab4..126adb02f 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -39,14 +39,15 @@ helm template [flags] CHART ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index 89436ed60..062244e73 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -31,14 +31,15 @@ helm test [RELEASE] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 290fe5921..5ed128958 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -66,14 +66,15 @@ helm upgrade [RELEASE] [CHART] ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_verify.md b/docs/helm/helm_verify.md index 2c65b3092..bc5343937 100644 --- a/docs/helm/helm_verify.md +++ b/docs/helm/helm_verify.md @@ -29,14 +29,15 @@ helm verify [flags] PATH ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jan-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index 39b4adfab..1f48cceba 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -44,14 +44,15 @@ helm version ### Options inherited from parent commands ``` - --debug enable verbose output - --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") - --host string address of Tiller. Overrides $HELM_HOST - --kube-context string name of the kubeconfig context to use - --tiller-namespace string namespace of Tiller (default "kube-system") + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 11-Feb-2018 +###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/pkg/helm/client.go b/pkg/helm/client.go index c7ef4d89e..372613b2a 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -17,6 +17,7 @@ limitations under the License. package helm // import "k8s.io/helm/pkg/helm" import ( + "fmt" "io" "time" @@ -25,6 +26,7 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/keepalive" + healthpb "google.golang.org/grpc/health/grpc_health_v1" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/proto/hapi/chart" rls "k8s.io/helm/pkg/proto/hapi/services" @@ -321,7 +323,7 @@ func (h *Client) connect(ctx context.Context) (conn *grpc.ClientConn, err error) default: opts = append(opts, grpc.WithInsecure()) } - ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + ctx, cancel := context.WithTimeout(ctx, h.opts.connectTimeout) defer cancel() if conn, err = grpc.DialContext(ctx, h.opts.host, opts...); err != nil { return nil, err @@ -488,6 +490,17 @@ func (h *Client) ping(ctx context.Context) error { } defer c.Close() - rlc := rls.NewReleaseServiceClient(c) - return rlc.PingTiller(ctx) + healthClient := healthpb.NewHealthClient(c) + resp, err := healthClient.Check(ctx, &healthpb.HealthCheckRequest{Service: "Tiller"}) + if err != nil { + return err + } + switch resp.GetStatus() { + case healthpb.HealthCheckResponse_SERVING: + return nil + case healthpb.HealthCheckResponse_NOT_SERVING: + return fmt.Errorf("tiller is not serving requests at this time, Please try again later") + default: + return fmt.Errorf("tiller healthcheck returned an unknown status") + } } diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index 49d424b33..2980e6dc9 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -39,6 +39,8 @@ var DefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm") type EnvSettings struct { // TillerHost is the host and port of Tiller. TillerHost string + // TillerConnectionTimeout is the duration (in seconds) helm will wait to establish a connection to tiller. + TillerConnectionTimeout int64 // TillerNamespace is the namespace in which Tiller runs. TillerNamespace string // Home is the local path to the Helm home directory. @@ -56,6 +58,7 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&s.KubeContext, "kube-context", "", "name of the kubeconfig context to use") fs.BoolVar(&s.Debug, "debug", false, "enable verbose output") fs.StringVar(&s.TillerNamespace, "tiller-namespace", "kube-system", "namespace of Tiller") + fs.Int64Var(&s.TillerConnectionTimeout, "tiller-connection-timeout", int64(300), "the duration (in seconds) Helm will wait to establish a connection to tiller") } // Init sets values from the environment. diff --git a/pkg/helm/option.go b/pkg/helm/option.go index a8770a488..3381e3f80 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -18,6 +18,7 @@ package helm import ( "crypto/tls" + "time" "github.com/golang/protobuf/proto" "golang.org/x/net/context" @@ -78,6 +79,8 @@ type options struct { reuseValues bool // release test options are applied directly to the test release history request testReq rls.TestReleaseRequest + // connectTimeout specifies the time duration Helm will wait to establish a connection to tiller + connectTimeout time.Duration } // Host specifies the host address of the Tiller release server, (default = ":44134"). @@ -180,6 +183,13 @@ func ReleaseName(name string) InstallOption { } } +// ConnectTimeout specifies the duration (in seconds) Helm will wait to establish a connection to tiller +func ConnectTimeout(timeout int64) Option { + return func(opts *options) { + opts.connectTimeout = time.Duration(timeout) * time.Second + } +} + // InstallTimeout specifies the number of seconds before kubernetes calls timeout func InstallTimeout(timeout int64) InstallOption { return func(opts *options) { diff --git a/pkg/helm/portforwarder/portforwarder.go b/pkg/helm/portforwarder/portforwarder.go index 07e692e9a..878610d5f 100644 --- a/pkg/helm/portforwarder/portforwarder.go +++ b/pkg/helm/portforwarder/portforwarder.go @@ -30,12 +30,12 @@ import ( ) var ( - tillerPodLabels labels.Set = labels.Set{"app": "helm", "name": "tiller"} + tillerPodLabels = labels.Set{"app": "helm", "name": "tiller"} ) // New creates a new and initialized tunnel. func New(namespace string, client kubernetes.Interface, config *rest.Config) (*kube.Tunnel, error) { - podName, err := getTillerPodName(client.CoreV1(), namespace) + podName, err := GetTillerPodName(client.CoreV1(), namespace) if err != nil { return nil, err } @@ -44,7 +44,8 @@ func New(namespace string, client kubernetes.Interface, config *rest.Config) (*k return t, t.ForwardPort() } -func getTillerPodName(client corev1.PodsGetter, namespace string) (string, error) { +// GetTillerPodName fetches the name of tiller pod running in the given namespace. +func GetTillerPodName(client corev1.PodsGetter, namespace string) (string, error) { selector := tillerPodLabels.AsSelector() pod, err := getFirstRunningPod(client, namespace, selector) if err != nil { diff --git a/pkg/helm/portforwarder/portforwarder_test.go b/pkg/helm/portforwarder/portforwarder_test.go index b9e90afa8..e4c148991 100644 --- a/pkg/helm/portforwarder/portforwarder_test.go +++ b/pkg/helm/portforwarder/portforwarder_test.go @@ -76,7 +76,7 @@ func TestGetFirstPod(t *testing.T) { for _, tt := range tests { client := fake.NewSimpleClientset(&v1.PodList{Items: tt.pods}) - name, err := getTillerPodName(client.Core(), v1.NamespaceDefault) + name, err := GetTillerPodName(client.Core(), v1.NamespaceDefault) if (err != nil) != tt.err { t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err) } From e2d65017e13f4c92e21d82a6efcf125dc532bdf1 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 8 Mar 2018 12:14:50 -0800 Subject: [PATCH 078/449] fix protoc k8s.io/kubernetes bumped protobuf to 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 --- glide.lock | 10 +++-- glide.yaml | 4 +- pkg/proto/hapi/chart/metadata.pb.go | 59 ++++++++++++++-------------- pkg/proto/hapi/release/hook.pb.go | 10 +++++ pkg/proto/hapi/services/tiller.pb.go | 20 +--------- 5 files changed, 49 insertions(+), 54 deletions(-) diff --git a/glide.lock b/glide.lock index e14766948..1ccdae61c 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: c4a1f6e380baf38d371d428fa5c8f7b2363663d811c728e982300692287a58e4 -updated: 2018-02-02T20:15:49.706602Z +hash: d93f565214b112cf8560e9cd2da2f3ab7852a1f19544569fc112bd4fb2d1d506 +updated: 2018-03-08T14:06:06.497394911-08:00 imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -147,7 +147,7 @@ imports: - name: github.com/go-openapi/swag version: f3f9494671f93fcff853e3c6e9e948b3eb71e590 - name: github.com/gobwas/glob - version: bea32b9cd2d6f55753d94a28e959b13f0244797a + version: 5ccd90ef52e1e632236f7326478d4faa74f99438 subpackages: - compiler - match @@ -168,7 +168,7 @@ imports: subpackages: - lru - name: github.com/golang/protobuf - version: 4bd1920723d7b7c925de087aa32e2187708897f7 + version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 subpackages: - proto - ptypes @@ -378,6 +378,8 @@ imports: - credentials - grpclb/grpc_lb_v1/messages - grpclog + - health + - health/grpc_health_v1 - internal - keepalive - metadata diff --git a/glide.yaml b/glide.yaml index 81bb8ebe1..7d0fce978 100644 --- a/glide.yaml +++ b/glide.yaml @@ -19,7 +19,7 @@ import: version: ~1.3.1 - package: github.com/technosophos/moniker - package: github.com/golang/protobuf - version: 4bd1920723d7b7c925de087aa32e2187708897f7 + version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 subpackages: - proto - ptypes/any @@ -53,7 +53,7 @@ import: vcs: git - package: k8s.io/kubernetes - version: ~1.9.2 + version: 1.9.2 - package: k8s.io/client-go version: ~6.0.0 - package: k8s.io/api diff --git a/pkg/proto/hapi/chart/metadata.pb.go b/pkg/proto/hapi/chart/metadata.pb.go index 49a4aa0ac..9daeaa9e5 100644 --- a/pkg/proto/hapi/chart/metadata.pb.go +++ b/pkg/proto/hapi/chart/metadata.pb.go @@ -107,7 +107,7 @@ type Metadata struct { // Annotations are additional mappings uninterpreted by Tiller, // made available for inspection by other applications. Annotations map[string]string `protobuf:"bytes,16,rep,name=annotations" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - // KubeVersion is a SemVer constraints on what version of Kubernetes is required. + // KubeVersion is a SemVer constraint specifying the version of Kubernetes required. KubeVersion string `protobuf:"bytes,17,opt,name=kubeVersion" json:"kubeVersion,omitempty"` } @@ -244,32 +244,33 @@ func init() { func init() { proto.RegisterFile("hapi/chart/metadata.proto", fileDescriptor2) } var fileDescriptor2 = []byte{ - // 427 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x5d, 0x6b, 0xdb, 0x30, - 0x14, 0x9d, 0x9b, 0x38, 0x89, 0xaf, 0xd7, 0xcd, 0xbb, 0x8c, 0xa2, 0x95, 0x31, 0x4c, 0xd8, 0x20, - 0x4f, 0x29, 0x6c, 0x30, 0xca, 0x1e, 0x06, 0x1b, 0x94, 0x3e, 0x6c, 0x4d, 0x87, 0xd9, 0x07, 0xec, - 0x4d, 0xb5, 0x2f, 0x8d, 0x48, 0x2c, 0x19, 0x49, 0xe9, 0xc8, 0xaf, 0xd8, 0x5f, 0x1e, 0x92, 0xad, - 0xda, 0x19, 0x7d, 0xbb, 0xe7, 0x1c, 0xdd, 0x23, 0x1d, 0xdd, 0x0b, 0x2f, 0xd6, 0xbc, 0x11, 0x67, - 0xe5, 0x9a, 0x6b, 0x7b, 0x56, 0x93, 0xe5, 0x15, 0xb7, 0x7c, 0xd9, 0x68, 0x65, 0x15, 0x82, 0x93, - 0x96, 0x5e, 0x9a, 0xbf, 0x07, 0xb8, 0xe2, 0x42, 0x5a, 0x2e, 0x24, 0x69, 0x44, 0x18, 0x4b, 0x5e, - 0x13, 0x8b, 0xf2, 0x68, 0x91, 0x14, 0xbe, 0xc6, 0xe7, 0x10, 0x53, 0xcd, 0xc5, 0x96, 0x1d, 0x79, - 0xb2, 0x05, 0xf3, 0xbf, 0x31, 0xcc, 0xae, 0x3a, 0xdb, 0x07, 0xdb, 0x10, 0xc6, 0x6b, 0x55, 0x53, - 0xd7, 0xe5, 0x6b, 0x64, 0x30, 0x35, 0x6a, 0xa7, 0x4b, 0x32, 0x6c, 0x94, 0x8f, 0x16, 0x49, 0x11, - 0xa0, 0x53, 0xee, 0x48, 0x1b, 0xa1, 0x24, 0x1b, 0xfb, 0x86, 0x00, 0x31, 0x87, 0xb4, 0x22, 0x53, - 0x6a, 0xd1, 0x58, 0xa7, 0xc6, 0x5e, 0x1d, 0x52, 0x78, 0x0a, 0xb3, 0x0d, 0xed, 0xff, 0x28, 0x5d, - 0x19, 0x36, 0xf1, 0xb6, 0xf7, 0x18, 0xcf, 0x21, 0xad, 0xef, 0xe3, 0x19, 0x36, 0xcd, 0x47, 0x8b, - 0xf4, 0xed, 0xc9, 0xb2, 0xff, 0x80, 0x65, 0x9f, 0xbe, 0x18, 0x1e, 0xc5, 0x13, 0x98, 0x90, 0xbc, - 0x15, 0x92, 0xd8, 0xcc, 0x5f, 0xd9, 0x21, 0x97, 0x4b, 0x94, 0x4a, 0xb2, 0xa4, 0xcd, 0xe5, 0x6a, - 0x7c, 0x05, 0xc0, 0x1b, 0xf1, 0xb3, 0x0b, 0x00, 0x5e, 0x19, 0x30, 0xf8, 0x12, 0x92, 0x52, 0xc9, - 0x4a, 0xf8, 0x04, 0xa9, 0x97, 0x7b, 0xc2, 0x39, 0x5a, 0x7e, 0x6b, 0xd8, 0xe3, 0xd6, 0xd1, 0xd5, - 0xad, 0x63, 0x13, 0x1c, 0x8f, 0x83, 0x63, 0x60, 0x9c, 0x5e, 0x51, 0xa3, 0xa9, 0xe4, 0x96, 0x2a, - 0xf6, 0x24, 0x8f, 0x16, 0xb3, 0x62, 0xc0, 0xe0, 0x6b, 0x38, 0xb6, 0x62, 0xbb, 0x25, 0x1d, 0x2c, - 0x9e, 0x7a, 0x8b, 0x43, 0x12, 0x2f, 0x21, 0xe5, 0x52, 0x2a, 0xcb, 0xdd, 0x3b, 0x0c, 0xcb, 0xfc, - 0xef, 0xbc, 0x39, 0xf8, 0x9d, 0xb0, 0x39, 0x9f, 0xfa, 0x73, 0x17, 0xd2, 0xea, 0x7d, 0x31, 0xec, - 0x74, 0x43, 0xda, 0xec, 0x6e, 0x28, 0x5c, 0xf6, 0xac, 0x1d, 0xd2, 0x80, 0x3a, 0xfd, 0x08, 0xd9, - 0xff, 0x16, 0x98, 0xc1, 0x68, 0x43, 0xfb, 0x6e, 0x6b, 0x5c, 0xe9, 0x76, 0xed, 0x8e, 0x6f, 0x77, - 0x61, 0x6b, 0x5a, 0xf0, 0xe1, 0xe8, 0x3c, 0x9a, 0xe7, 0x30, 0xb9, 0x68, 0x07, 0x90, 0xc2, 0xf4, - 0xc7, 0xea, 0xcb, 0xea, 0xfa, 0xd7, 0x2a, 0x7b, 0x84, 0x09, 0xc4, 0x97, 0xd7, 0xdf, 0xbf, 0x7d, - 0xcd, 0xa2, 0xcf, 0xd3, 0xdf, 0xb1, 0x7f, 0xf3, 0xcd, 0xc4, 0x6f, 0xf9, 0xbb, 0x7f, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x7f, 0xc1, 0xec, 0x3d, 0x02, 0x03, 0x00, 0x00, + // 435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x5d, 0x6b, 0xd4, 0x40, + 0x14, 0x35, 0xcd, 0x66, 0x77, 0x73, 0x63, 0x35, 0x0e, 0x52, 0xc6, 0x22, 0x12, 0x16, 0x85, 0x7d, + 0xda, 0x82, 0xbe, 0x14, 0x1f, 0x04, 0x85, 0x52, 0x41, 0xbb, 0x95, 0xe0, 0x07, 0xf8, 0x36, 0x4d, + 0x2e, 0xdd, 0x61, 0x93, 0x99, 0x30, 0x99, 0xad, 0xec, 0xaf, 0xf0, 0x2f, 0xcb, 0xdc, 0x64, 0x9a, + 0xac, 0xf4, 0xed, 0x9e, 0x73, 0x66, 0xce, 0xcc, 0xbd, 0xf7, 0xc0, 0x8b, 0x8d, 0x68, 0xe4, 0x59, + 0xb1, 0x11, 0xc6, 0x9e, 0xd5, 0x68, 0x45, 0x29, 0xac, 0x58, 0x35, 0x46, 0x5b, 0xcd, 0xc0, 0x49, + 0x2b, 0x92, 0x16, 0x9f, 0x01, 0xae, 0x84, 0x54, 0x56, 0x48, 0x85, 0x86, 0x31, 0x98, 0x28, 0x51, + 0x23, 0x0f, 0xb2, 0x60, 0x19, 0xe7, 0x54, 0xb3, 0xe7, 0x10, 0x61, 0x2d, 0x64, 0xc5, 0x8f, 0x88, + 0xec, 0x00, 0x4b, 0x21, 0xdc, 0x99, 0x8a, 0x87, 0xc4, 0xb9, 0x72, 0xf1, 0x37, 0x82, 0xf9, 0x55, + 0xff, 0xd0, 0x83, 0x46, 0x0c, 0x26, 0x1b, 0x5d, 0x63, 0xef, 0x43, 0x35, 0xe3, 0x30, 0x6b, 0xf5, + 0xce, 0x14, 0xd8, 0xf2, 0x30, 0x0b, 0x97, 0x71, 0xee, 0xa1, 0x53, 0xee, 0xd0, 0xb4, 0x52, 0x2b, + 0x3e, 0xa1, 0x0b, 0x1e, 0xb2, 0x0c, 0x92, 0x12, 0xdb, 0xc2, 0xc8, 0xc6, 0x3a, 0x35, 0x22, 0x75, + 0x4c, 0xb1, 0x53, 0x98, 0x6f, 0x71, 0xff, 0x47, 0x9b, 0xb2, 0xe5, 0x53, 0xb2, 0xbd, 0xc7, 0xec, + 0x1c, 0x92, 0xfa, 0xbe, 0xe1, 0x96, 0xcf, 0xb2, 0x70, 0x99, 0xbc, 0x3d, 0x59, 0x0d, 0x23, 0x59, + 0x0d, 0xf3, 0xc8, 0xc7, 0x47, 0xd9, 0x09, 0x4c, 0x51, 0xdd, 0x4a, 0x85, 0x7c, 0x4e, 0x4f, 0xf6, + 0xc8, 0xf5, 0x25, 0x0b, 0xad, 0x78, 0xdc, 0xf5, 0xe5, 0x6a, 0xf6, 0x0a, 0x40, 0x34, 0xf2, 0x67, + 0xdf, 0x00, 0x90, 0x32, 0x62, 0xd8, 0x4b, 0x88, 0x0b, 0xad, 0x4a, 0x49, 0x1d, 0x24, 0x24, 0x0f, + 0x84, 0x73, 0xb4, 0xe2, 0xb6, 0xe5, 0x8f, 0x3b, 0x47, 0x57, 0x77, 0x8e, 0x8d, 0x77, 0x3c, 0xf6, + 0x8e, 0x9e, 0x71, 0x7a, 0x89, 0x8d, 0xc1, 0x42, 0x58, 0x2c, 0xf9, 0x93, 0x2c, 0x58, 0xce, 0xf3, + 0x11, 0xc3, 0x5e, 0xc3, 0xb1, 0x95, 0x55, 0x85, 0xc6, 0x5b, 0x3c, 0x25, 0x8b, 0x43, 0x92, 0x5d, + 0x42, 0x22, 0x94, 0xd2, 0x56, 0xb8, 0x7f, 0xb4, 0x3c, 0xa5, 0xe9, 0xbc, 0x39, 0x98, 0x8e, 0xcf, + 0xd2, 0xc7, 0xe1, 0xdc, 0x85, 0xb2, 0x66, 0x9f, 0x8f, 0x6f, 0xba, 0x25, 0x6d, 0x77, 0x37, 0xe8, + 0x1f, 0x7b, 0xd6, 0x2d, 0x69, 0x44, 0x9d, 0x7e, 0x80, 0xf4, 0x7f, 0x0b, 0x97, 0xaa, 0x2d, 0xee, + 0xfb, 0xd4, 0xb8, 0xd2, 0xa5, 0xef, 0x4e, 0x54, 0x3b, 0x9f, 0x9a, 0x0e, 0xbc, 0x3f, 0x3a, 0x0f, + 0x16, 0x19, 0x4c, 0x2f, 0xba, 0x05, 0x24, 0x30, 0xfb, 0xb1, 0xfe, 0xb2, 0xbe, 0xfe, 0xb5, 0x4e, + 0x1f, 0xb1, 0x18, 0xa2, 0xcb, 0xeb, 0xef, 0xdf, 0xbe, 0xa6, 0xc1, 0xa7, 0xd9, 0xef, 0x88, 0xfe, + 0x7c, 0x33, 0xa5, 0xdc, 0xbf, 0xfb, 0x17, 0x00, 0x00, 0xff, 0xff, 0x36, 0xf9, 0x0d, 0xa6, 0x14, + 0x03, 0x00, 0x00, } diff --git a/pkg/proto/hapi/release/hook.pb.go b/pkg/proto/hapi/release/hook.pb.go index bd9391c50..508448280 100644 --- a/pkg/proto/hapi/release/hook.pb.go +++ b/pkg/proto/hapi/release/hook.pb.go @@ -6,9 +6,19 @@ Package release is a generated protocol buffer package. It is generated from these files: hapi/release/hook.proto + hapi/release/info.proto + hapi/release/release.proto + hapi/release/status.proto + hapi/release/test_run.proto + hapi/release/test_suite.proto It has these top-level messages: Hook + Info + Release + Status + TestRun + TestSuite */ package release diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 2112ea67f..37535aac7 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -275,7 +275,7 @@ type GetReleaseStatusResponse struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // Info contains information about the release. Info *hapi_release4.Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"` - // Namesapce the release was released into + // Namespace the release was released into Namespace string `protobuf:"bytes,3,opt,name=namespace" json:"namespace,omitempty"` } @@ -949,8 +949,6 @@ type ReleaseServiceClient interface { GetHistory(ctx context.Context, in *GetHistoryRequest, opts ...grpc.CallOption) (*GetHistoryResponse, error) // RunReleaseTest executes the tests defined of a named release RunReleaseTest(ctx context.Context, in *TestReleaseRequest, opts ...grpc.CallOption) (ReleaseService_RunReleaseTestClient, error) - // PingTiller sends a test/ping signal to Tiller to ensure that it's up - PingTiller(ctx context.Context) error } type releaseServiceClient struct { @@ -1080,14 +1078,6 @@ func (c *releaseServiceClient) RunReleaseTest(ctx context.Context, in *TestRelea return x, nil } -func (c *releaseServiceClient) PingTiller(ctx context.Context) error { - err := grpc.Invoke(ctx, "/hapi.services.tiller.ReleaseService/PingTiller", "Ping", nil, c.cc, grpc.FailFast(false)) - if err != nil { - return err - } - return nil -} - type ReleaseService_RunReleaseTestClient interface { Recv() (*TestReleaseResponse, error) grpc.ClientStream @@ -1310,10 +1300,6 @@ func _ReleaseService_RunReleaseTest_Handler(srv interface{}, stream grpc.ServerS return srv.(ReleaseServiceServer).RunReleaseTest(m, &releaseServiceRunReleaseTestServer{stream}) } -func _ReleaseService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - return "Pong", nil -} - type ReleaseService_RunReleaseTestServer interface { Send(*TestReleaseResponse) error grpc.ServerStream @@ -1363,10 +1349,6 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ MethodName: "GetHistory", Handler: _ReleaseService_GetHistory_Handler, }, - { - MethodName: "PingTiller", - Handler: _ReleaseService_Ping_Handler, - }, }, Streams: []grpc.StreamDesc{ { From f13e8f670bf590e99978f34f7549c4415d3a24e1 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 2 Mar 2018 12:39:33 -0800 Subject: [PATCH 079/449] replace FAILED deployments with `helm upgrade --install --force` When using `helm upgrade --install`, if the first release fails, Helm will respond with an error saying that it cannot upgrade from an unknown state. With this feature, `helm upgrade --install --force` automates the same process as `helm delete && helm install --replace`. It will mark the previous release as DELETED, delete any existing resources inside Kubernetes, then replace it as if it was a fresh install. It will then mark the FAILED release as SUPERSEDED. --- pkg/storage/storage.go | 4 ++ pkg/tiller/release_update.go | 112 ++++++++++++++++++++++++++++++ pkg/tiller/release_update_test.go | 50 ++++++++++++- 3 files changed, 163 insertions(+), 3 deletions(-) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index f76eb09f4..4b39e0bb2 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -129,6 +129,10 @@ func (s *Storage) Deployed(name string) (*rspb.Release, error) { return nil, err } + if len(ls) == 0 { + return nil, fmt.Errorf("%q has no deployed releases", name) + } + return ls[0], err } diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index d251db753..cb8b57792 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -18,6 +18,7 @@ package tiller import ( "fmt" + "strings" ctx "golang.org/x/net/context" @@ -37,6 +38,10 @@ func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease s.Log("preparing update for %s", req.Name) currentRelease, updatedRelease, err := s.prepareUpdate(req) if err != nil { + if req.Force { + // Use the --force, Luke. + return s.performUpdateForce(req) + } return nil, err } @@ -137,6 +142,113 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele return currentRelease, updatedRelease, err } +// performUpdateForce performs the same action as a `helm delete && helm install --replace`. +func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) (*services.UpdateReleaseResponse, error) { + // find the last release with the given name + oldRelease, err := s.env.Releases.Last(req.Name) + if err != nil { + return nil, err + } + + newRelease, err := s.prepareRelease(&services.InstallReleaseRequest{ + Chart: req.Chart, + Values: req.Values, + DryRun: req.DryRun, + Name: req.Name, + DisableHooks: req.DisableHooks, + Namespace: oldRelease.Namespace, + ReuseName: true, + Timeout: req.Timeout, + Wait: req.Wait, + }) + res := &services.UpdateReleaseResponse{Release: newRelease} + if err != nil { + s.Log("failed update prepare step: %s", err) + // On dry run, append the manifest contents to a failed release. This is + // a stop-gap until we can revisit an error backchannel post-2.0. + if req.DryRun && strings.HasPrefix(err.Error(), "YAML parse error") { + err = fmt.Errorf("%s\n%s", err, newRelease.Manifest) + } + return res, err + } + + // From here on out, the release is considered to be in Status_DELETING or Status_DELETED + // state. There is no turning back. + oldRelease.Info.Status.Code = release.Status_DELETING + oldRelease.Info.Deleted = timeconv.Now() + oldRelease.Info.Description = "Deletion in progress (or silently failed)" + s.recordRelease(oldRelease, true) + + // pre-delete hooks + if !req.DisableHooks { + if err := s.execHook(oldRelease.Hooks, oldRelease.Name, oldRelease.Namespace, hooks.PreDelete, req.Timeout); err != nil { + return res, err + } + } else { + s.Log("hooks disabled for %s", req.Name) + } + + // delete manifests from the old release + _, errs := s.ReleaseModule.Delete(oldRelease, nil, s.env) + + oldRelease.Info.Status.Code = release.Status_DELETED + oldRelease.Info.Description = "Deletion complete" + s.recordRelease(oldRelease, true) + + if len(errs) > 0 { + es := make([]string, 0, len(errs)) + for _, e := range errs { + s.Log("error: %v", e) + es = append(es, e.Error()) + } + return res, fmt.Errorf("Upgrade --force successfully deleted the previous release, but encountered %d error(s) and cannot continue: %s", len(es), strings.Join(es, "; ")) + } + + // post-delete hooks + if !req.DisableHooks { + if err := s.execHook(oldRelease.Hooks, oldRelease.Name, oldRelease.Namespace, hooks.PostDelete, req.Timeout); err != nil { + return res, err + } + } + + // pre-install hooks + if !req.DisableHooks { + if err := s.execHook(newRelease.Hooks, newRelease.Name, newRelease.Namespace, hooks.PreInstall, req.Timeout); err != nil { + return res, err + } + } + + // update new release with next revision number so as to append to the old release's history + newRelease.Version = oldRelease.Version + 1 + s.recordRelease(newRelease, false) + if err := s.ReleaseModule.Update(oldRelease, newRelease, req, s.env); err != nil { + msg := fmt.Sprintf("Upgrade %q failed: %s", newRelease.Name, err) + s.Log("warning: %s", msg) + newRelease.Info.Status.Code = release.Status_FAILED + newRelease.Info.Description = msg + s.recordRelease(newRelease, true) + return res, err + } + + // post-install hooks + if !req.DisableHooks { + if err := s.execHook(newRelease.Hooks, newRelease.Name, newRelease.Namespace, hooks.PostInstall, req.Timeout); err != nil { + msg := fmt.Sprintf("Release %q failed post-install: %s", newRelease.Name, err) + s.Log("warning: %s", msg) + newRelease.Info.Status.Code = release.Status_FAILED + newRelease.Info.Description = msg + s.recordRelease(newRelease, true) + return res, err + } + } + + newRelease.Info.Status.Code = release.Status_DEPLOYED + newRelease.Info.Description = "Upgrade complete" + s.recordRelease(newRelease, true) + + return res, nil +} + func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.Release, req *services.UpdateReleaseRequest) (*services.UpdateReleaseResponse, error) { res := &services.UpdateReleaseResponse{Release: updatedRelease} diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 0f2bcbabd..642952f19 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -225,9 +225,9 @@ func TestUpdateReleaseFailure(t *testing.T) { compareStoredAndReturnedRelease(t, *rs, *res) - edesc := "Upgrade \"angry-panda\" failed: Failed update in kube client" - if got := res.Release.Info.Description; got != edesc { - t.Errorf("Expected description %q, got %q", edesc, got) + expectedDescription := "Upgrade \"angry-panda\" failed: Failed update in kube client" + if got := res.Release.Info.Description; got != expectedDescription { + t.Errorf("Expected description %q, got %q", expectedDescription, got) } oldRelease, err := rs.env.Releases.Get(rel.Name, rel.Version) @@ -239,6 +239,50 @@ func TestUpdateReleaseFailure(t *testing.T) { } } +func TestUpdateReleaseFailure_Force(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := namedReleaseStub("forceful-luke", release.Status_FAILED) + rs.env.Releases.Create(rel) + rs.Log = t.Logf + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + DisableHooks: true, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/something", Data: []byte("text: 'Did you ever hear the tragedy of Darth Plagueis the Wise? I thought not. It’s not a story the Jedi would tell you. It’s a Sith legend. Darth Plagueis was a Dark Lord of the Sith, so powerful and so wise he could use the Force to influence the Midichlorians to create life... He had such a knowledge of the Dark Side that he could even keep the ones he cared about from dying. The Dark Side of the Force is a pathway to many abilities some consider to be unnatural. He became so powerful... The only thing he was afraid of was losing his power, which eventually, of course, he did. Unfortunately, he taught his apprentice everything he knew, then his apprentice killed him in his sleep. Ironic. He could save others from death, but not himself.'")}, + }, + }, + Force: true, + } + + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Errorf("Expected successful update, got %v", err) + } + + if updatedStatus := res.Release.Info.Status.Code; updatedStatus != release.Status_DEPLOYED { + t.Errorf("Expected DEPLOYED release. Got %d", updatedStatus) + } + + compareStoredAndReturnedRelease(t, *rs, *res) + + expectedDescription := "Upgrade complete" + if got := res.Release.Info.Description; got != expectedDescription { + t.Errorf("Expected description %q, got %q", expectedDescription, got) + } + + oldRelease, err := rs.env.Releases.Get(rel.Name, rel.Version) + if err != nil { + t.Errorf("Expected to be able to get previous release") + } + if oldStatus := oldRelease.Info.Status.Code; oldStatus != release.Status_DELETED { + t.Errorf("Expected Deleted status on previous Release version. Got %v", oldStatus) + } +} + func TestUpdateReleaseNoHooks(t *testing.T) { c := helm.NewContext() rs := rsFixture() From 58f6fa539a38fb41c63bdafa8021348e321b65aa Mon Sep 17 00:00:00 2001 From: Patrick Liu Date: Fri, 9 Mar 2018 10:21:13 +0800 Subject: [PATCH 080/449] Add helm-unittest in plugins --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index 6fbdf7df3..c14eb3880 100644 --- a/docs/related.md +++ b/docs/related.md @@ -42,6 +42,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query - [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp - [helm-hashtag](https://github.com/balboah/helm-hashtag) - Plugin for tracking docker tag hash digests as values +- [helm-unittest](https://github.com/lrills/helm-unittest) - Plugin for unit testing chart locally with YAML We also encourage GitHub authors to use the [helm-plugin](https://github.com/search?q=topic%3Ahelm-plugin&type=Repositories) tag on their plugin repositories. From 8f62dc713ab866a59096ba24764398f0cbc4fc87 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Thu, 8 Mar 2018 18:22:32 -0800 Subject: [PATCH 081/449] fix typo in docs and fake --- docs/chart_tests.md | 2 +- pkg/helm/fake.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/chart_tests.md b/docs/chart_tests.md index 0d2ae3ee7..d1cfe5017 100644 --- a/docs/chart_tests.md +++ b/docs/chart_tests.md @@ -2,7 +2,7 @@ A chart contains a number of Kubernetes resources and components that work together. As a chart author, you may want to write some tests that validate that your chart works as expected when it is installed. These tests also help the chart consumer understand what your chart is supposed to do. -A **test** in a helm chart lives under the `templates/` directory and is a pod definition that specifies a container with a given command to run. The container should exit successfully (exit 0) for a test to be considered a success. The pod definition must contain one of the helm test hook annotations: `helm.sh/hooks: test-success` or `helm.sh/hooks: test-failure`. +A **test** in a helm chart lives under the `templates/` directory and is a pod definition that specifies a container with a given command to run. The container should exit successfully (exit 0) for a test to be considered a success. The pod definition must contain one of the helm test hook annotations: `helm.sh/hook: test-success` or `helm.sh/hook: test-failure`. Example tests: - Validate that your configuration from the values.yaml file was properly injected. diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index dbb488610..0a9e77c44 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -194,7 +194,7 @@ var MockHookTemplate = `apiVersion: v1 kind: Job metadata: annotations: - "helm.sh/hooks": pre-install + "helm.sh/hook": pre-install ` // MockManifest is the manifest used for all mock release objects. From 4caecfbe7e1a1dcbe53234db715c2c24f760ca4e Mon Sep 17 00:00:00 2001 From: scriptonist Date: Fri, 9 Mar 2018 18:30:01 +0530 Subject: [PATCH 082/449] Added code to recover from a tiller pod crash in an event of template render failure --- pkg/engine/engine.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 46e0a59cf..e83476eae 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -19,6 +19,7 @@ package engine import ( "bytes" "fmt" + "log" "path" "sort" "strings" @@ -204,6 +205,11 @@ func (e *Engine) render(tpls map[string]renderable) (map[string]string, error) { // The idea with this process is to make it possible for more complex templates // to share common blocks, but to make the entire thing feel like a file-based // template engine. + defer func() { + if err := recover(); err != nil { + log.Printf("rendering template failed: %v\n", err) + } + }() t := template.New("gotpl") if e.Strict { t.Option("missingkey=error") From f9a8d3ef47225b01f253bb5eff88d91c756ca3a6 Mon Sep 17 00:00:00 2001 From: Nic Doye Date: Fri, 9 Mar 2018 13:10:10 +0000 Subject: [PATCH 083/449] Accept .yml files as well as .yaml for templates. See https://github.com/helm/helm-classic/pull/306 for helm classic and https://kubernetes.slack.com/archives/C51E88VDG/p1520588964000061 --- pkg/lint/rules/template.go | 6 +++--- pkg/lint/rules/template_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index 260259282..a8b6a6757 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -101,7 +101,7 @@ func Templates(linter *support.Linter, values []byte, namespace string, strict b linter.RunLinterRule(support.ErrorSev, path, validateAllowedExtension(fileName)) // We only apply the following lint rules to yaml files - if filepath.Ext(fileName) != ".yaml" { + if filepath.Ext(fileName) != ".yaml" || filepath.Ext(fileName) == ".yml" { continue } @@ -138,7 +138,7 @@ func validateTemplatesDir(templatesPath string) error { func validateAllowedExtension(fileName string) error { ext := filepath.Ext(fileName) - validExtensions := []string{".yaml", ".tpl", ".txt"} + validExtensions := []string{".yaml", ".yml", ".tpl", ".txt"} for _, b := range validExtensions { if b == ext { @@ -146,7 +146,7 @@ func validateAllowedExtension(fileName string) error { } } - return fmt.Errorf("file extension '%s' not valid. Valid extensions are .yaml, .tpl, or .txt", ext) + return fmt.Errorf("file extension '%s' not valid. Valid extensions are .yaml, .yml, .tpl, or .txt", ext) } func validateYamlContent(err error) error { diff --git a/pkg/lint/rules/template_test.go b/pkg/lint/rules/template_test.go index 080064698..cb1be94a2 100644 --- a/pkg/lint/rules/template_test.go +++ b/pkg/lint/rules/template_test.go @@ -28,11 +28,11 @@ import ( const templateTestBasedir = "./testdata/albatross" func TestValidateAllowedExtension(t *testing.T) { - var failTest = []string{"/foo", "/test.yml", "/test.toml", "test.yml"} + var failTest = []string{"/foo", "/test.toml"} for _, test := range failTest { err := validateAllowedExtension(test) - if err == nil || !strings.Contains(err.Error(), "Valid extensions are .yaml, .tpl, or .txt") { - t.Errorf("validateAllowedExtension('%s') to return \"Valid extensions are .yaml, .tpl, or .txt\", got no error", test) + if err == nil || !strings.Contains(err.Error(), "Valid extensions are .yaml, .yml, .tpl, or .txt") { + t.Errorf("validateAllowedExtension('%s') to return \"Valid extensions are .yaml, .yml, .tpl, or .txt\", got no error", test) } } var successTest = []string{"/foo.yaml", "foo.yaml", "foo.tpl", "/foo/bar/baz.yaml", "NOTES.txt"} From c285df0d65e9e1ade5eb9e22a8479578dd6e8ea1 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 9 Mar 2018 12:44:06 -0800 Subject: [PATCH 084/449] bump version to v2.8.1 (cherry picked from commit a80231648a1473929271764b920a8e346f6de844) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01927aff3..7622fafc8 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,10 @@ Think of it like apt/yum/homebrew for Kubernetes. Binary downloads of the Helm client can be found at the following links: -- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-darwin-amd64.tar.gz) -- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-linux-amd64.tar.gz) -- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-linux-386.tar.gz) -- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.1-windows-amd64.tar.gz) +- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-darwin-amd64.tar.gz) +- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-linux-amd64.tar.gz) +- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-linux-386.tar.gz) +- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-windows-amd64.tar.gz) Unpack the `helm` binary and add it to your PATH and you are good to go! macOS/[homebrew](https://brew.sh/) users can also use `brew install kubernetes-helm`. From f2e7bb5a5d29fd58c0102c39f6dd33db8d222fe5 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Fri, 9 Mar 2018 16:56:45 -0800 Subject: [PATCH 085/449] add support for output format in json or yaml --- cmd/helm/history.go | 75 ++++++++++++++++++++++++++++++++------- cmd/helm/history_test.go | 20 +++++++++++ docs/helm/helm_history.md | 3 +- 3 files changed, 84 insertions(+), 14 deletions(-) diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 659c39e81..944d61509 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -23,12 +23,24 @@ import ( "github.com/gosuri/uitable" "github.com/spf13/cobra" + "encoding/json" + "github.com/ghodss/yaml" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/timeconv" ) +type releaseInfo struct { + Revision int32 `json:"revision" yaml:"revision"` + Updated string `json:"updated" yaml:"updated"` + Status string `json:"status" yaml:"status"` + Chart string `json:"chart" yaml:"chart"` + Description string `json:"description" yaml:"description"` +} + +type releaseHistory []releaseInfo + var historyHelp = ` History prints historical revisions for a given release. @@ -46,11 +58,12 @@ The historical release set is printed as a formatted table, e.g: ` type historyCmd struct { - max int32 - rls string - out io.Writer - helmc helm.Interface - colWidth uint + max int32 + rls string + out io.Writer + helmc helm.Interface + colWidth uint + outputFormat string } func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { @@ -77,6 +90,7 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { f := cmd.Flags() f.Int32Var(&his.max, "max", 256, "maximum number of revision to include in history") f.UintVar(&his.colWidth, "col-width", 60, "specifies the max column width of output") + f.StringVarP(&his.outputFormat, "output", "o", "", "prints the output in the specified format ('json' or 'yaml' or defaults to 'table')") return cmd } @@ -90,15 +104,29 @@ func (cmd *historyCmd) run() error { return nil } - fmt.Fprintln(cmd.out, formatHistory(r.Releases, cmd.colWidth)) + releaseHistory := getReleaseHistory(r.Releases) + + var history []byte + var formattingError error + + switch cmd.outputFormat { + case "yaml": + history, formattingError = yaml.Marshal(releaseHistory) + case "json": + history, formattingError = json.Marshal(releaseHistory) + default: + history = formatAsTable(releaseHistory, cmd.colWidth) + } + + if formattingError != nil { + return prettyError(formattingError) + } + + fmt.Fprintln(cmd.out, string(history)) return nil } -func formatHistory(rls []*release.Release, colWidth uint) string { - tbl := uitable.New() - - tbl.MaxColWidth = colWidth - tbl.AddRow("REVISION", "UPDATED", "STATUS", "CHART", "DESCRIPTION") +func getReleaseHistory(rls []*release.Release) (history releaseHistory) { for i := len(rls) - 1; i >= 0; i-- { r := rls[i] c := formatChartname(r.Chart) @@ -106,9 +134,30 @@ func formatHistory(rls []*release.Release, colWidth uint) string { s := r.Info.Status.Code.String() v := r.Version d := r.Info.Description - tbl.AddRow(v, t, s, c, d) + + rInfo := releaseInfo{ + Revision: v, + Updated: t, + Status: s, + Chart: c, + Description: d, + } + history = append(history, rInfo) + } + + return history +} + +func formatAsTable(releases releaseHistory, colWidth uint) []byte { + tbl := uitable.New() + + tbl.MaxColWidth = colWidth + tbl.AddRow("REVISION", "UPDATED", "STATUS", "CHART", "DESCRIPTION") + for i := 0; i <= len(releases)-1; i++ { + r := releases[i] + tbl.AddRow(r.Revision, r.Updated, r.Status, r.Chart, r.Description) } - return tbl.String() + return tbl.Bytes() } func formatChartname(c *chart.Chart) string { diff --git a/cmd/helm/history_test.go b/cmd/helm/history_test.go index f193f6314..7594da964 100644 --- a/cmd/helm/history_test.go +++ b/cmd/helm/history_test.go @@ -63,6 +63,26 @@ func TestHistoryCmd(t *testing.T) { }, xout: "REVISION\tUPDATED \tSTATUS \tCHART \tDESCRIPTION \n3 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n4 \t(.*)\tDEPLOYED \tfoo-0.1.0-beta.1\tRelease mock\n", }, + { + cmds: "helm history --max=MAX RELEASE_NAME -o yaml", + desc: "get history with yaml output format", + args: []string{"--max=2", "-o=yaml", "angry-bird"}, + resp: []*rpb.Release{ + mk("angry-bird", 4, rpb.Status_DEPLOYED), + mk("angry-bird", 3, rpb.Status_SUPERSEDED), + }, + xout: "- chart: foo-0.1.0-beta.1\n description: Release mock\n revision: 3\n status: SUPERSEDED\n updated: (.*)\n- chart: foo-0.1.0-beta.1\n description: Release mock\n revision: 4\n status: DEPLOYED\n updated: (.*)\n\n", + }, + { + cmds: "helm history --max=MAX RELEASE_NAME -o json", + desc: "get history with json output format", + args: []string{"--max=2", "-o=json", "angry-bird"}, + resp: []*rpb.Release{ + mk("angry-bird", 4, rpb.Status_DEPLOYED), + mk("angry-bird", 3, rpb.Status_SUPERSEDED), + }, + xout: `[{"revision":3,"updated":".*","status":"SUPERSEDED","chart":"foo\-0.1.0-beta.1","description":"Release mock"},{"revision":4,"updated":".*","status":"DEPLOYED","chart":"foo\-0.1.0-beta.1","description":"Release mock"}]\n`, + }, } var buf bytes.Buffer diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index 81c720021..422c5f4e1 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -30,6 +30,7 @@ helm history [flags] RELEASE_NAME ``` --col-width uint specifies the max column width of output (default 60) --max int32 maximum number of revision to include in history (default 256) + -o, --output string prints the output in the specified format ('json' or 'yaml' or defaults to 'table') --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") @@ -51,4 +52,4 @@ helm history [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 9-Mar-2018 From fd4c8b0e230fb07b73a55f74e003077e151a016e Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Fri, 9 Mar 2018 15:47:34 -0500 Subject: [PATCH 086/449] fix(helm): remove duplicate code from cmd/helm/history_test.go. Closes #3649 Signed-off-by: Arash Deshmeh --- cmd/helm/history_test.go | 48 +++++++++++++--------------------------- 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/cmd/helm/history_test.go b/cmd/helm/history_test.go index f193f6314..6e46d24d4 100644 --- a/cmd/helm/history_test.go +++ b/cmd/helm/history_test.go @@ -17,10 +17,11 @@ limitations under the License. package main import ( - "bytes" - "regexp" + "io" "testing" + "github.com/spf13/cobra" + "k8s.io/helm/pkg/helm" rpb "k8s.io/helm/pkg/proto/hapi/release" ) @@ -34,50 +35,31 @@ func TestHistoryCmd(t *testing.T) { }) } - tests := []struct { - cmds string - desc string - args []string - resp []*rpb.Release - xout string - }{ + tests := []releaseCase{ { - cmds: "helm history RELEASE_NAME", - desc: "get history for release", + name: "get history for release", args: []string{"angry-bird"}, - resp: []*rpb.Release{ + rels: []*rpb.Release{ mk("angry-bird", 4, rpb.Status_DEPLOYED), mk("angry-bird", 3, rpb.Status_SUPERSEDED), mk("angry-bird", 2, rpb.Status_SUPERSEDED), mk("angry-bird", 1, rpb.Status_SUPERSEDED), }, - xout: "REVISION\tUPDATED \tSTATUS \tCHART \tDESCRIPTION \n1 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n2 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n3 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n4 \t(.*)\tDEPLOYED \tfoo-0.1.0-beta.1\tRelease mock\n", + expected: "REVISION\tUPDATED \tSTATUS \tCHART \tDESCRIPTION \n1 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n2 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n3 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n4 \t(.*)\tDEPLOYED \tfoo-0.1.0-beta.1\tRelease mock\n", }, { - cmds: "helm history --max=MAX RELEASE_NAME", - desc: "get history with max limit set", - args: []string{"--max=2", "angry-bird"}, - resp: []*rpb.Release{ + name: "get history with max limit set", + args: []string{"angry-bird"}, + flags: []string{"--max", "2"}, + rels: []*rpb.Release{ mk("angry-bird", 4, rpb.Status_DEPLOYED), mk("angry-bird", 3, rpb.Status_SUPERSEDED), }, - xout: "REVISION\tUPDATED \tSTATUS \tCHART \tDESCRIPTION \n3 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n4 \t(.*)\tDEPLOYED \tfoo-0.1.0-beta.1\tRelease mock\n", + expected: "REVISION\tUPDATED \tSTATUS \tCHART \tDESCRIPTION \n3 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n4 \t(.*)\tDEPLOYED \tfoo-0.1.0-beta.1\tRelease mock\n", }, } - var buf bytes.Buffer - for _, tt := range tests { - frc := &helm.FakeClient{Rels: tt.resp} - cmd := newHistoryCmd(frc, &buf) - cmd.ParseFlags(tt.args) - - if err := cmd.RunE(cmd, tt.args); err != nil { - t.Fatalf("%q\n\t%s: unexpected error: %v", tt.cmds, tt.desc, err) - } - re := regexp.MustCompile(tt.xout) - if !re.Match(buf.Bytes()) { - t.Fatalf("%q\n\t%s:\nexpected\n\t%q\nactual\n\t%q", tt.cmds, tt.desc, tt.xout, buf.String()) - } - buf.Reset() - } + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newHistoryCmd(c, out) + }) } From 3b56efb77c99a2040cbc92c21ba07ad8a7ccb0b4 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Mon, 12 Mar 2018 11:47:18 -0700 Subject: [PATCH 087/449] make table explicitly default --- cmd/helm/history.go | 6 ++++-- docs/helm/helm_history.md | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 944d61509..573459f91 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -90,7 +90,7 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { f := cmd.Flags() f.Int32Var(&his.max, "max", 256, "maximum number of revision to include in history") f.UintVar(&his.colWidth, "col-width", 60, "specifies the max column width of output") - f.StringVarP(&his.outputFormat, "output", "o", "", "prints the output in the specified format ('json' or 'yaml' or defaults to 'table')") + f.StringVarP(&his.outputFormat, "output", "o", "table", "prints the output in the specified format ('json' or 'yaml' or defaults to 'table')") return cmd } @@ -114,8 +114,10 @@ func (cmd *historyCmd) run() error { history, formattingError = yaml.Marshal(releaseHistory) case "json": history, formattingError = json.Marshal(releaseHistory) - default: + case "table": history = formatAsTable(releaseHistory, cmd.colWidth) + default: + return fmt.Errorf("unknown output format %q", cmd.outputFormat) } if formattingError != nil { diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index 422c5f4e1..a4ef50b80 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -30,7 +30,7 @@ helm history [flags] RELEASE_NAME ``` --col-width uint specifies the max column width of output (default 60) --max int32 maximum number of revision to include in history (default 256) - -o, --output string prints the output in the specified format ('json' or 'yaml' or defaults to 'table') + -o, --output string prints the output in the specified format ('json' or 'yaml' or defaults to 'table') (default "table") --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") @@ -52,4 +52,4 @@ helm history [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 9-Mar-2018 +###### Auto generated by spf13/cobra on 12-Mar-2018 From 393b2dca1bb98dc7f587c44e15efa0e5e8761814 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Mon, 12 Mar 2018 15:02:53 -0400 Subject: [PATCH 088/449] fix(helm) refactor helm status command tests to use releaseCase struct and the corresponding function runReleaseCases. Fixes #3659 Signed-off-by: Arash Deshmeh --- cmd/helm/status_test.go | 135 +++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 77 deletions(-) diff --git a/cmd/helm/status_test.go b/cmd/helm/status_test.go index 9de50b217..616b027f3 100644 --- a/cmd/helm/status_test.go +++ b/cmd/helm/status_test.go @@ -17,10 +17,8 @@ limitations under the License. package main import ( - "bytes" "fmt" "io" - "strings" "testing" "github.com/golang/protobuf/ptypes/timestamp" @@ -36,120 +34,103 @@ var ( dateString = timeconv.String(&date) ) -// statusCase describes a test case dealing with the status of a release -type statusCase struct { - name string - args []string - flags []string - expected string - err bool - rel *release.Release -} - func TestStatusCmd(t *testing.T) { - tests := []statusCase{ + tests := []releaseCase{ { name: "get status of a deployed release", args: []string{"flummoxed-chickadee"}, expected: outputWithStatus("DEPLOYED\n\n"), - rel: releaseMockWithStatus(&release.Status{ - Code: release.Status_DEPLOYED, - }), + rels: []*release.Release{ + releaseMockWithStatus(&release.Status{ + Code: release.Status_DEPLOYED, + }), + }, }, { name: "get status of a deployed release with notes", args: []string{"flummoxed-chickadee"}, expected: outputWithStatus("DEPLOYED\n\nNOTES:\nrelease notes\n"), - rel: releaseMockWithStatus(&release.Status{ - Code: release.Status_DEPLOYED, - Notes: "release notes", - }), + rels: []*release.Release{ + releaseMockWithStatus(&release.Status{ + Code: release.Status_DEPLOYED, + Notes: "release notes", + }), + }, }, { name: "get status of a deployed release with notes in json", args: []string{"flummoxed-chickadee"}, flags: []string{"-o", "json"}, expected: `{"name":"flummoxed-chickadee","info":{"status":{"code":1,"notes":"release notes"},"first_deployed":{"seconds":242085845},"last_deployed":{"seconds":242085845}}}`, - rel: releaseMockWithStatus(&release.Status{ - Code: release.Status_DEPLOYED, - Notes: "release notes", - }), + rels: []*release.Release{ + releaseMockWithStatus(&release.Status{ + Code: release.Status_DEPLOYED, + Notes: "release notes", + }), + }, }, { name: "get status of a deployed release with resources", args: []string{"flummoxed-chickadee"}, expected: outputWithStatus("DEPLOYED\n\nRESOURCES:\nresource A\nresource B\n\n"), - rel: releaseMockWithStatus(&release.Status{ - Code: release.Status_DEPLOYED, - Resources: "resource A\nresource B\n", - }), + rels: []*release.Release{ + releaseMockWithStatus(&release.Status{ + Code: release.Status_DEPLOYED, + Resources: "resource A\nresource B\n", + }), + }, }, { name: "get status of a deployed release with resources in YAML", args: []string{"flummoxed-chickadee"}, flags: []string{"-o", "yaml"}, - expected: "info:\nfirst_deployed:\nseconds:242085845\nlast_deployed:\nseconds:242085845\nstatus:\ncode:1\nresources:|\nresourceA\nresourceB\nname:flummoxed-chickadee\n", - rel: releaseMockWithStatus(&release.Status{ - Code: release.Status_DEPLOYED, - Resources: "resource A\nresource B\n", - }), + expected: "info:\n (.*)first_deployed:\n (.*)seconds: 242085845\n (.*)last_deployed:\n (.*)seconds: 242085845\n (.*)status:\n code: 1\n (.*)resources: |\n (.*)resource A\n (.*)resource B\nname: flummoxed-chickadee\n", + rels: []*release.Release{ + releaseMockWithStatus(&release.Status{ + Code: release.Status_DEPLOYED, + Resources: "resource A\nresource B\n", + }), + }, }, { name: "get status of a deployed release with test suite", args: []string{"flummoxed-chickadee"}, expected: outputWithStatus( fmt.Sprintf("DEPLOYED\n\nTEST SUITE:\nLast Started: %s\nLast Completed: %s\n\n", dateString, dateString) + - "TEST \tSTATUS \tINFO \tSTARTED \tCOMPLETED \n" + - fmt.Sprintf("test run 1\tSUCCESS \textra info\t%s\t%s\n", dateString, dateString) + - fmt.Sprintf("test run 2\tFAILURE \t \t%s\t%s\n", dateString, dateString)), - rel: releaseMockWithStatus(&release.Status{ - Code: release.Status_DEPLOYED, - LastTestSuiteRun: &release.TestSuite{ - StartedAt: &date, - CompletedAt: &date, - Results: []*release.TestRun{ - { - Name: "test run 1", - Status: release.TestRun_SUCCESS, - Info: "extra info", - StartedAt: &date, - CompletedAt: &date, - }, - { - Name: "test run 2", - Status: release.TestRun_FAILURE, - StartedAt: &date, - CompletedAt: &date, + "TEST \tSTATUS (.*)\tINFO (.*)\tSTARTED (.*)\tCOMPLETED (.*)\n" + + fmt.Sprintf("test run 1\tSUCCESS (.*)\textra info\t%s\t%s\n", dateString, dateString) + + fmt.Sprintf("test run 2\tFAILURE (.*)\t (.*)\t%s\t%s\n", dateString, dateString)), + rels: []*release.Release{ + releaseMockWithStatus(&release.Status{ + Code: release.Status_DEPLOYED, + LastTestSuiteRun: &release.TestSuite{ + StartedAt: &date, + CompletedAt: &date, + Results: []*release.TestRun{ + { + Name: "test run 1", + Status: release.TestRun_SUCCESS, + Info: "extra info", + StartedAt: &date, + CompletedAt: &date, + }, + { + Name: "test run 2", + Status: release.TestRun_FAILURE, + StartedAt: &date, + CompletedAt: &date, + }, }, }, - }, - }), + }), + }, }, } - scmd := func(c *helm.FakeClient, out io.Writer) *cobra.Command { + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { return newStatusCmd(c, out) - } - - var buf bytes.Buffer - for _, tt := range tests { - c := &helm.FakeClient{ - Rels: []*release.Release{tt.rel}, - } - cmd := scmd(c, &buf) - cmd.ParseFlags(tt.flags) - err := cmd.RunE(cmd, tt.args) - if (err != nil) != tt.err { - t.Errorf("%q. expected error, got '%v'", tt.name, err) - } + }) - expected := strings.Replace(tt.expected, " ", "", -1) - got := strings.Replace(buf.String(), " ", "", -1) - if expected != got { - t.Errorf("%q. expected\n%q\ngot\n%q", tt.name, expected, got) - } - buf.Reset() - } } func outputWithStatus(status string) string { From ff8fa3ef8f857808017f6790cfd0f889d755c1e0 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 12 Mar 2018 12:16:31 -0700 Subject: [PATCH 089/449] add back the default 5 second connection timeout When Helm v2.8.2 was released, we made a change to the default connection timeout by supplying a value passed from pkg/helm/environment. This broke support for third party clients relying on pkg/helm because now the default connection timeout is zero. Adding a default 5 second timeout back retains old behaviour, while not breaking backwards compatibility because the connection timeout can still be configured. --- pkg/helm/client.go | 2 ++ pkg/helm/client_test.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 pkg/helm/client_test.go diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 372613b2a..2fb1e54e4 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -44,6 +44,8 @@ type Client struct { // NewClient creates a new client. func NewClient(opts ...Option) *Client { var c Client + // set some sane defaults + c.Option(ConnectTimeout(5)) return c.Option(opts...) } diff --git a/pkg/helm/client_test.go b/pkg/helm/client_test.go new file mode 100644 index 000000000..95e044499 --- /dev/null +++ b/pkg/helm/client_test.go @@ -0,0 +1,34 @@ +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package helm + +import ( + "testing" + "time" +) + +func TestNewClient(t *testing.T) { + helmClient := NewClient() + if helmClient.opts.connectTimeout != 5*time.Second { + t.Errorf("expected default timeout duration to be 5 seconds, got %v", helmClient.opts.connectTimeout) + } + + helmClient = NewClient(ConnectTimeout(60)) + if helmClient.opts.connectTimeout != time.Minute { + t.Errorf("expected timeout duration to be 1 minute, got %v", helmClient.opts.connectTimeout) + } +} From c442ba2a4fa9733f81bd205f843b6a0365a8983d Mon Sep 17 00:00:00 2001 From: scriptonist Date: Tue, 13 Mar 2018 16:33:10 +0530 Subject: [PATCH 090/449] Now returning error and stopping installation --- pkg/engine/engine.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index e83476eae..7a940fc84 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -19,7 +19,6 @@ package engine import ( "bytes" "fmt" - "log" "path" "sort" "strings" @@ -197,7 +196,7 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap { } // render takes a map of templates/values and renders them. -func (e *Engine) render(tpls map[string]renderable) (map[string]string, error) { +func (e *Engine) render(tpls map[string]renderable) (rendered map[string]string, err error) { // Basically, what we do here is start with an empty parent template and then // build up a list of templates -- one for each file. Once all of the templates // have been parsed, we loop through again and execute every template. @@ -206,8 +205,8 @@ func (e *Engine) render(tpls map[string]renderable) (map[string]string, error) { // to share common blocks, but to make the entire thing feel like a file-based // template engine. defer func() { - if err := recover(); err != nil { - log.Printf("rendering template failed: %v\n", err) + if r := recover(); r != nil { + err = fmt.Errorf("rendering template failed: %v", r) } }() t := template.New("gotpl") @@ -247,7 +246,7 @@ func (e *Engine) render(tpls map[string]renderable) (map[string]string, error) { } } - rendered := make(map[string]string, len(files)) + rendered = make(map[string]string, len(files)) var buf bytes.Buffer for _, file := range files { // Don't render partials. We don't care out the direct output of partials. From d58c5a99a04a678f35ebcd3f7b58fba89986c852 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 13 Mar 2018 09:52:49 -0700 Subject: [PATCH 091/449] remove "This Repository" link from releases page --- scripts/get | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get b/scripts/get index 79e9f3520..1c1e617e8 100755 --- a/scripts/get +++ b/scripts/get @@ -78,7 +78,7 @@ checkDesiredVersion() { # Use the GitHub releases webpage for the project to find the desired version for this project. local release_url="https://github.com/kubernetes/helm/releases/${DESIRED_VERSION:-latest}" if type "curl" > /dev/null; then - TAG=$(curl -SsL $release_url | awk '/\/tag\//' | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') + TAG=$(curl -SsL $release_url | awk '/\/tag\//' | grep -v no-underline | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') elif type "wget" > /dev/null; then TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') fi From 0eb18ac957859652552ab1343d90c2b6ad1bdc32 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Tue, 13 Mar 2018 11:22:45 -0700 Subject: [PATCH 092/449] docs(OWNERS): add emeritus section (#3667) Cleaned up the owners file, adding the emeritus section and removing an account that was not a core maintainer. --- OWNERS | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/OWNERS b/OWNERS index 87f2d8f3a..32b26efa2 100644 --- a/OWNERS +++ b/OWNERS @@ -4,14 +4,11 @@ maintainers: - jascott1 - mattfarina - michelleN - - migmartri - nebril - prydonius - - seh - SlickNik - technosophos - thomastaylor312 - - vaikas-google - viglesiasce reviewers: - adamreese @@ -23,10 +20,11 @@ reviewers: - migmartri - nebril - prydonius - - sebgoa - - seh - SlickNik - technosophos - thomastaylor312 - - vaikas-google - viglesiasce +emeritus: + - migmartri + - seh + - vaikas-google From 5ca8746267753a273271f48c69cb901eaf08c1be Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 13 Mar 2018 21:10:59 -0400 Subject: [PATCH 093/449] fix(helm): refactor helm version command tests to remove duplication Signed-off-by: Arash Deshmeh --- cmd/helm/version_test.go | 72 ++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/cmd/helm/version_test.go b/cmd/helm/version_test.go index dbc40f401..e25724f4c 100644 --- a/cmd/helm/version_test.go +++ b/cmd/helm/version_test.go @@ -16,50 +16,50 @@ limitations under the License. package main import ( - "bytes" - "strings" + "fmt" + "io" + "regexp" "testing" + "github.com/spf13/cobra" + "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/version" ) func TestVersion(t *testing.T) { + lver := regexp.QuoteMeta(version.GetVersionProto().SemVer) + sver := regexp.QuoteMeta("1.2.3-fakeclient+testonly") + clientVersion := fmt.Sprintf("Client: &version\\.Version{SemVer:\"%s\", GitCommit:\"\", GitTreeState:\"\"}\n", lver) + serverVersion := fmt.Sprintf("Server: &version\\.Version{SemVer:\"%s\", GitCommit:\"\", GitTreeState:\"\"}\n", sver) - lver := version.GetVersionProto().SemVer - sver := "1.2.3-fakeclient+testonly" - - tests := []struct { - name string - client, server bool - args []string - fail bool - }{ - {"default", true, true, []string{}, false}, - {"client", true, false, []string{"-c"}, false}, - {"server", false, true, []string{"-s"}, false}, - {"template", true, true, []string{"--template='{{ .Client.SemVer }} {{ .Server.SemVer }}'"}, false}, + tests := []releaseCase{ + { + name: "default", + args: []string{}, + expected: clientVersion + serverVersion, + }, + { + name: "client", + args: []string{}, + flags: []string{"-c"}, + expected: clientVersion, + }, + { + name: "server", + args: []string{}, + flags: []string{"-s"}, + expected: serverVersion, + }, + { + name: "template", + args: []string{}, + flags: []string{"--template", "{{ .Client.SemVer }} {{ .Server.SemVer }}"}, + expected: lver + " " + sver, + }, } - settings.TillerHost = "fake-localhost" - for _, tt := range tests { - b := new(bytes.Buffer) - c := &helm.FakeClient{} - - cmd := newVersionCmd(c, b) - cmd.ParseFlags(tt.args) - if err := cmd.RunE(cmd, tt.args); err != nil { - if tt.fail { - continue - } - t.Fatal(err) - } - - if tt.client && !strings.Contains(b.String(), lver) { - t.Errorf("Expected %q to contain %q", b.String(), lver) - } - if tt.server && !strings.Contains(b.String(), sver) { - t.Errorf("Expected %q to contain %q", b.String(), sver) - } - } + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newVersionCmd(c, out) + }) } From 218fde07cf3cebb4bd5b13740711f0b158fcc5c0 Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Wed, 14 Mar 2018 16:37:59 +0100 Subject: [PATCH 094/449] Fix link to github issues --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6247f7b21..34b4f8b16 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,7 +30,7 @@ apply to [third_party](third_party/) and [vendor](vendor/). Whether you are a user or contributor, official support channels include: -- GitHub [issues](https://github.com/kubenetes/helm/issues/new) +- GitHub [issues](https://github.com/kubernetes/helm/issues/new) - Slack: #Helm room in the [Kubernetes Slack](http://slack.kubernetes.io/) Before opening a new issue or submitting a new pull request, it's helpful to search the project - it's likely that another user has already reported the issue you're facing, or it's a known issue that we're already aware of. From 8bd6a39bdf1ce9e06f3e90b0cda7bc3473e4ae1b Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 14 Mar 2018 08:49:16 -0700 Subject: [PATCH 095/449] add newline after header Doesn't cahnge the rendered markdown, but it makes the styling consistent with the rest of the docs. --- docs/securing_installation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index 2233620af..ffce5df75 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -41,6 +41,7 @@ Helm and Tiller are designed to install, remove, and modify logical applications Specific users and teams -- developers, operators, system and network administrators -- will need their own portion of the cluster in which they can use Helm and Tiller without risking other portions of the cluster. This means using a Kubernetes cluster with RBAC enabled and Tiller configured to enforce them. For more information about using RBAC in Kubernetes, see [Using RBAC Authorization](rbac.md). #### Tiller and User Permissions + Tiller in its current form does not provide a way to map user credentials to specific permissions within Kubernetes. When Tiller is running inside of the cluster, it operates with the permissions of its service account. If no service account name is supplied to Tiller, it runs with the default service account for that namespace. This means that all Tiller operations on that server are executed using the Tiller pod's credentials and permissions. To properly limit what Tiller itself can do, the standard Kubernetes RBAC mechanisms must be attached to Tiller, including Roles and RoleBindings that place explicit limits on what things a Tiller instance can install, and where. From b3d8c6760e281d8c079dca280e6805aa15951b9f Mon Sep 17 00:00:00 2001 From: Florian Zysset Date: Wed, 14 Mar 2018 18:00:39 +0000 Subject: [PATCH 096/449] feat(helm): inspect readme --- cmd/helm/inspect.go | 107 +++++++++++++++++++++++-------- cmd/helm/inspect_test.go | 13 ++-- docs/helm/helm.md | 2 +- docs/helm/helm_inspect.md | 3 +- docs/helm/helm_inspect_readme.md | 43 +++++++++++++ 5 files changed, 133 insertions(+), 35 deletions(-) create mode 100644 docs/helm/helm_inspect_readme.md diff --git a/cmd/helm/inspect.go b/cmd/helm/inspect.go index 6369b5ddc..736f14fce 100644 --- a/cmd/helm/inspect.go +++ b/cmd/helm/inspect.go @@ -19,11 +19,14 @@ package main import ( "fmt" "io" + "strings" "github.com/ghodss/yaml" + "github.com/golang/protobuf/ptypes/any" "github.com/spf13/cobra" "k8s.io/helm/pkg/chartutil" + "k8s.io/kubernetes/pkg/util/slice" ) const inspectDesc = ` @@ -43,6 +46,11 @@ This command inspects a chart (directory, file, or URL) and displays the content of the Charts.yaml file ` +const readmeChartDesc = ` +This command inspects a chart (directory, file, or URL) and displays the contents +of the README file +` + type inspectCmd struct { chartpath string output string @@ -60,13 +68,16 @@ type inspectCmd struct { const ( chartOnly = "chart" valuesOnly = "values" - both = "both" + readmeOnly = "readme" + all = "all" ) +var readmeFileNames = []string{"readme.md", "readme.txt", "readme"} + func newInspectCmd(out io.Writer) *cobra.Command { insp := &inspectCmd{ out: out, - output: both, + output: all, } inspectCommand := &cobra.Command{ @@ -125,51 +136,72 @@ func newInspectCmd(out io.Writer) *cobra.Command { }, } + readmeSubCmd := &cobra.Command{ + Use: "readme [CHART]", + Short: "shows inspect readme", + Long: readmeChartDesc, + RunE: func(cmd *cobra.Command, args []string) error { + insp.output = readmeOnly + if err := checkArgsLength(len(args), "chart name"); err != nil { + return err + } + cp, err := locateChartPath(insp.repoURL, args[0], insp.version, insp.verify, insp.keyring, + insp.certFile, insp.keyFile, insp.caFile) + if err != nil { + return err + } + insp.chartpath = cp + return insp.run() + }, + } + + cmds := []*cobra.Command{inspectCommand, readmeSubCmd, valuesSubCmd, chartSubCmd} vflag := "verify" vdesc := "verify the provenance data for this chart" - inspectCommand.Flags().BoolVar(&insp.verify, vflag, false, vdesc) - valuesSubCmd.Flags().BoolVar(&insp.verify, vflag, false, vdesc) - chartSubCmd.Flags().BoolVar(&insp.verify, vflag, false, vdesc) + for _, subCmd := range cmds { + subCmd.Flags().BoolVar(&insp.verify, vflag, false, vdesc) + } kflag := "keyring" kdesc := "path to the keyring containing public verification keys" kdefault := defaultKeyring() - inspectCommand.Flags().StringVar(&insp.keyring, kflag, kdefault, kdesc) - valuesSubCmd.Flags().StringVar(&insp.keyring, kflag, kdefault, kdesc) - chartSubCmd.Flags().StringVar(&insp.keyring, kflag, kdefault, kdesc) + for _, subCmd := range cmds { + subCmd.Flags().StringVar(&insp.keyring, kflag, kdefault, kdesc) + } verflag := "version" verdesc := "version of the chart. By default, the newest chart is shown" - inspectCommand.Flags().StringVar(&insp.version, verflag, "", verdesc) - valuesSubCmd.Flags().StringVar(&insp.version, verflag, "", verdesc) - chartSubCmd.Flags().StringVar(&insp.version, verflag, "", verdesc) + for _, subCmd := range cmds { + subCmd.Flags().StringVar(&insp.version, verflag, "", verdesc) + } repoURL := "repo" repoURLdesc := "chart repository url where to locate the requested chart" - inspectCommand.Flags().StringVar(&insp.repoURL, repoURL, "", repoURLdesc) - valuesSubCmd.Flags().StringVar(&insp.repoURL, repoURL, "", repoURLdesc) - chartSubCmd.Flags().StringVar(&insp.repoURL, repoURL, "", repoURLdesc) + for _, subCmd := range cmds { + subCmd.Flags().StringVar(&insp.repoURL, repoURL, "", repoURLdesc) + } certFile := "cert-file" certFiledesc := "verify certificates of HTTPS-enabled servers using this CA bundle" - inspectCommand.Flags().StringVar(&insp.certFile, certFile, "", certFiledesc) - valuesSubCmd.Flags().StringVar(&insp.certFile, certFile, "", certFiledesc) - chartSubCmd.Flags().StringVar(&insp.certFile, certFile, "", certFiledesc) + for _, subCmd := range cmds { + subCmd.Flags().StringVar(&insp.certFile, certFile, "", certFiledesc) + } keyFile := "key-file" keyFiledesc := "identify HTTPS client using this SSL key file" - inspectCommand.Flags().StringVar(&insp.keyFile, keyFile, "", keyFiledesc) - valuesSubCmd.Flags().StringVar(&insp.keyFile, keyFile, "", keyFiledesc) - chartSubCmd.Flags().StringVar(&insp.keyFile, keyFile, "", keyFiledesc) + for _, subCmd := range cmds { + subCmd.Flags().StringVar(&insp.keyFile, keyFile, "", keyFiledesc) + } caFile := "ca-file" caFiledesc := "chart repository url where to locate the requested chart" - inspectCommand.Flags().StringVar(&insp.caFile, caFile, "", caFiledesc) - valuesSubCmd.Flags().StringVar(&insp.caFile, caFile, "", caFiledesc) - chartSubCmd.Flags().StringVar(&insp.caFile, caFile, "", caFiledesc) + for _, subCmd := range cmds { + subCmd.Flags().StringVar(&insp.caFile, caFile, "", caFiledesc) + } - inspectCommand.AddCommand(valuesSubCmd) - inspectCommand.AddCommand(chartSubCmd) + for _, subCmd := range cmds[1:] { + inspectCommand.AddCommand(subCmd) + } return inspectCommand } @@ -184,16 +216,35 @@ func (i *inspectCmd) run() error { return err } - if i.output == chartOnly || i.output == both { + if i.output == chartOnly || i.output == all { fmt.Fprintln(i.out, string(cf)) } - if (i.output == valuesOnly || i.output == both) && chrt.Values != nil { - if i.output == both { + if (i.output == valuesOnly || i.output == all) && chrt.Values != nil { + if i.output == all { fmt.Fprintln(i.out, "---") } fmt.Fprintln(i.out, chrt.Values.Raw) } + if i.output == readmeOnly || i.output == all { + if i.output == all { + fmt.Fprintln(i.out, "---") + } + readme := findReadme(chrt.Files) + if readme == nil { + return nil + } + fmt.Fprintln(i.out, string(readme.Value)) + } + return nil +} + +func findReadme(files []*any.Any) (file *any.Any) { + for _, file := range files { + if slice.ContainsString(readmeFileNames, strings.ToLower(file.TypeUrl), nil) { + return file + } + } return nil } diff --git a/cmd/helm/inspect_test.go b/cmd/helm/inspect_test.go index b34b793f6..44d71fbbd 100644 --- a/cmd/helm/inspect_test.go +++ b/cmd/helm/inspect_test.go @@ -28,7 +28,7 @@ func TestInspect(t *testing.T) { insp := &inspectCmd{ chartpath: "testdata/testcharts/alpine", - output: "both", + output: all, out: b, } insp.run() @@ -42,15 +42,19 @@ func TestInspect(t *testing.T) { if err != nil { t.Fatal(err) } - - parts := strings.SplitN(b.String(), "---", 2) - if len(parts) != 2 { + readmeData, err := ioutil.ReadFile("testdata/testcharts/alpine/README.md") + if err != nil { + t.Fatal(err) + } + parts := strings.SplitN(b.String(), "---", 3) + if len(parts) != 3 { t.Fatalf("Expected 2 parts, got %d", len(parts)) } expect := []string{ strings.Replace(strings.TrimSpace(string(cdata)), "\r", "", -1), strings.Replace(strings.TrimSpace(string(data)), "\r", "", -1), + strings.Replace(strings.TrimSpace(string(readmeData)), "\r", "", -1), } // Problem: ghodss/yaml doesn't marshal into struct order. To solve, we @@ -73,5 +77,4 @@ func TestInspect(t *testing.T) { if b.Len() != 0 { t.Errorf("expected empty values buffer, got %q", b.String()) } - } diff --git a/docs/helm/helm.md b/docs/helm/helm.md index f470e84b2..8592cad7c 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -68,4 +68,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 14-Mar-2018 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index df122f763..9928ed847 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -42,6 +42,7 @@ helm inspect [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm inspect chart](helm_inspect_chart.md) - shows inspect chart +* [helm inspect readme](helm_inspect_readme.md) - shows inspect readme * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 14-Mar-2018 diff --git a/docs/helm/helm_inspect_readme.md b/docs/helm/helm_inspect_readme.md new file mode 100644 index 000000000..9dd9ebd43 --- /dev/null +++ b/docs/helm/helm_inspect_readme.md @@ -0,0 +1,43 @@ +## helm inspect readme + +shows inspect readme + +### Synopsis + + + +This command inspects a chart (directory, file, or URL) and displays the contents +of the README file + + +``` +helm inspect readme [CHART] +``` + +### Options + +``` + --ca-file string chart repository url where to locate the requested chart + --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + --key-file string identify HTTPS client using this SSL key file + --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") + --repo string chart repository url where to locate the requested chart + --verify verify the provenance data for this chart + --version string version of the chart. By default, the newest chart is shown +``` + +### Options inherited from parent commands + +``` + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") +``` + +### SEE ALSO +* [helm inspect](helm_inspect.md) - inspect a chart + +###### Auto generated by spf13/cobra on 14-Mar-2018 From 99eebad50062310ed3c4d0e37819075dd2188fd7 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Wed, 14 Mar 2018 13:54:06 -0700 Subject: [PATCH 097/449] update documentation as per review feedback --- cmd/helm/history.go | 2 +- docs/helm/helm_history.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 573459f91..7b8979142 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -90,7 +90,7 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { f := cmd.Flags() f.Int32Var(&his.max, "max", 256, "maximum number of revision to include in history") f.UintVar(&his.colWidth, "col-width", 60, "specifies the max column width of output") - f.StringVarP(&his.outputFormat, "output", "o", "table", "prints the output in the specified format ('json' or 'yaml' or defaults to 'table')") + f.StringVarP(&his.outputFormat, "output", "o", "table", "prints the output in the specified format (json|table|yaml)") return cmd } diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index a4ef50b80..ac51a8994 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -30,7 +30,7 @@ helm history [flags] RELEASE_NAME ``` --col-width uint specifies the max column width of output (default 60) --max int32 maximum number of revision to include in history (default 256) - -o, --output string prints the output in the specified format ('json' or 'yaml' or defaults to 'table') (default "table") + -o, --output string prints the output in the specified format (json|table|yaml) (default "table") --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") @@ -52,4 +52,4 @@ helm history [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 12-Mar-2018 +###### Auto generated by spf13/cobra on 14-Mar-2018 From 9680f79b5c0ec22905bad3a2aaedb501b359fe80 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Sat, 6 Jan 2018 12:19:29 -0500 Subject: [PATCH 098/449] feat: add --set and --values options to 'helm package' When 'helm package --set stringsArray' is run, this will set/override values in the packaged chart. 'helm package --values valueFiles' uses one or more value files to achieve the same. Closes #3141 Signed-off-by: Arash Deshmeh --- cmd/helm/package.go | 18 +++++ cmd/helm/package_test.go | 152 ++++++++++++++++++++++++++++++++++++++ docs/helm/helm_package.md | 4 +- 3 files changed, 173 insertions(+), 1 deletion(-) diff --git a/cmd/helm/package.go b/cmd/helm/package.go index ed44382c7..4b2e6b398 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -53,6 +53,8 @@ type packageCmd struct { save bool sign bool path string + valueFiles valueFiles + values []string key string keyring string version string @@ -95,6 +97,8 @@ func newPackageCmd(out io.Writer) *cobra.Command { } f := cmd.Flags() + f.VarP(&pkg.valueFiles, "values", "f", "specify values in a YAML file or a URL(can specify multiple)") + f.StringArrayVar(&pkg.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.BoolVar(&pkg.save, "save", true, "save packaged chart to local chart repository") f.BoolVar(&pkg.sign, "sign", false, "use a PGP private key to sign this package") f.StringVar(&pkg.key, "key", "", "name of the key to use when signing. Used if --sign is true") @@ -133,6 +137,20 @@ func (p *packageCmd) run() error { return err } + overrideVals, err := vals(p.valueFiles, p.values) + if err != nil { + return err + } + combinedVals, err := chartutil.CoalesceValues(ch, &chart.Config{Raw: string(overrideVals)}) + if err != nil { + return err + } + newVals, err := combinedVals.YAML() + if err != nil { + return err + } + ch.Values = &chart.Config{Raw: newVals} + // If version is set, modify the version. if len(p.version) != 0 { if err := setVersion(ch, p.version); err != nil { diff --git a/cmd/helm/package_test.go b/cmd/helm/package_test.go index 4404586e0..4a2df3f54 100644 --- a/cmd/helm/package_test.go +++ b/cmd/helm/package_test.go @@ -21,6 +21,7 @@ import ( "os" "path/filepath" "regexp" + "strings" "testing" "github.com/spf13/cobra" @@ -122,6 +123,13 @@ func TestPackage(t *testing.T) { hasfile: "chart-missing-deps-0.1.0.tgz", err: true, }, + { + name: "package --values does-not-exist", + args: []string{"testdata/testcharts/alpine"}, + flags: map[string]string{"values": "does-not-exist"}, + expect: "does-not-exist: no such file or directory", + err: true, + }, } // Because these tests are destructive, we run them in a tempdir. @@ -245,6 +253,150 @@ func TestSetAppVersion(t *testing.T) { } } +func TestPackageValues(t *testing.T) { + testCases := []struct { + desc string + args []string + valuefilesContents []string + flags map[string]string + expected []string + }{ + { + desc: "helm package, single values file", + args: []string{"testdata/testcharts/alpine"}, + valuefilesContents: []string{"Name: chart-name-foo"}, + expected: []string{"Name: chart-name-foo"}, + }, + { + desc: "helm package, multiple values files", + args: []string{"testdata/testcharts/alpine"}, + valuefilesContents: []string{"Name: chart-name-foo", "foo: bar"}, + expected: []string{"Name: chart-name-foo", "foo: bar"}, + }, + { + desc: "helm package, with set option", + args: []string{"testdata/testcharts/alpine"}, + flags: map[string]string{"set": "Name=chart-name-foo"}, + expected: []string{"Name: chart-name-foo"}, + }, + { + desc: "helm package, set takes precedence over value file", + args: []string{"testdata/testcharts/alpine"}, + valuefilesContents: []string{"Name: chart-name-foo"}, + flags: map[string]string{"set": "Name=chart-name-bar"}, + expected: []string{"Name: chart-name-bar"}, + }, + } + + thome, err := tempHelmHome(t) + if err != nil { + t.Fatal(err) + } + cleanup := resetEnv() + defer func() { + os.RemoveAll(thome.String()) + cleanup() + }() + + settings.Home = thome + + for _, tc := range testCases { + var files []string + for _, contents := range tc.valuefilesContents { + f, err := createValuesFile(contents) + if err != nil { + t.Errorf("%q unexpected error creating temporary values file: %q", tc.desc, err) + } + defer os.RemoveAll(filepath.Dir(f)) + files = append(files, f) + } + valueFiles := strings.Join(files, ",") + + expected, err := chartutil.ReadValues([]byte(strings.Join(tc.expected, "\n"))) + if err != nil { + t.Errorf("unexpected error parsing values: %q", err) + } + + runAndVerifyPackageCommandValues(t, tc.args, tc.flags, valueFiles, expected) + } +} + +func runAndVerifyPackageCommandValues(t *testing.T, args []string, flags map[string]string, valueFiles string, expected chartutil.Values) { + outputDir, err := ioutil.TempDir("", "helm-package") + if err != nil { + t.Errorf("unexpected error creating temporary output directory: %q", err) + } + defer os.RemoveAll(outputDir) + + if len(flags) == 0 { + flags = make(map[string]string) + } + flags["destination"] = outputDir + + if len(valueFiles) > 0 { + flags["values"] = valueFiles + } + + cmd := newPackageCmd(&bytes.Buffer{}) + setFlags(cmd, flags) + err = cmd.RunE(cmd, args) + if err != nil { + t.Errorf("unexpected error: %q", err) + } + + outputFile := filepath.Join(outputDir, "alpine-0.1.0.tgz") + verifyOutputChartExists(t, outputFile) + + var actual chartutil.Values + actual, err = getChartValues(outputFile) + if err != nil { + t.Errorf("unexpected error extracting chart values: %q", err) + } + + verifyValues(t, actual, expected) +} + +func createValuesFile(data string) (string, error) { + outputDir, err := ioutil.TempDir("", "values-file") + if err != nil { + return "", err + } + + outputFile := filepath.Join(outputDir, "values.yaml") + if err = ioutil.WriteFile(outputFile, []byte(data), 0755); err != nil { + os.RemoveAll(outputFile) + return "", err + } + + return outputFile, nil +} + +func getChartValues(chartPath string) (chartutil.Values, error) { + + chart, err := chartutil.Load(chartPath) + if err != nil { + return nil, err + } + + return chartutil.ReadValues([]byte(chart.Values.Raw)) +} + +func verifyValues(t *testing.T, actual, expected chartutil.Values) { + for key, value := range expected.AsMap() { + if got := actual[key]; got != value { + t.Errorf("Expected %q, got %q (%v)", value, got, actual) + } + } +} + +func verifyOutputChartExists(t *testing.T, chartPath string) { + if chartFile, err := os.Stat(chartPath); err != nil { + t.Errorf("expected file %q, got err %q", chartPath, err) + } else if chartFile.Size() == 0 { + t.Errorf("file %q has zero bytes.", chartPath) + } +} + func setFlags(cmd *cobra.Command, flags map[string]string) { dest := cmd.Flags() for f, v := range flags { diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index c51aa7032..daceef32c 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -29,7 +29,9 @@ helm package [flags] [CHART_PATH] [...] --key string name of the key to use when signing. Used if --sign is true --keyring string location of a public keyring (default "~/.gnupg/pubring.gpg") --save save packaged chart to local chart repository (default true) + --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --sign use a PGP private key to sign this package + -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) --version string set the version on the chart to this semver version ``` @@ -47,4 +49,4 @@ helm package [flags] [CHART_PATH] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 14-Mar-2018 From e8ec6679312e341ad69d3a03d7b3f9bd16a31b4d Mon Sep 17 00:00:00 2001 From: Michal Zerola Date: Thu, 15 Mar 2018 09:05:13 +0100 Subject: [PATCH 099/449] Fixed referencing the wrong env variable if SHA sum doesn't match. --- scripts/get | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/get b/scripts/get index 1c1e617e8..6654fd226 100755 --- a/scripts/get +++ b/scripts/get @@ -49,11 +49,11 @@ initOS() { # runs the given command as root (detects if we are root already) runAsRoot() { local CMD="$*" - + if [ $EUID -ne 0 ]; then CMD="sudo $CMD" fi - + $CMD } @@ -134,7 +134,7 @@ installFile() { local sum=$(openssl sha1 -sha256 ${HELM_TMP_FILE} | awk '{print $2}') local expected_sum=$(cat ${HELM_SUM_FILE}) if [ "$sum" != "$expected_sum" ]; then - echo "SHA sum of $HELM_TMP does not match. Aborting." + echo "SHA sum of ${HELM_TMP_FILE} does not match. Aborting." exit 1 fi From b7b1333731916c44159510563e1866c12050aa27 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 15 Mar 2018 05:42:19 -0400 Subject: [PATCH 100/449] fix(helm): search command returns error on index search failures (specifically on regular expression errors) Signed-off-by: Arash Deshmeh --- cmd/helm/search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/search.go b/cmd/helm/search.go index cf924dcb0..845bfd0be 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -83,7 +83,7 @@ func (s *searchCmd) run(args []string) error { q := strings.Join(args, " ") res, err = index.Search(q, searchMaxScore, s.regexp) if err != nil { - return nil + return err } } From 622ed7632c372c20e2d6b9fb88969a6ce67f0c27 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 15 Mar 2018 05:42:54 -0400 Subject: [PATCH 101/449] fix(helm): refactor search command tests to remove duplication Signed-off-by: Arash Deshmeh --- cmd/helm/search_test.go | 110 +++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 64 deletions(-) diff --git a/cmd/helm/search_test.go b/cmd/helm/search_test.go index 0fb54b5f9..734f752f5 100644 --- a/cmd/helm/search_test.go +++ b/cmd/helm/search_test.go @@ -17,78 +17,72 @@ limitations under the License. package main import ( - "bytes" - "strings" + "io" "testing" + + "github.com/spf13/cobra" + + "k8s.io/helm/pkg/helm" ) func TestSearchCmd(t *testing.T) { - tests := []struct { - name string - args []string - flags []string - expect string - regexp bool - fail bool - }{ + tests := []releaseCase{ { - name: "search for 'maria', expect one match", - args: []string{"maria"}, - expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/mariadb\t0.3.0 \t \tChart for MariaDB", + name: "search for 'maria', expect one match", + args: []string{"maria"}, + expected: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/mariadb\t0.3.0 \t \tChart for MariaDB", }, { - name: "search for 'alpine', expect two matches", - args: []string{"alpine"}, - expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod", + name: "search for 'alpine', expect two matches", + args: []string{"alpine"}, + expected: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod", }, { - name: "search for 'alpine' with versions, expect three matches", - args: []string{"alpine"}, - flags: []string{"--versions"}, - expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod\ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", + name: "search for 'alpine' with versions, expect three matches", + args: []string{"alpine"}, + flags: []string{"--versions"}, + expected: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod\ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", }, { - name: "search for 'alpine' with version constraint, expect one match with version 0.1.0", - args: []string{"alpine"}, - flags: []string{"--version", ">= 0.1, < 0.2"}, - expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", + name: "search for 'alpine' with version constraint, expect one match with version 0.1.0", + args: []string{"alpine"}, + flags: []string{"--version", ">= 0.1, < 0.2"}, + expected: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", }, { - name: "search for 'alpine' with version constraint, expect one match with version 0.1.0", - args: []string{"alpine"}, - flags: []string{"--versions", "--version", ">= 0.1, < 0.2"}, - expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", + name: "search for 'alpine' with version constraint, expect one match with version 0.1.0", + args: []string{"alpine"}, + flags: []string{"--versions", "--version", ">= 0.1, < 0.2"}, + expected: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", }, { - name: "search for 'alpine' with version constraint, expect one match with version 0.2.0", - args: []string{"alpine"}, - flags: []string{"--version", ">= 0.1"}, - expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod", + name: "search for 'alpine' with version constraint, expect one match with version 0.2.0", + args: []string{"alpine"}, + flags: []string{"--version", ">= 0.1"}, + expected: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod", }, { - name: "search for 'alpine' with version constraint and --versions, expect two matches", - args: []string{"alpine"}, - flags: []string{"--versions", "--version", ">= 0.1"}, - expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod\ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", + name: "search for 'alpine' with version constraint and --versions, expect two matches", + args: []string{"alpine"}, + flags: []string{"--versions", "--version", ">= 0.1"}, + expected: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod\ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", }, { - name: "search for 'syzygy', expect no matches", - args: []string{"syzygy"}, - expect: "No results found", + name: "search for 'syzygy', expect no matches", + args: []string{"syzygy"}, + expected: "No results found", }, { - name: "search for 'alp[a-z]+', expect two matches", - args: []string{"alp[a-z]+"}, - flags: []string{"--regexp"}, - expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod", - regexp: true, + name: "search for 'alp[a-z]+', expect two matches", + args: []string{"alp[a-z]+"}, + flags: []string{"--regexp"}, + expected: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod", }, { - name: "search for 'alp[', expect failure to compile regexp", - args: []string{"alp["}, - flags: []string{"--regexp"}, - regexp: true, - fail: true, + name: "search for 'alp[', expect failure to compile regexp", + args: []string{"alp["}, + flags: []string{"--regexp"}, + err: true, }, } @@ -97,19 +91,7 @@ func TestSearchCmd(t *testing.T) { settings.Home = "testdata/helmhome" - for _, tt := range tests { - buf := bytes.NewBuffer(nil) - cmd := newSearchCmd(buf) - cmd.ParseFlags(tt.flags) - if err := cmd.RunE(cmd, tt.args); err != nil { - if tt.fail { - continue - } - t.Fatalf("%s: unexpected error %s", tt.name, err) - } - got := strings.TrimSpace(buf.String()) - if got != tt.expect { - t.Errorf("%s: expected %q, got %q", tt.name, tt.expect, got) - } - } + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newSearchCmd(out) + }) } From 7d550e7aa0ba43121bae5a0b1f4bb3d23f9437bf Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 15 Mar 2018 16:26:57 -0700 Subject: [PATCH 102/449] fix windows path issues on `helm template -x` --- cmd/helm/template.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 4bfd4f7a3..3a7285fa1 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -122,7 +122,7 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { if len(t.renderFiles) > 0 { for _, f := range t.renderFiles { if !filepath.IsAbs(f) { - af, err = filepath.Abs(t.chartPath + "/" + f) + af, err = filepath.Abs(filepath.Join(t.chartPath, f)) if err != nil { return fmt.Errorf("could not resolve template path: %s", err) } @@ -232,9 +232,9 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { } in := func(needle string, haystack []string) bool { // make needle path absolute - d := strings.Split(needle, "/") + d := strings.Split(needle, string(os.PathSeparator)) dd := d[1:] - an := t.chartPath + "/" + strings.Join(dd, "/") + an := filepath.Join(t.chartPath, strings.Join(dd, string(os.PathSeparator))) for _, h := range haystack { if h == an { From 54d81dba042a5330161a701c55144cb6e71880e7 Mon Sep 17 00:00:00 2001 From: John Rowley Date: Thu, 15 Mar 2018 21:27:15 -0700 Subject: [PATCH 103/449] fixed an issue in versioning.mk (#3653) The MUTABLE_IMAGE_RUDDER variables was using the DOCKER_VERSION instead of MUTABLE_VERSION ``` MUTABLE_IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${MUTABLE_VERSION} MUTABLE_IMAGE_RUDDER := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME_RUDDER}:${DOCKER_VERSION} ``` --- versioning.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioning.mk b/versioning.mk index 2333530d9..d1c348f9c 100644 --- a/versioning.mk +++ b/versioning.mk @@ -28,7 +28,7 @@ LDFLAGS += -X k8s.io/helm/pkg/version.GitTreeState=${GIT_DIRTY} IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${DOCKER_VERSION} IMAGE_RUDDER := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME_RUDDER}:${DOCKER_VERSION} MUTABLE_IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${MUTABLE_VERSION} -MUTABLE_IMAGE_RUDDER := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME_RUDDER}:${DOCKER_VERSION} +MUTABLE_IMAGE_RUDDER := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME_RUDDER}:${MUTABLE_VERSION} DOCKER_PUSH = docker push ifeq ($(DOCKER_REGISTRY),gcr.io) From b027b895aaae74eb87642f57a804183ce3eb3d3e Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 15 Mar 2018 21:07:15 -0400 Subject: [PATCH 104/449] fix(helm): remove duplication in tests of repo-add command Signed-off-by: Arash Deshmeh --- cmd/helm/repo_add_test.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go index 1f49e45ea..79d0d3c53 100644 --- a/cmd/helm/repo_add_test.go +++ b/cmd/helm/repo_add_test.go @@ -17,10 +17,13 @@ limitations under the License. package main import ( - "bytes" + "io" "os" "testing" + "github.com/spf13/cobra" + + "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo/repotest" ) @@ -49,17 +52,13 @@ func TestRepoAddCmd(t *testing.T) { { name: "add a repository", args: []string{testName, srv.URL()}, - expected: testName + " has been added to your repositories", + expected: "\"" + testName + "\" has been added to your repositories", }, } - for _, tt := range tests { - buf := bytes.NewBuffer(nil) - c := newRepoAddCmd(buf) - if err := c.RunE(c, tt.args); err != nil { - t.Errorf("%q: expected %q, got %q", tt.name, tt.expected, err) - } - } + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newRepoAddCmd(out) + }) } func TestRepoAdd(t *testing.T) { From efdbc6d39cdca5ba58e132c14185a21cedfa3fda Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 15 Mar 2018 21:46:26 -0400 Subject: [PATCH 105/449] fix(helm): refactor tests on helm dependency list command to remove duplication Signed-off-by: Arash Deshmeh --- cmd/helm/dependency_test.go | 48 +++++++++++++------------------------ 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/cmd/helm/dependency_test.go b/cmd/helm/dependency_test.go index 887764742..cc4519147 100644 --- a/cmd/helm/dependency_test.go +++ b/cmd/helm/dependency_test.go @@ -16,59 +16,43 @@ limitations under the License. package main import ( - "bytes" - "strings" + "io" "testing" + + "github.com/spf13/cobra" + + "k8s.io/helm/pkg/helm" ) func TestDependencyListCmd(t *testing.T) { - tests := []struct { - name string - args []string - expect string - err bool - }{ + tests := []releaseCase{ { name: "No such chart", args: []string{"/no/such/chart"}, err: true, }, { - name: "No requirements.yaml", - args: []string{"testdata/testcharts/alpine"}, - expect: "WARNING: no requirements at ", + name: "No requirements.yaml", + args: []string{"testdata/testcharts/alpine"}, + expected: "WARNING: no requirements at ", }, { name: "Requirements in chart dir", args: []string{"testdata/testcharts/reqtest"}, - expect: "NAME \tVERSION\tREPOSITORY \tSTATUS \n" + + expected: "NAME \tVERSION\tREPOSITORY \tSTATUS \n" + "reqsubchart \t0.1.0 \thttps://example.com/charts\tunpacked\n" + "reqsubchart2\t0.2.0 \thttps://example.com/charts\tunpacked\n" + "reqsubchart3\t>=0.1.0\thttps://example.com/charts\tok \n\n", }, { - name: "Requirements in chart archive", - args: []string{"testdata/testcharts/reqtest-0.1.0.tgz"}, - expect: "NAME \tVERSION\tREPOSITORY \tSTATUS \nreqsubchart \t0.1.0 \thttps://example.com/charts\tmissing\nreqsubchart2\t0.2.0 \thttps://example.com/charts\tmissing\n", + name: "Requirements in chart archive", + args: []string{"testdata/testcharts/reqtest-0.1.0.tgz"}, + expected: "NAME \tVERSION\tREPOSITORY \tSTATUS \nreqsubchart \t0.1.0 \thttps://example.com/charts\tmissing\nreqsubchart2\t0.2.0 \thttps://example.com/charts\tmissing\n", }, } - for _, tt := range tests { - buf := bytes.NewBuffer(nil) - dlc := newDependencyListCmd(buf) - if err := dlc.RunE(dlc, tt.args); err != nil { - if tt.err { - continue - } - t.Errorf("Test %q: %s", tt.name, err) - continue - } - - got := buf.String() - if !strings.Contains(got, tt.expect) { - t.Errorf("Test: %q, Expected:\n%q\nGot:\n%q", tt.name, tt.expect, got) - } - } - + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newDependencyListCmd(out) + }) } From a2ff1726a8d0bce81e1b12148faf8fdb41601e5c Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Sun, 18 Mar 2018 20:42:05 -0400 Subject: [PATCH 106/449] fix output leak from tiller release install test Signed-off-by: Arash Deshmeh --- pkg/tiller/release_install_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index 793a36e94..8e2238e74 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -468,7 +468,6 @@ func TestInstallRelease_KubeVersion(t *testing.T) { }, } _, err := rs.InstallRelease(c, req) - fmt.Println(err) if err != nil { t.Fatalf("Expected valid range. Got %q", err) } From 5e3c8f6fd11bc40f5b0f4629028313cea9b5602d Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 19 Mar 2018 15:53:15 -0700 Subject: [PATCH 107/449] fix `helm get manifest` context deadline exceeded error --- cmd/helm/get_manifest.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/helm/get_manifest.go b/cmd/helm/get_manifest.go index 1c42830f0..c01febfb4 100644 --- a/cmd/helm/get_manifest.go +++ b/cmd/helm/get_manifest.go @@ -55,9 +55,7 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command { return errReleaseRequired } get.release = args[0] - if get.client == nil { - get.client = helm.NewClient(helm.Host(settings.TillerHost)) - } + get.client = ensureHelmClient(get.client) return get.run() }, } From 26b1f82457316c8b92c552687f1c0de0174d7e0b Mon Sep 17 00:00:00 2001 From: Daisuke Maki Date: Tue, 20 Mar 2018 09:44:20 +0900 Subject: [PATCH 108/449] Add actionable message in the error See #3697 --- cmd/helm/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index da1ee52d7..6d8d68c6e 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -443,7 +443,7 @@ func locateChartPath(repoURL, name, version string, verify bool, keyring, return filename, err } - return filename, fmt.Errorf("failed to download %q", name) + return filename, fmt.Errorf("failed to download %q (hint: running `helm repo update` may help)", name) } func generateName(nameTemplate string) (string, error) { From fdaaafc94db3a30c2c37b8e3ffdecd423e030a7a Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Tue, 20 Mar 2018 00:14:43 -0700 Subject: [PATCH 109/449] fix(helm): fix helm history unit tests fixes #3652 --- cmd/helm/helm_test.go | 29 ++++++++++++++--------------- cmd/helm/history.go | 14 +++++++------- cmd/helm/history_test.go | 20 ++++++++++---------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index 7d74d66b7..c95caa75f 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -40,23 +40,22 @@ type releaseCmd func(c *helm.FakeClient, out io.Writer) *cobra.Command // runReleaseCases runs a set of release cases through the given releaseCmd. func runReleaseCases(t *testing.T, tests []releaseCase, rcmd releaseCmd) { - var buf bytes.Buffer for _, tt := range tests { - c := &helm.FakeClient{ - Rels: tt.rels, - } - cmd := rcmd(c, &buf) - cmd.ParseFlags(tt.flags) - err := cmd.RunE(cmd, tt.args) - if (err != nil) != tt.err { - t.Errorf("%q. expected error, got '%v'", tt.name, err) - } - re := regexp.MustCompile(tt.expected) - if !re.Match(buf.Bytes()) { - t.Errorf("%q. expected\n%q\ngot\n%q", tt.name, tt.expected, buf.String()) - } - buf.Reset() + t.Run(tt.name, func(t *testing.T) { + c := &helm.FakeClient{Rels: tt.rels} + cmd := rcmd(c, &buf) + cmd.ParseFlags(tt.flags) + err := cmd.RunE(cmd, tt.args) + if (err != nil) != tt.err { + t.Errorf("expected error, got '%v'", err) + } + re := regexp.MustCompile(tt.expected) + if !re.Match(buf.Bytes()) { + t.Errorf("expected\n%q\ngot\n%q", tt.expected, buf.String()) + } + buf.Reset() + }) } } diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 7b8979142..e6366d31d 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -17,14 +17,14 @@ limitations under the License. package main import ( + "encoding/json" "fmt" "io" + "github.com/ghodss/yaml" "github.com/gosuri/uitable" "github.com/spf13/cobra" - "encoding/json" - "github.com/ghodss/yaml" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" @@ -32,11 +32,11 @@ import ( ) type releaseInfo struct { - Revision int32 `json:"revision" yaml:"revision"` - Updated string `json:"updated" yaml:"updated"` - Status string `json:"status" yaml:"status"` - Chart string `json:"chart" yaml:"chart"` - Description string `json:"description" yaml:"description"` + Revision int32 `json:"revision"` + Updated string `json:"updated"` + Status string `json:"status"` + Chart string `json:"chart"` + Description string `json:"description"` } type releaseHistory []releaseInfo diff --git a/cmd/helm/history_test.go b/cmd/helm/history_test.go index c6a14b333..fef433742 100644 --- a/cmd/helm/history_test.go +++ b/cmd/helm/history_test.go @@ -58,24 +58,24 @@ func TestHistoryCmd(t *testing.T) { expected: "REVISION\tUPDATED \tSTATUS \tCHART \tDESCRIPTION \n3 \t(.*)\tSUPERSEDED\tfoo-0.1.0-beta.1\tRelease mock\n4 \t(.*)\tDEPLOYED \tfoo-0.1.0-beta.1\tRelease mock\n", }, { - cmds: "helm history --max=MAX RELEASE_NAME -o yaml", - desc: "get history with yaml output format", - args: []string{"--max=2", "-o=yaml", "angry-bird"}, - resp: []*rpb.Release{ + name: "get history with yaml output format", + args: []string{"angry-bird"}, + flags: []string{"--output", "yaml"}, + rels: []*rpb.Release{ mk("angry-bird", 4, rpb.Status_DEPLOYED), mk("angry-bird", 3, rpb.Status_SUPERSEDED), }, - xout: "- chart: foo-0.1.0-beta.1\n description: Release mock\n revision: 3\n status: SUPERSEDED\n updated: (.*)\n- chart: foo-0.1.0-beta.1\n description: Release mock\n revision: 4\n status: DEPLOYED\n updated: (.*)\n\n", + expected: "- chart: foo-0.1.0-beta.1\n description: Release mock\n revision: 3\n status: SUPERSEDED\n updated: (.*)\n- chart: foo-0.1.0-beta.1\n description: Release mock\n revision: 4\n status: DEPLOYED\n updated: (.*)\n\n", }, { - cmds: "helm history --max=MAX RELEASE_NAME -o json", - desc: "get history with json output format", - args: []string{"--max=2", "-o=json", "angry-bird"}, - resp: []*rpb.Release{ + name: "get history with json output format", + args: []string{"angry-bird"}, + flags: []string{"--output", "json"}, + rels: []*rpb.Release{ mk("angry-bird", 4, rpb.Status_DEPLOYED), mk("angry-bird", 3, rpb.Status_SUPERSEDED), }, - xout: `[{"revision":3,"updated":".*","status":"SUPERSEDED","chart":"foo\-0.1.0-beta.1","description":"Release mock"},{"revision":4,"updated":".*","status":"DEPLOYED","chart":"foo\-0.1.0-beta.1","description":"Release mock"}]\n`, + expected: `[{"revision":3,"updated":".*","status":"SUPERSEDED","chart":"foo\-0.1.0-beta.1","description":"Release mock"},{"revision":4,"updated":".*","status":"DEPLOYED","chart":"foo\-0.1.0-beta.1","description":"Release mock"}]\n`, }, } From 27cbe424eeb88351faf7a82ce029ac33d1b40438 Mon Sep 17 00:00:00 2001 From: Andrii Soldatenko Date: Tue, 20 Mar 2018 16:35:22 +0200 Subject: [PATCH 110/449] Fixed typo --- cmd/helm/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index da1ee52d7..3b6d3e076 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -229,7 +229,7 @@ func (i *installCmd) run() error { } if req, err := chartutil.LoadRequirements(chartRequested); err == nil { - // If checkDependencies returns an error, we have unfullfilled dependencies. + // If checkDependencies returns an error, we have unfulfilled dependencies. // As of Helm 2.4.0, this is treated as a stopping condition: // https://github.com/kubernetes/helm/issues/2209 if err := checkDependencies(chartRequested, req); err != nil { From 8a73640549e58c13d162557de472f9006f3876bf Mon Sep 17 00:00:00 2001 From: Eyal Ben Moshe Date: Tue, 20 Mar 2018 17:56:48 +0000 Subject: [PATCH 111/449] Authentication support for remote charts repositories (#3206) Authentication support for remote charts repositories. --- cmd/helm/fetch.go | 8 ++- cmd/helm/inspect.go | 22 +++++-- cmd/helm/install.go | 12 +++- cmd/helm/repo_add.go | 10 ++- cmd/helm/repo_add_test.go | 6 +- cmd/helm/repo_remove_test.go | 2 +- cmd/helm/upgrade.go | 6 +- docs/chart_repository.md | 11 +++- docs/helm/helm_fetch.md | 4 +- docs/helm/helm_inspect.md | 2 + docs/helm/helm_inspect_chart.md | 2 + docs/helm/helm_inspect_values.md | 2 + docs/helm/helm_install.md | 2 + docs/helm/helm_repo_add.md | 2 + docs/helm/helm_upgrade.md | 2 + pkg/downloader/chart_downloader.go | 84 ++++++++++++++++++------- pkg/downloader/chart_downloader_test.go | 15 +++-- pkg/downloader/manager.go | 44 ++++++++----- pkg/downloader/manager_test.go | 9 ++- pkg/getter/httpgetter.go | 32 ++++++++-- pkg/getter/httpgetter_test.go | 4 +- pkg/repo/chartrepo.go | 18 +++++- 22 files changed, 224 insertions(+), 75 deletions(-) diff --git a/cmd/helm/fetch.go b/cmd/helm/fetch.go index 9c1f25614..069f57eff 100644 --- a/cmd/helm/fetch.go +++ b/cmd/helm/fetch.go @@ -52,6 +52,8 @@ type fetchCmd struct { destdir string version string repoURL string + username string + password string verify bool verifyLater bool @@ -106,6 +108,8 @@ func newFetchCmd(out io.Writer) *cobra.Command { f.StringVar(&fch.keyFile, "key-file", "", "identify HTTPS client using this SSL key file") f.StringVar(&fch.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") f.BoolVar(&fch.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.") + f.StringVar(&fch.username, "username", "", "chart repository username") + f.StringVar(&fch.password, "password", "", "chart repository password") return cmd } @@ -117,6 +121,8 @@ func (f *fetchCmd) run() error { Keyring: f.keyring, Verify: downloader.VerifyNever, Getters: getter.All(settings), + Username: f.username, + Password: f.password, } if f.verify { @@ -138,7 +144,7 @@ func (f *fetchCmd) run() error { } if f.repoURL != "" { - chartURL, err := repo.FindChartInRepoURL(f.repoURL, f.chartRef, f.version, f.certFile, f.keyFile, f.caFile, getter.All(settings)) + chartURL, err := repo.FindChartInAuthRepoURL(f.repoURL, f.username, f.password, f.chartRef, f.version, f.certFile, f.keyFile, f.caFile, getter.All(settings)) if err != nil { return err } diff --git a/cmd/helm/inspect.go b/cmd/helm/inspect.go index 736f14fce..999856959 100644 --- a/cmd/helm/inspect.go +++ b/cmd/helm/inspect.go @@ -59,6 +59,8 @@ type inspectCmd struct { out io.Writer version string repoURL string + username string + password string certFile string keyFile string @@ -88,7 +90,7 @@ func newInspectCmd(out io.Writer) *cobra.Command { if err := checkArgsLength(len(args), "chart name"); err != nil { return err } - cp, err := locateChartPath(insp.repoURL, args[0], insp.version, insp.verify, insp.keyring, + cp, err := locateChartPath(insp.repoURL, insp.username, insp.password, args[0], insp.version, insp.verify, insp.keyring, insp.certFile, insp.keyFile, insp.caFile) if err != nil { return err @@ -107,7 +109,7 @@ func newInspectCmd(out io.Writer) *cobra.Command { if err := checkArgsLength(len(args), "chart name"); err != nil { return err } - cp, err := locateChartPath(insp.repoURL, args[0], insp.version, insp.verify, insp.keyring, + cp, err := locateChartPath(insp.repoURL, insp.username, insp.password, args[0], insp.version, insp.verify, insp.keyring, insp.certFile, insp.keyFile, insp.caFile) if err != nil { return err @@ -126,7 +128,7 @@ func newInspectCmd(out io.Writer) *cobra.Command { if err := checkArgsLength(len(args), "chart name"); err != nil { return err } - cp, err := locateChartPath(insp.repoURL, args[0], insp.version, insp.verify, insp.keyring, + cp, err := locateChartPath(insp.repoURL, insp.username, insp.password, args[0], insp.version, insp.verify, insp.keyring, insp.certFile, insp.keyFile, insp.caFile) if err != nil { return err @@ -145,7 +147,7 @@ func newInspectCmd(out io.Writer) *cobra.Command { if err := checkArgsLength(len(args), "chart name"); err != nil { return err } - cp, err := locateChartPath(insp.repoURL, args[0], insp.version, insp.verify, insp.keyring, + cp, err := locateChartPath(insp.repoURL, insp.username, insp.password, args[0], insp.version, insp.verify, insp.keyring, insp.certFile, insp.keyFile, insp.caFile) if err != nil { return err @@ -181,6 +183,18 @@ func newInspectCmd(out io.Writer) *cobra.Command { subCmd.Flags().StringVar(&insp.repoURL, repoURL, "", repoURLdesc) } + username := "username" + usernamedesc := "chart repository username where to locate the requested chart" + inspectCommand.Flags().StringVar(&insp.username, username, "", usernamedesc) + valuesSubCmd.Flags().StringVar(&insp.username, username, "", usernamedesc) + chartSubCmd.Flags().StringVar(&insp.username, username, "", usernamedesc) + + password := "password" + passworddesc := "chart repository password where to locate the requested chart" + inspectCommand.Flags().StringVar(&insp.password, password, "", passworddesc) + valuesSubCmd.Flags().StringVar(&insp.password, password, "", passworddesc) + chartSubCmd.Flags().StringVar(&insp.password, password, "", passworddesc) + certFile := "cert-file" certFiledesc := "verify certificates of HTTPS-enabled servers using this CA bundle" for _, subCmd := range cmds { diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 3b6d3e076..a02f543db 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -118,6 +118,8 @@ type installCmd struct { timeout int64 wait bool repoURL string + username string + password string devel bool depUp bool @@ -165,7 +167,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { inst.version = ">0.0.0-0" } - cp, err := locateChartPath(inst.repoURL, args[0], inst.version, inst.verify, inst.keyring, + cp, err := locateChartPath(inst.repoURL, inst.username, inst.password, args[0], inst.version, inst.verify, inst.keyring, inst.certFile, inst.keyFile, inst.caFile) if err != nil { return err @@ -191,6 +193,8 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.Int64Var(&inst.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&inst.wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout") f.StringVar(&inst.repoURL, "repo", "", "chart repository url where to locate the requested chart") + f.StringVar(&inst.username, "username", "", "chart repository username where to locate the requested chart") + f.StringVar(&inst.password, "password", "", "chart repository password where to locate the requested chart") f.StringVar(&inst.certFile, "cert-file", "", "identify HTTPS client using this SSL certificate file") f.StringVar(&inst.keyFile, "key-file", "", "identify HTTPS client using this SSL key file") f.StringVar(&inst.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") @@ -381,7 +385,7 @@ func (i *installCmd) printRelease(rel *release.Release) { // - URL // // If 'verify' is true, this will attempt to also verify the chart. -func locateChartPath(repoURL, name, version string, verify bool, keyring, +func locateChartPath(repoURL, username, password, name, version string, verify bool, keyring, certFile, keyFile, caFile string) (string, error) { name = strings.TrimSpace(name) version = strings.TrimSpace(version) @@ -414,12 +418,14 @@ func locateChartPath(repoURL, name, version string, verify bool, keyring, Out: os.Stdout, Keyring: keyring, Getters: getter.All(settings), + Username: username, + Password: password, } if verify { dl.Verify = downloader.VerifyAlways } if repoURL != "" { - chartURL, err := repo.FindChartInRepoURL(repoURL, name, version, + chartURL, err := repo.FindChartInAuthRepoURL(repoURL, username, password, name, version, certFile, keyFile, caFile, getter.All(settings)) if err != nil { return "", err diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index b172d016c..77a64cc89 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -30,6 +30,8 @@ import ( type repoAddCmd struct { name string url string + username string + password string home helmpath.Home noupdate bool @@ -60,6 +62,8 @@ func newRepoAddCmd(out io.Writer) *cobra.Command { } f := cmd.Flags() + f.StringVar(&add.username, "username", "", "chart repository username") + f.StringVar(&add.password, "password", "", "chart repository password") f.BoolVar(&add.noupdate, "no-update", false, "raise error if repo is already registered") f.StringVar(&add.certFile, "cert-file", "", "identify HTTPS client using this SSL certificate file") f.StringVar(&add.keyFile, "key-file", "", "identify HTTPS client using this SSL key file") @@ -69,14 +73,14 @@ func newRepoAddCmd(out io.Writer) *cobra.Command { } func (a *repoAddCmd) run() error { - if err := addRepository(a.name, a.url, a.home, a.certFile, a.keyFile, a.caFile, a.noupdate); err != nil { + if err := addRepository(a.name, a.url, a.username, a.password, a.home, a.certFile, a.keyFile, a.caFile, a.noupdate); err != nil { return err } fmt.Fprintf(a.out, "%q has been added to your repositories\n", a.name) return nil } -func addRepository(name, url string, home helmpath.Home, certFile, keyFile, caFile string, noUpdate bool) error { +func addRepository(name, url, username, password string, home helmpath.Home, certFile, keyFile, caFile string, noUpdate bool) error { f, err := repo.LoadRepositoriesFile(home.RepositoryFile()) if err != nil { return err @@ -91,6 +95,8 @@ func addRepository(name, url string, home helmpath.Home, certFile, keyFile, caFi Name: name, Cache: cif, URL: url, + Username: username, + Password: password, CertFile: certFile, KeyFile: keyFile, CAFile: caFile, diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go index 79d0d3c53..157b1cc5b 100644 --- a/cmd/helm/repo_add_test.go +++ b/cmd/helm/repo_add_test.go @@ -80,7 +80,7 @@ func TestRepoAdd(t *testing.T) { settings.Home = thome - if err := addRepository(testName, ts.URL(), hh, "", "", "", true); err != nil { + if err := addRepository(testName, ts.URL(), "", "", hh, "", "", "", true); err != nil { t.Error(err) } @@ -93,11 +93,11 @@ func TestRepoAdd(t *testing.T) { t.Errorf("%s was not successfully inserted into %s", testName, hh.RepositoryFile()) } - if err := addRepository(testName, ts.URL(), hh, "", "", "", false); err != nil { + if err := addRepository(testName, ts.URL(), "", "", hh, "", "", "", false); err != nil { t.Errorf("Repository was not updated: %s", err) } - if err := addRepository(testName, ts.URL(), hh, "", "", "", false); err != nil { + if err := addRepository(testName, ts.URL(), "", "", hh, "", "", "", false); err != nil { t.Errorf("Duplicate repository name was added") } } diff --git a/cmd/helm/repo_remove_test.go b/cmd/helm/repo_remove_test.go index 63082b42e..174a44495 100644 --- a/cmd/helm/repo_remove_test.go +++ b/cmd/helm/repo_remove_test.go @@ -51,7 +51,7 @@ func TestRepoRemove(t *testing.T) { if err := removeRepoLine(b, testName, hh); err == nil { t.Errorf("Expected error removing %s, but did not get one.", testName) } - if err := addRepository(testName, ts.URL(), hh, "", "", "", true); err != nil { + if err := addRepository(testName, ts.URL(), "", "", hh, "", "", "", true); err != nil { t.Error(err) } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index d08dd62ef..aadb59ac2 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -73,6 +73,8 @@ type upgradeCmd struct { reuseValues bool wait bool repoURL string + username string + password string devel bool certFile string @@ -128,6 +130,8 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&upgrade.reuseValues, "reuse-values", false, "when upgrading, reuse the last release's values, and merge in any new values. If '--reset-values' is specified, this is ignored.") f.BoolVar(&upgrade.wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout") f.StringVar(&upgrade.repoURL, "repo", "", "chart repository url where to locate the requested chart") + f.StringVar(&upgrade.username, "username", "", "chart repository username where to locate the requested chart") + f.StringVar(&upgrade.password, "password", "", "chart repository password where to locate the requested chart") f.StringVar(&upgrade.certFile, "cert-file", "", "identify HTTPS client using this SSL certificate file") f.StringVar(&upgrade.keyFile, "key-file", "", "identify HTTPS client using this SSL key file") f.StringVar(&upgrade.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") @@ -139,7 +143,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { } func (u *upgradeCmd) run() error { - chartPath, err := locateChartPath(u.repoURL, u.chart, u.version, u.verify, u.keyring, u.certFile, u.keyFile, u.caFile) + chartPath, err := locateChartPath(u.repoURL, u.username, u.password, u.chart, u.version, u.verify, u.keyring, u.certFile, u.keyFile, u.caFile) if err != nil { return err } diff --git a/docs/chart_repository.md b/docs/chart_repository.md index 1379573fc..5a24249b8 100644 --- a/docs/chart_repository.md +++ b/docs/chart_repository.md @@ -148,6 +148,11 @@ Charts repository hosts its charts, so you may want to take a **Note:** A public GCS bucket can be accessed via simple HTTPS at this address `https://bucket-name.storage.googleapis.com/`. +### JFrog Artifactory + +You can also set up chart repositories using JFrog Artifactory. +Read more about chart repositories with JFrog Artifactory [here](https://www.jfrog.com/confluence/display/RTF/Helm+Chart+Repositories) + ### Github Pages example In a similar way you can create charts repository using GitHub Pages. @@ -270,10 +275,10 @@ fantastic-charts https://fantastic-charts.storage.googleapis.com If the charts are backed by HTTP basic authentication, you can also supply the username and password here: -```console -$ helm repo add fantastic-charts https://username:password@fantastic-charts.storage.googleapis.com +``console +$ helm repo add fantastic-charts https://fantastic-charts.storage.googleapis.com --username my-username --password my-password $ helm repo list -fantastic-charts https://username:password@fantastic-charts.storage.googleapis.com +fantastic-charts https://fantastic-charts.storage.googleapis.com ``` **Note:** A repository will not be added if it does not contain a valid diff --git a/docs/helm/helm_fetch.md b/docs/helm/helm_fetch.md index 3bc3334a0..1ddef65fa 100644 --- a/docs/helm/helm_fetch.md +++ b/docs/helm/helm_fetch.md @@ -33,10 +33,12 @@ helm fetch [flags] [chart URL | repo/chartname] [...] --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --key-file string identify HTTPS client using this SSL key file --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") + --password string chart repository password --prov fetch the provenance file, but don't perform verification --repo string chart repository url where to locate the requested chart --untar if set to true, will untar the chart after downloading it --untardir string if untar is specified, this flag specifies the name of the directory into which the chart is expanded (default ".") + --username string chart repository username --verify verify the package against its signature --version string specific version of a chart. Without this, the latest version is fetched ``` @@ -54,5 +56,3 @@ helm fetch [flags] [chart URL | repo/chartname] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. - -###### Auto generated by spf13/cobra on 8-Mar-2018 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index 9928ed847..e46b3dbf4 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -23,7 +23,9 @@ helm inspect [CHART] --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") + --password string chart repository password where to locate the requested chart --repo string chart repository url where to locate the requested chart + --username string chart repository username where to locate the requested chart --verify verify the provenance data for this chart --version string version of the chart. By default, the newest chart is shown ``` diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index bfa6061c8..cd1328b59 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -21,7 +21,9 @@ helm inspect chart [CHART] --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") + --password string chart repository password where to locate the requested chart --repo string chart repository url where to locate the requested chart + --username string chart repository username where to locate the requested chart --verify verify the provenance data for this chart --version string version of the chart. By default, the newest chart is shown ``` diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index fbf8660c2..6a907cc7d 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -21,7 +21,9 @@ helm inspect values [CHART] --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") + --password string chart repository password where to locate the requested chart --repo string chart repository url where to locate the requested chart + --username string chart repository username where to locate the requested chart --verify verify the provenance data for this chart --version string version of the chart. By default, the newest chart is shown ``` diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 406416dc8..0ae9097ba 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -80,6 +80,7 @@ helm install [CHART] --name-template string specify template used to name the release --namespace string namespace to install the release into. Defaults to the current kube config namespace. --no-hooks prevent hooks from running during install + --password string chart repository password where to locate the requested chart --replace re-use the given name, even if that name is already used. This is unsafe in production --repo string chart repository url where to locate the requested chart --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) @@ -89,6 +90,7 @@ helm install [CHART] --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") --tls-verify enable TLS for request and verify remote + --username string chart repository username where to locate the requested chart -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) --verify verify the package before installing it --version string specify the exact chart version to install. If this is not specified, the latest version is installed diff --git a/docs/helm/helm_repo_add.md b/docs/helm/helm_repo_add.md index f0dfcbd5d..456ffa27e 100644 --- a/docs/helm/helm_repo_add.md +++ b/docs/helm/helm_repo_add.md @@ -18,6 +18,8 @@ helm repo add [flags] [NAME] [URL] --cert-file string identify HTTPS client using this SSL certificate file --key-file string identify HTTPS client using this SSL key file --no-update raise error if repo is already registered + --password string chart repository password + --username string chart repository username ``` ### Options inherited from parent commands diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 5ed128958..5cbb9a110 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -46,6 +46,7 @@ helm upgrade [RELEASE] [CHART] --keyring string path to the keyring that contains public signing keys (default "~/.gnupg/pubring.gpg") --namespace string namespace to install the release into (only used if --install is set). Defaults to the current kube config namespace --no-hooks disable pre/post upgrade hooks + --password string chart repository password where to locate the requested chart --recreate-pods performs pods restart for the resource if applicable --repo string chart repository url where to locate the requested chart --reset-values when upgrading, reset the values to the ones built into the chart @@ -57,6 +58,7 @@ helm upgrade [RELEASE] [CHART] --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") --tls-verify enable TLS for request and verify remote + --username string chart repository username where to locate the requested chart -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) --verify verify the provenance of the chart before upgrading --version string specify the exact chart version to use. If this is not specified, the latest version is used diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index c7610aaf9..9fe89820e 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -67,6 +67,10 @@ type ChartDownloader struct { HelmHome helmpath.Home // Getter collection for the operation Getters getter.Providers + // Chart repository username + Username string + // Chart repository password + Password string } // DownloadTo retrieves a chart. Depending on the settings, it may also download a provenance file. @@ -81,7 +85,7 @@ type ChartDownloader struct { // Returns a string path to the location where the file was downloaded and a verification // (if provenance was verified), or an error if something bad happened. func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *provenance.Verification, error) { - u, g, err := c.ResolveChartVersion(ref, version) + u, r, g, err := c.ResolveChartVersionAndGetRepo(ref, version) if err != nil { return "", nil, err } @@ -100,7 +104,7 @@ func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *proven // If provenance is requested, verify it. ver := &provenance.Verification{} if c.Verify > VerifyNever { - body, err := g.Get(u.String() + ".prov") + body, err := r.Client.Get(u.String() + ".prov") if err != nil { if c.Verify == VerifyAlways { return destfile, ver, fmt.Errorf("Failed to fetch provenance %q", u.String()+".prov") @@ -140,96 +144,132 @@ func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *proven // * If version is empty, this will return the URL for the latest version // * If no version can be found, an error is returned func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, getter.Getter, error) { + u, r, _, err := c.ResolveChartVersionAndGetRepo(ref, version) + if r != nil { + return u, r.Client, err + } + return u, nil, err +} + +// Same as the ResolveChartVersion method, but returns the chart repositoryy. +func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*url.URL, *repo.ChartRepository, *getter.HttpGetter, error) { u, err := url.Parse(ref) if err != nil { - return nil, nil, fmt.Errorf("invalid chart URL format: %s", ref) + return nil, nil, nil, fmt.Errorf("invalid chart URL format: %s", ref) } rf, err := repo.LoadRepositoriesFile(c.HelmHome.RepositoryFile()) if err != nil { - return u, nil, err + return u, nil, nil, err } + g, err := getter.NewHTTPGetter(ref, "", "", "") + if err != nil { + return u, nil, nil, err + } + g.SetCredentials(c.getRepoCredentials(nil)) + if u.IsAbs() && len(u.Host) > 0 && len(u.Path) > 0 { // In this case, we have to find the parent repo that contains this chart // URL. And this is an unfortunate problem, as it requires actually going // through each repo cache file and finding a matching URL. But basically // we want to find the repo in case we have special SSL cert config // for that repo. + rc, err := c.scanReposForURL(ref, rf) if err != nil { // If there is no special config, return the default HTTP client and // swallow the error. if err == ErrNoOwnerRepo { - getterConstructor, err := c.Getters.ByScheme(u.Scheme) - if err != nil { - return u, nil, err - } - getter, err := getterConstructor(ref, "", "", "") - return u, getter, err + r := &repo.ChartRepository{} + r.Client = g + g.SetCredentials(c.getRepoCredentials(r)) + return u, r, g, err } - return u, nil, err + return u, nil, nil, err } r, err := repo.NewChartRepository(rc, c.Getters) // If we get here, we don't need to go through the next phase of looking // up the URL. We have it already. So we just return. - return u, r.Client, err + return u, r, g, err } // See if it's of the form: repo/path_to_chart p := strings.SplitN(u.Path, "/", 2) if len(p) < 2 { - return u, nil, fmt.Errorf("Non-absolute URLs should be in form of repo_name/path_to_chart, got: %s", u) + return u, nil, nil, fmt.Errorf("Non-absolute URLs should be in form of repo_name/path_to_chart, got: %s", u) } repoName := p[0] chartName := p[1] rc, err := pickChartRepositoryConfigByName(repoName, rf.Repositories) if err != nil { - return u, nil, err + return u, nil, nil, err } r, err := repo.NewChartRepository(rc, c.Getters) if err != nil { - return u, nil, err + return u, nil, nil, err } // Next, we need to load the index, and actually look up the chart. i, err := repo.LoadIndexFile(c.HelmHome.CacheIndex(r.Config.Name)) if err != nil { - return u, r.Client, fmt.Errorf("no cached repo found. (try 'helm repo update'). %s", err) + return u, r, g, fmt.Errorf("no cached repo found. (try 'helm repo update'). %s", err) } cv, err := i.Get(chartName, version) if err != nil { - return u, r.Client, fmt.Errorf("chart %q matching %s not found in %s index. (try 'helm repo update'). %s", chartName, version, r.Config.Name, err) + return u, r, g, fmt.Errorf("chart %q matching %s not found in %s index. (try 'helm repo update'). %s", chartName, version, r.Config.Name, err) } if len(cv.URLs) == 0 { - return u, r.Client, fmt.Errorf("chart %q has no downloadable URLs", ref) + return u, r, g, fmt.Errorf("chart %q has no downloadable URLs", ref) } // TODO: Seems that picking first URL is not fully correct u, err = url.Parse(cv.URLs[0]) if err != nil { - return u, r.Client, fmt.Errorf("invalid chart URL format: %s", ref) + return u, r, g, fmt.Errorf("invalid chart URL format: %s", ref) } // If the URL is relative (no scheme), prepend the chart repo's base URL if !u.IsAbs() { repoURL, err := url.Parse(rc.URL) if err != nil { - return repoURL, r.Client, err + return repoURL, r, nil, err } q := repoURL.Query() // We need a trailing slash for ResolveReference to work, but make sure there isn't already one repoURL.Path = strings.TrimSuffix(repoURL.Path, "/") + "/" u = repoURL.ResolveReference(u) u.RawQuery = q.Encode() - return u, r.Client, err + g, err := getter.NewHTTPGetter(rc.URL, "", "", "") + if err != nil { + return repoURL, r, nil, err + } + g.SetCredentials(c.getRepoCredentials(r)) + return u, r, g, err } - return u, r.Client, nil + return u, r, g, nil +} + +// If this ChartDownloader is not configured to use credentials, and the chart repository sent as an argument is, +// then the repository's configured credentials are returned. +// Else, this ChartDownloader's credentials are returned. +func (c *ChartDownloader) getRepoCredentials(r *repo.ChartRepository) (username, password string) { + username = c.Username + password = c.Password + if r != nil && r.Config != nil { + if username == "" { + username = r.Config.Username + } + if password == "" { + password = r.Config.Password + } + } + return } // VerifyChart takes a path to a chart archive and a keyring, and verifies the chart. diff --git a/pkg/downloader/chart_downloader_test.go b/pkg/downloader/chart_downloader_test.go index 0100772e9..80efa77e8 100644 --- a/pkg/downloader/chart_downloader_test.go +++ b/pkg/downloader/chart_downloader_test.go @@ -99,11 +99,11 @@ func TestDownload(t *testing.T) { t.Fatal("No http provider found") } - getter, err := provider.New(srv.URL, "", "", "") + g, err := provider.New(srv.URL, "", "", "") if err != nil { t.Fatal(err) } - got, err := getter.Get(srv.URL) + got, err := g.Get(srv.URL) if err != nil { t.Fatal(err) } @@ -115,16 +115,21 @@ func TestDownload(t *testing.T) { // test with server backed by basic auth basicAuthSrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { username, password, ok := r.BasicAuth() - if !ok || username != "username" && password != "password" { + if !ok || username != "username" || password != "password" { t.Errorf("Expected request to use basic auth and for username == 'username' and password == 'password', got '%v', '%s', '%s'", ok, username, password) } fmt.Fprint(w, expect) })) + defer basicAuthSrv.Close() u, _ := url.ParseRequestURI(basicAuthSrv.URL) - u.User = url.UserPassword("username", "password") - got, err = getter.Get(u.String()) + httpgetter, err := getter.NewHTTPGetter(u.String(), "", "", "") + if err != nil { + t.Fatal(err) + } + httpgetter.SetCredentials("username", "password") + got, err = httpgetter.Get(u.String()) if err != nil { t.Fatal(err) } diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 6d4103bae..89a839b54 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -197,14 +197,6 @@ func (m *Manager) downloadAll(deps []*chartutil.Dependency) error { return err } - dl := ChartDownloader{ - Out: m.Out, - Verify: m.Verify, - Keyring: m.Keyring, - HelmHome: m.HelmHome, - Getters: m.Getters, - } - destPath := filepath.Join(m.ChartPath, "charts") tmpPath := filepath.Join(m.ChartPath, "tmpcharts") @@ -245,12 +237,22 @@ func (m *Manager) downloadAll(deps []*chartutil.Dependency) error { // Any failure to resolve/download a chart should fail: // https://github.com/kubernetes/helm/issues/1439 - churl, err := findChartURL(dep.Name, dep.Version, dep.Repository, repos) + churl, username, password, err := findChartURL(dep.Name, dep.Version, dep.Repository, repos) if err != nil { saveError = fmt.Errorf("could not find %s: %s", churl, err) break } + dl := ChartDownloader{ + Out: m.Out, + Verify: m.Verify, + Keyring: m.Keyring, + HelmHome: m.HelmHome, + Getters: m.Getters, + Username: username, + Password: password, + } + if _, _, err := dl.DownloadTo(churl, "", destPath); err != nil { saveError = fmt.Errorf("could not download %s: %s", churl, err) break @@ -476,22 +478,30 @@ func (m *Manager) parallelRepoUpdate(repos []*repo.Entry) error { // repoURL is the repository to search // // If it finds a URL that is "relative", it will prepend the repoURL. -func findChartURL(name, version, repoURL string, repos map[string]*repo.ChartRepository) (string, error) { +func findChartURL(name, version, repoURL string, repos map[string]*repo.ChartRepository) (url, username, password string, err error) { for _, cr := range repos { if urlutil.Equal(repoURL, cr.Config.URL) { - entry, err := findEntryByName(name, cr) + var entry repo.ChartVersions + entry, err = findEntryByName(name, cr) if err != nil { - return "", err + return } - ve, err := findVersionedEntry(version, entry) + var ve *repo.ChartVersion + ve, err = findVersionedEntry(version, entry) if err != nil { - return "", err + return } - - return normalizeURL(repoURL, ve.URLs[0]) + url, err = normalizeURL(repoURL, ve.URLs[0]) + if err != nil { + return + } + username = cr.Config.Username + password = cr.Config.Password + return } } - return "", fmt.Errorf("chart %s not found in %s", name, repoURL) + err = fmt.Errorf("chart %s not found in %s", name, repoURL) + return } // findEntryByName finds an entry in the chart repository whose name matches the given name. diff --git a/pkg/downloader/manager_test.go b/pkg/downloader/manager_test.go index 091277689..1ff2a9c17 100644 --- a/pkg/downloader/manager_test.go +++ b/pkg/downloader/manager_test.go @@ -77,14 +77,19 @@ func TestFindChartURL(t *testing.T) { version := "0.1.0" repoURL := "http://example.com/charts" - churl, err := findChartURL(name, version, repoURL, repos) + churl, username, password, err := findChartURL(name, version, repoURL, repos) if err != nil { t.Fatal(err) } if churl != "https://kubernetes-charts.storage.googleapis.com/alpine-0.1.0.tgz" { t.Errorf("Unexpected URL %q", churl) } - + if username != "" { + t.Errorf("Unexpected username %q", username) + } + if password != "" { + t.Errorf("Unexpected password %q", password) + } } func TestGetRepoNames(t *testing.T) { diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index c86b96458..dd462ce5f 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -28,12 +28,23 @@ import ( ) //httpGetter is the efault HTTP(/S) backend handler -type httpGetter struct { - client *http.Client +type HttpGetter struct { + client *http.Client + username string + password string +} + +func (g *HttpGetter) SetCredentials(username, password string) { + g.username = username + g.password = password } //Get performs a Get from repo.Getter and returns the body. -func (g *httpGetter) Get(href string) (*bytes.Buffer, error) { +func (g *HttpGetter) Get(href string) (*bytes.Buffer, error) { + return g.get(href) +} + +func (g *HttpGetter) get(href string) (*bytes.Buffer, error) { buf := bytes.NewBuffer(nil) // Set a helm specific user agent so that a repo server and metrics can @@ -44,6 +55,10 @@ func (g *httpGetter) Get(href string) (*bytes.Buffer, error) { } req.Header.Set("User-Agent", "Helm/"+strings.TrimPrefix(version.GetVersion(), "v")) + if g.username != "" && g.password != "" { + req.SetBasicAuth(g.username, g.password) + } + resp, err := g.client.Do(req) if err != nil { return buf, err @@ -59,17 +74,22 @@ func (g *httpGetter) Get(href string) (*bytes.Buffer, error) { // newHTTPGetter constructs a valid http/https client as Getter func newHTTPGetter(URL, CertFile, KeyFile, CAFile string) (Getter, error) { - var client httpGetter + return NewHTTPGetter(URL, CertFile, KeyFile, CAFile) +} + +// NewHTTPGetter constructs a valid http/https client as HttpGetter +func NewHTTPGetter(URL, CertFile, KeyFile, CAFile string) (*HttpGetter, error) { + var client HttpGetter if CertFile != "" && KeyFile != "" { tlsConf, err := tlsutil.NewClientTLS(CertFile, KeyFile, CAFile) if err != nil { - return nil, fmt.Errorf("can't create TLS config for client: %s", err.Error()) + return &client, fmt.Errorf("can't create TLS config for client: %s", err.Error()) } tlsConf.BuildNameToCertificate() sni, err := urlutil.ExtractHostname(URL) if err != nil { - return nil, err + return &client, err } tlsConf.ServerName = sni diff --git a/pkg/getter/httpgetter_test.go b/pkg/getter/httpgetter_test.go index 477e0bc4f..fe3fde22a 100644 --- a/pkg/getter/httpgetter_test.go +++ b/pkg/getter/httpgetter_test.go @@ -27,7 +27,7 @@ func TestHTTPGetter(t *testing.T) { t.Fatal(err) } - if hg, ok := g.(*httpGetter); !ok { + if hg, ok := g.(*HttpGetter); !ok { t.Fatal("Expected newHTTPGetter to produce an httpGetter") } else if hg.client != http.DefaultClient { t.Fatal("Expected newHTTPGetter to return a default HTTP client.") @@ -42,7 +42,7 @@ func TestHTTPGetter(t *testing.T) { t.Fatal(err) } - if _, ok := g.(*httpGetter); !ok { + if _, ok := g.(*HttpGetter); !ok { t.Fatal("Expected newHTTPGetter to produce an httpGetter") } } diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index b95a7ae07..c76cc7913 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -36,6 +36,8 @@ type Entry struct { Name string `json:"name"` Cache string `json:"cache"` URL string `json:"url"` + Username string `json:"username"` + Password string `json:"password"` CertFile string `json:"certFile"` KeyFile string `json:"keyFile"` CAFile string `json:"caFile"` @@ -117,7 +119,12 @@ func (r *ChartRepository) DownloadIndexFile(cachePath string) error { parsedURL.Path = strings.TrimSuffix(parsedURL.Path, "/") + "/index.yaml" indexURL = parsedURL.String() - resp, err := r.Client.Get(indexURL) + g, err := getter.NewHTTPGetter(indexURL, r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile) + if err != nil { + return err + } + g.SetCredentials(r.Config.Username, r.Config.Password) + resp, err := g.Get(indexURL) if err != nil { return err } @@ -186,6 +193,13 @@ func (r *ChartRepository) generateIndex() error { // FindChartInRepoURL finds chart in chart repository pointed by repoURL // without adding repo to repositories func FindChartInRepoURL(repoURL, chartName, chartVersion, certFile, keyFile, caFile string, getters getter.Providers) (string, error) { + return FindChartInAuthRepoURL(repoURL, "", "", chartName, chartVersion, certFile, keyFile, caFile, getters) +} + +// FindChartInRepoURL finds chart in chart repository pointed by repoURL +// without adding repo to repositories. +// Unlike the FindChartInRepoURL function, this function also receives credentials for the chart repository. +func FindChartInAuthRepoURL(repoURL, username, password, chartName, chartVersion, certFile, keyFile, caFile string, getters getter.Providers) (string, error) { // Download and write the index file to a temporary location tempIndexFile, err := ioutil.TempFile("", "tmp-repo-file") @@ -196,6 +210,8 @@ func FindChartInRepoURL(repoURL, chartName, chartVersion, certFile, keyFile, caF c := Entry{ URL: repoURL, + Username: username, + Password: password, CertFile: certFile, KeyFile: keyFile, CAFile: caFile, From fb6645f67ee50aad32c64a32701fecedd2660412 Mon Sep 17 00:00:00 2001 From: Arturo Contreras Date: Wed, 14 Mar 2018 16:33:02 -0600 Subject: [PATCH 112/449] Adding --set-string flag to force string values. --- cmd/helm/install.go | 22 ++++++++-- cmd/helm/lint.go | 9 +++++ cmd/helm/template.go | 4 +- cmd/helm/upgrade.go | 8 +++- docs/chart_best_practices/values.md | 2 +- docs/helm/helm_install.md | 62 ++++++++++++++++------------- docs/helm/helm_lint.md | 11 ++--- docs/helm/helm_template.md | 21 +++++----- docs/helm/helm_upgrade.md | 60 ++++++++++++++-------------- pkg/strvals/parser.go | 45 +++++++++++++++------ pkg/strvals/parser_test.go | 40 +++++++++++++++++++ scripts/completions.bash | 2 + 12 files changed, 194 insertions(+), 92 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index a02f543db..1d8ec85f1 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -50,7 +50,8 @@ The install argument must be a chart reference, a path to a packaged chart, a path to an unpacked chart directory or a URL. To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line. +or use the '--set' flag and pass configuration from the command line, to force +a string value use '--set-string'. $ helm install -f myvalues.yaml ./redis @@ -58,6 +59,10 @@ or $ helm install --set name=prod ./redis +or + + $ helm install --set-string long_int=1234567890 ./redis + You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml contained a key called 'Test', the value set in override.yaml would take precedence: @@ -113,6 +118,7 @@ type installCmd struct { out io.Writer client helm.Interface values []string + stringValues []string nameTemplate string version string timeout int64 @@ -186,6 +192,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&inst.disableHooks, "no-hooks", false, "prevent hooks from running during install") f.BoolVar(&inst.replace, "replace", false, "re-use the given name, even if that name is already used. This is unsafe in production") f.StringArrayVar(&inst.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&inst.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringVar(&inst.nameTemplate, "name-template", "", "specify template used to name the release") f.BoolVar(&inst.verify, "verify", false, "verify the package before installing it") f.StringVar(&inst.keyring, "keyring", defaultKeyring(), "location of public keys used for verification") @@ -211,7 +218,7 @@ func (i *installCmd) run() error { i.namespace = defaultNamespace() } - rawVals, err := vals(i.valueFiles, i.values) + rawVals, err := vals(i.valueFiles, i.values, i.stringValues) if err != nil { return err } @@ -325,8 +332,8 @@ func mergeValues(dest map[string]interface{}, src map[string]interface{}) map[st } // vals merges values from files specified via -f/--values and -// directly via --set, marshaling them to YAML -func vals(valueFiles valueFiles, values []string) ([]byte, error) { +// directly via --set or --set-string, marshaling them to YAML +func vals(valueFiles valueFiles, values []string, stringValues []string) ([]byte, error) { base := map[string]interface{}{} // User specified a values files via -f/--values @@ -359,6 +366,13 @@ func vals(valueFiles valueFiles, values []string) ([]byte, error) { } } + // User specified a value via --set-string + for _, value := range stringValues { + if err := strvals.ParseIntoString(value, base); err != nil { + return []byte{}, fmt.Errorf("failed parsing --set-string data: %s", err) + } + } + return yaml.Marshal(base) } diff --git a/cmd/helm/lint.go b/cmd/helm/lint.go index 29eea1a88..6e08f2747 100644 --- a/cmd/helm/lint.go +++ b/cmd/helm/lint.go @@ -46,6 +46,7 @@ or recommendation, it will emit [WARNING] messages. type lintCmd struct { valueFiles valueFiles values []string + sValues []string namespace string strict bool paths []string @@ -71,6 +72,7 @@ func newLintCmd(out io.Writer) *cobra.Command { cmd.Flags().VarP(&l.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)") cmd.Flags().StringArrayVar(&l.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + cmd.Flags().StringArrayVar(&l.sValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") cmd.Flags().StringVar(&l.namespace, "namespace", "default", "namespace to install the release into (only used if --install is set)") cmd.Flags().BoolVar(&l.strict, "strict", false, "fail on lint warnings") @@ -192,5 +194,12 @@ func (l *lintCmd) vals() ([]byte, error) { } } + // User specified a value via --set-string + for _, value := range l.sValues { + if err := strvals.ParseIntoString(value, base); err != nil { + return []byte{}, fmt.Errorf("failed parsing --set-string data: %s", err) + } + } + return yaml.Marshal(base) } diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 3a7285fa1..c04bc2dc8 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -68,6 +68,7 @@ type templateCmd struct { chartPath string out io.Writer values []string + stringValues []string nameTemplate string showNotes bool releaseName string @@ -96,6 +97,7 @@ func newTemplateCmd(out io.Writer) *cobra.Command { f.VarP(&t.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)") f.StringVar(&t.namespace, "namespace", "", "namespace to install the release into") f.StringArrayVar(&t.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&t.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringVar(&t.nameTemplate, "name-template", "", "specify template used to name the release") f.StringVar(&t.kubeVersion, "kube-version", defaultKubeVersion, "kubernetes version used as Capabilities.KubeVersion.Major/Minor") f.StringVar(&t.outputDir, "output-dir", "", "writes the executed templates to files in output-dir instead of stdout") @@ -149,7 +151,7 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { t.namespace = defaultNamespace() } // get combined values and create config - rawVals, err := vals(t.valueFiles, t.values) + rawVals, err := vals(t.valueFiles, t.values, t.stringValues) if err != nil { return err } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index aadb59ac2..125796762 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -37,7 +37,8 @@ a packaged chart, or a fully qualified URL. For chart references, the latest version will be specified unless the '--version' flag is set. To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line. +or use the '--set' flag and pass configuration from the command line, to force string +values, use '--set-string'. You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml @@ -63,6 +64,7 @@ type upgradeCmd struct { disableHooks bool valueFiles valueFiles values []string + stringValues []string verify bool keyring string install bool @@ -118,6 +120,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&upgrade.recreate, "recreate-pods", false, "performs pods restart for the resource if applicable") f.BoolVar(&upgrade.force, "force", false, "force resource update through delete/recreate if needed") f.StringArrayVar(&upgrade.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&upgrade.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.BoolVar(&upgrade.disableHooks, "disable-hooks", false, "disable pre/post upgrade hooks. DEPRECATED. Use no-hooks") f.BoolVar(&upgrade.disableHooks, "no-hooks", false, "disable pre/post upgrade hooks") f.BoolVar(&upgrade.verify, "verify", false, "verify the provenance of the chart before upgrading") @@ -183,6 +186,7 @@ func (u *upgradeCmd) run() error { disableHooks: u.disableHooks, keyring: u.keyring, values: u.values, + stringValues: u.stringValues, namespace: u.namespace, timeout: u.timeout, wait: u.wait, @@ -191,7 +195,7 @@ func (u *upgradeCmd) run() error { } } - rawVals, err := vals(u.valueFiles, u.values) + rawVals, err := vals(u.valueFiles, u.values, u.stringValues) if err != nil { return err } diff --git a/docs/chart_best_practices/values.md b/docs/chart_best_practices/values.md index c338f7f4c..2962e7d45 100644 --- a/docs/chart_best_practices/values.md +++ b/docs/chart_best_practices/values.md @@ -92,7 +92,7 @@ There are three potential sources of values: - A chart's `values.yaml` file - A values file supplied by `helm install -f` or `helm upgrade -f` -- The values passed to a `--set` flag on `helm install` or `helm upgrade` +- The values passed to a `--set` or `--set-string` flag on `helm install` or `helm upgrade` When designing the structure of your values, keep in mind that users of your chart may want to override them via either the `-f` flag or with the `--set` diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 0ae9097ba..25ccea1bd 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -12,7 +12,8 @@ The install argument must be a chart reference, a path to a packaged chart, a path to an unpacked chart directory or a URL. To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line. +or use the '--set' flag and pass configuration from the command line, to force +a string value use '--set-string'. $ helm install -f myvalues.yaml ./redis @@ -20,6 +21,10 @@ or $ helm install --set name=prod ./redis +or + + $ helm install --set-string long_int=1234567890 ./redis + You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml contained a key called 'Test', the value set in override.yaml would take precedence: @@ -69,32 +74,33 @@ helm install [CHART] ### Options ``` - --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle - --cert-file string identify HTTPS client using this SSL certificate file - --dep-up run helm dependency update before installing the chart - --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. - --dry-run simulate an install - --key-file string identify HTTPS client using this SSL key file - --keyring string location of public keys used for verification (default "~/.gnupg/pubring.gpg") - -n, --name string release name. If unspecified, it will autogenerate one for you - --name-template string specify template used to name the release - --namespace string namespace to install the release into. Defaults to the current kube config namespace. - --no-hooks prevent hooks from running during install - --password string chart repository password where to locate the requested chart - --replace re-use the given name, even if that name is already used. This is unsafe in production - --repo string chart repository url where to locate the requested chart - --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) - --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote - --username string chart repository username where to locate the requested chart - -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) - --verify verify the package before installing it - --version string specify the exact chart version to install. If this is not specified, the latest version is installed - --wait if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout + --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle + --cert-file string identify HTTPS client using this SSL certificate file + --dep-up run helm dependency update before installing the chart + --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. + --dry-run simulate an install + --key-file string identify HTTPS client using this SSL key file + --keyring string location of public keys used for verification (default "~/.gnupg/pubring.gpg") + -n, --name string release name. If unspecified, it will autogenerate one for you + --name-template string specify template used to name the release + --namespace string namespace to install the release into. Defaults to the current kube config namespace. + --no-hooks prevent hooks from running during install + --password string chart repository password where to locate the requested chart + --replace re-use the given name, even if that name is already used. This is unsafe in production + --repo string chart repository url where to locate the requested chart + --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote + --username string chart repository username where to locate the requested chart + -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) + --verify verify the package before installing it + --version string specify the exact chart version to install. If this is not specified, the latest version is installed + --wait if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout ``` ### Options inherited from parent commands @@ -111,4 +117,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 20-Mar-2018 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index da3cdf945..596edf2bb 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -21,10 +21,11 @@ helm lint [flags] PATH ### Options ``` - --namespace string namespace to install the release into (only used if --install is set) (default "default") - --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) - --strict fail on lint warnings - -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) + --namespace string namespace to install the release into (only used if --install is set) (default "default") + --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --strict fail on lint warnings + -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) ``` ### Options inherited from parent commands @@ -41,4 +42,4 @@ helm lint [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 9-Mar-2018 diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index 126adb02f..3a4e9ce4a 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -25,15 +25,16 @@ helm template [flags] CHART ### Options ``` - -x, --execute stringArray only execute the given templates - --kube-version string kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9") - -n, --name string release name (default "RELEASE-NAME") - --name-template string specify template used to name the release - --namespace string namespace to install the release into - --notes show the computed NOTES.txt file as well - --output-dir string writes the executed templates to files in output-dir instead of stdout - --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) - -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) + -x, --execute stringArray only execute the given templates + --kube-version string kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9") + -n, --name string release name (default "RELEASE-NAME") + --name-template string specify template used to name the release + --namespace string namespace to install the release into + --notes show the computed NOTES.txt file as well + --output-dir string writes the executed templates to files in output-dir instead of stdout + --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) ``` ### Options inherited from parent commands @@ -50,4 +51,4 @@ helm template [flags] CHART ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 9-Mar-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 5cbb9a110..7ada6025f 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -14,7 +14,8 @@ a packaged chart, or a fully qualified URL. For chart references, the latest version will be specified unless the '--version' flag is set. To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line. +or use the '--set' flag and pass configuration from the command line, to force string +values, use '--set-string'. You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml @@ -36,33 +37,34 @@ helm upgrade [RELEASE] [CHART] ### Options ``` - --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle - --cert-file string identify HTTPS client using this SSL certificate file - --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. - --dry-run simulate an upgrade - --force force resource update through delete/recreate if needed - -i, --install if a release by this name doesn't already exist, run an install - --key-file string identify HTTPS client using this SSL key file - --keyring string path to the keyring that contains public signing keys (default "~/.gnupg/pubring.gpg") - --namespace string namespace to install the release into (only used if --install is set). Defaults to the current kube config namespace - --no-hooks disable pre/post upgrade hooks - --password string chart repository password where to locate the requested chart - --recreate-pods performs pods restart for the resource if applicable - --repo string chart repository url where to locate the requested chart - --reset-values when upgrading, reset the values to the ones built into the chart - --reuse-values when upgrading, reuse the last release's values, and merge in any new values. If '--reset-values' is specified, this is ignored. - --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) - --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote - --username string chart repository username where to locate the requested chart - -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) - --verify verify the provenance of the chart before upgrading - --version string specify the exact chart version to use. If this is not specified, the latest version is used - --wait if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout + --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle + --cert-file string identify HTTPS client using this SSL certificate file + --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. + --dry-run simulate an upgrade + --force force resource update through delete/recreate if needed + -i, --install if a release by this name doesn't already exist, run an install + --key-file string identify HTTPS client using this SSL key file + --keyring string path to the keyring that contains public signing keys (default "~/.gnupg/pubring.gpg") + --namespace string namespace to install the release into (only used if --install is set). Defaults to the current kube config namespace + --no-hooks disable pre/post upgrade hooks + --password string chart repository password where to locate the requested chart + --recreate-pods performs pods restart for the resource if applicable + --repo string chart repository url where to locate the requested chart + --reset-values when upgrading, reset the values to the ones built into the chart + --reuse-values when upgrading, reuse the last release's values, and merge in any new values. If '--reset-values' is specified, this is ignored. + --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote + --username string chart repository username where to locate the requested chart + -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) + --verify verify the provenance of the chart before upgrading + --version string specify the exact chart version to use. If this is not specified, the latest version is used + --wait if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout ``` ### Options inherited from parent commands @@ -79,4 +81,4 @@ helm upgrade [RELEASE] [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 20-Mar-2018 diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 8e97b4d44..8a999feb7 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -45,18 +45,38 @@ func ToYAML(s string) (string, error) { func Parse(s string) (map[string]interface{}, error) { vals := map[string]interface{}{} scanner := bytes.NewBufferString(s) - t := newParser(scanner, vals) + t := newParser(scanner, vals, false) err := t.parse() return vals, err } -//ParseInto parses a strvals line and merges the result into dest. +// Parse parses a set line and forces a string value. +// +// A set line is of the form name1=value1,name2=value2 +func ParseString(s string) (map[string]interface{}, error) { + vals := map[string]interface{}{} + scanner := bytes.NewBufferString(s) + t := newParser(scanner, vals, true) + err := t.parse() + return vals, err +} + +// ParseInto parses a strvals line and merges the result into dest. // // If the strval string has a key that exists in dest, it overwrites the // dest version. func ParseInto(s string, dest map[string]interface{}) error { scanner := bytes.NewBufferString(s) - t := newParser(scanner, dest) + t := newParser(scanner, dest, false) + return t.parse() +} + +// ParseIntoString parses a strvals line nad merges the result into dest. +// +// This method always returns a string as the value. +func ParseIntoString(s string, dest map[string]interface{}) error { + scanner := bytes.NewBufferString(s) + t := newParser(scanner, dest, true) return t.parse() } @@ -65,10 +85,11 @@ func ParseInto(s string, dest map[string]interface{}) error { type parser struct { sc *bytes.Buffer data map[string]interface{} + st bool } -func newParser(sc *bytes.Buffer, data map[string]interface{}) *parser { - return &parser{sc: sc, data: data} +func newParser(sc *bytes.Buffer, data map[string]interface{}, stringBool bool) *parser { + return &parser{sc: sc, data: data, st: stringBool} } func (t *parser) parse() error { @@ -133,7 +154,7 @@ func (t *parser) key(data map[string]interface{}) error { return e case ErrNotList: v, e := t.val() - set(data, string(k), typedVal(v)) + set(data, string(k), typedVal(v, t.st)) return e default: return e @@ -206,7 +227,7 @@ func (t *parser) listItem(list []interface{}, i int) ([]interface{}, error) { return setIndex(list, i, ""), err case ErrNotList: v, e := t.val() - return setIndex(list, i, typedVal(v)), e + return setIndex(list, i, typedVal(v, t.st)), e default: return list, e } @@ -265,10 +286,10 @@ func (t *parser) valList() ([]interface{}, error) { if r, _, e := t.sc.ReadRune(); e == nil && r != ',' { t.sc.UnreadRune() } - list = append(list, typedVal(v)) + list = append(list, typedVal(v, t.st)) return list, nil case last == ',': - list = append(list, typedVal(v)) + list = append(list, typedVal(v, t.st)) } } } @@ -298,7 +319,7 @@ func inMap(k rune, m map[rune]bool) bool { return ok } -func typedVal(v []rune) interface{} { +func typedVal(v []rune, st bool) interface{} { val := string(v) if strings.EqualFold(val, "true") { return true @@ -308,8 +329,8 @@ func typedVal(v []rune) interface{} { return false } - // If this value does not start with zero, try parsing it to an int - if len(val) != 0 && val[0] != '0' { + // If this value does not start with zero, and not returnString, try parsing it to an int + if !st && len(val) != 0 && val[0] != '0' { if iv, err := strconv.ParseInt(val, 10, 64); err == nil { return iv } diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index a3f6e4207..3f9828498 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -65,6 +65,17 @@ func TestSetIndex(t *testing.T) { } func TestParseSet(t *testing.T) { + testsString := []struct { + str string + expect map[string]interface{} + err bool + }{ + { + str: "long_int_string=1234567890", + expect: map[string]interface{}{"long_int_string": "1234567890"}, + err: false, + }, + } tests := []struct { str string expect map[string]interface{} @@ -97,6 +108,10 @@ func TestParseSet(t *testing.T) { str: "leading_zeros=00009", expect: map[string]interface{}{"leading_zeros": "00009"}, }, + { + str: "long_int=1234567890", + expect: map[string]interface{}{"long_int": 1234567890}, + }, { str: "name1,name2=", err: true, @@ -278,6 +293,31 @@ func TestParseSet(t *testing.T) { t.Fatalf("Error serializing parsed value: %s", err) } + if string(y1) != string(y2) { + t.Errorf("%s: Expected:\n%s\nGot:\n%s", tt.str, y1, y2) + } + } + for _, tt := range testsString { + got, err := ParseString(tt.str) + if err != nil { + if tt.err { + continue + } + t.Fatalf("%s: %s", tt.str, err) + } + if tt.err { + t.Errorf("%s: Expected error. Got nil", tt.str) + } + + y1, err := yaml.Marshal(tt.expect) + if err != nil { + t.Fatal(err) + } + y2, err := yaml.Marshal(got) + if err != nil { + t.Fatalf("Error serializing parsed value: %s", err) + } + if string(y1) != string(y2) { t.Errorf("%s: Expected:\n%s\nGot:\n%s", tt.str, y1, y2) } diff --git a/scripts/completions.bash b/scripts/completions.bash index b2524ea38..c24f3d257 100644 --- a/scripts/completions.bash +++ b/scripts/completions.bash @@ -830,6 +830,8 @@ _helm_install() local_nonpersistent_flags+=("--repo=") flags+=("--set=") local_nonpersistent_flags+=("--set=") + flags+=("--set-string=") + local_nonpersistent_flags+=("--set-string=") flags+=("--timeout=") local_nonpersistent_flags+=("--timeout=") flags+=("--tls") From e23d2f68283add8c55137ce7e6dd3bb4c8827d7f Mon Sep 17 00:00:00 2001 From: Alexey igrychev Date: Wed, 21 Mar 2018 17:19:53 +0300 Subject: [PATCH 113/449] Implement before-hook-creation delete policy Existing helm.sh/hook-delete-policy annotation variables (hook-failed, hook-succeeded) do not allow to leave failed jobs for debugging without blocking the next job launching: every failed job must be deleted manually before the next related release is launching (installing, updating or rolling back). New policy, before-hook-creation, removes the hook from previous release if there is one before the new hook is launched and can be used with another variable. --- _proto/hapi/release/hook.proto | 1 + docs/charts_hooks.md | 17 +++++++- pkg/hooks/hooks.go | 5 ++- pkg/proto/hapi/release/hook.pb.go | 68 ++++++++++++++++--------------- pkg/tiller/hooks.go | 35 ++++++++-------- pkg/tiller/release_server.go | 39 ++++++++++-------- 6 files changed, 97 insertions(+), 68 deletions(-) diff --git a/_proto/hapi/release/hook.proto b/_proto/hapi/release/hook.proto index 22c1fedef..f0332ecb8 100644 --- a/_proto/hapi/release/hook.proto +++ b/_proto/hapi/release/hook.proto @@ -38,6 +38,7 @@ message Hook { enum DeletePolicy { SUCCEEDED = 0; FAILED = 1; + BEFORE_HOOK_CREATION = 2; } string name = 1; // Kind is the Kubernetes kind. diff --git a/docs/charts_hooks.md b/docs/charts_hooks.md index 5fc9462e4..af6d0f4f9 100644 --- a/docs/charts_hooks.md +++ b/docs/charts_hooks.md @@ -180,4 +180,19 @@ It is also possible to define policies that determine when to delete correspondi "helm.sh/hook-delete-policy": hook-succeeded ``` -When using `"helm.sh/hook-delete-policy"` annotation, you can choose its value from `"hook-succeeded"` and `"hook-failed"`. The value `"hook-succeeded"` specifies Tiller should delete the hook after the hook is successfully executed, while the value `"hook-failed"`specifies Tiller should delete the hook if the hook failed during execution. +You can choose one or more defined annotation values: +* `"hook-succeeded"` specifies Tiller should delete the hook after the hook is successfully executed. +* `"hook-failed"` specifies Tiller should delete the hook if the hook failed during execution. +* `"before-hook-creation"` specifies Tiller should delete the previous hook before the new hook is launched. + +### Automatically delete hook from previous release + +When helm release being updated it is possible, that hook resource already exists in cluster. By default helm will try to create resource and fail with `"... already exists"` error. + +One might choose `"helm.sh/hook-delete-policy": "before-hook-creation"` over `"helm.sh/hook-delete-policy": "hook-succeeded,hook-failed"` because: + +* It is convinient to keep failed hook job resource in kubernetes for example for manual debug. +* It may be necessary to keep succeeded hook resource in kubernetes for some reason. +* At the same time it is not desireable to do manual resource deletion before helm release upgrade. + +`"helm.sh/hook-delete-policy": "before-hook-creation"` annotation on hook causes tiller to remove the hook from previous release if there is one before the new hook is launched and can be used with another policies. diff --git a/pkg/hooks/hooks.go b/pkg/hooks/hooks.go index ed2d946a4..80f838368 100644 --- a/pkg/hooks/hooks.go +++ b/pkg/hooks/hooks.go @@ -45,8 +45,9 @@ const ( // Type of policy for deleting the hook const ( - HookSucceeded = "hook-succeeded" - HookFailed = "hook-failed" + HookSucceeded = "hook-succeeded" + HookFailed = "hook-failed" + BeforeHookCreation = "before-hook-creation" ) // FilterTestHooks filters the list of hooks are returns only testing hooks. diff --git a/pkg/proto/hapi/release/hook.pb.go b/pkg/proto/hapi/release/hook.pb.go index 508448280..00fa5c188 100644 --- a/pkg/proto/hapi/release/hook.pb.go +++ b/pkg/proto/hapi/release/hook.pb.go @@ -89,17 +89,20 @@ func (Hook_Event) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []i type Hook_DeletePolicy int32 const ( - Hook_SUCCEEDED Hook_DeletePolicy = 0 - Hook_FAILED Hook_DeletePolicy = 1 + Hook_SUCCEEDED Hook_DeletePolicy = 0 + Hook_FAILED Hook_DeletePolicy = 1 + Hook_BEFORE_HOOK_CREATION Hook_DeletePolicy = 2 ) var Hook_DeletePolicy_name = map[int32]string{ 0: "SUCCEEDED", 1: "FAILED", + 2: "BEFORE_HOOK_CREATION", } var Hook_DeletePolicy_value = map[string]int32{ - "SUCCEEDED": 0, - "FAILED": 1, + "SUCCEEDED": 0, + "FAILED": 1, + "BEFORE_HOOK_CREATION": 2, } func (x Hook_DeletePolicy) String() string { @@ -196,32 +199,33 @@ func init() { func init() { proto.RegisterFile("hapi/release/hook.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 428 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xd1, 0x6e, 0xda, 0x30, - 0x14, 0x86, 0x9b, 0x12, 0x12, 0x38, 0x50, 0xea, 0x59, 0xd3, 0x66, 0x71, 0x53, 0xc4, 0x15, 0xbb, - 0x09, 0x53, 0xa7, 0x3d, 0x40, 0x4a, 0xce, 0xd6, 0xaa, 0x11, 0x20, 0x27, 0x68, 0xd2, 0x6e, 0xa2, - 0x74, 0xb8, 0x10, 0x11, 0xe2, 0x88, 0x98, 0x4d, 0x7b, 0xa6, 0xbd, 0xce, 0x1e, 0x68, 0xb2, 0x09, - 0x59, 0xa5, 0xed, 0xee, 0x9c, 0xef, 0x7c, 0x76, 0xce, 0x1f, 0xc3, 0xdb, 0x6d, 0x5a, 0x66, 0xd3, - 0x83, 0xc8, 0x45, 0x5a, 0x89, 0xe9, 0x56, 0xca, 0x9d, 0x57, 0x1e, 0xa4, 0x92, 0xb4, 0xaf, 0x07, - 0x5e, 0x3d, 0x18, 0xde, 0x6c, 0xa4, 0xdc, 0xe4, 0x62, 0x6a, 0x66, 0x4f, 0xc7, 0xe7, 0xa9, 0xca, - 0xf6, 0xa2, 0x52, 0xe9, 0xbe, 0x3c, 0xe9, 0xe3, 0x5f, 0x36, 0xd8, 0xf7, 0x52, 0xee, 0x28, 0x05, - 0xbb, 0x48, 0xf7, 0x82, 0x59, 0x23, 0x6b, 0xd2, 0xe5, 0xa6, 0xd6, 0x6c, 0x97, 0x15, 0x6b, 0x76, - 0x79, 0x62, 0xba, 0xd6, 0xac, 0x4c, 0xd5, 0x96, 0xb5, 0x4e, 0x4c, 0xd7, 0x74, 0x08, 0x9d, 0x7d, - 0x5a, 0x64, 0xcf, 0xa2, 0x52, 0xcc, 0x36, 0xbc, 0xe9, 0xe9, 0x7b, 0x70, 0xc4, 0x77, 0x51, 0xa8, - 0x8a, 0xb5, 0x47, 0xad, 0xc9, 0xe0, 0x96, 0x79, 0x2f, 0x17, 0xf4, 0xf4, 0xb7, 0x3d, 0xd4, 0x02, - 0xaf, 0x3d, 0xfa, 0x11, 0x3a, 0x79, 0x5a, 0xa9, 0xe4, 0x70, 0x2c, 0x98, 0x33, 0xb2, 0x26, 0xbd, - 0xdb, 0xa1, 0x77, 0x8a, 0xe1, 0x9d, 0x63, 0x78, 0xf1, 0x39, 0x06, 0x77, 0xb5, 0xcb, 0x8f, 0x05, - 0x7d, 0x03, 0xce, 0x0f, 0x91, 0x6d, 0xb6, 0x8a, 0xb9, 0x23, 0x6b, 0xd2, 0xe6, 0x75, 0x47, 0xef, - 0xe1, 0x7a, 0x2d, 0x72, 0xa1, 0x44, 0x52, 0xca, 0x3c, 0xfb, 0x96, 0x89, 0x8a, 0x75, 0xcc, 0x26, - 0x37, 0xff, 0xd9, 0x24, 0x30, 0xe6, 0x52, 0x8b, 0x3f, 0xf9, 0x60, 0xfd, 0xb7, 0xcb, 0x44, 0x35, - 0xfe, 0x6d, 0x41, 0xdb, 0xac, 0x4a, 0x7b, 0xe0, 0xae, 0xe6, 0x8f, 0xf3, 0xc5, 0x97, 0x39, 0xb9, - 0xa0, 0xd7, 0xd0, 0x5b, 0x72, 0x4c, 0x1e, 0xe6, 0x51, 0xec, 0x87, 0x21, 0xb1, 0x28, 0x81, 0xfe, - 0x72, 0x11, 0xc5, 0x0d, 0xb9, 0xa4, 0x03, 0x00, 0xad, 0x04, 0x18, 0x62, 0x8c, 0xa4, 0x65, 0x8e, - 0x68, 0xa3, 0x06, 0xf6, 0xf9, 0x8e, 0xd5, 0xf2, 0x33, 0xf7, 0x03, 0x24, 0xed, 0xe6, 0x8e, 0x33, - 0x71, 0x0c, 0xe1, 0x98, 0xf0, 0x45, 0x18, 0xde, 0xf9, 0xb3, 0x47, 0xe2, 0xd2, 0x57, 0x70, 0x65, - 0x9c, 0x06, 0x75, 0x28, 0x83, 0xd7, 0x1c, 0x43, 0xf4, 0x23, 0x4c, 0x62, 0x8c, 0xe2, 0x24, 0x5a, - 0xcd, 0x66, 0x18, 0x45, 0xa4, 0xfb, 0xcf, 0xe4, 0x93, 0xff, 0x10, 0xae, 0x38, 0x12, 0x18, 0xbf, - 0x83, 0xfe, 0xcb, 0xd8, 0xf4, 0x0a, 0xba, 0xe6, 0x18, 0x06, 0x18, 0x90, 0x0b, 0x0a, 0xe0, 0x68, - 0x17, 0x03, 0x62, 0xdd, 0x75, 0xbf, 0xba, 0xf5, 0xef, 0x7a, 0x72, 0xcc, 0x5b, 0x7c, 0xf8, 0x13, - 0x00, 0x00, 0xff, 0xff, 0xb9, 0x8a, 0xe1, 0xaf, 0x89, 0x02, 0x00, 0x00, + // 445 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x51, 0x8f, 0x9a, 0x40, + 0x10, 0x80, 0x8f, 0x13, 0x41, 0x47, 0xcf, 0xdb, 0x6e, 0x9a, 0x76, 0xe3, 0xcb, 0x19, 0x9f, 0x7c, + 0xc2, 0xe6, 0x9a, 0xfe, 0x00, 0x84, 0xb9, 0x6a, 0x24, 0x60, 0x16, 0x4c, 0x93, 0xbe, 0x10, 0xae, + 0xee, 0x29, 0x11, 0x81, 0x08, 0xb6, 0xe9, 0x0f, 0xec, 0x3f, 0xe8, 0x0f, 0x6a, 0x76, 0x45, 0x7b, + 0x49, 0xfb, 0x36, 0xf3, 0xcd, 0x37, 0xc3, 0x0c, 0x0b, 0xef, 0x77, 0x49, 0x99, 0x4e, 0x8f, 0x22, + 0x13, 0x49, 0x25, 0xa6, 0xbb, 0xa2, 0xd8, 0x5b, 0xe5, 0xb1, 0xa8, 0x0b, 0xda, 0x97, 0x05, 0xab, + 0x29, 0x0c, 0x1f, 0xb6, 0x45, 0xb1, 0xcd, 0xc4, 0x54, 0xd5, 0x9e, 0x4f, 0x2f, 0xd3, 0x3a, 0x3d, + 0x88, 0xaa, 0x4e, 0x0e, 0xe5, 0x59, 0x1f, 0xff, 0xd2, 0x41, 0x9f, 0x17, 0xc5, 0x9e, 0x52, 0xd0, + 0xf3, 0xe4, 0x20, 0x98, 0x36, 0xd2, 0x26, 0x5d, 0xae, 0x62, 0xc9, 0xf6, 0x69, 0xbe, 0x61, 0xb7, + 0x67, 0x26, 0x63, 0xc9, 0xca, 0xa4, 0xde, 0xb1, 0xd6, 0x99, 0xc9, 0x98, 0x0e, 0xa1, 0x73, 0x48, + 0xf2, 0xf4, 0x45, 0x54, 0x35, 0xd3, 0x15, 0xbf, 0xe6, 0xf4, 0x03, 0x18, 0xe2, 0xbb, 0xc8, 0xeb, + 0x8a, 0xb5, 0x47, 0xad, 0xc9, 0xe0, 0x91, 0x59, 0xaf, 0x17, 0xb4, 0xe4, 0xb7, 0x2d, 0x94, 0x02, + 0x6f, 0x3c, 0xfa, 0x09, 0x3a, 0x59, 0x52, 0xd5, 0xf1, 0xf1, 0x94, 0x33, 0x63, 0xa4, 0x4d, 0x7a, + 0x8f, 0x43, 0xeb, 0x7c, 0x86, 0x75, 0x39, 0xc3, 0x8a, 0x2e, 0x67, 0x70, 0x53, 0xba, 0xfc, 0x94, + 0xd3, 0x77, 0x60, 0xfc, 0x10, 0xe9, 0x76, 0x57, 0x33, 0x73, 0xa4, 0x4d, 0xda, 0xbc, 0xc9, 0xe8, + 0x1c, 0xee, 0x37, 0x22, 0x13, 0xb5, 0x88, 0xcb, 0x22, 0x4b, 0xbf, 0xa5, 0xa2, 0x62, 0x1d, 0xb5, + 0xc9, 0xc3, 0x7f, 0x36, 0x71, 0x95, 0xb9, 0x92, 0xe2, 0x4f, 0x3e, 0xd8, 0xfc, 0xcd, 0x52, 0x51, + 0x8d, 0x7f, 0x6b, 0xd0, 0x56, 0xab, 0xd2, 0x1e, 0x98, 0x6b, 0x7f, 0xe9, 0x07, 0x5f, 0x7c, 0x72, + 0x43, 0xef, 0xa1, 0xb7, 0xe2, 0x18, 0x2f, 0xfc, 0x30, 0xb2, 0x3d, 0x8f, 0x68, 0x94, 0x40, 0x7f, + 0x15, 0x84, 0xd1, 0x95, 0xdc, 0xd2, 0x01, 0x80, 0x54, 0x5c, 0xf4, 0x30, 0x42, 0xd2, 0x52, 0x2d, + 0xd2, 0x68, 0x80, 0x7e, 0x99, 0xb1, 0x5e, 0x7d, 0xe6, 0xb6, 0x8b, 0xa4, 0x7d, 0x9d, 0x71, 0x21, + 0x86, 0x22, 0x1c, 0x63, 0x1e, 0x78, 0xde, 0xcc, 0x76, 0x96, 0xc4, 0xa4, 0x6f, 0xe0, 0x4e, 0x39, + 0x57, 0xd4, 0xa1, 0x0c, 0xde, 0x72, 0xf4, 0xd0, 0x0e, 0x31, 0x8e, 0x30, 0x8c, 0xe2, 0x70, 0xed, + 0x38, 0x18, 0x86, 0xa4, 0xfb, 0x4f, 0xe5, 0xc9, 0x5e, 0x78, 0x6b, 0x8e, 0x04, 0xc6, 0x0e, 0xf4, + 0x5f, 0x9f, 0x4d, 0xef, 0xa0, 0xab, 0xda, 0xd0, 0x45, 0x97, 0xdc, 0x50, 0x00, 0x43, 0xba, 0xe8, + 0x12, 0x4d, 0x0e, 0x99, 0xe1, 0x53, 0xc0, 0x31, 0x9e, 0x07, 0xc1, 0x32, 0x76, 0x38, 0xda, 0xd1, + 0x22, 0xf0, 0xc9, 0xed, 0xac, 0xfb, 0xd5, 0x6c, 0x7e, 0xe4, 0xb3, 0xa1, 0x5e, 0xe9, 0xe3, 0x9f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x13, 0x64, 0x75, 0x6c, 0xa3, 0x02, 0x00, 0x00, } diff --git a/pkg/tiller/hooks.go b/pkg/tiller/hooks.go index 6ac2cc636..e1e965d08 100644 --- a/pkg/tiller/hooks.go +++ b/pkg/tiller/hooks.go @@ -46,8 +46,9 @@ var events = map[string]release.Hook_Event{ // deletePolices represents a mapping between the key in the annotation for label deleting policy and its real meaning var deletePolices = map[string]release.Hook_DeletePolicy{ - hooks.HookSucceeded: release.Hook_SUCCEEDED, - hooks.HookFailed: release.Hook_FAILED, + hooks.HookSucceeded: release.Hook_SUCCEEDED, + hooks.HookFailed: release.Hook_FAILED, + hooks.BeforeHookCreation: release.Hook_BEFORE_HOOK_CREATION, } // Manifest represents a manifest file, which has a name and some content. @@ -189,21 +190,14 @@ func (file *manifestFile) sort(result *result) error { result.hooks = append(result.hooks, h) - isKnownDeletePolices := false - dps, ok := entry.Metadata.Annotations[hooks.HookDeleteAnno] - if ok { - for _, dp := range strings.Split(dps, ",") { - dp = strings.ToLower(strings.TrimSpace(dp)) - p, exist := deletePolices[dp] - if exist { - isKnownDeletePolices = true - h.DeletePolicies = append(h.DeletePolicies, p) - } + operateAnnotationValues(entry, hooks.HookDeleteAnno, func(value string) { + policy, exist := deletePolices[value] + if exist { + h.DeletePolicies = append(h.DeletePolicies, policy) + } else { + log.Printf("info: skipping unknown hook delete policy: %q", value) } - if !isKnownDeletePolices { - log.Printf("info: skipping unknown hook delete policy: %q", dps) - } - } + }) } return nil @@ -228,3 +222,12 @@ func calculateHookWeight(entry util.SimpleHead) int32 { return int32(hw) } + +func operateAnnotationValues(entry util.SimpleHead, annotation string, operate func(p string)) { + if dps, ok := entry.Metadata.Annotations[annotation]; ok { + for _, dp := range strings.Split(dps, ",") { + dp = strings.ToLower(strings.TrimSpace(dp)) + operate(dp) + } + } +} diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index a96c64938..eaa6515bb 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -347,6 +347,9 @@ func (s *ReleaseServer) execHook(hs []*release.Hook, name, namespace, hook strin executingHooks = sortByHookWeight(executingHooks) for _, h := range executingHooks { + if err := s.deleteHookIfShouldBeDeletedByDeletePolicy(h, hooks.BeforeHookCreation, name, namespace, hook, kubeCli); err != nil { + return err + } b := bytes.NewBufferString(h.Manifest) if err := kubeCli.Create(namespace, b, timeout, false); err != nil { @@ -356,18 +359,13 @@ func (s *ReleaseServer) execHook(hs []*release.Hook, name, namespace, hook strin // No way to rewind a bytes.Buffer()? b.Reset() b.WriteString(h.Manifest) + if err := kubeCli.WatchUntilReady(namespace, b, timeout, false); err != nil { s.Log("warning: Release %s %s %s could not complete: %s", name, hook, h.Path, err) // If a hook is failed, checkout the annotation of the hook to determine whether the hook should be deleted // under failed condition. If so, then clear the corresponding resource object in the hook - if hookShouldBeDeleted(h, hooks.HookFailed) { - b.Reset() - b.WriteString(h.Manifest) - s.Log("deleting %s hook %s for release %s due to %q policy", hook, h.Name, name, hooks.HookFailed) - if errHookDelete := kubeCli.Delete(namespace, b); errHookDelete != nil { - s.Log("warning: Release %s %s %S could not be deleted: %s", name, hook, h.Path, errHookDelete) - return errHookDelete - } + if err := s.deleteHookIfShouldBeDeletedByDeletePolicy(h, hooks.HookFailed, name, namespace, hook, kubeCli); err != nil { + return err } return err } @@ -377,13 +375,8 @@ func (s *ReleaseServer) execHook(hs []*release.Hook, name, namespace, hook strin // If all hooks are succeeded, checkout the annotation of each hook to determine whether the hook should be deleted // under succeeded condition. If so, then clear the corresponding resource object in each hook for _, h := range executingHooks { - b := bytes.NewBufferString(h.Manifest) - if hookShouldBeDeleted(h, hooks.HookSucceeded) { - s.Log("deleting %s hook %s for release %s due to %q policy", hook, h.Name, name, hooks.HookSucceeded) - if errHookDelete := kubeCli.Delete(namespace, b); errHookDelete != nil { - s.Log("warning: Release %s %s %S could not be deleted: %s", name, hook, h.Path, errHookDelete) - return errHookDelete - } + if err := s.deleteHookIfShouldBeDeletedByDeletePolicy(h, hooks.HookSucceeded, name, namespace, hook, kubeCli); err != nil { + return err } h.LastRun = timeconv.Now() } @@ -409,11 +402,23 @@ func validateReleaseName(releaseName string) error { return nil } +func (s *ReleaseServer) deleteHookIfShouldBeDeletedByDeletePolicy(h *release.Hook, policy string, name, namespace, hook string, kubeCli environment.KubeClient) error { + b := bytes.NewBufferString(h.Manifest) + if hookHasDeletePolicy(h, policy) { + s.Log("deleting %s hook %s for release %s due to %q policy", hook, h.Name, name, policy) + if errHookDelete := kubeCli.Delete(namespace, b); errHookDelete != nil { + s.Log("warning: Release %s %s %S could not be deleted: %s", name, hook, h.Path, errHookDelete) + return errHookDelete + } + } + return nil +} + // hookShouldBeDeleted determines whether the defined hook deletion policy matches the hook deletion polices // supported by helm. If so, mark the hook as one should be deleted. -func hookShouldBeDeleted(hook *release.Hook, policy string) bool { +func hookHasDeletePolicy(h *release.Hook, policy string) bool { if dp, ok := deletePolices[policy]; ok { - for _, v := range hook.DeletePolicies { + for _, v := range h.DeletePolicies { if dp == v { return true } From ffb0ec03bf6c69a447cf36ffc0877221a127652a Mon Sep 17 00:00:00 2001 From: Morgan Parry Date: Wed, 13 Dec 2017 15:50:25 +0000 Subject: [PATCH 114/449] (fix) Handle caFile alone being set for repos Previously it was only respected if certFile and keyFile were also specified. However, these are independent features. --- pkg/getter/httpgetter.go | 15 +++---------- pkg/getter/httpgetter_test.go | 20 +++++++++++++---- pkg/tlsutil/tls.go | 42 ++++++++++++++++++++++++++++------- 3 files changed, 53 insertions(+), 24 deletions(-) diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index dd462ce5f..d04b1076c 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -23,7 +23,6 @@ import ( "strings" "k8s.io/helm/pkg/tlsutil" - "k8s.io/helm/pkg/urlutil" "k8s.io/helm/pkg/version" ) @@ -80,19 +79,11 @@ func newHTTPGetter(URL, CertFile, KeyFile, CAFile string) (Getter, error) { // NewHTTPGetter constructs a valid http/https client as HttpGetter func NewHTTPGetter(URL, CertFile, KeyFile, CAFile string) (*HttpGetter, error) { var client HttpGetter - if CertFile != "" && KeyFile != "" { - tlsConf, err := tlsutil.NewClientTLS(CertFile, KeyFile, CAFile) + if (CertFile != "" && KeyFile != "") || CAFile != "" { + tlsConf, err := tlsutil.NewTLSConfig(URL, CertFile, KeyFile, CAFile) if err != nil { - return &client, fmt.Errorf("can't create TLS config for client: %s", err.Error()) + return &client, fmt.Errorf("can't create TLS config: %s", err.Error()) } - tlsConf.BuildNameToCertificate() - - sni, err := urlutil.ExtractHostname(URL) - if err != nil { - return &client, err - } - tlsConf.ServerName = sni - client.client = &http.Client{ Transport: &http.Transport{ TLSClientConfig: tlsConf, diff --git a/pkg/getter/httpgetter_test.go b/pkg/getter/httpgetter_test.go index fe3fde22a..ec730f401 100644 --- a/pkg/getter/httpgetter_test.go +++ b/pkg/getter/httpgetter_test.go @@ -28,7 +28,7 @@ func TestHTTPGetter(t *testing.T) { } if hg, ok := g.(*HttpGetter); !ok { - t.Fatal("Expected newHTTPGetter to produce an httpGetter") + t.Fatal("Expected newHTTPGetter to produce an HttpGetter") } else if hg.client != http.DefaultClient { t.Fatal("Expected newHTTPGetter to return a default HTTP client.") } @@ -37,12 +37,24 @@ func TestHTTPGetter(t *testing.T) { cd := "../../testdata" join := filepath.Join ca, pub, priv := join(cd, "ca.pem"), join(cd, "crt.pem"), join(cd, "key.pem") - g, err = newHTTPGetter("http://example.com/", pub, priv, ca) + g, err = newHTTPGetter("https://example.com/", pub, priv, ca) if err != nil { t.Fatal(err) } + if hg, ok := g.(*HttpGetter); !ok { + t.Fatal("Expected newHTTPGetter to produce an HttpGetter") + } else if hg.client == http.DefaultClient { + t.Fatal("Expected newHTTPGetter to return a non-default HTTP client") + } - if _, ok := g.(*HttpGetter); !ok { - t.Fatal("Expected newHTTPGetter to produce an httpGetter") + // Test with SSL, caFile only + g, err = newHTTPGetter("https://example.com/", "", "", ca) + if err != nil { + t.Fatal(err) + } + if hg, ok := g.(*HttpGetter); !ok { + t.Fatal("Expected newHTTPGetter to produce an HttpGetter") + } else if hg.client == http.DefaultClient { + t.Fatal("Expected newHTTPGetter to return a non-default HTTP client") } } diff --git a/pkg/tlsutil/tls.go b/pkg/tlsutil/tls.go index df698fd4e..c166a1662 100644 --- a/pkg/tlsutil/tls.go +++ b/pkg/tlsutil/tls.go @@ -21,17 +21,20 @@ import ( "crypto/x509" "fmt" "io/ioutil" + "k8s.io/helm/pkg/urlutil" ) -// NewClientTLS returns tls.Config appropriate for client auth. -func NewClientTLS(certFile, keyFile, caFile string) (*tls.Config, error) { - cert, err := CertFromFilePair(certFile, keyFile) - if err != nil { - return nil, err - } - config := tls.Config{ - Certificates: []tls.Certificate{*cert}, +func newTLSConfigCommon(certFile, keyFile, caFile string) (*tls.Config, error) { + config := tls.Config{} + + if certFile != "" && keyFile != "" { + cert, err := CertFromFilePair(certFile, keyFile) + if err != nil { + return nil, err + } + config.Certificates = []tls.Certificate{*cert} } + if caFile != "" { cp, err := CertPoolFromFile(caFile) if err != nil { @@ -39,9 +42,32 @@ func NewClientTLS(certFile, keyFile, caFile string) (*tls.Config, error) { } config.RootCAs = cp } + return &config, nil } +// NewClientTLS returns tls.Config appropriate for client auth. +func NewClientTLS(certFile, keyFile, caFile string) (*tls.Config, error) { + return newTLSConfigCommon(certFile, keyFile, caFile) +} + +// NewTLSConfig returns tls.Config appropriate for client and/or server auth. +func NewTLSConfig(url, certFile, keyFile, caFile string) (*tls.Config, error) { + config, err := newTLSConfigCommon(certFile, keyFile, caFile) + if err != nil { + return nil, err + } + config.BuildNameToCertificate() + + serverName, err := urlutil.ExtractHostname(url) + if err != nil { + return nil, err + } + config.ServerName = serverName + + return config, nil +} + // CertPoolFromFile returns an x509.CertPool containing the certificates // in the given PEM-encoded file. // Returns an error if the file could not be read, a certificate could not From 6b5c3c3ac79599dd4a2fcc99568ffedc0fc64697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helgi=20=C3=9Eorbj=C3=B6rnsson?= Date: Wed, 21 Mar 2018 17:28:27 -0700 Subject: [PATCH 115/449] Create index.yaml if missing when running repo index --merge Fixes #3682 --- cmd/helm/repo_index.go | 14 +++++++++++--- cmd/helm/repo_index_test.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/cmd/helm/repo_index.go b/cmd/helm/repo_index.go index 95e4b8aac..540057eb8 100644 --- a/cmd/helm/repo_index.go +++ b/cmd/helm/repo_index.go @@ -19,6 +19,7 @@ package main import ( "fmt" "io" + "os" "path/filepath" "github.com/spf13/cobra" @@ -86,9 +87,16 @@ func index(dir, url, mergeTo string) error { return err } if mergeTo != "" { - i2, err := repo.LoadIndexFile(mergeTo) - if err != nil { - return fmt.Errorf("Merge failed: %s", err) + // if index.yaml is missing then create an empty one to merge into + var i2 *repo.IndexFile + if _, err := os.Stat(mergeTo); os.IsNotExist(err) { + i2 = repo.NewIndexFile() + i2.WriteFile(mergeTo, 0755) + } else { + i2, err = repo.LoadIndexFile(mergeTo) + if err != nil { + return fmt.Errorf("Merge failed: %s", err) + } } i.Merge(i2) } diff --git a/cmd/helm/repo_index_test.go b/cmd/helm/repo_index_test.go index bd1010dd7..4d6313f6c 100644 --- a/cmd/helm/repo_index_test.go +++ b/cmd/helm/repo_index_test.go @@ -112,6 +112,36 @@ func TestRepoIndexCmd(t *testing.T) { if vs[0].Version != expectedVersion { t.Errorf("expected %q, got %q", expectedVersion, vs[0].Version) } + + // test that index.yaml gets generated on merge even when it doesn't exist + if err := os.Remove(destIndex); err != nil { + t.Fatal(err) + } + + c.ParseFlags([]string{"--merge", destIndex}) + if err := c.RunE(c, []string{dir}); err != nil { + t.Error(err) + } + + _, err = repo.LoadIndexFile(destIndex) + if err != nil { + t.Fatal(err) + } + + // verify it didn't create an empty index.yaml and the merged happened + if len(index.Entries) != 2 { + t.Errorf("expected 2 entries, got %d: %#v", len(index.Entries), index.Entries) + } + + vs = index.Entries["compressedchart"] + if len(vs) != 3 { + t.Errorf("expected 3 versions, got %d: %#v", len(vs), vs) + } + + expectedVersion = "0.3.0" + if vs[0].Version != expectedVersion { + t.Errorf("expected %q, got %q", expectedVersion, vs[0].Version) + } } func linkOrCopy(old, new string) error { From 85a38febb539e1ef27c59c619295ad5a02c3a7c4 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 22 Mar 2018 08:22:09 +0000 Subject: [PATCH 116/449] add a link to Jenkins X and how it uses helm for promoting applications through environments via GitOps --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index c14eb3880..dfe0b1c1f 100644 --- a/docs/related.md +++ b/docs/related.md @@ -69,6 +69,7 @@ Tools layered on top of Helm or Tiller. - [ChartMuseum](https://github.com/chartmuseum/chartmuseum) - Helm Chart Repository with support for Amazon S3 and Google Cloud Storage - [Helm.NET](https://github.com/qmfrederik/helm) - A .NET client for Tiller's API - [Codefresh](https://codefresh.io) - Kubernetes native CI/CD and management platform with UI dashboards for managing Helm charts and releases +- [Jenkins X](http://jenkins-x.io/) - open source automated C/CD for Kubernetes which uses Helm for [promoting](http://jenkins-x.io/about/features/#promotion) applications through [environments via GitOps](http://jenkins-x.io/about/features/#environments) ## Helm Included From c8b12df12fa3f66d2c22006fafbd93f37ef6332c Mon Sep 17 00:00:00 2001 From: Ferenc- Date: Thu, 22 Mar 2018 14:51:45 +0100 Subject: [PATCH 117/449] Fix HTML parsing when setting TAG with wget Now the parsing part is the same as in the curl scenario --- scripts/get | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get b/scripts/get index 6654fd226..3c4fb9f7d 100755 --- a/scripts/get +++ b/scripts/get @@ -80,7 +80,7 @@ checkDesiredVersion() { if type "curl" > /dev/null; then TAG=$(curl -SsL $release_url | awk '/\/tag\//' | grep -v no-underline | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') elif type "wget" > /dev/null; then - TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') + TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | grep -v no-underline | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') fi if [ "x$TAG" == "x" ]; then echo "Cannot determine ${DESIRED_VERSION} tag." From 12d5c39e31b568cf02ad71b69a4f06f591c03969 Mon Sep 17 00:00:00 2001 From: fqsghostcloud Date: Thu, 22 Mar 2018 23:21:32 +0800 Subject: [PATCH 118/449] fix Syntax error fix Syntax error --- docs/chart_repository.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_repository.md b/docs/chart_repository.md index 5a24249b8..01d457e63 100644 --- a/docs/chart_repository.md +++ b/docs/chart_repository.md @@ -275,7 +275,7 @@ fantastic-charts https://fantastic-charts.storage.googleapis.com If the charts are backed by HTTP basic authentication, you can also supply the username and password here: -``console +```console $ helm repo add fantastic-charts https://fantastic-charts.storage.googleapis.com --username my-username --password my-password $ helm repo list fantastic-charts https://fantastic-charts.storage.googleapis.com From e51abc25509a9d483bc7b51009d879b4f4d91009 Mon Sep 17 00:00:00 2001 From: Justin Scott Date: Thu, 22 Mar 2018 12:23:11 -0700 Subject: [PATCH 119/449] Add issue_template.md which asks for version info. --- .github/issue_template.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/issue_template.md diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 000000000..f4a3a8219 --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,9 @@ + + +Helm version: + +Kubernetes version: + +Cloud Provider/Platform (AKS, GKE, Minikube etc.): + + From b4b43a12a3297635b3b494c02f4b6d1ded90b22e Mon Sep 17 00:00:00 2001 From: Justin Scott Date: Thu, 22 Mar 2018 13:21:03 -0700 Subject: [PATCH 120/449] Update to specify version command output. --- .github/issue_template.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index f4a3a8219..48f48e5b6 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -1,8 +1,8 @@ -Helm version: +Output of `helm version`: -Kubernetes version: +Output of `kubectl version`: Cloud Provider/Platform (AKS, GKE, Minikube etc.): From 8f7b719a5002fa8f27ee7d12df57f2346ee4cd00 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Fri, 23 Mar 2018 06:33:25 +0000 Subject: [PATCH 121/449] fixed typo + moved into Helm Included section --- docs/related.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/related.md b/docs/related.md index dfe0b1c1f..997e3f01d 100644 --- a/docs/related.md +++ b/docs/related.md @@ -69,7 +69,6 @@ Tools layered on top of Helm or Tiller. - [ChartMuseum](https://github.com/chartmuseum/chartmuseum) - Helm Chart Repository with support for Amazon S3 and Google Cloud Storage - [Helm.NET](https://github.com/qmfrederik/helm) - A .NET client for Tiller's API - [Codefresh](https://codefresh.io) - Kubernetes native CI/CD and management platform with UI dashboards for managing Helm charts and releases -- [Jenkins X](http://jenkins-x.io/) - open source automated C/CD for Kubernetes which uses Helm for [promoting](http://jenkins-x.io/about/features/#promotion) applications through [environments via GitOps](http://jenkins-x.io/about/features/#environments) ## Helm Included @@ -79,6 +78,7 @@ Platforms, distributions, and services that include Helm support. - [Cabin](http://www.skippbox.com/cabin/) - Mobile App for Managing Kubernetes - [Qstack](https://qstack.com) - [Fabric8](https://fabric8.io) - Integrated development platform for Kubernetes +- [Jenkins X](http://jenkins-x.io/) - open source automated CI/CD for Kubernetes which uses Helm for [promoting](http://jenkins-x.io/about/features/#promotion) applications through [environments via GitOps](http://jenkins-x.io/about/features/#environments) ## Misc From ae817f7372c5bea32cfa27e40d8489c546cce043 Mon Sep 17 00:00:00 2001 From: Russell Morrisey Date: Fri, 23 Mar 2018 15:43:54 -0400 Subject: [PATCH 122/449] Updated to mention the --purge flag on delete See: https://github.com/kubernetes/helm/issues/2332 --- docs/install_faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install_faq.md b/docs/install_faq.md index ff9ee89e6..f2eae5b48 100644 --- a/docs/install_faq.md +++ b/docs/install_faq.md @@ -224,7 +224,7 @@ I am trying to remove stuff. **Q: When I delete the Tiller deployment, how come all the releases are still there?** Releases are stored in ConfigMaps inside of the `kube-system` namespace. You will -have to manually delete them to get rid of the record. +have to manually delete them to get rid of the record, or use ```helm delete --purge```. **Q: I want to delete my local Helm. Where are all its files?** From 0ee69cfd4b5d21cc006ff184407ac31e5b4b691e Mon Sep 17 00:00:00 2001 From: AdamDang Date: Sun, 25 Mar 2018 15:51:57 +0800 Subject: [PATCH 123/449] Update tiller_ssl.md "that" is duplicated. --- docs/tiller_ssl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tiller_ssl.md b/docs/tiller_ssl.md index db1603068..d7f0166c4 100644 --- a/docs/tiller_ssl.md +++ b/docs/tiller_ssl.md @@ -251,7 +251,7 @@ This configuration sends our client-side certificate to establish identity, uses the client key for encryption, and uses the CA certificate to validate the remote Tiller's identity. -Typing a line that that is cumbersome, though. The shortcut is to move the key, +Typing a line that is cumbersome, though. The shortcut is to move the key, cert, and CA into `$HELM_HOME`: ```console From 8d65f72332b14e80bdfa86618a540710b55d8504 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 26 Mar 2018 22:15:36 -0700 Subject: [PATCH 124/449] ref(*): kubernetes v1.10 support --- glide.lock | 184 +++++++++----------------------- glide.yaml | 20 ++-- pkg/kube/client.go | 14 ++- pkg/kube/client_test.go | 226 ++++++++++++---------------------------- 4 files changed, 133 insertions(+), 311 deletions(-) diff --git a/glide.lock b/glide.lock index 1ccdae61c..068f86372 100644 --- a/glide.lock +++ b/glide.lock @@ -1,71 +1,20 @@ -hash: d93f565214b112cf8560e9cd2da2f3ab7852a1f19544569fc112bd4fb2d1d506 -updated: 2018-03-08T14:06:06.497394911-08:00 +hash: 6837936360d447b64aa7a09d3c89c18ac5540b009a57fc4d3227af299bf40268 +updated: 2018-03-27T05:13:24.967040785Z imports: -- name: cloud.google.com/go - version: 3b1ae45394a234c385be014e9a488f2bb6eef821 - repo: https://github.com/GoogleCloudPlatform/google-cloud-go.git - subpackages: - - compute - - compute/metadata - - internal - name: github.com/aokoli/goutils version: 9c37978a95bd5c709a15883b6242714ea6709e64 - name: github.com/asaskevich/govalidator version: 7664702784775e51966f0885f5cd27435916517b -- name: github.com/aws/aws-sdk-go - version: 760741802ad40f49ae9fc4a69ef6706d2527d62e - subpackages: - - aws - - aws/awserr - - aws/awsutil - - aws/client - - aws/client/metadata - - aws/corehandlers - - aws/credentials - - aws/credentials/ec2rolecreds - - aws/credentials/endpointcreds - - aws/credentials/stscreds - - aws/defaults - - aws/ec2metadata - - aws/endpoints - - aws/request - - aws/session - - aws/signer/v4 - - internal/shareddefaults - - private/protocol - - private/protocol/ec2query - - private/protocol/json/jsonutil - - private/protocol/jsonrpc - - private/protocol/query - - private/protocol/query/queryutil - - private/protocol/rest - - private/protocol/xml/xmlutil - - service/autoscaling - - service/ec2 - - service/ecr - - service/elb - - service/elbv2 - - service/kms - - service/sts - name: github.com/Azure/go-ansiterm version: 19f72df4d05d31cbe1c56bfc8045c96babff6c7e subpackages: - winterm -- name: github.com/Azure/go-autorest - version: e14a70c556c8e0db173358d1a903dca345a8e75e - subpackages: - - autorest - - autorest/adal - - autorest/azure - - autorest/date - name: github.com/beorn7/perks version: 3ac7bf7a47d159a033b107610db8a1b6575507a4 subpackages: - quantile - name: github.com/BurntSushi/toml version: b26d9c308763d68093482582cea63d69be07a0f0 -- name: github.com/chai2010/gettext-go - version: bf70f2a70fb1b1f36d90d671a72795984eab0fcb - name: github.com/cpuguy83/go-md2man version: 71acacd42f85e5e82f70a55327789582a5200a90 subpackages: @@ -74,8 +23,6 @@ imports: version: 782f4967f2dc4564575ca782fe2d04090b5faca8 subpackages: - spew -- name: github.com/dgrijalva/jwt-go - version: 01aeca54ebda6e0fbfafd0a524d234159c05ec20 - name: github.com/docker/distribution version: edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c subpackages: @@ -106,8 +53,9 @@ imports: - pkg/jsonmessage - pkg/longpath - pkg/mount + - pkg/parsers - pkg/stdcopy - - pkg/symlink + - pkg/sysinfo - pkg/system - pkg/term - pkg/term/windows @@ -124,10 +72,6 @@ imports: version: 449fdfce4d962303d702fec724ef0ad181c92528 subpackages: - spdy -- name: github.com/emicklei/go-restful - version: ff4f55a206334ef123e4f79bbf348980da81ca46 - subpackages: - - log - name: github.com/evanphx/json-patch version: 944e07253867aacae43c04b2e6a239005443f33a - name: github.com/exponent-io/jsonpath @@ -136,14 +80,12 @@ imports: version: f6a740d52f961c60348ebb109adde9f4635d7540 - name: github.com/ghodss/yaml version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee -- name: github.com/go-ini/ini - version: 300e940a926eb277d3901b20bdfcc54928ad3642 - name: github.com/go-openapi/jsonpointer version: 46af16f9f7b149af66e5d1bd010e3574dc06de98 - name: github.com/go-openapi/jsonreference version: 13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272 - name: github.com/go-openapi/spec - version: 7abd5745472fff5eb3685386d5fb8bf38683154d + version: 1de3e0542de65ad8d75452a595886fdd0befb363 - name: github.com/go-openapi/swag version: f3f9494671f93fcff853e3c6e9e948b3eb71e590 - name: github.com/gobwas/glob @@ -185,15 +127,6 @@ imports: - OpenAPIv2 - compiler - extensions -- name: github.com/gophercloud/gophercloud - version: 8183543f90d1aef267a5ecc209f2e0715b355acb - subpackages: - - openstack - - openstack/identity/v2/tenants - - openstack/identity/v2/tokens - - openstack/identity/v3/tokens - - openstack/utils - - pagination - name: github.com/gosuri/uitable version: 36ee7e946282a3fb1cfecd476ddc9b35d8847e42 subpackages: @@ -217,12 +150,8 @@ imports: version: 6633656539c1639d9d78127b7d47c622b5d7b6dc - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 -- name: github.com/jmespath/go-jmespath - version: 0b12d6b521d83fc7f755e7cfc1b1fbdd35a01a74 - name: github.com/json-iterator/go - version: 36b14963da70d11297d313183d7e6388c8510e1e -- name: github.com/juju/ratelimit - version: 5b9ff866471762aa2ab2dced63c9fb6f53921342 + version: 13f86432b882000a51c6e610c620974462691a97 - name: github.com/mailru/easyjson version: 2f5df55504ebc322e4d52d34df6a1f5b503bf26d subpackages: @@ -245,8 +174,6 @@ imports: - pbutil - name: github.com/mitchellh/go-wordwrap version: ad45545899c7b13c020ea92b2072220eefad42b8 -- name: github.com/naoina/go-stringutil - version: 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b - name: github.com/opencontainers/go-digest version: a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb - name: github.com/opencontainers/image-spec @@ -301,6 +228,8 @@ imports: version: 81e90905daefcd6fd217b62423c0908922eadb30 subpackages: - cast5 + - ed25519 + - ed25519/internal/edwards25519 - openpgp - openpgp/armor - openpgp/clearsign @@ -315,20 +244,12 @@ imports: version: 1c05540f6879653db88113bc4a2b70aec4bd491f subpackages: - context - - context/ctxhttp - http2 - http2/hpack - idna - internal/timeseries - lex/httplex - trace -- name: golang.org/x/oauth2 - version: a6bd8cefa1811bd24b86f8902872e4e8225f74c4 - subpackages: - - google - - internal - - jws - - jwt - name: golang.org/x/sys version: 43eea11bc92608addb41b8a406b0407495c106f6 subpackages: @@ -353,18 +274,10 @@ imports: - unicode/bidi - unicode/norm - width -- name: google.golang.org/appengine - version: 12d5545dc1cfa6047a286d5e853841b6471f4c19 +- name: golang.org/x/time + version: f51c12702a4d776e4c1fa9b0fabab841babae631 subpackages: - - internal - - internal/app_identity - - internal/base - - internal/datastore - - internal/log - - internal/modules - - internal/remote_api - - internal/urlfetch - - urlfetch + - rate - name: google.golang.org/genproto version: 09f6ed296fc66555a25fe4ce95173148778dfa85 subpackages: @@ -390,20 +303,18 @@ imports: - status - tap - transport -- name: gopkg.in/gcfg.v1 - version: 27e4946190b4a327b539185f2b5b1f7c84730728 - subpackages: - - scanner - - token - - types - name: gopkg.in/inf.v0 version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4 -- name: gopkg.in/warnings.v0 - version: 8a331561fe74dadba6edfc59f3be66c22c3b065d +- name: gopkg.in/square/go-jose.v2 + version: f8f38de21b4dcd69d0413faf231983f5fd6634b1 + subpackages: + - cipher + - json + - jwt - name: gopkg.in/yaml.v2 version: 53feefa2559fb8dfa8d81baad31be332c97d6c77 - name: k8s.io/api - version: 006a217681ae70cbacdd66a5e2fca1a61a8ff28e + version: c699ec51538f0cfd4afa8bfcfe1e0779cafbe666 subpackages: - admission/v1beta1 - admissionregistration/v1alpha1 @@ -436,11 +347,11 @@ imports: - storage/v1alpha1 - storage/v1beta1 - name: k8s.io/apiextensions-apiserver - version: a5bbfd114a9b122acd741c61d88c84812375d9e1 + version: 898b0eda132e1aeac43a459785144ee4bf9b0a2e subpackages: - pkg/features - name: k8s.io/apimachinery - version: 68f9c3a1feb3140df59c67ced62d3a5df8e6c9c2 + version: 54101a56dda9a0962bc48751c058eb4c546dcbb9 subpackages: - pkg/api/equality - pkg/api/errors @@ -454,7 +365,7 @@ imports: - pkg/apis/meta/v1 - pkg/apis/meta/v1/unstructured - pkg/apis/meta/v1/validation - - pkg/apis/meta/v1alpha1 + - pkg/apis/meta/v1beta1 - pkg/conversion - pkg/conversion/queryparams - pkg/fields @@ -472,6 +383,7 @@ imports: - pkg/util/cache - pkg/util/clock - pkg/util/diff + - pkg/util/duration - pkg/util/errors - pkg/util/framer - pkg/util/httpstream @@ -496,7 +408,7 @@ imports: - third_party/forked/golang/netutil - third_party/forked/golang/reflect - name: k8s.io/apiserver - version: 2a1092aaa7202e8f9b188281ff9424a014ce61c2 + version: ea53f8588c655568158b4ff53f5ec6fa4ebfc332 subpackages: - pkg/apis/audit - pkg/authentication/authenticator @@ -507,7 +419,7 @@ imports: - pkg/util/feature - pkg/util/flag - name: k8s.io/client-go - version: 78700dec6369ba22221b72770783300f143df150 + version: 23781f4d6632d88e869066eaebb743857aa1ef9b subpackages: - discovery - discovery/fake @@ -635,15 +547,21 @@ imports: - listers/storage/v1 - listers/storage/v1alpha1 - listers/storage/v1beta1 + - pkg/apis/clientauthentication + - pkg/apis/clientauthentication/v1alpha1 - pkg/version - - plugin/pkg/client/auth - - plugin/pkg/client/auth/azure - - plugin/pkg/client/auth/gcp - - plugin/pkg/client/auth/oidc - - plugin/pkg/client/auth/openstack + - plugin/pkg/client/auth/exec - rest - rest/fake - rest/watch + - scale + - scale/scheme + - scale/scheme/appsint + - scale/scheme/appsv1beta1 + - scale/scheme/appsv1beta2 + - scale/scheme/autoscalingv1 + - scale/scheme/extensionsint + - scale/scheme/extensionsv1beta1 - testing - third_party/forked/golang/template - tools/auth @@ -670,13 +588,12 @@ imports: - util/retry - util/workqueue - name: k8s.io/kube-openapi - version: 39a7bf85c140f972372c2a0d1ee40adbf0c8bfe1 + version: 50ae88d24ede7b8bad68e23c805b5d3da5c8abaf subpackages: - - pkg/common - pkg/util/proto - pkg/util/proto/validation - name: k8s.io/kubernetes - version: 5fa2db2bd46ac79e5e00a4e6ed24191080aa463b + version: 923d8441db527e908cd7d266c4a9d18daa596d4c subpackages: - pkg/api/events - pkg/api/legacyscheme @@ -686,7 +603,6 @@ imports: - pkg/api/service - pkg/api/testapi - pkg/api/v1/pod - - pkg/api/v1/service - pkg/apis/admission - pkg/apis/admission/install - pkg/apis/admission/v1beta1 @@ -799,9 +715,8 @@ imports: - pkg/client/clientset_generated/internalclientset/typed/settings/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion/fake - - pkg/client/unversioned + - pkg/client/conditions - pkg/cloudprovider - - pkg/cloudprovider/providers/aws - pkg/controller - pkg/controller/daemon - pkg/controller/daemon/util @@ -810,8 +725,8 @@ imports: - pkg/controller/statefulset - pkg/controller/volume/events - pkg/controller/volume/persistentvolume + - pkg/controller/volume/persistentvolume/metrics - pkg/credentialprovider - - pkg/credentialprovider/aws - pkg/features - pkg/fieldpath - pkg/kubectl @@ -830,6 +745,7 @@ imports: - pkg/kubectl/util/hash - pkg/kubectl/util/slice - pkg/kubectl/util/term + - pkg/kubectl/util/transport - pkg/kubectl/validation - pkg/kubelet/apis - pkg/kubelet/types @@ -837,6 +753,13 @@ imports: - pkg/printers - pkg/printers/internalversion - pkg/registry/rbac/validation + - pkg/scheduler/algorithm + - pkg/scheduler/algorithm/predicates + - pkg/scheduler/algorithm/priorities/util + - pkg/scheduler/api + - pkg/scheduler/schedulercache + - pkg/scheduler/util + - pkg/scheduler/volumebinder - pkg/security/apparmor - pkg/serviceaccount - pkg/util/file @@ -858,14 +781,9 @@ imports: - pkg/version - pkg/volume - pkg/volume/util - - pkg/watch/json - - plugin/pkg/scheduler/algorithm - - plugin/pkg/scheduler/algorithm/predicates - - plugin/pkg/scheduler/algorithm/priorities/util - - plugin/pkg/scheduler/api - - plugin/pkg/scheduler/schedulercache - - plugin/pkg/scheduler/util - - plugin/pkg/scheduler/volumebinder + - pkg/volume/util/fs + - pkg/volume/util/recyclerclient + - pkg/volume/util/types - name: k8s.io/utils version: aedf551cdb8b0119df3a19c65fde413a13b34997 subpackages: @@ -874,8 +792,6 @@ imports: - exec/testing - name: vbom.ml/util version: db5cfe13f5cc80a4990d98e2e1b0707a4d1a5394 - repo: https://github.com/fvbommel/util.git - vcs: git subpackages: - sortorder testImports: diff --git a/glide.yaml b/glide.yaml index 7d0fce978..7fcb16d0b 100644 --- a/glide.yaml +++ b/glide.yaml @@ -43,28 +43,20 @@ import: - package: github.com/evanphx/json-patch - package: github.com/BurntSushi/toml version: ~0.3.0 -- package: github.com/naoina/go-stringutil - version: ~0.1.0 -- package: github.com/chai2010/gettext-go - package: github.com/prometheus/client_golang version: 0.8.0 -- package: vbom.ml/util - repo: https://github.com/fvbommel/util.git - vcs: git +- package: github.com/grpc-ecosystem/go-grpc-prometheus - package: k8s.io/kubernetes - version: 1.9.2 + version: release-1.10 - package: k8s.io/client-go - version: ~6.0.0 + version: kubernetes-1.10.0 - package: k8s.io/api - version: kubernetes-1.9.2 + version: release-1.10 - package: k8s.io/apimachinery - version: kubernetes-1.9.2 + version: release-1.10 - package: k8s.io/apiserver - version: kubernetes-1.9.2 - -- package: cloud.google.com/go/compute - repo: https://github.com/GoogleCloudPlatform/google-cloud-go.git + version: release-1.10 testImports: - package: github.com/stretchr/testify diff --git a/pkg/kube/client.go b/pkg/kube/client.go index cd5227dd7..e4e2dc1bb 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -47,7 +47,7 @@ import ( "k8s.io/client-go/tools/clientcmd" batchinternal "k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/core" - conditions "k8s.io/kubernetes/pkg/client/unversioned" + "k8s.io/kubernetes/pkg/client/conditions" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" @@ -77,10 +77,12 @@ func New(config clientcmd.ClientConfig) *Client { return &Client{ Factory: cmdutil.NewFactory(config), SchemaCacheDir: clientcmd.RecommendedSchemaFile, - Log: func(_ string, _ ...interface{}) {}, + Log: nopLogger, } } +var nopLogger = func(_ string, _ ...interface{}) {} + // ResourceActorFunc performs an action on a single resource. type ResourceActorFunc func(*resource.Info) error @@ -205,7 +207,10 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // an object type changes, so we can just rely on that. Problem is it doesn't seem to keep // track of tab widths. buf := new(bytes.Buffer) - p, _ := c.Printer(nil, printers.PrintOptions{}) + p, err := cmdutil.PrinterForOptions(&printers.PrintOptions{}) + if err != nil { + return "", err + } for t, ot := range objs { if _, err = buf.WriteString("==> " + t + "\n"); err != nil { return "", err @@ -608,7 +613,8 @@ func (c *Client) AsVersionedObject(obj runtime.Object) (runtime.Object, error) { return nil, err } versions := &runtime.VersionedObjects{} - err = runtime.DecodeInto(c.Decoder(true), json, versions) + decoder := unstructured.UnstructuredJSONScheme + err = runtime.DecodeInto(decoder, json, versions) return versions.First(), err } diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index a81b2c949..47049810a 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -18,8 +18,6 @@ package kube import ( "bytes" - "encoding/json" - "fmt" "io" "io/ioutil" "net/http" @@ -31,19 +29,20 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/dynamic" "k8s.io/client-go/rest/fake" + "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/kubectl" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" - "k8s.io/kubernetes/pkg/printers" - watchjson "k8s.io/kubernetes/pkg/watch/json" + "k8s.io/kubernetes/pkg/kubectl/scheme" ) +var unstructuredSerializer = dynamic.ContentConfig().NegotiatedSerializer + func objBody(codec runtime.Codec, obj runtime.Object) io.ReadCloser { return ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(codec, obj)))) } @@ -117,31 +116,21 @@ func (f *fakeReaperFactory) Reaper(mapping *meta.RESTMapping) (kubectl.Reaper, e return f.reaper, nil } -func newEventResponse(code int, e *watch.Event) (*http.Response, error) { - dispatchedEvent, err := encodeAndMarshalEvent(e) - if err != nil { - return nil, err - } - - header := http.Header{} - header.Set("Content-Type", runtime.ContentTypeJSON) - body := ioutil.NopCloser(bytes.NewReader(dispatchedEvent)) - return &http.Response{StatusCode: code, Header: header, Body: body}, nil +type testClient struct { + *Client + *cmdtesting.TestFactory } -func encodeAndMarshalEvent(e *watch.Event) ([]byte, error) { - encodedEvent, err := watchjson.Object(testapi.Default.Codec(), e) - if err != nil { - return nil, err +func newTestClient() *testClient { + tf := cmdtesting.NewTestFactory() + c := &Client{ + Factory: tf, + Log: nopLogger, + } + return &testClient{ + Client: c, + TestFactory: tf, } - - return json.Marshal(encodedEvent) -} - -func newTestClient(f cmdutil.Factory) *Client { - c := New(nil) - c.Factory = f - return c } func TestUpdate(t *testing.T) { @@ -153,10 +142,11 @@ func TestUpdate(t *testing.T) { var actions []string - f, tf, codec, _ := cmdtesting.NewAPIFactory() + tf := cmdtesting.NewTestFactory() + defer tf.Cleanup() tf.UnstructuredClient = &fake.RESTClient{ GroupVersion: schema.GroupVersion{Version: "v1"}, - NegotiatedSerializer: dynamic.ContentConfig().NegotiatedSerializer, + NegotiatedSerializer: unstructuredSerializer, Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { p, m := req.URL.Path, req.Method actions = append(actions, p+":"+m) @@ -190,9 +180,11 @@ func TestUpdate(t *testing.T) { }), } + c := newTestClient() reaper := &fakeReaper{} - rf := &fakeReaperFactory{Factory: f, reaper: reaper} - c := newTestClient(rf) + rf := &fakeReaperFactory{Factory: tf, reaper: reaper} + c.Client.Factory = rf + codec := legacyscheme.Codecs.LegacyCodec(scheme.Versions...) if err := c.Update(core.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil { t.Fatal(err) } @@ -251,54 +243,35 @@ func TestBuild(t *testing.T) { }, } + c := newTestClient() for _, tt := range tests { - f, _, _, _ := cmdtesting.NewAPIFactory() - c := newTestClient(f) - - // Test for an invalid manifest - infos, err := c.Build(tt.namespace, tt.reader) - if err != nil && !tt.err { - t.Errorf("%q. Got error message when no error should have occurred: %v", tt.name, err) - } else if err != nil && strings.Contains(err.Error(), "--validate=false") { - t.Errorf("%q. error message was not scrubbed", tt.name) - } + t.Run(tt.name, func(t *testing.T) { + c.Cleanup() + + // Test for an invalid manifest + infos, err := c.Build(tt.namespace, tt.reader) + if err != nil && !tt.err { + t.Errorf("Got error message when no error should have occurred: %v", err) + } else if err != nil && strings.Contains(err.Error(), "--validate=false") { + t.Error("error message was not scrubbed") + } - if len(infos) != tt.count { - t.Errorf("%q. expected %d result objects, got %d", tt.name, tt.count, len(infos)) - } + if len(infos) != tt.count { + t.Errorf("expected %d result objects, got %d", tt.count, len(infos)) + } + }) } } -type testPrinter struct { - Objects []runtime.Object - Err error - printers.ResourcePrinter -} - -func (t *testPrinter) PrintObj(obj runtime.Object, out io.Writer) error { - t.Objects = append(t.Objects, obj) - fmt.Fprintf(out, "%#v", obj) - return t.Err -} - -func (t *testPrinter) HandledResources() []string { - return []string{} -} - -func (t *testPrinter) AfterPrint(io.Writer, string) error { - return t.Err -} - func TestGet(t *testing.T) { list := newPodList("starfish", "otter") - f, tf, _, _ := cmdtesting.NewAPIFactory() - tf.Printer = &testPrinter{} - tf.UnstructuredClient = &fake.RESTClient{ + c := newTestClient() + defer c.Cleanup() + c.TestFactory.UnstructuredClient = &fake.RESTClient{ GroupVersion: schema.GroupVersion{Version: "v1"}, - NegotiatedSerializer: dynamic.ContentConfig().NegotiatedSerializer, + NegotiatedSerializer: unstructuredSerializer, Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { p, m := req.URL.Path, req.Method - //actions = append(actions, p+":"+m) t.Logf("got request %s %s", p, m) switch { case p == "/namespaces/default/pods/starfish" && m == "GET": @@ -311,7 +284,6 @@ func TestGet(t *testing.T) { } }), } - c := newTestClient(f) // Test Success data := strings.NewReader("kind: Pod\napiVersion: v1\nmetadata:\n name: otter") @@ -358,101 +330,37 @@ func TestPerform(t *testing.T) { } for _, tt := range tests { - results := []*resource.Info{} + t.Run(tt.name, func(t *testing.T) { + results := []*resource.Info{} - fn := func(info *resource.Info) error { - results = append(results, info) + fn := func(info *resource.Info) error { + results = append(results, info) - if info.Namespace != tt.namespace { - t.Errorf("%q. expected namespace to be '%s', got %s", tt.name, tt.namespace, info.Namespace) + if info.Namespace != tt.namespace { + t.Errorf("expected namespace to be '%s', got %s", tt.namespace, info.Namespace) + } + return nil } - return nil - } - f, _, _, _ := cmdtesting.NewAPIFactory() - c := newTestClient(f) - infos, err := c.Build(tt.namespace, tt.reader) - if err != nil && err.Error() != tt.errMessage { - t.Errorf("%q. Error while building manifests: %v", tt.name, err) - } - - err = perform(infos, fn) - if (err != nil) != tt.err { - t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err) - } - if err != nil && err.Error() != tt.errMessage { - t.Errorf("%q. expected error message: %v, got %v", tt.name, tt.errMessage, err) - } - - if len(results) != tt.count { - t.Errorf("%q. expected %d result objects, got %d", tt.name, tt.count, len(results)) - } - } -} - -func TestWaitAndGetCompletedPodPhase(t *testing.T) { - tests := []struct { - podPhase core.PodPhase - expectedPhase core.PodPhase - err bool - errMessage string - }{ - { - podPhase: core.PodPending, - expectedPhase: core.PodUnknown, - err: true, - errMessage: "watch closed before Until timeout", - }, { - podPhase: core.PodRunning, - expectedPhase: core.PodUnknown, - err: true, - errMessage: "watch closed before Until timeout", - }, { - podPhase: core.PodSucceeded, - expectedPhase: core.PodSucceeded, - }, { - podPhase: core.PodFailed, - expectedPhase: core.PodFailed, - }, - } - - for _, tt := range tests { - f, tf, codec, ns := cmdtesting.NewAPIFactory() - actions := make(map[string]string) - - var testPodList core.PodList - testPodList.Items = append(testPodList.Items, newPodWithStatus("bestpod", core.PodStatus{Phase: tt.podPhase}, "test")) - - tf.Client = &fake.RESTClient{ - NegotiatedSerializer: ns, - Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { - p, m := req.URL.Path, req.Method - actions[p] = m - switch { - case p == "/namespaces/test/pods/bestpod" && m == "GET": - return newResponse(200, &testPodList.Items[0]) - case p == "/namespaces/test/pods" && m == "GET": - event := watch.Event{Type: watch.Added, Object: &testPodList.Items[0]} - return newEventResponse(200, &event) - default: - t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) - return nil, nil - } - }), - } + c := newTestClient() + defer c.Cleanup() + infos, err := c.Build(tt.namespace, tt.reader) + if err != nil && err.Error() != tt.errMessage { + t.Errorf("Error while building manifests: %v", err) + } - c := newTestClient(f) + err = perform(infos, fn) + if (err != nil) != tt.err { + t.Errorf("expected error: %v, got %v", tt.err, err) + } + if err != nil && err.Error() != tt.errMessage { + t.Errorf("expected error message: %v, got %v", tt.errMessage, err) + } - phase, err := c.WaitAndGetCompletedPodPhase("test", objBody(codec, &testPodList), 1*time.Second) - if (err != nil) != tt.err { - t.Fatalf("Expected error but there was none.") - } - if err != nil && err.Error() != tt.errMessage { - t.Fatalf("Expected error %s, got %s", tt.errMessage, err.Error()) - } - if phase != tt.expectedPhase { - t.Fatalf("Expected pod phase %s, got %s", tt.expectedPhase, phase) - } + if len(results) != tt.count { + t.Errorf("expected %d result objects, got %d", tt.count, len(results)) + } + }) } } From 050257d1f9c33763da8b711d0d8d84f78d66195c Mon Sep 17 00:00:00 2001 From: Shredgar Date: Tue, 27 Mar 2018 14:52:32 +0200 Subject: [PATCH 125/449] Updated kubernetes_distros.md with DC/OS note. Updated kubernetes_distros.md with a note that Helm is running fine on Kubernetes on DC/OS --- docs/kubernetes_distros.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/kubernetes_distros.md b/docs/kubernetes_distros.md index 04a86d0b4..c30bc87f3 100644 --- a/docs/kubernetes_distros.md +++ b/docs/kubernetes_distros.md @@ -43,3 +43,9 @@ Helm works straightforward on OpenShift Online, OpenShift Dedicated, OpenShift C ## Platform9 Helm Client and Helm Server (Tiller) are pre-installed with [Platform9 Managed Kubernetes](https://platform9.com/managed-kubernetes/?utm_source=helm_distro_notes). Platform9 provides access to all official Helm charts through the App Catalog UI and native Kubernetes CLI. Additional repositories can be manually added. Further details are available in this [Platform9 App Catalog article](https://platform9.com/support/deploying-kubernetes-apps-platform9-managed-kubernetes/?utm_source=helm_distro_notes). + +## DC/OS ++ ++Helm (both client and server) has been tested and is working on Mesospheres DC/OS Kubernetes platform, and requires ++no additional configuration. + From 84236783499d20060ed05b2e4022f4df1df2ca20 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Tue, 27 Mar 2018 19:56:46 +0200 Subject: [PATCH 126/449] Remove outdated note. --- docs/provenance.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docs/provenance.md b/docs/provenance.md index 1eb69f8f3..331074e8c 100644 --- a/docs/provenance.md +++ b/docs/provenance.md @@ -4,13 +4,6 @@ Helm has provenance tools which help chart users verify the integrity and origin of a package. Using industry-standard tools based on PKI, GnuPG, and well-respected package managers, Helm can generate and verify signature files. -**Note:** -Version 2.0.0-alpha.4 introduced a system for verifying the authenticity of charts. -While we do not anticipate that any major changes will be made to the file formats -or provenancing algorithms, this portion of Helm is not considered _frozen_ until -2.0.0-RC1 is released. The original plan for this feature can be found -[at issue 983](https://github.com/kubernetes/helm/issues/983). - ## Overview Integrity is established by comparing a chart to a provenance record. Provenance From 7e8c2d300fd0d6f3374615a6eba2c1a5fa8c9259 Mon Sep 17 00:00:00 2001 From: adshmh Date: Tue, 27 Mar 2018 16:06:04 -0400 Subject: [PATCH 127/449] Fix several golint warnings (#3756) * fix(helm): fix golint warning due to ApiVersionV1 constant name Signed-off-by: Arash Deshmeh * fix(helm): fix golint warning due to ResolveChartVersionAndGetRepo comment Signed-off-by: Arash Deshmeh * fix(helm): fix golint warnings on HttpGetter type and SetCredentials method missing a comment Signed-off-by: Arash Deshmeh * fix(helm):fix golint warning due to comment on FindChartInAuthRepoURL function Signed-off-by: Arash Deshmeh * fix(helm): fix golint warning due to RepoFile type name Signed-off-by: Arash Deshmeh * fix(helm): fix golint warning due to ParseString comment Signed-off-by: Arash Deshmeh --- pkg/chartutil/chartfile.go | 2 +- pkg/downloader/chart_downloader.go | 2 +- pkg/getter/httpgetter.go | 6 ++++-- pkg/repo/chartrepo.go | 6 +++--- pkg/repo/repo.go | 3 ++- pkg/strvals/parser.go | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pkg/chartutil/chartfile.go b/pkg/chartutil/chartfile.go index 9897d66ff..c2879cdae 100644 --- a/pkg/chartutil/chartfile.go +++ b/pkg/chartutil/chartfile.go @@ -31,7 +31,7 @@ import ( // ApiVersionV1 is the API version number for version 1. // // This is ApiVersionV1 instead of APIVersionV1 to match the protobuf-generated name. -const ApiVersionV1 = "v1" +const ApiVersionV1 = "v1" // nolint // UnmarshalChartfile takes raw Chart.yaml data and unmarshals it. func UnmarshalChartfile(data []byte) (*chart.Metadata, error) { diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 9fe89820e..9262ea547 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -151,7 +151,7 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, ge return u, nil, err } -// Same as the ResolveChartVersion method, but returns the chart repositoryy. +// ResolveChartVersionAndGetRepo is the same as the ResolveChartVersion method, but returns the chart repositoryy. func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*url.URL, *repo.ChartRepository, *getter.HttpGetter, error) { u, err := url.Parse(ref) if err != nil { diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index dd462ce5f..3c20e35e1 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -27,13 +27,15 @@ import ( "k8s.io/helm/pkg/version" ) -//httpGetter is the efault HTTP(/S) backend handler -type HttpGetter struct { +//HttpGetter is the efault HTTP(/S) backend handler +// TODO: change the name to HTTPGetter in Helm 3 +type HttpGetter struct { //nolint client *http.Client username string password string } +//SetCredentials sets the credentials for the getter func (g *HttpGetter) SetCredentials(username, password string) { g.username = username g.password = password diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index c76cc7913..bf03a68bb 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -196,9 +196,9 @@ func FindChartInRepoURL(repoURL, chartName, chartVersion, certFile, keyFile, caF return FindChartInAuthRepoURL(repoURL, "", "", chartName, chartVersion, certFile, keyFile, caFile, getters) } -// FindChartInRepoURL finds chart in chart repository pointed by repoURL -// without adding repo to repositories. -// Unlike the FindChartInRepoURL function, this function also receives credentials for the chart repository. +// FindChartInAuthRepoURL finds chart in chart repository pointed by repoURL +// without adding repo to repositories, like FindChartInRepoURL, +// but it also receives credentials for the chart repository. func FindChartInAuthRepoURL(repoURL, username, password, chartName, chartVersion, certFile, keyFile, caFile string, getters getter.Providers) (string, error) { // Download and write the index file to a temporary location diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index 194eace79..b5bba164e 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -31,7 +31,8 @@ import ( var ErrRepoOutOfDate = errors.New("repository file is out of date") // RepoFile represents the repositories.yaml file in $HELM_HOME -type RepoFile struct { +// TODO: change type name to File in Helm 3 to resolve linter warning +type RepoFile struct { // nolint APIVersion string `json:"apiVersion"` Generated time.Time `json:"generated"` Repositories []*Entry `json:"repositories"` diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 8a999feb7..8a16adf7e 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -50,7 +50,7 @@ func Parse(s string) (map[string]interface{}, error) { return vals, err } -// Parse parses a set line and forces a string value. +// ParseString parses a set line and forces a string value. // // A set line is of the form name1=value1,name2=value2 func ParseString(s string) (map[string]interface{}, error) { From c364b074eb18bb8dee579baf014e11915c07746b Mon Sep 17 00:00:00 2001 From: muhongwei <32874157+muhongwei@users.noreply.github.com> Date: Wed, 28 Mar 2018 04:06:48 +0800 Subject: [PATCH 128/449] fix 'mulitenant'->'multitenant' (#3755) --- docs/securing_installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index ffce5df75..5c420242e 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -71,7 +71,7 @@ Enabling this feature currently requires setting the `--storage=secret` flag in Because of the relative longevity of Helm, the Helm chart ecosystem evolved without the immediate concern for cluster-wide control, and especially in the developer space this makes complete sense. However, charts are a kind of package that not only installs containers you may or may not have validated yourself, but it may also install into more than one namespace. -As with all shared software, in a controlled or shared environment you must validate all software you install yourself _before_ you install it. If you have secured Tiller with TLS and have installed it with permissions to only one or a subset of namespaces, some charts may fail to install -- but in these environments, that is exactly what you want. If you need to use the chart, you may have to work with the creator or modify it yourself in order to use it securely in a mulitenant cluster with proper RBAC rules applied. The `helm template` command renders the chart locally and displays the output. +As with all shared software, in a controlled or shared environment you must validate all software you install yourself _before_ you install it. If you have secured Tiller with TLS and have installed it with permissions to only one or a subset of namespaces, some charts may fail to install -- but in these environments, that is exactly what you want. If you need to use the chart, you may have to work with the creator or modify it yourself in order to use it securely in a multitenant cluster with proper RBAC rules applied. The `helm template` command renders the chart locally and displays the output. Once vetted, you can use Helm's provenance tools to [ensure the provenance and integrity of charts](provenance.md) that you use. From 3a1086ba196b8ecb8dc4c2a0a133653319b9b281 Mon Sep 17 00:00:00 2001 From: muhongwei <32874157+muhongwei@users.noreply.github.com> Date: Wed, 28 Mar 2018 04:07:13 +0800 Subject: [PATCH 129/449] fix 'eveything' -> 'everything' (#3754) --- docs/release_checklist.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 9bb3ae00c..26506985c 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -197,7 +197,7 @@ From here on just repeat this process, continuously testing until you're happy w ## 6. Finalize the Release -When you're finally happy with the quality of a release candidate, you can move on and create the real thing. Double-check one last time to make sure eveything is in order, then finally push the release tag. +When you're finally happy with the quality of a release candidate, you can move on and create the real thing. Double-check one last time to make sure everything is in order, then finally push the release tag. ```shell git checkout $RELEASE_BRANCH_NAME From da276a08b6997a73f07339d5f8caad56f1644a08 Mon Sep 17 00:00:00 2001 From: Shredgar Date: Wed, 28 Mar 2018 10:12:56 +0200 Subject: [PATCH 130/449] Removed typos (additional plus signs) Removed typos (additional plus signs) --- docs/kubernetes_distros.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/kubernetes_distros.md b/docs/kubernetes_distros.md index c30bc87f3..8b80519ec 100644 --- a/docs/kubernetes_distros.md +++ b/docs/kubernetes_distros.md @@ -45,7 +45,7 @@ Helm works straightforward on OpenShift Online, OpenShift Dedicated, OpenShift C Helm Client and Helm Server (Tiller) are pre-installed with [Platform9 Managed Kubernetes](https://platform9.com/managed-kubernetes/?utm_source=helm_distro_notes). Platform9 provides access to all official Helm charts through the App Catalog UI and native Kubernetes CLI. Additional repositories can be manually added. Further details are available in this [Platform9 App Catalog article](https://platform9.com/support/deploying-kubernetes-apps-platform9-managed-kubernetes/?utm_source=helm_distro_notes). ## DC/OS -+ -+Helm (both client and server) has been tested and is working on Mesospheres DC/OS Kubernetes platform, and requires -+no additional configuration. + +Helm (both client and server) has been tested and is working on Mesospheres DC/OS 1.11 Kubernetes platform, and requires +no additional configuration. From 44fa549df0be521aaaced1dc01e7833a3b15235f Mon Sep 17 00:00:00 2001 From: fibonacci1729 Date: Wed, 28 Mar 2018 15:43:23 -0600 Subject: [PATCH 131/449] stream releases when listing --- cmd/helm/list.go | 18 +++++++++++------- pkg/helm/client.go | 18 ++++++++++++++++-- pkg/tiller/release_list.go | 17 +++++++++++------ 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 0219d60f2..4332ceb21 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -148,7 +148,7 @@ func (l *listCmd) run() error { return prettyError(err) } - if len(res.Releases) == 0 { + if len(res.GetReleases()) == 0 { return nil } @@ -239,12 +239,16 @@ func formatList(rels []*release.Release, colWidth uint) string { table.MaxColWidth = colWidth table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "NAMESPACE") for _, r := range rels { - c := fmt.Sprintf("%s-%s", r.Chart.Metadata.Name, r.Chart.Metadata.Version) - t := timeconv.String(r.Info.LastDeployed) - s := r.Info.Status.Code.String() - v := r.Version - n := r.Namespace - table.AddRow(r.Name, v, t, s, c, n) + md := r.GetChart().GetMetadata() + c := fmt.Sprintf("%s-%s", md.GetName(), md.GetVersion()) + t := "-" + if tspb := r.GetInfo().GetLastDeployed(); tspb != nil { + t = timeconv.String(tspb) + } + s := r.GetInfo().GetStatus().GetCode().String() + v := r.GetVersion() + n := r.GetNamespace() + table.AddRow(r.GetName(), v, t, s, c, n) } return table.String() } diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 2fb1e54e4..43e9f4daf 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -346,8 +346,22 @@ func (h *Client) list(ctx context.Context, req *rls.ListReleasesRequest) (*rls.L if err != nil { return nil, err } - - return s.Recv() + var resp *rls.ListReleasesResponse + for { + r, err := s.Recv() + if err == io.EOF { + break + } + if err != nil { + return nil, err + } + if resp == nil { + resp = r + continue + } + resp.Releases = append(resp.Releases, r.GetReleases()[0]) + } + return resp, nil } // Executes tiller.InstallRelease RPC. diff --git a/pkg/tiller/release_list.go b/pkg/tiller/release_list.go index 9ccc8a686..ec4dbfb39 100644 --- a/pkg/tiller/release_list.go +++ b/pkg/tiller/release_list.go @@ -108,13 +108,18 @@ func (s *ReleaseServer) ListReleases(req *services.ListReleasesRequest, stream s l = int64(len(rels)) } - res := &services.ListReleasesResponse{ - Next: next, - Count: l, - Total: total, - Releases: rels, + for i := 0; i < min(len(rels), int(req.Limit)); i++ { + res := &services.ListReleasesResponse{ + Next: next, + Count: l, + Total: total, + Releases: []*release.Release{rels[i]}, + } + if err := stream.Send(res); err != nil { + return err + } } - return stream.Send(res) + return nil } func filterByNamespace(namespace string, rels []*release.Release) ([]*release.Release, error) { From 75835c5fa4a5a3d849d7a5b4e1a88f9cda527456 Mon Sep 17 00:00:00 2001 From: Ryan Hartje Date: Wed, 28 Mar 2018 18:51:26 -0400 Subject: [PATCH 132/449] return a non 0 exit code when lint fails due to missing Chart.yaml --- cmd/helm/lint.go | 8 ++++++++ cmd/helm/lint_test.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/cmd/helm/lint.go b/cmd/helm/lint.go index 6e08f2747..e83026117 100644 --- a/cmd/helm/lint.go +++ b/cmd/helm/lint.go @@ -97,10 +97,14 @@ func (l *lintCmd) run() error { var total int var failures int + rc := 0 for _, path := range l.paths { if linter, err := lintChart(path, rvals, l.namespace, l.strict); err != nil { fmt.Println("==> Skipping", path) fmt.Println(err) + if err == errLintNoChart { + rc = 1 + } } else { fmt.Println("==> Linting", path) @@ -127,6 +131,10 @@ func (l *lintCmd) run() error { fmt.Fprintf(l.out, "%s, no failures\n", msg) + if rc != 0 { + os.Exit(rc) + } + return nil } diff --git a/cmd/helm/lint_test.go b/cmd/helm/lint_test.go index 7f045153c..973af9b63 100644 --- a/cmd/helm/lint_test.go +++ b/cmd/helm/lint_test.go @@ -28,6 +28,7 @@ var ( archivedChartPathWithHyphens = "testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz" invalidArchivedChartPath = "testdata/testcharts/invalidcompressedchart0.1.0.tgz" chartDirPath = "testdata/testcharts/decompressedchart/" + chartMissingManifest = "testdata/testcharts/chart-missing-manifest" ) func TestLintChart(t *testing.T) { @@ -46,4 +47,8 @@ func TestLintChart(t *testing.T) { if _, err := lintChart(invalidArchivedChartPath, values, namespace, strict); err == nil { t.Errorf("Expected a chart parsing error") } + + if _, err := lintChart(chartMissingManifest, values, namespace, strict); err == nil { + t.Errorf("Expected a chart parsing error") + } } From 372815a1b4231c6949f574fa3908653f8da71df5 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Wed, 28 Mar 2018 18:05:54 -0700 Subject: [PATCH 133/449] Fix tiller deployment on RBAC clusters Adds automountServiceAccountToken when a serviceAccount is specified. Prior to this, tiller falls back to contacting the KUBERNETES_SERVICE on localhost:8080 rather than respecting the cluster IP in the KUBERNETES_SERVICE_{HOST,PORT} environment variables. Fixes #3460, fixes #3467. --- cmd/helm/installer/install.go | 4 +++- cmd/helm/installer/install_test.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index fc81fa26b..a45179a48 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -176,6 +176,7 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { return nil, err } } + automountServiceAccountToken := opts.ServiceAccount != "" d := &v1beta1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Namespace: opts.Namespace, @@ -189,7 +190,8 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { Labels: labels, }, Spec: v1.PodSpec{ - ServiceAccountName: opts.ServiceAccount, + ServiceAccountName: opts.ServiceAccount, + AutomountServiceAccountToken: &automountServiceAccountToken, Containers: []v1.Container{ { Name: "tiller", diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index dbb7143e3..80219505a 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -96,6 +96,9 @@ func TestDeploymentManifestForServiceAccount(t *testing.T) { if got := d.Spec.Template.Spec.ServiceAccountName; got != tt.serviceAccount { t.Errorf("%s: expected service account value %q, got %q", tt.name, tt.serviceAccount, got) } + if got := *d.Spec.Template.Spec.AutomountServiceAccountToken; got != (tt.serviceAccount != "") { + t.Errorf("%s: unexpected automountServiceAccountToken = %t for serviceAccount %q", tt.name, got, tt.serviceAccount) + } } } From cd06b8583787beef2da0cdaefb9de916ad4eb8ab Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 29 Mar 2018 05:08:56 -0400 Subject: [PATCH 134/449] fix(helm): fix output leak from unit tests of helm create command Signed-off-by: Arash Deshmeh --- cmd/helm/create_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go index cb7b1d387..84ccebece 100644 --- a/cmd/helm/create_test.go +++ b/cmd/helm/create_test.go @@ -46,7 +46,7 @@ func TestCreateCmd(t *testing.T) { defer os.Chdir(pwd) // Run a create - cmd := newCreateCmd(os.Stdout) + cmd := newCreateCmd(ioutil.Discard) if err := cmd.RunE(cmd, []string{cname}); err != nil { t.Errorf("Failed to run create: %s", err) return @@ -117,7 +117,7 @@ func TestCreateStarterCmd(t *testing.T) { defer os.Chdir(pwd) // Run a create - cmd := newCreateCmd(os.Stdout) + cmd := newCreateCmd(ioutil.Discard) cmd.ParseFlags([]string{"--starter", "starterchart"}) if err := cmd.RunE(cmd, []string{cname}); err != nil { t.Errorf("Failed to run create: %s", err) From b530f552366263001cfc5bfc16de7ccedb161219 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Thu, 29 Mar 2018 23:43:04 +0800 Subject: [PATCH 135/449] Update rbac.md In the main text and paragraph title, "Tiller" and "tiller" are both used, It's better use same format. --- docs/rbac.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/rbac.md b/docs/rbac.md index bc138ceee..b48a85ad2 100644 --- a/docs/rbac.md +++ b/docs/rbac.md @@ -4,7 +4,7 @@ In Kubernetes, granting a role to an application-specific service account is a b Bitnami also has a fantastic guide for [configuring RBAC in your cluster](https://docs.bitnami.com/kubernetes/how-to/configure-rbac-in-your-kubernetes-cluster/) that takes you through RBAC basics. -This guide is for users who want to restrict tiller's capabilities to install resources to certain namespaces, or to grant a helm client running access to a tiller instance. +This guide is for users who want to restrict Tiller's capabilities to install resources to certain namespaces, or to grant a helm client running access to a Tiller instance. ## Tiller and Role-based Access Control @@ -51,7 +51,7 @@ clusterrolebinding "tiller" created $ helm init --service-account tiller ``` -### Example: Deploy tiller in a namespace, restricted to deploying resources only in that namespace +### Example: Deploy Tiller in a namespace, restricted to deploying resources only in that namespace In the example above, we gave Tiller admin access to the entire cluster. You are not at all required to give Tiller cluster-admin access for it to work. Instead of specifying a ClusterRole or a ClusterRoleBinding, you can specify a Role and RoleBinding to limit Tiller's scope to a particular namespace. @@ -62,7 +62,7 @@ $ kubectl create serviceaccount tiller --namespace tiller-world serviceaccount "tiller" created ``` -Define a Role that allows tiller to manage all resources in `tiller-world` like in `role-tiller.yaml`: +Define a Role that allows Tiller to manage all resources in `tiller-world` like in `role-tiller.yaml`: ```yaml kind: Role @@ -104,7 +104,7 @@ $ kubectl create -f rolebinding-tiller.yaml rolebinding "tiller-binding" created ``` -Afterwards you can run `helm init` to install tiller in the `tiller-world` namespace. +Afterwards you can run `helm init` to install Tiller in the `tiller-world` namespace. ```console $ helm init --service-account tiller --tiller-namespace tiller-world @@ -125,11 +125,11 @@ NAME READY STATUS RESTARTS AGE wayfaring-yak-alpine 0/1 ContainerCreating 0 0s ``` -### Example: Deploy tiller in a namespace, restricted to deploying resources in another namespace +### Example: Deploy Tiller in a namespace, restricted to deploying resources in another namespace In the example above, we gave Tiller admin access to the namespace it was deployed inside. Now, let's limit Tiller's scope to deploy resources in a different namespace! -For example, let's install tiller in the namespace `myorg-system` and allow tiller to deploy resources in the namespace `myorg-users`. +For example, let's install Tiller in the namespace `myorg-system` and allow Tiller to deploy resources in the namespace `myorg-users`. ```console $ kubectl create namespace myorg-system @@ -138,7 +138,7 @@ $ kubectl create serviceaccount tiller --namespace myorg-system serviceaccount "tiller" created ``` -Define a Role that allows tiller to manage all resources in `myorg-users` like in `role-tiller.yaml`: +Define a Role that allows Tiller to manage all resources in `myorg-users` like in `role-tiller.yaml`: ```yaml kind: Role @@ -180,7 +180,7 @@ $ kubectl create -f rolebinding-tiller.yaml rolebinding "tiller-binding" created ``` -We'll also need to grant tiller access to read configmaps in myorg-system so it can store release information. In `role-tiller-myorg-system.yaml`: +We'll also need to grant Tiller access to read configmaps in myorg-system so it can store release information. In `role-tiller-myorg-system.yaml`: ```yaml kind: Role @@ -224,11 +224,11 @@ rolebinding "tiller-binding" created ## Helm and Role-based Access Control -When running a helm client in a pod, in order for the helm client to talk to a tiller instance, it will need certain privileges to be granted. Specifically, the helm client will need to be able to create pods, forward ports and be able to list pods in the namespace where tiller is running (so it can find tiller). +When running a helm client in a pod, in order for the helm client to talk to a Tiller instance, it will need certain privileges to be granted. Specifically, the helm client will need to be able to create pods, forward ports and be able to list pods in the namespace where Tiller is running (so it can find Tiller). ### Example: Deploy Helm in a namespace, talking to Tiller in another namespace -In this example, we will assume tiller is running in a namespace called `tiller-world` and that the helm client is running in a namespace called `helm-world`. By default, tiller is running in the `kube-system` namespace. +In this example, we will assume Tiller is running in a namespace called `tiller-world` and that the helm client is running in a namespace called `helm-world`. By default, Tiller is running in the `kube-system` namespace. In `helm-user.yaml`: From 090709068ed9c3870836d483d038fe1e71d5e7df Mon Sep 17 00:00:00 2001 From: ReSearchITEng Date: Fri, 30 Mar 2018 09:59:06 +0300 Subject: [PATCH 136/449] closes #3795 closes #3795 --- scripts/get | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/get b/scripts/get index 3c4fb9f7d..943ca4158 100755 --- a/scripts/get +++ b/scripts/get @@ -184,7 +184,9 @@ help () { # cleanup temporary files to avoid https://github.com/kubernetes/helm/issues/2977 cleanup() { - rm -rf "$HELM_TMP_ROOT" + if [[ -d "${HELM_TMP_ROOT:-}" ]]; then + rm -rf "$HELM_TMP_ROOT" + fi } # Execution From 715bee2e839e5f5aab0a6d58d852c95f03081f67 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Sun, 1 Apr 2018 12:39:43 -0400 Subject: [PATCH 137/449] fix(helm) refactor release_testing unit tests to utilize runReleaseCases Signed-off-by: Arash Deshmeh --- cmd/helm/helm_test.go | 8 ++++-- cmd/helm/release_testing_test.go | 47 ++++++++------------------------ 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index c95caa75f..79b8c16f2 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -43,7 +43,10 @@ func runReleaseCases(t *testing.T, tests []releaseCase, rcmd releaseCmd) { var buf bytes.Buffer for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - c := &helm.FakeClient{Rels: tt.rels} + c := &helm.FakeClient{ + Rels: tt.rels, + Responses: tt.responses, + } cmd := rcmd(c, &buf) cmd.ParseFlags(tt.flags) err := cmd.RunE(cmd, tt.args) @@ -69,7 +72,8 @@ type releaseCase struct { err bool resp *release.Release // Rels are the available releases at the start of the test. - rels []*release.Release + rels []*release.Release + responses map[string]release.TestRun_Status } // tempHelmHome sets up a Helm Home in a temp dir. diff --git a/cmd/helm/release_testing_test.go b/cmd/helm/release_testing_test.go index 02ab1883c..b946746d0 100644 --- a/cmd/helm/release_testing_test.go +++ b/cmd/helm/release_testing_test.go @@ -17,55 +17,50 @@ limitations under the License. package main import ( - "bytes" + "io" "testing" + "github.com/spf13/cobra" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/release" ) func TestReleaseTesting(t *testing.T) { - tests := []struct { - name string - args []string - flags []string - responses map[string]release.TestRun_Status - fail bool - }{ + tests := []releaseCase{ { name: "basic test", args: []string{"example-release"}, flags: []string{}, responses: map[string]release.TestRun_Status{"PASSED: green lights everywhere": release.TestRun_SUCCESS}, - fail: false, + err: false, }, { name: "test failure", args: []string{"example-fail"}, flags: []string{}, responses: map[string]release.TestRun_Status{"FAILURE: red lights everywhere": release.TestRun_FAILURE}, - fail: true, + err: true, }, { name: "test unknown", args: []string{"example-unknown"}, flags: []string{}, responses: map[string]release.TestRun_Status{"UNKNOWN: yellow lights everywhere": release.TestRun_UNKNOWN}, - fail: false, + err: false, }, { name: "test error", args: []string{"example-error"}, flags: []string{}, responses: map[string]release.TestRun_Status{"ERROR: yellow lights everywhere": release.TestRun_FAILURE}, - fail: true, + err: true, }, { name: "test running", args: []string{"example-running"}, flags: []string{}, responses: map[string]release.TestRun_Status{"RUNNING: things are happpeningggg": release.TestRun_RUNNING}, - fail: false, + err: false, }, { name: "multiple tests example", @@ -78,29 +73,11 @@ func TestReleaseTesting(t *testing.T) { "FAILURE: good thing u checked :)": release.TestRun_FAILURE, "RUNNING: things are happpeningggg yet again": release.TestRun_RUNNING, "PASSED: feel free to party again": release.TestRun_SUCCESS}, - fail: true, + err: true, }, } - for _, tt := range tests { - c := &helm.FakeClient{Responses: tt.responses} - - buf := bytes.NewBuffer(nil) - cmd := newReleaseTestCmd(c, buf) - cmd.ParseFlags(tt.flags) - - err := cmd.RunE(cmd, tt.args) - if err == nil && tt.fail { - t.Errorf("%q did not fail but should have failed", tt.name) - } - - if err != nil { - if tt.fail { - continue - } else { - t.Errorf("%q reported error: %s", tt.name, err) - } - } - - } + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newReleaseTestCmd(c, out) + }) } From 10a54071697f2c03493efc75d475f239464ff685 Mon Sep 17 00:00:00 2001 From: fibonacci1729 Date: Fri, 30 Mar 2018 09:28:42 -0600 Subject: [PATCH 138/449] release list paritioning --- pkg/tiller/release_list.go | 51 ++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/pkg/tiller/release_list.go b/pkg/tiller/release_list.go index ec4dbfb39..72c21d97c 100644 --- a/pkg/tiller/release_list.go +++ b/pkg/tiller/release_list.go @@ -18,11 +18,11 @@ package tiller import ( "fmt" - "regexp" - + "github.com/golang/protobuf/proto" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" relutil "k8s.io/helm/pkg/releaseutil" + "regexp" ) // ListReleases lists the releases found by the server. @@ -107,21 +107,52 @@ func (s *ReleaseServer) ListReleases(req *services.ListReleasesRequest, stream s rels = rels[0:req.Limit] l = int64(len(rels)) } - - for i := 0; i < min(len(rels), int(req.Limit)); i++ { - res := &services.ListReleasesResponse{ - Next: next, - Count: l, - Total: total, - Releases: []*release.Release{rels[i]}, - } + res := &services.ListReleasesResponse{ + Next: next, + Count: l, + Total: total, + } + chunks := s.partition(rels[:min(len(rels), int(req.Limit))], maxMsgSize-proto.Size(res)) + for res.Releases = range chunks { if err := stream.Send(res); err != nil { + for range chunks { // drain + } return err } } return nil } +// partition packs releases into slices upto the capacity cap in bytes. +func (s *ReleaseServer) partition(rels []*release.Release, cap int) <-chan []*release.Release { + chunks := make(chan []*release.Release, 1) + go func() { + var ( + fill = 0 // fill is space available to fill + size int // size is size of a release + ) + var chunk []*release.Release + for _, rls := range rels { + if size = proto.Size(rls); size+fill > cap { + // Over-cap, push chunk onto channel to send over gRPC stream + s.Log("partitioned at %d with %d releases (cap=%d)", fill, len(chunk), cap) + chunks <- chunk + // reset paritioning state + chunk = chunk[:0] + fill = 0 + } + chunk = append(chunk, rls) + fill += size + } + if len(chunk) > 0 { + // send remaining if any + chunks <- chunk + } + close(chunks) + }() + return chunks +} + func filterByNamespace(namespace string, rels []*release.Release) ([]*release.Release, error) { matches := []*release.Release{} for _, r := range rels { From e90724d51bcc2b47c8491255f259e73f90fc2c1e Mon Sep 17 00:00:00 2001 From: Gijs Kunze Date: Tue, 3 Apr 2018 11:12:12 +0200 Subject: [PATCH 139/449] Removes unnecessary if block --- cmd/helm/install.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 55e34f405..d52dbc667 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -313,11 +313,6 @@ func mergeValues(dest map[string]interface{}, src map[string]interface{}) map[st dest[k] = v continue } - // If the key doesn't exist already, then just set the key to that value - if _, exists := dest[k]; !exists { - dest[k] = nextMap - continue - } // Edge case: If the key exists in the destination, but isn't a map destMap, isMap := dest[k].(map[string]interface{}) // If the source map has a map for this key, prefer it From 256d354eab89ad0fc46d7da3aa9751676b604b7e Mon Sep 17 00:00:00 2001 From: Timofey Kirillov Date: Wed, 21 Mar 2018 23:13:29 +0300 Subject: [PATCH 140/449] Add hook-delete-policy ReleaseServer unit tests Cover hook-succeeded, hook-failed and before-hook-creation hook delete policies. --- pkg/tiller/release_server_test.go | 464 ++++++++++++++++++++++++++++++ 1 file changed, 464 insertions(+) diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index d71e34bee..6c4d42e04 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -18,18 +18,25 @@ package tiller import ( "errors" + "fmt" "io" "io/ioutil" "os" "regexp" "testing" + "time" + "github.com/ghodss/yaml" "github.com/golang/protobuf/ptypes/timestamp" "golang.org/x/net/context" "google.golang.org/grpc/metadata" + "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" + "k8s.io/kubernetes/pkg/kubectl/resource" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/hooks" + "k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" @@ -345,3 +352,460 @@ func (rs mockRunReleaseTestServer) SetTrailer(m metadata.MD) {} func (rs mockRunReleaseTestServer) SendMsg(v interface{}) error { return nil } func (rs mockRunReleaseTestServer) RecvMsg(v interface{}) error { return nil } func (rs mockRunReleaseTestServer) Context() context.Context { return helm.NewContext() } + +type mockHooksManifest struct { + Metadata struct { + Name string + Annotations map[string]string + } +} +type mockHooksKubeClient struct { + Resources map[string]*mockHooksManifest +} + +var errResourceExists = errors.New("resource already exists") + +func (kc *mockHooksKubeClient) makeManifest(r io.Reader) (*mockHooksManifest, error) { + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, err + } + + manifest := &mockHooksManifest{} + err = yaml.Unmarshal(b, manifest) + if err != nil { + return nil, err + } + + return manifest, nil +} +func (kc *mockHooksKubeClient) Create(ns string, r io.Reader, timeout int64, shouldWait bool) error { + manifest, err := kc.makeManifest(r) + if err != nil { + return err + } + + if _, hasKey := kc.Resources[manifest.Metadata.Name]; hasKey { + return errResourceExists + } + + kc.Resources[manifest.Metadata.Name] = manifest + + return nil +} +func (kc *mockHooksKubeClient) Get(ns string, r io.Reader) (string, error) { + return "", nil +} +func (kc *mockHooksKubeClient) Delete(ns string, r io.Reader) error { + manifest, err := kc.makeManifest(r) + if err != nil { + return err + } + + delete(kc.Resources, manifest.Metadata.Name) + + return nil +} +func (kc *mockHooksKubeClient) WatchUntilReady(ns string, r io.Reader, timeout int64, shouldWait bool) error { + paramManifest, err := kc.makeManifest(r) + if err != nil { + return err + } + + manifest, hasManifest := kc.Resources[paramManifest.Metadata.Name] + if !hasManifest { + return fmt.Errorf("mockHooksKubeClient.WatchUntilReady: no such resource %s found", paramManifest.Metadata.Name) + } + + if manifest.Metadata.Annotations["mockHooksKubeClient/Emulate"] == "hook-failed" { + return fmt.Errorf("mockHooksKubeClient.WatchUntilReady: hook-failed") + } + + return nil +} +func (kc *mockHooksKubeClient) Update(ns string, currentReader, modifiedReader io.Reader, force bool, recreate bool, timeout int64, shouldWait bool) error { + return nil +} +func (kc *mockHooksKubeClient) Build(ns string, reader io.Reader) (kube.Result, error) { + return []*resource.Info{}, nil +} +func (kc *mockHooksKubeClient) BuildUnstructured(ns string, reader io.Reader) (kube.Result, error) { + return []*resource.Info{}, nil +} +func (kc *mockHooksKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { + return core.PodUnknown, nil +} + +func deletePolicyStub(kubeClient *mockHooksKubeClient) *ReleaseServer { + e := environment.New() + e.Releases = storage.Init(driver.NewMemory()) + e.KubeClient = kubeClient + + clientset := fake.NewSimpleClientset() + return &ReleaseServer{ + ReleaseModule: &LocalReleaseModule{ + clientset: clientset, + }, + env: e, + clientset: clientset, + Log: func(_ string, _ ...interface{}) {}, + } +} + +func deletePolicyHookStub(hookName string, extraAnnotations map[string]string, DeletePolicies []release.Hook_DeletePolicy) *release.Hook { + extraAnnotationsStr := "" + for k, v := range extraAnnotations { + extraAnnotationsStr += fmt.Sprintf(" \"%s\": \"%s\"\n", k, v) + } + + return &release.Hook{ + Name: hookName, + Kind: "Job", + Path: hookName, + Manifest: fmt.Sprintf(`kind: Job +metadata: + name: %s + annotations: + "helm.sh/hook": pre-install,pre-upgrade +%sdata: +name: value`, hookName, extraAnnotationsStr), + Events: []release.Hook_Event{ + release.Hook_PRE_INSTALL, + release.Hook_PRE_UPGRADE, + }, + DeletePolicies: DeletePolicies, + } +} + +func execHookShouldSucceed(rs *ReleaseServer, hook *release.Hook, releaseName string, namespace string, hookType string) error { + err := rs.execHook([]*release.Hook{hook}, releaseName, namespace, hookType, 600) + if err != nil { + return fmt.Errorf("expected hook %s to be successful: %s", hook.Name, err) + } + return nil +} + +func execHookShouldFail(rs *ReleaseServer, hook *release.Hook, releaseName string, namespace string, hookType string) error { + err := rs.execHook([]*release.Hook{hook}, releaseName, namespace, hookType, 600) + if err == nil { + return fmt.Errorf("expected hook %s to be failed", hook.Name) + } + return nil +} + +func execHookShouldFailWithError(rs *ReleaseServer, hook *release.Hook, releaseName string, namespace string, hookType string, expectedError error) error { + err := rs.execHook([]*release.Hook{hook}, releaseName, namespace, hookType, 600) + if err != expectedError { + return fmt.Errorf("expected hook %s to fail with error %v, got %v", hook.Name, expectedError, err) + } + return nil +} + +type deletePolicyContext struct { + ReleaseServer *ReleaseServer + ReleaseName string + Namespace string + HookName string + KubeClient *mockHooksKubeClient +} + +func newDeletePolicyContext() *deletePolicyContext { + kubeClient := &mockHooksKubeClient{ + Resources: make(map[string]*mockHooksManifest), + } + + return &deletePolicyContext{ + KubeClient: kubeClient, + ReleaseServer: deletePolicyStub(kubeClient), + ReleaseName: "flying-carp", + Namespace: "river", + HookName: "migration-job", + } +} + +func TestSuccessfulHookWithoutDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + hook := deletePolicyHookStub(ctx.HookName, nil, nil) + + err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be created by kube client", hook.Name) + } +} + +func TestFailedHookWithoutDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{"mockHooksKubeClient/Emulate": "hook-failed"}, + nil, + ) + + err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be created by kube client", hook.Name) + } +} + +func TestSuccessfulHookWithSucceededDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{"helm.sh/hook-delete-policy": "hook-succeeded"}, + []release.Hook_DeletePolicy{release.Hook_SUCCEEDED}, + ) + + err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; hasResource { + t.Errorf("expected resource %s to be unexisting after hook succeeded", hook.Name) + } +} + +func TestSuccessfulHookWithFailedDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{"helm.sh/hook-delete-policy": "hook-failed"}, + []release.Hook_DeletePolicy{release.Hook_FAILED}, + ) + + err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after hook succeeded", hook.Name) + } +} + +func TestFailedHookWithSucceededDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{ + "mockHooksKubeClient/Emulate": "hook-failed", + "helm.sh/hook-delete-policy": "hook-succeeded", + }, + []release.Hook_DeletePolicy{release.Hook_SUCCEEDED}, + ) + + err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after hook failed", hook.Name) + } +} + +func TestFailedHookWithFailedDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{ + "mockHooksKubeClient/Emulate": "hook-failed", + "helm.sh/hook-delete-policy": "hook-failed", + }, + []release.Hook_DeletePolicy{release.Hook_FAILED}, + ) + + err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; hasResource { + t.Errorf("expected resource %s to be unexisting after hook failed", hook.Name) + } +} + +func TestSuccessfulHookWithSuccededOrFailedDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{ + "helm.sh/hook-delete-policy": "hook-succeeded,hook-failed", + }, + []release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_FAILED}, + ) + + err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; hasResource { + t.Errorf("expected resource %s to be unexisting after hook succeeded", hook.Name) + } +} + +func TestFailedHookWithSuccededOrFailedDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{ + "mockHooksKubeClient/Emulate": "hook-failed", + "helm.sh/hook-delete-policy": "hook-succeeded,hook-failed", + }, + []release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_FAILED}, + ) + + err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; hasResource { + t.Errorf("expected resource %s to be unexisting after hook failed", hook.Name) + } +} + +func TestHookAlreadyExists(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, nil, nil) + + err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after hook succeeded", hook.Name) + } + + err = execHookShouldFailWithError(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreUpgrade, errResourceExists) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after already exists error", hook.Name) + } +} + +func TestHookDeletingWithBeforeHookCreationDeletePolicy(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{"helm.sh/hook-delete-policy": "before-hook-creation"}, + []release.Hook_DeletePolicy{release.Hook_BEFORE_HOOK_CREATION}, + ) + + err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after hook succeeded", hook.Name) + } + + err = execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreUpgrade) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after hook succeeded", hook.Name) + } +} + +func TestSuccessfulHookWithMixedDeletePolicies(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{ + "helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation", + }, + []release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION}, + ) + + err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; hasResource { + t.Errorf("expected resource %s to be unexisting after hook succeeded", hook.Name) + } + + err = execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreUpgrade) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; hasResource { + t.Errorf("expected resource %s to be unexisting after hook succeeded", hook.Name) + } +} + +func TestFailedHookWithMixedDeletePolicies(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{ + "mockHooksKubeClient/Emulate": "hook-failed", + "helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation", + }, + []release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION}, + ) + + err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after hook failed", hook.Name) + } + + err = execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreUpgrade) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after hook failed", hook.Name) + } +} + +func TestFailedThenSuccessfulHookWithMixedDeletePolicies(t *testing.T) { + ctx := newDeletePolicyContext() + + hook := deletePolicyHookStub(ctx.HookName, + map[string]string{ + "mockHooksKubeClient/Emulate": "hook-failed", + "helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation", + }, + []release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION}, + ) + + err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; !hasResource { + t.Errorf("expected resource %s to be existing after hook failed", hook.Name) + } + + hook = deletePolicyHookStub(ctx.HookName, + map[string]string{ + "helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation", + }, + []release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION}, + ) + + err = execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreUpgrade) + if err != nil { + t.Error(err) + } + + if _, hasResource := ctx.KubeClient.Resources[hook.Name]; hasResource { + t.Errorf("expected resource %s to be unexisting after hook succeeded", hook.Name) + } +} From 6430f90c52f3c94aa01c44170798714f434ee76b Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 3 Apr 2018 08:13:18 -0700 Subject: [PATCH 141/449] import client auth plugins --- cmd/helm/helm.go | 2 ++ glide.lock | 58 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 497565209..f19cb3c50 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -30,6 +30,8 @@ import ( "k8s.io/client-go/rest" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + // Import to initialize client auth plugins. + _ "k8s.io/client-go/plugin/pkg/client/auth" "k8s.io/helm/pkg/helm" helm_env "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/portforwarder" diff --git a/glide.lock b/glide.lock index 068f86372..6c54c927c 100644 --- a/glide.lock +++ b/glide.lock @@ -1,6 +1,11 @@ hash: 6837936360d447b64aa7a09d3c89c18ac5540b009a57fc4d3227af299bf40268 -updated: 2018-03-27T05:13:24.967040785Z +updated: 2018-04-03T08:17:14.801847688-07:00 imports: +- name: cloud.google.com/go + version: 3b1ae45394a234c385be014e9a488f2bb6eef821 + subpackages: + - compute/metadata + - internal - name: github.com/aokoli/goutils version: 9c37978a95bd5c709a15883b6242714ea6709e64 - name: github.com/asaskevich/govalidator @@ -9,6 +14,13 @@ imports: version: 19f72df4d05d31cbe1c56bfc8045c96babff6c7e subpackages: - winterm +- name: github.com/Azure/go-autorest + version: d4e6b95c12a08b4de2d48b45d5b4d594e5d32fab + subpackages: + - autorest + - autorest/adal + - autorest/azure + - autorest/date - name: github.com/beorn7/perks version: 3ac7bf7a47d159a033b107610db8a1b6575507a4 subpackages: @@ -23,6 +35,8 @@ imports: version: 782f4967f2dc4564575ca782fe2d04090b5faca8 subpackages: - spew +- name: github.com/dgrijalva/jwt-go + version: 01aeca54ebda6e0fbfafd0a524d234159c05ec20 - name: github.com/docker/distribution version: edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c subpackages: @@ -121,12 +135,23 @@ imports: version: 7d79101e329e5a3adf994758c578dab82b90c017 - name: github.com/google/gofuzz version: 44d81051d367757e1c7c6a5a86423ece9afcf63c +- name: github.com/google/uuid + version: 064e2069ce9c359c118179501254f67d7d37ba24 - name: github.com/googleapis/gnostic version: 0c5108395e2debce0d731cf0287ddf7242066aba subpackages: - OpenAPIv2 - compiler - extensions +- name: github.com/gophercloud/gophercloud + version: 6da026c32e2d622cc242d32984259c77237aefe1 + subpackages: + - openstack + - openstack/identity/v2/tenants + - openstack/identity/v2/tokens + - openstack/identity/v3/tokens + - openstack/utils + - pagination - name: github.com/gosuri/uitable version: 36ee7e946282a3fb1cfecd476ddc9b35d8847e42 subpackages: @@ -163,7 +188,7 @@ imports: - name: github.com/Masterminds/semver version: 517734cc7d6470c0d07130e40fd40bdeb9bcd3fd - name: github.com/Masterminds/sprig - version: b217b9c388de2cacde4354c536e520c52c055563 + version: 6b2a58267f6a8b1dc8e2eb5519b984008fa85e8c - name: github.com/Masterminds/vcs version: 3084677c2c188840777bff30054f2b553729d329 - name: github.com/mattn/go-runewidth @@ -210,8 +235,6 @@ imports: version: 5bd2802263f21d8788851d5305584c82a5c75d7e - name: github.com/russross/blackfriday version: 300106c228d52c8941d4b3de6054a6062a86dda3 -- name: github.com/satori/go.uuid - version: f58768cc1a7a7e77a3bd49e98cdd21419399b6a3 - name: github.com/shurcooL/sanitized_anchor_name version: 10ef21a441db47d8b13ebcc5fd2310f636973c77 - name: github.com/sirupsen/logrus @@ -244,12 +267,20 @@ imports: version: 1c05540f6879653db88113bc4a2b70aec4bd491f subpackages: - context + - context/ctxhttp - http2 - http2/hpack - idna - internal/timeseries - lex/httplex - trace +- name: golang.org/x/oauth2 + version: a6bd8cefa1811bd24b86f8902872e4e8225f74c4 + subpackages: + - google + - internal + - jws + - jwt - name: golang.org/x/sys version: 43eea11bc92608addb41b8a406b0407495c106f6 subpackages: @@ -278,6 +309,18 @@ imports: version: f51c12702a4d776e4c1fa9b0fabab841babae631 subpackages: - rate +- name: google.golang.org/appengine + version: 12d5545dc1cfa6047a286d5e853841b6471f4c19 + subpackages: + - internal + - internal/app_identity + - internal/base + - internal/datastore + - internal/log + - internal/modules + - internal/remote_api + - internal/urlfetch + - urlfetch - name: google.golang.org/genproto version: 09f6ed296fc66555a25fe4ce95173148778dfa85 subpackages: @@ -550,7 +593,12 @@ imports: - pkg/apis/clientauthentication - pkg/apis/clientauthentication/v1alpha1 - pkg/version + - plugin/pkg/client/auth + - plugin/pkg/client/auth/azure - plugin/pkg/client/auth/exec + - plugin/pkg/client/auth/gcp + - plugin/pkg/client/auth/oidc + - plugin/pkg/client/auth/openstack - rest - rest/fake - rest/watch @@ -593,7 +641,7 @@ imports: - pkg/util/proto - pkg/util/proto/validation - name: k8s.io/kubernetes - version: 923d8441db527e908cd7d266c4a9d18daa596d4c + version: a22f9fd34871d9dc9e5db2c02c713821d18ab2cd subpackages: - pkg/api/events - pkg/api/legacyscheme From d83ca8acc99ddd15c88e096898020cbf5ca890d1 Mon Sep 17 00:00:00 2001 From: Zack Williams Date: Tue, 3 Apr 2018 13:10:56 -0700 Subject: [PATCH 142/449] Fix #3822 --- pkg/chartutil/create.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 319a75e2f..07bd11449 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -59,6 +59,9 @@ image: tag: stable pullPolicy: IfNotPresent +nameOverride: "" +fullnameOverride: "" + service: type: ClusterIP port: 80 From 79bb0285f74baba5b11bffbc30c5e79a7212dd1e Mon Sep 17 00:00:00 2001 From: AdamDang Date: Wed, 4 Apr 2018 07:07:55 +0800 Subject: [PATCH 143/449] Typo fix helm->Helm --- docs/rbac.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/rbac.md b/docs/rbac.md index b48a85ad2..2a3dfe7a0 100644 --- a/docs/rbac.md +++ b/docs/rbac.md @@ -4,11 +4,11 @@ In Kubernetes, granting a role to an application-specific service account is a b Bitnami also has a fantastic guide for [configuring RBAC in your cluster](https://docs.bitnami.com/kubernetes/how-to/configure-rbac-in-your-kubernetes-cluster/) that takes you through RBAC basics. -This guide is for users who want to restrict Tiller's capabilities to install resources to certain namespaces, or to grant a helm client running access to a Tiller instance. +This guide is for users who want to restrict Tiller's capabilities to install resources to certain namespaces, or to grant a Helm client running access to a Tiller instance. ## Tiller and Role-based Access Control -You can add a service account to Tiller using the `--service-account ` flag while you're configuring helm. As a prerequisite, you'll have to create a role binding which specifies a [role](https://kubernetes.io/docs/admin/authorization/rbac/#role-and-clusterrole) and a [service account](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/) name that have been set up in advance. +You can add a service account to Tiller using the `--service-account ` flag while you're configuring Helm. As a prerequisite, you'll have to create a role binding which specifies a [role](https://kubernetes.io/docs/admin/authorization/rbac/#role-and-clusterrole) and a [service account](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/) name that have been set up in advance. Once you have satisfied the pre-requisite and have a service account with the correct permissions, you'll run a command like this: `helm init --service-account ` @@ -110,7 +110,7 @@ Afterwards you can run `helm init` to install Tiller in the `tiller-world` names $ helm init --service-account tiller --tiller-namespace tiller-world $HELM_HOME has been configured at /Users/awesome-user/.helm. -Tiller (the helm server side component) has been installed into your Kubernetes Cluster. +Tiller (the Helm server side component) has been installed into your Kubernetes Cluster. Happy Helming! $ helm install nginx --tiller-namespace tiller-world --namespace tiller-world @@ -224,11 +224,11 @@ rolebinding "tiller-binding" created ## Helm and Role-based Access Control -When running a helm client in a pod, in order for the helm client to talk to a Tiller instance, it will need certain privileges to be granted. Specifically, the helm client will need to be able to create pods, forward ports and be able to list pods in the namespace where Tiller is running (so it can find Tiller). +When running a Helm client in a pod, in order for the Helm client to talk to a Tiller instance, it will need certain privileges to be granted. Specifically, the Helm client will need to be able to create pods, forward ports and be able to list pods in the namespace where Tiller is running (so it can find Tiller). ### Example: Deploy Helm in a namespace, talking to Tiller in another namespace -In this example, we will assume Tiller is running in a namespace called `tiller-world` and that the helm client is running in a namespace called `helm-world`. By default, Tiller is running in the `kube-system` namespace. +In this example, we will assume Tiller is running in a namespace called `tiller-world` and that the Helm client is running in a namespace called `helm-world`. By default, Tiller is running in the `kube-system` namespace. In `helm-user.yaml`: From 33f3238cd89ad5e95d813ed0da2b53b813354a0d Mon Sep 17 00:00:00 2001 From: Ryan Hartje Date: Tue, 3 Apr 2018 20:17:54 -0400 Subject: [PATCH 144/449] using existing mechanism to flag for failures --- cmd/helm/lint.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/helm/lint.go b/cmd/helm/lint.go index e83026117..63f11c062 100644 --- a/cmd/helm/lint.go +++ b/cmd/helm/lint.go @@ -97,13 +97,12 @@ func (l *lintCmd) run() error { var total int var failures int - rc := 0 for _, path := range l.paths { if linter, err := lintChart(path, rvals, l.namespace, l.strict); err != nil { fmt.Println("==> Skipping", path) fmt.Println(err) if err == errLintNoChart { - rc = 1 + failures = failures + 1 } } else { fmt.Println("==> Linting", path) @@ -131,10 +130,6 @@ func (l *lintCmd) run() error { fmt.Fprintf(l.out, "%s, no failures\n", msg) - if rc != 0 { - os.Exit(rc) - } - return nil } From 32d4070e6abbcd947e9bf8c277a057a2972e498a Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Wed, 4 Apr 2018 09:17:57 +0100 Subject: [PATCH 145/449] Switch flag to update existing record --- pkg/tiller/release_rollback.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tiller/release_rollback.go b/pkg/tiller/release_rollback.go index fe9a6a032..fa3d943f4 100644 --- a/pkg/tiller/release_rollback.go +++ b/pkg/tiller/release_rollback.go @@ -135,7 +135,7 @@ func (s *ReleaseServer) performRollback(currentRelease, targetRelease *release.R targetRelease.Info.Status.Code = release.Status_FAILED targetRelease.Info.Description = msg s.recordRelease(currentRelease, true) - s.recordRelease(targetRelease, false) + s.recordRelease(targetRelease, true) return res, err } From 071c024108559825f4d439f624625a093ac5db89 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Wed, 4 Apr 2018 12:04:27 -0400 Subject: [PATCH 146/449] ref(cmd/helm): show grpc error msg from prettyError --- cmd/helm/helm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 497565209..86d7696fb 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -214,7 +214,7 @@ func prettyError(err error) error { } // If it's grpc's error, make it more user-friendly. if s, ok := status.FromError(err); ok { - return s.Err() + return fmt.Errorf(s.Message()) } // Else return the original error. return err From 5b14ce094e8fcfbbcd1301c5ef9b6a5893fb5b77 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Wed, 4 Apr 2018 15:44:28 -0400 Subject: [PATCH 147/449] fix(pkg/tiller): reuseValues combines all prev val Resolves #3655 We were seeing that when running helm upgrade with the reuse-values flag enabled that you could end up in the position where overrides a.k.a computed values from previous revisions were not being saved on the updated revision. This left us in a weird position where some computed values would disappear mysteriously in the abyss. That happened because computed values from previous revisions weren't merged with the new computed values every time the reuse-values flag was used. This PR merges computed values from the previous revisions so you don't end up in that kind of conundrum. --- pkg/tiller/release_server.go | 16 +++++ pkg/tiller/release_update_test.go | 106 +++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 2 deletions(-) diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index a96c64938..c72107026 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -25,6 +25,7 @@ import ( "strings" "github.com/technosophos/moniker" + "gopkg.in/yaml.v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/discovery" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" @@ -135,7 +136,22 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current if err != nil { return err } + + // merge new values with current + req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw req.Chart.Values = &chart.Config{Raw: nv} + + // yaml unmarshal and marshal to remove duplicate keys + y := map[string]interface{}{} + if err := yaml.Unmarshal([]byte(req.Values.Raw), &y); err != nil { + return err + } + data, err := yaml.Marshal(y) + if err != nil { + return err + } + + req.Values.Raw = string(data) return nil } diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 642952f19..0189201d1 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -17,6 +17,7 @@ limitations under the License. package tiller import ( + "fmt" "strings" "testing" @@ -128,6 +129,107 @@ func TestUpdateRelease_ResetValues(t *testing.T) { } } +// This is a regression test for bug found in issue #3655 +func TestUpdateRelease_ComplexReuseValues(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + + installReq := &services.InstallReleaseRequest{ + Namespace: "spaced", + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + {Name: "templates/hooks", Data: []byte(manifestWithHook)}, + }, + Values: &chart.Config{Raw: "defaultFoo: defaultBar"}, + }, + Values: &chart.Config{Raw: "foo: bar"}, + } + + fmt.Println("Running Install release with foo: bar override") + installResp, err := rs.InstallRelease(c, installReq) + if err != nil { + t.Fatal(err) + } + + rel := installResp.Release + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + {Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)}, + }, + Values: &chart.Config{Raw: "defaultFoo: defaultBar"}, + }, + } + + fmt.Println("Running Update release with no overrides and no reuse-values flag") + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + + expect := "foo: bar" + if res.Release.Config != nil && res.Release.Config.Raw != expect { + t.Errorf("Expected chart values to be %q, got %q", expect, res.Release.Config.Raw) + } + + rel = res.Release + req = &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + {Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)}, + }, + Values: &chart.Config{Raw: "defaultFoo: defaultBar"}, + }, + Values: &chart.Config{Raw: "foo2: bar2"}, + ReuseValues: true, + } + + fmt.Println("Running Update release with foo2: bar2 override and reuse-values") + res, err = rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + + // This should have the newly-passed overrides. + expect = "foo: bar\nfoo2: bar2\n" + if res.Release.Config != nil && res.Release.Config.Raw != expect { + t.Errorf("Expected request config to be %q, got %q", expect, res.Release.Config.Raw) + } + + rel = res.Release + req = &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + {Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)}, + }, + Values: &chart.Config{Raw: "defaultFoo: defaultBar"}, + }, + Values: &chart.Config{Raw: "foo: baz"}, + ReuseValues: true, + } + + fmt.Println("Running Update release with foo=baz override with reuse-values flag") + res, err = rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + expect = "foo: baz\nfoo2: bar2\n" + if res.Release.Config != nil && res.Release.Config.Raw != expect { + t.Errorf("Expected chart values to be %q, got %q", expect, res.Release.Config.Raw) + } +} + func TestUpdateRelease_ReuseValues(t *testing.T) { c := helm.NewContext() rs := rsFixture() @@ -157,8 +259,8 @@ func TestUpdateRelease_ReuseValues(t *testing.T) { if res.Release.Chart.Values != nil && res.Release.Chart.Values.Raw != expect { t.Errorf("Expected chart values to be %q, got %q", expect, res.Release.Chart.Values.Raw) } - // This should have the newly-passed overrides. - expect = "name2: val2" + // This should have the newly-passed overrides and any other computed values. `name: value` comes from release Config via releaseStub() + expect = "name: value\nname2: val2" if res.Release.Config != nil && res.Release.Config.Raw != expect { t.Errorf("Expected request config to be %q, got %q", expect, res.Release.Config.Raw) } From 8455b12869ccc483f2b165184a1b765045031562 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Wed, 4 Apr 2018 15:54:12 -0400 Subject: [PATCH 148/449] ref(pkg/tiller): clarify reuseValues comment --- pkg/tiller/release_update.go | 2 +- pkg/tiller/release_update_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index cb8b57792..6f5d37331 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -80,7 +80,7 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele return nil, nil, err } - // If new values were not supplied in the upgrade, re-use the existing values. + // determine if values will be reused if err := s.reuseValues(req, currentRelease); err != nil { return nil, nil, err } diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 0189201d1..a1b9a4bff 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -260,7 +260,7 @@ func TestUpdateRelease_ReuseValues(t *testing.T) { t.Errorf("Expected chart values to be %q, got %q", expect, res.Release.Chart.Values.Raw) } // This should have the newly-passed overrides and any other computed values. `name: value` comes from release Config via releaseStub() - expect = "name: value\nname2: val2" + expect = "name: value\nname2: val2\n" if res.Release.Config != nil && res.Release.Config.Raw != expect { t.Errorf("Expected request config to be %q, got %q", expect, res.Release.Config.Raw) } From d86bd2468ea866f4f131e80dfc1142cf71c5fc4e Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Mon, 19 Mar 2018 12:35:42 -0400 Subject: [PATCH 149/449] ref(cmd/upgrade): update reuse-values flag descrip helps clarify behavior. See #3655 --- cmd/helm/upgrade.go | 2 +- docs/helm/helm_upgrade.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 125796762..66c4a3657 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -130,7 +130,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&upgrade.version, "version", "", "specify the exact chart version to use. If this is not specified, the latest version is used") f.Int64Var(&upgrade.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&upgrade.resetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart") - f.BoolVar(&upgrade.reuseValues, "reuse-values", false, "when upgrading, reuse the last release's values, and merge in any new values. If '--reset-values' is specified, this is ignored.") + f.BoolVar(&upgrade.reuseValues, "reuse-values", false, "when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored.") f.BoolVar(&upgrade.wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout") f.StringVar(&upgrade.repoURL, "repo", "", "chart repository url where to locate the requested chart") f.StringVar(&upgrade.username, "username", "", "chart repository username where to locate the requested chart") diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 7ada6025f..c2882265e 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -51,7 +51,7 @@ helm upgrade [RELEASE] [CHART] --recreate-pods performs pods restart for the resource if applicable --repo string chart repository url where to locate the requested chart --reset-values when upgrading, reset the values to the ones built into the chart - --reuse-values when upgrading, reuse the last release's values, and merge in any new values. If '--reset-values' is specified, this is ignored. + --reuse-values when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored. --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) @@ -81,4 +81,4 @@ helm upgrade [RELEASE] [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 20-Mar-2018 +###### Auto generated by spf13/cobra on 4-Apr-2018 From 149601916c132fe7f2b814de99fb1d96daa4f2d7 Mon Sep 17 00:00:00 2001 From: Daryl Walleck Date: Wed, 4 Apr 2018 18:43:03 -0500 Subject: [PATCH 150/449] Fixes typos introduced in #3540. Closes #3823 --- docs/charts_hooks.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/charts_hooks.md b/docs/charts_hooks.md index af6d0f4f9..4142f2ce0 100644 --- a/docs/charts_hooks.md +++ b/docs/charts_hooks.md @@ -191,8 +191,8 @@ When helm release being updated it is possible, that hook resource already exist One might choose `"helm.sh/hook-delete-policy": "before-hook-creation"` over `"helm.sh/hook-delete-policy": "hook-succeeded,hook-failed"` because: -* It is convinient to keep failed hook job resource in kubernetes for example for manual debug. +* It is convenient to keep failed hook job resource in kubernetes for example for manual debug. * It may be necessary to keep succeeded hook resource in kubernetes for some reason. -* At the same time it is not desireable to do manual resource deletion before helm release upgrade. +* At the same time it is not desirable to do manual resource deletion before helm release upgrade. -`"helm.sh/hook-delete-policy": "before-hook-creation"` annotation on hook causes tiller to remove the hook from previous release if there is one before the new hook is launched and can be used with another policies. +`"helm.sh/hook-delete-policy": "before-hook-creation"` annotation on hook causes tiller to remove the hook from previous release if there is one before the new hook is launched and can be used with another policy. From bb12c12b17522cebfa3a33b32ba13f96243aefe0 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 5 Apr 2018 08:06:47 -0700 Subject: [PATCH 151/449] rename TPR to CRD --- .../custom_resource_definitions.md | 37 ++++++++++++++++++ .../third_party_resources.md | 38 ------------------- 2 files changed, 37 insertions(+), 38 deletions(-) create mode 100644 docs/chart_best_practices/custom_resource_definitions.md delete mode 100644 docs/chart_best_practices/third_party_resources.md diff --git a/docs/chart_best_practices/custom_resource_definitions.md b/docs/chart_best_practices/custom_resource_definitions.md new file mode 100644 index 000000000..96690dc9b --- /dev/null +++ b/docs/chart_best_practices/custom_resource_definitions.md @@ -0,0 +1,37 @@ +# Custom Resource Definitions + +This section of the Best Practices Guide deals with creating and using Custom Resource Definition +objects. + +When working with Custom Resource Definitions (CRDs), it is important to distinguish +two different pieces: + +- There is a declaration of a CRD. This is the YAML file that has the kind `CustomResourceDefinition` +- Then there are resources that _use_ the CRD. Say a CRD defines `foo.example.com/v1`. Any resource + that has `apiVersion: example.com/v1` and kind `Foo` is a resource that uses the CRD. + +## Install a CRD Declaration Before Using the Resource + +Helm is optimized to load as many resources into Kubernetes as fast as possible. +By design, Kubernetes can take an entire set of manifests and bring them all +online (this is called the reconciliation loop). + +But there's a difference with CRDs. + +For a CRD, the declaration must be registered before any resources of that CRDs +kind(s) can be used. And the registration process sometimes takes a few seconds. + +### Method 1: Separate Charts + +One way to do this is to put the CRD definition in one chart, and then put any +resources that use that CRD in _another_ chart. + +In this method, each chart must be installed separately. + +### Method 2: Pre-install Hooks + +To package the two together, add a `pre-install` hook to the CRD definition so +that it is fully installed before the rest of the chart is executed. + +Note that if you create the CRD with a `pre-install` hook, that CRD definition +will not be deleted when `helm delete` is run. diff --git a/docs/chart_best_practices/third_party_resources.md b/docs/chart_best_practices/third_party_resources.md deleted file mode 100644 index cb0fcc754..000000000 --- a/docs/chart_best_practices/third_party_resources.md +++ /dev/null @@ -1,38 +0,0 @@ -# Third Party Resources - -This section of the Best Practices Guide deals with creating and using Third Party Resource -objects. - -When working with Third Party Resources (TPRs), it is important to distinguish -two different pieces: - -- There is a declaration of a TPR. This is the YAML file that has the kind `ThirdPartyResource` -- Then there are resources that _use_ the TPR. Say a TPR defines `foo.example.com/v1`. Any resource - that has `apiVersion: example.com/v1` and kind `Foo` is a resource that uses the - TPR. - -## Install a TPR Declaration Before Using the Resource - -Helm is optimized to load as many resources into Kubernetes as fast as possible. -By design, Kubernetes can take an entire set of manifests and bring them all -online (this is called the reconciliation loop). - -But there's a difference with TPRs. - -For a TPR, the declaration must be registered before any resources of that TPRs -kind(s) can be used. And the registration process sometimes takes a few seconds. - -### Method 1: Separate Charts - -One way to do this is to put the TPR definition in one chart, and then put any -resources that use that TPR in _another_ chart. - -In this method, each chart must be installed separately. - -### Method 2: Pre-install Hooks - -To package the two together, add a `pre-install` hook to the TPR definition so -that it is fully installed before the rest of the chart is executed. - -Note that if you create the TPR with a `pre-install` hook, that TPR definition -will not be deleted when `helm delete` is run. From c650a2ca9d1383a98da0ee1ea5a49ba75851a9e1 Mon Sep 17 00:00:00 2001 From: Stefan Henseler Date: Thu, 5 Apr 2018 23:51:21 +0200 Subject: [PATCH 152/449] Updates readme with choco install command --- README.md | 6 +++++- docs/install.md | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7622fafc8..fb2e16bce 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,11 @@ Binary downloads of the Helm client can be found at the following links: - [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-windows-amd64.tar.gz) Unpack the `helm` binary and add it to your PATH and you are good to go! -macOS/[homebrew](https://brew.sh/) users can also use `brew install kubernetes-helm`. + +If you want to use a package manager: + +- macOS/[homebrew](https://brew.sh/) users can use `brew install kubernetes-helm`. +- Windows/[chocolatey](https://chocolatey.org/) users can use `choco install kubernetes-helm`. To rapidly get Helm up and running, start with the [Quick Start Guide](https://docs.helm.sh/using_helm/#quickstart-guide). diff --git a/docs/install.md b/docs/install.md index 78b1a53b6..6ca13c90a 100755 --- a/docs/install.md +++ b/docs/install.md @@ -36,6 +36,15 @@ brew install kubernetes-helm (Note: There is also a formula for emacs-helm, which is a different project.) +### From Chocolatey (Windows) + +Members of the Kubernetes community have contributed a [Helm package](https://chocolatey.org/packages/kubernetes-helm) build to +[Chocolatey](https://chocolatey.org/). This package is generally up to date. + +``` +choco install kubernetes-helm +``` + ## From Script Helm now has an installer script that will automatically grab the latest version From 3b30168569419a33227f0a44a60f7d18fd8206e6 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 6 Apr 2018 00:40:43 +0200 Subject: [PATCH 153/449] toYaml - Fixes #3410 - trailing \n issue `toYaml` utilized by `.Files` was introducing a new line. It is an issue since the new line is part of a functions output, it can't be whitespace chomped away so it would require a `trimSuffix "\n"` pipe. This commit trims one trailing `\n` from the toYaml output. --- pkg/chartutil/files.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index a711a3366..ced8ce15a 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -175,7 +175,7 @@ func ToYaml(v interface{}) string { // Swallow errors inside of a template. return "" } - return string(data) + return strings.TrimSuffix(string(data), "\n") } // FromYaml converts a YAML document into a map[string]interface{}. From 8f64ee331be72346671796fb6eff18637481274b Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 6 Apr 2018 00:41:14 +0200 Subject: [PATCH 154/449] toYaml - Fixes #3470 - trailing \n issue `toYaml` was introducing a new line. It is an issue since the new line is part of a functions output, it can't be whitespace chomped away so it would require a `trimSuffix "\n"` pipe. This commit trims one trailing `\n` from the toYaml output. --- pkg/strvals/parser.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 8a16adf7e..aa3d15904 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -36,7 +36,7 @@ func ToYAML(s string) (string, error) { return "", err } d, err := yaml.Marshal(m) - return string(d), err + return strings.TrimSuffix(string(d), "\n"), err } // Parse parses a set line. From 7bf8fa1a40053e5faf0affb5b209cd1bf4233bd2 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 6 Apr 2018 00:59:22 +0200 Subject: [PATCH 155/449] Updated tests for PR #3837 --- pkg/chartutil/files_test.go | 8 ++++---- pkg/strvals/parser_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/chartutil/files_test.go b/pkg/chartutil/files_test.go index 731c82e6f..5cec35883 100644 --- a/pkg/chartutil/files_test.go +++ b/pkg/chartutil/files_test.go @@ -72,10 +72,10 @@ func TestToConfig(t *testing.T) { f := NewFiles(getTestFiles()) out := f.Glob("**/captain.txt").AsConfig() - as.Equal("captain.txt: The Captain\n", out) + as.Equal("captain.txt: The Captain", out) out = f.Glob("ship/**").AsConfig() - as.Equal("captain.txt: The Captain\nstowaway.txt: Legatt\n", out) + as.Equal("captain.txt: The Captain\nstowaway.txt: Legatt", out) } func TestToSecret(t *testing.T) { @@ -84,7 +84,7 @@ func TestToSecret(t *testing.T) { f := NewFiles(getTestFiles()) out := f.Glob("ship/**").AsSecrets() - as.Equal("captain.txt: VGhlIENhcHRhaW4=\nstowaway.txt: TGVnYXR0\n", out) + as.Equal("captain.txt: VGhlIENhcHRhaW4=\nstowaway.txt: TGVnYXR0", out) } func TestLines(t *testing.T) { @@ -99,7 +99,7 @@ func TestLines(t *testing.T) { } func TestToYaml(t *testing.T) { - expect := "foo: bar\n" + expect := "foo: bar" v := struct { Foo string `json:"foo"` }{ diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index 3f9828498..fd287bf8a 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -365,7 +365,7 @@ func TestToYAML(t *testing.T) { if err != nil { t.Fatal(err) } - expect := "name: value\n" + expect := "name: value" if o != expect { t.Errorf("Expected %q, got %q", expect, o) } From f0c93a0f5632a0e6365c9d46fe74f92f1844a5de Mon Sep 17 00:00:00 2001 From: AdamDang Date: Fri, 6 Apr 2018 16:58:40 +0800 Subject: [PATCH 156/449] Fix some typos outout->output Get's->get the the->the --- pkg/kube/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index e4e2dc1bb..89e919e3d 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -56,7 +56,7 @@ import ( ) const ( - // MissingGetHeader is added to Get's outout when a resource is not found. + // MissingGetHeader is added to get output when a resource is not found. MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n" ) @@ -406,7 +406,7 @@ func createPatch(mapping *meta.RESTMapping, target, current runtime.Object) ([]b // While different objects need different merge types, the parent function // that calls this does not try to create a patch when the data (first - // returned object) is nil. We can skip calculating the the merge type as + // returned object) is nil. We can skip calculating the merge type as // the returned merge type is ignored. if apiequality.Semantic.DeepEqual(oldData, newData) { return nil, types.StrategicMergePatchType, nil @@ -692,7 +692,7 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf return err } -//get an kubernetes resources's relation pods +//get a kubernetes resources' relation pods // kubernetes resource used select labels to relate pods func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]core.Pod) (map[string][]core.Pod, error) { if info == nil { From 6a778a1e3dd7ec964805dd71bfefac1dc6f79b19 Mon Sep 17 00:00:00 2001 From: Steffen Windoffer Date: Fri, 6 Apr 2018 11:21:54 +0200 Subject: [PATCH 157/449] remove unused servicePort from default ingress template --- pkg/chartutil/create.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 07bd11449..9f2a8cc1f 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -123,7 +123,6 @@ const defaultIgnore = `# Patterns to ignore when building packages. const defaultIngress = `{{- if .Values.ingress.enabled -}} {{- $fullName := include ".fullname" . -}} -{{- $servicePort := .Values.service.port -}} {{- $ingressPath := .Values.ingress.path -}} apiVersion: extensions/v1beta1 kind: Ingress From 4e250826964914ec01488e80d772aeb0e62d89b5 Mon Sep 17 00:00:00 2001 From: Taylor Thomas Date: Fri, 6 Apr 2018 15:43:37 -0700 Subject: [PATCH 158/449] fix(package): Adds missing `set-string` flag and parameter A recent PR (#3471) wasn't up to date with the latest master changes. This fixes the issue and adds the right number of parameters to the `vals` function call. --- cmd/helm/package.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/helm/package.go b/cmd/helm/package.go index 4b2e6b398..bf171e534 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -55,6 +55,7 @@ type packageCmd struct { path string valueFiles valueFiles values []string + stringValues []string key string keyring string version string @@ -99,6 +100,7 @@ func newPackageCmd(out io.Writer) *cobra.Command { f := cmd.Flags() f.VarP(&pkg.valueFiles, "values", "f", "specify values in a YAML file or a URL(can specify multiple)") f.StringArrayVar(&pkg.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&pkg.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.BoolVar(&pkg.save, "save", true, "save packaged chart to local chart repository") f.BoolVar(&pkg.sign, "sign", false, "use a PGP private key to sign this package") f.StringVar(&pkg.key, "key", "", "name of the key to use when signing. Used if --sign is true") @@ -137,7 +139,7 @@ func (p *packageCmd) run() error { return err } - overrideVals, err := vals(p.valueFiles, p.values) + overrideVals, err := vals(p.valueFiles, p.values, p.stringValues) if err != nil { return err } From b193d8b891a95d8ec99dd4b5badb5aa998a6356b Mon Sep 17 00:00:00 2001 From: Taylor Thomas Date: Fri, 6 Apr 2018 16:33:38 -0700 Subject: [PATCH 159/449] fix(docs): Add the missing docs Because I was too stupid to regen the docs and flake made it so we didn't get a reminder --- docs/helm/helm_package.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index daceef32c..957f9c3b2 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -23,16 +23,17 @@ helm package [flags] [CHART_PATH] [...] ### Options ``` - --app-version string set the appVersion on the chart to this version - -u, --dependency-update update dependencies from "requirements.yaml" to dir "charts/" before packaging - -d, --destination string location to write the chart. (default ".") - --key string name of the key to use when signing. Used if --sign is true - --keyring string location of a public keyring (default "~/.gnupg/pubring.gpg") - --save save packaged chart to local chart repository (default true) - --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) - --sign use a PGP private key to sign this package - -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) - --version string set the version on the chart to this semver version + --app-version string set the appVersion on the chart to this version + -u, --dependency-update update dependencies from "requirements.yaml" to dir "charts/" before packaging + -d, --destination string location to write the chart. (default ".") + --key string name of the key to use when signing. Used if --sign is true + --keyring string location of a public keyring (default "~/.gnupg/pubring.gpg") + --save save packaged chart to local chart repository (default true) + --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --sign use a PGP private key to sign this package + -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) + --version string set the version on the chart to this semver version ``` ### Options inherited from parent commands @@ -49,4 +50,4 @@ helm package [flags] [CHART_PATH] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 6-Apr-2018 From 33ccaef7eb0ba04a24eba13c5bd8a7063ec11188 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Sat, 7 Apr 2018 08:56:44 +0800 Subject: [PATCH 160/449] typo fix get->Get's typo fix get->Get's --- pkg/kube/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 89e919e3d..8a7402938 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -56,7 +56,7 @@ import ( ) const ( - // MissingGetHeader is added to get output when a resource is not found. + // MissingGetHeader is added to Get's output when a resource is not found. MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n" ) From 947d928895adc80133d1c837250c531a5cfeeff0 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Sat, 7 Apr 2018 12:04:29 -0400 Subject: [PATCH 161/449] fix(helm) refactor reset command unit tests to remove duplication in test code Signed-off-by: Arash Deshmeh --- cmd/helm/reset_test.go | 169 ++++++++++++++++------------------------- 1 file changed, 65 insertions(+), 104 deletions(-) diff --git a/cmd/helm/reset_test.go b/cmd/helm/reset_test.go index 458736a63..ae6a00036 100644 --- a/cmd/helm/reset_test.go +++ b/cmd/helm/reset_test.go @@ -31,40 +31,58 @@ import ( "k8s.io/helm/pkg/proto/hapi/release" ) +type resetCase struct { + name string + err bool + resp []*release.Release + removeHelmHome bool + force bool + expectedActions int + expectedOutput string +} + func TestResetCmd(t *testing.T) { - home, err := ioutil.TempDir("", "helm_home") - if err != nil { - t.Fatal(err) - } - defer os.Remove(home) - var buf bytes.Buffer - c := &helm.FakeClient{} - fc := fake.NewSimpleClientset() - cmd := &resetCmd{ - out: &buf, - home: helmpath.Home(home), - client: c, - kubeClient: fc, - namespace: core.NamespaceDefault, - } - if err := cmd.run(); err != nil { - t.Errorf("unexpected error: %v", err) - } - actions := fc.Actions() - if len(actions) != 3 { - t.Errorf("Expected 3 actions, got %d", len(actions)) - } - expected := "Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster." - if !strings.Contains(buf.String(), expected) { - t.Errorf("expected %q, got %q", expected, buf.String()) - } - if _, err := os.Stat(home); err != nil { - t.Errorf("Helm home directory %s does not exists", home) - } + verifyResetCmd(t, resetCase{ + name: "test reset command", + expectedActions: 3, + expectedOutput: "Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.", + }) } func TestResetCmd_removeHelmHome(t *testing.T) { + verifyResetCmd(t, resetCase{ + name: "test reset command - remove helm home", + removeHelmHome: true, + expectedActions: 3, + expectedOutput: "Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.", + }) +} + +func TestReset_deployedReleases(t *testing.T) { + verifyResetCmd(t, resetCase{ + name: "test reset command - deployed releases", + resp: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), + }, + err: true, + expectedOutput: "there are still 1 deployed releases (Tip: use --force to remove Tiller. Releases will not be deleted.)", + }) +} + +func TestReset_forceFlag(t *testing.T) { + verifyResetCmd(t, resetCase{ + name: "test reset command - force flag", + force: true, + resp: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), + }, + expectedActions: 3, + expectedOutput: "Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.", + }) +} + +func verifyResetCmd(t *testing.T, tc resetCase) { home, err := ioutil.TempDir("", "helm_home") if err != nil { t.Fatal(err) @@ -72,99 +90,42 @@ func TestResetCmd_removeHelmHome(t *testing.T) { defer os.Remove(home) var buf bytes.Buffer - c := &helm.FakeClient{} + c := &helm.FakeClient{ + Rels: tc.resp, + } fc := fake.NewSimpleClientset() cmd := &resetCmd{ - removeHelmHome: true, + removeHelmHome: tc.removeHelmHome, + force: tc.force, out: &buf, home: helmpath.Home(home), client: c, kubeClient: fc, namespace: core.NamespaceDefault, } - if err := cmd.run(); err != nil { - t.Errorf("unexpected error: %v", err) - } - actions := fc.Actions() - if len(actions) != 3 { - t.Errorf("Expected 3 actions, got %d", len(actions)) - } - expected := "Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster." - if !strings.Contains(buf.String(), expected) { - t.Errorf("expected %q, got %q", expected, buf.String()) - } - if _, err := os.Stat(home); err == nil { - t.Errorf("Helm home directory %s already exists", home) - } -} -func TestReset_deployedReleases(t *testing.T) { - home, err := ioutil.TempDir("", "helm_home") - if err != nil { - t.Fatal(err) - } - defer os.Remove(home) - - var buf bytes.Buffer - resp := []*release.Release{ - helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), - } - c := &helm.FakeClient{ - Rels: resp, - } - fc := fake.NewSimpleClientset() - cmd := &resetCmd{ - out: &buf, - home: helmpath.Home(home), - client: c, - kubeClient: fc, - namespace: core.NamespaceDefault, - } err = cmd.run() - expected := "there are still 1 deployed releases (Tip: use --force to remove Tiller. Releases will not be deleted.)" - if !strings.Contains(err.Error(), expected) { + if !tc.err && err != nil { t.Errorf("unexpected error: %v", err) } - if _, err := os.Stat(home); err != nil { - t.Errorf("Helm home directory %s does not exists", home) - } -} -func TestReset_forceFlag(t *testing.T) { - home, err := ioutil.TempDir("", "helm_home") - if err != nil { - t.Fatal(err) + got := buf.String() + if tc.err { + got = err.Error() } - defer os.Remove(home) - var buf bytes.Buffer - resp := []*release.Release{ - helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", StatusCode: release.Status_DEPLOYED}), - } - c := &helm.FakeClient{ - Rels: resp, - } - fc := fake.NewSimpleClientset() - cmd := &resetCmd{ - force: true, - out: &buf, - home: helmpath.Home(home), - client: c, - kubeClient: fc, - namespace: core.NamespaceDefault, - } - if err := cmd.run(); err != nil { - t.Errorf("unexpected error: %v", err) - } actions := fc.Actions() - if len(actions) != 3 { - t.Errorf("Expected 3 actions, got %d", len(actions)) + if tc.expectedActions > 0 && len(actions) != tc.expectedActions { + t.Errorf("Expected %d actions, got %d", tc.expectedActions, len(actions)) } - expected := "Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster." - if !strings.Contains(buf.String(), expected) { - t.Errorf("expected %q, got %q", expected, buf.String()) + if !strings.Contains(got, tc.expectedOutput) { + t.Errorf("expected %q, got %q", tc.expectedOutput, got) } - if _, err := os.Stat(home); err != nil { + _, err = os.Stat(home) + if !tc.removeHelmHome && err != nil { t.Errorf("Helm home directory %s does not exists", home) } + if tc.removeHelmHome && err == nil { + t.Errorf("Helm home directory %s exists", home) + } } From af53b0166cbb558bc2e8d62a21bb78561f95e0bf Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sun, 8 Apr 2018 23:18:47 +0200 Subject: [PATCH 162/449] Typo fix `*/ }}` would cause an error actually, one must use `*/}}` or `*/ -}}`. Not obvious at all. --- docs/chart_best_practices/templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_best_practices/templates.md b/docs/chart_best_practices/templates.md index c9995ea0a..7b21c5fea 100644 --- a/docs/chart_best_practices/templates.md +++ b/docs/chart_best_practices/templates.md @@ -155,7 +155,7 @@ Template comments should be used when documenting features of a template, such a ```yaml {{- /* mychart.shortname provides a 6 char truncated version of the release name. -*/ }} +*/ -}} {{ define "mychart.shortname" -}} {{ .Release.Name | trunc 6 }} {{- end -}} From 229d58788ebb5530eabd28afe527f4f9c7834a6f Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Mon, 9 Apr 2018 12:18:23 -0400 Subject: [PATCH 163/449] fix(helm): refactor tiller release install unit tests using chart and install request stubs Signed-off-by: Arash Deshmeh --- pkg/tiller/release_install_test.go | 150 +++++++---------------------- pkg/tiller/release_server_test.go | 125 ++++++++++++++++++++++-- 2 files changed, 148 insertions(+), 127 deletions(-) diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index 8e2238e74..2f21dc46b 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -22,7 +22,6 @@ import ( "testing" "k8s.io/helm/pkg/helm" - "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/version" @@ -32,17 +31,7 @@ func TestInstallRelease(t *testing.T) { c := helm.NewContext() rs := rsFixture() - // TODO: Refactor this into a mock. - req := &services.InstallReleaseRequest{ - Namespace: "spaced", - Chart: &chart.Chart{ - Metadata: &chart.Metadata{Name: "hello"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - }, - }, - } + req := installRequest() res, err := rs.InstallRelease(c, req) if err != nil { t.Fatalf("Failed install: %s", err) @@ -96,18 +85,9 @@ func TestInstallRelease_WithNotes(t *testing.T) { c := helm.NewContext() rs := rsFixture() - // TODO: Refactor this into a mock. - req := &services.InstallReleaseRequest{ - Namespace: "spaced", - Chart: &chart.Chart{ - Metadata: &chart.Metadata{Name: "hello"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - {Name: "templates/NOTES.txt", Data: []byte(notesText)}, - }, - }, - } + req := installRequest( + withChart(withNotes(notesText)), + ) res, err := rs.InstallRelease(c, req) if err != nil { t.Fatalf("Failed install: %s", err) @@ -165,18 +145,9 @@ func TestInstallRelease_WithNotesRendered(t *testing.T) { c := helm.NewContext() rs := rsFixture() - // TODO: Refactor this into a mock. - req := &services.InstallReleaseRequest{ - Namespace: "spaced", - Chart: &chart.Chart{ - Metadata: &chart.Metadata{Name: "hello"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - {Name: "templates/NOTES.txt", Data: []byte(notesText + " {{.Release.Name}}")}, - }, - }, - } + req := installRequest( + withChart(withNotes(notesText + " {{.Release.Name}}")), + ) res, err := rs.InstallRelease(c, req) if err != nil { t.Fatalf("Failed install: %s", err) @@ -236,17 +207,9 @@ func TestInstallRelease_TillerVersion(t *testing.T) { c := helm.NewContext() rs := rsFixture() - // TODO: Refactor this into a mock. - req := &services.InstallReleaseRequest{ - Namespace: "spaced", - Chart: &chart.Chart{ - Metadata: &chart.Metadata{Name: "hello", TillerVersion: ">=2.2.0"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - }, - }, - } + req := installRequest( + withChart(withTiller(">=2.2.0")), + ) _, err := rs.InstallRelease(c, req) if err != nil { t.Fatalf("Expected valid range. Got %q", err) @@ -258,17 +221,9 @@ func TestInstallRelease_WrongTillerVersion(t *testing.T) { c := helm.NewContext() rs := rsFixture() - // TODO: Refactor this into a mock. - req := &services.InstallReleaseRequest{ - Namespace: "spaced", - Chart: &chart.Chart{ - Metadata: &chart.Metadata{Name: "hello", TillerVersion: "<2.0.0"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - }, - }, - } + req := installRequest( + withChart(withTiller("<2.0.0")), + ) _, err := rs.InstallRelease(c, req) if err == nil { t.Fatalf("Expected to fail because of wrong version") @@ -284,29 +239,10 @@ func TestInstallRelease_WithChartAndDependencyNotes(t *testing.T) { c := helm.NewContext() rs := rsFixture() - // TODO: Refactor this into a mock. - req := &services.InstallReleaseRequest{ - Namespace: "spaced", - Chart: &chart.Chart{ - Metadata: &chart.Metadata{Name: "hello"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - {Name: "templates/NOTES.txt", Data: []byte(notesText)}, - }, - Dependencies: []*chart.Chart{ - { - Metadata: &chart.Metadata{Name: "hello"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - {Name: "templates/NOTES.txt", Data: []byte(notesText + " child")}, - }, - }, - }, - }, - } - + req := installRequest(withChart( + withNotes(notesText), + withDependency(withNotes(notesText+" child")), + )) res, err := rs.InstallRelease(c, req) if err != nil { t.Fatalf("Failed install: %s", err) @@ -335,10 +271,9 @@ func TestInstallRelease_DryRun(t *testing.T) { c := helm.NewContext() rs := rsFixture() - req := &services.InstallReleaseRequest{ - Chart: chartStub(), - DryRun: true, - } + req := installRequest(withDryRun(), + withChart(withSampleTemplates()), + ) res, err := rs.InstallRelease(c, req) if err != nil { t.Errorf("Failed install: %s", err) @@ -389,10 +324,7 @@ func TestInstallRelease_NoHooks(t *testing.T) { rs := rsFixture() rs.env.Releases.Create(releaseStub()) - req := &services.InstallReleaseRequest{ - Chart: chartStub(), - DisableHooks: true, - } + req := installRequest(withDisabledHooks()) res, err := rs.InstallRelease(c, req) if err != nil { t.Errorf("Failed install: %s", err) @@ -409,9 +341,7 @@ func TestInstallRelease_FailedHooks(t *testing.T) { rs.env.Releases.Create(releaseStub()) rs.env.KubeClient = newHookFailingKubeClient() - req := &services.InstallReleaseRequest{ - Chart: chartStub(), - } + req := installRequest() res, err := rs.InstallRelease(c, req) if err == nil { t.Error("Expected failed install") @@ -429,11 +359,10 @@ func TestInstallRelease_ReuseName(t *testing.T) { rel.Info.Status.Code = release.Status_DELETED rs.env.Releases.Create(rel) - req := &services.InstallReleaseRequest{ - Chart: chartStub(), - ReuseName: true, - Name: rel.Name, - } + req := installRequest( + withReuseName(), + withName(rel.Name), + ) res, err := rs.InstallRelease(c, req) if err != nil { t.Fatalf("Failed install: %s", err) @@ -457,16 +386,9 @@ func TestInstallRelease_KubeVersion(t *testing.T) { c := helm.NewContext() rs := rsFixture() - // TODO: Refactor this into a mock. - req := &services.InstallReleaseRequest{ - Chart: &chart.Chart{ - Metadata: &chart.Metadata{Name: "hello", KubeVersion: ">=0.0.0"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - }, - }, - } + req := installRequest( + withChart(withKube(">=0.0.0")), + ) _, err := rs.InstallRelease(c, req) if err != nil { t.Fatalf("Expected valid range. Got %q", err) @@ -477,16 +399,10 @@ func TestInstallRelease_WrongKubeVersion(t *testing.T) { c := helm.NewContext() rs := rsFixture() - // TODO: Refactor this into a mock. - req := &services.InstallReleaseRequest{ - Chart: &chart.Chart{ - Metadata: &chart.Metadata{Name: "hello", KubeVersion: ">=5.0.0"}, - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, - }, - }, - } + req := installRequest( + withChart(withKube(">=5.0.0")), + ) + _, err := rs.InstallRelease(c, req) if err == nil { t.Fatalf("Expected to fail because of wrong version") diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index 6c4d42e04..73ba08f67 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -105,23 +105,128 @@ func rsFixture() *ReleaseServer { } } -// chartStub creates a fully stubbed out chart. -func chartStub() *chart.Chart { - return &chart.Chart{ - // TODO: This should be more complete. - Metadata: &chart.Metadata{ - Name: "hello", +type chartOptions struct { + *chart.Chart +} + +type chartOption func(*chartOptions) + +func buildChart(opts ...chartOption) *chart.Chart { + c := &chartOptions{ + Chart: &chart.Chart{ + // TODO: This should be more complete. + Metadata: &chart.Metadata{ + Name: "hello", + }, + // This adds a basic template and hooks. + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + {Name: "templates/hooks", Data: []byte(manifestWithHook)}, + }, }, - // This adds basic templates, partials, and hooks. - Templates: []*chart.Template{ - {Name: "templates/hello", Data: []byte("hello: world")}, + } + + for _, opt := range opts { + opt(c) + } + + return c.Chart +} + +func withKube(version string) chartOption { + return func(opts *chartOptions) { + opts.Metadata.KubeVersion = version + } +} + +func withTiller(version string) chartOption { + return func(opts *chartOptions) { + opts.Metadata.TillerVersion = version + } +} + +func withDependency(dependencyOpts ...chartOption) chartOption { + return func(opts *chartOptions) { + opts.Dependencies = append(opts.Dependencies, buildChart(dependencyOpts...)) + } +} + +func withNotes(notes string) chartOption { + return func(opts *chartOptions) { + opts.Templates = append(opts.Templates, &chart.Template{ + Name: "templates/NOTES.txt", + Data: []byte(notes), + }) + } +} + +func withSampleTemplates() chartOption { + return func(opts *chartOptions) { + sampleTemplates := []*chart.Template{ + // This adds basic templates and partials. {Name: "templates/goodbye", Data: []byte("goodbye: world")}, {Name: "templates/empty", Data: []byte("")}, {Name: "templates/with-partials", Data: []byte(`hello: {{ template "_planet" . }}`)}, {Name: "templates/partials/_planet", Data: []byte(`{{define "_planet"}}Earth{{end}}`)}, - {Name: "templates/hooks", Data: []byte(manifestWithHook)}, + } + opts.Templates = append(opts.Templates, sampleTemplates...) + } +} + +type installOptions struct { + *services.InstallReleaseRequest +} + +type installOption func(*installOptions) + +func withName(name string) installOption { + return func(opts *installOptions) { + opts.Name = name + } +} + +func withDryRun() installOption { + return func(opts *installOptions) { + opts.DryRun = true + } +} + +func withDisabledHooks() installOption { + return func(opts *installOptions) { + opts.DisableHooks = true + } +} + +func withReuseName() installOption { + return func(opts *installOptions) { + opts.ReuseName = true + } +} + +func withChart(chartOpts ...chartOption) installOption { + return func(opts *installOptions) { + opts.Chart = buildChart(chartOpts...) + } +} + +func installRequest(opts ...installOption) *services.InstallReleaseRequest { + reqOpts := &installOptions{ + &services.InstallReleaseRequest{ + Namespace: "spaced", + Chart: buildChart(), }, } + + for _, opt := range opts { + opt(reqOpts) + } + + return reqOpts.InstallReleaseRequest +} + +// chartStub creates a fully stubbed out chart. +func chartStub() *chart.Chart { + return buildChart(withSampleTemplates()) } // releaseStub creates a release stub, complete with the chartStub as its chart. From eed1cd7f8dc0757e284023b9692af09afb881caf Mon Sep 17 00:00:00 2001 From: AdamDang Date: Tue, 10 Apr 2018 23:54:19 +0800 Subject: [PATCH 164/449] Proper none not in capitals Helm is a proper none, should be written in capitals. --- docs/chart_repository_sync_example.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/chart_repository_sync_example.md b/docs/chart_repository_sync_example.md index 2fff70de9..de140c636 100644 --- a/docs/chart_repository_sync_example.md +++ b/docs/chart_repository_sync_example.md @@ -3,7 +3,7 @@ ## Prerequisites * Install the [gsutil](https://cloud.google.com/storage/docs/gsutil) tool. *We rely heavily on the gsutil rsync functionality* -* Be sure to have access to the helm binary +* Be sure to have access to the Helm binary * _Optional: We recommend you set [object versioning](https://cloud.google.com/storage/docs/gsutil/addlhelp/ObjectVersioningandConcurrencyControl#top_of_page) on your GCS bucket in case you accidentally delete something._ ## Set up a local chart repository directory @@ -16,7 +16,7 @@ $ mv alpine-0.1.0.tgz fantastic-charts/ ``` ## Generate an updated index.yaml -Use helm to generate an updated index.yaml file by passing in the directory path and the url of the remote repository to the `helm repo index` command like this: +Use Helm to generate an updated index.yaml file by passing in the directory path and the url of the remote repository to the `helm repo index` command like this: ```console $ helm repo index fantastic-charts/ --url https://fantastic-charts.storage.googleapis.com From 2b1e0019cab3381645140fd0189932e70bf4f615 Mon Sep 17 00:00:00 2001 From: xianlubird Date: Wed, 11 Apr 2018 20:51:58 +0800 Subject: [PATCH 165/449] Fix some typo Signed-off-by: xianlubird --- docs/chart_template_guide/named_templates.md | 2 +- docs/charts.md | 2 +- docs/plugins.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/chart_template_guide/named_templates.md b/docs/chart_template_guide/named_templates.md index 042842427..33425d102 100644 --- a/docs/chart_template_guide/named_templates.md +++ b/docs/chart_template_guide/named_templates.md @@ -105,7 +105,7 @@ data: {{- end }} ``` -As mentioned above, **template names are global**. As a result of this, if two templates are declared with the same name the last occurance will be the one that is used. Since templates in subcharts are compiled together with top-level templates, it is best to name your templates with _chart specific names_. A popular naming convention is to prefix each defined template with the name of the chart: `{{ define "mychart.labels" }}`. +As mentioned above, **template names are global**. As a result of this, if two templates are declared with the same name the last occurrence will be the one that is used. Since templates in subcharts are compiled together with top-level templates, it is best to name your templates with _chart specific names_. A popular naming convention is to prefix each defined template with the name of the chart: `{{ define "mychart.labels" }}`. ## Setting the scope of a template diff --git a/docs/charts.md b/docs/charts.md index 8722e6862..1bbab5f19 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -850,7 +850,7 @@ considerations in mind: - The `Chart.yaml` will be overwritten by the generator. - Users will expect to modify such a chart's contents, so documentation should indicate how users can do so. -- All occurences of `` will be replaced with the specified chart +- All occurrences of `` will be replaced with the specified chart name so that starter charts can be used as templates. Currently the only way to add a chart to `$HELM_HOME/starters` is to manually diff --git a/docs/plugins.md b/docs/plugins.md index b2cc3c812..82bcfe33b 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -134,7 +134,7 @@ downloaders: If such plugin is installed, Helm can interact with the repository using the specified protocol scheme by invoking the `command`. The special repository shall be added -similarily to the regular ones: `helm repo add favorite myprotocol://example.com/` +similarly to the regular ones: `helm repo add favorite myprotocol://example.com/` The rules for the special repos are the same to the regular ones: Helm must be able to download the `index.yaml` file in order to discover and cache the list of available Charts. From 9fb94309f58397e7dbdd5f4ce6053ff17124b8d3 Mon Sep 17 00:00:00 2001 From: eyalbe4 Date: Wed, 11 Apr 2018 19:07:15 +0300 Subject: [PATCH 166/449] Basic auth credentials from repo not used in install/upgrade/fetch commands #3858 --- pkg/downloader/chart_downloader.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 9262ea547..fe2f3ce92 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -167,7 +167,6 @@ func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*u if err != nil { return u, nil, nil, err } - g.SetCredentials(c.getRepoCredentials(nil)) if u.IsAbs() && len(u.Host) > 0 && len(u.Path) > 0 { // In this case, we have to find the parent repo that contains this chart @@ -203,6 +202,7 @@ func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*u repoName := p[0] chartName := p[1] rc, err := pickChartRepositoryConfigByName(repoName, rf.Repositories) + if err != nil { return u, nil, nil, err } @@ -211,6 +211,7 @@ func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*u if err != nil { return u, nil, nil, err } + g.SetCredentials(c.getRepoCredentials(r)) // Next, we need to load the index, and actually look up the chart. i, err := repo.LoadIndexFile(c.HelmHome.CacheIndex(r.Config.Name)) From 3912138914ded0b85b8f11b1593dd47aec90e94c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Wed, 11 Apr 2018 18:33:50 +0200 Subject: [PATCH 167/449] Remove Mercurial build-time dependency Since the only dep (bitbucket.org/ww/goautoneg) that required it is gone in https://github.com/kubernetes/helm/commit/845e99014362983d01179a411ae664b104e6c1f7#diff-f16a80eae23d5b298c2652448ec420cfL4 --- Makefile | 4 ---- docs/developers.md | 1 - docs/install.md | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 709cc301a..2dfbd2c3c 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,6 @@ coverage: HAS_GLIDE := $(shell command -v glide;) HAS_GOX := $(shell command -v gox;) HAS_GIT := $(shell command -v git;) -HAS_HG := $(shell command -v hg;) .PHONY: bootstrap bootstrap: @@ -133,9 +132,6 @@ endif ifndef HAS_GIT $(error You must install Git) -endif -ifndef HAS_HG - $(error You must install Mercurial) endif glide install --strip-vendor go build -o bin/protoc-gen-go ./vendor/github.com/golang/protobuf/protoc-gen-go diff --git a/docs/developers.md b/docs/developers.md index 5095bf1a0..e18c28d5d 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -10,7 +10,6 @@ Helm and Tiller. - A Kubernetes cluster w/ kubectl (optional) - The gRPC toolchain - Git -- Mercurial ## Building Helm/Tiller diff --git a/docs/install.md b/docs/install.md index 6ca13c90a..17905a805 100755 --- a/docs/install.md +++ b/docs/install.md @@ -81,7 +81,7 @@ Building Helm from source is slightly more work, but is the best way to go if you want to test the latest (pre-release) Helm version. You must have a working Go environment with -[glide](https://github.com/Masterminds/glide) and Mercurial installed. +[glide](https://github.com/Masterminds/glide) installed. ```console $ cd $GOPATH From b2cdc40a8834856fee5457a86159f0e128af6b4c Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 11 Apr 2018 14:43:44 -0700 Subject: [PATCH 168/449] remove optional field from charts and templates --- docs/charts.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/charts.md b/docs/charts.md index 1bbab5f19..a19c1a477 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -27,8 +27,8 @@ wordpress/ README.md # OPTIONAL: A human-readable README file requirements.yaml # OPTIONAL: A YAML file listing dependencies for the chart values.yaml # The default configuration values for this chart - charts/ # OPTIONAL: A directory containing any charts upon which this chart depends. - templates/ # OPTIONAL: A directory of templates that, when combined with values, + charts/ # A directory containing any charts upon which this chart depends. + templates/ # A directory of templates that, when combined with values, # will generate valid Kubernetes manifest files. templates/NOTES.txt # OPTIONAL: A plain text file containing short usage notes ``` @@ -36,8 +36,6 @@ wordpress/ Helm reserves use of the `charts/` and `templates/` directories, and of the listed file names. Other files will be left as they are. -While the `charts` and `templates` directories are optional there must be at least one chart dependency or template file for the chart to be valid. - ## The Chart.yaml File The `Chart.yaml` file is required for a chart. It contains the following fields: From 7cf9d23f28d45e2e39338cd10d097ccb433795cc Mon Sep 17 00:00:00 2001 From: Chance Zibolski Date: Wed, 11 Apr 2018 14:46:18 -0700 Subject: [PATCH 169/449] Update helm template -x to support children chart manifests in more cases The previous code validated the manifests exist within the file system, which only works when a chart is unpacked, meaning children charts stored as tgz's in the parent chart's `charts/` directory don't exist as individual files in the filesystem, causing validation to file. Instead, we validate against the paths within the chart itself rather than the filesystem, handling both chart.tgz's and charts that are unpacked as directories in the chart/ directory. --- cmd/helm/template.go | 78 ++++++++++++++++++++------------------- cmd/helm/template_test.go | 7 ++++ 2 files changed, 47 insertions(+), 38 deletions(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index c04bc2dc8..fc1f44392 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -117,31 +117,10 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { } else { return err } - // verify specified templates exist relative to chart - rf := []string{} - var af string - var err error - if len(t.renderFiles) > 0 { - for _, f := range t.renderFiles { - if !filepath.IsAbs(f) { - af, err = filepath.Abs(filepath.Join(t.chartPath, f)) - if err != nil { - return fmt.Errorf("could not resolve template path: %s", err) - } - } else { - af = f - } - rf = append(rf, af) - - if _, err := os.Stat(af); err != nil { - return fmt.Errorf("could not resolve template path: %s", err) - } - } - } // verify that output-dir exists if provided if t.outputDir != "" { - _, err = os.Stat(t.outputDir) + _, err := os.Stat(t.outputDir) if os.IsNotExist(err) { return fmt.Errorf("output-dir '%s' does not exist", t.outputDir) } @@ -232,19 +211,7 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { m := tiller.Manifest{Name: k, Content: v, Head: &util.SimpleHead{Kind: h}} listManifests = append(listManifests, m) } - in := func(needle string, haystack []string) bool { - // make needle path absolute - d := strings.Split(needle, string(os.PathSeparator)) - dd := d[1:] - an := filepath.Join(t.chartPath, strings.Join(dd, string(os.PathSeparator))) - - for _, h := range haystack { - if h == an { - return true - } - } - return false - } + if settings.Debug { rel := &release.Release{ Name: t.releaseName, @@ -257,10 +224,45 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { printRelease(os.Stdout, rel) } - for _, m := range tiller.SortByKind(listManifests) { - if len(t.renderFiles) > 0 && !in(m.Name, rf) { - continue + var manifestsToRender []tiller.Manifest + + // if we have a list of files to render, then check that each of the + // provided files exists in the chart. + if len(t.renderFiles) > 0 { + for _, f := range t.renderFiles { + missing := true + if !filepath.IsAbs(f) { + newF, err := filepath.Abs(filepath.Join(t.chartPath, f)) + if err != nil { + return fmt.Errorf("could not turn template path %s into absolute path: %s", f, err) + } + f = newF + } + + for _, manifest := range listManifests { + manifestPathSplit := strings.Split(manifest.Name, string(filepath.Separator)) + // remove the chart name from the path + manifestPathSplit = manifestPathSplit[1:] + toJoin := append([]string{t.chartPath}, manifestPathSplit...) + manifestPath := filepath.Join(toJoin...) + + // if the filepath provided matches a manifest path in the + // chart, render that manifest + if f == manifestPath { + manifestsToRender = append(manifestsToRender, manifest) + missing = false + } + } + if missing { + return fmt.Errorf("could not find template %s in chart", f) + } } + } else { + // no renderFiles provided, render all manifests in the chart + manifestsToRender = listManifests + } + + for _, m := range tiller.SortByKind(manifestsToRender) { data := m.Content b := filepath.Base(m.Name) if !t.showNotes && b == "NOTES.txt" { diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index eefa46774..bbcc9f3af 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -69,6 +69,13 @@ func TestTemplateCmd(t *testing.T) { expectKey: "subchart1/templates/service.yaml", expectValue: "protocol: TCP\n name: apache", }, + { + name: "check_execute_subchart_template", + desc: "verify --execute single template on a subchart template", + args: []string{chartPath, "-x", "charts/subcharta/templates/service.yaml", "--set", "subcharta.service.name=foobar"}, + expectKey: "subchart1/charts/subcharta/templates/service.yaml", + expectValue: "protocol: TCP\n name: foobar", + }, { name: "check_namespace", desc: "verify --namespace", From 79c73b57459a79c850151ddf2239cfbad9c4551a Mon Sep 17 00:00:00 2001 From: Chance Zibolski Date: Wed, 11 Apr 2018 16:26:15 -0700 Subject: [PATCH 170/449] Add working template to mariner chart for use in testing subcharts --- pkg/chartutil/testdata/frobnitz-1.2.3.tgz | Bin 2070 -> 3654 bytes .../frobnitz/charts/mariner-4.3.2.tgz | Bin 1034 -> 1012 bytes .../mariner/charts/albatross-0.1.0.tgz | Bin 347 -> 292 bytes .../mariner/templates/placeholder.tpl | 2 ++ 4 files changed, 2 insertions(+) diff --git a/pkg/chartutil/testdata/frobnitz-1.2.3.tgz b/pkg/chartutil/testdata/frobnitz-1.2.3.tgz index fb21cd08fb08fd2f4e45e940634ce1cdb0421457..cd12d2c1ef7d96805820389c38a21d03add7f06d 100644 GIT binary patch literal 3654 zcmV-M4!Q9kiwFR5n9f=N1MOT3eA84H-+ti4f}qF;D$HFn{Rzs_cgxCnOg4}=Y`kAv z+T5*SX;YGPUBNK~kqPn;KINs;!KWZ^##B&n2r4=RR1i@ZQxPVQjhD(mpx;f>m90D~ z&=t`9e~hHL=RT5?bMCq4oSQV3G21DAj54hDpi-%fdOZ-22I;8M=%k|;K&{mnv^t$Z ztP;|UfG#bPDw7IQsL^W?|MfbpDh#NCJ&>#6U(SDt<4VQt9*2zE1E2hN zwh}Cly9pZ|^gaT~zd@_^)Bk#nRx8VYC_p%+6a zDt5-qknS3lIL66ZptnaW&pSAiQdx~anZ__mGr=mXjL@<`QIkMHS%iDOT2+HC%b>#@ z_H+edw=+B;JUX!_n8mXMdO9ZQER&#}!Z-;;WQD9);60a$Ld1Wc{96S1=W4|a{CoCa z_4!|?H)>`3FBI_cpJXhx!~L7$zea16`5y}S_%En5oXbqFg+2n!|9XSLpZ`XKQJ()p zfw+!YHX3-R@%CsIS79AHDB{qI08jy%y3kpB%sU0TTrS+D#ThnTsX;fXL}i#nc3l#2 zI+j|?qA7dE)ri%xv9U_AR3fi2BH*G(-r641=nWXM0jP8<@BKlM?J*v5Jk|l#iWAJ0 z4vEri41^atPAOgz%2;UOMe;O?Mf4yGwSWP)_`kP#o$7My26UcA(R6#vPGq_g|BCqkE)jWSU!?HfZN@(GIuJ6gmes!VO4@bI|C>qdNE<^bX6odHCeNXSdFY zy^|AbqmO{{uhIL@|5~+Lmj6(|%XWYS+XAf&O+r={?SBz`@}HC#pU^82w~@i`Bar-S zME_sS^}j(Q%YP^k4Z2kM=oHm#0k2C7h+ZLFp@@zK12`fbUX2I`-FRRnIACXhQy`M) z6JRE!8HZp=C=^{77Ld{f$RbN4jcEfo2$3m){uoCLEtCNkIv9@P8P+Z9pb)_)|12Es zq*y4hi^FNgk`cT<0?EHt6!7t1j5-Hf^GgV% z|J6Ew{jb*S<0|^U>I~-{!BGVP{l7Z@_>a+`mF>Tf;8{r13>Z5W z7e)6uK*BV_N%H`6F)U4D+1auH|D#be|EG4Gzyal7f5rT-SIhq2kl=DsXSE0rNE6(( z-Y~G&0Jz-)l~F73&;Lx3HUy;Dg18GLp#87%&;K$Q)Uy2_5{UB8Ss5oy0yDDRMed_h zw-}nC83L(;Ho)wZGC%|hyM=a=h(t8=z44*jeHSur7XI=t`Tc_H1G;hlk3prA^S?s^ zfBt*jv@xP%7U$E)1fh=r`X8sD<^PP9xiYAwksCdSRpI?idpxvzb@bTC!-=}&k67%|MeIzPU1CyE+6WpJyQ_7B<0{v7#i(x{;u zhR5ufF>&5U3*MMllAh=B45@G4(q$c9m|Jhc0|S~oP&jJke=v6C_Bsiz7j`dLKBb^R z-F}Vl(bxU&XZ!nymqtIZYlXG7HRHEE2Y*{lo{l>FWog$n8@sMPeJW-4gt;dv>%6y9 zCU$5v;58;Pr{BxpR@R^LRF7|Rv2QA$p78jj@qN#)*#DI$?vkOfZ-Za^gfEWnv*pDe z4Yp2yKH}@#p7pIi%nqN`Fk*Da=T}dwcY0k+y|JHwd2=f3&0!1HzOZF~$;XkOM<#vY z0mTP?*}JLyi0Al)#gQ)^$%$?CY1E>IrJKHZ#&D{;txo-;MUCe*%Ng(>e8+RBQ&+se zNoGWxHn#|S50usWx@V^ekvkU^g^z#bSXRVnhbbcIg>@sBuWV?W_*w=wl3V`a`llKX zPvUb|Z<@Mc)AFB-y0v8Mev|slsPd_);UA3f>{{L|F?NY(p<TGBA;nIvt4+6zUTP-&tE*;Yo}4SV#Idt)zswTlVKM- zo$TIu*XKh`ncnZob2ocT#pupAp}0dcm=>7Oh(hZ+dv$kdL;Rnnos=$EQZAr>^JhdvboX zwmLM|v^j2ckNk-GdvYdd26>`+u*_4u`S|g?NcZ$%C)$p|rgchxvUHYqGX2$Rdl!sZw`}U6l8xIoob{N0NNL``JdVmaQ@UzR-%Hzm-)X+I4Ew{g1e@B%v+a|m zy81 zuD^6}&C~PBx39{h+pTHo-aW5H#f5g-wHJ0L>|8(RV_Uy_f8t9!xsG1g(Wuez{l?hJ z)MNa`8R_GWJ~C$EFJ-Uf*_2V)KP8^!53l;}$SV~ck0}TA*?wWoqRrckY|3Tdi8rc7@_4of7W&eL@P$Sw~ zW4mVpbkK|&+4yFHqbwj^Bmq4syE6+o81nMgPcbT7ZLg#dxXozG;S{43_G`+EgF6}5 zkpH0W2EB3n->B8d`~O0MYw$m)j^IH0Uw=jZpHVCOe?kM%|5KIi>moRi4$<BuEAeQ4scPJtoWL_SI@K>uEsU=!XjK)+W?12} zB2^k<4C+lZWm17Jw5d=GVVuBHZPycD{Xs~#F5PamZBblRLQ<8Sq~7(euWQJEP_uz< zSpREODxF%^|DnJ&_#f14pg{Ux<)8nfQE4>t{;!ZATHNF*=wo3eP?hClbH_+8f}Fqe z4@W@#?>C3uOdo;d-=Ou||EbX!4YK@)1b*Lt%Ao9|3G_wFdt`tSB*7Dxv-`%5#giZn z2@Z!;7 zaMF?<-P#n-cPDDf-(UEp8-y*AIDc@!qf2=j3_bdig-#B@>Ph`Djl?qj4P@ zHve!@*OKO=<`lnWFZ^9+doQx^d%WGKW1An}k+|ar`|v%3SFJ4?_ekZMtV^AX@d3>% zD=tRu%vtk#&dSFtJUw#HjkPu0IDbawtj3jzmy!%$cp958b^Wf-k8ht3uUzWkhP-jn z^W{5fzk7PD%fGke-FMG6$pD4t`!J;{1_hFT zwfYMCPb2UD4GpR`=OI4V4FAMSU*Hs91kt0`!)b=B9ilbC)k8m+yjHvm@pt6^R-HkC zDc zVQyr3R8em|NM&qo0PLOLZ`(K$$NQ|mVxYXPWl8>ZHInWHO%_{RHdt(P2P_VU3oVT; zB9y2lX*<4b{`UhZS$33ol{Svjr2IZKvPhA##1Cgk4&ABXlZ>kWbw4IVC~rkl_HN(u zecvAq2IjBt`}M#6&>vOD=6n#2g26l3`;9!Lxl}~F^ZlomQ~z?WL?p|&B8u`%jvWA! zah0IB!qs?vydZ3j4gg*&K}>=VGe5Bfok|6b7V zTmIY70USf|>S0P5Lc|R^QXfp|Y%WaS;5lV8cXiW;bCRO#I1(d6dc}pS6M$wwpiFaL zu4P+2Miu`G)0`27vO4lqzMrn3iGRNz*7zUvf}Z8S4gHLaak#nh47z_pj8iga3fv_Z zEOu{iEx>PD75|?0kLWDp0{2}D`@ZGB4IRKw>zQk3%NHo8tRXV1LXLBA0RNO^h7V=(;FE%cNXR(Mb*3W! z2`-TFTze9Z^Ai^k7bj2v&8GYZkcglX1jX|X(`g_u=aMQeR<;jnNfrMwkK{9T0*&^6 zaDV=PWchDJn?<@U4*;eb*K!z8E&#mrjaog6D*kE2GfysN&rnAb|AXPMZvXpzyZ+yb z4u8B(8I-HhM{eNx?vEdwL%Ep2b;>e1mW$buTQ1lymrHNi^SGFGL*Mtiaxrs@Y=4=> z0f4f!YeuuHhcXB6-@osg)FS(xJAx&RRdVEpgP{uv(pjR)4>Ue<6-woPZ~zWtl+lON z(sj`d`mk$G=`?|nGTEn8Nae!yksG?OGXIvv_x(-jL*IodW$eh!$YSMo@0KAk;#q78 z2?nN=enTk&V_nFhejp#dq0Y48U*I2eDp2?M(qlZj+Fu<_{P+C2{qOe%cKyE<#h7Cj zV-`^~0YIH{DW9;MX1I;w7+l}eG@6qeSN-9r9W!u{TLq>>&X+ z3rp;`tR4LCH5#~yfB#wm52z%26TJT_)}9p#&@Iz>aU@w;zaJNVy30~aSc zIgh`(H)!I2*sHDohkn0j`ENzF4Lnygi^uRQkDU}1iHRbc=>D4A&fB${C1+uP2~ zjaN8|#b*bAkqI(0kN`+fP(@~Uul$T+L8Brw6w8a}>(XmwmC4oZRXNHt@F)B+=c>qD z+s6dpYQMyjNjDNm6vplt+^ze#psBu@h-b09y>%U#W27$>sM~}3l`|Txbe&Z|^f@k2 zxZssJ{+pXDrt)&rgxPPj8SyL$Rpo$(rsg@g1x(|f*DJ<65l>U1pZLGs?u2Gt$q;k* z2lu`2`|f|*=zDkYzt@GpCjJNa=l@0{>;JbRv;MbU?OzfJGt5wEU|=q3HZv>qWiy3K z%@hh_<30)%JrZzIyR> zx56UjdO~8&$>pnG7u~^s`6(q*1y7y~XdM6h{TlzH(IB+^x1l@Z|KnmGta|EEp{H1Qt>y}JJ&27%?j4IRMAedB3fyXPEiZQ=j@_?NTJ zl#7%o?HgzttTUWo#E3xS@fPg_azcd!#bKh4rNkI$rZ}wlTvP^F>WlS7a0ITo&dxNv zh?@BiU&j91^}km174|>0_W$kZG5kNb{r7wQ`}W`R-->qH|M1lhZLJ=mI{#&u#$E#e zn(co*{&z6!+4%of^u_kSh~lX{029Dtdx}@9UHtDe0HAUFKdAFR^zHnAJKACYO(STY z0jOeuW>h8fiHXxwJY^k5vY9#B#~i`fP7yqtcJaSi&e`4>{&l|y*6jZWb^m|l+xfp% zv`x7E4S?@YyZGPdc7R6ze^CGZpOO9jzm~K+{(nN0;8H#+HhXdFct$FCMzS*7)(8lmGQQS%|2-P@PLQ%XW@8+wgs zC{cqN=XU3ETlOupvu)3qh#>i3n-2{XEL0(gmeQ(NX#^|8)Y=AHVz8k>LqKV1T8daG zEj<%$=k{JmQfgYfTrJLzgPFUVotfQdp8x+@3u41YxGuDa2!aq*6cDs(t`#D3uFV5P zDWXcUtctP>1W^(NH3XE!+*ASIBM{TAXenrG=+@)tuw?Qd=E>hjvAsvI^6_7jf|&4W zXqly7gFX*cmTw(@QH;{~3yLaB(TF0^_$z`Wg@91{t=!E2JpMMcPz>Zx0jDER!-h)? z$Buyp(1=V6XxWnik`4xOKY_4~2=cfs2z$XGnV0womvXYRgu~q3z8%ILQpo=x%HHDG z!0qY(?EI%4iRphiD8wJ54&T7YLN@VAZ37GHzY>`je^n7>rvK$YM=r8;WNQZUVjKXq zAm<3sOhAGi&!fKqfRXEX261pY22zB$UaYPTZG)C;B3^T>y16P6TvBw1u)vGFz^viF zNg;9s(O^Pq?TcUmw_X3!tQSQ&sQ;o0)Bkc%i2oL7`l#f}pJO5YmqcaW`=1ht3QYgY zK_z$&C82K;kUIfEq5tff#)jri&o?x!UCncqU{lKQ0R2GlN<-7eS~|jlgdiOx4XXb| zLufZh%1;D-Kpe}gHKE-e^tkLInh7xq%q4f$fC~-m0pfr}w(og#KEtM8(~gfpQI4|f z=Nu^Y)DCL+s!aQ+Hp#}@qe}Xbs|08rDtN+Tv z?ChQ$d5&A}IC>(DKxZf4k~4>F9)h=ko)?VpRtKAUxT}lh-M!1a_y1zqUmH~IJZXRP z->${wV*aZl_5Y|Mi!A@k!K&@|hdSOLX$>v?eJsBDJK>>aZ+z~*H?-WXjvpL4 z+}G5<_l3u*R}8o8JX`OyO}(?U->9kT8ofSoa@}xcZ+FF4a?Q1eR~7Y2d{^PMLneEN5o@_g@A$io99Pa!(Gqe2EM9;aGzHLzl;B?va8(XMXA#dZOazk)CZYAAR6O_jKm3)#;J$KkF}5PtE+Xqr&>;_{v|u zobg_3J2%*OU*`IX%QJf~eIop_=ZoIU@iULE(~pg1Mn{i4Q!%i=ckS0p=02G2kD@hK icf1~Y>h8pa!C){L36ZtiaDKCZKKh4VpUVhPw(Vq+5%p#1{`AAuCqVmyct4N85WAVyGp#n=>Wj1n4S z;p*((BjusRcz0-+&)sGA_I7u6_dCDuclIoZ4IANLpo|EDpsOnITP@cLl9Frl08!F) zQI-`+mw+HDk|+d#TF#Ryka7vc^i(WJNH|3z353tP9o;Mz`UG2>HDDfLsOK$)?XBLPk%{~bzM;vs=p>GasUXWKb3R2#PzqKg+d@d3b-h8BiKk1 z!?8nP9+;0z3q-t;0b&jY&8aZLHX_L7+7WjBjTBzyB`)E3N2#gdF81Xx{vn0>_f>Yw z69X6O|EeIVvL?{_R~21m{$B|S`eW3VGBC1`P25t)z?A;4N@wN2u8Au1|4I-=Nn}Tn z9Wjs_;sB@zxkP|w7!vHbE?oxzMoGsth=bE1kRT-KhJrz~0$NEE@e#)gp6Md~F2#hX z5qOaoSTy`MDJVw}6%*2EFGB=ep#M*v|4Cl`Gyg9?1^wHhnL;IZ{v1>Jzocru{;DFY zvZ8zXD}u!QzY@#>_o5g~nFQoUfIrdC4+@@}1r{d^7tl8ZOXofKKt27{yHO|#Vg~j8 zVi?2?l1PR9EFg|$)|=3d`%9eHLBxa@`N5JKXCMg;>;mF|u(#~G^mv9%zowlO21P6K z`p>0NjlUbqkkWIm|I;Rd5{?vdH?_;X^S7q6M{?qA4k~LcYf~K+m|0+Ut*A;=jm8X{kE*t&)SnE4r zM%A}7hwC=o@X3?4*}Ff!Z$VXtJ9Kn&ORKnfAk%L&Pun>D;)phO*KK{PKizeFOIz=n zy*o!wAB(P@-@O0Xt)Vxb?^^Wuz7^Z9s$0DG<(79l=RDI;yJg+Mmmb}CrBT z-!}KT=4?9KaOjJkYcgQjk@g!0$KO1e>6trl|4%m!{=B?u+4!Emw}w`2=pOv&TJ81s z9#V$gq1JEK%Ii?$Zt#20ucxXP^=-QPiQlpZ?i{{l`pMzO-oRHAJB1&st=E><&K!N! zdCK`A=yslR;D-|}568cpeRH7ta7WJ{hsPI;tY0|c!1o)c|1u-g@WGDm6TNL{-wPw* z(Wd>^e|==&5o^vX4U=!@9%pP?@baZ~f!i;ZpbQ3s!C){L3#Uqb*v{OB-fRab*UwBA(c`Y z>HD>GHpXPa)Jof#p|#i7P0QBn5B52oW3GRMndiUgOi0D6>D{frG2KU{)b;s`Qe4bm z%SvX%Z{5gy{`vd|)7ysTSHM;_wqg5{wti^nk)EvUsolQ}TKhoH^`Tah5&VKqp@FnN`?~EI5yvGmVv;1>iU*^A(0{Q~{uR`@o*M z%7&edw#^PUw8u^~=X1(x-;Xn!Wk0%GbA5)&B41Dtb&pGEL74_#ol>prTw=m`( zZL@bK9qp@cfp6q5bA|kGVa)$vTxZ)U9snQJf0Fvu`%medQ2%dX$UhbD7&<%4vW@eV tab?Ds>0<3e$rj$(uw88|syhGx0000000000006*m_5v>lSt Date: Wed, 11 Apr 2018 16:28:14 -0700 Subject: [PATCH 171/449] test helm template -x against subcharts stored as tgz's --- cmd/helm/template_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index bbcc9f3af..46adecca7 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -27,7 +27,10 @@ import ( "testing" ) -var chartPath = "./../../pkg/chartutil/testdata/subpop/charts/subchart1" +var ( + chartPath = "./../../pkg/chartutil/testdata/subpop/charts/subchart1" + frobnitzChartPath = "./../../pkg/chartutil/testdata/frobnitz" +) func TestTemplateCmd(t *testing.T) { absChartPath, err := filepath.Abs(chartPath) @@ -76,6 +79,13 @@ func TestTemplateCmd(t *testing.T) { expectKey: "subchart1/charts/subcharta/templates/service.yaml", expectValue: "protocol: TCP\n name: foobar", }, + { + name: "check_execute_subchart_template_for_tgz_subchart", + desc: "verify --execute single template on a subchart template where the subchart is a .tgz in the chart directory", + args: []string{frobnitzChartPath, "-x", "charts/mariner/templates/placeholder.tpl", "--set", "mariner.name=moon"}, + expectKey: "frobnitz/charts/mariner/templates/placeholder.tpl", + expectValue: "Goodbye moon", + }, { name: "check_namespace", desc: "verify --namespace", From 095bd97d3d27e459d4bcdf5f007f32df29933996 Mon Sep 17 00:00:00 2001 From: Chance Zibolski Date: Wed, 11 Apr 2018 16:28:56 -0700 Subject: [PATCH 172/449] Disambigutate chartPaths variables in helm template tests --- cmd/helm/template_test.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index 46adecca7..d2469525e 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -28,12 +28,12 @@ import ( ) var ( - chartPath = "./../../pkg/chartutil/testdata/subpop/charts/subchart1" - frobnitzChartPath = "./../../pkg/chartutil/testdata/frobnitz" + subchart1ChartPath = "./../../pkg/chartutil/testdata/subpop/charts/subchart1" + frobnitzChartPath = "./../../pkg/chartutil/testdata/frobnitz" ) func TestTemplateCmd(t *testing.T) { - absChartPath, err := filepath.Abs(chartPath) + subchart1AbsChartPath, err := filepath.Abs(subchart1ChartPath) if err != nil { t.Fatal(err) } @@ -47,35 +47,35 @@ func TestTemplateCmd(t *testing.T) { { name: "check_name", desc: "check for a known name in chart", - args: []string{chartPath}, + args: []string{subchart1ChartPath}, expectKey: "subchart1/templates/service.yaml", expectValue: "protocol: TCP\n name: nginx", }, { name: "check_set_name", desc: "verify --set values exist", - args: []string{chartPath, "-x", "templates/service.yaml", "--set", "service.name=apache"}, + args: []string{subchart1ChartPath, "-x", "templates/service.yaml", "--set", "service.name=apache"}, expectKey: "subchart1/templates/service.yaml", expectValue: "protocol: TCP\n name: apache", }, { name: "check_execute", desc: "verify --execute single template", - args: []string{chartPath, "-x", "templates/service.yaml", "--set", "service.name=apache"}, + args: []string{subchart1ChartPath, "-x", "templates/service.yaml", "--set", "service.name=apache"}, expectKey: "subchart1/templates/service.yaml", expectValue: "protocol: TCP\n name: apache", }, { name: "check_execute_absolute", desc: "verify --execute single template", - args: []string{chartPath, "-x", absChartPath + "/" + "templates/service.yaml", "--set", "service.name=apache"}, + args: []string{subchart1ChartPath, "-x", subchart1AbsChartPath + "/" + "templates/service.yaml", "--set", "service.name=apache"}, expectKey: "subchart1/templates/service.yaml", expectValue: "protocol: TCP\n name: apache", }, { name: "check_execute_subchart_template", desc: "verify --execute single template on a subchart template", - args: []string{chartPath, "-x", "charts/subcharta/templates/service.yaml", "--set", "subcharta.service.name=foobar"}, + args: []string{subchart1ChartPath, "-x", "charts/subcharta/templates/service.yaml", "--set", "subcharta.service.name=foobar"}, expectKey: "subchart1/charts/subcharta/templates/service.yaml", expectValue: "protocol: TCP\n name: foobar", }, @@ -89,42 +89,42 @@ func TestTemplateCmd(t *testing.T) { { name: "check_namespace", desc: "verify --namespace", - args: []string{chartPath, "--namespace", "test"}, + args: []string{subchart1ChartPath, "--namespace", "test"}, expectKey: "subchart1/templates/service.yaml", expectValue: "namespace: \"test\"", }, { name: "check_release_name", desc: "verify --release exists", - args: []string{chartPath, "--name", "test"}, + args: []string{subchart1ChartPath, "--name", "test"}, expectKey: "subchart1/templates/service.yaml", expectValue: "release-name: \"test\"", }, { name: "check_notes", desc: "verify --notes shows notes", - args: []string{chartPath, "--notes", "true"}, + args: []string{subchart1ChartPath, "--notes", "true"}, expectKey: "subchart1/templates/NOTES.txt", expectValue: "Sample notes for subchart1", }, { name: "check_values_files", desc: "verify --values files values exist", - args: []string{chartPath, "--values", chartPath + "/charts/subchartA/values.yaml"}, + args: []string{subchart1ChartPath, "--values", subchart1ChartPath + "/charts/subchartA/values.yaml"}, expectKey: "subchart1/templates/service.yaml", expectValue: "name: apache", }, { name: "check_name_template", desc: "verify --name-template result exists", - args: []string{chartPath, "--name-template", "foobar-{{ b64enc \"abc\" }}-baz"}, + args: []string{subchart1ChartPath, "--name-template", "foobar-{{ b64enc \"abc\" }}-baz"}, expectKey: "subchart1/templates/service.yaml", expectValue: "release-name: \"foobar-YWJj-baz\"", }, { name: "check_kube_version", desc: "verify --kube-version overrides the kubernetes version", - args: []string{chartPath, "--kube-version", "1.6"}, + args: []string{subchart1ChartPath, "--kube-version", "1.6"}, expectKey: "subchart1/templates/service.yaml", expectValue: "kube-version/major: \"1\"\n kube-version/minor: \"6\"\n kube-version/gitversion: \"v1.6.0\"", }, From d3601b9103a86e08b317a5e56c308920bbc781fe Mon Sep 17 00:00:00 2001 From: Chance Zibolski Date: Wed, 11 Apr 2018 16:46:24 -0700 Subject: [PATCH 173/449] Correctly use subtests in helm template tests The testing.T in the subtest wasn't being used, so subtests were effectively not being used. Additionally, in case subtests run in parallel, we assign tt := tt to fix closure captures on range variables, since the variables produced by a range are re-used between iterations. --- cmd/helm/template_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index d2469525e..7505b0474 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -132,7 +132,8 @@ func TestTemplateCmd(t *testing.T) { var buf bytes.Buffer for _, tt := range tests { - t.Run(tt.name, func(T *testing.T) { + tt := tt + t.Run(tt.name, func(t *testing.T) { // capture stdout old := os.Stdout r, w, _ := os.Pipe() From 275717d5613cb3ee1d7303b3cbe8914001964709 Mon Sep 17 00:00:00 2001 From: Chance Zibolski Date: Wed, 11 Apr 2018 16:48:53 -0700 Subject: [PATCH 174/449] test helm template -x with non-existent manifest --- cmd/helm/template_test.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index 7505b0474..68ed87cd2 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -43,6 +43,7 @@ func TestTemplateCmd(t *testing.T) { args []string expectKey string expectValue string + expectError string }{ { name: "check_name", @@ -65,6 +66,12 @@ func TestTemplateCmd(t *testing.T) { expectKey: "subchart1/templates/service.yaml", expectValue: "protocol: TCP\n name: apache", }, + { + name: "check_execute_non_existent", + desc: "verify --execute fails on a template that doesnt exist", + args: []string{subchart1ChartPath, "-x", "templates/thisdoesntexist.yaml"}, + expectError: "could not find template", + }, { name: "check_execute_absolute", desc: "verify --execute single template", @@ -143,8 +150,21 @@ func TestTemplateCmd(t *testing.T) { cmd := newTemplateCmd(out) cmd.SetArgs(tt.args) err := cmd.Execute() - if err != nil { - t.Errorf("expected: %v, got %v", tt.expectValue, err) + + if tt.expectError != "" { + if err == nil { + t.Errorf("expected err: %s, but no error occurred", tt.expectError) + } + // non nil error, check if it contains the expected error + if strings.Contains(err.Error(), tt.expectError) { + // had the error we were looking for, this test case is + // done + return + } else { + t.Fatalf("expected err: %q, got: %q", tt.expectError, err) + } + } else if err != nil { + t.Errorf("expected no error, got %v", err) } // restore stdout w.Close() From 988d998ac985d7f2c97b222a9d120bcd16868f30 Mon Sep 17 00:00:00 2001 From: Jesse Weinstein Date: Fri, 13 Apr 2018 09:57:35 -0700 Subject: [PATCH 175/449] Document apiVersion field Added in https://github.com/kubernetes/helm/issues/1264 --- docs/charts.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/charts.md b/docs/charts.md index a19c1a477..a55038e3e 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -41,6 +41,7 @@ the listed file names. Other files will be left as they are. The `Chart.yaml` file is required for a chart. It contains the following fields: ```yaml +apiVersion: The chart API version, always "v1" (required) name: The name of the chart (required) version: A SemVer 2 version (required) kubeVersion: A SemVer range of compatible Kubernetes versions (optional) From d652136c8163020e6cc936145f259201c6b7a00a Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Sat, 14 Apr 2018 05:52:34 -0400 Subject: [PATCH 176/449] fix(helm): resolve linter's warning on template command unit tests Signed-off-by: Arash Deshmeh --- cmd/helm/template_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index 68ed87cd2..cad42db16 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -160,9 +160,8 @@ func TestTemplateCmd(t *testing.T) { // had the error we were looking for, this test case is // done return - } else { - t.Fatalf("expected err: %q, got: %q", tt.expectError, err) } + t.Fatalf("expected err: %q, got: %q", tt.expectError, err) } else if err != nil { t.Errorf("expected no error, got %v", err) } From fb4183da15dbccc25ea3361030caddb381a79c8c Mon Sep 17 00:00:00 2001 From: Sergii Manannikov Date: Sat, 14 Apr 2018 15:51:01 +0200 Subject: [PATCH 177/449] Create PodSecurityPolicy before Pods and ServiceAccounts --- pkg/tiller/kind_sorter.go | 2 ++ pkg/tiller/kind_sorter_test.go | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index f367e65c8..43726d53e 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -30,6 +30,7 @@ var InstallOrder SortOrder = []string{ "Namespace", "ResourceQuota", "LimitRange", + "PodSecurityPolicy", "Secret", "ConfigMap", "StorageClass", @@ -80,6 +81,7 @@ var UninstallOrder SortOrder = []string{ "StorageClass", "ConfigMap", "Secret", + "PodSecurityPolicy", "LimitRange", "ResourceQuota", "Namespace", diff --git a/pkg/tiller/kind_sorter_test.go b/pkg/tiller/kind_sorter_test.go index ef7296e89..8d01fac17 100644 --- a/pkg/tiller/kind_sorter_test.go +++ b/pkg/tiller/kind_sorter_test.go @@ -85,6 +85,10 @@ func TestKindSorter(t *testing.T) { Name: "o", Head: &util.SimpleHead{Kind: "Pod"}, }, + { + Name: "3", + Head: &util.SimpleHead{Kind: "PodSecurityPolicy"}, + }, { Name: "q", Head: &util.SimpleHead{Kind: "ReplicaSet"}, @@ -136,8 +140,8 @@ func TestKindSorter(t *testing.T) { order SortOrder expected string }{ - {"install", InstallOrder, "abcde1fgh2ijklmnopqrstuvw!"}, - {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1edcba!"}, + {"install", InstallOrder, "abc3de1fgh2ijklmnopqrstuvw!"}, + {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1ed3cba!"}, } { var buf bytes.Buffer t.Run(test.description, func(t *testing.T) { From 7abed941fb9a14cc1b4dbd2b4bdf906c6e9ad41b Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 16 Apr 2018 16:46:47 -0700 Subject: [PATCH 178/449] Revert "feat: add --set and --values options to 'helm package'" This reverts commit a930eb7ff4dcba13831174496dda2445e81ebeaa. --- cmd/helm/package.go | 20 ----- cmd/helm/package_test.go | 152 -------------------------------------- docs/helm/helm_package.md | 21 +++--- 3 files changed, 9 insertions(+), 184 deletions(-) diff --git a/cmd/helm/package.go b/cmd/helm/package.go index bf171e534..ed44382c7 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -53,9 +53,6 @@ type packageCmd struct { save bool sign bool path string - valueFiles valueFiles - values []string - stringValues []string key string keyring string version string @@ -98,9 +95,6 @@ func newPackageCmd(out io.Writer) *cobra.Command { } f := cmd.Flags() - f.VarP(&pkg.valueFiles, "values", "f", "specify values in a YAML file or a URL(can specify multiple)") - f.StringArrayVar(&pkg.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") - f.StringArrayVar(&pkg.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.BoolVar(&pkg.save, "save", true, "save packaged chart to local chart repository") f.BoolVar(&pkg.sign, "sign", false, "use a PGP private key to sign this package") f.StringVar(&pkg.key, "key", "", "name of the key to use when signing. Used if --sign is true") @@ -139,20 +133,6 @@ func (p *packageCmd) run() error { return err } - overrideVals, err := vals(p.valueFiles, p.values, p.stringValues) - if err != nil { - return err - } - combinedVals, err := chartutil.CoalesceValues(ch, &chart.Config{Raw: string(overrideVals)}) - if err != nil { - return err - } - newVals, err := combinedVals.YAML() - if err != nil { - return err - } - ch.Values = &chart.Config{Raw: newVals} - // If version is set, modify the version. if len(p.version) != 0 { if err := setVersion(ch, p.version); err != nil { diff --git a/cmd/helm/package_test.go b/cmd/helm/package_test.go index 4a2df3f54..4404586e0 100644 --- a/cmd/helm/package_test.go +++ b/cmd/helm/package_test.go @@ -21,7 +21,6 @@ import ( "os" "path/filepath" "regexp" - "strings" "testing" "github.com/spf13/cobra" @@ -123,13 +122,6 @@ func TestPackage(t *testing.T) { hasfile: "chart-missing-deps-0.1.0.tgz", err: true, }, - { - name: "package --values does-not-exist", - args: []string{"testdata/testcharts/alpine"}, - flags: map[string]string{"values": "does-not-exist"}, - expect: "does-not-exist: no such file or directory", - err: true, - }, } // Because these tests are destructive, we run them in a tempdir. @@ -253,150 +245,6 @@ func TestSetAppVersion(t *testing.T) { } } -func TestPackageValues(t *testing.T) { - testCases := []struct { - desc string - args []string - valuefilesContents []string - flags map[string]string - expected []string - }{ - { - desc: "helm package, single values file", - args: []string{"testdata/testcharts/alpine"}, - valuefilesContents: []string{"Name: chart-name-foo"}, - expected: []string{"Name: chart-name-foo"}, - }, - { - desc: "helm package, multiple values files", - args: []string{"testdata/testcharts/alpine"}, - valuefilesContents: []string{"Name: chart-name-foo", "foo: bar"}, - expected: []string{"Name: chart-name-foo", "foo: bar"}, - }, - { - desc: "helm package, with set option", - args: []string{"testdata/testcharts/alpine"}, - flags: map[string]string{"set": "Name=chart-name-foo"}, - expected: []string{"Name: chart-name-foo"}, - }, - { - desc: "helm package, set takes precedence over value file", - args: []string{"testdata/testcharts/alpine"}, - valuefilesContents: []string{"Name: chart-name-foo"}, - flags: map[string]string{"set": "Name=chart-name-bar"}, - expected: []string{"Name: chart-name-bar"}, - }, - } - - thome, err := tempHelmHome(t) - if err != nil { - t.Fatal(err) - } - cleanup := resetEnv() - defer func() { - os.RemoveAll(thome.String()) - cleanup() - }() - - settings.Home = thome - - for _, tc := range testCases { - var files []string - for _, contents := range tc.valuefilesContents { - f, err := createValuesFile(contents) - if err != nil { - t.Errorf("%q unexpected error creating temporary values file: %q", tc.desc, err) - } - defer os.RemoveAll(filepath.Dir(f)) - files = append(files, f) - } - valueFiles := strings.Join(files, ",") - - expected, err := chartutil.ReadValues([]byte(strings.Join(tc.expected, "\n"))) - if err != nil { - t.Errorf("unexpected error parsing values: %q", err) - } - - runAndVerifyPackageCommandValues(t, tc.args, tc.flags, valueFiles, expected) - } -} - -func runAndVerifyPackageCommandValues(t *testing.T, args []string, flags map[string]string, valueFiles string, expected chartutil.Values) { - outputDir, err := ioutil.TempDir("", "helm-package") - if err != nil { - t.Errorf("unexpected error creating temporary output directory: %q", err) - } - defer os.RemoveAll(outputDir) - - if len(flags) == 0 { - flags = make(map[string]string) - } - flags["destination"] = outputDir - - if len(valueFiles) > 0 { - flags["values"] = valueFiles - } - - cmd := newPackageCmd(&bytes.Buffer{}) - setFlags(cmd, flags) - err = cmd.RunE(cmd, args) - if err != nil { - t.Errorf("unexpected error: %q", err) - } - - outputFile := filepath.Join(outputDir, "alpine-0.1.0.tgz") - verifyOutputChartExists(t, outputFile) - - var actual chartutil.Values - actual, err = getChartValues(outputFile) - if err != nil { - t.Errorf("unexpected error extracting chart values: %q", err) - } - - verifyValues(t, actual, expected) -} - -func createValuesFile(data string) (string, error) { - outputDir, err := ioutil.TempDir("", "values-file") - if err != nil { - return "", err - } - - outputFile := filepath.Join(outputDir, "values.yaml") - if err = ioutil.WriteFile(outputFile, []byte(data), 0755); err != nil { - os.RemoveAll(outputFile) - return "", err - } - - return outputFile, nil -} - -func getChartValues(chartPath string) (chartutil.Values, error) { - - chart, err := chartutil.Load(chartPath) - if err != nil { - return nil, err - } - - return chartutil.ReadValues([]byte(chart.Values.Raw)) -} - -func verifyValues(t *testing.T, actual, expected chartutil.Values) { - for key, value := range expected.AsMap() { - if got := actual[key]; got != value { - t.Errorf("Expected %q, got %q (%v)", value, got, actual) - } - } -} - -func verifyOutputChartExists(t *testing.T, chartPath string) { - if chartFile, err := os.Stat(chartPath); err != nil { - t.Errorf("expected file %q, got err %q", chartPath, err) - } else if chartFile.Size() == 0 { - t.Errorf("file %q has zero bytes.", chartPath) - } -} - func setFlags(cmd *cobra.Command, flags map[string]string) { dest := cmd.Flags() for f, v := range flags { diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index 957f9c3b2..21090fa45 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -23,17 +23,14 @@ helm package [flags] [CHART_PATH] [...] ### Options ``` - --app-version string set the appVersion on the chart to this version - -u, --dependency-update update dependencies from "requirements.yaml" to dir "charts/" before packaging - -d, --destination string location to write the chart. (default ".") - --key string name of the key to use when signing. Used if --sign is true - --keyring string location of a public keyring (default "~/.gnupg/pubring.gpg") - --save save packaged chart to local chart repository (default true) - --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) - --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) - --sign use a PGP private key to sign this package - -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) - --version string set the version on the chart to this semver version + --app-version string set the appVersion on the chart to this version + -u, --dependency-update update dependencies from "requirements.yaml" to dir "charts/" before packaging + -d, --destination string location to write the chart. (default ".") + --key string name of the key to use when signing. Used if --sign is true + --keyring string location of a public keyring (default "~/.gnupg/pubring.gpg") + --save save packaged chart to local chart repository (default true) + --sign use a PGP private key to sign this package + --version string set the version on the chart to this semver version ``` ### Options inherited from parent commands @@ -50,4 +47,4 @@ helm package [flags] [CHART_PATH] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 6-Apr-2018 +###### Auto generated by spf13/cobra on 16-Apr-2018 From ec34bbe12ab66904d8e29afd46c7930e5385ac3c Mon Sep 17 00:00:00 2001 From: AdamDang Date: Tue, 17 Apr 2018 13:55:29 +0800 Subject: [PATCH 179/449] Correct the returned message Correct the returned message --- pkg/plugin/installer/vcs_installer_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/plugin/installer/vcs_installer_test.go b/pkg/plugin/installer/vcs_installer_test.go index 453899543..d6eb32c1b 100644 --- a/pkg/plugin/installer/vcs_installer_test.go +++ b/pkg/plugin/installer/vcs_installer_test.go @@ -133,9 +133,9 @@ func TestVCSInstallerNonExistentVersion(t *testing.T) { } if err := Install(i); err == nil { - t.Error("expected error for version does not exists, got none") + t.Error("expected error for version does not exist, got none") } else if err.Error() != fmt.Sprintf("requested version %q does not exist for plugin %q", version, source) { - t.Errorf("expected error for version does not exists, got (%v)", err) + t.Errorf("expected error for version does not exist, got (%v)", err) } } func TestVCSInstallerUpdate(t *testing.T) { From fc6cd9098b1f495c8aed4d959218182ca79a8f64 Mon Sep 17 00:00:00 2001 From: ryane Date: Wed, 21 Feb 2018 16:27:50 -0500 Subject: [PATCH 180/449] fix(helm): add service, secret manifests in `init -o` When `helm init -o yaml|json` is run, the service and optional secret manifests will be included in the output. The manifests are included in a Kubernetes [List](https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#List) object. This also includes some refactoring and consolidates how manifests are output in `--dry-run` and removes some unnecessary marshaling between Kubernetes objects and strings. Fixes #3145 --- cmd/helm/init.go | 65 +++------------------- cmd/helm/init_test.go | 16 +++--- cmd/helm/installer/install.go | 89 ++++++++++++++++++++---------- cmd/helm/installer/install_test.go | 84 +++++++++++----------------- 4 files changed, 109 insertions(+), 145 deletions(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index d368945ec..ec2a06843 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -181,58 +181,29 @@ func (i *initCmd) run() error { i.opts.MaxHistory = i.maxHistory i.opts.Replicas = i.replicas - writeYAMLManifest := func(apiVersion, kind, body string, first, last bool) error { - w := i.out - if !first { - // YAML starting document boundary marker - if _, err := fmt.Fprintln(w, "---"); err != nil { - return err - } - } - if _, err := fmt.Fprintln(w, "apiVersion:", apiVersion); err != nil { - return err - } - if _, err := fmt.Fprintln(w, "kind:", kind); err != nil { - return err - } - if _, err := fmt.Fprint(w, body); err != nil { - return err - } - if !last { - return nil - } - // YAML ending document boundary marker - _, err := fmt.Fprintln(w, "...") - return err - } if len(i.opts.Output) > 0 { - var body string + var body []byte var err error - const tm = `{"apiVersion":"extensions/v1beta1","kind":"Deployment",` - if body, err = installer.DeploymentManifest(&i.opts); err != nil { + if body, err = installer.TillerManifests(&i.opts); err != nil { return err } switch i.opts.Output.String() { case "json": var out bytes.Buffer - jsonb, err := yaml.ToJSON([]byte(body)) + jsonb, err := yaml.ToJSON(body) if err != nil { return err } - buf := bytes.NewBuffer(make([]byte, 0, len(tm)+len(jsonb)-1)) - buf.WriteString(tm) - // Drop the opening object delimiter ('{'). - buf.Write(jsonb[1:]) + buf := bytes.NewBuffer(jsonb) if err := json.Indent(&out, buf.Bytes(), "", " "); err != nil { return err } if _, err = i.out.Write(out.Bytes()); err != nil { return err } - return nil case "yaml": - if err := writeYAMLManifest("extensions/v1beta1", "Deployment", body, true, false); err != nil { + if _, err = i.out.Write(body); err != nil { return err } return nil @@ -241,35 +212,17 @@ func (i *initCmd) run() error { } } if settings.Debug { - - var body string + var body []byte var err error - // write Deployment manifest - if body, err = installer.DeploymentManifest(&i.opts); err != nil { - return err - } - if err := writeYAMLManifest("extensions/v1beta1", "Deployment", body, true, false); err != nil { + // write Tiller manifests + if body, err = installer.TillerManifests(&i.opts); err != nil { return err } - // write Service manifest - if body, err = installer.ServiceManifest(i.namespace); err != nil { - return err - } - if err := writeYAMLManifest("v1", "Service", body, false, !i.opts.EnableTLS); err != nil { + if _, err = i.out.Write(body); err != nil { return err } - - // write Secret manifest - if i.opts.EnableTLS { - if body, err = installer.SecretManifest(&i.opts); err != nil { - return err - } - if err := writeYAMLManifest("v1", "Secret", body, false, true); err != nil { - return err - } - } } if i.dryRun { diff --git a/cmd/helm/init_test.go b/cmd/helm/init_test.go index 6a5767fca..283d37e53 100644 --- a/cmd/helm/init_test.go +++ b/cmd/helm/init_test.go @@ -167,15 +167,13 @@ func TestInitCmd_dryRun(t *testing.T) { t.Errorf("expected no server calls, got %d", got) } - docs := bytes.Split(buf.Bytes(), []byte("\n---")) - if got, want := len(docs), 2; got != want { - t.Fatalf("Expected document count of %d, got %d", want, got) - } - for _, doc := range docs { - var y map[string]interface{} - if err := yaml.Unmarshal(doc, &y); err != nil { - t.Errorf("Expected parseable YAML, got %q\n\t%s", doc, err) - } + list := &metav1.List{} + if err := yaml.Unmarshal(buf.Bytes(), &list); err != nil { + t.Errorf("Expected parseable List, got %q\n\t%s", buf.String(), err) + } + + if got, want := len(list.Items), 2; got != want { + t.Fatalf("Expected resource count of %d, got %d", want, got) } } diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index a45179a48..5e506a6e4 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -27,7 +27,9 @@ import ( "k8s.io/api/core/v1" "k8s.io/api/extensions/v1beta1" apierrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/kubernetes" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" @@ -104,7 +106,7 @@ func semverCompare(image string) int { // createDeployment creates the Tiller Deployment resource. func createDeployment(client extensionsclient.DeploymentsGetter, opts *Options) error { - obj, err := deployment(opts) + obj, err := generateDeployment(opts) if err != nil { return err } @@ -113,40 +115,66 @@ func createDeployment(client extensionsclient.DeploymentsGetter, opts *Options) } -// deployment gets the deployment object that installs Tiller. -func deployment(opts *Options) (*v1beta1.Deployment, error) { - return generateDeployment(opts) +// Deployment gets the deployment object that installs Tiller. +func Deployment(opts *Options) (*v1beta1.Deployment, error) { + dep, err := generateDeployment(opts) + if err != nil { + return nil, err + } + dep.TypeMeta = metav1.TypeMeta{ + Kind: "Deployment", + APIVersion: "extensions/v1beta1", + } + return dep, nil } // createService creates the Tiller service resource func createService(client corev1.ServicesGetter, namespace string) error { - obj := service(namespace) + obj := generateService(namespace) _, err := client.Services(obj.Namespace).Create(obj) return err } -// service gets the service object that installs Tiller. -func service(namespace string) *v1.Service { - return generateService(namespace) +// Service gets the service object that installs Tiller. +func Service(namespace string) *v1.Service { + svc := generateService(namespace) + svc.TypeMeta = metav1.TypeMeta{ + Kind: "Service", + APIVersion: "v1", + } + return svc } -// DeploymentManifest gets the manifest (as a string) that describes the Tiller Deployment -// resource. -func DeploymentManifest(opts *Options) (string, error) { - obj, err := deployment(opts) +// TillerManifests gets the Deployment, Service, and Secret (if tls-enabled) manifests +func TillerManifests(opts *Options) ([]byte, error) { + dep, err := Deployment(opts) if err != nil { - return "", err + return []byte{}, err } - buf, err := yaml.Marshal(obj) - return string(buf), err -} -// ServiceManifest gets the manifest (as a string) that describes the Tiller Service -// resource. -func ServiceManifest(namespace string) (string, error) { - obj := service(namespace) - buf, err := yaml.Marshal(obj) - return string(buf), err + svc := Service(opts.Namespace) + + objs := []runtime.Object{dep, svc} + + if opts.EnableTLS { + secret, err := Secret(opts) + if err != nil { + return []byte{}, err + } + objs = append(objs, secret) + } + + list := &metav1.List{ + TypeMeta: metav1.TypeMeta{ + Kind: "List", + APIVersion: "v1", + }, + } + if err := meta.SetList(list, objs); err != nil { + return []byte{}, err + } + buf, err := yaml.Marshal(list) + return buf, err } func generateLabels(labels map[string]string) map[string]string { @@ -323,14 +351,19 @@ func generateService(namespace string) *v1.Service { return s } -// SecretManifest gets the manifest (as a string) that describes the Tiller Secret resource. -func SecretManifest(opts *Options) (string, error) { - o, err := generateSecret(opts) +// Secret gets the Tiller secret resource. +func Secret(opts *Options) (*v1.Secret, error) { + secret, err := generateSecret(opts) if err != nil { - return "", err + return nil, err + } + + secret.TypeMeta = metav1.TypeMeta{ + Kind: "Secret", + APIVersion: "v1", } - buf, err := yaml.Marshal(o) - return string(buf), err + + return secret, nil } // createSecret creates the Tiller secret resource. diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index 80219505a..c27d978cf 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -34,7 +34,7 @@ import ( "k8s.io/helm/pkg/version" ) -func TestDeploymentManifest(t *testing.T) { +func TestDeployment(t *testing.T) { tests := []struct { name string image string @@ -48,14 +48,10 @@ func TestDeploymentManifest(t *testing.T) { } for _, tt := range tests { - o, err := DeploymentManifest(&Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary}) + dep, err := Deployment(&Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary}) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - var dep v1beta1.Deployment - if err := yaml.Unmarshal([]byte(o), &dep); err != nil { - t.Fatalf("%s: error %q", tt.name, err) - } if got := dep.Spec.Template.Spec.Containers[0].Image; got != tt.expect { t.Errorf("%s: expected image %q, got %q", tt.name, tt.expect, got) @@ -71,7 +67,7 @@ func TestDeploymentManifest(t *testing.T) { } } -func TestDeploymentManifestForServiceAccount(t *testing.T) { +func TestDeploymentForServiceAccount(t *testing.T) { tests := []struct { name string image string @@ -84,15 +80,11 @@ func TestDeploymentManifestForServiceAccount(t *testing.T) { {"withoutSA", "", false, "gcr.io/kubernetes-helm/tiller:latest", "IfNotPresent", ""}, } for _, tt := range tests { - o, err := DeploymentManifest(&Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary, ServiceAccount: tt.serviceAccount}) + d, err := Deployment(&Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary, ServiceAccount: tt.serviceAccount}) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - var d v1beta1.Deployment - if err := yaml.Unmarshal([]byte(o), &d); err != nil { - t.Fatalf("%s: error %q", tt.name, err) - } if got := d.Spec.Template.Spec.ServiceAccountName; got != tt.serviceAccount { t.Errorf("%s: expected service account value %q, got %q", tt.name, tt.serviceAccount, got) } @@ -102,7 +94,7 @@ func TestDeploymentManifestForServiceAccount(t *testing.T) { } } -func TestDeploymentManifest_WithTLS(t *testing.T) { +func TestDeployment_WithTLS(t *testing.T) { tests := []struct { opts Options name string @@ -129,15 +121,11 @@ func TestDeploymentManifest_WithTLS(t *testing.T) { }, } for _, tt := range tests { - o, err := DeploymentManifest(&tt.opts) + d, err := Deployment(&tt.opts) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - var d v1beta1.Deployment - if err := yaml.Unmarshal([]byte(o), &d); err != nil { - t.Fatalf("%s: error %q", tt.name, err) - } // verify environment variable in deployment reflect the use of tls being enabled. if got := d.Spec.Template.Spec.Containers[0].Env[2].Value; got != tt.verify { t.Errorf("%s: expected tls verify env value %q, got %q", tt.name, tt.verify, got) @@ -149,14 +137,7 @@ func TestDeploymentManifest_WithTLS(t *testing.T) { } func TestServiceManifest(t *testing.T) { - o, err := ServiceManifest(v1.NamespaceDefault) - if err != nil { - t.Fatalf("error %q", err) - } - var svc v1.Service - if err := yaml.Unmarshal([]byte(o), &svc); err != nil { - t.Fatalf("error %q", err) - } + svc := Service(v1.NamespaceDefault) if got := svc.ObjectMeta.Namespace; got != v1.NamespaceDefault { t.Errorf("expected namespace %s, got %s", v1.NamespaceDefault, got) @@ -164,7 +145,7 @@ func TestServiceManifest(t *testing.T) { } func TestSecretManifest(t *testing.T) { - o, err := SecretManifest(&Options{ + obj, err := Secret(&Options{ VerifyTLS: true, EnableTLS: true, Namespace: v1.NamespaceDefault, @@ -177,11 +158,6 @@ func TestSecretManifest(t *testing.T) { t.Fatalf("error %q", err) } - var obj v1.Secret - if err := yaml.Unmarshal([]byte(o), &obj); err != nil { - t.Fatalf("error %q", err) - } - if got := obj.ObjectMeta.Namespace; got != v1.NamespaceDefault { t.Errorf("expected namespace %s, got %s", v1.NamespaceDefault, got) } @@ -365,13 +341,13 @@ func TestInstall_canary(t *testing.T) { func TestUpgrade(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:v1.0.0", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -406,7 +382,7 @@ func TestUpgrade(t *testing.T) { func TestUpgrade_serviceNotFound(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace", UseCanary: false, @@ -449,13 +425,13 @@ func TestUpgrade_serviceNotFound(t *testing.T) { func TestUgrade_newerVersion(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:v100.5.0", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -509,13 +485,13 @@ func TestUgrade_newerVersion(t *testing.T) { func TestUpgrade_identical(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:v2.0.0", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -550,13 +526,13 @@ func TestUpgrade_identical(t *testing.T) { func TestUpgrade_canaryClient(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:canary" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:v1.0.0", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -591,13 +567,13 @@ func TestUpgrade_canaryClient(t *testing.T) { func TestUpgrade_canaryServer(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:canary", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -637,7 +613,8 @@ func tlsTestFile(t *testing.T, path string) string { } return path } -func TestDeploymentManifest_WithNodeSelectors(t *testing.T) { + +func TestDeployment_WithNodeSelectors(t *testing.T) { tests := []struct { opts Options name string @@ -661,15 +638,11 @@ func TestDeploymentManifest_WithNodeSelectors(t *testing.T) { }, } for _, tt := range tests { - o, err := DeploymentManifest(&tt.opts) + d, err := Deployment(&tt.opts) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - var d v1beta1.Deployment - if err := yaml.Unmarshal([]byte(o), &d); err != nil { - t.Fatalf("%s: error %q", tt.name, err) - } // Verify that environment variables in Deployment reflect the use of TLS being enabled. got := d.Spec.Template.Spec.NodeSelector for k, v := range tt.expect { @@ -679,7 +652,8 @@ func TestDeploymentManifest_WithNodeSelectors(t *testing.T) { } } } -func TestDeploymentManifest_WithSetValues(t *testing.T) { + +func TestDeployment_WithSetValues(t *testing.T) { tests := []struct { opts Options name string @@ -706,11 +680,17 @@ func TestDeploymentManifest_WithSetValues(t *testing.T) { }, } for _, tt := range tests { - o, err := DeploymentManifest(&tt.opts) + d, err := Deployment(&tt.opts) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - values, err := chartutil.ReadValues([]byte(o)) + + o, err := yaml.Marshal(d) + if err != nil { + t.Errorf("Error marshaling Deployment: %s", err) + } + + values, err := chartutil.ReadValues(o) if err != nil { t.Errorf("Error converting Deployment manifest to Values: %s", err) } From b9d022f6b9860a793ffa75e229ee0296381f1a1e Mon Sep 17 00:00:00 2001 From: ryane Date: Fri, 23 Feb 2018 20:40:25 -0500 Subject: [PATCH 181/449] don't wrap helm init -o/--dry-run output in List Manifests in yaml are separated by `---`. In json, manifests are separated by newlines (see https://github.com/kubernetes/kubernetes/blob/master/hack/testdata/multi-resource-json.json) --- cmd/helm/init.go | 56 ++++++++++++++++++++++------------- cmd/helm/init_test.go | 51 +++++++++++++++---------------- cmd/helm/installer/install.go | 26 ++++++++-------- 3 files changed, 72 insertions(+), 61 deletions(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index ec2a06843..ea23890cb 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -181,46 +181,62 @@ func (i *initCmd) run() error { i.opts.MaxHistory = i.maxHistory i.opts.Replicas = i.replicas + writeYAMLManifests := func(manifests []string) error { + w := i.out + for _, manifest := range manifests { + if _, err := fmt.Fprintln(w, "---"); err != nil { + return err + } + + if _, err := fmt.Fprintln(w, manifest); err != nil { + return err + } + } + + // YAML ending document boundary marker + _, err := fmt.Fprintln(w, "...") + return err + } if len(i.opts.Output) > 0 { - var body []byte + var manifests []string var err error - if body, err = installer.TillerManifests(&i.opts); err != nil { + if manifests, err = installer.TillerManifests(&i.opts); err != nil { return err } switch i.opts.Output.String() { case "json": - var out bytes.Buffer - jsonb, err := yaml.ToJSON(body) - if err != nil { - return err - } - buf := bytes.NewBuffer(jsonb) - if err := json.Indent(&out, buf.Bytes(), "", " "); err != nil { - return err - } - if _, err = i.out.Write(out.Bytes()); err != nil { - return err + for _, manifest := range manifests { + var out bytes.Buffer + jsonb, err := yaml.ToJSON([]byte(manifest)) + if err != nil { + return err + } + buf := bytes.NewBuffer(jsonb) + if err := json.Indent(&out, buf.Bytes(), "", " "); err != nil { + return err + } + if _, err = i.out.Write(out.Bytes()); err != nil { + return err + } + fmt.Fprint(i.out, "\n") } return nil case "yaml": - if _, err = i.out.Write(body); err != nil { - return err - } - return nil + return writeYAMLManifests(manifests) default: return fmt.Errorf("unknown output format: %q", i.opts.Output) } } if settings.Debug { - var body []byte + var manifests []string var err error // write Tiller manifests - if body, err = installer.TillerManifests(&i.opts); err != nil { + if manifests, err = installer.TillerManifests(&i.opts); err != nil { return err } - if _, err = i.out.Write(body); err != nil { + if err = writeYAMLManifests(manifests); err != nil { return err } } diff --git a/cmd/helm/init_test.go b/cmd/helm/init_test.go index 283d37e53..a4bb0646a 100644 --- a/cmd/helm/init_test.go +++ b/cmd/helm/init_test.go @@ -18,6 +18,7 @@ package main import ( "bytes" + "io" "io/ioutil" "os" "path/filepath" @@ -32,11 +33,10 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + yamlutil "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/kubernetes/fake" testcore "k8s.io/client-go/testing" - "encoding/json" - "k8s.io/helm/cmd/helm/installer" "k8s.io/helm/pkg/helm/helmpath" ) @@ -167,13 +167,15 @@ func TestInitCmd_dryRun(t *testing.T) { t.Errorf("expected no server calls, got %d", got) } - list := &metav1.List{} - if err := yaml.Unmarshal(buf.Bytes(), &list); err != nil { - t.Errorf("Expected parseable List, got %q\n\t%s", buf.String(), err) + docs := bytes.Split(buf.Bytes(), []byte("\n---")) + if got, want := len(docs), 2; got != want { + t.Fatalf("Expected document count of %d, got %d", want, got) } - - if got, want := len(list.Items), 2; got != want { - t.Fatalf("Expected resource count of %d, got %d", want, got) + for _, doc := range docs { + var y map[string]interface{} + if err := yaml.Unmarshal(doc, &y); err != nil { + t.Errorf("Expected parseable YAML, got %q\n\t%s", doc, err) + } } } @@ -304,7 +306,7 @@ func TestInitCmd_tlsOptions(t *testing.T) { } } -// TestInitCmd_output tests that init -o formats are unmarshal-able +// TestInitCmd_output tests that init -o can be decoded func TestInitCmd_output(t *testing.T) { // This is purely defensive in this case. home, err := ioutil.TempDir("", "helm_home") @@ -318,26 +320,14 @@ func TestInitCmd_output(t *testing.T) { settings.Debug = dbg }() fc := fake.NewSimpleClientset() - tests := []struct { - expectF func([]byte, interface{}) error - expectName string - }{ - { - json.Unmarshal, - "json", - }, - { - yaml.Unmarshal, - "yaml", - }, - } + tests := []string{"json", "yaml"} for _, s := range tests { var buf bytes.Buffer cmd := &initCmd{ out: &buf, home: helmpath.Home(home), kubeClient: fc, - opts: installer.Options{Output: installer.OutputFormat(s.expectName)}, + opts: installer.Options{Output: installer.OutputFormat(s)}, namespace: v1.NamespaceDefault, } if err := cmd.run(); err != nil { @@ -346,10 +336,17 @@ func TestInitCmd_output(t *testing.T) { if got := len(fc.Actions()); got != 0 { t.Errorf("expected no server calls, got %d", got) } - d := &v1beta1.Deployment{} - if err = s.expectF(buf.Bytes(), &d); err != nil { - t.Errorf("error unmarshalling init %s output %s %s", s.expectName, err, buf.String()) + + var obj interface{} + decoder := yamlutil.NewYAMLOrJSONDecoder(&buf, 4096) + for { + err := decoder.Decode(&obj) + if err != nil { + if err == io.EOF { + break + } + t.Errorf("error decoding init %s output %s %s", s, err, buf.String()) + } } } - } diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index 5e506a6e4..df4319106 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -27,7 +27,6 @@ import ( "k8s.io/api/core/v1" "k8s.io/api/extensions/v1beta1" apierrors "k8s.io/apimachinery/pkg/api/errors" - meta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" @@ -146,10 +145,10 @@ func Service(namespace string) *v1.Service { } // TillerManifests gets the Deployment, Service, and Secret (if tls-enabled) manifests -func TillerManifests(opts *Options) ([]byte, error) { +func TillerManifests(opts *Options) ([]string, error) { dep, err := Deployment(opts) if err != nil { - return []byte{}, err + return []string{}, err } svc := Service(opts.Namespace) @@ -159,22 +158,21 @@ func TillerManifests(opts *Options) ([]byte, error) { if opts.EnableTLS { secret, err := Secret(opts) if err != nil { - return []byte{}, err + return []string{}, err } objs = append(objs, secret) } - list := &metav1.List{ - TypeMeta: metav1.TypeMeta{ - Kind: "List", - APIVersion: "v1", - }, - } - if err := meta.SetList(list, objs); err != nil { - return []byte{}, err + manifests := make([]string, len(objs)) + for i, obj := range objs { + o, err := yaml.Marshal(obj) + if err != nil { + return []string{}, err + } + manifests[i] = string(o) } - buf, err := yaml.Marshal(list) - return buf, err + + return manifests, err } func generateLabels(labels map[string]string) map[string]string { From 4b975acfe34654bf611cc872395d7c3f18db7744 Mon Sep 17 00:00:00 2001 From: ryane Date: Tue, 27 Feb 2018 17:22:33 -0500 Subject: [PATCH 182/449] update docstrings on Deployment, Service, and Secret --- cmd/helm/installer/install.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index df4319106..58cdeb5b1 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -114,7 +114,9 @@ func createDeployment(client extensionsclient.DeploymentsGetter, opts *Options) } -// Deployment gets the deployment object that installs Tiller. +// Deployment gets a deployment object that can be used to generate a manifest +// as a string. This object should not be submitted directly to the Kubernetes +// api func Deployment(opts *Options) (*v1beta1.Deployment, error) { dep, err := generateDeployment(opts) if err != nil { @@ -134,7 +136,8 @@ func createService(client corev1.ServicesGetter, namespace string) error { return err } -// Service gets the service object that installs Tiller. +// Service gets a service object that can be used to generate a manifest as a +// string. This object should not be submitted directly to the Kubernetes api func Service(namespace string) *v1.Service { svc := generateService(namespace) svc.TypeMeta = metav1.TypeMeta{ @@ -349,7 +352,8 @@ func generateService(namespace string) *v1.Service { return s } -// Secret gets the Tiller secret resource. +// Secret gets a secret object that can be used to generate a manifest as a +// string. This object should not be submitted directly to the Kubernetes api func Secret(opts *Options) (*v1.Secret, error) { secret, err := generateSecret(opts) if err != nil { From d011244af2fa566136ead2aa2b9587420ce5a8b6 Mon Sep 17 00:00:00 2001 From: Ali Rizwan Date: Thu, 15 Mar 2018 16:07:29 +0100 Subject: [PATCH 183/449] Fixed SIGSEGV when running helm create with -p and no values.yaml file --- pkg/chartutil/create.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 9f2a8cc1f..4c6b484a9 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -307,8 +307,9 @@ func CreateFrom(chartfile *chart.Metadata, dest string, src string) error { } schart.Templates = updatedTemplates - schart.Values = &chart.Config{Raw: string(Transform(schart.Values.Raw, "", schart.Metadata.Name))} - + if schart.Values != nil { + schart.Values = &chart.Config{Raw: string(Transform(schart.Values.Raw, "", schart.Metadata.Name))} + } return SaveDir(schart, dest) } From 49c748da722ab2da445409f3f8c70f47460f435a Mon Sep 17 00:00:00 2001 From: fqsghostcloud Date: Thu, 22 Mar 2018 23:28:04 +0800 Subject: [PATCH 184/449] Update CONTRIBUTING.md "Semantic Versioning" will be better --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 34b4f8b16..ec3db568c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ An issue that we are not sure we will be doing will not be added to any mileston A milestone (and hence release) is considered done when all outstanding issues/PRs have been closed or moved to another milestone. -## Semver +## Semantic Versioning Helm maintains a strong commitment to backward compatibility. All of our changes to protocols and formats are backward compatible from Helm 2.0 until Helm 3.0. No features, flags, or commands are removed or substantially modified (other than bug fixes). From 4bae2a91918f470cf6fde8e6fa25445d32ba6aa9 Mon Sep 17 00:00:00 2001 From: Derek Bassett Date: Mon, 26 Feb 2018 20:03:43 -0700 Subject: [PATCH 185/449] The default defined role does not allow Tiller to launch Kubernetes jobs. --- docs/rbac.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rbac.md b/docs/rbac.md index 2a3dfe7a0..36d06e62a 100644 --- a/docs/rbac.md +++ b/docs/rbac.md @@ -71,7 +71,7 @@ metadata: name: tiller-manager namespace: tiller-world rules: -- apiGroups: ["", "extensions", "apps"] +- apiGroups: ["", "batch", "extensions", "apps"] resources: ["*"] verbs: ["*"] ``` From 8c021ed3149ced452e0b260fa77b0b49d5fd7a7f Mon Sep 17 00:00:00 2001 From: cameronconradt <16780811+cameronconradt@users.noreply.github.com> Date: Fri, 23 Mar 2018 23:57:35 -0600 Subject: [PATCH 186/449] Update files.go Should suppress the warnings about the naming of these two functions. Added TODO --- pkg/chartutil/files.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index ced8ce15a..a34605a27 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -211,7 +211,8 @@ func ToToml(v interface{}) string { // always return a string, even on marshal error (empty string). // // This is designed to be called from a template. -func ToJson(v interface{}) string { +//TODO:change the function signature in Helm 3 +func ToJson(v interface{}) string { //nolint data, err := json.Marshal(v) if err != nil { // Swallow errors inside of a template. @@ -226,7 +227,8 @@ func ToJson(v interface{}) string { // JSON documents. Additionally, because its intended use is within templates // it tolerates errors. It will insert the returned error message string into // m["Error"] in the returned map. -func FromJson(str string) map[string]interface{} { +//TODO:change the function signature in Helm 3 +func FromJson(str string) map[string]interface{} { //nolint m := map[string]interface{}{} if err := json.Unmarshal([]byte(str), &m); err != nil { From bff343d5be2c236802444e22d4801b8eeadf8c1e Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Sat, 14 Apr 2018 15:37:42 -0400 Subject: [PATCH 187/449] feat(helm): support removing multiple repositories with repo remove command Signed-off-by: Arash Deshmeh --- cmd/helm/repo_remove.go | 15 ++++++--- cmd/helm/repo_remove_test.go | 64 ++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 5 deletions(-) diff --git a/cmd/helm/repo_remove.go b/cmd/helm/repo_remove.go index 201ee9ca8..728852fa1 100644 --- a/cmd/helm/repo_remove.go +++ b/cmd/helm/repo_remove.go @@ -41,13 +41,18 @@ func newRepoRemoveCmd(out io.Writer) *cobra.Command { Aliases: []string{"rm"}, Short: "remove a chart repository", RunE: func(cmd *cobra.Command, args []string) error { - if err := checkArgsLength(len(args), "name of chart repository"); err != nil { - return err + if len(args) == 0 { + return fmt.Errorf("need at least one argument, name of chart repository") } - remove.name = args[0] - remove.home = settings.Home - return remove.run() + remove.home = settings.Home + for i := 0; i < len(args); i++ { + remove.name = args[i] + if err := remove.run(); err != nil { + return err + } + } + return nil }, } diff --git a/cmd/helm/repo_remove_test.go b/cmd/helm/repo_remove_test.go index 174a44495..bc071b989 100644 --- a/cmd/helm/repo_remove_test.go +++ b/cmd/helm/repo_remove_test.go @@ -18,6 +18,7 @@ package main import ( "bytes" + "io/ioutil" "os" "strings" "testing" @@ -79,3 +80,66 @@ func TestRepoRemove(t *testing.T) { t.Errorf("%s was not successfully removed from repositories list", testName) } } + +func TestRepoRemove_NoArguments(t *testing.T) { + cmd := newRepoRemoveCmd(ioutil.Discard) + if err := cmd.RunE(cmd, []string{}); err == nil { + t.Errorf("Expected an error since no repo names were provided") + } +} + +func TestRepoRemove_MultipleRepos(t *testing.T) { + ts, thome, err := repotest.NewTempServer("testdata/testserver/*.*") + if err != nil { + t.Fatal(err) + } + + hh := helmpath.Home(thome) + cleanup := resetEnv() + defer func() { + ts.Stop() + os.RemoveAll(thome.String()) + cleanup() + }() + if err := ensureTestHome(hh, t); err != nil { + t.Fatal(err) + } + + settings.Home = thome + + repoFoo := testName + "foo" + repoBar := testName + "bar" + + if err := addRepository(repoFoo, ts.URL(), "", "", hh, "", "", "", true); err != nil { + t.Error(err) + } + if err := addRepository(repoBar, ts.URL(), "", "", hh, "", "", "", true); err != nil { + t.Error(err) + } + + b := bytes.NewBuffer(nil) + + cmd := newRepoRemoveCmd(b) + if err := cmd.RunE(cmd, []string{repoFoo, repoBar}); err != nil { + t.Error(err) + } + + if !strings.Contains(b.String(), repoFoo) { + t.Errorf("Expected %q in output, found: %q", repoFoo, b.String()) + } + if !strings.Contains(b.String(), repoBar) { + t.Errorf("Expected %q in output, found: %q", repoBar, b.String()) + } + + f, err := repo.LoadRepositoriesFile(hh.RepositoryFile()) + if err != nil { + t.Error(err) + } + + if f.Has(repoFoo) { + t.Errorf("%s was not successfully removed from repositories list", repoFoo) + } + if f.Has(repoBar) { + t.Errorf("%s was not successfully removed from repositories list", repoBar) + } +} From 4c05a92131fae85ea33b2b705528fa12dc884e80 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Sun, 15 Apr 2018 23:37:13 +0800 Subject: [PATCH 188/449] Typo fix in functions_and_pipelines.md useable->usable --- docs/chart_template_guide/functions_and_pipelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/functions_and_pipelines.md b/docs/chart_template_guide/functions_and_pipelines.md index 54eb8e24f..66176fc59 100644 --- a/docs/chart_template_guide/functions_and_pipelines.md +++ b/docs/chart_template_guide/functions_and_pipelines.md @@ -1,6 +1,6 @@ # Template Functions and Pipelines -So far, we've seen how to place information into a template. But that information is placed into the template unmodified. Sometimes we want to transform the supplied data in a way that makes it more useable to us. +So far, we've seen how to place information into a template. But that information is placed into the template unmodified. Sometimes we want to transform the supplied data in a way that makes it more usable to us. Let's start with a best practice: When injecting strings from the `.Values` object into the template, we ought to quote these strings. We can do that by calling the `quote` function in the template directive: From 3a85809716edbfba8e8f71f3f6d8a324f0fef139 Mon Sep 17 00:00:00 2001 From: Derek Bassett Date: Thu, 22 Mar 2018 23:21:45 -0600 Subject: [PATCH 189/449] Add App Version to the helm ls command. --- cmd/helm/list.go | 5 +++-- cmd/helm/list_test.go | 27 ++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 4332ceb21..c2633d21c 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -237,7 +237,7 @@ func formatList(rels []*release.Release, colWidth uint) string { table := uitable.New() table.MaxColWidth = colWidth - table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "NAMESPACE") + table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "APP VERSION", "NAMESPACE") for _, r := range rels { md := r.GetChart().GetMetadata() c := fmt.Sprintf("%s-%s", md.GetName(), md.GetVersion()) @@ -247,8 +247,9 @@ func formatList(rels []*release.Release, colWidth uint) string { } s := r.GetInfo().GetStatus().GetCode().String() v := r.GetVersion() + a := md.GetAppVersion() n := r.GetNamespace() - table.AddRow(r.GetName(), v, t, s, c, n) + table.AddRow(r.GetName(), v, t, s, c, a, n) } return table.String() } diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index d853fa6b1..e292b4b5a 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -22,11 +22,29 @@ import ( "github.com/spf13/cobra" + "io/ioutil" + "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" + "os" ) func TestListCmd(t *testing.T) { + tmpChart, _ := ioutil.TempDir("testdata", "tmp") + defer os.RemoveAll(tmpChart) + cfile := &chart.Metadata{ + Name: "foo", + Description: "A Helm chart for Kubernetes", + Version: "0.1.0-beta.1", + AppVersion: "2.X.A", + } + chartPath, err := chartutil.Create(cfile, tmpChart) + if err != nil { + t.Errorf("Error creating chart for list: %v", err) + } + ch, _ := chartutil.Load(chartPath) + tests := []releaseCase{ { name: "with a release", @@ -40,7 +58,14 @@ func TestListCmd(t *testing.T) { rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}), }, - expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\tdefault \n", + expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tAPP VERSION\tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\t \tdefault \n", + }, + { + name: "list with appVersion", + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas", Chart: ch}), + }, + expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tAPP VERSION\tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\t2.X.A \tdefault \n", }, { name: "list, one deployed, one failed", From 23e054d49dd71cf633600113b1aa473a2b5aee31 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Tue, 17 Apr 2018 14:42:09 +0800 Subject: [PATCH 190/449] Correct the returned message in reset_test.go Correct the returned message --- cmd/helm/reset_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/reset_test.go b/cmd/helm/reset_test.go index ae6a00036..189b69273 100644 --- a/cmd/helm/reset_test.go +++ b/cmd/helm/reset_test.go @@ -123,7 +123,7 @@ func verifyResetCmd(t *testing.T, tc resetCase) { } _, err = os.Stat(home) if !tc.removeHelmHome && err != nil { - t.Errorf("Helm home directory %s does not exists", home) + t.Errorf("Helm home directory %s does not exist", home) } if tc.removeHelmHome && err == nil { t.Errorf("Helm home directory %s exists", home) From 401a73207475600ed78c0cb0bcb28f7133c7b62d Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Sat, 14 Apr 2018 11:29:27 -0400 Subject: [PATCH 191/449] ref(pkg/plugin): create clean path for extracting plugins --- glide.lock | 10 ++- glide.yaml | 2 + pkg/plugin/installer/http_installer.go | 16 ++-- pkg/plugin/installer/http_installer_test.go | 88 +++++++++++++++++++++ 4 files changed, 108 insertions(+), 8 deletions(-) diff --git a/glide.lock b/glide.lock index 6c54c927c..a91c31b7b 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 6837936360d447b64aa7a09d3c89c18ac5540b009a57fc4d3227af299bf40268 -updated: 2018-04-03T08:17:14.801847688-07:00 +hash: 4023a1644d60060fbf2fdbbe5b73cbb4b957eb686ce925640d102db2d1858676 +updated: 2018-04-14T11:27:34.604716498-04:00 imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -31,6 +31,8 @@ imports: version: 71acacd42f85e5e82f70a55327789582a5200a90 subpackages: - md2man +- name: github.com/cyphar/filepath-securejoin + version: 06bda8370f45268db985f7af15732444d94ed51c - name: github.com/davecgh/go-spew version: 782f4967f2dc4564575ca782fe2d04090b5faca8 subpackages: @@ -210,6 +212,8 @@ imports: version: ca53cad383cad2479bbba7f7a1a05797ec1386e4 - name: github.com/peterbourgon/diskv version: 5f041e8faa004a95c88a202771f4cc3e991971e6 +- name: github.com/pkg/errors + version: 645ef00459ed84a119197bfb8d8205042c6df63d - name: github.com/prometheus/client_golang version: c5b7fccd204277076155f10851dad72b76a49317 subpackages: @@ -641,7 +645,7 @@ imports: - pkg/util/proto - pkg/util/proto/validation - name: k8s.io/kubernetes - version: a22f9fd34871d9dc9e5db2c02c713821d18ab2cd + version: baab3992147260d47cb59b9c485a24fdeff2e457 subpackages: - pkg/api/events - pkg/api/legacyscheme diff --git a/glide.yaml b/glide.yaml index 7fcb16d0b..ce5d0e8c2 100644 --- a/glide.yaml +++ b/glide.yaml @@ -57,6 +57,8 @@ import: version: release-1.10 - package: k8s.io/apiserver version: release-1.10 +- package: github.com/cyphar/filepath-securejoin + version: ^0.2.1 testImports: - package: github.com/stretchr/testify diff --git a/pkg/plugin/installer/http_installer.go b/pkg/plugin/installer/http_installer.go index 91d497651..b5c205de6 100644 --- a/pkg/plugin/installer/http_installer.go +++ b/pkg/plugin/installer/http_installer.go @@ -21,14 +21,17 @@ import ( "compress/gzip" "fmt" "io" - "k8s.io/helm/pkg/getter" - "k8s.io/helm/pkg/helm/environment" - "k8s.io/helm/pkg/helm/helmpath" - "k8s.io/helm/pkg/plugin/cache" "os" "path/filepath" "regexp" "strings" + + fp "github.com/cyphar/filepath-securejoin" + + "k8s.io/helm/pkg/getter" + "k8s.io/helm/pkg/helm/environment" + "k8s.io/helm/pkg/helm/helmpath" + "k8s.io/helm/pkg/plugin/cache" ) // HTTPInstaller installs plugins from an archive served by a web server. @@ -181,7 +184,10 @@ func (g *TarGzExtractor) Extract(buffer *bytes.Buffer, targetDir string) error { return err } - path := filepath.Join(targetDir, header.Name) + path, err := fp.SecureJoin(targetDir, header.Name) + if err != nil { + return err + } switch header.Typeflag { case tar.TypeDir: diff --git a/pkg/plugin/installer/http_installer_test.go b/pkg/plugin/installer/http_installer_test.go index ca1a71e3e..bab5f7a92 100644 --- a/pkg/plugin/installer/http_installer_test.go +++ b/pkg/plugin/installer/http_installer_test.go @@ -16,12 +16,15 @@ limitations under the License. package installer // import "k8s.io/helm/pkg/plugin/installer" import ( + "archive/tar" "bytes" + "compress/gzip" "encoding/base64" "fmt" "io/ioutil" "k8s.io/helm/pkg/helm/helmpath" "os" + "path/filepath" "testing" ) @@ -187,3 +190,88 @@ func TestHTTPInstallerUpdate(t *testing.T) { t.Error("update method not implemented for http installer") } } + +func TestExtract(t *testing.T) { + //create a temp home + hh, err := ioutil.TempDir("", "helm-home-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(hh) + + home := helmpath.Home(hh) + if err := os.MkdirAll(home.Plugins(), 0755); err != nil { + t.Fatalf("Could not create %s: %s", home.Plugins(), err) + } + + cacheDir := filepath.Join(home.Cache(), "plugins", "plugin-key") + if err := os.MkdirAll(cacheDir, 0755); err != nil { + t.Fatalf("Could not create %s: %s", cacheDir, err) + } + + //{"plugin.yaml", "plugin metadata up in here"}, + //{"README.md", "so you know what's upp"}, + //{"script.sh", "echo script"}, + + var tarbuf bytes.Buffer + tw := tar.NewWriter(&tarbuf) + var files = []struct { + Name, Body string + }{ + {"../../plugin.yaml", "sneaky plugin metadata"}, + {"README.md", "some text"}, + } + for _, file := range files { + hdr := &tar.Header{ + Name: file.Name, + Typeflag: tar.TypeReg, + Mode: 0600, + Size: int64(len(file.Body)), + } + if err := tw.WriteHeader(hdr); err != nil { + t.Fatal(err) + } + if _, err := tw.Write([]byte(file.Body)); err != nil { + t.Fatal(err) + } + } + if err := tw.Close(); err != nil { + t.Fatal(err) + } + + var buf bytes.Buffer + gz := gzip.NewWriter(&buf) + if _, err := gz.Write(tarbuf.Bytes()); err != nil { + t.Fatal(err) + } + gz.Close() + + source := "https://repo.localdomain/plugins/fake-plugin-0.0.1.tgz" + extr, err := NewExtractor(source) + if err != nil { + t.Fatal(err) + } + + if err = extr.Extract(&buf, cacheDir); err != nil { + t.Errorf("Did not expect error but got error: %v", err) + } + + pluginYAMLFullPath := filepath.Join(cacheDir, "plugin.yaml") + if _, err := os.Stat(pluginYAMLFullPath); err != nil { + if os.IsNotExist(err) { + t.Errorf("Expected %s to exist but doesn't", pluginYAMLFullPath) + } else { + t.Error(err) + } + } + + readmeFullPath := filepath.Join(cacheDir, "README.md") + if _, err := os.Stat(readmeFullPath); err != nil { + if os.IsNotExist(err) { + t.Errorf("Expected %s to exist but doesn't", readmeFullPath) + } else { + t.Error(err) + } + } + +} From d822907a0372e0e2806f3ca9ff55d391bc19e5c7 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Tue, 17 Apr 2018 15:04:53 -0400 Subject: [PATCH 192/449] fix(pkg/strvals): evaluate "null" values resolves #3891 Co-authored-by: Matthew Fisher --- pkg/strvals/parser.go | 8 ++++++++ pkg/strvals/parser_test.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index aa3d15904..8d20c3bc3 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -82,6 +82,10 @@ func ParseIntoString(s string, dest map[string]interface{}) error { // parser is a simple parser that takes a strvals line and parses it into a // map representation. +// +// where sc is the source of the original data being parsed +// where data is the final parsed data from the parses with correct types +// where st is a boolean to figure out if we're forcing it to parse values as string type parser struct { sc *bytes.Buffer data map[string]interface{} @@ -329,6 +333,10 @@ func typedVal(v []rune, st bool) interface{} { return false } + if strings.EqualFold(val, "null") { + return nil + } + // If this value does not start with zero, and not returnString, try parsing it to an int if !st && len(val) != 0 && val[0] != '0' { if iv, err := strconv.ParseInt(val, 10, 64); err == nil { diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index fd287bf8a..482377c32 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -81,6 +81,11 @@ func TestParseSet(t *testing.T) { expect map[string]interface{} err bool }{ + { + "name1=null,f=false,t=true", + map[string]interface{}{"name1": nil, "f": false, "t": true}, + false, + }, { "name1=value1", map[string]interface{}{"name1": "value1"}, From 474f261ea195d7f878ea0700692731d13956c7ca Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Tue, 17 Apr 2018 15:14:09 -0700 Subject: [PATCH 193/449] fix(kube): use correct object type in watch fixes #3902 --- pkg/kube/client.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 8a7402938..08707fa76 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -47,7 +47,6 @@ import ( "k8s.io/client-go/tools/clientcmd" batchinternal "k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/conditions" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" @@ -686,12 +685,27 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf c.Log("Watching pod %s for completion with timeout of %v", info.Name, timeout) _, err = watch.Until(timeout, w, func(e watch.Event) (bool, error) { - return conditions.PodCompleted(e) + return isPodComplete(e) }) return err } +func isPodComplete(event watch.Event) (bool, error) { + o, ok := event.Object.(*core.Pod) + if !ok { + return true, fmt.Errorf("expected a *core.Pod, got %T", event.Object) + } + if event.Type == watch.Deleted { + return false, fmt.Errorf("pod not found") + } + switch o.Status.Phase { + case core.PodFailed, core.PodSucceeded: + return true, nil + } + return false, nil +} + //get a kubernetes resources' relation pods // kubernetes resource used select labels to relate pods func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]core.Pod) (map[string][]core.Pod, error) { From aab3fb1bdb5f0de3c928c16b2d59da947a382615 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 17 Apr 2018 16:36:50 -0700 Subject: [PATCH 194/449] swallow the error when returning the default HTTP client --- pkg/downloader/chart_downloader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index fe2f3ce92..8b386fc09 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -183,7 +183,7 @@ func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*u r := &repo.ChartRepository{} r.Client = g g.SetCredentials(c.getRepoCredentials(r)) - return u, r, g, err + return u, r, g, nil } return u, nil, nil, err } From 609a2d2fc73e39c3fb78ef6b9ad207cf12d408a3 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Wed, 18 Apr 2018 11:42:56 -0700 Subject: [PATCH 195/449] fix(kube): get correct versioned object from info helper fixes: #3826 --- pkg/kube/client.go | 85 ++++++++++++++++------------------------------ pkg/kube/wait.go | 2 +- 2 files changed, 30 insertions(+), 57 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 08707fa76..34d979d47 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -35,9 +35,7 @@ import ( extv1beta1 "k8s.io/api/extensions/v1beta1" apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" @@ -393,12 +391,12 @@ func deleteResource(c *Client, info *resource.Info) error { return reaper.Stop(info.Namespace, info.Name, 0, nil) } -func createPatch(mapping *meta.RESTMapping, target, current runtime.Object) ([]byte, types.PatchType, error) { +func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.PatchType, error) { oldData, err := json.Marshal(current) if err != nil { return nil, types.StrategicMergePatchType, fmt.Errorf("serializing current configuration: %s", err) } - newData, err := json.Marshal(target) + newData, err := json.Marshal(target.Object) if err != nil { return nil, types.StrategicMergePatchType, fmt.Errorf("serializing target configuration: %s", err) } @@ -412,7 +410,7 @@ func createPatch(mapping *meta.RESTMapping, target, current runtime.Object) ([]b } // Get a versioned object - versionedObject, err := mapping.ConvertToVersion(target, mapping.GroupVersionKind.GroupVersion()) + versionedObject, err := target.Versioned() // Unstructured objects, such as CRDs, may not have an not registered error // returned from ConvertToVersion. Anything that's unstructured should @@ -434,7 +432,7 @@ func createPatch(mapping *meta.RESTMapping, target, current runtime.Object) ([]b } func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, force bool, recreate bool) error { - patch, patchType, err := createPatch(target.Mapping, target.Object, currentObj) + patch, patchType, err := createPatch(target, currentObj) if err != nil { return fmt.Errorf("failed to create patch: %s", err) } @@ -484,16 +482,9 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, return nil } - versioned, err := c.AsVersionedObject(target.Object) - if runtime.IsNotRegisteredError(err) { - return nil - } - if err != nil { - return err - } - - selector, err := getSelectorFromObject(versioned) - if err != nil { + versioned := target.AsVersioned() + selector, ok := getSelectorFromObject(versioned) + if !ok { return nil } @@ -522,45 +513,45 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, return nil } -func getSelectorFromObject(obj runtime.Object) (map[string]string, error) { +func getSelectorFromObject(obj runtime.Object) (map[string]string, bool) { switch typed := obj.(type) { case *v1.ReplicationController: - return typed.Spec.Selector, nil + return typed.Spec.Selector, true case *extv1beta1.ReplicaSet: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1.ReplicaSet: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *extv1beta1.Deployment: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1beta1.Deployment: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1beta2.Deployment: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1.Deployment: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *extv1beta1.DaemonSet: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1beta2.DaemonSet: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1.DaemonSet: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *batch.Job: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1beta1.StatefulSet: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1beta2.StatefulSet: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true case *appsv1.StatefulSet: - return typed.Spec.Selector.MatchLabels, nil + return typed.Spec.Selector.MatchLabels, true default: - return nil, fmt.Errorf("Unsupported kind when getting selector: %v", obj) + return nil, false } } @@ -605,18 +596,6 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err return err } -// AsVersionedObject converts a runtime.object to a versioned object. -func (c *Client) AsVersionedObject(obj runtime.Object) (runtime.Object, error) { - json, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj) - if err != nil { - return nil, err - } - versions := &runtime.VersionedObjects{} - decoder := unstructured.UnstructuredJSONScheme - err = runtime.DecodeInto(decoder, json, versions) - return versions.First(), err -} - // waitForJob is a helper that waits for a job to complete. // // This operates on an event returned from a watcher. @@ -715,22 +694,16 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] c.Log("get relation pod of object: %s/%s/%s", info.Namespace, info.Mapping.GroupVersionKind.Kind, info.Name) - versioned, err := c.AsVersionedObject(info.Object) - if runtime.IsNotRegisteredError(err) { + versioned, err := info.Versioned() + switch { + case runtime.IsNotRegisteredError(err): return objPods, nil - } - if err != nil { + case err != nil: return objPods, err } - // We can ignore this error because it will only error if it isn't a type that doesn't - // have pods. In that case, we don't care - selector, _ := getSelectorFromObject(versioned) - - selectorString := labels.Set(selector).AsSelector().String() - - // If we have an empty selector, this likely is a service or config map, so bail out now - if selectorString == "" { + selector, ok := getSelectorFromObject(versioned) + if !ok { return objPods, nil } diff --git a/pkg/kube/wait.go b/pkg/kube/wait.go index 27ede15db..88f3c7d34 100644 --- a/pkg/kube/wait.go +++ b/pkg/kube/wait.go @@ -56,7 +56,7 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { pvc := []v1.PersistentVolumeClaim{} deployments := []deployment{} for _, v := range created { - obj, err := c.AsVersionedObject(v.Object) + obj, err := v.Versioned() if err != nil && !runtime.IsNotRegisteredError(err) { return false, err } From 2c386c7af33dddb42c2a62dcbb63b00ff2b62076 Mon Sep 17 00:00:00 2001 From: Sean Eagan Date: Wed, 18 Apr 2018 13:27:37 -0500 Subject: [PATCH 196/449] feat(list): Optional output as JSON and YAML The choice of interface `--output (json|yaml)` is to match that of the status command, except that -o is not available as it is already used by --offset. WIP #1534 --- cmd/helm/list.go | 138 +++++++++++++++++++++++++++++++++-------- cmd/helm/list_test.go | 80 +++++++++++++++++++++++- docs/helm/helm_list.md | 3 +- pkg/helm/fake.go | 23 ++++++- 4 files changed, 215 insertions(+), 29 deletions(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index c2633d21c..4614c7f67 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -17,10 +17,12 @@ limitations under the License. package main import ( + "encoding/json" "fmt" "io" "strings" + "github.com/ghodss/yaml" "github.com/gosuri/uitable" "github.com/spf13/cobra" @@ -75,6 +77,22 @@ type listCmd struct { pending bool client helm.Interface colWidth uint + output string +} + +type listResult struct { + Next string + Releases []listRelease +} + +type listRelease struct { + Name string + Revision int32 + Updated string + Status string + Chart string + AppVersion string + Namespace string } func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { @@ -114,6 +132,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&list.pending, "pending", false, "show pending releases") f.StringVar(&list.namespace, "namespace", "", "show releases within a specific namespace") f.UintVar(&list.colWidth, "col-width", 60, "specifies the max column width of output") + f.StringVar(&list.output, "output", "", "output the specified format (json or yaml)") // TODO: Do we want this as a feature of 'helm list'? //f.BoolVar(&list.superseded, "history", true, "show historical releases") @@ -148,23 +167,17 @@ func (l *listCmd) run() error { return prettyError(err) } - if len(res.GetReleases()) == 0 { - return nil - } + rels := filterList(res.Releases) - if res.Next != "" && !l.short { - fmt.Fprintf(l.out, "\tnext: %s\n", res.Next) - } + result := getListResult(rels, res.Next) - rels := filterList(res.Releases) + output, err := formatResult(l.output, l.short, result, l.colWidth) - if l.short { - for _, r := range rels { - fmt.Fprintln(l.out, r.Name) - } - return nil + if err != nil { + return prettyError(err) } - fmt.Fprintln(l.out, formatList(rels, l.colWidth)) + + fmt.Fprintln(l.out, output) return nil } @@ -233,23 +246,98 @@ func (l *listCmd) statusCodes() []release.Status_Code { return status } -func formatList(rels []*release.Release, colWidth uint) string { - table := uitable.New() - - table.MaxColWidth = colWidth - table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "APP VERSION", "NAMESPACE") +func getListResult(rels []*release.Release, next string) listResult { + listReleases := []listRelease{} for _, r := range rels { md := r.GetChart().GetMetadata() - c := fmt.Sprintf("%s-%s", md.GetName(), md.GetVersion()) t := "-" if tspb := r.GetInfo().GetLastDeployed(); tspb != nil { t = timeconv.String(tspb) } - s := r.GetInfo().GetStatus().GetCode().String() - v := r.GetVersion() - a := md.GetAppVersion() - n := r.GetNamespace() - table.AddRow(r.GetName(), v, t, s, c, a, n) + + lr := listRelease{ + Name: r.GetName(), + Revision: r.GetVersion(), + Updated: t, + Status: r.GetInfo().GetStatus().GetCode().String(), + Chart: fmt.Sprintf("%s-%s", md.GetName(), md.GetVersion()), + AppVersion: md.GetAppVersion(), + Namespace: r.GetNamespace(), + } + listReleases = append(listReleases, lr) + } + + return listResult{ + Releases: listReleases, + Next: next, } - return table.String() +} + +func shortenListResult(result listResult) []string { + names := []string{} + for _, r := range result.Releases { + names = append(names, r.Name) + } + + return names +} + +func formatResult(format string, short bool, result listResult, colWidth uint) (string, error) { + var output string + var err error + + var shortResult []string + var finalResult interface{} + if short { + shortResult = shortenListResult(result) + finalResult = shortResult + } else { + finalResult = result + } + + switch format { + case "": + if short { + output = formatTextShort(shortResult) + } else { + output = formatText(result, colWidth) + } + case "json": + o, e := json.Marshal(finalResult) + if e != nil { + err = fmt.Errorf("Failed to Marshal JSON output: %s", e) + } else { + output = string(o) + } + case "yaml": + o, e := yaml.Marshal(finalResult) + if e != nil { + err = fmt.Errorf("Failed to Marshal YAML output: %s", e) + } else { + output = string(o) + } + default: + err = fmt.Errorf("Unknown output format \"%s\"", format) + } + return output, err +} + +func formatText(result listResult, colWidth uint) string { + nextOutput := "" + if result.Next != "" { + nextOutput = fmt.Sprintf("\tnext: %s\n", result.Next) + } + + table := uitable.New() + table.MaxColWidth = colWidth + table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "APP VERSION", "NAMESPACE") + for _, lr := range result.Releases { + table.AddRow(lr.Name, lr.Revision, lr.Updated, lr.Status, lr.Chart, lr.AppVersion, lr.Namespace) + } + + return fmt.Sprintf("%s%s", nextOutput, table.String()) +} + +func formatTextShort(shortResult []string) string { + return strings.Join(shortResult, "\n") } diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index e292b4b5a..e0faee935 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -18,16 +18,18 @@ package main import ( "io" + "regexp" "testing" "github.com/spf13/cobra" "io/ioutil" + "os" + "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" - "os" ) func TestListCmd(t *testing.T) { @@ -46,6 +48,11 @@ func TestListCmd(t *testing.T) { ch, _ := chartutil.Load(chartPath) tests := []releaseCase{ + { + name: "empty", + rels: []*release.Release{}, + expected: "", + }, { name: "with a release", rels: []*release.Release{ @@ -67,6 +74,77 @@ func TestListCmd(t *testing.T) { }, expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tAPP VERSION\tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\t2.X.A \tdefault \n", }, + { + name: "with json output", + flags: []string{"--max", "1", "--output", "json"}, + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide"}), + }, + expected: regexp.QuoteMeta(`{"Next":"atlas-guide","Releases":[{"Name":"thomas-guide","Revision":1,"Updated":"`) + `([^"]*)` + regexp.QuoteMeta(`","Status":"DEPLOYED","Chart":"foo-0.1.0-beta.1","AppVersion":"","Namespace":"default"}]} +`), + }, + { + name: "with yaml output", + flags: []string{"--max", "1", "--output", "yaml"}, + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide"}), + }, + expected: regexp.QuoteMeta(`Next: atlas-guide +Releases: +- AppVersion: "" + Chart: foo-0.1.0-beta.1 + Name: thomas-guide + Namespace: default + Revision: 1 + Status: DEPLOYED + Updated: `) + `(.*)` + ` + +`, + }, + { + name: "with short json output", + flags: []string{"-q", "--output", "json"}, + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}), + }, + expected: regexp.QuoteMeta(`["atlas"] +`), + }, + { + name: "with short yaml output", + flags: []string{"-q", "--output", "yaml"}, + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}), + }, + expected: regexp.QuoteMeta(`- atlas + +`), + }, + { + name: "with json output without next", + flags: []string{"--output", "json"}, + rels: []*release.Release{}, + expected: regexp.QuoteMeta(`{"Next":"","Releases":[]} +`), + }, + { + name: "with yaml output without next", + flags: []string{"--output", "yaml"}, + rels: []*release.Release{}, + expected: regexp.QuoteMeta(`Next: "" +Releases: [] + +`), + }, + { + name: "with unknown output format", + flags: []string{"--output", "_unknown_"}, + rels: []*release.Release{}, + err: true, + expected: regexp.QuoteMeta(``), + }, { name: "list, one deployed, one failed", flags: []string{"-q"}, diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index 1d5bf7ea2..99872a413 100755 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -49,6 +49,7 @@ helm list [flags] [FILTER] -m, --max int maximum number of releases to fetch (default 256) --namespace string show releases within a specific namespace -o, --offset string next release name in the list, used to offset from start value + --output string output the specified format (json or yaml) --pending show pending releases -r, --reverse reverse the sort order -q, --short output short (quiet) listing format @@ -73,4 +74,4 @@ helm list [flags] [FILTER] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Apr-2018 diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index 0a9e77c44..68d39a6ab 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -49,9 +49,28 @@ var _ Interface = (*FakeClient)(nil) // ListReleases lists the current releases func (c *FakeClient) ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesResponse, error) { + reqOpts := c.Opts + for _, opt := range opts { + opt(&reqOpts) + } + req := &reqOpts.listReq + rels := c.Rels + count := int64(len(c.Rels)) + var next string + limit := req.GetLimit() + // TODO: Handle all other options. + if limit != 0 && limit < count { + rels = rels[:limit] + count = limit + next = c.Rels[limit].GetName() + } + resp := &rls.ListReleasesResponse{ - Count: int64(len(c.Rels)), - Releases: c.Rels, + Count: count, + Releases: rels, + } + if next != "" { + resp.Next = next } return resp, nil } From bfa0a82296f86819cc0981b46a38d44373e4ff75 Mon Sep 17 00:00:00 2001 From: Colin Dickson Date: Thu, 19 Apr 2018 19:20:42 -0400 Subject: [PATCH 197/449] fixed flag for tls ca cert option in the documentation --- docs/securing_installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index 5c420242e..9f74f6049 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -95,10 +95,10 @@ If these steps are followed, an example `helm init` command might look something $ helm init \ --tiller-tls \ --tiller-tls-verify \ ---tiller-tls-ca-cert=ca.pem \ --tiller-tls-cert=cert.pem \ --tiller-tls-key=key.pem \ ---service-account=accountname +--tls-ca-cert=ca.pem \ +--service-account=accountname ``` This command will start Tiller with both strong authentication over gRPC, and a service account to which RBAC policies have been applied. From 9deec7569cd17a3686a9a5bd97a0a9704a4303d7 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Mon, 23 Apr 2018 13:05:12 +0800 Subject: [PATCH 198/449] Typo fix in plugins.md "that that"->"that" "that that"->"that" --- docs/plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins.md b/docs/plugins.md index 82bcfe33b..3087d1b39 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -183,7 +183,7 @@ If a plugin specifies `useTunnel: true`, Helm will do the following (in order): 5. Close the tunnel The tunnel is removed as soon as the `command` returns. So, for example, a -command cannot background a process and assume that that process will be able +command cannot background a process and assume that process will be able to use the tunnel. ## A Note on Flag Parsing From d71e674b3c2cb1da0ac77d6a16107ef2f3c9719e Mon Sep 17 00:00:00 2001 From: AdamDang Date: Mon, 23 Apr 2018 13:06:24 +0800 Subject: [PATCH 199/449] Update install.go --- cmd/helm/installer/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index 58cdeb5b1..7bf192aca 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -74,7 +74,7 @@ func Upgrade(client kubernetes.Interface, opts *Options) error { if _, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Update(obj); err != nil { return err } - // If the service does not exists that would mean we are upgrading from a Tiller version + // If the service does not exist that would mean we are upgrading from a Tiller version // that didn't deploy the service, so install it. _, err = client.CoreV1().Services(opts.Namespace).Get(serviceName, metav1.GetOptions{}) if apierrors.IsNotFound(err) { From 04b3fafb50c80db307d2287766ab25de2c07d12b Mon Sep 17 00:00:00 2001 From: Julius Kammerl Date: Mon, 23 Apr 2018 15:42:07 +0200 Subject: [PATCH 200/449] Avoid to call 'go' with empty -tags argument go1.10.1 linux/amd64 complains: flag provided but not defined: -tags when compiling with: "make build-cross dist". This seems to fix it. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2dfbd2c3c..a8f778377 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ build: .PHONY: build-cross build-cross: LDFLAGS += -extldflags "-static" build-cross: - CGO_ENABLED=0 gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/$(APP) + CGO_ENABLED=0 gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/$(APP) .PHONY: dist dist: From fef99c6287856ae1ae56b7fc4fc9f617c94057b3 Mon Sep 17 00:00:00 2001 From: Fabian Ruff Date: Mon, 23 Apr 2018 20:12:40 +0200 Subject: [PATCH 201/449] Fix --tiller-namespace flag for plugins This fixes using `--tiller-namespace $namespace` flag (without the equal sign) for helm plugins. --- cmd/helm/load_plugins.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index ef24e7883..f4c97bde7 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -131,7 +131,7 @@ func manuallyProcessArgs(args []string) ([]string, []string) { switch a := args[i]; a { case "--debug": known = append(known, a) - case "--host", "--kube-context", "--home": + case "--host", "--kube-context", "--home", "--tiller-namespace": known = append(known, a, args[i+1]) i++ default: From 9eec592b3be5d8cdc39cb37472a147dd95d13dad Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Mon, 23 Apr 2018 14:30:34 -0700 Subject: [PATCH 202/449] fix(kube): output internal object table fixes #3937 --- pkg/kube/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 34d979d47..e4c6b6a9f 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -178,7 +178,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // versions per cluster, but this certainly won't hurt anything, so let's be safe. gvk := info.ResourceMapping().GroupVersionKind vk := gvk.Version + "/" + gvk.Kind - objs[vk] = append(objs[vk], info.Object) + objs[vk] = append(objs[vk], info.AsInternal()) //Get the relation pods objPods, err = c.getSelectRelationPod(info, objPods) From 62ce81a57853b7312daf719419c4cacf810eb744 Mon Sep 17 00:00:00 2001 From: Marat Garafutdinov Date: Mon, 23 Apr 2018 16:35:29 -0700 Subject: [PATCH 203/449] add --col-width to `helm search` (#3949) * add customizeable --col-width * make docs. whitespacing --- cmd/helm/search.go | 8 +++++--- docs/helm/helm_search.md | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/helm/search.go b/cmd/helm/search.go index 845bfd0be..ab284a898 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -47,6 +47,7 @@ type searchCmd struct { versions bool regexp bool version string + colWidth uint } func newSearchCmd(out io.Writer) *cobra.Command { @@ -66,6 +67,7 @@ func newSearchCmd(out io.Writer) *cobra.Command { f.BoolVarP(&sc.regexp, "regexp", "r", false, "use regular expressions for searching") f.BoolVarP(&sc.versions, "versions", "l", false, "show the long listing, with each version of each chart on its own line") f.StringVarP(&sc.version, "version", "v", "", "search using semantic versioning constraints") + f.UintVar(&sc.colWidth, "col-width", 60, "specifies the max column width of output") return cmd } @@ -93,7 +95,7 @@ func (s *searchCmd) run(args []string) error { return err } - fmt.Fprintln(s.out, s.formatSearchResults(data)) + fmt.Fprintln(s.out, s.formatSearchResults(data, s.colWidth)) return nil } @@ -126,12 +128,12 @@ func (s *searchCmd) applyConstraint(res []*search.Result) ([]*search.Result, err return data, nil } -func (s *searchCmd) formatSearchResults(res []*search.Result) string { +func (s *searchCmd) formatSearchResults(res []*search.Result, colWidth uint) string { if len(res) == 0 { return "No results found" } table := uitable.New() - table.MaxColWidth = 50 + table.MaxColWidth = colWidth table.AddRow("NAME", "CHART VERSION", "APP VERSION", "DESCRIPTION") for _, r := range res { table.AddRow(r.Name, r.Chart.Version, r.Chart.AppVersion, r.Chart.Description) diff --git a/docs/helm/helm_search.md b/docs/helm/helm_search.md index f59814b9a..1ed04e880 100644 --- a/docs/helm/helm_search.md +++ b/docs/helm/helm_search.md @@ -19,6 +19,7 @@ helm search [keyword] ### Options ``` + --col-width uint specifies the max column width of output (default 60) -r, --regexp use regular expressions for searching -v, --version string search using semantic versioning constraints -l, --versions show the long listing, with each version of each chart on its own line @@ -38,4 +39,4 @@ helm search [keyword] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 23-Apr-2018 From b499d85f695ac946cc8c34b7a2b787f15161e206 Mon Sep 17 00:00:00 2001 From: BarryWilliams Date: Mon, 23 Apr 2018 22:25:11 -0400 Subject: [PATCH 204/449] Changed whitespacing in comments --- pkg/chartutil/files.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index a34605a27..b71ef5759 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -211,8 +211,8 @@ func ToToml(v interface{}) string { // always return a string, even on marshal error (empty string). // // This is designed to be called from a template. -//TODO:change the function signature in Helm 3 -func ToJson(v interface{}) string { //nolint +// TODO: change the function signature in Helm 3 +func ToJson(v interface{}) string { // nolint data, err := json.Marshal(v) if err != nil { // Swallow errors inside of a template. @@ -227,8 +227,8 @@ func ToJson(v interface{}) string { //nolint // JSON documents. Additionally, because its intended use is within templates // it tolerates errors. It will insert the returned error message string into // m["Error"] in the returned map. -//TODO:change the function signature in Helm 3 -func FromJson(str string) map[string]interface{} { //nolint +// TODO: change the function signature in Helm 3 +func FromJson(str string) map[string]interface{} { // nolint m := map[string]interface{}{} if err := json.Unmarshal([]byte(str), &m); err != nil { From d52c315166d55fe259165aa1d9d1d634f7316e42 Mon Sep 17 00:00:00 2001 From: Julien Bordellier Date: Tue, 24 Apr 2018 15:26:57 +0200 Subject: [PATCH 205/449] Add quoting support in ingress to allow wildcard domain --- pkg/chartutil/create.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 4c6b484a9..30c6310b2 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -143,14 +143,14 @@ spec: {{- range .Values.ingress.tls }} - hosts: {{- range .hosts }} - - {{ . }} + - {{ . | quote }} {{- end }} secretName: {{ .secretName }} {{- end }} {{- end }} rules: {{- range .Values.ingress.hosts }} - - host: {{ . }} + - host: {{ . | quote }} http: paths: - path: {{ $ingressPath }} From a0f2bd80aa695afb57981b5a3106d459d999231f Mon Sep 17 00:00:00 2001 From: eyalbe4 Date: Wed, 25 Apr 2018 03:44:47 +0300 Subject: [PATCH 206/449] Fix for - Downloader plugins not used when downloading new repo's index.yaml #3938 --- pkg/downloader/chart_downloader.go | 73 ++++++++++++++---------------- pkg/repo/chartrepo.go | 18 +++++--- 2 files changed, 45 insertions(+), 46 deletions(-) diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 8b386fc09..6861a8270 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -23,6 +23,7 @@ import ( "net/url" "os" "path/filepath" + "reflect" "strings" "k8s.io/helm/pkg/getter" @@ -85,7 +86,7 @@ type ChartDownloader struct { // Returns a string path to the location where the file was downloaded and a verification // (if provenance was verified), or an error if something bad happened. func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *provenance.Verification, error) { - u, r, g, err := c.ResolveChartVersionAndGetRepo(ref, version) + u, g, err := c.ResolveChartVersion(ref, version) if err != nil { return "", nil, err } @@ -104,7 +105,7 @@ func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *proven // If provenance is requested, verify it. ver := &provenance.Verification{} if c.Verify > VerifyNever { - body, err := r.Client.Get(u.String() + ".prov") + body, err := g.Get(u.String() + ".prov") if err != nil { if c.Verify == VerifyAlways { return destfile, ver, fmt.Errorf("Failed to fetch provenance %q", u.String()+".prov") @@ -144,28 +145,14 @@ func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *proven // * If version is empty, this will return the URL for the latest version // * If no version can be found, an error is returned func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, getter.Getter, error) { - u, r, _, err := c.ResolveChartVersionAndGetRepo(ref, version) - if r != nil { - return u, r.Client, err - } - return u, nil, err -} - -// ResolveChartVersionAndGetRepo is the same as the ResolveChartVersion method, but returns the chart repositoryy. -func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*url.URL, *repo.ChartRepository, *getter.HttpGetter, error) { u, err := url.Parse(ref) if err != nil { - return nil, nil, nil, fmt.Errorf("invalid chart URL format: %s", ref) + return nil, nil, fmt.Errorf("invalid chart URL format: %s", ref) } rf, err := repo.LoadRepositoriesFile(c.HelmHome.RepositoryFile()) if err != nil { - return u, nil, nil, err - } - - g, err := getter.NewHTTPGetter(ref, "", "", "") - if err != nil { - return u, nil, nil, err + return u, nil, err } if u.IsAbs() && len(u.Host) > 0 && len(u.Path) > 0 { @@ -180,23 +167,26 @@ func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*u // If there is no special config, return the default HTTP client and // swallow the error. if err == ErrNoOwnerRepo { - r := &repo.ChartRepository{} - r.Client = g - g.SetCredentials(c.getRepoCredentials(r)) - return u, r, g, nil + getterConstructor, err := c.Getters.ByScheme(u.Scheme) + if err != nil { + return u, nil, err + } + getter, err := getterConstructor(ref, "", "", "") + return u, getter, err } - return u, nil, nil, err + return u, nil, err } r, err := repo.NewChartRepository(rc, c.Getters) + c.setCredentials(r) // If we get here, we don't need to go through the next phase of looking // up the URL. We have it already. So we just return. - return u, r, g, err + return u, r.Client, err } // See if it's of the form: repo/path_to_chart p := strings.SplitN(u.Path, "/", 2) if len(p) < 2 { - return u, nil, nil, fmt.Errorf("Non-absolute URLs should be in form of repo_name/path_to_chart, got: %s", u) + return u, nil, fmt.Errorf("Non-absolute URLs should be in form of repo_name/path_to_chart, got: %s", u) } repoName := p[0] @@ -204,56 +194,59 @@ func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*u rc, err := pickChartRepositoryConfigByName(repoName, rf.Repositories) if err != nil { - return u, nil, nil, err + return u, nil, err } r, err := repo.NewChartRepository(rc, c.Getters) if err != nil { - return u, nil, nil, err + return u, nil, err } - g.SetCredentials(c.getRepoCredentials(r)) + c.setCredentials(r) // Next, we need to load the index, and actually look up the chart. i, err := repo.LoadIndexFile(c.HelmHome.CacheIndex(r.Config.Name)) if err != nil { - return u, r, g, fmt.Errorf("no cached repo found. (try 'helm repo update'). %s", err) + return u, r.Client, fmt.Errorf("no cached repo found. (try 'helm repo update'). %s", err) } cv, err := i.Get(chartName, version) if err != nil { - return u, r, g, fmt.Errorf("chart %q matching %s not found in %s index. (try 'helm repo update'). %s", chartName, version, r.Config.Name, err) + return u, r.Client, fmt.Errorf("chart %q matching %s not found in %s index. (try 'helm repo update'). %s", chartName, version, r.Config.Name, err) } if len(cv.URLs) == 0 { - return u, r, g, fmt.Errorf("chart %q has no downloadable URLs", ref) + return u, r.Client, fmt.Errorf("chart %q has no downloadable URLs", ref) } // TODO: Seems that picking first URL is not fully correct u, err = url.Parse(cv.URLs[0]) if err != nil { - return u, r, g, fmt.Errorf("invalid chart URL format: %s", ref) + return u, r.Client, fmt.Errorf("invalid chart URL format: %s", ref) } // If the URL is relative (no scheme), prepend the chart repo's base URL if !u.IsAbs() { repoURL, err := url.Parse(rc.URL) if err != nil { - return repoURL, r, nil, err + return repoURL, r.Client, err } q := repoURL.Query() // We need a trailing slash for ResolveReference to work, but make sure there isn't already one repoURL.Path = strings.TrimSuffix(repoURL.Path, "/") + "/" u = repoURL.ResolveReference(u) u.RawQuery = q.Encode() - g, err := getter.NewHTTPGetter(rc.URL, "", "", "") - if err != nil { - return repoURL, r, nil, err - } - g.SetCredentials(c.getRepoCredentials(r)) - return u, r, g, err + return u, r.Client, err } - return u, r, g, nil + return u, r.Client, nil +} + +// If HttpGetter is used, this method sets the configured repository credentials on the HttpGetter. +func (c *ChartDownloader) setCredentials(r *repo.ChartRepository) { + var t *getter.HttpGetter + if reflect.TypeOf(r.Client) == reflect.TypeOf(t) { + r.Client.(*getter.HttpGetter).SetCredentials(c.getRepoCredentials(r)) + } } // If this ChartDownloader is not configured to use credentials, and the chart repository sent as an argument is, diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index bf03a68bb..ba1e6f4ff 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -22,6 +22,7 @@ import ( "net/url" "os" "path/filepath" + "reflect" "strings" "github.com/ghodss/yaml" @@ -119,12 +120,9 @@ func (r *ChartRepository) DownloadIndexFile(cachePath string) error { parsedURL.Path = strings.TrimSuffix(parsedURL.Path, "/") + "/index.yaml" indexURL = parsedURL.String() - g, err := getter.NewHTTPGetter(indexURL, r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile) - if err != nil { - return err - } - g.SetCredentials(r.Config.Username, r.Config.Password) - resp, err := g.Get(indexURL) + + r.setCredentials() + resp, err := r.Client.Get(indexURL) if err != nil { return err } @@ -152,6 +150,14 @@ func (r *ChartRepository) DownloadIndexFile(cachePath string) error { return ioutil.WriteFile(cp, index, 0644) } +// If HttpGetter is used, this method sets the configured repository credentials on the HttpGetter. +func (r *ChartRepository) setCredentials() { + var t *getter.HttpGetter + if reflect.TypeOf(r.Client) == reflect.TypeOf(t) { + r.Client.(*getter.HttpGetter).SetCredentials(r.Config.Username, r.Config.Password) + } +} + // Index generates an index for the chart repository and writes an index.yaml file. func (r *ChartRepository) Index() error { err := r.generateIndex() From b38a75bf58930b27b01d96e8f0586ddf6bcdcd74 Mon Sep 17 00:00:00 2001 From: Julien Bordellier Date: Wed, 25 Apr 2018 17:02:32 +0200 Subject: [PATCH 207/449] Change tiller's Dockerfile to use USER nobody + upgrades to alpine:3.7 --- rootfs/Dockerfile | 8 ++++---- rootfs/Dockerfile.experimental | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index 53757cd8d..ca5ad2225 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -12,15 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine:3.3 +FROM alpine:3.7 RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* ENV HOME /tmp -COPY tiller /tiller +COPY tiller /bin/tiller EXPOSE 44134 - -CMD ["/tiller"] +USER nobody +ENTRYPOINT ["/bin/tiller"] diff --git a/rootfs/Dockerfile.experimental b/rootfs/Dockerfile.experimental index 990bcde51..66a218477 100644 --- a/rootfs/Dockerfile.experimental +++ b/rootfs/Dockerfile.experimental @@ -12,15 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine:3.3 +FROM alpine:3.7 RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* ENV HOME /tmp -COPY tiller /tiller +COPY tiller /bin/tiller EXPOSE 44134 - -CMD ["/tiller", "--experimental-release"] +USER nobody +ENTRYPOINT ["/bin/tiller", "--experimental-release"] From c465aa11ffcb7d16b7abe67a85cc9c63223b8dda Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 25 Apr 2018 14:55:05 -0700 Subject: [PATCH 208/449] remove need for type reflection --- pkg/downloader/chart_downloader.go | 6 ++---- pkg/repo/chartrepo.go | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 6861a8270..59b9d4d75 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -23,7 +23,6 @@ import ( "net/url" "os" "path/filepath" - "reflect" "strings" "k8s.io/helm/pkg/getter" @@ -243,9 +242,8 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, ge // If HttpGetter is used, this method sets the configured repository credentials on the HttpGetter. func (c *ChartDownloader) setCredentials(r *repo.ChartRepository) { - var t *getter.HttpGetter - if reflect.TypeOf(r.Client) == reflect.TypeOf(t) { - r.Client.(*getter.HttpGetter).SetCredentials(c.getRepoCredentials(r)) + if t, ok := r.Client.(*getter.HttpGetter); ok { + t.SetCredentials(c.getRepoCredentials(r)) } } diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index ba1e6f4ff..438f66d7c 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -22,7 +22,6 @@ import ( "net/url" "os" "path/filepath" - "reflect" "strings" "github.com/ghodss/yaml" @@ -152,9 +151,8 @@ func (r *ChartRepository) DownloadIndexFile(cachePath string) error { // If HttpGetter is used, this method sets the configured repository credentials on the HttpGetter. func (r *ChartRepository) setCredentials() { - var t *getter.HttpGetter - if reflect.TypeOf(r.Client) == reflect.TypeOf(t) { - r.Client.(*getter.HttpGetter).SetCredentials(r.Config.Username, r.Config.Password) + if t, ok := r.Client.(*getter.HttpGetter); ok { + t.SetCredentials(r.Config.Username, r.Config.Password) } } From c4ada7977afcd93992a8be59bd40c8ccedbe98b0 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 8 Feb 2017 13:56:49 -0800 Subject: [PATCH 209/449] build helm binary in tiller image --- .gitignore | 1 + Makefile | 1 + rootfs/Dockerfile | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b94f87b26..7fdfdcf2a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ _dist/ _proto/*.pb.go bin/ +rootfs/helm rootfs/tiller rootfs/rudder vendor/ diff --git a/Makefile b/Makefile index a8f778377..54cc1ff18 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,7 @@ check-docker: docker-binary: BINDIR = ./rootfs docker-binary: GOFLAGS += -a -installsuffix cgo docker-binary: + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -o $(BINDIR)/helm $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/helm GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -o $(BINDIR)/tiller $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/tiller .PHONY: docker-build diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index ca5ad2225..ef426616a 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -14,10 +14,11 @@ FROM alpine:3.7 -RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* +RUN apk update && apk add ca-certificates socat && rm -rf /var/cache/apk/* ENV HOME /tmp +COPY helm /bin/helm COPY tiller /bin/tiller EXPOSE 44134 From b13ff1b37d8d31ee6c59f3a9718a30a35de3d2fe Mon Sep 17 00:00:00 2001 From: Julien Bordellier Date: Thu, 26 Apr 2018 10:41:54 +0200 Subject: [PATCH 210/449] docs(helm): update Globs examples to work correctly --- docs/chart_template_guide/accessing_files.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/chart_template_guide/accessing_files.md b/docs/chart_template_guide/accessing_files.md index 250fd9520..11747d4f0 100644 --- a/docs/chart_template_guide/accessing_files.md +++ b/docs/chart_template_guide/accessing_files.md @@ -119,9 +119,10 @@ You have multiple options with Globs: ```yaml -{{ range $path := .Files.Glob "**.yaml" }} -{{ $path }}: | -{{ .Files.Get $path }} +{{ $root := . }} +{{ range $path, $bytes := .Files.Glob "**.yaml" }} +{{ $path }}: |- +{{ $root.Files.Get $path }} {{ end }} ``` @@ -129,7 +130,7 @@ Or ```yaml {{ range $path, $bytes := .Files.Glob "foo/*" }} -{{ $path }}: '{{ b64enc $bytes }}' +{{ $path.base }}: '{{ $root.Files.Get $path | b64enc }}' {{ end }} ``` From b58ec27c500c6257681a4ad13d2af936232a4897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herbert=20M=C3=BChlburger?= Date: Fri, 27 Apr 2018 14:14:37 +0200 Subject: [PATCH 211/449] #3763 replace backslash with forward slash --- pkg/chartutil/save.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index bff32dde5..dd835a924 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -24,6 +24,7 @@ import ( "io/ioutil" "os" "path/filepath" + "strings" "github.com/ghodss/yaml" @@ -204,6 +205,7 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error { // writeToTar writes a single file to a tar archive. func writeToTar(out *tar.Writer, name string, body []byte) error { // TODO: Do we need to create dummy parent directory names if none exist? + name = strings.Replace(name, "\\", "/", -1) h := &tar.Header{ Name: name, Mode: 0755, From 2f47bf940505953429425ac6409585b9b4731ef2 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 27 Apr 2018 12:30:46 -0700 Subject: [PATCH 212/449] Revert "toYaml - Fix #3470 and #3410's trailing \n issues" --- pkg/chartutil/files.go | 2 +- pkg/chartutil/files_test.go | 8 ++++---- pkg/strvals/parser.go | 2 +- pkg/strvals/parser_test.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index b71ef5759..a09bb8f43 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -175,7 +175,7 @@ func ToYaml(v interface{}) string { // Swallow errors inside of a template. return "" } - return strings.TrimSuffix(string(data), "\n") + return string(data) } // FromYaml converts a YAML document into a map[string]interface{}. diff --git a/pkg/chartutil/files_test.go b/pkg/chartutil/files_test.go index 5cec35883..731c82e6f 100644 --- a/pkg/chartutil/files_test.go +++ b/pkg/chartutil/files_test.go @@ -72,10 +72,10 @@ func TestToConfig(t *testing.T) { f := NewFiles(getTestFiles()) out := f.Glob("**/captain.txt").AsConfig() - as.Equal("captain.txt: The Captain", out) + as.Equal("captain.txt: The Captain\n", out) out = f.Glob("ship/**").AsConfig() - as.Equal("captain.txt: The Captain\nstowaway.txt: Legatt", out) + as.Equal("captain.txt: The Captain\nstowaway.txt: Legatt\n", out) } func TestToSecret(t *testing.T) { @@ -84,7 +84,7 @@ func TestToSecret(t *testing.T) { f := NewFiles(getTestFiles()) out := f.Glob("ship/**").AsSecrets() - as.Equal("captain.txt: VGhlIENhcHRhaW4=\nstowaway.txt: TGVnYXR0", out) + as.Equal("captain.txt: VGhlIENhcHRhaW4=\nstowaway.txt: TGVnYXR0\n", out) } func TestLines(t *testing.T) { @@ -99,7 +99,7 @@ func TestLines(t *testing.T) { } func TestToYaml(t *testing.T) { - expect := "foo: bar" + expect := "foo: bar\n" v := struct { Foo string `json:"foo"` }{ diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 8d20c3bc3..90670a4dd 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -36,7 +36,7 @@ func ToYAML(s string) (string, error) { return "", err } d, err := yaml.Marshal(m) - return strings.TrimSuffix(string(d), "\n"), err + return string(d), err } // Parse parses a set line. diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index 482377c32..c897cf0a7 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -370,7 +370,7 @@ func TestToYAML(t *testing.T) { if err != nil { t.Fatal(err) } - expect := "name: value" + expect := "name: value\n" if o != expect { t.Errorf("Expected %q, got %q", expect, o) } From c8b45e81da133ab2db97553964c10e8980059fb9 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 27 Apr 2018 15:33:48 -0700 Subject: [PATCH 213/449] Revert "Fix tiller deployment on RBAC clusters" --- cmd/helm/installer/install.go | 4 +--- cmd/helm/installer/install_test.go | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index 7bf192aca..c5fb1dc80 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -205,7 +205,6 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { return nil, err } } - automountServiceAccountToken := opts.ServiceAccount != "" d := &v1beta1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Namespace: opts.Namespace, @@ -219,8 +218,7 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { Labels: labels, }, Spec: v1.PodSpec{ - ServiceAccountName: opts.ServiceAccount, - AutomountServiceAccountToken: &automountServiceAccountToken, + ServiceAccountName: opts.ServiceAccount, Containers: []v1.Container{ { Name: "tiller", diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index c27d978cf..72d2d7039 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -88,9 +88,6 @@ func TestDeploymentForServiceAccount(t *testing.T) { if got := d.Spec.Template.Spec.ServiceAccountName; got != tt.serviceAccount { t.Errorf("%s: expected service account value %q, got %q", tt.name, tt.serviceAccount, got) } - if got := *d.Spec.Template.Spec.AutomountServiceAccountToken; got != (tt.serviceAccount != "") { - t.Errorf("%s: unexpected automountServiceAccountToken = %t for serviceAccount %q", tt.name, got, tt.serviceAccount) - } } } From 1c757e46ef2515bc9baab3b639715f81bf05f572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herbert=20M=C3=BChlburger?= Date: Sat, 28 Apr 2018 09:16:46 +0200 Subject: [PATCH 214/449] Refactor to be more precise --- pkg/chartutil/save.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index dd835a924..201372a0f 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -24,7 +24,6 @@ import ( "io/ioutil" "os" "path/filepath" - "strings" "github.com/ghodss/yaml" @@ -205,9 +204,8 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error { // writeToTar writes a single file to a tar archive. func writeToTar(out *tar.Writer, name string, body []byte) error { // TODO: Do we need to create dummy parent directory names if none exist? - name = strings.Replace(name, "\\", "/", -1) h := &tar.Header{ - Name: name, + Name: filepath.ToSlash(name), Mode: 0755, Size: int64(len(body)), } From f942a08682dcb7b8c7223d8430b3f106f608d011 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Sun, 29 Apr 2018 13:46:46 +0800 Subject: [PATCH 215/449] Typo fix: evalutes->evaluates --- pkg/ignore/rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ignore/rules.go b/pkg/ignore/rules.go index 76f45fc7a..185d289bb 100644 --- a/pkg/ignore/rules.go +++ b/pkg/ignore/rules.go @@ -77,7 +77,7 @@ func (r *Rules) Len() int { return len(r.patterns) } -// Ignore evalutes the file at the given path, and returns true if it should be ignored. +// Ignore evaluates the file at the given path, and returns true if it should be ignored. // // Ignore evaluates path against the rules in order. Evaluation stops when a match // is found. Matching a negative rule will stop evaluation. From 9dce199f989461b6cdeab6c5e4e347fbff717b18 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Mon, 7 May 2018 00:15:35 +0800 Subject: [PATCH 216/449] Typo fix: usa helm->use helm usa helm->use helm --- docs/securing_installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index 9f74f6049..4083bf188 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -53,7 +53,7 @@ This situation may change in the future. While the community has several methods In the default installation the gRPC endpoint that Tiller offers is available inside the cluster (not external to the cluster) without authentication configuration applied. Without applying authentication, any process in the cluster can use the gRPC endpoint to perform operations inside the cluster. In a local or secured private cluster, this enables rapid usage and is normal. (When running outside the cluster, Helm authenticates through the Kubernetes API server to reach Tiller, leveraging existing Kubernetes authentication support.) -Shared and production clusters -- for the most part -- should use Helm 2.7.2 at a minimum and configure TLS for each Tiller gRPC endpoint to ensure that within the cluster usage of gRPC endpoints is only for the properly authenticated identity for that endpoint. Doing so enables any number of Tiller instances to be deployed in any number of namespaces and yet no unauthenticated usage of any gRPC endpoint is possible. Finally, usa Helm `init` with the `--tiller-tls-verify` option to install Tiller with TLS enabled and to verify remote certificates, and all other Helm commands should use the `--tls` option. +Shared and production clusters -- for the most part -- should use Helm 2.7.2 at a minimum and configure TLS for each Tiller gRPC endpoint to ensure that within the cluster usage of gRPC endpoints is only for the properly authenticated identity for that endpoint. Doing so enables any number of Tiller instances to be deployed in any number of namespaces and yet no unauthenticated usage of any gRPC endpoint is possible. Finally, use Helm `init` with the `--tiller-tls-verify` option to install Tiller with TLS enabled and to verify remote certificates, and all other Helm commands should use the `--tls` option. For more information about the proper steps to configure Tiller and use Helm properly with TLS configured, see [Using SSL between Helm and Tiller](tiller_ssl.md). From c507797677fb1d1a95b35fb80f6ee7dbb0e82bb0 Mon Sep 17 00:00:00 2001 From: Taylor Thomas Date: Thu, 10 May 2018 14:30:09 -0700 Subject: [PATCH 217/449] docs(release_checklist): Adds information about new release meetings We have decided to start having release meetings to define clear objectives for a release. This documents the process. --- docs/release_checklist.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 26506985c..de047971e 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -2,9 +2,36 @@ **IMPORTANT**: If your experience deviates from this document, please document the changes to keep it up-to-date. +## Release Meetings +As part of the release process, two of the weekly developer calls will be co-opted +as "release meetings." + +### Start of the Release Cycle +The first developer call after a release will be used as the release meeting to +start the next release cycle. During this meeting, the following items must be +identified: + +- Release date +- Goals/Objectives for this release +- The release manager (basically whoever is going to cut the release) +- Any other important details for the community + +All of this information should be added to the GitHub milestone for the given +release. This should give the community and maintainers a clear set of guidelines +to follow when choosing whether or not to add issues and PRs to a given release. + +### End (almost) of the Release Cycle +The developer call closest to two weeks before the scheduled release date will +be used to review any remaining PRs that should be pulled into the release. This +is the place to debate whether or not we should wait before cutting a release and +any other concerns. At the end of this meeting, if the release date has not been +pushed out, the first RC should be cut. Subsequent developer calls in between this +meeting and the release date should have some time set aside to see if any bugs +were found. Once the release date is reached, the final release can be cut + ## A Maintainer's Guide to Releasing Helm -So you're in charge of a new release for helm? Cool. Here's what to do... +So you're in charge of a new release for Helm? Cool. Here's what to do... ![TODO: Nothing](images/nothing.png) From 74769eccd5ad1cf66b3bb3820d933177dacd5afa Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Fri, 11 May 2018 12:09:38 -0600 Subject: [PATCH 218/449] feat(tiller): support CRD installation (#3982) This adds support for installing CRDs well before any other resource kinds are installed. This PR introduces a new hook, `crd-install`, that fires before manifests are even validated. It is used to install a CRD before any other part of a chart is installed. Currently, this hook is _only implemented for install_. That means we currently cannot add new CRDs during `helm upgrade`, nor can they be rolled back. This is the safest configuration, as the update/rollback cycle gets very challenging when CRDs are added and removed. --- _proto/hapi/release/hook.proto | 1 + _proto/hapi/services/tiller.proto | 2 + cmd/helm/install.go | 51 +++++---- docs/charts_hooks.md | 61 +++++++++- docs/helm/helm_install.md | 3 +- pkg/helm/client.go | 1 + pkg/helm/option.go | 9 ++ pkg/hooks/hooks.go | 1 + pkg/proto/hapi/release/hook.pb.go | 58 +++++----- pkg/proto/hapi/services/tiller.pb.go | 165 ++++++++++++++------------- pkg/tiller/hooks.go | 6 +- pkg/tiller/release_install.go | 43 ++++++- pkg/tiller/release_install_test.go | 82 +++++++++++++ pkg/tiller/release_server.go | 21 ++-- pkg/tiller/release_server_test.go | 19 +++ 15 files changed, 378 insertions(+), 145 deletions(-) diff --git a/_proto/hapi/release/hook.proto b/_proto/hapi/release/hook.proto index f0332ecb8..0d96dd9ae 100644 --- a/_proto/hapi/release/hook.proto +++ b/_proto/hapi/release/hook.proto @@ -34,6 +34,7 @@ message Hook { POST_ROLLBACK = 8; RELEASE_TEST_SUCCESS = 9; RELEASE_TEST_FAILURE = 10; + CRD_INSTALL = 11; } enum DeletePolicy { SUCCEEDED = 0; diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 5897676ab..8daef0cb3 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -271,6 +271,8 @@ message InstallReleaseRequest { // wait, if true, will wait until all Pods, PVCs, and Services are in a ready state // before marking the release as successful. It will wait for as long as timeout bool wait = 9; + + bool disable_crd_hook = 10; } // InstallReleaseResponse is the response from a release installation. diff --git a/cmd/helm/install.go b/cmd/helm/install.go index d52dbc667..2dafd85ba 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -106,28 +106,29 @@ charts in a repository, use 'helm search'. ` type installCmd struct { - name string - namespace string - valueFiles valueFiles - chartPath string - dryRun bool - disableHooks bool - replace bool - verify bool - keyring string - out io.Writer - client helm.Interface - values []string - stringValues []string - nameTemplate string - version string - timeout int64 - wait bool - repoURL string - username string - password string - devel bool - depUp bool + name string + namespace string + valueFiles valueFiles + chartPath string + dryRun bool + disableHooks bool + disableCRDHook bool + replace bool + verify bool + keyring string + out io.Writer + client helm.Interface + values []string + stringValues []string + nameTemplate string + version string + timeout int64 + wait bool + repoURL string + username string + password string + devel bool + depUp bool certFile string keyFile string @@ -190,6 +191,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&inst.namespace, "namespace", "", "namespace to install the release into. Defaults to the current kube config namespace.") f.BoolVar(&inst.dryRun, "dry-run", false, "simulate an install") f.BoolVar(&inst.disableHooks, "no-hooks", false, "prevent hooks from running during install") + f.BoolVar(&inst.disableCRDHook, "no-crd-hook", false, "prevent CRD hooks from running, but run other hooks") f.BoolVar(&inst.replace, "replace", false, "re-use the given name, even if that name is already used. This is unsafe in production") f.StringArrayVar(&inst.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringArrayVar(&inst.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") @@ -273,6 +275,7 @@ func (i *installCmd) run() error { helm.InstallDryRun(i.dryRun), helm.InstallReuseName(i.replace), helm.InstallDisableHooks(i.disableHooks), + helm.InstallDisableCRDHook(i.disableCRDHook), helm.InstallTimeout(i.timeout), helm.InstallWait(i.wait)) if err != nil { @@ -287,6 +290,10 @@ func (i *installCmd) run() error { // If this is a dry run, we can't display status. if i.dryRun { + // This is special casing to avoid breaking backward compatibility: + if res.Release.Info.Description != "Dry run complete" { + fmt.Fprintf(os.Stdout, "WARNING: %s\n", res.Release.Info.Description) + } return nil } diff --git a/docs/charts_hooks.md b/docs/charts_hooks.md index 4142f2ce0..f51749f57 100644 --- a/docs/charts_hooks.md +++ b/docs/charts_hooks.md @@ -16,6 +16,17 @@ Hooks work like regular templates, but they have special annotations that cause Helm to utilize them differently. In this section, we cover the basic usage pattern for hooks. +Hooks are declared as an annotation in the metadata section of a manifest: + +```yaml +apiVersion: ... +kind: .... +metadata: + annotations: + "helm.sh/hook": "pre-install" +# ... +``` + ## The Available Hooks The following hooks are defined: @@ -36,6 +47,8 @@ The following hooks are defined: rendered, but before any resources have been rolled back. - post-rollback: Executes on a rollback request after all resources have been modified. +- crd-install: Adds CRD resources before any other checks are run. This is used + only on CRD definitions that are used by other manifests in the chart. ## Hooks and the Release Lifecycle @@ -62,7 +75,7 @@ hooks, the lifecycle is altered like this: Kubernetes) 5. Tiller sorts hooks by weight (assigning a weight of 0 by default) and by name for those hooks with the same weight in ascending order. 6. Tiller then loads the hook with the lowest weight first (negative to positive) -7. Tiller waits until the hook is "Ready" +7. Tiller waits until the hook is "Ready" (except for CRDs) 8. Tiller loads the resulting resources into Kubernetes. Note that if the `--wait` flag is set, Tiller will wait until all resources are in a ready state and will not run the `post-install` hook until they are ready. @@ -185,6 +198,52 @@ You can choose one or more defined annotation values: * `"hook-failed"` specifies Tiller should delete the hook if the hook failed during execution. * `"before-hook-creation"` specifies Tiller should delete the previous hook before the new hook is launched. +### Defining a CRD with the `crd-install` Hook + +Custom Resource Definitions (CRDs) are a special kind in Kubernetes. They provide +a way to define other kinds. + +On occasion, a chart needs to both define a kind and then use it. This is done +with the `crd-install` hook. + +The `crd-install` hook is executed very early during an installation, before +the rest of the manifests are verified. CRDs can be annotated with this hook so +that they are installed before any instances of that CRD are referenced. In this +way, when verification happens later, the CRDs will be available. + +Here is an example of defining a CRD with a hook, and an instance of the CRD: + +```yaml +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: crontabs.stable.example.com + annotations: + "helm.sh/hook": crd-install +spec: + group: stable.example.com + version: v1 + scope: Namespaced + names: + plural: crontabs + singular: crontab + kind: CronTab + shortNames: + - ct +``` + +And: + +```yaml +apiVersion: stable.example.com/v1 +kind: CronTab +metadata: + name: {{ .Release.Name }}-inst +``` + +Both of these can now be in the same chart, provided that the CRD is correctly +annotated. + ### Automatically delete hook from previous release When helm release being updated it is possible, that hook resource already exists in cluster. By default helm will try to create resource and fail with `"... already exists"` error. diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 25ccea1bd..9f1ad86b0 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -84,6 +84,7 @@ helm install [CHART] -n, --name string release name. If unspecified, it will autogenerate one for you --name-template string specify template used to name the release --namespace string namespace to install the release into. Defaults to the current kube config namespace. + --no-crd-hook prevent CRD hooks from running, but run other hooks --no-hooks prevent hooks from running during install --password string chart repository password where to locate the requested chart --replace re-use the given name, even if that name is already used. This is unsafe in production @@ -117,4 +118,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 20-Mar-2018 +###### Auto generated by spf13/cobra on 27-Apr-2018 diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 43e9f4daf..465ca0af8 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -97,6 +97,7 @@ func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ... req.Namespace = ns req.DryRun = reqOpts.dryRun req.DisableHooks = reqOpts.disableHooks + req.DisableCrdHook = reqOpts.disableCRDHook req.ReuseName = reqOpts.reuseName ctx := NewContext() diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 3381e3f80..602e1e3a3 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -51,6 +51,8 @@ type options struct { force bool // if set, skip running hooks disableHooks bool + // if set, skip CRD hook only + disableCRDHook bool // name of release releaseName string // tls.Config to use for rpc if tls enabled @@ -295,6 +297,13 @@ func InstallDisableHooks(disable bool) InstallOption { } } +// InstallDisableCRDHook disables CRD hook during installation. +func InstallDisableCRDHook(disable bool) InstallOption { + return func(opts *options) { + opts.disableCRDHook = disable + } +} + // InstallReuseName will (if true) instruct Tiller to re-use an existing name. func InstallReuseName(reuse bool) InstallOption { return func(opts *options) { diff --git a/pkg/hooks/hooks.go b/pkg/hooks/hooks.go index 80f838368..64118333d 100644 --- a/pkg/hooks/hooks.go +++ b/pkg/hooks/hooks.go @@ -41,6 +41,7 @@ const ( PostRollback = "post-rollback" ReleaseTestSuccess = "test-success" ReleaseTestFailure = "test-failure" + CRDInstall = "crd-install" ) // Type of policy for deleting the hook diff --git a/pkg/proto/hapi/release/hook.pb.go b/pkg/proto/hapi/release/hook.pb.go index 00fa5c188..0a44165c8 100644 --- a/pkg/proto/hapi/release/hook.pb.go +++ b/pkg/proto/hapi/release/hook.pb.go @@ -52,6 +52,7 @@ const ( Hook_POST_ROLLBACK Hook_Event = 8 Hook_RELEASE_TEST_SUCCESS Hook_Event = 9 Hook_RELEASE_TEST_FAILURE Hook_Event = 10 + Hook_CRD_INSTALL Hook_Event = 11 ) var Hook_Event_name = map[int32]string{ @@ -66,6 +67,7 @@ var Hook_Event_name = map[int32]string{ 8: "POST_ROLLBACK", 9: "RELEASE_TEST_SUCCESS", 10: "RELEASE_TEST_FAILURE", + 11: "CRD_INSTALL", } var Hook_Event_value = map[string]int32{ "UNKNOWN": 0, @@ -79,6 +81,7 @@ var Hook_Event_value = map[string]int32{ "POST_ROLLBACK": 8, "RELEASE_TEST_SUCCESS": 9, "RELEASE_TEST_FAILURE": 10, + "CRD_INSTALL": 11, } func (x Hook_Event) String() string { @@ -199,33 +202,34 @@ func init() { func init() { proto.RegisterFile("hapi/release/hook.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 445 bytes of a gzipped FileDescriptorProto + // 453 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x51, 0x8f, 0x9a, 0x40, - 0x10, 0x80, 0x8f, 0x13, 0x41, 0x47, 0xcf, 0xdb, 0x6e, 0x9a, 0x76, 0xe3, 0xcb, 0x19, 0x9f, 0x7c, + 0x10, 0x80, 0x8f, 0x53, 0x41, 0x47, 0xcf, 0xdb, 0x6e, 0x9a, 0x76, 0xe3, 0xcb, 0x19, 0x9f, 0x7c, 0xc2, 0xe6, 0x9a, 0xfe, 0x00, 0x84, 0xb9, 0x6a, 0x24, 0x60, 0x16, 0x4c, 0x93, 0xbe, 0x10, 0xae, - 0xee, 0x29, 0x11, 0x81, 0x08, 0xb6, 0xe9, 0x0f, 0xec, 0x3f, 0xe8, 0x0f, 0x6a, 0x76, 0x45, 0x7b, - 0x49, 0xfb, 0x36, 0xf3, 0xcd, 0x37, 0xc3, 0x0c, 0x0b, 0xef, 0x77, 0x49, 0x99, 0x4e, 0x8f, 0x22, - 0x13, 0x49, 0x25, 0xa6, 0xbb, 0xa2, 0xd8, 0x5b, 0xe5, 0xb1, 0xa8, 0x0b, 0xda, 0x97, 0x05, 0xab, - 0x29, 0x0c, 0x1f, 0xb6, 0x45, 0xb1, 0xcd, 0xc4, 0x54, 0xd5, 0x9e, 0x4f, 0x2f, 0xd3, 0x3a, 0x3d, - 0x88, 0xaa, 0x4e, 0x0e, 0xe5, 0x59, 0x1f, 0xff, 0xd2, 0x41, 0x9f, 0x17, 0xc5, 0x9e, 0x52, 0xd0, - 0xf3, 0xe4, 0x20, 0x98, 0x36, 0xd2, 0x26, 0x5d, 0xae, 0x62, 0xc9, 0xf6, 0x69, 0xbe, 0x61, 0xb7, - 0x67, 0x26, 0x63, 0xc9, 0xca, 0xa4, 0xde, 0xb1, 0xd6, 0x99, 0xc9, 0x98, 0x0e, 0xa1, 0x73, 0x48, - 0xf2, 0xf4, 0x45, 0x54, 0x35, 0xd3, 0x15, 0xbf, 0xe6, 0xf4, 0x03, 0x18, 0xe2, 0xbb, 0xc8, 0xeb, - 0x8a, 0xb5, 0x47, 0xad, 0xc9, 0xe0, 0x91, 0x59, 0xaf, 0x17, 0xb4, 0xe4, 0xb7, 0x2d, 0x94, 0x02, - 0x6f, 0x3c, 0xfa, 0x09, 0x3a, 0x59, 0x52, 0xd5, 0xf1, 0xf1, 0x94, 0x33, 0x63, 0xa4, 0x4d, 0x7a, - 0x8f, 0x43, 0xeb, 0x7c, 0x86, 0x75, 0x39, 0xc3, 0x8a, 0x2e, 0x67, 0x70, 0x53, 0xba, 0xfc, 0x94, - 0xd3, 0x77, 0x60, 0xfc, 0x10, 0xe9, 0x76, 0x57, 0x33, 0x73, 0xa4, 0x4d, 0xda, 0xbc, 0xc9, 0xe8, - 0x1c, 0xee, 0x37, 0x22, 0x13, 0xb5, 0x88, 0xcb, 0x22, 0x4b, 0xbf, 0xa5, 0xa2, 0x62, 0x1d, 0xb5, - 0xc9, 0xc3, 0x7f, 0x36, 0x71, 0x95, 0xb9, 0x92, 0xe2, 0x4f, 0x3e, 0xd8, 0xfc, 0xcd, 0x52, 0x51, - 0x8d, 0x7f, 0x6b, 0xd0, 0x56, 0xab, 0xd2, 0x1e, 0x98, 0x6b, 0x7f, 0xe9, 0x07, 0x5f, 0x7c, 0x72, - 0x43, 0xef, 0xa1, 0xb7, 0xe2, 0x18, 0x2f, 0xfc, 0x30, 0xb2, 0x3d, 0x8f, 0x68, 0x94, 0x40, 0x7f, - 0x15, 0x84, 0xd1, 0x95, 0xdc, 0xd2, 0x01, 0x80, 0x54, 0x5c, 0xf4, 0x30, 0x42, 0xd2, 0x52, 0x2d, - 0xd2, 0x68, 0x80, 0x7e, 0x99, 0xb1, 0x5e, 0x7d, 0xe6, 0xb6, 0x8b, 0xa4, 0x7d, 0x9d, 0x71, 0x21, - 0x86, 0x22, 0x1c, 0x63, 0x1e, 0x78, 0xde, 0xcc, 0x76, 0x96, 0xc4, 0xa4, 0x6f, 0xe0, 0x4e, 0x39, - 0x57, 0xd4, 0xa1, 0x0c, 0xde, 0x72, 0xf4, 0xd0, 0x0e, 0x31, 0x8e, 0x30, 0x8c, 0xe2, 0x70, 0xed, - 0x38, 0x18, 0x86, 0xa4, 0xfb, 0x4f, 0xe5, 0xc9, 0x5e, 0x78, 0x6b, 0x8e, 0x04, 0xc6, 0x0e, 0xf4, - 0x5f, 0x9f, 0x4d, 0xef, 0xa0, 0xab, 0xda, 0xd0, 0x45, 0x97, 0xdc, 0x50, 0x00, 0x43, 0xba, 0xe8, - 0x12, 0x4d, 0x0e, 0x99, 0xe1, 0x53, 0xc0, 0x31, 0x9e, 0x07, 0xc1, 0x32, 0x76, 0x38, 0xda, 0xd1, - 0x22, 0xf0, 0xc9, 0xed, 0xac, 0xfb, 0xd5, 0x6c, 0x7e, 0xe4, 0xb3, 0xa1, 0x5e, 0xe9, 0xe3, 0x9f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x13, 0x64, 0x75, 0x6c, 0xa3, 0x02, 0x00, 0x00, + 0xee, 0x29, 0x11, 0x81, 0x08, 0xb6, 0xe9, 0x1f, 0xed, 0x3f, 0xe8, 0xff, 0x68, 0x76, 0x45, 0x7a, + 0x49, 0xfb, 0x36, 0xf3, 0xcd, 0xb7, 0xb3, 0x33, 0xbb, 0xf0, 0x7e, 0x1f, 0x17, 0xc9, 0xec, 0x24, + 0x52, 0x11, 0x97, 0x62, 0xb6, 0xcf, 0xf3, 0x83, 0x59, 0x9c, 0xf2, 0x2a, 0xa7, 0x03, 0x59, 0x30, + 0xeb, 0xc2, 0xe8, 0x61, 0x97, 0xe7, 0xbb, 0x54, 0xcc, 0x54, 0xed, 0xf9, 0xfc, 0x32, 0xab, 0x92, + 0xa3, 0x28, 0xab, 0xf8, 0x58, 0x5c, 0xf4, 0xc9, 0xaf, 0x36, 0xb4, 0x17, 0x79, 0x7e, 0xa0, 0x14, + 0xda, 0x59, 0x7c, 0x14, 0x4c, 0x1b, 0x6b, 0xd3, 0x1e, 0x57, 0xb1, 0x64, 0x87, 0x24, 0xdb, 0xb2, + 0xdb, 0x0b, 0x93, 0xb1, 0x64, 0x45, 0x5c, 0xed, 0x59, 0xeb, 0xc2, 0x64, 0x4c, 0x47, 0xd0, 0x3d, + 0xc6, 0x59, 0xf2, 0x22, 0xca, 0x8a, 0xb5, 0x15, 0x6f, 0x72, 0xfa, 0x01, 0x74, 0xf1, 0x5d, 0x64, + 0x55, 0xc9, 0x3a, 0xe3, 0xd6, 0x74, 0xf8, 0xc8, 0xcc, 0xd7, 0x03, 0x9a, 0xf2, 0x6e, 0x13, 0xa5, + 0xc0, 0x6b, 0x8f, 0x7e, 0x82, 0x6e, 0x1a, 0x97, 0x55, 0x74, 0x3a, 0x67, 0x4c, 0x1f, 0x6b, 0xd3, + 0xfe, 0xe3, 0xc8, 0xbc, 0xac, 0x61, 0x5e, 0xd7, 0x30, 0xc3, 0xeb, 0x1a, 0xdc, 0x90, 0x2e, 0x3f, + 0x67, 0xf4, 0x1d, 0xe8, 0x3f, 0x44, 0xb2, 0xdb, 0x57, 0xcc, 0x18, 0x6b, 0xd3, 0x0e, 0xaf, 0x33, + 0xba, 0x80, 0xfb, 0xad, 0x48, 0x45, 0x25, 0xa2, 0x22, 0x4f, 0x93, 0x6f, 0x89, 0x28, 0x59, 0x57, + 0x4d, 0xf2, 0xf0, 0x9f, 0x49, 0x1c, 0x65, 0xae, 0xa5, 0xf8, 0x93, 0x0f, 0xb7, 0x7f, 0xb3, 0x44, + 0x94, 0x93, 0xdf, 0x1a, 0x74, 0xd4, 0xa8, 0xb4, 0x0f, 0xc6, 0xc6, 0x5b, 0x79, 0xfe, 0x17, 0x8f, + 0xdc, 0xd0, 0x7b, 0xe8, 0xaf, 0x39, 0x46, 0x4b, 0x2f, 0x08, 0x2d, 0xd7, 0x25, 0x1a, 0x25, 0x30, + 0x58, 0xfb, 0x41, 0xd8, 0x90, 0x5b, 0x3a, 0x04, 0x90, 0x8a, 0x83, 0x2e, 0x86, 0x48, 0x5a, 0xea, + 0x88, 0x34, 0x6a, 0xd0, 0xbe, 0xf6, 0xd8, 0xac, 0x3f, 0x73, 0xcb, 0x41, 0xd2, 0x69, 0x7a, 0x5c, + 0x89, 0xae, 0x08, 0xc7, 0x88, 0xfb, 0xae, 0x3b, 0xb7, 0xec, 0x15, 0x31, 0xe8, 0x1b, 0xb8, 0x53, + 0x4e, 0x83, 0xba, 0x94, 0xc1, 0x5b, 0x8e, 0x2e, 0x5a, 0x01, 0x46, 0x21, 0x06, 0x61, 0x14, 0x6c, + 0x6c, 0x1b, 0x83, 0x80, 0xf4, 0xfe, 0xa9, 0x3c, 0x59, 0x4b, 0x77, 0xc3, 0x91, 0x80, 0xbc, 0xdb, + 0xe6, 0x4e, 0x33, 0x6d, 0x7f, 0x62, 0xc3, 0xe0, 0xf5, 0x3b, 0xd0, 0x3b, 0xe8, 0xa9, 0x3e, 0xe8, + 0xa0, 0x43, 0x6e, 0x28, 0x80, 0x2e, 0x0f, 0xa3, 0x43, 0x34, 0xd9, 0x75, 0x8e, 0x4f, 0x3e, 0xc7, + 0x68, 0xe1, 0xfb, 0xab, 0xc8, 0xe6, 0x68, 0x85, 0x4b, 0xdf, 0x23, 0xb7, 0xf3, 0xde, 0x57, 0xa3, + 0x7e, 0xd9, 0x67, 0x5d, 0x7d, 0xdb, 0xc7, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3b, 0xcf, 0xed, + 0xd9, 0xb4, 0x02, 0x00, 0x00, } diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 37535aac7..4d23bcdad 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -599,7 +599,8 @@ type InstallReleaseRequest struct { Timeout int64 `protobuf:"varint,8,opt,name=timeout" json:"timeout,omitempty"` // wait, if true, will wait until all Pods, PVCs, and Services are in a ready state // before marking the release as successful. It will wait for as long as timeout - Wait bool `protobuf:"varint,9,opt,name=wait" json:"wait,omitempty"` + Wait bool `protobuf:"varint,9,opt,name=wait" json:"wait,omitempty"` + DisableCrdHook bool `protobuf:"varint,10,opt,name=disable_crd_hook,json=disableCrdHook" json:"disable_crd_hook,omitempty"` } func (m *InstallReleaseRequest) Reset() { *m = InstallReleaseRequest{} } @@ -670,6 +671,13 @@ func (m *InstallReleaseRequest) GetWait() bool { return false } +func (m *InstallReleaseRequest) GetDisableCrdHook() bool { + if m != nil { + return m.DisableCrdHook + } + return false +} + // InstallReleaseResponse is the response from a release installation. type InstallReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -1368,82 +1376,83 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1217 bytes of a gzipped FileDescriptorProto + // 1235 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x6e, 0xe3, 0xc4, - 0x17, 0xaf, 0xf3, 0x9d, 0x93, 0x36, 0xff, 0x74, 0x9a, 0xb6, 0xae, 0xff, 0x0b, 0x2a, 0x46, 0xb0, - 0xd9, 0x85, 0x4d, 0x21, 0x70, 0x83, 0x84, 0x90, 0xba, 0xdd, 0xa8, 0x2d, 0x94, 0xae, 0xe4, 0x6c, - 0x17, 0x09, 0x01, 0x91, 0x9b, 0x4c, 0x5a, 0xb3, 0x8e, 0x27, 0x78, 0xc6, 0x65, 0x7b, 0xcb, 0x1d, - 0x8f, 0xc2, 0x5b, 0xf0, 0x1e, 0x5c, 0xc2, 0x83, 0x20, 0xcf, 0x87, 0xeb, 0x49, 0xed, 0xd6, 0xf4, - 0x26, 0x9e, 0x99, 0xf3, 0xfd, 0x3b, 0x67, 0xce, 0x9c, 0x80, 0x75, 0xe9, 0x2e, 0xbc, 0x3d, 0x8a, - 0xc3, 0x2b, 0x6f, 0x82, 0xe9, 0x1e, 0xf3, 0x7c, 0x1f, 0x87, 0xfd, 0x45, 0x48, 0x18, 0x41, 0xdd, - 0x98, 0xd6, 0x57, 0xb4, 0xbe, 0xa0, 0x59, 0x5b, 0x5c, 0x62, 0x72, 0xe9, 0x86, 0x4c, 0xfc, 0x0a, - 0x6e, 0x6b, 0x3b, 0x7d, 0x4e, 0x82, 0x99, 0x77, 0x21, 0x09, 0xc2, 0x44, 0x88, 0x7d, 0xec, 0x52, - 0xac, 0xbe, 0x9a, 0x90, 0xa2, 0x79, 0xc1, 0x8c, 0x48, 0xc2, 0xff, 0x35, 0x02, 0xc3, 0x94, 0x8d, - 0xc3, 0x28, 0x90, 0xc4, 0x1d, 0x8d, 0x48, 0x99, 0xcb, 0x22, 0xaa, 0x19, 0xbb, 0xc2, 0x21, 0xf5, - 0x48, 0xa0, 0xbe, 0x82, 0x66, 0xff, 0x59, 0x82, 0x8d, 0x13, 0x8f, 0x32, 0x47, 0x08, 0x52, 0x07, - 0xff, 0x12, 0x61, 0xca, 0x50, 0x17, 0xaa, 0xbe, 0x37, 0xf7, 0x98, 0x69, 0xec, 0x1a, 0xbd, 0xb2, - 0x23, 0x36, 0x68, 0x0b, 0x6a, 0x64, 0x36, 0xa3, 0x98, 0x99, 0xa5, 0x5d, 0xa3, 0xd7, 0x74, 0xe4, - 0x0e, 0x7d, 0x05, 0x75, 0x4a, 0x42, 0x36, 0x3e, 0xbf, 0x36, 0xcb, 0xbb, 0x46, 0xaf, 0x3d, 0xf8, - 0xa0, 0x9f, 0x85, 0x53, 0x3f, 0xb6, 0x34, 0x22, 0x21, 0xeb, 0xc7, 0x3f, 0xcf, 0xaf, 0x9d, 0x1a, - 0xe5, 0xdf, 0x58, 0xef, 0xcc, 0xf3, 0x19, 0x0e, 0xcd, 0x8a, 0xd0, 0x2b, 0x76, 0xe8, 0x10, 0x80, - 0xeb, 0x25, 0xe1, 0x14, 0x87, 0x66, 0x95, 0xab, 0xee, 0x15, 0x50, 0xfd, 0x32, 0xe6, 0x77, 0x9a, - 0x54, 0x2d, 0xd1, 0x97, 0xb0, 0x2a, 0x20, 0x19, 0x4f, 0xc8, 0x14, 0x53, 0xb3, 0xb6, 0x5b, 0xee, - 0xb5, 0x07, 0x3b, 0x42, 0x95, 0x82, 0x7f, 0x24, 0x40, 0x3b, 0x20, 0x53, 0xec, 0xb4, 0x04, 0x7b, - 0xbc, 0xa6, 0xe8, 0x11, 0x34, 0x03, 0x77, 0x8e, 0xe9, 0xc2, 0x9d, 0x60, 0xb3, 0xce, 0x3d, 0xbc, - 0x39, 0xb0, 0x7f, 0x82, 0x86, 0x32, 0x6e, 0x0f, 0xa0, 0x26, 0x42, 0x43, 0x2d, 0xa8, 0x9f, 0x9d, - 0x7e, 0x73, 0xfa, 0xf2, 0xbb, 0xd3, 0xce, 0x0a, 0x6a, 0x40, 0xe5, 0x74, 0xff, 0xdb, 0x61, 0xc7, - 0x40, 0xeb, 0xb0, 0x76, 0xb2, 0x3f, 0x7a, 0x35, 0x76, 0x86, 0x27, 0xc3, 0xfd, 0xd1, 0xf0, 0x45, - 0xa7, 0x64, 0xbf, 0x0b, 0xcd, 0xc4, 0x67, 0x54, 0x87, 0xf2, 0xfe, 0xe8, 0x40, 0x88, 0xbc, 0x18, - 0x8e, 0x0e, 0x3a, 0x86, 0xfd, 0xbb, 0x01, 0x5d, 0x3d, 0x45, 0x74, 0x41, 0x02, 0x8a, 0xe3, 0x1c, - 0x4d, 0x48, 0x14, 0x24, 0x39, 0xe2, 0x1b, 0x84, 0xa0, 0x12, 0xe0, 0xb7, 0x2a, 0x43, 0x7c, 0x1d, - 0x73, 0x32, 0xc2, 0x5c, 0x9f, 0x67, 0xa7, 0xec, 0x88, 0x0d, 0xfa, 0x14, 0x1a, 0x32, 0x74, 0x6a, - 0x56, 0x76, 0xcb, 0xbd, 0xd6, 0x60, 0x53, 0x07, 0x44, 0x5a, 0x74, 0x12, 0x36, 0xfb, 0x10, 0xb6, - 0x0f, 0xb1, 0xf2, 0x44, 0xe0, 0xa5, 0x2a, 0x26, 0xb6, 0xeb, 0xce, 0x31, 0x77, 0x26, 0xb6, 0xeb, - 0xce, 0x31, 0x32, 0xa1, 0x2e, 0xcb, 0x8d, 0xbb, 0x53, 0x75, 0xd4, 0xd6, 0x66, 0x60, 0xde, 0x56, - 0x24, 0xe3, 0xca, 0xd2, 0xf4, 0x21, 0x54, 0xe2, 0x9b, 0xc0, 0xd5, 0xb4, 0x06, 0x48, 0xf7, 0xf3, - 0x38, 0x98, 0x11, 0x87, 0xd3, 0xf5, 0x54, 0x95, 0x97, 0x53, 0x75, 0x94, 0xb6, 0x7a, 0x40, 0x02, - 0x86, 0x03, 0xf6, 0x30, 0xff, 0x4f, 0x60, 0x27, 0x43, 0x93, 0x0c, 0x60, 0x0f, 0xea, 0xd2, 0x35, - 0xae, 0x2d, 0x17, 0x57, 0xc5, 0x65, 0xff, 0x5d, 0x82, 0xee, 0xd9, 0x62, 0xea, 0x32, 0xac, 0x48, - 0x77, 0x38, 0xf5, 0x18, 0xaa, 0xbc, 0xa3, 0x48, 0x2c, 0xd6, 0x85, 0x6e, 0xd1, 0x76, 0x0e, 0xe2, - 0x5f, 0x47, 0xd0, 0xd1, 0x53, 0xa8, 0x5d, 0xb9, 0x7e, 0x84, 0x29, 0x07, 0x22, 0x41, 0x4d, 0x72, - 0xf2, 0x76, 0xe4, 0x48, 0x0e, 0xb4, 0x0d, 0xf5, 0x69, 0x78, 0x1d, 0xf7, 0x13, 0x7e, 0x05, 0x1b, - 0x4e, 0x6d, 0x1a, 0x5e, 0x3b, 0x51, 0x80, 0xde, 0x87, 0xb5, 0xa9, 0x47, 0xdd, 0x73, 0x1f, 0x8f, - 0x2f, 0x09, 0x79, 0x43, 0xf9, 0x2d, 0x6c, 0x38, 0xab, 0xf2, 0xf0, 0x28, 0x3e, 0x43, 0x56, 0x5c, - 0x49, 0x93, 0x10, 0xbb, 0x0c, 0x9b, 0x35, 0x4e, 0x4f, 0xf6, 0x31, 0x86, 0xcc, 0x9b, 0x63, 0x12, - 0x31, 0x7e, 0x75, 0xca, 0x8e, 0xda, 0xa2, 0xf7, 0x60, 0x35, 0xc4, 0x14, 0xb3, 0xb1, 0xf4, 0xb2, - 0xc1, 0x25, 0x5b, 0xfc, 0xec, 0xb5, 0x70, 0x0b, 0x41, 0xe5, 0x57, 0xd7, 0x63, 0x66, 0x93, 0x93, - 0xf8, 0x5a, 0x88, 0x45, 0x14, 0x2b, 0x31, 0x50, 0x62, 0x11, 0xc5, 0x52, 0xac, 0x0b, 0xd5, 0x19, - 0x09, 0x27, 0xd8, 0x6c, 0x71, 0x9a, 0xd8, 0xd8, 0x47, 0xb0, 0xb9, 0x04, 0xf2, 0x43, 0xf3, 0xf5, - 0x8f, 0x01, 0x5b, 0x0e, 0xf1, 0xfd, 0x73, 0x77, 0xf2, 0xa6, 0x40, 0xc6, 0x52, 0xe0, 0x96, 0xee, - 0x06, 0xb7, 0x9c, 0x01, 0x6e, 0xaa, 0x08, 0x2b, 0x5a, 0x11, 0x6a, 0xb0, 0x57, 0xf3, 0x61, 0xaf, - 0xe9, 0xb0, 0x2b, 0x4c, 0xeb, 0x29, 0x4c, 0x13, 0xc0, 0x1a, 0x69, 0xc0, 0xbe, 0x86, 0xed, 0x5b, - 0x51, 0x3e, 0x14, 0xb2, 0x3f, 0x4a, 0xb0, 0x79, 0x1c, 0x50, 0xe6, 0xfa, 0xfe, 0x12, 0x62, 0x49, - 0x3d, 0x1b, 0x85, 0xeb, 0xb9, 0xf4, 0x5f, 0xea, 0xb9, 0xac, 0x41, 0xae, 0xf2, 0x53, 0x49, 0xe5, - 0xa7, 0x50, 0x8d, 0x6b, 0x9d, 0xa5, 0xb6, 0xd4, 0x59, 0xd0, 0x3b, 0x00, 0xa2, 0x28, 0xb9, 0x72, - 0x01, 0x6d, 0x93, 0x9f, 0x9c, 0xca, 0x46, 0xa2, 0xb2, 0xd1, 0xc8, 0xce, 0x46, 0xaa, 0xc2, 0xed, - 0x63, 0xd8, 0x5a, 0x86, 0xea, 0xa1, 0xb0, 0xff, 0x66, 0xc0, 0xf6, 0x59, 0xe0, 0x65, 0x02, 0x9f, - 0x55, 0xaa, 0xb7, 0xa0, 0x28, 0x65, 0x40, 0xd1, 0x85, 0xea, 0x22, 0x0a, 0x2f, 0xb0, 0x84, 0x56, - 0x6c, 0xd2, 0x31, 0x56, 0xb4, 0x18, 0xed, 0x31, 0x98, 0xb7, 0x7d, 0x78, 0x60, 0x44, 0xb1, 0xd7, - 0xc9, 0x4b, 0xd0, 0x14, 0x5d, 0xdf, 0xde, 0x80, 0xf5, 0x43, 0xcc, 0x5e, 0x8b, 0x6b, 0x21, 0xc3, - 0xb3, 0x87, 0x80, 0xd2, 0x87, 0x37, 0xf6, 0xe4, 0x91, 0x6e, 0x4f, 0x8d, 0x45, 0x8a, 0x5f, 0x71, - 0xd9, 0x5f, 0x70, 0xdd, 0x47, 0x1e, 0x65, 0x24, 0xbc, 0xbe, 0x0b, 0xba, 0x0e, 0x94, 0xe7, 0xee, - 0x5b, 0xf9, 0x50, 0xc4, 0x4b, 0xfb, 0x90, 0x7b, 0x90, 0x88, 0x4a, 0x0f, 0xd2, 0xcf, 0xae, 0x51, - 0xec, 0xd9, 0xfd, 0x01, 0xd0, 0x2b, 0x9c, 0x4c, 0x00, 0xf7, 0xbc, 0x58, 0x2a, 0x09, 0x25, 0xbd, - 0xd0, 0x4c, 0xa8, 0x4f, 0x7c, 0xec, 0x06, 0xd1, 0x42, 0xa6, 0x4d, 0x6d, 0xed, 0x1f, 0x61, 0x43, - 0xd3, 0x2e, 0xfd, 0x8c, 0xe3, 0xa1, 0x17, 0x52, 0x7b, 0xbc, 0x44, 0x9f, 0x43, 0x4d, 0x8c, 0x45, - 0x5c, 0x77, 0x7b, 0xf0, 0x48, 0xf7, 0x9b, 0x2b, 0x89, 0x02, 0x39, 0x47, 0x39, 0x92, 0x77, 0xf0, - 0x57, 0x03, 0xda, 0xea, 0xa1, 0x17, 0x43, 0x1b, 0xf2, 0x60, 0x35, 0x3d, 0xd1, 0xa0, 0x27, 0xf9, - 0x33, 0xdd, 0xd2, 0x60, 0x6a, 0x3d, 0x2d, 0xc2, 0x2a, 0x22, 0xb0, 0x57, 0x3e, 0x31, 0x10, 0x85, - 0xce, 0xf2, 0xa0, 0x81, 0x9e, 0x65, 0xeb, 0xc8, 0x99, 0x6c, 0xac, 0x7e, 0x51, 0x76, 0x65, 0x16, - 0x5d, 0xf1, 0x9a, 0xd1, 0xa7, 0x03, 0x74, 0xaf, 0x1a, 0x7d, 0x20, 0xb1, 0xf6, 0x0a, 0xf3, 0x27, - 0x76, 0x7f, 0x86, 0x35, 0xed, 0x85, 0x43, 0x39, 0x68, 0x65, 0xcd, 0x1a, 0xd6, 0x47, 0x85, 0x78, - 0x13, 0x5b, 0x73, 0x68, 0xeb, 0x4d, 0x0a, 0xe5, 0x28, 0xc8, 0xec, 0xfa, 0xd6, 0xc7, 0xc5, 0x98, - 0x13, 0x73, 0x14, 0x3a, 0xcb, 0x3d, 0x24, 0x2f, 0x8f, 0x39, 0xfd, 0x2e, 0x2f, 0x8f, 0x79, 0xad, - 0xc9, 0x5e, 0x41, 0x2e, 0xc0, 0x4d, 0x0b, 0x41, 0x8f, 0x73, 0x13, 0xa2, 0x77, 0x1e, 0xab, 0x77, - 0x3f, 0x63, 0x62, 0x62, 0x01, 0xff, 0x5b, 0x7a, 0x63, 0x51, 0x0e, 0x34, 0xd9, 0x03, 0x87, 0xf5, - 0xac, 0x20, 0xf7, 0x52, 0x50, 0xb2, 0x2b, 0xdd, 0x11, 0x94, 0xde, 0xf2, 0xee, 0x08, 0x6a, 0xa9, - 0xc1, 0xd9, 0x2b, 0xc8, 0x83, 0xb6, 0x13, 0x05, 0xd2, 0x74, 0xdc, 0x16, 0x50, 0x8e, 0xf4, 0xed, - 0xae, 0x66, 0x3d, 0x29, 0xc0, 0x79, 0x73, 0xbf, 0x9f, 0xc3, 0xf7, 0x0d, 0xc5, 0x7a, 0x5e, 0xe3, - 0xff, 0x69, 0x3f, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x7c, 0x9c, 0x49, 0xc1, 0x0f, 0x00, - 0x00, + 0x17, 0xaf, 0xf3, 0x9d, 0x93, 0x6e, 0xfe, 0xd9, 0x69, 0xda, 0xba, 0xfe, 0x2f, 0xa8, 0x18, 0xc1, + 0x66, 0x17, 0x36, 0x85, 0xc0, 0x0d, 0x12, 0x42, 0xea, 0x66, 0xa3, 0xb6, 0x50, 0xba, 0x92, 0xb3, + 0x5d, 0x24, 0x04, 0x44, 0x6e, 0x32, 0x69, 0xcd, 0x3a, 0x76, 0xf0, 0x8c, 0xcb, 0xf6, 0x96, 0x3b, + 0xde, 0x8a, 0x77, 0xe0, 0x92, 0x4b, 0x78, 0x10, 0x34, 0x5f, 0xae, 0x27, 0xb5, 0x5b, 0xd3, 0x9b, + 0x78, 0x66, 0xce, 0xf7, 0xef, 0x9c, 0x39, 0x73, 0x02, 0xd6, 0x85, 0xbb, 0xf4, 0xf6, 0x08, 0x8e, + 0x2e, 0xbd, 0x29, 0x26, 0x7b, 0xd4, 0xf3, 0x7d, 0x1c, 0xf5, 0x97, 0x51, 0x48, 0x43, 0xd4, 0x65, + 0xb4, 0xbe, 0xa2, 0xf5, 0x05, 0xcd, 0xda, 0xe2, 0x12, 0xd3, 0x0b, 0x37, 0xa2, 0xe2, 0x57, 0x70, + 0x5b, 0xdb, 0xe9, 0xf3, 0x30, 0x98, 0x7b, 0xe7, 0x92, 0x20, 0x4c, 0x44, 0xd8, 0xc7, 0x2e, 0xc1, + 0xea, 0xab, 0x09, 0x29, 0x9a, 0x17, 0xcc, 0x43, 0x49, 0xf8, 0xbf, 0x46, 0xa0, 0x98, 0xd0, 0x49, + 0x14, 0x07, 0x92, 0xb8, 0xa3, 0x11, 0x09, 0x75, 0x69, 0x4c, 0x34, 0x63, 0x97, 0x38, 0x22, 0x5e, + 0x18, 0xa8, 0xaf, 0xa0, 0xd9, 0x7f, 0x94, 0x60, 0xe3, 0xd8, 0x23, 0xd4, 0x11, 0x82, 0xc4, 0xc1, + 0xbf, 0xc4, 0x98, 0x50, 0xd4, 0x85, 0xaa, 0xef, 0x2d, 0x3c, 0x6a, 0x1a, 0xbb, 0x46, 0xaf, 0xec, + 0x88, 0x0d, 0xda, 0x82, 0x5a, 0x38, 0x9f, 0x13, 0x4c, 0xcd, 0xd2, 0xae, 0xd1, 0x6b, 0x3a, 0x72, + 0x87, 0xbe, 0x82, 0x3a, 0x09, 0x23, 0x3a, 0x39, 0xbb, 0x32, 0xcb, 0xbb, 0x46, 0xaf, 0x3d, 0xf8, + 0xa0, 0x9f, 0x85, 0x53, 0x9f, 0x59, 0x1a, 0x87, 0x11, 0xed, 0xb3, 0x9f, 0xe7, 0x57, 0x4e, 0x8d, + 0xf0, 0x2f, 0xd3, 0x3b, 0xf7, 0x7c, 0x8a, 0x23, 0xb3, 0x22, 0xf4, 0x8a, 0x1d, 0x3a, 0x00, 0xe0, + 0x7a, 0xc3, 0x68, 0x86, 0x23, 0xb3, 0xca, 0x55, 0xf7, 0x0a, 0xa8, 0x7e, 0xc9, 0xf8, 0x9d, 0x26, + 0x51, 0x4b, 0xf4, 0x25, 0xac, 0x0b, 0x48, 0x26, 0xd3, 0x70, 0x86, 0x89, 0x59, 0xdb, 0x2d, 0xf7, + 0xda, 0x83, 0x1d, 0xa1, 0x4a, 0xc1, 0x3f, 0x16, 0xa0, 0x0d, 0xc3, 0x19, 0x76, 0x5a, 0x82, 0x9d, + 0xad, 0x09, 0x7a, 0x04, 0xcd, 0xc0, 0x5d, 0x60, 0xb2, 0x74, 0xa7, 0xd8, 0xac, 0x73, 0x0f, 0xaf, + 0x0f, 0xec, 0x9f, 0xa0, 0xa1, 0x8c, 0xdb, 0x03, 0xa8, 0x89, 0xd0, 0x50, 0x0b, 0xea, 0xa7, 0x27, + 0xdf, 0x9c, 0xbc, 0xfc, 0xee, 0xa4, 0xb3, 0x86, 0x1a, 0x50, 0x39, 0xd9, 0xff, 0x76, 0xd4, 0x31, + 0xd0, 0x43, 0x78, 0x70, 0xbc, 0x3f, 0x7e, 0x35, 0x71, 0x46, 0xc7, 0xa3, 0xfd, 0xf1, 0xe8, 0x45, + 0xa7, 0x64, 0xbf, 0x0b, 0xcd, 0xc4, 0x67, 0x54, 0x87, 0xf2, 0xfe, 0x78, 0x28, 0x44, 0x5e, 0x8c, + 0xc6, 0xc3, 0x8e, 0x61, 0xff, 0x6e, 0x40, 0x57, 0x4f, 0x11, 0x59, 0x86, 0x01, 0xc1, 0x2c, 0x47, + 0xd3, 0x30, 0x0e, 0x92, 0x1c, 0xf1, 0x0d, 0x42, 0x50, 0x09, 0xf0, 0x5b, 0x95, 0x21, 0xbe, 0x66, + 0x9c, 0x34, 0xa4, 0xae, 0xcf, 0xb3, 0x53, 0x76, 0xc4, 0x06, 0x7d, 0x0a, 0x0d, 0x19, 0x3a, 0x31, + 0x2b, 0xbb, 0xe5, 0x5e, 0x6b, 0xb0, 0xa9, 0x03, 0x22, 0x2d, 0x3a, 0x09, 0x9b, 0x7d, 0x00, 0xdb, + 0x07, 0x58, 0x79, 0x22, 0xf0, 0x52, 0x15, 0xc3, 0xec, 0xba, 0x0b, 0xcc, 0x9d, 0x61, 0x76, 0xdd, + 0x05, 0x46, 0x26, 0xd4, 0x65, 0xb9, 0x71, 0x77, 0xaa, 0x8e, 0xda, 0xda, 0x14, 0xcc, 0x9b, 0x8a, + 0x64, 0x5c, 0x59, 0x9a, 0x3e, 0x84, 0x0a, 0xbb, 0x09, 0x5c, 0x4d, 0x6b, 0x80, 0x74, 0x3f, 0x8f, + 0x82, 0x79, 0xe8, 0x70, 0xba, 0x9e, 0xaa, 0xf2, 0x6a, 0xaa, 0x0e, 0xd3, 0x56, 0x87, 0x61, 0x40, + 0x71, 0x40, 0xef, 0xe7, 0xff, 0x31, 0xec, 0x64, 0x68, 0x92, 0x01, 0xec, 0x41, 0x5d, 0xba, 0xc6, + 0xb5, 0xe5, 0xe2, 0xaa, 0xb8, 0xec, 0xbf, 0x4b, 0xd0, 0x3d, 0x5d, 0xce, 0x5c, 0x8a, 0x15, 0xe9, + 0x16, 0xa7, 0x1e, 0x43, 0x95, 0x77, 0x14, 0x89, 0xc5, 0x43, 0xa1, 0x5b, 0xb4, 0x9d, 0x21, 0xfb, + 0x75, 0x04, 0x1d, 0x3d, 0x85, 0xda, 0xa5, 0xeb, 0xc7, 0x98, 0x70, 0x20, 0x12, 0xd4, 0x24, 0x27, + 0x6f, 0x47, 0x8e, 0xe4, 0x40, 0xdb, 0x50, 0x9f, 0x45, 0x57, 0xac, 0x9f, 0xf0, 0x2b, 0xd8, 0x70, + 0x6a, 0xb3, 0xe8, 0xca, 0x89, 0x03, 0xf4, 0x3e, 0x3c, 0x98, 0x79, 0xc4, 0x3d, 0xf3, 0xf1, 0xe4, + 0x22, 0x0c, 0xdf, 0x10, 0x7e, 0x0b, 0x1b, 0xce, 0xba, 0x3c, 0x3c, 0x64, 0x67, 0xc8, 0x62, 0x95, + 0x34, 0x8d, 0xb0, 0x4b, 0xb1, 0x59, 0xe3, 0xf4, 0x64, 0xcf, 0x30, 0xa4, 0xde, 0x02, 0x87, 0x31, + 0xe5, 0x57, 0xa7, 0xec, 0xa8, 0x2d, 0x7a, 0x0f, 0xd6, 0x23, 0x4c, 0x30, 0x9d, 0x48, 0x2f, 0x1b, + 0x5c, 0xb2, 0xc5, 0xcf, 0x5e, 0x0b, 0xb7, 0x10, 0x54, 0x7e, 0x75, 0x3d, 0x6a, 0x36, 0x39, 0x89, + 0xaf, 0x85, 0x58, 0x4c, 0xb0, 0x12, 0x03, 0x25, 0x16, 0x13, 0x2c, 0xc5, 0xba, 0x50, 0x9d, 0x87, + 0xd1, 0x14, 0x9b, 0x2d, 0x4e, 0x13, 0x1b, 0xfb, 0x10, 0x36, 0x57, 0x40, 0xbe, 0x6f, 0xbe, 0xfe, + 0x31, 0x60, 0xcb, 0x09, 0x7d, 0xff, 0xcc, 0x9d, 0xbe, 0x29, 0x90, 0xb1, 0x14, 0xb8, 0xa5, 0xdb, + 0xc1, 0x2d, 0x67, 0x80, 0x9b, 0x2a, 0xc2, 0x8a, 0x56, 0x84, 0x1a, 0xec, 0xd5, 0x7c, 0xd8, 0x6b, + 0x3a, 0xec, 0x0a, 0xd3, 0x7a, 0x0a, 0xd3, 0x04, 0xb0, 0x46, 0x1a, 0xb0, 0xaf, 0x61, 0xfb, 0x46, + 0x94, 0xf7, 0x85, 0xec, 0xcf, 0x12, 0x6c, 0x1e, 0x05, 0x84, 0xba, 0xbe, 0xbf, 0x82, 0x58, 0x52, + 0xcf, 0x46, 0xe1, 0x7a, 0x2e, 0xfd, 0x97, 0x7a, 0x2e, 0x6b, 0x90, 0xab, 0xfc, 0x54, 0x52, 0xf9, + 0x29, 0x54, 0xe3, 0x5a, 0x67, 0xa9, 0xad, 0x74, 0x16, 0xf4, 0x0e, 0x80, 0x28, 0x4a, 0xae, 0x5c, + 0x40, 0xdb, 0xe4, 0x27, 0x27, 0xb2, 0x91, 0xa8, 0x6c, 0x34, 0xb2, 0xb3, 0x91, 0xae, 0xf0, 0x1e, + 0x74, 0x94, 0x3f, 0xd3, 0x68, 0xc6, 0x7d, 0x92, 0x55, 0xde, 0x96, 0xe7, 0xc3, 0x68, 0xc6, 0xbc, + 0xb2, 0x8f, 0x60, 0x6b, 0x15, 0xd4, 0xfb, 0x26, 0xe8, 0x37, 0x03, 0xb6, 0x4f, 0x03, 0x2f, 0x33, + 0x45, 0x59, 0x45, 0x7d, 0x03, 0xb4, 0x52, 0x06, 0x68, 0x5d, 0xa8, 0x2e, 0xe3, 0xe8, 0x1c, 0xcb, + 0x24, 0x88, 0x4d, 0x1a, 0x8d, 0x8a, 0x86, 0x86, 0x3d, 0x01, 0xf3, 0xa6, 0x0f, 0xf7, 0x8c, 0x88, + 0x79, 0x9d, 0xbc, 0x19, 0x4d, 0xf1, 0x3e, 0xd8, 0x1b, 0xf0, 0xf0, 0x00, 0xd3, 0xd7, 0xe2, 0x02, + 0xc9, 0xf0, 0xec, 0x11, 0xa0, 0xf4, 0xe1, 0xb5, 0x3d, 0x79, 0xa4, 0xdb, 0x53, 0x03, 0x94, 0xe2, + 0x57, 0x5c, 0xf6, 0x17, 0x5c, 0xf7, 0xa1, 0x47, 0x68, 0x18, 0x5d, 0xdd, 0x06, 0x5d, 0x07, 0xca, + 0x0b, 0xf7, 0xad, 0x7c, 0x52, 0xd8, 0xd2, 0x3e, 0xe0, 0x1e, 0x24, 0xa2, 0xd2, 0x83, 0xf4, 0x03, + 0x6d, 0x14, 0x7b, 0xa0, 0x7f, 0x00, 0xf4, 0x0a, 0x27, 0xb3, 0xc2, 0x1d, 0x6f, 0x9b, 0x4a, 0x42, + 0x49, 0x2f, 0x49, 0x13, 0xea, 0x53, 0x1f, 0xbb, 0x41, 0xbc, 0x94, 0x69, 0x53, 0x5b, 0xfb, 0x47, + 0xd8, 0xd0, 0xb4, 0x4b, 0x3f, 0x59, 0x3c, 0xe4, 0x5c, 0x6a, 0x67, 0x4b, 0xf4, 0x39, 0xd4, 0xc4, + 0x00, 0xc5, 0x75, 0xb7, 0x07, 0x8f, 0x74, 0xbf, 0xb9, 0x92, 0x38, 0x90, 0x13, 0x97, 0x23, 0x79, + 0x07, 0x7f, 0x35, 0xa0, 0xad, 0x46, 0x02, 0x31, 0xde, 0x21, 0x0f, 0xd6, 0xd3, 0xb3, 0x0f, 0x7a, + 0x92, 0x3f, 0xfd, 0xad, 0x8c, 0xb0, 0xd6, 0xd3, 0x22, 0xac, 0x22, 0x02, 0x7b, 0xed, 0x13, 0x03, + 0x11, 0xe8, 0xac, 0x8e, 0x24, 0xe8, 0x59, 0xb6, 0x8e, 0x9c, 0x19, 0xc8, 0xea, 0x17, 0x65, 0x57, + 0x66, 0xd1, 0x25, 0xaf, 0x19, 0x7d, 0x8e, 0x40, 0x77, 0xaa, 0xd1, 0x47, 0x17, 0x6b, 0xaf, 0x30, + 0x7f, 0x62, 0xf7, 0x67, 0x78, 0xa0, 0xbd, 0x85, 0x28, 0x07, 0xad, 0xac, 0xa9, 0xc4, 0xfa, 0xa8, + 0x10, 0x6f, 0x62, 0x6b, 0x01, 0x6d, 0xbd, 0x49, 0xa1, 0x1c, 0x05, 0x99, 0xef, 0x83, 0xf5, 0x71, + 0x31, 0xe6, 0xc4, 0x1c, 0x81, 0xce, 0x6a, 0x0f, 0xc9, 0xcb, 0x63, 0x4e, 0xbf, 0xcb, 0xcb, 0x63, + 0x5e, 0x6b, 0xb2, 0xd7, 0x90, 0x0b, 0x70, 0xdd, 0x42, 0xd0, 0xe3, 0xdc, 0x84, 0xe8, 0x9d, 0xc7, + 0xea, 0xdd, 0xcd, 0x98, 0x98, 0x58, 0xc2, 0xff, 0x56, 0x5e, 0x63, 0x94, 0x03, 0x4d, 0xf6, 0x68, + 0x62, 0x3d, 0x2b, 0xc8, 0xbd, 0x12, 0x94, 0xec, 0x4a, 0xb7, 0x04, 0xa5, 0xb7, 0xbc, 0x5b, 0x82, + 0x5a, 0x69, 0x70, 0xf6, 0x1a, 0xf2, 0xa0, 0xed, 0xc4, 0x81, 0x34, 0xcd, 0xda, 0x02, 0xca, 0x91, + 0xbe, 0xd9, 0xd5, 0xac, 0x27, 0x05, 0x38, 0xaf, 0xef, 0xf7, 0x73, 0xf8, 0xbe, 0xa1, 0x58, 0xcf, + 0x6a, 0xfc, 0xdf, 0xef, 0x67, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x5d, 0xc3, 0xd5, 0x55, 0xeb, + 0x0f, 0x00, 0x00, } diff --git a/pkg/tiller/hooks.go b/pkg/tiller/hooks.go index e1e965d08..2dd085ed7 100644 --- a/pkg/tiller/hooks.go +++ b/pkg/tiller/hooks.go @@ -42,6 +42,7 @@ var events = map[string]release.Hook_Event{ hooks.PostRollback: release.Hook_POST_ROLLBACK, hooks.ReleaseTestSuccess: release.Hook_RELEASE_TEST_SUCCESS, hooks.ReleaseTestFailure: release.Hook_RELEASE_TEST_FAILURE, + hooks.CRDInstall: release.Hook_CRD_INSTALL, } // deletePolices represents a mapping between the key in the annotation for label deleting policy and its real meaning @@ -137,10 +138,6 @@ func (file *manifestFile) sort(result *result) error { return e } - if entry.Version != "" && !file.apis.Has(entry.Version) { - return fmt.Errorf("apiVersion %q in %s is not available", entry.Version, file.path) - } - if !hasAnyAnnotation(entry) { result.generic = append(result.generic, Manifest{ Name: file.path, @@ -199,7 +196,6 @@ func (file *manifestFile) sort(result *result) error { } }) } - return nil } diff --git a/pkg/tiller/release_install.go b/pkg/tiller/release_install.go index 8e7fd3acd..0b8f4da5b 100644 --- a/pkg/tiller/release_install.go +++ b/pkg/tiller/release_install.go @@ -127,20 +127,59 @@ func (s *ReleaseServer) prepareRelease(req *services.InstallReleaseRequest) (*re rel.Info.Status.Notes = notesTxt } - err = validateManifest(s.env.KubeClient, req.Namespace, manifestDoc.Bytes()) - return rel, err + return rel, nil +} + +func hasCRDHook(hs []*release.Hook) bool { + for _, h := range hs { + for _, e := range h.Events { + if e == events[hooks.CRDInstall] { + return true + } + } + } + return false } // performRelease runs a release. func (s *ReleaseServer) performRelease(r *release.Release, req *services.InstallReleaseRequest) (*services.InstallReleaseResponse, error) { res := &services.InstallReleaseResponse{Release: r} + manifestDoc := []byte(r.Manifest) if req.DryRun { s.Log("dry run for %s", r.Name) + + if !req.DisableCrdHook && hasCRDHook(r.Hooks) { + s.Log("validation skipped because CRD hook is present") + res.Release.Info.Description = "Validation skipped because CRDs are not installed" + return res, nil + } + + // Here's the problem with dry runs and CRDs: We can't install a CRD + // during a dry run, which means it cannot be validated. + if err := validateManifest(s.env.KubeClient, req.Namespace, manifestDoc); err != nil { + return res, err + } + res.Release.Info.Description = "Dry run complete" return res, nil } + // crd-install hooks + if !req.DisableHooks && !req.DisableCrdHook { + if err := s.execHook(r.Hooks, r.Name, r.Namespace, hooks.CRDInstall, req.Timeout); err != nil { + fmt.Printf("Finished installing CRD: %s", err) + return res, err + } + } else { + s.Log("CRD install hooks disabled for %s", req.Name) + } + + // Because the CRDs are installed, they are used for validation during this step. + if err := validateManifest(s.env.KubeClient, req.Namespace, manifestDoc); err != nil { + return res, fmt.Errorf("validation failed: %s", err) + } + // pre-install hooks if !req.DisableHooks { if err := s.execHook(r.Hooks, r.Name, r.Namespace, hooks.PreInstall, req.Timeout); err != nil { diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index 2f21dc46b..a244e4b72 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -22,11 +22,44 @@ import ( "testing" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/version" ) +func TestHasCRDHook(t *testing.T) { + tests := []struct { + hooks []*release.Hook + expect bool + }{ + { + hooks: []*release.Hook{ + {Events: []release.Hook_Event{release.Hook_PRE_DELETE}}, + }, + expect: false, + }, + { + hooks: []*release.Hook{ + {Events: []release.Hook_Event{release.Hook_CRD_INSTALL}}, + }, + expect: true, + }, + { + hooks: []*release.Hook{ + {Events: []release.Hook_Event{release.Hook_PRE_UPGRADE, release.Hook_CRD_INSTALL}}, + }, + expect: true, + }, + } + + for i, tt := range tests { + if tt.expect != hasCRDHook(tt.hooks) { + t.Errorf("test %d: expected %t, got %t", i, tt.expect, !tt.expect) + } + } +} + func TestInstallRelease(t *testing.T) { c := helm.NewContext() rs := rsFixture() @@ -335,6 +368,55 @@ func TestInstallRelease_NoHooks(t *testing.T) { } } +func TestInstallRelease_CRDInstallHook(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.env.Releases.Create(releaseStub()) + + req := installRequest() + req.Chart.Templates = append(req.Chart.Templates, &chart.Template{ + Name: "templates/crdhook", + Data: []byte(manifestWithCRDHook), + }) + + res, err := rs.InstallRelease(c, req) + if err != nil { + t.Errorf("Failed install: %s", err) + } + + // The new hook should have been pulled from the manifest. + if l := len(res.Release.Hooks); l != 2 { + t.Fatalf("expected 2 hooks, got %d", l) + } + + expect := "Install complete" + if got := res.Release.Info.Description; got != expect { + t.Errorf("Expected Description to be %q, got %q", expect, got) + } +} + +func TestInstallRelease_DryRunCRDInstallHook(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.env.Releases.Create(releaseStub()) + + req := installRequest(withDryRun()) + req.Chart.Templates = append(req.Chart.Templates, &chart.Template{ + Name: "templates/crdhook", + Data: []byte(manifestWithCRDHook), + }) + + res, err := rs.InstallRelease(c, req) + if err != nil { + t.Errorf("Failed install: %s", err) + } + + expect := "Validation skipped because CRDs are not installed" + if res.Release.Info.Description != expect { + t.Errorf("Expected Description %q, got %q", expect, res.Release.Info.Description) + } +} + func TestInstallRelease_FailedHooks(t *testing.T) { c := helm.NewContext() rs := rsFixture() diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index 7c4bc62cf..1a2b3c4da 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -363,7 +363,7 @@ func (s *ReleaseServer) execHook(hs []*release.Hook, name, namespace, hook strin executingHooks = sortByHookWeight(executingHooks) for _, h := range executingHooks { - if err := s.deleteHookIfShouldBeDeletedByDeletePolicy(h, hooks.BeforeHookCreation, name, namespace, hook, kubeCli); err != nil { + if err := s.deleteHookByPolicy(h, hooks.BeforeHookCreation, name, namespace, hook, kubeCli); err != nil { return err } @@ -376,14 +376,17 @@ func (s *ReleaseServer) execHook(hs []*release.Hook, name, namespace, hook strin b.Reset() b.WriteString(h.Manifest) - if err := kubeCli.WatchUntilReady(namespace, b, timeout, false); err != nil { - s.Log("warning: Release %s %s %s could not complete: %s", name, hook, h.Path, err) - // If a hook is failed, checkout the annotation of the hook to determine whether the hook should be deleted - // under failed condition. If so, then clear the corresponding resource object in the hook - if err := s.deleteHookIfShouldBeDeletedByDeletePolicy(h, hooks.HookFailed, name, namespace, hook, kubeCli); err != nil { + // We can't watch CRDs + if hook != hooks.CRDInstall { + if err := kubeCli.WatchUntilReady(namespace, b, timeout, false); err != nil { + s.Log("warning: Release %s %s %s could not complete: %s", name, hook, h.Path, err) + // If a hook is failed, checkout the annotation of the hook to determine whether the hook should be deleted + // under failed condition. If so, then clear the corresponding resource object in the hook + if err := s.deleteHookByPolicy(h, hooks.HookFailed, name, namespace, hook, kubeCli); err != nil { + return err + } return err } - return err } } @@ -391,7 +394,7 @@ func (s *ReleaseServer) execHook(hs []*release.Hook, name, namespace, hook strin // If all hooks are succeeded, checkout the annotation of each hook to determine whether the hook should be deleted // under succeeded condition. If so, then clear the corresponding resource object in each hook for _, h := range executingHooks { - if err := s.deleteHookIfShouldBeDeletedByDeletePolicy(h, hooks.HookSucceeded, name, namespace, hook, kubeCli); err != nil { + if err := s.deleteHookByPolicy(h, hooks.HookSucceeded, name, namespace, hook, kubeCli); err != nil { return err } h.LastRun = timeconv.Now() @@ -418,7 +421,7 @@ func validateReleaseName(releaseName string) error { return nil } -func (s *ReleaseServer) deleteHookIfShouldBeDeletedByDeletePolicy(h *release.Hook, policy string, name, namespace, hook string, kubeCli environment.KubeClient) error { +func (s *ReleaseServer) deleteHookByPolicy(h *release.Hook, policy string, name, namespace, hook string, kubeCli environment.KubeClient) error { b := bytes.NewBufferString(h.Manifest) if hookHasDeletePolicy(h, policy) { s.Log("deleting %s hook %s for release %s due to %q policy", hook, h.Name, name, policy) diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index 73ba08f67..96cb84a75 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -55,6 +55,25 @@ metadata: data: name: value` +var manifestWithCRDHook = ` +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: crontabs.stable.example.com + annotations: + "helm.sh/hook": crd-install +spec: + group: stable.example.com + version: v1 + scope: Namespaced + names: + plural: crontabs + singular: crontab + kind: CronTab + shortNames: + - ct +` + var manifestWithTestHook = `kind: Pod metadata: name: finding-nemo, From e54d36519a1b2ff992312094be7809d594a704e4 Mon Sep 17 00:00:00 2001 From: Gabriel Silva Vinha Date: Fri, 11 May 2018 15:10:26 -0300 Subject: [PATCH 219/449] Upgrade moniker version (#4034) --- glide.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/glide.yaml b/glide.yaml index ce5d0e8c2..fc3dcc37d 100644 --- a/glide.yaml +++ b/glide.yaml @@ -18,6 +18,7 @@ import: - package: github.com/Masterminds/semver version: ~1.3.1 - package: github.com/technosophos/moniker + version: ~0.2 - package: github.com/golang/protobuf version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 subpackages: From 21a50134ac1e189bf48da4c6f8acb0cdeea944b5 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Fri, 11 May 2018 14:15:46 -0400 Subject: [PATCH 220/449] chore(docs): mv index.md to README.md * Newcomers may not realize they have to look for the index.md file when coming to the docs dir * README.md makes the index easier to see --- docs/{index.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{index.md => README.md} (100%) diff --git a/docs/index.md b/docs/README.md similarity index 100% rename from docs/index.md rename to docs/README.md From 9ccb46df664aa225218300ec27ddb9d3e74fa151 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Fri, 11 May 2018 12:12:42 -0700 Subject: [PATCH 221/449] fix(kube): run schema validation on BuildUnstructured --- pkg/kube/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index e4c6b6a9f..926174ef1 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -139,6 +139,7 @@ func (c *Client) BuildUnstructured(namespace string, reader io.Reader) (Result, NamespaceParam(namespace). DefaultNamespace(). Stream(reader, ""). + Schema(c.validator()). Flatten(). Do().Infos() return result, scrubValidationError(err) From e8fd4f78ffb65557f106c2b39f4e382aa895b934 Mon Sep 17 00:00:00 2001 From: Doug Winter Date: Fri, 11 May 2018 20:25:04 +0100 Subject: [PATCH 222/449] Support values files on remote servers with self-signed certs / client cert authentication (#4003) * support tls for values file access - uses --ca-file / --cert-file / --key-file * also for upgrade command --- cmd/helm/install.go | 10 +++++----- cmd/helm/template.go | 2 +- cmd/helm/upgrade.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 2dafd85ba..d1c24c213 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -220,7 +220,7 @@ func (i *installCmd) run() error { i.namespace = defaultNamespace() } - rawVals, err := vals(i.valueFiles, i.values, i.stringValues) + rawVals, err := vals(i.valueFiles, i.values, i.stringValues, i.certFile, i.keyFile, i.caFile) if err != nil { return err } @@ -335,7 +335,7 @@ func mergeValues(dest map[string]interface{}, src map[string]interface{}) map[st // vals merges values from files specified via -f/--values and // directly via --set or --set-string, marshaling them to YAML -func vals(valueFiles valueFiles, values []string, stringValues []string) ([]byte, error) { +func vals(valueFiles valueFiles, values []string, stringValues []string, CertFile, KeyFile, CAFile string) ([]byte, error) { base := map[string]interface{}{} // User specified a values files via -f/--values @@ -347,7 +347,7 @@ func vals(valueFiles valueFiles, values []string, stringValues []string) ([]byte if strings.TrimSpace(filePath) == "-" { bytes, err = ioutil.ReadAll(os.Stdin) } else { - bytes, err = readFile(filePath) + bytes, err = readFile(filePath, CertFile, KeyFile, CAFile) } if err != nil { @@ -512,7 +512,7 @@ func checkDependencies(ch *chart.Chart, reqs *chartutil.Requirements) error { } //readFile load a file from the local directory or a remote file with a url. -func readFile(filePath string) ([]byte, error) { +func readFile(filePath, CertFile, KeyFile, CAFile string) ([]byte, error) { u, _ := url.Parse(filePath) p := getter.All(settings) @@ -523,7 +523,7 @@ func readFile(filePath string) ([]byte, error) { return ioutil.ReadFile(filePath) } - getter, err := getterConstructor(filePath, "", "", "") + getter, err := getterConstructor(filePath, CertFile, KeyFile, CAFile) if err != nil { return []byte{}, err } diff --git a/cmd/helm/template.go b/cmd/helm/template.go index fc1f44392..458df87b5 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -130,7 +130,7 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { t.namespace = defaultNamespace() } // get combined values and create config - rawVals, err := vals(t.valueFiles, t.values, t.stringValues) + rawVals, err := vals(t.valueFiles, t.values, t.stringValues, "", "", "") if err != nil { return err } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 66c4a3657..4dd433a39 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -195,7 +195,7 @@ func (u *upgradeCmd) run() error { } } - rawVals, err := vals(u.valueFiles, u.values, u.stringValues) + rawVals, err := vals(u.valueFiles, u.values, u.stringValues, u.certFile, u.keyFile, u.caFile) if err != nil { return err } From 9705a83e26cd55ffec6932b97ca7091195d10b08 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Sat, 12 May 2018 17:37:09 -0700 Subject: [PATCH 223/449] fix lint warning --- pkg/downloader/manager.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 89a839b54..9ee1f6f6d 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -99,11 +99,7 @@ func (m *Manager) Build() error { } // Now we need to fetch every package here into charts/ - if err := m.downloadAll(lock.Dependencies); err != nil { - return err - } - - return nil + return m.downloadAll(lock.Dependencies) } // Update updates a local charts directory. From 4aa38b0ef43631b73556448344036dd9aadf21c0 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Mon, 14 May 2018 18:47:13 +0200 Subject: [PATCH 224/449] Suppress 'unauthenticated users' warning when --tiller-tls-verify present And clarify the warning to indicate exactly how to correct the problem. --- cmd/helm/init.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index ea23890cb..e2fb694bc 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -281,9 +281,12 @@ func (i *initCmd) run() error { "(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)") } } else { - fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.\n\n"+ - "Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.\n"+ - "For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation") + fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.") + if !tlsVerify { + fmt.Fprintln(i.out, "\nPlease note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.\n"+ + "To prevent this, run `helm init` with the --tiller-tls-verify flag.\n"+ + "For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation") + } } if err := i.ping(); err != nil { return err From a76027101a9a57b727ccdea654c88bac67be92e1 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 14 May 2018 11:44:49 -0700 Subject: [PATCH 225/449] replace with a link to the latest releases page This removes a step required every time we release Helm, making it simpler to cut a new release. --- README.md | 7 +------ docs/release_checklist.md | 25 ------------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/README.md b/README.md index fb2e16bce..fc091056e 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,7 @@ Think of it like apt/yum/homebrew for Kubernetes. ## Install -Binary downloads of the Helm client can be found at the following links: - -- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-darwin-amd64.tar.gz) -- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-linux-amd64.tar.gz) -- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-linux-386.tar.gz) -- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-windows-amd64.tar.gz) +Binary downloads of the Helm client can be found on [the latest Releases page](https://github.com/kubernetes/helm/releases/latest). Unpack the `helm` binary and add it to your PATH and you are good to go! diff --git a/docs/release_checklist.md b/docs/release_checklist.md index de047971e..5187b720a 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -121,31 +121,6 @@ index 2109a0a..6f5a1a4 100644 BuildMetadata = "unreleased" ``` -The README stores links to the latest release for helm. We want to change the version to the first release candidate which we are releasing (more on that in step 5). - -```shell -$ git diff README.md -diff --git a/README.md b/README.md -index 022afd79..547839e2 100644 ---- a/README.md -+++ b/README.md -@@ -34,10 +34,10 @@ Think of it like apt/yum/homebrew for Kubernetes. - - Binary downloads of the Helm client can be found at the following links: - --- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-darwin-amd64.tar.gz) --- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-amd64.tar.gz) --- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-386.tar.gz) --- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-windows-amd64.tar.gz) -+- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-darwin-amd64.tar.gz) -+- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-linux-amd64.tar.gz) -+- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-linux-386.tar.gz) -+- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-windows-amd64.tar.gz) - - Unpack the `helm` binary and add it to your PATH and you are good to go! - macOS/[homebrew](https://brew.sh/) users can also use `brew install kubernetes-helm`. -``` - For patch releases, the old version number will be the latest patch release, so just bump the patch number, incrementing Z by one. ```shell From 87a0afd244348c5ad5ee15c8c9632b0a987aceb8 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Wed, 16 May 2018 00:31:05 +0800 Subject: [PATCH 226/449] Typo fix: mach->match mach->match --- pkg/chartutil/requirements.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chartutil/requirements.go b/pkg/chartutil/requirements.go index 546160b0c..6ef6508d9 100644 --- a/pkg/chartutil/requirements.go +++ b/pkg/chartutil/requirements.go @@ -45,7 +45,7 @@ var ( type Dependency struct { // Name is the name of the dependency. // - // This must mach the name in the dependency's Chart.yaml. + // This must match the name in the dependency's Chart.yaml. Name string `json:"name"` // Version is the version (range) of this chart. // From 3afc76f01a5cd2052bca4573ad8ef03f63722e9e Mon Sep 17 00:00:00 2001 From: James Meickle Date: Tue, 15 May 2018 12:43:28 -0400 Subject: [PATCH 227/449] Don't request Tiller version in installer This makes the script hang for quite a while if it can't connect to Tiller to retrieve this information that isn't being used anyways. --- scripts/get | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get b/scripts/get index 943ca4158..af0960abf 100755 --- a/scripts/get +++ b/scripts/get @@ -92,7 +92,7 @@ checkDesiredVersion() { # if it needs to be changed. checkHelmInstalledVersion() { if [[ -f "${HELM_INSTALL_DIR}/${PROJECT_NAME}" ]]; then - local version=$(helm version | grep '^Client' | cut -d'"' -f2) + local version=$(helm version -c | grep '^Client' | cut -d'"' -f2) if [[ "$version" == "$TAG" ]]; then echo "Helm ${version} is already ${DESIRED_VERSION:-latest}" return 0 From 00431bed71f16f258718d0d355d82cc4645f49c1 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Thu, 17 May 2018 00:05:06 +0800 Subject: [PATCH 228/449] Update capabilities.go --- pkg/chartutil/capabilities.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chartutil/capabilities.go b/pkg/chartutil/capabilities.go index c87c0368e..d26aa1707 100644 --- a/pkg/chartutil/capabilities.go +++ b/pkg/chartutil/capabilities.go @@ -42,7 +42,7 @@ var ( type Capabilities struct { // List of all supported API versions APIVersions VersionSet - // KubeVerison is the Kubernetes version + // KubeVersion is the Kubernetes version KubeVersion *version.Info // TillerVersion is the Tiller version // From 8ab182130055084668b2180e4c65ed293bbf419c Mon Sep 17 00:00:00 2001 From: Alejandro Vicente Grabovetsky Date: Sat, 19 May 2018 02:42:49 +0300 Subject: [PATCH 229/449] Migrate 'template' to 'include' in 'helm create' to conform to Helm best practices Signed-off-by: Alejandro Vicente Grabovetsky --- pkg/chartutil/create.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 30c6310b2..fa6fb2783 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -129,8 +129,8 @@ kind: Ingress metadata: name: {{ $fullName }} labels: - app: {{ template ".name" . }} - chart: {{ template ".chart" . }} + app: {{ include ".name" . }} + chart: {{ include ".chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- with .Values.ingress.annotations }} @@ -164,22 +164,22 @@ spec: const defaultDeployment = `apiVersion: apps/v1beta2 kind: Deployment metadata: - name: {{ template ".fullname" . }} + name: {{ include ".fullname" . }} labels: - app: {{ template ".name" . }} - chart: {{ template ".chart" . }} + app: {{ include ".name" . }} + chart: {{ include ".chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: - app: {{ template ".name" . }} + app: {{ include ".name" . }} release: {{ .Release.Name }} template: metadata: labels: - app: {{ template ".name" . }} + app: {{ include ".name" . }} release: {{ .Release.Name }} spec: containers: @@ -217,10 +217,10 @@ spec: const defaultService = `apiVersion: v1 kind: Service metadata: - name: {{ template ".fullname" . }} + name: {{ include ".fullname" . }} labels: - app: {{ template ".name" . }} - chart: {{ template ".chart" . }} + app: {{ include ".name" . }} + chart: {{ include ".chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: @@ -231,7 +231,7 @@ spec: protocol: TCP name: http selector: - app: {{ template ".name" . }} + app: {{ include ".name" . }} release: {{ .Release.Name }} ` @@ -241,16 +241,16 @@ const defaultNotes = `1. Get the application URL by running these commands: http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template ".fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include ".fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get svc -w {{ template ".fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template ".fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + You can watch the status of by running 'kubectl get svc -w {{ include ".fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include ".fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template ".name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include ".name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl port-forward $POD_NAME 8080:80 {{- end }} From bfc8e5e81e2bba9733298ccd08c40dfaa4ee021d Mon Sep 17 00:00:00 2001 From: Yeni Capote Diaz Date: Sun, 20 May 2018 23:26:45 -0700 Subject: [PATCH 230/449] removed --install option from --namespace. --- cmd/helm/lint.go | 2 +- docs/helm/helm_lint.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/helm/lint.go b/cmd/helm/lint.go index 63f11c062..c81468e50 100644 --- a/cmd/helm/lint.go +++ b/cmd/helm/lint.go @@ -73,7 +73,7 @@ func newLintCmd(out io.Writer) *cobra.Command { cmd.Flags().VarP(&l.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)") cmd.Flags().StringArrayVar(&l.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") cmd.Flags().StringArrayVar(&l.sValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") - cmd.Flags().StringVar(&l.namespace, "namespace", "default", "namespace to install the release into (only used if --install is set)") + cmd.Flags().StringVar(&l.namespace, "namespace", "default", "namespace to put the release into") cmd.Flags().BoolVar(&l.strict, "strict", false, "fail on lint warnings") return cmd diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index 596edf2bb..c10322efd 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -21,7 +21,7 @@ helm lint [flags] PATH ### Options ``` - --namespace string namespace to install the release into (only used if --install is set) (default "default") + --namespace string namespace to put the release into (default "default") --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --strict fail on lint warnings @@ -42,4 +42,4 @@ helm lint [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 9-Mar-2018 +###### Auto generated by spf13/cobra on 20-May-2018 From 3c2aeaa60b59e9faf1548b0a6310f247a5f995d6 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Mon, 21 May 2018 16:18:16 +0800 Subject: [PATCH 231/449] fix charts doc: extra space in requirement condition --- docs/charts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/charts.md b/docs/charts.md index a55038e3e..8f8a9856f 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -265,7 +265,7 @@ dependencies: - name: subchart1 repository: http://localhost:10191 version: 0.1.0 - condition: subchart1.enabled, global.subchart1.enabled + condition: subchart1.enabled,global.subchart1.enabled tags: - front-end - subchart1 From f263e9672ea8ecead0adbbbd7205ffc2f2d6b3c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Tue, 22 May 2018 16:24:19 +0200 Subject: [PATCH 232/449] Add helm template --is-upgrade Useful for toggling .Release.IsInstall / .Release.IsUpgrade which in turn may cause templates to render differently. --- cmd/helm/template.go | 28 +++++++++++-------- cmd/helm/template_test.go | 14 ++++++++++ .../charts/subchart1/templates/service.yaml | 2 ++ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 458df87b5..7e3eb48a7 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -63,18 +63,19 @@ To render just one template in a chart, use '-x': ` type templateCmd struct { - namespace string - valueFiles valueFiles - chartPath string - out io.Writer - values []string - stringValues []string - nameTemplate string - showNotes bool - releaseName string - renderFiles []string - kubeVersion string - outputDir string + namespace string + valueFiles valueFiles + chartPath string + out io.Writer + values []string + stringValues []string + nameTemplate string + showNotes bool + releaseName string + releaseIsUpgrade bool + renderFiles []string + kubeVersion string + outputDir string } func newTemplateCmd(out io.Writer) *cobra.Command { @@ -93,6 +94,7 @@ func newTemplateCmd(out io.Writer) *cobra.Command { f := cmd.Flags() f.BoolVar(&t.showNotes, "notes", false, "show the computed NOTES.txt file as well") f.StringVarP(&t.releaseName, "name", "n", "RELEASE-NAME", "release name") + f.BoolVar(&t.releaseIsUpgrade, "is-upgrade", false, "set .Release.IsUpgrade instead of .Release.IsInstall") f.StringArrayVarP(&t.renderFiles, "execute", "x", []string{}, "only execute the given templates") f.VarP(&t.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)") f.StringVar(&t.namespace, "namespace", "", "namespace to install the release into") @@ -159,6 +161,8 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { } options := chartutil.ReleaseOptions{ Name: t.releaseName, + IsInstall: !t.releaseIsUpgrade, + IsUpgrade: t.releaseIsUpgrade, Time: timeconv.Now(), Namespace: t.namespace, } diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index cad42db16..d15dc5666 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -107,6 +107,20 @@ func TestTemplateCmd(t *testing.T) { expectKey: "subchart1/templates/service.yaml", expectValue: "release-name: \"test\"", }, + { + name: "check_release_is_install", + desc: "verify --is-upgrade toggles .Release.IsInstall", + args: []string{subchart1ChartPath, "--is-upgrade=false"}, + expectKey: "subchart1/templates/service.yaml", + expectValue: "release-is-install: \"true\"", + }, + { + name: "check_release_is_upgrade", + desc: "verify --is-upgrade toggles .Release.IsUpgrade", + args: []string{subchart1ChartPath, "--is-upgrade", "true"}, + expectKey: "subchart1/templates/service.yaml", + expectValue: "release-is-upgrade: \"true\"", + }, { name: "check_notes", desc: "verify --notes shows notes", diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml index 3835a3d0b..e06d19b90 100644 --- a/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml +++ b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml @@ -6,6 +6,8 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" namespace: "{{ .Release.Namespace }}" release-name: "{{ .Release.Name }}" + release-is-upgrade: "{{ .Release.IsUpgrade }}" + release-is-install: "{{ .Release.IsInstall }}" kube-version/major: "{{ .Capabilities.KubeVersion.Major }}" kube-version/minor: "{{ .Capabilities.KubeVersion.Minor }}" kube-version/gitversion: "v{{ .Capabilities.KubeVersion.Major }}.{{ .Capabilities.KubeVersion.Minor }}.0" From 8ef20d13cf999d15f380721163909971da08250b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Tue, 22 May 2018 16:45:37 +0200 Subject: [PATCH 233/449] make docs recipe for target 'verify-docs' failed --- docs/helm/helm_template.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index 3a4e9ce4a..cdc8a84a6 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -26,6 +26,7 @@ helm template [flags] CHART ``` -x, --execute stringArray only execute the given templates + --is-upgrade set .Release.IsUpgrade instead of .Release.IsInstall --kube-version string kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9") -n, --name string release name (default "RELEASE-NAME") --name-template string specify template used to name the release @@ -51,4 +52,4 @@ helm template [flags] CHART ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 9-Mar-2018 +###### Auto generated by spf13/cobra on 22-May-2018 From fd5364dec755b72d30eec67cd047501453957774 Mon Sep 17 00:00:00 2001 From: Ryan Hartje Date: Wed, 23 May 2018 11:43:56 -0400 Subject: [PATCH 234/449] adding docs for GKE for helm 2 --- docs/kubernetes_distros.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/kubernetes_distros.md b/docs/kubernetes_distros.md index 8b80519ec..bb14043da 100644 --- a/docs/kubernetes_distros.md +++ b/docs/kubernetes_distros.md @@ -18,8 +18,9 @@ Hyperkube you may need to do some manual configuration. ## GKE -Google's GKE hosted Kubernetes platform is known to work with Helm, and requires -no additional configuration. +Google's GKE hosted Kubernetes platform enables RBAC by default. You will need to create a service account for tiller, and use the --service-account flag when initializing the helm server. + +See [Tiller and role-based access control](https://docs.helm.sh/using_helm/#role-based-access-control) for more information. ## Ubuntu with 'kubeadm' @@ -48,4 +49,3 @@ Helm Client and Helm Server (Tiller) are pre-installed with [Platform9 Managed K Helm (both client and server) has been tested and is working on Mesospheres DC/OS 1.11 Kubernetes platform, and requires no additional configuration. - From df946b518314c0893591b34449bee708739c0825 Mon Sep 17 00:00:00 2001 From: Shubham Jain Date: Thu, 24 May 2018 18:19:51 +0530 Subject: [PATCH 235/449] docs(helm): Added double quotes to example In the current version of helm (2.8.2), there needs to be double quotes around the value to support escaping special characters. --- docs/using_helm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using_helm.md b/docs/using_helm.md index 6bf7bc40a..0d15637d4 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -285,7 +285,7 @@ servers: ``` Sometimes you need to use special characters in your `--set` lines. You can use -a backslash to escape the characters; `--set name=value1\,value2` will become: +a backslash to escape the characters; `--set name="value1\,value2"` will become: ```yaml name: "value1,value2" From a0fd3ae1578994f0a4db874db7fd5704dee3213f Mon Sep 17 00:00:00 2001 From: mf-lit Date: Thu, 24 May 2018 16:41:11 +0100 Subject: [PATCH 236/449] Update tiller_ssl.md Add -days parameter to openssl signing commands for clarity. Also add some related troubleshooting steps. --- docs/tiller_ssl.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/tiller_ssl.md b/docs/tiller_ssl.md index d7f0166c4..6db195507 100644 --- a/docs/tiller_ssl.md +++ b/docs/tiller_ssl.md @@ -148,10 +148,10 @@ $ openssl req -key helm.key.pem -new -sha256 -out helm.csr.pem (In rare cases, we've had to add the `-nodes` flag when generating the request.) -Now we sign each of these CSRs with the CA certificate we created: +Now we sign each of these CSRs with the CA certificate we created (adjust the days parameter to suit your requirements): ```console -$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in tiller.csr.pem -out tiller.cert.pem +$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in tiller.csr.pem -out tiller.cert.pem -days 365 Signature ok subject=/C=US/ST=CO/L=Boulder/O=Tiller Server/CN=tiller-server Getting CA Private Key @@ -161,7 +161,7 @@ Enter pass phrase for ca.key.pem: And again for the client certificate: ```console -$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in helm.csr.pem -out helm.cert.pem +$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in helm.csr.pem -out helm.cert.pem -days 365 ``` At this point, the important files for us are these: @@ -284,6 +284,13 @@ the host name that Helm connects to matches the host name on the certificate. In some cases this is awkward, since Helm will connect over localhost, or the FQDN is not available for public resolution. +*If I use `--tls-verify` on the client, I get `Error: x509: certificate has expired or is not yet valid`* + +Your helm certificate has expired, you need to sign a new certificate using your private key and the CA (and consider increasing the number of days) + +If your tiller certificate has expired, you'll need to sign a new certificate, base64 encode it and update the Tiller Secret: +`kubectl edit secret tiller-secret` + ## References https://github.com/denji/golang-tls From 14d8c0cf3b0126cc6577dca533be311c83dfa11a Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Thu, 24 May 2018 12:14:09 -0700 Subject: [PATCH 237/449] update security vulnerability email --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec3db568c..8fecb0479 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ The Kubernetes Helm project accepts contributions via GitHub pull requests. This Most of the time, when you find a bug in Helm, it should be reported using [GitHub issues](https://github.com/kubernetes/helm/issues). However, if you are reporting a _security vulnerability_, please email a report to -[helm-security@deis.com](mailto:helm-security@deis.com). This will give +[cncf-kubernetes-helm-security@lists.cncf.io](mailto:cncf-kubernetes-helm-security@lists.cncf.io). This will give us a chance to try to fix the issue before it is exploited in the wild. ## Contributor License Agreements From e9bc63120f3d49491091efb511cb47a2dc0b8c27 Mon Sep 17 00:00:00 2001 From: mattjmcnaughton Date: Sun, 27 May 2018 18:25:55 -0400 Subject: [PATCH 238/449] Fix inaccurate comment in `tiller` When reading through `cmd/tiller/tiller.go`, I noticed a comment around `rootServer` mentions the usage of an `init` function. However, there is no `init` function in this package. Update the comment to be more accurate. --- cmd/tiller/tiller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index 5d2db3816..c97187b2a 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -85,7 +85,7 @@ var ( // rootServer is the root gRPC server. // - // Each gRPC service registers itself to this server during init(). + // Each gRPC service registers itself to this server during start(). rootServer *grpc.Server // env is the default environment. From 6b5264b93ca63c095be66c0c0f625ba546fec120 Mon Sep 17 00:00:00 2001 From: mattjmcnaughton Date: Mon, 28 May 2018 10:07:33 -0400 Subject: [PATCH 239/449] Fix concurrency issues with helm install Address a race condition that arises when running two `helm install` commands, both of which specify a namespace that does not already exist. In this specific instance, attempting to create a `namespace` which already exists shouldn't be a failure which causes `helm install` to terminate. --- pkg/kube/namespace.go | 11 ++++++++++- pkg/tiller/environment/environment.go | 2 -- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/kube/namespace.go b/pkg/kube/namespace.go index 9d2793d87..6547e4abc 100644 --- a/pkg/kube/namespace.go +++ b/pkg/kube/namespace.go @@ -40,7 +40,16 @@ func getNamespace(client internalclientset.Interface, namespace string) (*core.N func ensureNamespace(client internalclientset.Interface, namespace string) error { _, err := getNamespace(client, namespace) if err != nil && errors.IsNotFound(err) { - return createNamespace(client, namespace) + err = createNamespace(client, namespace) + + // If multiple commands which run `ensureNamespace` are run in + // parallel, then protect against the race condition in which + // the namespace did not exist when `getNamespace` was executed, + // but did exist when `createNamespace` was executed. If that + // happens, we can just proceed as normal. + if errors.IsAlreadyExists(err) { + return nil + } } return err } diff --git a/pkg/tiller/environment/environment.go b/pkg/tiller/environment/environment.go index 366fdf522..18518dfc1 100644 --- a/pkg/tiller/environment/environment.go +++ b/pkg/tiller/environment/environment.go @@ -98,8 +98,6 @@ type Engine interface { type KubeClient interface { // Create creates one or more resources. // - // namespace must contain a valid existing namespace. - // // reader must contain a YAML stream (one or more YAML documents separated // by "\n---\n"). Create(namespace string, reader io.Reader, timeout int64, shouldWait bool) error From e255d8c7da73b7e3bd3b04ac56bee7707d9604c8 Mon Sep 17 00:00:00 2001 From: radbaron Date: Tue, 29 May 2018 15:28:04 +0100 Subject: [PATCH 240/449] Documentation: add syntax highlighting to code examples & fix spelling of kube primitives --- docs/examples/README.md | 3 +-- docs/using_helm.md | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/examples/README.md b/docs/examples/README.md index 723040ca8..f936e1551 100644 --- a/docs/examples/README.md +++ b/docs/examples/README.md @@ -14,6 +14,5 @@ It simply deploys a single pod running Alpine Linux. The `nginx` chart shows how to compose several resources into one chart, and it illustrates more complex template usage. -It deploys a `deployment` (which creates a `replica set`), a `config -map`, and a `service`. The replica set starts an nginx pod. The config +It deploys a `Deployment` (which creates a `ReplicaSet`), a `ConfigMap`, and a `Service`. The replica set starts an nginx pod. The config map stores the files that the nginx server can serve. diff --git a/docs/using_helm.md b/docs/using_helm.md index 0d15637d4..5490abbe1 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -43,7 +43,7 @@ carefully curated and maintained charts. This chart repository is named You can see which charts are available by running `helm search`: -``` +```console $ helm search NAME VERSION DESCRIPTION stable/drupal 0.3.2 One of the most versatile open source content m... @@ -56,7 +56,7 @@ stable/mysql 0.1.0 Chart for MySQL With no filter, `helm search` shows you all of the available charts. You can narrow down your results by searching with a filter: -``` +```console $ helm search mysql NAME VERSION DESCRIPTION stable/mysql 0.1.0 Chart for MySQL @@ -69,7 +69,7 @@ Why is `mariadb` in the list? Because its package description relates it to MySQL. We can use `helm inspect chart` to see this: -``` +```console $ helm inspect stable/mariadb Fetched stable/mariadb to mariadb-0.5.1.tgz description: Chart for MariaDB @@ -91,7 +91,7 @@ package you want to install, you can use `helm install` to install it. To install a new package, use the `helm install` command. At its simplest, it takes only one argument: The name of the chart. -``` +```console $ helm install stable/mariadb Fetched stable/mariadb-0.3.0 to /Users/mattbutcher/Code/Go/src/k8s.io/helm/mariadb-0.3.0.tgz happy-panda @@ -139,7 +139,7 @@ may take a long time to install into the cluster. To keep track of a release's state, or to re-read configuration information, you can use `helm status`: -``` +```console $ helm status happy-panda Last Deployed: Wed Sep 28 12:32:28 2016 Namespace: default @@ -392,14 +392,14 @@ is not a full list of cli flags. To see a description of all flags, just run When it is time to uninstall or delete a release from the cluster, use the `helm delete` command: -``` +```console $ helm delete happy-panda ``` This will remove the release from the cluster. You can see all of your currently deployed releases with the `helm list` command: -``` +```console $ helm list NAME VERSION UPDATED STATUS CHART inky-cat 1 Wed Sep 28 12:59:46 2016 DEPLOYED alpine-0.1.0 From 1c800c12ff1df25d74fa3fff09380b4098553b7c Mon Sep 17 00:00:00 2001 From: Elmar Ritsch Date: Tue, 29 May 2018 21:17:37 +0200 Subject: [PATCH 241/449] Parse booleans and null as string values with --set-string flag --- pkg/strvals/parser.go | 9 +++++++-- pkg/strvals/parser_test.go | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 90670a4dd..dae949d8e 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -325,6 +325,11 @@ func inMap(k rune, m map[rune]bool) bool { func typedVal(v []rune, st bool) interface{} { val := string(v) + + if st { + return val + } + if strings.EqualFold(val, "true") { return true } @@ -337,8 +342,8 @@ func typedVal(v []rune, st bool) interface{} { return nil } - // If this value does not start with zero, and not returnString, try parsing it to an int - if !st && len(val) != 0 && val[0] != '0' { + // If this value does not start with zero, try parsing it to an int + if len(val) != 0 && val[0] != '0' { if iv, err := strconv.ParseInt(val, 10, 64); err == nil { return iv } diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index c897cf0a7..54a95e6e0 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -75,6 +75,11 @@ func TestParseSet(t *testing.T) { expect: map[string]interface{}{"long_int_string": "1234567890"}, err: false, }, + { + str: "boolean=true", + expect: map[string]interface{}{"boolean": "true"}, + err: false, + }, } tests := []struct { str string @@ -117,6 +122,10 @@ func TestParseSet(t *testing.T) { str: "long_int=1234567890", expect: map[string]interface{}{"long_int": 1234567890}, }, + { + str: "boolean=true", + expect: map[string]interface{}{"boolean": true}, + }, { str: "name1,name2=", err: true, From 5434774033310aae4c59e236ad72863f25f04e9d Mon Sep 17 00:00:00 2001 From: Elmar Ritsch Date: Tue, 29 May 2018 21:38:21 +0200 Subject: [PATCH 242/449] Add test to make sure --set-string flag takes `null` as string --- pkg/strvals/parser_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index 54a95e6e0..7ad31aa56 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -80,6 +80,11 @@ func TestParseSet(t *testing.T) { expect: map[string]interface{}{"boolean": "true"}, err: false, }, + { + str: "is_null=null", + expect: map[string]interface{}{"is_null": "null"}, + err: false, + }, } tests := []struct { str string From f2813ae31eaebf568db8375ea3d055d170dde0a1 Mon Sep 17 00:00:00 2001 From: Elmar Ritsch Date: Tue, 29 May 2018 22:06:00 +0200 Subject: [PATCH 243/449] Add test to make sure --set flag interprets `null` as `nil` --- pkg/strvals/parser_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index 7ad31aa56..f6e35c81b 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -131,6 +131,11 @@ func TestParseSet(t *testing.T) { str: "boolean=true", expect: map[string]interface{}{"boolean": true}, }, + { + str: "is_null=null", + expect: map[string]interface{}{"is_null": nil}, + err: false, + }, { str: "name1,name2=", err: true, From 24c400d92a3e98086b3749e2c01cbd2e9192639e Mon Sep 17 00:00:00 2001 From: Rob Salmond Date: Thu, 31 May 2018 10:36:28 -0700 Subject: [PATCH 244/449] small typo fix --- docs/securing_installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index 4083bf188..f192ad9f8 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -34,7 +34,7 @@ There are four main areas to consider when securing a tiller installation: ### RBAC -Recent versions of Kubernetes employ a [role-based access control (or RBAC)](https://en.wikipedia.org/wiki/Role-based_access_control) system (as do modern operating systems) to help mitigate the damage that can done if credentials are misused or bugs exist. Even where an identity is hijacked, the identity has only so many permissions to a controlled space. This effectively adds a layer of security to limit the scope of any attack with that identity. +Recent versions of Kubernetes employ a [role-based access control (or RBAC)](https://en.wikipedia.org/wiki/Role-based_access_control) system (as do modern operating systems) to help mitigate the damage that can be done if credentials are misused or bugs exist. Even where an identity is hijacked, the identity has only so many permissions to a controlled space. This effectively adds a layer of security to limit the scope of any attack with that identity. Helm and Tiller are designed to install, remove, and modify logical applications that can contain many services interacting together. As a result, often its usefulness involves cluster-wide operations, which in a multitenant cluster means that great care must be taken with access to a cluster-wide Tiller installation to prevent improper activity. From daed8f830397fae26f61a4ef731c216600902631 Mon Sep 17 00:00:00 2001 From: mattjmcnaughton Date: Fri, 1 Jun 2018 10:13:33 -0400 Subject: [PATCH 245/449] Fix test failure message The error message we reported if the test failed was incorrect. --- pkg/releasetesting/test_suite_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/releasetesting/test_suite_test.go b/pkg/releasetesting/test_suite_test.go index e6cc8bcf5..0c2fae876 100644 --- a/pkg/releasetesting/test_suite_test.go +++ b/pkg/releasetesting/test_suite_test.go @@ -134,7 +134,7 @@ func TestRun(t *testing.T) { } if result2.Status != release.TestRun_FAILURE { - t.Errorf("Expected test result to be successful, got: %v", result2.Status) + t.Errorf("Expected test result to be failure, got: %v", result2.Status) } } From 53b11b338f13b21dea725208d93740d5b6cef047 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Sat, 2 Jun 2018 18:57:31 +0800 Subject: [PATCH 246/449] Typo fix: retruns->returns retruns->returns --- pkg/helm/portforwarder/pod.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/helm/portforwarder/pod.go b/pkg/helm/portforwarder/pod.go index 7c2355204..5eae5b5e6 100644 --- a/pkg/helm/portforwarder/pod.go +++ b/pkg/helm/portforwarder/pod.go @@ -32,7 +32,7 @@ func isPodReady(pod *v1.Pod) bool { return isPodReadyConditionTrue(pod.Status) } -// isPodReady retruns true if a pod is ready; false otherwise. +// isPodReadyConditionTrue returns true if a pod is ready; false otherwise. func isPodReadyConditionTrue(status v1.PodStatus) bool { condition := getPodReadyCondition(status) return condition != nil && condition.Status == v1.ConditionTrue From 004640e092773963c67669d97815379a0eaa9d1d Mon Sep 17 00:00:00 2001 From: Lukas Eichler Date: Sat, 2 Jun 2018 13:05:46 +0200 Subject: [PATCH 247/449] Added documentation for the tpl function --- docs/charts_tips_and_tricks.md | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index 484d8b936..a83b44457 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -106,6 +106,43 @@ For example: The above will render the template when .Values.foo is defined, but will fail to render and exit when .Values.foo is undefined. +## Using the 'tpl' Function + +The `tpl` function allows developers to evaluate strings as templates inside a template. +This is useful to pass a template string as a value to a chart or render external configuration files. +Syntax: `{{ tpl TEMPLATE_STRING VALUES }}` + +Examples: +``` +# values +template: "{{ .Values.name }}" +name: "Tom" + +# template +{{ tpl .Values.template . }} + +# output +Tom +``` + +Rendering a external configuration file: +``` +# external configuration file conf/app.conf +firstName={{ .Values.firstName }} +lastName={{ .Values.lastName }} + +# values +firstName: Peter +lastName: Parker + +# template +{{ tpl (.Files.Get "conf/app.conf") . }} + +# output +firstName=Peter +lastName=Parker +``` + ## Creating Image Pull Secrets Image pull secrets are essentially a combination of _registry_, _username_, and _password_. You may need them in an application you are deploying, but to create them requires running _base64_ a couple of times. We can write a helper template to compose the Docker configuration file for use as the Secret's payload. Here is an example: From 0deb98c0eedde84a592b4342d58969f6ae223f1d Mon Sep 17 00:00:00 2001 From: mattjmcnaughton Date: Sat, 2 Jun 2018 10:37:35 -0400 Subject: [PATCH 248/449] Fix incorrect timestamp when helm package The files contained in the `tar` file from `helm package` did not have the correct timestamp. This lack of timestamp occurred because we were not writing any time to the tar header file. --- pkg/chartutil/save.go | 8 ++-- pkg/chartutil/save_test.go | 80 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index 201372a0f..8a2746993 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -24,6 +24,7 @@ import ( "io/ioutil" "os" "path/filepath" + "time" "github.com/ghodss/yaml" @@ -205,9 +206,10 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error { func writeToTar(out *tar.Writer, name string, body []byte) error { // TODO: Do we need to create dummy parent directory names if none exist? h := &tar.Header{ - Name: filepath.ToSlash(name), - Mode: 0755, - Size: int64(len(body)), + Name: filepath.ToSlash(name), + Mode: 0755, + Size: int64(len(body)), + ModTime: time.Now(), } if err := out.WriteHeader(h); err != nil { return err diff --git a/pkg/chartutil/save_test.go b/pkg/chartutil/save_test.go index 5e1564299..3279281b2 100644 --- a/pkg/chartutil/save_test.go +++ b/pkg/chartutil/save_test.go @@ -17,10 +17,14 @@ limitations under the License. package chartutil import ( + "archive/tar" + "compress/gzip" + "io" "io/ioutil" "os" "strings" "testing" + "time" "github.com/golang/protobuf/ptypes/any" "k8s.io/helm/pkg/proto/hapi/chart" @@ -73,6 +77,82 @@ func TestSave(t *testing.T) { } } +func TestSavePreservesTimestamps(t *testing.T) { + // Test executes so quickly that if we don't subtract a second, the + // check will fail because `initialCreateTime` will be identical to the + // written timestamp for the files. + initialCreateTime := time.Now().Add(-1 * time.Second) + + tmp, err := ioutil.TempDir("", "helm-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tmp) + + c := &chart.Chart{ + Metadata: &chart.Metadata{ + Name: "ahab", + Version: "1.2.3.4", + }, + Values: &chart.Config{ + Raw: "ship: Pequod", + }, + Files: []*any.Any{ + {TypeUrl: "scheherazade/shahryar.txt", Value: []byte("1,001 Nights")}, + }, + } + + where, err := Save(c, tmp) + if err != nil { + t.Fatalf("Failed to save: %s", err) + } + + allHeaders, err := retrieveAllHeadersFromTar(where) + if err != nil { + t.Fatalf("Failed to parse tar: %v", err) + } + + for _, header := range allHeaders { + if header.ModTime.Before(initialCreateTime) { + t.Fatalf("File timestamp not preserved: %v", header.ModTime) + } + } +} + +// We could refactor `load.go` to use this `retrieveAllHeadersFromTar` function +// as well, so we are not duplicating components of the code which iterate +// through the tar. +func retrieveAllHeadersFromTar(path string) ([]*tar.Header, error) { + raw, err := os.Open(path) + if err != nil { + return nil, err + } + defer raw.Close() + + unzipped, err := gzip.NewReader(raw) + if err != nil { + return nil, err + } + defer unzipped.Close() + + tr := tar.NewReader(unzipped) + headers := []*tar.Header{} + for { + hd, err := tr.Next() + if err == io.EOF { + break + } + + if err != nil { + return nil, err + } + + headers = append(headers, hd) + } + + return headers, nil +} + func TestSaveDir(t *testing.T) { tmp, err := ioutil.TempDir("", "helm-") if err != nil { From f49e911a81bf17d655be244a631661406b8157ff Mon Sep 17 00:00:00 2001 From: tariq1890 Date: Sat, 2 Jun 2018 21:26:50 -0700 Subject: [PATCH 249/449] Setting DisableCompression to true to disable unwanted httpclient tranformations --- pkg/getter/httpgetter.go | 14 ++++---- pkg/getter/httpgetter_test.go | 53 +++++++++++++++++++++++++++-- pkg/getter/testdata/sssd-0.1.0.tgz | Bin 0 -> 2736 bytes 3 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 pkg/getter/testdata/sssd-0.1.0.tgz diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index 990cb8cc5..1df6b0f62 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -81,19 +81,17 @@ func newHTTPGetter(URL, CertFile, KeyFile, CAFile string) (Getter, error) { // NewHTTPGetter constructs a valid http/https client as HttpGetter func NewHTTPGetter(URL, CertFile, KeyFile, CAFile string) (*HttpGetter, error) { var client HttpGetter + tr := &http.Transport{ + DisableCompression: true, + } if (CertFile != "" && KeyFile != "") || CAFile != "" { tlsConf, err := tlsutil.NewTLSConfig(URL, CertFile, KeyFile, CAFile) if err != nil { return &client, fmt.Errorf("can't create TLS config: %s", err.Error()) } - client.client = &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: tlsConf, - Proxy: http.ProxyFromEnvironment, - }, - } - } else { - client.client = http.DefaultClient + tr.TLSClientConfig = tlsConf + tr.Proxy = http.ProxyFromEnvironment } + client.client = &http.Client{Transport: tr} return &client, nil } diff --git a/pkg/getter/httpgetter_test.go b/pkg/getter/httpgetter_test.go index ec730f401..fa4863de8 100644 --- a/pkg/getter/httpgetter_test.go +++ b/pkg/getter/httpgetter_test.go @@ -16,21 +16,29 @@ limitations under the License. package getter import ( + "io" "net/http" + "net/http/httptest" + "os" "path/filepath" + "strconv" "testing" ) +type TestFileHandler struct{} + +func (h *TestFileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + HandleClient(w, r) +} + func TestHTTPGetter(t *testing.T) { g, err := newHTTPGetter("http://example.com", "", "", "") if err != nil { t.Fatal(err) } - if hg, ok := g.(*HttpGetter); !ok { + if _, ok := g.(*HttpGetter); !ok { t.Fatal("Expected newHTTPGetter to produce an HttpGetter") - } else if hg.client != http.DefaultClient { - t.Fatal("Expected newHTTPGetter to return a default HTTP client.") } // Test with SSL: @@ -58,3 +66,42 @@ func TestHTTPGetter(t *testing.T) { t.Fatal("Expected newHTTPGetter to return a non-default HTTP client") } } + +func HandleClient(writer http.ResponseWriter, request *http.Request) { + f, _ := os.Open("testdata/sssd-0.1.0.tgz") + defer f.Close() + + b := make([]byte, 512) + f.Read(b) + //Get the file size + FileStat, _ := f.Stat() + FileSize := strconv.FormatInt(FileStat.Size(), 10) + + //Simulating improper header values from bitbucket + writer.Header().Set("Content-Type", "application/x-tar") + writer.Header().Set("Content-Encoding", "gzip") + writer.Header().Set("Content-Length", FileSize) + + f.Seek(0, 0) + io.Copy(writer, f) + return +} + +func TestHTTPGetterTarDownload(t *testing.T) { + h := &TestFileHandler{} + server := httptest.NewServer(h) + defer server.Close() + + g, err := newHTTPGetter(server.URL, "", "", "") + if err != nil { + t.Fatal(err) + } + + data, _ := g.Get(server.URL) + mimeType := http.DetectContentType(data.Bytes()) + + expectedMimeType := "application/x-gzip" + if mimeType != expectedMimeType { + t.Fatalf("Expected response with MIME type %s, but got %s", expectedMimeType, mimeType) + } +} diff --git a/pkg/getter/testdata/sssd-0.1.0.tgz b/pkg/getter/testdata/sssd-0.1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..2f34fece6a1fd4de1852a3057f7a373e3f3070ad GIT binary patch literal 2736 zcmV;h3QzSPiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PH&dZyUF-{aJqn=X9@0XP@oZ>6ZiYfFSA6Vr?4CZHJ*499hTn zY0*iVq;un!=KbvtlFna~yriGC=?0iT*mn{|QlyR&Nm*;N_F+MdOQy6G555I-I-Snb zy}j_?>2%irJKd-AzS!Q~?ezK&;F}1u4wZG(Jm_@(E}iws{Y!vq{sE2UN~SRB5~}t5 zwb4yF4U(Z{hHDp^4&Wt<5}02vkShbOKp0G|!x9F_D#P6r252Unp@k!grIJL_5>xOC zjZ9{=J4rX`kncVD4Lk_n|AdMP?Kg7(w|xJ-C;i^~_rLpeZ}a`%2W-I+=Cl$H;vxuN zwO`2FC`>sGEzNu9$CaxTy#93d0bAWW#?bR^J%Q!ql%)LP7dOQ&F} zDgzEnEvQ4A5ModZ&gh}4q)VYo2ruavQvzU6E6bfS(-d;dl%eh5HUJzQrw|A@0-!4) zPL$wmn!>C6Sh*8}7NsM^qkBqB$()aeUe4j%>Fg4K3`f;?C~$%zh0b}m*X{ULRZ=c( z3WqO#JthFQc3~+2v+Ni}5!HjQRYU1^Q3X_RscdX+`<_sJ1W%bP{lv>ftm=y-{$aw$CNbO@O# zgg{V<{|BIqp|wM8)P!efQV%+D&$oXZ=pn?e_Neo+RC*pLC!1yXpSn@&1T9RB9D=3%iGc%Z@G4vX8mK9ji6b_D- z+Lotx!$h30Lq-`ImvNIq8y#yajna3vV~1T}d&>341#vgupn`+!Iy;@j-DLigpUJ{Q*UYu(x zvk>xo{|+h-&mkF*kQ%QA8RlFfG(r&J5gX82bcIkOi3umaD?sug2A>}D?F5bC8Nz39 zrjiVv^ui-A2UVW)b7-^{#8778ISO}ZkU9i9=aE-JOyRGJ3Z8S!fNCAYPRMTtnIX2AzLf|uL}K~9150n+wp8WeGKJn*<&j=^eV zI|+G}gF%7R)*535`mtHAE`OuTe*F@LblF)-M*&pB-EdjUR36N84DV7Wsb3 zBD?8%W$`Up)qf~;-03YEEL$&=h$ZL<#ZA@?D2*HEvaIU(T<7fIvk##KWeAO*8qgRv zzG#x)+ZS!%{$XwZk9m`l>aUp$yk-CI_WD=$|EIm)X8*qrSj+#PahauX7*@d>s!55C zX4KJ?04(zOt+-4GL^o#Z^pMsmTwKg^eJe+R1THV@v=24zI=tHH%@OOJGoY@z?;4>% z!yO&3Vbs+Jk2DiJl2!>czA}>COiyzP`|a!wlR-8<9Trr z(BSeC_QOlWp7%y)TE9kC(%QRnlGgqWMw*s)Wu$5OpEJ6+m{IqpZNkHtEL^5vrw?bt zKF0U9CoiJ~Z6LCr$8dSsSf_NdRNlKXW>NcFm4T_Uq<-CgY_uzD+IGZcs2)O# zH~v^cwDmoOLnR%ayL71we5f_y0>_xGD8|D?iK@gms*=vG4r*O{G+Ktzk2;~QsMGDi z>&}lQYsj`5Mbw)RN|j-((=AJOjm@qXh|NxSDXb8_I_7&jrwx2_2rDruP?WKb`Ym|e zmjB=DUb+9Z+k3j%|L+5~;DkDdMuw{!aSgzy0ws(pE;261peZ|}W3=-dA-2+58E3&3 zC z_2<9QUxx4h*B1vzZ(by2_HB6FUjJFI|8;wNoBN;l0$VT`42}r-=>PuME}YXgZMQWY zR|XTV+P*!WS9YMjePe-!YLUvJju*Y}D5<1ltS<=>r@&yT9K!6{0Qci$7VZk6beu&$ zP$Da+WQUiIplFFQ*2^phYzv(~-dN&7;gn-R+b=6-i_+%%l>IYvD!Db2KQOpOrtt%`b)} zgluiWE9s2ND&{9bNbrp@yB~F7g9I6Bp{Av$qVjOO0wsaM$3=-L>OF0@&*n`DS387> z$~rVqS?`BEv5zlNlnXQYeLJzm&df*Gj7=2p#Gt{yDsH($OGsmF(1r{Jx|J32Xu;yqnus;>0wHpHr(lc@4A1;>nwi6(Rh40An^0K< qU77LvlxupeR_I)(`@Q|p1~#yP4Q$|k;r{{v0RR8?Fq}33HUI!%P-8y; literal 0 HcmV?d00001 From 28880a848f87576d2493ffbf9421be57ea775d4f Mon Sep 17 00:00:00 2001 From: andrzejwp Date: Tue, 5 Jun 2018 15:19:46 +0200 Subject: [PATCH 250/449] Add link to cdwv/awesome-helm --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index 997e3f01d..bf55df549 100644 --- a/docs/related.md +++ b/docs/related.md @@ -16,6 +16,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [GitLab, Consumer Driven Contracts, Helm and Kubernetes](https://medium.com/@enxebre/gitlab-consumer-driven-contracts-helm-and-kubernetes-b7235a60a1cb#.xwp1y4tgi) - [Writing a Helm Chart](https://www.influxdata.com/packaged-kubernetes-deployments-writing-helm-chart/) - [Creating a Helm Plugin in 3 Steps](http://technosophos.com/2017/03/21/creating-a-helm-plugin.html) +- [Awesome Helm](https://github.com/cdwv/awesome-helm) - List of awesome Helm resources ## Video, Audio, and Podcast From bb5a24609c325f0fd9978eb5bc7e23245099d55f Mon Sep 17 00:00:00 2001 From: mattjmcnaughton Date: Tue, 5 Jun 2018 09:48:11 -0400 Subject: [PATCH 251/449] Increase error message specificity for name reuse If `helm upgrade` fails because a reused name is still in use, the error message does not specify which name is still in use. Update the error message. --- pkg/tiller/release_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index 1a2b3c4da..a75b7fc86 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -190,7 +190,7 @@ func (s *ReleaseServer) uniqName(start string, reuse bool) (string, error) { s.Log("name %s exists but is not in use, reusing name", start) return start, nil } else if reuse { - return "", errors.New("cannot re-use a name that is still in use") + return "", fmt.Errorf("a released named %s is in use, cannot re-use a name that is still in use", start) } return "", fmt.Errorf("a release named %s already exists.\nRun: helm ls --all %s; to check the status of the release\nOr run: helm del --purge %s; to delete it", start, start, start) From d1333ad24305f0b230f6f0958f69baf424da6eee Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 3 Apr 2018 17:13:14 -0400 Subject: [PATCH 252/449] added description field to api types UpdateReleaseRequest, InstallReleaseRequest, UninstallReleaseRequest, and RollbackReleaseRequest Signed-off-by: Arash Deshmeh --- _proto/hapi/services/tiller.proto | 9 ++ pkg/proto/hapi/services/tiller.pb.go | 196 ++++++++++++++++----------- 2 files changed, 126 insertions(+), 79 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 8daef0cb3..95391cb1a 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -209,6 +209,8 @@ message UpdateReleaseRequest { bool reuse_values = 10; // Force resource update through delete/recreate if needed. bool force = 11; + // Description, if set, will set the description for the updated release + string description = 12; } // UpdateReleaseResponse is the response to an update request. @@ -234,6 +236,8 @@ message RollbackReleaseRequest { bool wait = 7; // Force resource update through delete/recreate if needed. bool force = 8; + // Description, if set, will set the description for the rollback + string description = 9; } // RollbackReleaseResponse is the response to an update request. @@ -273,6 +277,9 @@ message InstallReleaseRequest { bool wait = 9; bool disable_crd_hook = 10; + + // Description, if set, will set the description for the installed release + string description = 11; } // InstallReleaseResponse is the response from a release installation. @@ -290,6 +297,8 @@ message UninstallReleaseRequest { bool purge = 3; // timeout specifies the max amount of time any kubernetes client command can run. int64 timeout = 4; + // Description, if set, will set the description for the uninnstalled release + string description = 5; } // UninstallReleaseResponse represents a successful response to an uninstall request. diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 4d23bcdad..c0b9ab7d3 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -376,6 +376,8 @@ type UpdateReleaseRequest struct { ReuseValues bool `protobuf:"varint,10,opt,name=reuse_values,json=reuseValues" json:"reuse_values,omitempty"` // Force resource update through delete/recreate if needed. Force bool `protobuf:"varint,11,opt,name=force" json:"force,omitempty"` + // Description, if set, will set the description for the updated release + Description string `protobuf:"bytes,12,opt,name=description" json:"description,omitempty"` } func (m *UpdateReleaseRequest) Reset() { *m = UpdateReleaseRequest{} } @@ -460,6 +462,13 @@ func (m *UpdateReleaseRequest) GetForce() bool { return false } +func (m *UpdateReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // UpdateReleaseResponse is the response to an update request. type UpdateReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -495,6 +504,8 @@ type RollbackReleaseRequest struct { Wait bool `protobuf:"varint,7,opt,name=wait" json:"wait,omitempty"` // Force resource update through delete/recreate if needed. Force bool `protobuf:"varint,8,opt,name=force" json:"force,omitempty"` + // Description, if set, will set the description for the rollback + Description string `protobuf:"bytes,9,opt,name=description" json:"description,omitempty"` } func (m *RollbackReleaseRequest) Reset() { *m = RollbackReleaseRequest{} } @@ -558,6 +569,13 @@ func (m *RollbackReleaseRequest) GetForce() bool { return false } +func (m *RollbackReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // RollbackReleaseResponse is the response to an update request. type RollbackReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -601,6 +619,8 @@ type InstallReleaseRequest struct { // before marking the release as successful. It will wait for as long as timeout Wait bool `protobuf:"varint,9,opt,name=wait" json:"wait,omitempty"` DisableCrdHook bool `protobuf:"varint,10,opt,name=disable_crd_hook,json=disableCrdHook" json:"disable_crd_hook,omitempty"` + // Description, if set, will set the description for the installed release + Description string `protobuf:"bytes,11,opt,name=description" json:"description,omitempty"` } func (m *InstallReleaseRequest) Reset() { *m = InstallReleaseRequest{} } @@ -678,6 +698,13 @@ func (m *InstallReleaseRequest) GetDisableCrdHook() bool { return false } +func (m *InstallReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // InstallReleaseResponse is the response from a release installation. type InstallReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -705,6 +732,8 @@ type UninstallReleaseRequest struct { Purge bool `protobuf:"varint,3,opt,name=purge" json:"purge,omitempty"` // timeout specifies the max amount of time any kubernetes client command can run. Timeout int64 `protobuf:"varint,4,opt,name=timeout" json:"timeout,omitempty"` + // Description, if set, will set the description for the uninnstalled release + Description string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"` } func (m *UninstallReleaseRequest) Reset() { *m = UninstallReleaseRequest{} } @@ -740,6 +769,13 @@ func (m *UninstallReleaseRequest) GetTimeout() int64 { return 0 } +func (m *UninstallReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // UninstallReleaseResponse represents a successful response to an uninstall request. type UninstallReleaseResponse struct { // Release is the release that was marked deleted. @@ -1376,83 +1412,85 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1235 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x6e, 0xe3, 0xc4, - 0x17, 0xaf, 0xf3, 0x9d, 0x93, 0x6e, 0xfe, 0xd9, 0x69, 0xda, 0xba, 0xfe, 0x2f, 0xa8, 0x18, 0xc1, - 0x66, 0x17, 0x36, 0x85, 0xc0, 0x0d, 0x12, 0x42, 0xea, 0x66, 0xa3, 0xb6, 0x50, 0xba, 0x92, 0xb3, - 0x5d, 0x24, 0x04, 0x44, 0x6e, 0x32, 0x69, 0xcd, 0x3a, 0x76, 0xf0, 0x8c, 0xcb, 0xf6, 0x96, 0x3b, - 0xde, 0x8a, 0x77, 0xe0, 0x92, 0x4b, 0x78, 0x10, 0x34, 0x5f, 0xae, 0x27, 0xb5, 0x5b, 0xd3, 0x9b, - 0x78, 0x66, 0xce, 0xf7, 0xef, 0x9c, 0x39, 0x73, 0x02, 0xd6, 0x85, 0xbb, 0xf4, 0xf6, 0x08, 0x8e, - 0x2e, 0xbd, 0x29, 0x26, 0x7b, 0xd4, 0xf3, 0x7d, 0x1c, 0xf5, 0x97, 0x51, 0x48, 0x43, 0xd4, 0x65, - 0xb4, 0xbe, 0xa2, 0xf5, 0x05, 0xcd, 0xda, 0xe2, 0x12, 0xd3, 0x0b, 0x37, 0xa2, 0xe2, 0x57, 0x70, - 0x5b, 0xdb, 0xe9, 0xf3, 0x30, 0x98, 0x7b, 0xe7, 0x92, 0x20, 0x4c, 0x44, 0xd8, 0xc7, 0x2e, 0xc1, - 0xea, 0xab, 0x09, 0x29, 0x9a, 0x17, 0xcc, 0x43, 0x49, 0xf8, 0xbf, 0x46, 0xa0, 0x98, 0xd0, 0x49, - 0x14, 0x07, 0x92, 0xb8, 0xa3, 0x11, 0x09, 0x75, 0x69, 0x4c, 0x34, 0x63, 0x97, 0x38, 0x22, 0x5e, - 0x18, 0xa8, 0xaf, 0xa0, 0xd9, 0x7f, 0x94, 0x60, 0xe3, 0xd8, 0x23, 0xd4, 0x11, 0x82, 0xc4, 0xc1, - 0xbf, 0xc4, 0x98, 0x50, 0xd4, 0x85, 0xaa, 0xef, 0x2d, 0x3c, 0x6a, 0x1a, 0xbb, 0x46, 0xaf, 0xec, - 0x88, 0x0d, 0xda, 0x82, 0x5a, 0x38, 0x9f, 0x13, 0x4c, 0xcd, 0xd2, 0xae, 0xd1, 0x6b, 0x3a, 0x72, - 0x87, 0xbe, 0x82, 0x3a, 0x09, 0x23, 0x3a, 0x39, 0xbb, 0x32, 0xcb, 0xbb, 0x46, 0xaf, 0x3d, 0xf8, - 0xa0, 0x9f, 0x85, 0x53, 0x9f, 0x59, 0x1a, 0x87, 0x11, 0xed, 0xb3, 0x9f, 0xe7, 0x57, 0x4e, 0x8d, - 0xf0, 0x2f, 0xd3, 0x3b, 0xf7, 0x7c, 0x8a, 0x23, 0xb3, 0x22, 0xf4, 0x8a, 0x1d, 0x3a, 0x00, 0xe0, - 0x7a, 0xc3, 0x68, 0x86, 0x23, 0xb3, 0xca, 0x55, 0xf7, 0x0a, 0xa8, 0x7e, 0xc9, 0xf8, 0x9d, 0x26, - 0x51, 0x4b, 0xf4, 0x25, 0xac, 0x0b, 0x48, 0x26, 0xd3, 0x70, 0x86, 0x89, 0x59, 0xdb, 0x2d, 0xf7, - 0xda, 0x83, 0x1d, 0xa1, 0x4a, 0xc1, 0x3f, 0x16, 0xa0, 0x0d, 0xc3, 0x19, 0x76, 0x5a, 0x82, 0x9d, - 0xad, 0x09, 0x7a, 0x04, 0xcd, 0xc0, 0x5d, 0x60, 0xb2, 0x74, 0xa7, 0xd8, 0xac, 0x73, 0x0f, 0xaf, - 0x0f, 0xec, 0x9f, 0xa0, 0xa1, 0x8c, 0xdb, 0x03, 0xa8, 0x89, 0xd0, 0x50, 0x0b, 0xea, 0xa7, 0x27, - 0xdf, 0x9c, 0xbc, 0xfc, 0xee, 0xa4, 0xb3, 0x86, 0x1a, 0x50, 0x39, 0xd9, 0xff, 0x76, 0xd4, 0x31, - 0xd0, 0x43, 0x78, 0x70, 0xbc, 0x3f, 0x7e, 0x35, 0x71, 0x46, 0xc7, 0xa3, 0xfd, 0xf1, 0xe8, 0x45, - 0xa7, 0x64, 0xbf, 0x0b, 0xcd, 0xc4, 0x67, 0x54, 0x87, 0xf2, 0xfe, 0x78, 0x28, 0x44, 0x5e, 0x8c, - 0xc6, 0xc3, 0x8e, 0x61, 0xff, 0x6e, 0x40, 0x57, 0x4f, 0x11, 0x59, 0x86, 0x01, 0xc1, 0x2c, 0x47, - 0xd3, 0x30, 0x0e, 0x92, 0x1c, 0xf1, 0x0d, 0x42, 0x50, 0x09, 0xf0, 0x5b, 0x95, 0x21, 0xbe, 0x66, - 0x9c, 0x34, 0xa4, 0xae, 0xcf, 0xb3, 0x53, 0x76, 0xc4, 0x06, 0x7d, 0x0a, 0x0d, 0x19, 0x3a, 0x31, - 0x2b, 0xbb, 0xe5, 0x5e, 0x6b, 0xb0, 0xa9, 0x03, 0x22, 0x2d, 0x3a, 0x09, 0x9b, 0x7d, 0x00, 0xdb, - 0x07, 0x58, 0x79, 0x22, 0xf0, 0x52, 0x15, 0xc3, 0xec, 0xba, 0x0b, 0xcc, 0x9d, 0x61, 0x76, 0xdd, - 0x05, 0x46, 0x26, 0xd4, 0x65, 0xb9, 0x71, 0x77, 0xaa, 0x8e, 0xda, 0xda, 0x14, 0xcc, 0x9b, 0x8a, - 0x64, 0x5c, 0x59, 0x9a, 0x3e, 0x84, 0x0a, 0xbb, 0x09, 0x5c, 0x4d, 0x6b, 0x80, 0x74, 0x3f, 0x8f, - 0x82, 0x79, 0xe8, 0x70, 0xba, 0x9e, 0xaa, 0xf2, 0x6a, 0xaa, 0x0e, 0xd3, 0x56, 0x87, 0x61, 0x40, - 0x71, 0x40, 0xef, 0xe7, 0xff, 0x31, 0xec, 0x64, 0x68, 0x92, 0x01, 0xec, 0x41, 0x5d, 0xba, 0xc6, - 0xb5, 0xe5, 0xe2, 0xaa, 0xb8, 0xec, 0xbf, 0x4b, 0xd0, 0x3d, 0x5d, 0xce, 0x5c, 0x8a, 0x15, 0xe9, - 0x16, 0xa7, 0x1e, 0x43, 0x95, 0x77, 0x14, 0x89, 0xc5, 0x43, 0xa1, 0x5b, 0xb4, 0x9d, 0x21, 0xfb, - 0x75, 0x04, 0x1d, 0x3d, 0x85, 0xda, 0xa5, 0xeb, 0xc7, 0x98, 0x70, 0x20, 0x12, 0xd4, 0x24, 0x27, - 0x6f, 0x47, 0x8e, 0xe4, 0x40, 0xdb, 0x50, 0x9f, 0x45, 0x57, 0xac, 0x9f, 0xf0, 0x2b, 0xd8, 0x70, - 0x6a, 0xb3, 0xe8, 0xca, 0x89, 0x03, 0xf4, 0x3e, 0x3c, 0x98, 0x79, 0xc4, 0x3d, 0xf3, 0xf1, 0xe4, - 0x22, 0x0c, 0xdf, 0x10, 0x7e, 0x0b, 0x1b, 0xce, 0xba, 0x3c, 0x3c, 0x64, 0x67, 0xc8, 0x62, 0x95, - 0x34, 0x8d, 0xb0, 0x4b, 0xb1, 0x59, 0xe3, 0xf4, 0x64, 0xcf, 0x30, 0xa4, 0xde, 0x02, 0x87, 0x31, - 0xe5, 0x57, 0xa7, 0xec, 0xa8, 0x2d, 0x7a, 0x0f, 0xd6, 0x23, 0x4c, 0x30, 0x9d, 0x48, 0x2f, 0x1b, - 0x5c, 0xb2, 0xc5, 0xcf, 0x5e, 0x0b, 0xb7, 0x10, 0x54, 0x7e, 0x75, 0x3d, 0x6a, 0x36, 0x39, 0x89, - 0xaf, 0x85, 0x58, 0x4c, 0xb0, 0x12, 0x03, 0x25, 0x16, 0x13, 0x2c, 0xc5, 0xba, 0x50, 0x9d, 0x87, - 0xd1, 0x14, 0x9b, 0x2d, 0x4e, 0x13, 0x1b, 0xfb, 0x10, 0x36, 0x57, 0x40, 0xbe, 0x6f, 0xbe, 0xfe, - 0x31, 0x60, 0xcb, 0x09, 0x7d, 0xff, 0xcc, 0x9d, 0xbe, 0x29, 0x90, 0xb1, 0x14, 0xb8, 0xa5, 0xdb, - 0xc1, 0x2d, 0x67, 0x80, 0x9b, 0x2a, 0xc2, 0x8a, 0x56, 0x84, 0x1a, 0xec, 0xd5, 0x7c, 0xd8, 0x6b, - 0x3a, 0xec, 0x0a, 0xd3, 0x7a, 0x0a, 0xd3, 0x04, 0xb0, 0x46, 0x1a, 0xb0, 0xaf, 0x61, 0xfb, 0x46, - 0x94, 0xf7, 0x85, 0xec, 0xcf, 0x12, 0x6c, 0x1e, 0x05, 0x84, 0xba, 0xbe, 0xbf, 0x82, 0x58, 0x52, - 0xcf, 0x46, 0xe1, 0x7a, 0x2e, 0xfd, 0x97, 0x7a, 0x2e, 0x6b, 0x90, 0xab, 0xfc, 0x54, 0x52, 0xf9, - 0x29, 0x54, 0xe3, 0x5a, 0x67, 0xa9, 0xad, 0x74, 0x16, 0xf4, 0x0e, 0x80, 0x28, 0x4a, 0xae, 0x5c, - 0x40, 0xdb, 0xe4, 0x27, 0x27, 0xb2, 0x91, 0xa8, 0x6c, 0x34, 0xb2, 0xb3, 0x91, 0xae, 0xf0, 0x1e, - 0x74, 0x94, 0x3f, 0xd3, 0x68, 0xc6, 0x7d, 0x92, 0x55, 0xde, 0x96, 0xe7, 0xc3, 0x68, 0xc6, 0xbc, - 0xb2, 0x8f, 0x60, 0x6b, 0x15, 0xd4, 0xfb, 0x26, 0xe8, 0x37, 0x03, 0xb6, 0x4f, 0x03, 0x2f, 0x33, - 0x45, 0x59, 0x45, 0x7d, 0x03, 0xb4, 0x52, 0x06, 0x68, 0x5d, 0xa8, 0x2e, 0xe3, 0xe8, 0x1c, 0xcb, - 0x24, 0x88, 0x4d, 0x1a, 0x8d, 0x8a, 0x86, 0x86, 0x3d, 0x01, 0xf3, 0xa6, 0x0f, 0xf7, 0x8c, 0x88, - 0x79, 0x9d, 0xbc, 0x19, 0x4d, 0xf1, 0x3e, 0xd8, 0x1b, 0xf0, 0xf0, 0x00, 0xd3, 0xd7, 0xe2, 0x02, - 0xc9, 0xf0, 0xec, 0x11, 0xa0, 0xf4, 0xe1, 0xb5, 0x3d, 0x79, 0xa4, 0xdb, 0x53, 0x03, 0x94, 0xe2, - 0x57, 0x5c, 0xf6, 0x17, 0x5c, 0xf7, 0xa1, 0x47, 0x68, 0x18, 0x5d, 0xdd, 0x06, 0x5d, 0x07, 0xca, - 0x0b, 0xf7, 0xad, 0x7c, 0x52, 0xd8, 0xd2, 0x3e, 0xe0, 0x1e, 0x24, 0xa2, 0xd2, 0x83, 0xf4, 0x03, - 0x6d, 0x14, 0x7b, 0xa0, 0x7f, 0x00, 0xf4, 0x0a, 0x27, 0xb3, 0xc2, 0x1d, 0x6f, 0x9b, 0x4a, 0x42, - 0x49, 0x2f, 0x49, 0x13, 0xea, 0x53, 0x1f, 0xbb, 0x41, 0xbc, 0x94, 0x69, 0x53, 0x5b, 0xfb, 0x47, - 0xd8, 0xd0, 0xb4, 0x4b, 0x3f, 0x59, 0x3c, 0xe4, 0x5c, 0x6a, 0x67, 0x4b, 0xf4, 0x39, 0xd4, 0xc4, - 0x00, 0xc5, 0x75, 0xb7, 0x07, 0x8f, 0x74, 0xbf, 0xb9, 0x92, 0x38, 0x90, 0x13, 0x97, 0x23, 0x79, - 0x07, 0x7f, 0x35, 0xa0, 0xad, 0x46, 0x02, 0x31, 0xde, 0x21, 0x0f, 0xd6, 0xd3, 0xb3, 0x0f, 0x7a, - 0x92, 0x3f, 0xfd, 0xad, 0x8c, 0xb0, 0xd6, 0xd3, 0x22, 0xac, 0x22, 0x02, 0x7b, 0xed, 0x13, 0x03, - 0x11, 0xe8, 0xac, 0x8e, 0x24, 0xe8, 0x59, 0xb6, 0x8e, 0x9c, 0x19, 0xc8, 0xea, 0x17, 0x65, 0x57, - 0x66, 0xd1, 0x25, 0xaf, 0x19, 0x7d, 0x8e, 0x40, 0x77, 0xaa, 0xd1, 0x47, 0x17, 0x6b, 0xaf, 0x30, - 0x7f, 0x62, 0xf7, 0x67, 0x78, 0xa0, 0xbd, 0x85, 0x28, 0x07, 0xad, 0xac, 0xa9, 0xc4, 0xfa, 0xa8, - 0x10, 0x6f, 0x62, 0x6b, 0x01, 0x6d, 0xbd, 0x49, 0xa1, 0x1c, 0x05, 0x99, 0xef, 0x83, 0xf5, 0x71, - 0x31, 0xe6, 0xc4, 0x1c, 0x81, 0xce, 0x6a, 0x0f, 0xc9, 0xcb, 0x63, 0x4e, 0xbf, 0xcb, 0xcb, 0x63, - 0x5e, 0x6b, 0xb2, 0xd7, 0x90, 0x0b, 0x70, 0xdd, 0x42, 0xd0, 0xe3, 0xdc, 0x84, 0xe8, 0x9d, 0xc7, - 0xea, 0xdd, 0xcd, 0x98, 0x98, 0x58, 0xc2, 0xff, 0x56, 0x5e, 0x63, 0x94, 0x03, 0x4d, 0xf6, 0x68, - 0x62, 0x3d, 0x2b, 0xc8, 0xbd, 0x12, 0x94, 0xec, 0x4a, 0xb7, 0x04, 0xa5, 0xb7, 0xbc, 0x5b, 0x82, - 0x5a, 0x69, 0x70, 0xf6, 0x1a, 0xf2, 0xa0, 0xed, 0xc4, 0x81, 0x34, 0xcd, 0xda, 0x02, 0xca, 0x91, - 0xbe, 0xd9, 0xd5, 0xac, 0x27, 0x05, 0x38, 0xaf, 0xef, 0xf7, 0x73, 0xf8, 0xbe, 0xa1, 0x58, 0xcf, - 0x6a, 0xfc, 0xdf, 0xef, 0x67, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x5d, 0xc3, 0xd5, 0x55, 0xeb, - 0x0f, 0x00, 0x00, + // 1267 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xed, 0x6e, 0xe3, 0x44, + 0x17, 0x6e, 0xe2, 0x7c, 0x9e, 0x74, 0xf3, 0x66, 0x67, 0xb3, 0xad, 0xeb, 0x77, 0x41, 0xc1, 0x08, + 0x36, 0xbb, 0xb0, 0x29, 0x04, 0xfe, 0x20, 0x21, 0xa4, 0x6e, 0x36, 0x6a, 0x0b, 0xa5, 0x2b, 0x39, + 0xdb, 0x45, 0x42, 0x40, 0xe4, 0x26, 0x93, 0xd6, 0xac, 0x63, 0x07, 0xcf, 0xb8, 0x6c, 0x2f, 0x00, + 0x24, 0xee, 0x83, 0x0b, 0xe1, 0x3e, 0xb8, 0x0e, 0xfe, 0x23, 0xcf, 0x87, 0xeb, 0x71, 0xec, 0xd4, + 0xf4, 0x4f, 0xe3, 0x99, 0x73, 0xe6, 0x7c, 0x3c, 0xcf, 0x9c, 0x33, 0xa7, 0x60, 0x5c, 0xda, 0x2b, + 0x67, 0x9f, 0xe0, 0xe0, 0xca, 0x99, 0x61, 0xb2, 0x4f, 0x1d, 0xd7, 0xc5, 0xc1, 0x60, 0x15, 0xf8, + 0xd4, 0x47, 0xdd, 0x48, 0x36, 0x90, 0xb2, 0x01, 0x97, 0x19, 0x3b, 0xec, 0xc4, 0xec, 0xd2, 0x0e, + 0x28, 0xff, 0xcb, 0xb5, 0x8d, 0xdd, 0xe4, 0xbe, 0xef, 0x2d, 0x9c, 0x0b, 0x21, 0xe0, 0x2e, 0x02, + 0xec, 0x62, 0x9b, 0x60, 0xf9, 0xab, 0x1c, 0x92, 0x32, 0xc7, 0x5b, 0xf8, 0x42, 0xf0, 0x7f, 0x45, + 0x40, 0x31, 0xa1, 0xd3, 0x20, 0xf4, 0x84, 0x70, 0x4f, 0x11, 0x12, 0x6a, 0xd3, 0x90, 0x28, 0xce, + 0xae, 0x70, 0x40, 0x1c, 0xdf, 0x93, 0xbf, 0x5c, 0x66, 0xfe, 0x55, 0x86, 0x07, 0x27, 0x0e, 0xa1, + 0x16, 0x3f, 0x48, 0x2c, 0xfc, 0x4b, 0x88, 0x09, 0x45, 0x5d, 0xa8, 0xba, 0xce, 0xd2, 0xa1, 0x7a, + 0xa9, 0x57, 0xea, 0x6b, 0x16, 0x5f, 0xa0, 0x1d, 0xa8, 0xf9, 0x8b, 0x05, 0xc1, 0x54, 0x2f, 0xf7, + 0x4a, 0xfd, 0xa6, 0x25, 0x56, 0xe8, 0x2b, 0xa8, 0x13, 0x3f, 0xa0, 0xd3, 0xf3, 0x6b, 0x5d, 0xeb, + 0x95, 0xfa, 0xed, 0xe1, 0x07, 0x83, 0x2c, 0x9c, 0x06, 0x91, 0xa7, 0x89, 0x1f, 0xd0, 0x41, 0xf4, + 0xe7, 0xf9, 0xb5, 0x55, 0x23, 0xec, 0x37, 0xb2, 0xbb, 0x70, 0x5c, 0x8a, 0x03, 0xbd, 0xc2, 0xed, + 0xf2, 0x15, 0x3a, 0x04, 0x60, 0x76, 0xfd, 0x60, 0x8e, 0x03, 0xbd, 0xca, 0x4c, 0xf7, 0x0b, 0x98, + 0x7e, 0x19, 0xe9, 0x5b, 0x4d, 0x22, 0x3f, 0xd1, 0x97, 0xb0, 0xcd, 0x21, 0x99, 0xce, 0xfc, 0x39, + 0x26, 0x7a, 0xad, 0xa7, 0xf5, 0xdb, 0xc3, 0x3d, 0x6e, 0x4a, 0xc2, 0x3f, 0xe1, 0xa0, 0x8d, 0xfc, + 0x39, 0xb6, 0x5a, 0x5c, 0x3d, 0xfa, 0x26, 0xe8, 0x11, 0x34, 0x3d, 0x7b, 0x89, 0xc9, 0xca, 0x9e, + 0x61, 0xbd, 0xce, 0x22, 0xbc, 0xd9, 0x30, 0x7f, 0x82, 0x86, 0x74, 0x6e, 0x0e, 0xa1, 0xc6, 0x53, + 0x43, 0x2d, 0xa8, 0x9f, 0x9d, 0x7e, 0x73, 0xfa, 0xf2, 0xbb, 0xd3, 0xce, 0x16, 0x6a, 0x40, 0xe5, + 0xf4, 0xe0, 0xdb, 0x71, 0xa7, 0x84, 0xee, 0xc3, 0xbd, 0x93, 0x83, 0xc9, 0xab, 0xa9, 0x35, 0x3e, + 0x19, 0x1f, 0x4c, 0xc6, 0x2f, 0x3a, 0x65, 0xf3, 0x5d, 0x68, 0xc6, 0x31, 0xa3, 0x3a, 0x68, 0x07, + 0x93, 0x11, 0x3f, 0xf2, 0x62, 0x3c, 0x19, 0x75, 0x4a, 0xe6, 0x1f, 0x25, 0xe8, 0xaa, 0x14, 0x91, + 0x95, 0xef, 0x11, 0x1c, 0x71, 0x34, 0xf3, 0x43, 0x2f, 0xe6, 0x88, 0x2d, 0x10, 0x82, 0x8a, 0x87, + 0xdf, 0x4a, 0x86, 0xd8, 0x77, 0xa4, 0x49, 0x7d, 0x6a, 0xbb, 0x8c, 0x1d, 0xcd, 0xe2, 0x0b, 0xf4, + 0x29, 0x34, 0x44, 0xea, 0x44, 0xaf, 0xf4, 0xb4, 0x7e, 0x6b, 0xf8, 0x50, 0x05, 0x44, 0x78, 0xb4, + 0x62, 0x35, 0xf3, 0x10, 0x76, 0x0f, 0xb1, 0x8c, 0x84, 0xe3, 0x25, 0x6f, 0x4c, 0xe4, 0xd7, 0x5e, + 0x62, 0x16, 0x4c, 0xe4, 0xd7, 0x5e, 0x62, 0xa4, 0x43, 0x5d, 0x5c, 0x37, 0x16, 0x4e, 0xd5, 0x92, + 0x4b, 0x93, 0x82, 0xbe, 0x6e, 0x48, 0xe4, 0x95, 0x65, 0xe9, 0x43, 0xa8, 0x44, 0x95, 0xc0, 0xcc, + 0xb4, 0x86, 0x48, 0x8d, 0xf3, 0xd8, 0x5b, 0xf8, 0x16, 0x93, 0xab, 0x54, 0x69, 0x69, 0xaa, 0x8e, + 0x92, 0x5e, 0x47, 0xbe, 0x47, 0xb1, 0x47, 0xef, 0x16, 0xff, 0x09, 0xec, 0x65, 0x58, 0x12, 0x09, + 0xec, 0x43, 0x5d, 0x84, 0xc6, 0xac, 0xe5, 0xe2, 0x2a, 0xb5, 0xcc, 0xdf, 0x34, 0xe8, 0x9e, 0xad, + 0xe6, 0x36, 0xc5, 0x52, 0xb4, 0x21, 0xa8, 0xc7, 0x50, 0x65, 0x1d, 0x45, 0x60, 0x71, 0x9f, 0xdb, + 0xe6, 0x6d, 0x67, 0x14, 0xfd, 0xb5, 0xb8, 0x1c, 0x3d, 0x85, 0xda, 0x95, 0xed, 0x86, 0x98, 0x30, + 0x20, 0x62, 0xd4, 0x84, 0x26, 0x6b, 0x47, 0x96, 0xd0, 0x40, 0xbb, 0x50, 0x9f, 0x07, 0xd7, 0x51, + 0x3f, 0x61, 0x25, 0xd8, 0xb0, 0x6a, 0xf3, 0xe0, 0xda, 0x0a, 0x3d, 0xf4, 0x3e, 0xdc, 0x9b, 0x3b, + 0xc4, 0x3e, 0x77, 0xf1, 0xf4, 0xd2, 0xf7, 0xdf, 0x10, 0x56, 0x85, 0x0d, 0x6b, 0x5b, 0x6c, 0x1e, + 0x45, 0x7b, 0xc8, 0x88, 0x6e, 0xd2, 0x2c, 0xc0, 0x36, 0xc5, 0x7a, 0x8d, 0xc9, 0xe3, 0x75, 0x84, + 0x21, 0x75, 0x96, 0xd8, 0x0f, 0x29, 0x2b, 0x1d, 0xcd, 0x92, 0x4b, 0xf4, 0x1e, 0x6c, 0x07, 0x98, + 0x60, 0x3a, 0x15, 0x51, 0x36, 0xd8, 0xc9, 0x16, 0xdb, 0x7b, 0xcd, 0xc3, 0x42, 0x50, 0xf9, 0xd5, + 0x76, 0xa8, 0xde, 0x64, 0x22, 0xf6, 0xcd, 0x8f, 0x85, 0x04, 0xcb, 0x63, 0x20, 0x8f, 0x85, 0x04, + 0x8b, 0x63, 0x5d, 0xa8, 0x2e, 0xfc, 0x60, 0x86, 0xf5, 0x16, 0x93, 0xf1, 0x05, 0xea, 0x41, 0x6b, + 0x8e, 0xc9, 0x2c, 0x70, 0x56, 0x34, 0x62, 0x74, 0x9b, 0x61, 0x9a, 0xdc, 0x32, 0x8f, 0xe0, 0x61, + 0x8a, 0x86, 0xbb, 0x32, 0xfa, 0x7b, 0x19, 0x76, 0x2c, 0xdf, 0x75, 0xcf, 0xed, 0xd9, 0x9b, 0x02, + 0x9c, 0x26, 0xe0, 0x2f, 0x6f, 0x86, 0x5f, 0xcb, 0x80, 0x3f, 0x71, 0x4d, 0x2b, 0xca, 0x35, 0x55, + 0x88, 0xa9, 0xe6, 0x13, 0x53, 0x53, 0x89, 0x91, 0xa8, 0xd7, 0x13, 0xa8, 0xc7, 0x90, 0x36, 0x36, + 0x40, 0xda, 0x5c, 0x87, 0xf4, 0x6b, 0xd8, 0x5d, 0xc3, 0xe1, 0xae, 0xa0, 0xfe, 0x53, 0x86, 0x87, + 0xc7, 0x1e, 0xa1, 0xb6, 0xeb, 0xa6, 0x30, 0x8d, 0x6b, 0xa2, 0x54, 0xb8, 0x26, 0xca, 0xff, 0xa5, + 0x26, 0x34, 0x85, 0x14, 0xc9, 0x60, 0x25, 0xc1, 0x60, 0xa1, 0x3a, 0x51, 0xba, 0x53, 0x2d, 0xd5, + 0x9d, 0xd0, 0x3b, 0x00, 0xfc, 0x62, 0x33, 0xe3, 0x1c, 0xfc, 0x26, 0xdb, 0x39, 0x15, 0xcd, 0x48, + 0xf2, 0xd5, 0xc8, 0xe6, 0x2b, 0x59, 0x25, 0x7d, 0xe8, 0xc8, 0x78, 0x66, 0xc1, 0x9c, 0xc5, 0x24, + 0x2a, 0xa5, 0x2d, 0xf6, 0x47, 0xc1, 0x3c, 0x8a, 0x2a, 0xcd, 0x61, 0x6b, 0x9d, 0xc3, 0x63, 0xd8, + 0x49, 0xc3, 0x7e, 0x57, 0x0a, 0xff, 0x2c, 0xc1, 0xee, 0x99, 0xe7, 0x64, 0x92, 0x98, 0x55, 0x18, + 0x6b, 0xb0, 0x96, 0x33, 0x60, 0xed, 0x42, 0x75, 0x15, 0x06, 0x17, 0x58, 0xd0, 0xc4, 0x17, 0x49, + 0xbc, 0x2a, 0x2a, 0x5e, 0xa9, 0x8c, 0xab, 0xeb, 0x19, 0x4f, 0x41, 0x5f, 0x8f, 0xf2, 0x8e, 0x39, + 0x47, 0x79, 0xc5, 0x6f, 0x57, 0x93, 0xbf, 0x53, 0xe6, 0x03, 0xb8, 0x7f, 0x88, 0xe9, 0x6b, 0x5e, + 0xa6, 0x02, 0x00, 0x73, 0x0c, 0x28, 0xb9, 0x79, 0xe3, 0x4f, 0x6c, 0xa9, 0xfe, 0xe4, 0x20, 0x27, + 0xf5, 0xa5, 0x96, 0xf9, 0x05, 0xb3, 0x7d, 0xe4, 0x10, 0xea, 0x07, 0xd7, 0x9b, 0xc0, 0xed, 0x80, + 0xb6, 0xb4, 0xdf, 0x8a, 0xa7, 0x2d, 0xfa, 0x34, 0x0f, 0x59, 0x04, 0xf1, 0x51, 0x11, 0x41, 0x72, + 0x50, 0x28, 0x15, 0x1b, 0x14, 0x7e, 0x00, 0xf4, 0x0a, 0xc7, 0x33, 0xcb, 0x2d, 0x6f, 0xac, 0xa4, + 0xa9, 0xac, 0xd2, 0xa4, 0x43, 0x7d, 0xe6, 0x62, 0xdb, 0x0b, 0x57, 0x82, 0x58, 0xb9, 0x34, 0x7f, + 0x84, 0x07, 0x8a, 0x75, 0x11, 0x67, 0x94, 0x0f, 0xb9, 0x10, 0xd6, 0xa3, 0x4f, 0xf4, 0x39, 0xd4, + 0xf8, 0x20, 0xc7, 0x6c, 0xb7, 0x87, 0x8f, 0xd4, 0xb8, 0x99, 0x91, 0xd0, 0x13, 0x93, 0x9f, 0x25, + 0x74, 0x87, 0x7f, 0x37, 0xa0, 0x2d, 0x47, 0x13, 0x3e, 0x66, 0x22, 0x07, 0xb6, 0x93, 0x33, 0x18, + 0x7a, 0x92, 0x3f, 0x85, 0xa6, 0x46, 0x69, 0xe3, 0x69, 0x11, 0x55, 0x9e, 0x81, 0xb9, 0xf5, 0x49, + 0x09, 0x11, 0xe8, 0xa4, 0x47, 0x23, 0xf4, 0x2c, 0xdb, 0x46, 0xce, 0x2c, 0x66, 0x0c, 0x8a, 0xaa, + 0x4b, 0xb7, 0xe8, 0x8a, 0xdd, 0x19, 0x75, 0x9e, 0x41, 0xb7, 0x9a, 0x51, 0x47, 0x28, 0x63, 0xbf, + 0xb0, 0x7e, 0xec, 0xf7, 0x67, 0xb8, 0xa7, 0xbc, 0xb8, 0x28, 0x07, 0xad, 0xac, 0xe9, 0xc8, 0xf8, + 0xa8, 0x90, 0x6e, 0xec, 0x6b, 0x09, 0x6d, 0xb5, 0x8d, 0xa1, 0x1c, 0x03, 0x99, 0x6f, 0x8c, 0xf1, + 0x71, 0x31, 0xe5, 0xd8, 0x1d, 0x81, 0x4e, 0xba, 0x87, 0xe4, 0xf1, 0x98, 0xd3, 0x11, 0xf3, 0x78, + 0xcc, 0x6b, 0x4d, 0xe6, 0x16, 0xb2, 0x01, 0x6e, 0x5a, 0x08, 0x7a, 0x9c, 0x4b, 0x88, 0xda, 0x79, + 0x8c, 0xfe, 0xed, 0x8a, 0xb1, 0x8b, 0x15, 0xfc, 0x2f, 0xf5, 0xa2, 0xa3, 0x1c, 0x68, 0xb2, 0x07, + 0x20, 0xe3, 0x59, 0x41, 0xed, 0x54, 0x52, 0xa2, 0x2b, 0x6d, 0x48, 0x4a, 0x6d, 0x79, 0x1b, 0x92, + 0x4a, 0x35, 0x38, 0x73, 0x0b, 0x39, 0xd0, 0xb6, 0x42, 0x4f, 0xb8, 0x8e, 0xda, 0x02, 0xca, 0x39, + 0xbd, 0xde, 0xd5, 0x8c, 0x27, 0x05, 0x34, 0x6f, 0xea, 0xfb, 0x39, 0x7c, 0xdf, 0x90, 0xaa, 0xe7, + 0x35, 0xf6, 0x5f, 0xf8, 0x67, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x73, 0x4f, 0x4d, 0x73, + 0x10, 0x00, 0x00, } From b178ec22699074bfad5cc3e7320d882c6ef8732b Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 3 Apr 2018 17:29:21 -0400 Subject: [PATCH 253/449] added ability to handle custom release descriptions to tiller Signed-off-by: Arash Deshmeh --- pkg/tiller/release_install.go | 6 +++- pkg/tiller/release_install_test.go | 20 ++++++++++++ pkg/tiller/release_rollback.go | 7 +++- pkg/tiller/release_rollback_test.go | 32 ++++++++++++++++++ pkg/tiller/release_uninstall.go | 6 +++- pkg/tiller/release_uninstall_test.go | 21 ++++++++++++ pkg/tiller/release_update.go | 12 +++++-- pkg/tiller/release_update_test.go | 49 ++++++++++++++++++++++++++++ 8 files changed, 148 insertions(+), 5 deletions(-) diff --git a/pkg/tiller/release_install.go b/pkg/tiller/release_install.go index 0b8f4da5b..01ef88c98 100644 --- a/pkg/tiller/release_install.go +++ b/pkg/tiller/release_install.go @@ -250,7 +250,11 @@ func (s *ReleaseServer) performRelease(r *release.Release, req *services.Install } r.Info.Status.Code = release.Status_DEPLOYED - r.Info.Description = "Install complete" + if req.Description == "" { + r.Info.Description = "Install complete" + } else { + r.Info.Description = req.Description + } // This is a tricky case. The release has been created, but the result // cannot be recorded. The truest thing to tell the user is that the // release was created. However, the user will not be able to do anything diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index a244e4b72..bbea3b9dd 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -495,3 +495,23 @@ func TestInstallRelease_WrongKubeVersion(t *testing.T) { t.Errorf("Expected %q to contain %q", err.Error(), expect) } } + +func TestInstallRelease_Description(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.env.Releases.Create(releaseStub()) + + customDescription := "foo" + req := &services.InstallReleaseRequest{ + Chart: chartStub(), + Description: customDescription, + } + res, err := rs.InstallRelease(c, req) + if err != nil { + t.Errorf("Failed install: %s", err) + } + + if desc := res.Release.Info.Description; desc != customDescription { + t.Errorf("Expected description %q. Got %q", customDescription, desc) + } +} diff --git a/pkg/tiller/release_rollback.go b/pkg/tiller/release_rollback.go index fa3d943f4..ab6462db9 100644 --- a/pkg/tiller/release_rollback.go +++ b/pkg/tiller/release_rollback.go @@ -86,6 +86,11 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (* return nil, nil, err } + description := req.Description + if req.Description == "" { + description = fmt.Sprintf("Rollback to %d", previousVersion) + } + // Store a new release object with previous release's configuration targetRelease := &release.Release{ Name: req.Name, @@ -101,7 +106,7 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (* }, // Because we lose the reference to previous version elsewhere, we set the // message here, and only override it later if we experience failure. - Description: fmt.Sprintf("Rollback to %d", previousVersion), + Description: description, }, Version: currentRelease.Version + 1, Manifest: previousRelease.Manifest, diff --git a/pkg/tiller/release_rollback_test.go b/pkg/tiller/release_rollback_test.go index b73501a36..710f0ebbe 100644 --- a/pkg/tiller/release_rollback_test.go +++ b/pkg/tiller/release_rollback_test.go @@ -252,3 +252,35 @@ func TestRollbackReleaseFailure(t *testing.T) { t.Errorf("Expected SUPERSEDED status on previous Release version. Got %v", oldStatus) } } + +func TestRollbackReleaseWithCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + upgradedRel := upgradeReleaseVersion(rel) + rs.env.Releases.Update(rel) + rs.env.Releases.Create(upgradedRel) + + customDescription := "foo" + req := &services.RollbackReleaseRequest{ + Name: rel.Name, + Description: customDescription, + } + res, err := rs.RollbackRelease(c, req) + if err != nil { + t.Fatalf("Failed rollback: %s", err) + } + + if res.Release.Name == "" { + t.Errorf("Expected release name.") + } + + if res.Release.Name != rel.Name { + t.Errorf("Updated release name does not match previous release name. Expected %s, got %s", rel.Name, res.Release.Name) + } + + if res.Release.Info.Description != customDescription { + t.Errorf("Expected Description to be %q, got %q", customDescription, res.Release.Info.Description) + } +} diff --git a/pkg/tiller/release_uninstall.go b/pkg/tiller/release_uninstall.go index 423b6e7ef..294645ae7 100644 --- a/pkg/tiller/release_uninstall.go +++ b/pkg/tiller/release_uninstall.go @@ -97,7 +97,11 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR } rel.Info.Status.Code = release.Status_DELETED - rel.Info.Description = "Deletion complete" + if req.Description == "" { + rel.Info.Description = "Deletion complete" + } else { + rel.Info.Description = req.Description + } if req.Purge { s.Log("purge requested for %s", req.Name) diff --git a/pkg/tiller/release_uninstall_test.go b/pkg/tiller/release_uninstall_test.go index 20bfd2486..a68ac55f7 100644 --- a/pkg/tiller/release_uninstall_test.go +++ b/pkg/tiller/release_uninstall_test.go @@ -176,3 +176,24 @@ func TestUninstallReleaseNoHooks(t *testing.T) { t.Errorf("Expected LastRun to be zero, got %d.", res.Release.Hooks[0].LastRun.Seconds) } } + +func TestUninstallReleaseCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.env.Releases.Create(releaseStub()) + + customDescription := "foo" + req := &services.UninstallReleaseRequest{ + Name: "angry-panda", + Description: "foo", + } + + res, err := rs.UninstallRelease(c, req) + if err != nil { + t.Errorf("Failed uninstall: %s", err) + } + + if res.Release.Info.Description != customDescription { + t.Errorf("Expected description to be %q, got %q", customDescription, res.Release.Info.Description) + } +} diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 6f5d37331..e94de705d 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -243,7 +243,11 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( } newRelease.Info.Status.Code = release.Status_DEPLOYED - newRelease.Info.Description = "Upgrade complete" + if req.Description == "" { + newRelease.Info.Description = "Upgrade complete" + } else { + newRelease.Info.Description = req.Description + } s.recordRelease(newRelease, true) return res, nil @@ -287,7 +291,11 @@ func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.R s.recordRelease(originalRelease, true) updatedRelease.Info.Status.Code = release.Status_DEPLOYED - updatedRelease.Info.Description = "Upgrade complete" + if req.Description == "" { + updatedRelease.Info.Description = "Upgrade complete" + } else { + updatedRelease.Info.Description = req.Description + } return res, nil } diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index a1b9a4bff..56dcca874 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -432,6 +432,55 @@ func TestUpdateReleaseNoChanges(t *testing.T) { } } +func TestUpdateReleaseCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + + customDescription := "foo" + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: rel.GetChart(), + Description: customDescription, + } + + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + if res.Release.Info.Description != customDescription { + t.Errorf("Expected release description to be %q, got %q", customDescription, res.Release.Info.Description) + } + compareStoredAndReturnedRelease(t, *rs, *res) +} + +func TestUpdateReleaseCustomDescription_Force(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + + customDescription := "foo" + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: rel.GetChart(), + Force: true, + Description: customDescription, + } + + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + if res.Release.Info.Description != customDescription { + t.Errorf("Expected release description to be %q, got %q", customDescription, res.Release.Info.Description) + } + compareStoredAndReturnedRelease(t, *rs, *res) +} + func compareStoredAndReturnedRelease(t *testing.T, rs ReleaseServer, res services.UpdateReleaseResponse) *release.Release { storedRelease, err := rs.env.Releases.Get(res.Release.Name, res.Release.Version) if err != nil { From dcb6803c04e57fe65bc21d4924efc3b7562e5873 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 3 Apr 2018 17:35:07 -0400 Subject: [PATCH 254/449] feat(helm): Added the ability to handle custom description to client side for install, upgrade, rollback, and delete commands. Updated the documentation according to the changes. Signed-off-by: Arash Deshmeh --- cmd/helm/delete.go | 3 +++ cmd/helm/delete_test.go | 8 ++++++++ cmd/helm/install.go | 5 ++++- cmd/helm/install_test.go | 7 +++++++ cmd/helm/rollback.go | 5 ++++- cmd/helm/rollback_test.go | 6 ++++++ cmd/helm/upgrade.go | 6 +++++- cmd/helm/upgrade_test.go | 16 ++++++++++++++++ docs/helm/helm_delete.md | 3 ++- docs/helm/helm_install.md | 3 ++- docs/helm/helm_rollback.md | 3 ++- docs/helm/helm_upgrade.md | 1 + pkg/helm/fake.go | 21 ++++++++++++++------- pkg/helm/fake_test.go | 17 +++++++++++++++++ pkg/helm/option.go | 28 ++++++++++++++++++++++++++++ 15 files changed, 119 insertions(+), 13 deletions(-) diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go index e0ac8c4f6..46c7abcb1 100755 --- a/cmd/helm/delete.go +++ b/cmd/helm/delete.go @@ -40,6 +40,7 @@ type deleteCmd struct { disableHooks bool purge bool timeout int64 + description string out io.Writer client helm.Interface @@ -81,6 +82,7 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&del.disableHooks, "no-hooks", false, "prevent hooks from running during deletion") f.BoolVar(&del.purge, "purge", false, "remove the release from the store and make its name free for later use") f.Int64Var(&del.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") + f.StringVar(&del.description, "description", "", "specify a description for the release") return cmd } @@ -91,6 +93,7 @@ func (d *deleteCmd) run() error { helm.DeleteDisableHooks(d.disableHooks), helm.DeletePurge(d.purge), helm.DeleteTimeout(d.timeout), + helm.DeleteDescription(d.description), } res, err := d.client.DeleteRelease(d.name, opts...) if res != nil && res.Info != "" { diff --git a/cmd/helm/delete_test.go b/cmd/helm/delete_test.go index 829d17906..6b5c444b1 100644 --- a/cmd/helm/delete_test.go +++ b/cmd/helm/delete_test.go @@ -61,6 +61,14 @@ func TestDelete(t *testing.T) { resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}), rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}, }, + { + name: "delete with description", + args: []string{"aeneas"}, + flags: []string{"--description", "foo"}, + expected: "", + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}), + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}, + }, { name: "delete without release", args: []string{}, diff --git a/cmd/helm/install.go b/cmd/helm/install.go index d1c24c213..6a2107b92 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -129,6 +129,7 @@ type installCmd struct { password string devel bool depUp bool + description string certFile string keyFile string @@ -209,6 +210,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&inst.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") f.BoolVar(&inst.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.") f.BoolVar(&inst.depUp, "dep-up", false, "run helm dependency update before installing the chart") + f.StringVar(&inst.description, "description", "", "specify a description for the release") return cmd } @@ -277,7 +279,8 @@ func (i *installCmd) run() error { helm.InstallDisableHooks(i.disableHooks), helm.InstallDisableCRDHook(i.disableCRDHook), helm.InstallTimeout(i.timeout), - helm.InstallWait(i.wait)) + helm.InstallWait(i.wait), + helm.InstallDescription(i.description)) if err != nil { return prettyError(err) } diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index aa828c6ce..236174bec 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -115,6 +115,13 @@ func TestInstall(t *testing.T) { expected: "FOOBAR", resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "FOOBAR"}), }, + { + name: "install with custom description", + args: []string{"testdata/testcharts/alpine"}, + flags: []string{"--name", "virgil", "--description", "foobar"}, + expected: "virgil", + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil", Description: "foobar"}), + }, // Install, perform chart verification along the way. { name: "install with verification, missing provenance", diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index 889b6ae28..370807cb4 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -45,6 +45,7 @@ type rollbackCmd struct { client helm.Interface timeout int64 wait bool + description string } func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { @@ -83,6 +84,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&rollback.disableHooks, "no-hooks", false, "prevent hooks from running during rollback") f.Int64Var(&rollback.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&rollback.wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout") + f.StringVar(&rollback.description, "description", "", "specify a description for the release") return cmd } @@ -96,7 +98,8 @@ func (r *rollbackCmd) run() error { helm.RollbackDisableHooks(r.disableHooks), helm.RollbackVersion(r.revision), helm.RollbackTimeout(r.timeout), - helm.RollbackWait(r.wait)) + helm.RollbackWait(r.wait), + helm.RollbackDescription(r.description)) if err != nil { return prettyError(err) } diff --git a/cmd/helm/rollback_test.go b/cmd/helm/rollback_test.go index f1479b2eb..62bfd6477 100644 --- a/cmd/helm/rollback_test.go +++ b/cmd/helm/rollback_test.go @@ -45,6 +45,12 @@ func TestRollbackCmd(t *testing.T) { flags: []string{"--wait"}, expected: "Rollback was a success! Happy Helming!", }, + { + name: "rollback a release with description", + args: []string{"funny-honey", "1"}, + flags: []string{"--description", "foo"}, + expected: "Rollback was a success! Happy Helming!", + }, { name: "rollback a release without revision", args: []string{"funny-honey"}, diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 4dd433a39..aaf87b7d0 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -78,6 +78,7 @@ type upgradeCmd struct { username string password string devel bool + description string certFile string keyFile string @@ -139,6 +140,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&upgrade.keyFile, "key-file", "", "identify HTTPS client using this SSL key file") f.StringVar(&upgrade.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") f.BoolVar(&upgrade.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.") + f.StringVar(&upgrade.description, "description", "", "specify the description to use for the upgrade, rather than the default") f.MarkDeprecated("disable-hooks", "use --no-hooks instead") @@ -190,6 +192,7 @@ func (u *upgradeCmd) run() error { namespace: u.namespace, timeout: u.timeout, wait: u.wait, + description: u.description, } return ic.run() } @@ -224,7 +227,8 @@ func (u *upgradeCmd) run() error { helm.UpgradeTimeout(u.timeout), helm.ResetValues(u.resetValues), helm.ReuseValues(u.reuseValues), - helm.UpgradeWait(u.wait)) + helm.UpgradeWait(u.wait), + helm.UpgradeDescription(u.description)) if err != nil { return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) } diff --git a/cmd/helm/upgrade_test.go b/cmd/helm/upgrade_test.go index 187d3593e..032df2f32 100644 --- a/cmd/helm/upgrade_test.go +++ b/cmd/helm/upgrade_test.go @@ -139,6 +139,14 @@ func TestUpgradeCmd(t *testing.T) { expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch})}, }, + { + name: "install a release with 'upgrade --install' and custom description", + args: []string{"crazy-bunny", chartPath}, + flags: []string{"-i", "--description", "foo"}, + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch, Description: "foo"}), + expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch, Description: "foo"})}, + }, { name: "upgrade a release with wait", args: []string{"crazy-bunny", chartPath}, @@ -147,6 +155,14 @@ func TestUpgradeCmd(t *testing.T) { expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2})}, }, + { + name: "upgrade a release with description", + args: []string{"crazy-bunny", chartPath}, + flags: []string{"--description", "foo"}, + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2}), + expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2, Description: "foo"})}, + }, { name: "upgrade a release with missing dependencies", args: []string{"bonkers-bunny", missingDepsPath}, diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index 5d41cd7ea..9eee6e8ec 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -20,6 +20,7 @@ helm delete [flags] RELEASE_NAME [...] ### Options ``` + --description string specify a description for the release --dry-run simulate a delete --no-hooks prevent hooks from running during deletion --purge remove the release from the store and make its name free for later use @@ -45,4 +46,4 @@ helm delete [flags] RELEASE_NAME [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 13-Apr-2018 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 9f1ad86b0..62d02cc38 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -77,6 +77,7 @@ helm install [CHART] --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle --cert-file string identify HTTPS client using this SSL certificate file --dep-up run helm dependency update before installing the chart + --description string specify a description for the release --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --dry-run simulate an install --key-file string identify HTTPS client using this SSL key file @@ -118,4 +119,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 27-Apr-2018 +###### Auto generated by spf13/cobra on 5-Jun-2018 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index 4b6dcbbb2..ae64a0a26 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -20,6 +20,7 @@ helm rollback [flags] [RELEASE] [REVISION] ### Options ``` + --description string specify a description for the release --dry-run simulate a rollback --force force resource update through delete/recreate if needed --no-hooks prevent hooks from running during rollback @@ -47,4 +48,4 @@ helm rollback [flags] [RELEASE] [REVISION] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 13-Apr-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index c2882265e..b952624a5 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -39,6 +39,7 @@ helm upgrade [RELEASE] [CHART] ``` --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle --cert-file string identify HTTPS client using this SSL certificate file + --description string specify the description to use for the upgrade, rather than the default --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --dry-run simulate an upgrade --force force resource update through delete/recreate if needed diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index 68d39a6ab..2f0ad90b8 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -88,6 +88,7 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts } releaseName := c.Opts.instReq.Name + releaseDescription := c.Opts.instReq.Description // Check to see if the release already exists. rel, err := c.ReleaseStatus(releaseName, nil) @@ -95,7 +96,7 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts return nil, errors.New("cannot re-use a name that is still in use") } - release := ReleaseMock(&MockReleaseOptions{Name: releaseName, Namespace: ns}) + release := ReleaseMock(&MockReleaseOptions{Name: releaseName, Namespace: ns, Description: releaseDescription}) c.Rels = append(c.Rels, release) return &rls.InstallReleaseResponse{ @@ -225,11 +226,12 @@ metadata: // MockReleaseOptions allows for user-configurable options on mock release objects. type MockReleaseOptions struct { - Name string - Version int32 - Chart *chart.Chart - StatusCode release.Status_Code - Namespace string + Name string + Version int32 + Chart *chart.Chart + StatusCode release.Status_Code + Namespace string + Description string } // ReleaseMock creates a mock release object based on options set by MockReleaseOptions. This function should typically not be used outside of testing. @@ -251,6 +253,11 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { namespace = "default" } + description := opts.Description + if description == "" { + description = "Release mock" + } + ch := opts.Chart if opts.Chart == nil { ch = &chart.Chart{ @@ -275,7 +282,7 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { FirstDeployed: &date, LastDeployed: &date, Status: &release.Status{Code: scode}, - Description: "Release mock", + Description: description, }, Chart: ch, Config: &chart.Config{Raw: `name: "value"`}, diff --git a/pkg/helm/fake_test.go b/pkg/helm/fake_test.go index 9c0a53759..f6de572b5 100644 --- a/pkg/helm/fake_test.go +++ b/pkg/helm/fake_test.go @@ -150,6 +150,23 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { }, wantErr: false, }, + { + name: "Add release with description.", + fields: fields{ + Rels: []*release.Release{}, + }, + args: args{ + ns: "default", + opts: []InstallOption{ReleaseName("new-release"), InstallDescription("foo-bar")}, + }, + want: &rls.InstallReleaseResponse{ + Release: ReleaseMock(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), + }, + relsAfter: []*release.Release{ + ReleaseMock(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), + }, + wantErr: false, + }, { name: "Try to add a release where the name already exists.", fields: fields{ diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 602e1e3a3..4babec073 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -262,6 +262,34 @@ func UpdateValueOverrides(raw []byte) UpdateOption { } } +// InstallDescription specifies the description for the release +func InstallDescription(description string) InstallOption { + return func(opts *options) { + opts.instReq.Description = description + } +} + +// UpgradeDescription specifies the description for the update +func UpgradeDescription(description string) UpdateOption { + return func(opts *options) { + opts.updateReq.Description = description + } +} + +// RollbackDescription specifies the description for the release +func RollbackDescription(description string) RollbackOption { + return func(opts *options) { + opts.rollbackReq.Description = description + } +} + +// DeleteDescription specifies the description for the release +func DeleteDescription(description string) DeleteOption { + return func(opts *options) { + opts.uninstallReq.Description = description + } +} + // DeleteDisableHooks will disable hooks for a deletion operation. func DeleteDisableHooks(disable bool) DeleteOption { return func(opts *options) { From 6eaa2a7061bfe078b60c7e016540dd8e2d07eb57 Mon Sep 17 00:00:00 2001 From: ruicao Date: Wed, 6 Jun 2018 10:48:33 +0800 Subject: [PATCH 255/449] Typo fix: indentifies -> identifies --- cmd/helm/installer/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index 13cf43dcc..3769d12e1 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -50,7 +50,7 @@ type Options struct { // Force allows to force upgrading tiller if deployed version is greater than current version ForceUpgrade bool - // ImageSpec indentifies the image Tiller will use when deployed. + // ImageSpec identifies the image Tiller will use when deployed. // // Valid if and only if UseCanary is false. ImageSpec string From fb485a98610879b8137b455f8aed06bd7c4435b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herbert=20M=C3=BChlburger?= Date: Thu, 7 Jun 2018 10:30:17 +0200 Subject: [PATCH 256/449] test: add test for 'ParseIntoString' and update test for 'ParseInto' --- pkg/strvals/parser_test.go | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index f6e35c81b..22f0e753a 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -355,12 +355,13 @@ func TestParseInto(t *testing.T) { "inner2": "value2", }, } - input := "outer.inner1=value1,outer.inner3=value3" + input := "outer.inner1=value1,outer.inner3=value3,outer.inner4=4" expect := map[string]interface{}{ "outer": map[string]interface{}{ "inner1": "value1", "inner2": "value2", "inner3": "value3", + "inner4": 4, }, } @@ -381,6 +382,39 @@ func TestParseInto(t *testing.T) { t.Errorf("%s: Expected:\n%s\nGot:\n%s", input, y1, y2) } } +func TestParseIntoString(t *testing.T) { + got := map[string]interface{}{ + "outer": map[string]interface{}{ + "inner1": "overwrite", + "inner2": "value2", + }, + } + input := "outer.inner1=1,outer.inner3=3" + expect := map[string]interface{}{ + "outer": map[string]interface{}{ + "inner1": "1", + "inner2": "value2", + "inner3": "3", + }, + } + + if err := ParseIntoString(input, got); err != nil { + t.Fatal(err) + } + + y1, err := yaml.Marshal(expect) + if err != nil { + t.Fatal(err) + } + y2, err := yaml.Marshal(got) + if err != nil { + t.Fatalf("Error serializing parsed value: %s", err) + } + + if string(y1) != string(y2) { + t.Errorf("%s: Expected:\n%s\nGot:\n%s", input, y1, y2) + } +} func TestToYAML(t *testing.T) { // The TestParse does the hard part. We just verify that YAML formatting is From d72d78ed8743014597c5b27e3c860bfad8539dd7 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Thu, 7 Jun 2018 07:24:45 -0500 Subject: [PATCH 257/449] Add s390 architecture in TARGETS Signed-off-by: Alice Frosi --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 54cc1ff18..77d7c8ff7 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ DOCKER_REGISTRY ?= gcr.io IMAGE_PREFIX ?= kubernetes-helm SHORT_NAME ?= tiller SHORT_NAME_RUDDER ?= rudder -TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le windows/amd64 +TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x windows/amd64 DIST_DIRS = find * -type d -exec APP = helm From 142d0df128ae5d561dcb61ddec6a1b3a67a5ff94 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Thu, 7 Jun 2018 15:12:31 +0100 Subject: [PATCH 258/449] Remove trailing whitespace --- docs/charts.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/charts.md b/docs/charts.md index 8f8a9856f..656731182 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -303,7 +303,6 @@ The `--set` parameter can be used as usual to alter tag and condition values. ```` helm install --set tags.front-end=true --set subchart2.enabled=false - ```` ##### Tags and Condition Resolution From d5e25db55989287121167f11ade00c30787b9b27 Mon Sep 17 00:00:00 2001 From: liyongxin Date: Fri, 8 Jun 2018 10:09:07 +0800 Subject: [PATCH 259/449] typo fix for lengh to length --- pkg/storage/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 4b39e0bb2..d308cef1b 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -163,7 +163,7 @@ func (s *Storage) History(name string) ([]*rspb.Release, error) { return s.Driver.Query(map[string]string{"NAME": name, "OWNER": "TILLER"}) } -// removeLeastRecent removes items from history until the lengh number of releases +// removeLeastRecent removes items from history until the length number of releases // does not exceed max. // // We allow max to be set explicitly so that calling functions can "make space" From bfb8dea4d6d24585da497437e1cc6fe7df764665 Mon Sep 17 00:00:00 2001 From: Sebastien Plisson Date: Mon, 11 Jun 2018 19:36:46 -0700 Subject: [PATCH 260/449] fix(helm): Display debug release info when upgrade failed because of timeout. Closes #3020 --- cmd/helm/helm_test.go | 4 ++-- cmd/helm/install.go | 30 ++++++++++++++++++++---------- cmd/helm/rollback.go | 20 +++++++++++++++++++- cmd/helm/upgrade.go | 18 ++++++++++++++---- 4 files changed, 55 insertions(+), 17 deletions(-) diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index 79b8c16f2..d80b1a2c2 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -50,8 +50,8 @@ func runReleaseCases(t *testing.T, tests []releaseCase, rcmd releaseCmd) { cmd := rcmd(c, &buf) cmd.ParseFlags(tt.flags) err := cmd.RunE(cmd, tt.args) - if (err != nil) != tt.err { - t.Errorf("expected error, got '%v'", err) + if (err == nil) && tt.err { + t.Errorf("expected error, got no error") } re := regexp.MustCompile(tt.expected) if !re.Match(buf.Bytes()) { diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 6a2107b92..a6d8a1777 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -269,7 +269,7 @@ func (i *installCmd) run() error { return fmt.Errorf("cannot load requirements: %v", err) } - res, err := i.client.InstallReleaseFromChart( + resp, err := i.client.InstallReleaseFromChart( chartRequested, i.namespace, helm.ValueOverrides(rawVals), @@ -281,27 +281,37 @@ func (i *installCmd) run() error { helm.InstallTimeout(i.timeout), helm.InstallWait(i.wait), helm.InstallDescription(i.description)) - if err != nil { - return prettyError(err) + + // If there is an error while waiting, make a call without waiting to get the release content + if (resp == nil || resp.Release == nil) && i.wait { + if res, e := i.client.ReleaseContent(i.name); e != nil { + fmt.Fprintf(i.out, "Error reading release content: %v", prettyError(e)) + } else { + i.printRelease(res.Release) + } + } else { + rel := resp.GetRelease() + if rel == nil { + return nil + } + i.printRelease(rel) } - rel := res.GetRelease() - if rel == nil { - return nil + if err != nil { + return prettyError(err) } - i.printRelease(rel) // If this is a dry run, we can't display status. if i.dryRun { // This is special casing to avoid breaking backward compatibility: - if res.Release.Info.Description != "Dry run complete" { - fmt.Fprintf(os.Stdout, "WARNING: %s\n", res.Release.Info.Description) + if resp.Release.Info.Description != "Dry run complete" { + fmt.Fprintf(os.Stdout, "WARNING: %s\n", resp.Release.Info.Description) } return nil } // Print the status like status command does - status, err := i.client.ReleaseStatus(rel.Name) + status, err := i.client.ReleaseStatus(i.name) if err != nil { return prettyError(err) } diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index 370807cb4..c47a8272d 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -90,7 +90,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { } func (r *rollbackCmd) run() error { - _, err := r.client.RollbackRelease( + resp, err := r.client.RollbackRelease( r.name, helm.RollbackDryRun(r.dryRun), helm.RollbackRecreate(r.recreate), @@ -100,6 +100,24 @@ func (r *rollbackCmd) run() error { helm.RollbackTimeout(r.timeout), helm.RollbackWait(r.wait), helm.RollbackDescription(r.description)) + + if settings.Debug { + // If there is an error while waiting, make a call without waiting to get the release content + if (resp == nil || resp.Release == nil) && r.wait { + if res, e := r.client.ReleaseContent(r.name); e != nil { + fmt.Fprintf(r.out, "Error reading release content: %v", prettyError(e)) + } else { + printRelease(r.out, res.Release) + } + } else { + rel := resp.GetRelease() + if rel == nil { + return nil + } + printRelease(r.out, rel) + } + } + if err != nil { return prettyError(err) } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index aaf87b7d0..104b4c6ba 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -229,12 +229,22 @@ func (u *upgradeCmd) run() error { helm.ReuseValues(u.reuseValues), helm.UpgradeWait(u.wait), helm.UpgradeDescription(u.description)) - if err != nil { - return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) - } if settings.Debug { - printRelease(u.out, resp.Release) + // If there is an error while waiting, make a call without waiting to get the updated release content + if (resp == nil || resp.Release == nil) && u.wait { + if res, e := u.client.ReleaseContent(u.release); e != nil { + fmt.Fprintf(u.out, "Error reading release content: %v", prettyError(e)) + } else { + printRelease(u.out, res.Release) + } + } else { + printRelease(u.out, resp.Release) + } + } + + if err != nil { + return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) } fmt.Fprintf(u.out, "Release %q has been upgraded. Happy Helming!\n", u.release) From c5dd4b1fde676e43073913b3dbeab78f32c929df Mon Sep 17 00:00:00 2001 From: liyongxin Date: Tue, 12 Jun 2018 11:05:02 +0800 Subject: [PATCH 261/449] typo fix for template test --- cmd/helm/template_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index d15dc5666..263b6bb35 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -68,8 +68,8 @@ func TestTemplateCmd(t *testing.T) { }, { name: "check_execute_non_existent", - desc: "verify --execute fails on a template that doesnt exist", - args: []string{subchart1ChartPath, "-x", "templates/thisdoesntexist.yaml"}, + desc: "verify --execute fails on a template that doesn't exist", + args: []string{subchart1ChartPath, "-x", "templates/thisdoesn'texist.yaml"}, expectError: "could not find template", }, { From 0b202eb184092fbc45e39b2607aa077fc3fddf1a Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 17 May 2018 09:24:25 +0800 Subject: [PATCH 262/449] Fix(helm): fix the bug of the charts not deployed after downloaded in helm install --dep-up helm install --dep-up does not deploy the charts downloaded by itself. I reload the charts path after downloading the missing charts. Closes #3423 --- cmd/helm/install.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index a6d8a1777..401611935 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -260,6 +260,12 @@ func (i *installCmd) run() error { if err := man.Update(); err != nil { return prettyError(err) } + + // Update all dependencies which are present in /charts. + chartRequested, err = chartutil.Load(i.chartPath) + if err != nil { + return prettyError(err) + } } else { return prettyError(err) } From cffb4c491eaa9d8c583b100d7b475c6e6ccb396f Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Thu, 24 May 2018 11:53:46 -0700 Subject: [PATCH 263/449] add SECURITY_CONTACTS --- SECURITY_CONTACTS | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 SECURITY_CONTACTS diff --git a/SECURITY_CONTACTS b/SECURITY_CONTACTS new file mode 100644 index 000000000..7298ea2d2 --- /dev/null +++ b/SECURITY_CONTACTS @@ -0,0 +1,20 @@ +# Defined below are the security contacts for this repo. +# +# They are the contact point for the Product Security Team to reach out +# to for triaging and handling of incoming issues. +# +# The below names agree to abide by the +# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy) +# and will be removed and replaced if they violate that agreement. +# +# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE +# INSTRUCTIONS AT https://github.com/kubernetes/helm/blob/master/CONTRIBUTING.md#reporting-a-security-issue + +adamreese +bacongobbler +mattfarina +michelleN +prydonius +SlickNik +technosophos +thomastaylor312 From 93f4671519524a15f6e3310a4bb06b757ac4167c Mon Sep 17 00:00:00 2001 From: Curtis Mattoon Date: Thu, 14 Jun 2018 12:05:24 -0400 Subject: [PATCH 264/449] Do not fail linting because of missing 'required' template values --- pkg/engine/engine.go | 13 +++++++++++++ pkg/lint/rules/template.go | 1 + 2 files changed, 14 insertions(+) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 7a940fc84..c2e74af5c 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -19,6 +19,7 @@ package engine import ( "bytes" "fmt" + "log" "path" "sort" "strings" @@ -39,6 +40,8 @@ type Engine struct { // a value that was not passed in. Strict bool CurrentTemplates map[string]renderable + // In LintMode, some 'required' template values may be missing, so don't fail + LintMode bool } // New creates a new Go template Engine instance. @@ -155,9 +158,19 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap { // Add the 'required' function here funcMap["required"] = func(warn string, val interface{}) (interface{}, error) { if val == nil { + if e.LintMode { + // Don't fail on missing required values when linting + log.Printf("[INFO] Missing required value: %s", warn) + return val, nil + } return val, fmt.Errorf(warn) } else if _, ok := val.(string); ok { if val == "" { + if e.LintMode { + // Don't fail on missing required values when linting + log.Printf("[INFO] Missing required value: %s", warn) + return val, nil + } return val, fmt.Errorf(warn) } } diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index a8b6a6757..3bddcf5fc 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -76,6 +76,7 @@ func Templates(linter *support.Linter, values []byte, namespace string, strict b return } e := engine.New() + e.LintMode = true if strict { e.Strict = true } From 14d2394abe0d87a884c01d47a5e05a8fa0d985c2 Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Sat, 16 Jun 2018 18:07:08 +0100 Subject: [PATCH 265/449] Add 'name' label to created namespaces --- pkg/kube/namespace.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/kube/namespace.go b/pkg/kube/namespace.go index 6547e4abc..c6878bd0f 100644 --- a/pkg/kube/namespace.go +++ b/pkg/kube/namespace.go @@ -27,6 +27,9 @@ func createNamespace(client internalclientset.Interface, namespace string) error ns := &core.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: namespace, + Labels: map[string]string{ + "name": namespace, + }, }, } _, err := client.Core().Namespaces().Create(ns) From a5cb54fd47cd45e3c18d9dc025093810c83e40b9 Mon Sep 17 00:00:00 2001 From: Gage Hugo Date: Tue, 19 Jun 2018 10:58:02 -0500 Subject: [PATCH 266/449] chore(sprig): bump sprig to 2.15.0 This change updates sprig to 2.15, which has support for generating SSL certificates in charts from user defined CA certificates. --- glide.lock | 21 ++++++++++----------- glide.yaml | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/glide.lock b/glide.lock index a91c31b7b..eef256fd1 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 4023a1644d60060fbf2fdbbe5b73cbb4b957eb686ce925640d102db2d1858676 -updated: 2018-04-14T11:27:34.604716498-04:00 +hash: 41304a2eabc68608507c034304ce87cbf76924c90caaafbe42a9be16e6265868 +updated: 2018-06-19T14:50:56.238468981-05:00 imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -89,7 +89,7 @@ imports: subpackages: - spdy - name: github.com/evanphx/json-patch - version: 944e07253867aacae43c04b2e6a239005443f33a + version: 94e38aa1586e8a6c8a75770bddf5ff84c48a106b - name: github.com/exponent-io/jsonpath version: d6023ce2651d8eafb5c75bb0c7167536102ec9f5 - name: github.com/fatih/camelcase @@ -250,7 +250,7 @@ imports: - name: github.com/spf13/pflag version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7 - name: github.com/technosophos/moniker - version: ab470f5e105a44d0c87ea21bacd6a335c4816d83 + version: a5dbd03a2245d554160e3ae6bfdcf969fe58b431 - name: golang.org/x/crypto version: 81e90905daefcd6fd217b62423c0908922eadb30 subpackages: @@ -359,9 +359,9 @@ imports: - json - jwt - name: gopkg.in/yaml.v2 - version: 53feefa2559fb8dfa8d81baad31be332c97d6c77 + version: 670d4cfef0544295bc27a114dbac37980d83185a - name: k8s.io/api - version: c699ec51538f0cfd4afa8bfcfe1e0779cafbe666 + version: 8b7507fac302640dd5f1efbf9643199952cc58db subpackages: - admission/v1beta1 - admissionregistration/v1alpha1 @@ -398,7 +398,7 @@ imports: subpackages: - pkg/features - name: k8s.io/apimachinery - version: 54101a56dda9a0962bc48751c058eb4c546dcbb9 + version: f6313580a4d36c7c74a3d845dda6e116642c4f90 subpackages: - pkg/api/equality - pkg/api/errors @@ -455,7 +455,7 @@ imports: - third_party/forked/golang/netutil - third_party/forked/golang/reflect - name: k8s.io/apiserver - version: ea53f8588c655568158b4ff53f5ec6fa4ebfc332 + version: f7914ed3085badf66a1b6f3a5218ada28f7bd084 subpackages: - pkg/apis/audit - pkg/authentication/authenticator @@ -640,12 +640,12 @@ imports: - util/retry - util/workqueue - name: k8s.io/kube-openapi - version: 50ae88d24ede7b8bad68e23c805b5d3da5c8abaf + version: 39cb288412c48cb533ba4be5d6c28620b9a0c1b4 subpackages: - pkg/util/proto - pkg/util/proto/validation - name: k8s.io/kubernetes - version: baab3992147260d47cb59b9c485a24fdeff2e457 + version: 32ac1c9073b132b8ba18aa830f46b77dcceb0723 subpackages: - pkg/api/events - pkg/api/legacyscheme @@ -767,7 +767,6 @@ imports: - pkg/client/clientset_generated/internalclientset/typed/settings/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion/fake - - pkg/client/conditions - pkg/cloudprovider - pkg/controller - pkg/controller/daemon diff --git a/glide.yaml b/glide.yaml index fc3dcc37d..a101a11ee 100644 --- a/glide.yaml +++ b/glide.yaml @@ -13,7 +13,7 @@ import: - package: github.com/imdario/mergo version: 6633656539c1639d9d78127b7d47c622b5d7b6dc - package: github.com/Masterminds/sprig - version: ^2.14.1 + version: ^2.15.0 - package: github.com/ghodss/yaml - package: github.com/Masterminds/semver version: ~1.3.1 From 149198c8f1749b51c96b9a10d901ade7c8452f8c Mon Sep 17 00:00:00 2001 From: Jon Kalfayan Date: Wed, 27 Jun 2018 21:31:40 -0700 Subject: [PATCH 267/449] add nil check in if statement configmap example, also note why --- docs/chart_template_guide/control_structures.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/chart_template_guide/control_structures.md b/docs/chart_template_guide/control_structures.md index 7575ebc35..1844bd393 100644 --- a/docs/chart_template_guide/control_structures.md +++ b/docs/chart_template_guide/control_structures.md @@ -53,10 +53,10 @@ data: myvalue: "Hello World" drink: {{ .Values.favorite.drink | default "tea" | quote }} food: {{ .Values.favorite.food | upper | quote }} - {{ if eq .Values.favorite.drink "coffee" }}mug: true{{ end }} + {{ if (.Values.favorite.drink) and eq .Values.favorite.drink "coffee" }}mug: true{{ end }} ``` -Since we commented out `drink: coffee` in our last example, the output should not include a `mug: true` flag. But if we add that line back into our `values.yaml` file, the output should look like this: +Note that `.Values.favorite.drink` must be defined or else it will throw an error when comparing it to "coffee". Since we commented out `drink: coffee` in our last example, the output should not include a `mug: true` flag. But if we add that line back into our `values.yaml` file, the output should look like this: ```yaml # Source: mychart/templates/configmap.yaml From 4630e924e7eb8d5f992cbfcd1d53663f910e022a Mon Sep 17 00:00:00 2001 From: Junya Ogasawara Date: Fri, 29 Jun 2018 14:06:54 +0900 Subject: [PATCH 268/449] Change permission of index.yaml Because index.yaml generated by a command `helm repo index` isn't executable file, but just configuration file. --- cmd/helm/repo_index.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/helm/repo_index.go b/cmd/helm/repo_index.go index 540057eb8..939f35ac0 100644 --- a/cmd/helm/repo_index.go +++ b/cmd/helm/repo_index.go @@ -91,7 +91,7 @@ func index(dir, url, mergeTo string) error { var i2 *repo.IndexFile if _, err := os.Stat(mergeTo); os.IsNotExist(err) { i2 = repo.NewIndexFile() - i2.WriteFile(mergeTo, 0755) + i2.WriteFile(mergeTo, 0644) } else { i2, err = repo.LoadIndexFile(mergeTo) if err != nil { @@ -101,5 +101,5 @@ func index(dir, url, mergeTo string) error { i.Merge(i2) } i.SortEntries() - return i.WriteFile(out, 0755) + return i.WriteFile(out, 0644) } From a1a369b811aeb0755981c2327c9b0734a4ddda30 Mon Sep 17 00:00:00 2001 From: roc Date: Thu, 5 Jul 2018 11:50:03 +0800 Subject: [PATCH 269/449] Support Stdin when using downloaders of plugin Inject os.Stdin into the command of helm plugin's downloaders --- pkg/getter/plugingetter.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/getter/plugingetter.go b/pkg/getter/plugingetter.go index c747eef7f..a73ccc853 100644 --- a/pkg/getter/plugingetter.go +++ b/pkg/getter/plugingetter.go @@ -69,6 +69,7 @@ func (p *pluginGetter) Get(href string) (*bytes.Buffer, error) { buf := bytes.NewBuffer(nil) prog.Stdout = buf prog.Stderr = os.Stderr + prog.Stdin = os.Stdin if err := prog.Run(); err != nil { if eerr, ok := err.(*exec.ExitError); ok { os.Stderr.Write(eerr.Stderr) From 7199aa542e3babc15469c8f6e771cf338d4124ac Mon Sep 17 00:00:00 2001 From: flynnduism Date: Thu, 5 Jul 2018 15:15:59 -0700 Subject: [PATCH 270/449] docs(chore): add svg logo --- docs/logos/helm-blue-vector.svg | 27 ++++++ docs/logos/helm-white-vector.svg | 27 ++++++ docs/logos/helm.svg | 153 +++++++++++++++++++++++++++++++ 3 files changed, 207 insertions(+) create mode 100755 docs/logos/helm-blue-vector.svg create mode 100755 docs/logos/helm-white-vector.svg create mode 100644 docs/logos/helm.svg diff --git a/docs/logos/helm-blue-vector.svg b/docs/logos/helm-blue-vector.svg new file mode 100755 index 000000000..b8707ba90 --- /dev/null +++ b/docs/logos/helm-blue-vector.svg @@ -0,0 +1,27 @@ + + + + logo + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/docs/logos/helm-white-vector.svg b/docs/logos/helm-white-vector.svg new file mode 100755 index 000000000..4b5163d8f --- /dev/null +++ b/docs/logos/helm-white-vector.svg @@ -0,0 +1,27 @@ + + + + logo white + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/logos/helm.svg b/docs/logos/helm.svg new file mode 100644 index 000000000..2d8858e93 --- /dev/null +++ b/docs/logos/helm.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From bf2e7382a8731581d76d4f4366ebf58fc578d583 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Fri, 6 Jul 2018 15:46:20 +0800 Subject: [PATCH 271/449] Some small typos: Some small typos: Line 92: stategies->strategies Line 263: namepace->namespace Line 266: ReuseName->Reuse_name --- _proto/hapi/services/tiller.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 95391cb1a..25bf7af44 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -89,7 +89,7 @@ service ReleaseService { // // Releases can be retrieved in chunks by setting limit and offset. // -// Releases can be sorted according to a few pre-determined sort stategies. +// Releases can be sorted according to a few pre-determined sort strategies. message ListReleasesRequest { // Limit is the maximum number of releases to be returned. int64 limit = 1; @@ -264,10 +264,10 @@ message InstallReleaseRequest { // DisableHooks causes the server to skip running any hooks for the install. bool disable_hooks = 5; - // Namepace is the kubernetes namespace of the release. + // Namespace is the kubernetes namespace of the release. string namespace = 6; - // ReuseName requests that Tiller re-uses a name, instead of erroring out. + // Reuse_name requests that Tiller re-uses a name, instead of erroring out. bool reuse_name = 7; // timeout specifies the max amount of time any kubernetes client command can run. From 5147937f423bf6108691794d6de0cce0dd096158 Mon Sep 17 00:00:00 2001 From: roc Date: Sun, 8 Jul 2018 17:08:48 +0800 Subject: [PATCH 272/449] docs(helm): add helm-cos to related helm plugins --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index bf55df549..bac9e899b 100644 --- a/docs/related.md +++ b/docs/related.md @@ -39,6 +39,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [helm-secrets](https://github.com/futuresimple/helm-secrets) - Plugin to manage and store secrets safely - [helm-edit](https://github.com/mstrzele/helm-edit) - Plugin for editing release's values - [helm-gcs](https://github.com/nouney/helm-gcs) - Plugin to manage repositories on Google Cloud Storage +- [helm-cos](https://github.com/imroc/helm-cos) - Plugin to manage repositories on Tencent Cloud Object Storage - [helm-github](https://github.com/sagansystems/helm-github) - Plugin to install Helm Charts from Github repositories - [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query - [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp From 7b5d214e0e0c65b30946e84c51edfcbc7bdc05ac Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Tue, 10 Jul 2018 18:18:41 -0400 Subject: [PATCH 273/449] chore(docs): lowercase `Kind` for clarity `Kind` being upper case makes it seem like we're referrring to the Kind field of a Kubernetes resource but we're really talking about the kind of helm hook in this case. resolves #4302 --- docs/charts_hooks.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/charts_hooks.md b/docs/charts_hooks.md index f51749f57..b6c276bba 100644 --- a/docs/charts_hooks.md +++ b/docs/charts_hooks.md @@ -183,8 +183,7 @@ deterministic executing order. Weights are defined using the following annotatio ``` Hook weights can be positive or negative numbers but must be represented as -strings. When Tiller starts the execution cycle of hooks of a particular Kind it -will sort those hooks in ascending order. +strings. When Tiller starts the execution cycle of hooks of a particular kind (ex. the `pre-install` hooks or `post-install` hooks, etc.) it will sort those hooks in ascending order. It is also possible to define policies that determine when to delete corresponding hook resources. Hook deletion policies are defined using the following annotation: From 45ac18a45044f87bead50dea86d8d316087a54f0 Mon Sep 17 00:00:00 2001 From: fibonacci1729 Date: Tue, 10 Jul 2018 17:51:03 -0600 Subject: [PATCH 274/449] fix(helm): return when listing with no releases or nil --- cmd/helm/list.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 4614c7f67..47417749f 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -166,8 +166,11 @@ func (l *listCmd) run() error { if err != nil { return prettyError(err) } + if res == nil { + return nil + } - rels := filterList(res.Releases) + rels := filterList(res.GetReleases()) result := getListResult(rels, res.Next) From a1b0305e1ea14330c5c60b150df2e1826bed72f3 Mon Sep 17 00:00:00 2001 From: flynnduism Date: Wed, 11 Jul 2018 13:03:00 -0700 Subject: [PATCH 275/449] docs(chore): scale svg up to 620 initial width/height --- docs/logos/helm-blue-vector.svg | 70 ++++++++++++++++++++------------ docs/logos/helm-white-vector.svg | 70 ++++++++++++++++++++------------ 2 files changed, 86 insertions(+), 54 deletions(-) mode change 100755 => 100644 docs/logos/helm-blue-vector.svg mode change 100755 => 100644 docs/logos/helm-white-vector.svg diff --git a/docs/logos/helm-blue-vector.svg b/docs/logos/helm-blue-vector.svg old mode 100755 new mode 100644 index b8707ba90..45f2c2f86 --- a/docs/logos/helm-blue-vector.svg +++ b/docs/logos/helm-blue-vector.svg @@ -1,27 +1,43 @@ - - - - logo - Created with Sketch. - - - - - - - \ No newline at end of file + + + + +logo +Created with Sketch. + + + + + + diff --git a/docs/logos/helm-white-vector.svg b/docs/logos/helm-white-vector.svg old mode 100755 new mode 100644 index 4b5163d8f..0f09be31e --- a/docs/logos/helm-white-vector.svg +++ b/docs/logos/helm-white-vector.svg @@ -1,27 +1,43 @@ - - - - logo white - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + +logo white +Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + From 3a8422f4a6d50793befbfdf0f34943a94290806d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Magnusson?= Date: Wed, 11 Jul 2018 23:03:16 +0200 Subject: [PATCH 276/449] CONTRIBUTING.md: Corrected slack channel/s in support channels --- CONTRIBUTING.md | 102 ++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8fecb0479..81ed009d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,9 @@ apply to [third_party](third_party/) and [vendor](vendor/). Whether you are a user or contributor, official support channels include: - GitHub [issues](https://github.com/kubernetes/helm/issues/new) -- Slack: #Helm room in the [Kubernetes Slack](http://slack.kubernetes.io/) +- Slack [Kubernetes Slack](http://slack.kubernetes.io/): + - User: #helm-users + - Contributor: #helm-dev Before opening a new issue or submitting a new pull request, it's helpful to search the project - it's likely that another user has already reported the issue you're facing, or it's a known issue that we're already aware of. @@ -40,15 +42,15 @@ Before opening a new issue or submitting a new pull request, it's helpful to sea We use milestones to track progress of releases. There are also 2 special milestones used for helping us keep work organized: `Upcoming - Minor` and `Upcoming - Major` -`Upcoming - Minor` is used for keeping track of issues that aren't assigned to a specific +`Upcoming - Minor` is used for keeping track of issues that aren't assigned to a specific release but could easily be addressed in a minor release. `Upcoming - Major` keeps track -of issues that will need to be addressed in a major release. For example, if the current -version is `2.2.0` an issue/PR could fall in to one of 4 different active milestones: -`2.2.1`, `2.3.0`, `Upcoming - Minor`, or `Upcoming - Major`. If an issue pertains to a -specific upcoming bug or minor release, it would go into `2.2.1` or `2.3.0`. If the issue/PR -does not have a specific milestone yet, but it is likely that it will land in a `2.X` release, -it should go into `Upcoming - Minor`. If the issue/PR is a large functionality add or change -and/or it breaks compatibility, then it should be added to the `Upcoming - Major` milestone. +of issues that will need to be addressed in a major release. For example, if the current +version is `2.2.0` an issue/PR could fall in to one of 4 different active milestones: +`2.2.1`, `2.3.0`, `Upcoming - Minor`, or `Upcoming - Major`. If an issue pertains to a +specific upcoming bug or minor release, it would go into `2.2.1` or `2.3.0`. If the issue/PR +does not have a specific milestone yet, but it is likely that it will land in a `2.X` release, +it should go into `Upcoming - Minor`. If the issue/PR is a large functionality add or change +and/or it breaks compatibility, then it should be added to the `Upcoming - Major` milestone. An issue that we are not sure we will be doing will not be added to any milestone. A milestone (and hence release) is considered done when all outstanding issues/PRs have been closed or moved to another milestone. @@ -75,42 +77,42 @@ Issues are used as the primary method for tracking anything to do with the Helm ### Issue Types There are 4 types of issues (each with their own corresponding [label](#labels)): -- Question: These are support or functionality inquiries that we want to have a record of for -future reference. Generally these are questions that are too complex or large to store in the -Slack channel or have particular interest to the community as a whole. Depending on the discussion, +- Question: These are support or functionality inquiries that we want to have a record of for +future reference. Generally these are questions that are too complex or large to store in the +Slack channel or have particular interest to the community as a whole. Depending on the discussion, these can turn into "Feature" or "Bug" issues. -- Proposal: Used for items (like this one) that propose a new ideas or functionality that require -a larger community discussion. This allows for feedback from others in the community before a -feature is actually developed. This is not needed for small additions. Final word on whether or -not a feature needs a proposal is up to the core maintainers. All issues that are proposals should -both have a label and an issue title of "Proposal: [the rest of the title]." A proposal can become +- Proposal: Used for items (like this one) that propose a new ideas or functionality that require +a larger community discussion. This allows for feedback from others in the community before a +feature is actually developed. This is not needed for small additions. Final word on whether or +not a feature needs a proposal is up to the core maintainers. All issues that are proposals should +both have a label and an issue title of "Proposal: [the rest of the title]." A proposal can become a "Feature" and does not require a milestone. -- Features: These track specific feature requests and ideas until they are complete. They can evolve +- Features: These track specific feature requests and ideas until they are complete. They can evolve from a "Proposal" or can be submitted individually depending on the size. - Bugs: These track bugs with the code or problems with the documentation (i.e. missing or incomplete) ### Issue Lifecycle -The issue lifecycle is mainly driven by the core maintainers, but is good information for those +The issue lifecycle is mainly driven by the core maintainers, but is good information for those contributing to Helm. All issue types follow the same general lifecycle. Differences are noted below. 1. Issue creation 2. Triage - - The maintainer in charge of triaging will apply the proper labels for the issue. This - includes labels for priority, type, and metadata (such as "starter"). The only issue - priority we will be tracking is whether or not the issue is "critical." If additional + - The maintainer in charge of triaging will apply the proper labels for the issue. This + includes labels for priority, type, and metadata (such as "starter"). The only issue + priority we will be tracking is whether or not the issue is "critical." If additional levels are needed in the future, we will add them. - - (If needed) Clean up the title to succinctly and clearly state the issue. Also ensure + - (If needed) Clean up the title to succinctly and clearly state the issue. Also ensure that proposals are prefaced with "Proposal". - - Add the issue to the correct milestone. If any questions come up, don't worry about + - Add the issue to the correct milestone. If any questions come up, don't worry about adding the issue to a milestone until the questions are answered. - We attempt to do this process at least once per work day. 3. Discussion - - "Feature" and "Bug" issues should be connected to the PR that resolves it. - - Whoever is working on a "Feature" or "Bug" issue (whether a maintainer or someone from - the community), should either assign the issue to them self or make a comment in the issue + - "Feature" and "Bug" issues should be connected to the PR that resolves it. + - Whoever is working on a "Feature" or "Bug" issue (whether a maintainer or someone from + the community), should either assign the issue to them self or make a comment in the issue saying that they are taking it. - - "Proposal" and "Question" issues should stay open until resolved or if they have not been - active for more than 30 days. This will help keep the issue queue to a manageable size and + - "Proposal" and "Question" issues should stay open until resolved or if they have not been + active for more than 30 days. This will help keep the issue queue to a manageable size and reduce noise. Should the issue need to stay open, the `keep open` label can be added. 4. Issue closure @@ -133,36 +135,36 @@ Like any good open source project, we use Pull Requests to track code changes 1. PR creation - We more than welcome PRs that are currently in progress. They are a great way to keep track of - important work that is in-flight, but useful for others to see. If a PR is a work in progress, + important work that is in-flight, but useful for others to see. If a PR is a work in progress, it **must** be prefaced with "WIP: [title]". Once the PR is ready for review, remove "WIP" from the title. - It is preferred, but not required, to have a PR tied to a specific issue. 2. Triage - - The maintainer in charge of triaging will apply the proper labels for the issue. This should - include at least a size label, `bug` or `feature`, and `awaiting review` once all labels are applied. + - The maintainer in charge of triaging will apply the proper labels for the issue. This should + include at least a size label, `bug` or `feature`, and `awaiting review` once all labels are applied. See the [Labels section](#labels) for full details on the definitions of labels - Add the PR to the correct milestone. This should be the same as the issue the PR closes. 3. Assigning reviews - - Once a review has the `awaiting review` label, maintainers will review them as schedule permits. + - Once a review has the `awaiting review` label, maintainers will review them as schedule permits. The maintainer who takes the issue should self-request a review. - - Reviews from others in the community, especially those who have encountered a bug or have - requested a feature, are highly encouraged, but not required. Maintainer reviews **are** required + - Reviews from others in the community, especially those who have encountered a bug or have + requested a feature, are highly encouraged, but not required. Maintainer reviews **are** required before any merge - - Any PR with the `size/large` label requires 2 review approvals from maintainers before it can be + - Any PR with the `size/large` label requires 2 review approvals from maintainers before it can be merged. Those with `size/medium` are per the judgement of the maintainers 4. Reviewing/Discussion - - Once a maintainer begins reviewing a PR, they will remove the `awaiting review` label and add - the `in progress` label so the person submitting knows that it is being worked on. This is + - Once a maintainer begins reviewing a PR, they will remove the `awaiting review` label and add + the `in progress` label so the person submitting knows that it is being worked on. This is especially helpful when the review may take awhile. - All reviews will be completed using Github review tool. - - A "Comment" review should be used when there are questions about the code that should be + - A "Comment" review should be used when there are questions about the code that should be answered, but that don't involve code changes. This type of review does not count as approval. - A "Changes Requested" review indicates that changes to the code need to be made before they will be merged. - Reviewers should update labels as needed (such as `needs rebase`) 5. Address comments by answering questions or changing code 6. Merge or close - - PRs should stay open until merged or if they have not been active for more than 30 days. - This will help keep the PR queue to a manageable size and reduce noise. Should the PR need + - PRs should stay open until merged or if they have not been active for more than 30 days. + This will help keep the PR queue to a manageable size and reduce noise. Should the PR need to stay open (like in the case of a WIP), the `keep open` label can be added. - If the owner of the PR is listed in `OWNERS`, that user **must** merge their own PRs or explicitly request another OWNER do that for them. @@ -171,14 +173,14 @@ Like any good open source project, we use Pull Requests to track code changes #### Documentation PRs -Documentation PRs will follow the same lifecycle as other PRs. They will also be labeled with the -`docs` label. For documentation, special attention will be paid to spelling, grammar, and clarity +Documentation PRs will follow the same lifecycle as other PRs. They will also be labeled with the +`docs` label. For documentation, special attention will be paid to spelling, grammar, and clarity (whereas those things don't matter *as* much for comments in code). ## The Triager -Each week, one of the core maintainers will serve as the designated "triager" starting after the -public standup meetings on Thursday. This person will be in charge triaging new PRs and issues +Each week, one of the core maintainers will serve as the designated "triager" starting after the +public standup meetings on Thursday. This person will be in charge triaging new PRs and issues throughout the work week. ## Labels @@ -222,11 +224,11 @@ The following tables define all label types used for Helm. It is split up by cat #### Size labels -Size labels are used to indicate how "dangerous" a PR is. The guidelines below are used to assign the -labels, but ultimately this can be changed by the maintainers. For example, even if a PR only makes -30 lines of changes in 1 file, but it changes key functionality, it will likely be labeled as `size/large` -because it requires sign off from multiple people. Conversely, a PR that adds a small feature, but requires -another 150 lines of tests to cover all cases, could be labeled as `size/small` even though the number +Size labels are used to indicate how "dangerous" a PR is. The guidelines below are used to assign the +labels, but ultimately this can be changed by the maintainers. For example, even if a PR only makes +30 lines of changes in 1 file, but it changes key functionality, it will likely be labeled as `size/large` +because it requires sign off from multiple people. Conversely, a PR that adds a small feature, but requires +another 150 lines of tests to cover all cases, could be labeled as `size/small` even though the number lines is greater than defined below. | Label | Description | From fbd42f30cc0b409a4b8c23381409033019539b44 Mon Sep 17 00:00:00 2001 From: fibonacci1729 Date: Thu, 12 Jul 2018 13:26:07 -0600 Subject: [PATCH 277/449] docs(*): update tiller_ssl docs to reflect IP SAN usage. When using helm/tiller in tls-verify mode, 127.0.0.1 should be listed as an IP SAN in the tiller certificate to pass hostname verficiation of the TLS handshake. Closes #4149 --- docs/tiller_ssl.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/tiller_ssl.md b/docs/tiller_ssl.md index 6db195507..963e36e40 100644 --- a/docs/tiller_ssl.md +++ b/docs/tiller_ssl.md @@ -284,6 +284,21 @@ the host name that Helm connects to matches the host name on the certificate. In some cases this is awkward, since Helm will connect over localhost, or the FQDN is not available for public resolution. +*If I use `--tls-verify` on the client, I get `Error: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs`* + +By default, the Helm client connects to Tiller via tunnel (i.e. kube proxy) at 127.0.0.1. During the TLS handshake, +a target, usually provided as a hostname (e.g. example.com), is checked against the subject and subject alternative +names of the certificate (i.e. hostname verficiation). However, because of the tunnel, the target is an IP address. +Therefore, to validate the certificate, the IP address 127.0.0.1 must be listed as an IP subject alternative name +(IP SAN) in the Tiller certificate. + +For example, to list 127.0.0.1 as an IP SAN when generating the Tiller certificate: + +```console +$ echo subjectAltName=IP:127.0.0.1 > extfile.cnf +$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in tiller.csr.pem -out tiller.cert.pem -days 365 -extfile extfile.cnf +``` + *If I use `--tls-verify` on the client, I get `Error: x509: certificate has expired or is not yet valid`* Your helm certificate has expired, you need to sign a new certificate using your private key and the CA (and consider increasing the number of days) From d4745975d97fbe056104d89e029252204ecba9ab Mon Sep 17 00:00:00 2001 From: Dusty Rip Date: Sun, 15 Jul 2018 17:26:27 +0200 Subject: [PATCH 278/449] Allow zsh completion to be autoloaded by compinit --- cmd/helm/completion.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index b1cd04140..e83a32a13 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -82,6 +82,8 @@ func runCompletionBash(out io.Writer, cmd *cobra.Command) error { func runCompletionZsh(out io.Writer, cmd *cobra.Command) error { zshInitialization := ` +#compdef helm + __helm_bash_source() { alias shopt=':' alias _expand=_bash_expand From ae702c5a9ed7d7687ea11de2249575575dd6875b Mon Sep 17 00:00:00 2001 From: fibonacci1729 Date: Mon, 16 Jul 2018 13:40:42 -0600 Subject: [PATCH 279/449] fix(helm): add --tls-hostname flag to tls-flags --- cmd/helm/helm.go | 11 +++++++++-- pkg/tlsutil/cfg.go | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 4c7ca9290..99075b8ab 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -40,6 +40,7 @@ import ( ) var ( + tlsServerName string // overrides the server name used to verify the hostname on the returned certificates from the server. tlsCaCertFile string // path to TLS CA certificate file tlsCertFile string // path to TLS certificate file tlsKeyFile string // path to TLS key file @@ -280,8 +281,13 @@ func newClient() helm.Interface { if tlsKeyFile == "" { tlsKeyFile = settings.Home.TLSKey() } - debug("Key=%q, Cert=%q, CA=%q\n", tlsKeyFile, tlsCertFile, tlsCaCertFile) - tlsopts := tlsutil.Options{KeyFile: tlsKeyFile, CertFile: tlsCertFile, InsecureSkipVerify: true} + debug("Host=%q, Key=%q, Cert=%q, CA=%q\n", tlsKeyFile, tlsCertFile, tlsCaCertFile) + tlsopts := tlsutil.Options{ + ServerName: tlsServerName, + KeyFile: tlsKeyFile, + CertFile: tlsCertFile, + InsecureSkipVerify: true, + } if tlsVerify { tlsopts.CaCertFile = tlsCaCertFile tlsopts.InsecureSkipVerify = false @@ -301,6 +307,7 @@ func newClient() helm.Interface { func addFlagsTLS(cmd *cobra.Command) *cobra.Command { // add flags + cmd.Flags().StringVar(&tlsServerName, "tls-hostname", settings.TillerHost, "the server name used to verify the hostname on the returned certificates from the server") cmd.Flags().StringVar(&tlsCaCertFile, "tls-ca-cert", tlsCaCertDefault, "path to TLS CA certificate file") cmd.Flags().StringVar(&tlsCertFile, "tls-cert", tlsCertDefault, "path to TLS certificate file") cmd.Flags().StringVar(&tlsKeyFile, "tls-key", tlsKeyDefault, "path to TLS key file") diff --git a/pkg/tlsutil/cfg.go b/pkg/tlsutil/cfg.go index 9ce3109e1..3cc18d3d2 100644 --- a/pkg/tlsutil/cfg.go +++ b/pkg/tlsutil/cfg.go @@ -33,6 +33,9 @@ type Options struct { CertFile string // Client-only options InsecureSkipVerify bool + // Overrides the server name used to verify the hostname on the returned + // certificates from the server. + ServerName string // Server-only options ClientAuth tls.ClientAuthType } @@ -55,8 +58,12 @@ func ClientConfig(opts Options) (cfg *tls.Config, err error) { return nil, err } } - - cfg = &tls.Config{InsecureSkipVerify: opts.InsecureSkipVerify, Certificates: []tls.Certificate{*cert}, RootCAs: pool} + cfg = &tls.Config{ + InsecureSkipVerify: opts.InsecureSkipVerify, + Certificates: []tls.Certificate{*cert}, + ServerName: opts.ServerName, + RootCAs: pool, + } return cfg, nil } From 848e6965c2b6754bb09ca729eac859d06629bf29 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 16 Jul 2018 13:46:50 -0600 Subject: [PATCH 280/449] Revert "fix(helm): add `--tls-hostname` flag to tls flags." --- cmd/helm/helm.go | 11 ++--------- docs/tiller_ssl.md | 15 --------------- pkg/tlsutil/cfg.go | 11 ++--------- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 99075b8ab..4c7ca9290 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -40,7 +40,6 @@ import ( ) var ( - tlsServerName string // overrides the server name used to verify the hostname on the returned certificates from the server. tlsCaCertFile string // path to TLS CA certificate file tlsCertFile string // path to TLS certificate file tlsKeyFile string // path to TLS key file @@ -281,13 +280,8 @@ func newClient() helm.Interface { if tlsKeyFile == "" { tlsKeyFile = settings.Home.TLSKey() } - debug("Host=%q, Key=%q, Cert=%q, CA=%q\n", tlsKeyFile, tlsCertFile, tlsCaCertFile) - tlsopts := tlsutil.Options{ - ServerName: tlsServerName, - KeyFile: tlsKeyFile, - CertFile: tlsCertFile, - InsecureSkipVerify: true, - } + debug("Key=%q, Cert=%q, CA=%q\n", tlsKeyFile, tlsCertFile, tlsCaCertFile) + tlsopts := tlsutil.Options{KeyFile: tlsKeyFile, CertFile: tlsCertFile, InsecureSkipVerify: true} if tlsVerify { tlsopts.CaCertFile = tlsCaCertFile tlsopts.InsecureSkipVerify = false @@ -307,7 +301,6 @@ func newClient() helm.Interface { func addFlagsTLS(cmd *cobra.Command) *cobra.Command { // add flags - cmd.Flags().StringVar(&tlsServerName, "tls-hostname", settings.TillerHost, "the server name used to verify the hostname on the returned certificates from the server") cmd.Flags().StringVar(&tlsCaCertFile, "tls-ca-cert", tlsCaCertDefault, "path to TLS CA certificate file") cmd.Flags().StringVar(&tlsCertFile, "tls-cert", tlsCertDefault, "path to TLS certificate file") cmd.Flags().StringVar(&tlsKeyFile, "tls-key", tlsKeyDefault, "path to TLS key file") diff --git a/docs/tiller_ssl.md b/docs/tiller_ssl.md index 963e36e40..6db195507 100644 --- a/docs/tiller_ssl.md +++ b/docs/tiller_ssl.md @@ -284,21 +284,6 @@ the host name that Helm connects to matches the host name on the certificate. In some cases this is awkward, since Helm will connect over localhost, or the FQDN is not available for public resolution. -*If I use `--tls-verify` on the client, I get `Error: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs`* - -By default, the Helm client connects to Tiller via tunnel (i.e. kube proxy) at 127.0.0.1. During the TLS handshake, -a target, usually provided as a hostname (e.g. example.com), is checked against the subject and subject alternative -names of the certificate (i.e. hostname verficiation). However, because of the tunnel, the target is an IP address. -Therefore, to validate the certificate, the IP address 127.0.0.1 must be listed as an IP subject alternative name -(IP SAN) in the Tiller certificate. - -For example, to list 127.0.0.1 as an IP SAN when generating the Tiller certificate: - -```console -$ echo subjectAltName=IP:127.0.0.1 > extfile.cnf -$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in tiller.csr.pem -out tiller.cert.pem -days 365 -extfile extfile.cnf -``` - *If I use `--tls-verify` on the client, I get `Error: x509: certificate has expired or is not yet valid`* Your helm certificate has expired, you need to sign a new certificate using your private key and the CA (and consider increasing the number of days) diff --git a/pkg/tlsutil/cfg.go b/pkg/tlsutil/cfg.go index 3cc18d3d2..9ce3109e1 100644 --- a/pkg/tlsutil/cfg.go +++ b/pkg/tlsutil/cfg.go @@ -33,9 +33,6 @@ type Options struct { CertFile string // Client-only options InsecureSkipVerify bool - // Overrides the server name used to verify the hostname on the returned - // certificates from the server. - ServerName string // Server-only options ClientAuth tls.ClientAuthType } @@ -58,12 +55,8 @@ func ClientConfig(opts Options) (cfg *tls.Config, err error) { return nil, err } } - cfg = &tls.Config{ - InsecureSkipVerify: opts.InsecureSkipVerify, - Certificates: []tls.Certificate{*cert}, - ServerName: opts.ServerName, - RootCAs: pool, - } + + cfg = &tls.Config{InsecureSkipVerify: opts.InsecureSkipVerify, Certificates: []tls.Certificate{*cert}, RootCAs: pool} return cfg, nil } From eba139a6f95b772b4117bc60683ebe5c957092b3 Mon Sep 17 00:00:00 2001 From: "A. Stiles" Date: Mon, 16 Jul 2018 15:47:15 -0500 Subject: [PATCH 281/449] Include exact details to configure storage=secret --- docs/securing_installation.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index f192ad9f8..a489cc837 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -65,7 +65,7 @@ For historical reasons, Tiller stores its release information in ConfigMaps. We Secrets are the Kubernetes accepted mechanism for saving configuration data that is considered sensitive. While secrets don't themselves offer many protections, Kubernetes cluster management software often treats them differently than other objects. Thus, we suggest using secrets to store releases. -Enabling this feature currently requires setting the `--storage=secret` flag in the tiller-deploy deployment. This entails directly modifying the deployment or using `helm init --override=...`, as no helm init flag is currently available to do this for you. For more information, see [Using --override](install.md#using---override). +Enabling this feature currently requires setting the `--storage=secret` flag in the tiller-deploy deployment. This entails directly modifying the deployment or using `helm init --override 'spec.template.spec.containers[0].command'='{/tiller,--storage=secret}'`, as no helm init flag is currently available to do this for you. ### Thinking about Charts @@ -93,6 +93,7 @@ If these steps are followed, an example `helm init` command might look something ```bash $ helm init \ +--override 'spec.template.spec.containers[0].command'='{/tiller,--storage=secret}' \ --tiller-tls \ --tiller-tls-verify \ --tiller-tls-cert=cert.pem \ @@ -101,7 +102,7 @@ $ helm init \ --service-account=accountname ``` -This command will start Tiller with both strong authentication over gRPC, and a service account to which RBAC policies have been applied. +This command will start Tiller with strong authentication over gRPC, release information stored in a Kubernetes Secret, and a service account to which RBAC policies have been applied. From 29d603969c31af20cb8726508290a248bd276bb6 Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Mon, 16 Jul 2018 17:10:16 -0700 Subject: [PATCH 282/449] [fake] make InstallReleaseFromChart obey DryRun --- pkg/helm/fake.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index 2f0ad90b8..39909cfcd 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -97,7 +97,9 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts } release := ReleaseMock(&MockReleaseOptions{Name: releaseName, Namespace: ns, Description: releaseDescription}) - c.Rels = append(c.Rels, release) + if !c.Opts.dryRun { + c.Rels = append(c.Rels, release) + } return &rls.InstallReleaseResponse{ Release: release, From 9c0d3fcb79f50a360e085b6e786dffe6972b02a0 Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Mon, 16 Jul 2018 17:15:56 -0700 Subject: [PATCH 283/449] [fake] return the correct error message for missing releases --- pkg/helm/fake.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index 39909cfcd..05235c92a 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -18,7 +18,6 @@ package helm // import "k8s.io/helm/pkg/helm" import ( "errors" - "fmt" "math/rand" "sync" @@ -27,6 +26,7 @@ import ( "k8s.io/helm/pkg/proto/hapi/release" rls "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/proto/hapi/version" + storage "k8s.io/helm/pkg/storage/driver" ) // FakeClient implements Interface @@ -117,7 +117,7 @@ func (c *FakeClient) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.U } } - return nil, fmt.Errorf("No such release: %s", rlsName) + return nil, storage.ErrReleaseNotFound(rlsName) } // GetVersion returns a fake version @@ -161,7 +161,7 @@ func (c *FakeClient) ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.G }, nil } } - return nil, fmt.Errorf("No such release: %s", rlsName) + return nil, storage.ErrReleaseNotFound(rlsName) } // ReleaseContent returns the configuration for the matching release name in the fake release client. @@ -173,7 +173,7 @@ func (c *FakeClient) ReleaseContent(rlsName string, opts ...ContentOption) (resp }, nil } } - return resp, fmt.Errorf("No such release: %s", rlsName) + return resp, storage.ErrReleaseNotFound(rlsName) } // ReleaseHistory returns a release's revision history. From d6157d10a7d98613c5e673d58ded0399748fb51e Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 18 Jul 2018 16:01:11 -0400 Subject: [PATCH 284/449] helm template cmd - conformity of output (#3811) By changing a string from `##---` to `---` the output written to files matches the output generated to stdout. --- cmd/helm/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 7e3eb48a7..9ba217871 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -309,7 +309,7 @@ func writeToFile(outputDir string, name string, data string) error { defer f.Close() - _, err = f.WriteString(fmt.Sprintf("##---\n# Source: %s\n%s", name, data)) + _, err = f.WriteString(fmt.Sprintf("---\n# Source: %s\n%s", name, data)) if err != nil { return err From d4963ba151025ba481a676803e028c9a2905b134 Mon Sep 17 00:00:00 2001 From: Ihor Dvoretskyi Date: Thu, 19 Jul 2018 01:54:06 +0300 Subject: [PATCH 285/449] Slack channels now have URL's --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fc091056e..0b3d90247 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,9 @@ The [Helm roadmap uses Github milestones](https://github.com/kubernetes/helm/mil You can reach the Helm community and developers via the following channels: - [Kubernetes Slack](http://slack.k8s.io): - - #helm-users - - #helm-dev - - #charts + - [#helm-users](https://kubernetes.slack.com/messages/helm-users) + - [#helm-dev](https://kubernetes.slack.com/messages/helm-dev) + - [#charts](https://kubernetes.slack.com/messages/charts) - Mailing Lists: - [Helm Mailing List](https://lists.cncf.io/g/cncf-kubernetes-helm) - [Kubernetes SIG Apps Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-apps) From e60288f7ba624b6f1729b33964e319bd9e5ddc7c Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Fri, 20 Jul 2018 12:12:08 -0400 Subject: [PATCH 286/449] ref(docs): add more links to tiller rbac info --- docs/install.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/install.md b/docs/install.md index 17905a805..cc7f75a3a 100755 --- a/docs/install.md +++ b/docs/install.md @@ -122,6 +122,7 @@ You can explicitly tell `helm init` to... - Install a particular image (version) with `--tiller-image` - Install to a particular cluster with `--kube-context` - Install into a particular namespace with `--tiller-namespace` +- Install Tiller with a Service Account with `--service-account` (for [RBAC enabled clusters](securing_installation.md#rbac)) Once Tiller is installed, running `helm version` should show you both the client and server version. (If it shows only the client version, From 536cd58baf6caf6c48bb0f023b8e9284c384ee48 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Fri, 20 Jul 2018 13:23:43 -0400 Subject: [PATCH 287/449] docs(rbac.md): delete redundant step --- docs/rbac.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/rbac.md b/docs/rbac.md index 36d06e62a..4af36203c 100644 --- a/docs/rbac.md +++ b/docs/rbac.md @@ -14,11 +14,6 @@ Once you have satisfied the pre-requisite and have a service account with the co ### Example: Service account with cluster-admin role -```console -$ kubectl create serviceaccount tiller --namespace kube-system -serviceaccount "tiller" created -``` - In `rbac-config.yaml`: ```yaml From a99d591dd29232a027baf835550eae6c8e55d27f Mon Sep 17 00:00:00 2001 From: Dan Clarke Date: Fri, 20 Jul 2018 18:42:17 +0100 Subject: [PATCH 288/449] Add missing space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Yeah, I know - very trivial, but ¯\_(ツ)_/¯ :) --- docs/quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quickstart.md b/docs/quickstart.md index 52a7c800f..8622137b2 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -65,7 +65,7 @@ This will install Tiller into the Kubernetes cluster you saw with **TIP:** When you want to upgrade Tiller, just run `helm init --upgrade`. -By default, when Tiller is installed,it does not have authentication enabled. +By default, when Tiller is installed, it does not have authentication enabled. To learn more about configuring strong TLS authentication for Tiller, consult [the Tiller TLS guide](tiller_ssl.md). From 5cc7cd31442d719cee6c32fcca1a3f5dcf688def Mon Sep 17 00:00:00 2001 From: Rohan Chakravarthy Date: Mon, 23 Jul 2018 12:40:54 -0700 Subject: [PATCH 289/449] feat(helm): Add the --kubeconfig flag (#4235) Adds the ability to specify a kubeconfig file that overrides $KUBECONFIG --- cmd/helm/helm.go | 14 +++++++------- cmd/helm/init.go | 4 ++-- cmd/helm/install.go | 2 +- cmd/helm/reset.go | 2 +- cmd/helm/version.go | 8 +++++--- docs/helm/helm.md | 3 ++- docs/helm/helm_completion.md | 3 ++- docs/helm/helm_create.md | 3 ++- docs/helm/helm_delete.md | 3 ++- docs/helm/helm_dependency.md | 3 ++- docs/helm/helm_dependency_build.md | 3 ++- docs/helm/helm_dependency_list.md | 3 ++- docs/helm/helm_dependency_update.md | 3 ++- docs/helm/helm_fetch.md | 3 +++ docs/helm/helm_get.md | 3 ++- docs/helm/helm_get_hooks.md | 3 ++- docs/helm/helm_get_manifest.md | 3 ++- docs/helm/helm_get_values.md | 3 ++- docs/helm/helm_history.md | 3 ++- docs/helm/helm_home.md | 3 ++- docs/helm/helm_init.md | 3 ++- docs/helm/helm_inspect.md | 3 ++- docs/helm/helm_inspect_chart.md | 3 ++- docs/helm/helm_inspect_readme.md | 3 ++- docs/helm/helm_inspect_values.md | 3 ++- docs/helm/helm_install.md | 3 ++- docs/helm/helm_lint.md | 3 ++- docs/helm/helm_list.md | 3 ++- docs/helm/helm_package.md | 3 ++- docs/helm/helm_plugin.md | 3 ++- docs/helm/helm_plugin_install.md | 3 ++- docs/helm/helm_plugin_list.md | 3 ++- docs/helm/helm_plugin_remove.md | 3 ++- docs/helm/helm_plugin_update.md | 3 ++- docs/helm/helm_repo.md | 3 ++- docs/helm/helm_repo_add.md | 3 ++- docs/helm/helm_repo_index.md | 3 ++- docs/helm/helm_repo_list.md | 3 ++- docs/helm/helm_repo_remove.md | 3 ++- docs/helm/helm_repo_update.md | 3 ++- docs/helm/helm_reset.md | 3 ++- docs/helm/helm_rollback.md | 3 ++- docs/helm/helm_search.md | 3 ++- docs/helm/helm_serve.md | 3 ++- docs/helm/helm_status.md | 3 ++- docs/helm/helm_template.md | 3 ++- docs/helm/helm_test.md | 3 ++- docs/helm/helm_upgrade.md | 3 ++- docs/helm/helm_verify.md | 3 ++- docs/helm/helm_version.md | 3 ++- pkg/helm/environment/environment.go | 3 +++ pkg/helm/environment/environment_test.go | 10 +++++++--- pkg/kube/config.go | 11 +++++++++-- 53 files changed, 126 insertions(+), 63 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 4c7ca9290..be3ced376 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -169,7 +169,7 @@ func markDeprecated(cmd *cobra.Command, notice string) *cobra.Command { func setupConnection() error { if settings.TillerHost == "" { - config, client, err := getKubeClient(settings.KubeContext) + config, client, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return err } @@ -223,8 +223,8 @@ func prettyError(err error) error { } // configForContext creates a Kubernetes REST client configuration for a given kubeconfig context. -func configForContext(context string) (*rest.Config, error) { - config, err := kube.GetConfig(context).ClientConfig() +func configForContext(context string, kubeconfig string) (*rest.Config, error) { + config, err := kube.GetConfig(context, kubeconfig).ClientConfig() if err != nil { return nil, fmt.Errorf("could not get Kubernetes config for context %q: %s", context, err) } @@ -232,8 +232,8 @@ func configForContext(context string) (*rest.Config, error) { } // getKubeClient creates a Kubernetes config and client for a given kubeconfig context. -func getKubeClient(context string) (*rest.Config, kubernetes.Interface, error) { - config, err := configForContext(context) +func getKubeClient(context string, kubeconfig string) (*rest.Config, kubernetes.Interface, error) { + config, err := configForContext(context, kubeconfig) if err != nil { return nil, nil, err } @@ -247,8 +247,8 @@ func getKubeClient(context string) (*rest.Config, kubernetes.Interface, error) { // getInternalKubeClient creates a Kubernetes config and an "internal" client for a given kubeconfig context. // // Prefer the similar getKubeClient if you don't need to use such an internal client. -func getInternalKubeClient(context string) (internalclientset.Interface, error) { - config, err := configForContext(context) +func getInternalKubeClient(context string, kubeconfig string) (internalclientset.Interface, error) { + config, err := configForContext(context, kubeconfig) if err != nil { return nil, err } diff --git a/cmd/helm/init.go b/cmd/helm/init.go index e2fb694bc..51bf2139c 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -258,7 +258,7 @@ func (i *initCmd) run() error { if !i.clientOnly { if i.kubeClient == nil { - _, c, err := getKubeClient(settings.KubeContext) + _, c, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return fmt.Errorf("could not get kubernetes client: %s", err) } @@ -301,7 +301,7 @@ func (i *initCmd) run() error { func (i *initCmd) ping() error { if i.wait { - _, kubeClient, err := getKubeClient(settings.KubeContext) + _, kubeClient, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return err } diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 401611935..61de8d63b 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -501,7 +501,7 @@ func generateName(nameTemplate string) (string, error) { } func defaultNamespace() string { - if ns, _, err := kube.GetConfig(settings.KubeContext).Namespace(); err == nil { + if ns, _, err := kube.GetConfig(settings.KubeContext, settings.KubeConfig).Namespace(); err == nil { return ns } return "default" diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index 9d3e17e03..1fe0ce39f 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -86,7 +86,7 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { // runReset uninstalls tiller from Kubernetes Cluster and deletes local config func (d *resetCmd) run() error { if d.kubeClient == nil { - c, err := getInternalKubeClient(settings.KubeContext) + c, err := getInternalKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return fmt.Errorf("could not get kubernetes client: %s", err) } diff --git a/cmd/helm/version.go b/cmd/helm/version.go index d541067a0..407c2bf43 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -76,7 +76,10 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { if version.showServer { // We do this manually instead of in PreRun because we only // need a tunnel if server version is requested. - setupConnection() + err := setupConnection() + if err != nil { + return err + } } version.client = ensureHelmClient(version.client) return version.run() @@ -115,7 +118,6 @@ func (v *versionCmd) run() error { } fmt.Fprintf(v.out, "Kubernetes: %#v\n", k8sVersion) } - resp, err := v.client.GetVersion() if err != nil { if grpc.Code(err) == codes.Unimplemented { @@ -135,7 +137,7 @@ func (v *versionCmd) run() error { func getK8sVersion() (*apiVersion.Info, error) { var v *apiVersion.Info - _, client, err := getKubeClient(settings.KubeContext) + _, client, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return v, err } diff --git a/docs/helm/helm.md b/docs/helm/helm.md index 8592cad7c..ae27de401 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -36,6 +36,7 @@ Environment: --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -68,4 +69,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_completion.md b/docs/helm/helm_completion.md index 994205d88..64a6056f8 100644 --- a/docs/helm/helm_completion.md +++ b/docs/helm/helm_completion.md @@ -28,6 +28,7 @@ helm completion SHELL --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -35,4 +36,4 @@ helm completion SHELL ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index 6e0f3de78..7ae947ed7 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -47,6 +47,7 @@ helm create NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -54,4 +55,4 @@ helm create NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index 9eee6e8ec..e181f439e 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -39,6 +39,7 @@ helm delete [flags] RELEASE_NAME [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -46,4 +47,4 @@ helm delete [flags] RELEASE_NAME [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 13-Apr-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_dependency.md b/docs/helm/helm_dependency.md index 34d49e20a..b0085c6c7 100644 --- a/docs/helm/helm_dependency.md +++ b/docs/helm/helm_dependency.md @@ -61,6 +61,7 @@ for this case. --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -71,4 +72,4 @@ for this case. * [helm dependency list](helm_dependency_list.md) - list the dependencies for the given chart * [helm dependency update](helm_dependency_update.md) - update charts/ based on the contents of requirements.yaml -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_dependency_build.md b/docs/helm/helm_dependency_build.md index 0413a9a85..eea2fa02c 100644 --- a/docs/helm/helm_dependency_build.md +++ b/docs/helm/helm_dependency_build.md @@ -34,6 +34,7 @@ helm dependency build [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -41,4 +42,4 @@ helm dependency build [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_dependency_list.md b/docs/helm/helm_dependency_list.md index b4343081c..d6bc0175a 100644 --- a/docs/helm/helm_dependency_list.md +++ b/docs/helm/helm_dependency_list.md @@ -26,6 +26,7 @@ helm dependency list [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -33,4 +34,4 @@ helm dependency list [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_dependency_update.md b/docs/helm/helm_dependency_update.md index 3c90ff779..90b81ecea 100644 --- a/docs/helm/helm_dependency_update.md +++ b/docs/helm/helm_dependency_update.md @@ -39,6 +39,7 @@ helm dependency update [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -46,4 +47,4 @@ helm dependency update [flags] CHART ### SEE ALSO * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_fetch.md b/docs/helm/helm_fetch.md index 1ddef65fa..c347d1620 100644 --- a/docs/helm/helm_fetch.md +++ b/docs/helm/helm_fetch.md @@ -50,9 +50,12 @@ helm fetch [flags] [chart URL | repo/chartname] [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. + +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index 9cd70e520..f233cd2a7 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -40,6 +40,7 @@ helm get [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -50,4 +51,4 @@ helm get [flags] RELEASE_NAME * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_get_hooks.md b/docs/helm/helm_get_hooks.md index 85fa5d04b..4f9fa1887 100644 --- a/docs/helm/helm_get_hooks.md +++ b/docs/helm/helm_get_hooks.md @@ -33,6 +33,7 @@ helm get hooks [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -40,4 +41,4 @@ helm get hooks [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_get_manifest.md b/docs/helm/helm_get_manifest.md index a00c1be56..3ae55ef3e 100644 --- a/docs/helm/helm_get_manifest.md +++ b/docs/helm/helm_get_manifest.md @@ -35,6 +35,7 @@ helm get manifest [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -42,4 +43,4 @@ helm get manifest [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index d8944b475..12d973122 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -32,6 +32,7 @@ helm get values [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -39,4 +40,4 @@ helm get values [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index ac51a8994..437e70f03 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -45,6 +45,7 @@ helm history [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -52,4 +53,4 @@ helm history [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_home.md b/docs/helm/helm_home.md index bdccd756f..9af12c91a 100644 --- a/docs/helm/helm_home.md +++ b/docs/helm/helm_home.md @@ -21,6 +21,7 @@ helm home --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -28,4 +29,4 @@ helm home ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index 5374488af..ec775520a 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -64,6 +64,7 @@ helm init --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -71,4 +72,4 @@ helm init ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index e46b3dbf4..4bc904f63 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -37,6 +37,7 @@ helm inspect [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -47,4 +48,4 @@ helm inspect [CHART] * [helm inspect readme](helm_inspect_readme.md) - shows inspect readme * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index cd1328b59..257f26051 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -35,6 +35,7 @@ helm inspect chart [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -42,4 +43,4 @@ helm inspect chart [CHART] ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_inspect_readme.md b/docs/helm/helm_inspect_readme.md index 9dd9ebd43..8ff7d892e 100644 --- a/docs/helm/helm_inspect_readme.md +++ b/docs/helm/helm_inspect_readme.md @@ -33,6 +33,7 @@ helm inspect readme [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -40,4 +41,4 @@ helm inspect readme [CHART] ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index 6a907cc7d..50ff6ac24 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -35,6 +35,7 @@ helm inspect values [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -42,4 +43,4 @@ helm inspect values [CHART] ### SEE ALSO * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 62d02cc38..dbb087964 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -112,6 +112,7 @@ helm install [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -119,4 +120,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 5-Jun-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index c10322efd..319939bcf 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -35,6 +35,7 @@ helm lint [flags] PATH --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -42,4 +43,4 @@ helm lint [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 20-May-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index 99872a413..c7e99e403 100755 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -67,6 +67,7 @@ helm list [flags] [FILTER] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -74,4 +75,4 @@ helm list [flags] [FILTER] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Apr-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index 21090fa45..30d06fcf0 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -40,6 +40,7 @@ helm package [flags] [CHART_PATH] [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -47,4 +48,4 @@ helm package [flags] [CHART_PATH] [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 16-Apr-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_plugin.md b/docs/helm/helm_plugin.md index cc42aa4dc..bb0498d87 100644 --- a/docs/helm/helm_plugin.md +++ b/docs/helm/helm_plugin.md @@ -16,6 +16,7 @@ Manage client-side Helm plugins. --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -27,4 +28,4 @@ Manage client-side Helm plugins. * [helm plugin remove](helm_plugin_remove.md) - remove one or more Helm plugins * [helm plugin update](helm_plugin_update.md) - update one or more Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_plugin_install.md b/docs/helm/helm_plugin_install.md index 196ca97dd..ab45850bf 100644 --- a/docs/helm/helm_plugin_install.md +++ b/docs/helm/helm_plugin_install.md @@ -29,6 +29,7 @@ helm plugin install [options] ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -36,4 +37,4 @@ helm plugin install [options] ... ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_plugin_list.md b/docs/helm/helm_plugin_list.md index ddfd04ee6..dc13cdf7a 100644 --- a/docs/helm/helm_plugin_list.md +++ b/docs/helm/helm_plugin_list.md @@ -18,6 +18,7 @@ helm plugin list --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -25,4 +26,4 @@ helm plugin list ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_plugin_remove.md b/docs/helm/helm_plugin_remove.md index 8543a367a..2ef833217 100644 --- a/docs/helm/helm_plugin_remove.md +++ b/docs/helm/helm_plugin_remove.md @@ -18,6 +18,7 @@ helm plugin remove ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -25,4 +26,4 @@ helm plugin remove ... ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_plugin_update.md b/docs/helm/helm_plugin_update.md index 9e5e205f0..93bc3e764 100644 --- a/docs/helm/helm_plugin_update.md +++ b/docs/helm/helm_plugin_update.md @@ -18,6 +18,7 @@ helm plugin update ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -25,4 +26,4 @@ helm plugin update ... ### SEE ALSO * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_repo.md b/docs/helm/helm_repo.md index 4109ceca4..32e9d02b2 100644 --- a/docs/helm/helm_repo.md +++ b/docs/helm/helm_repo.md @@ -20,6 +20,7 @@ Example usage: --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -32,4 +33,4 @@ Example usage: * [helm repo remove](helm_repo_remove.md) - remove a chart repository * [helm repo update](helm_repo_update.md) - update information of available charts locally from chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_repo_add.md b/docs/helm/helm_repo_add.md index 456ffa27e..1deb0cb5c 100644 --- a/docs/helm/helm_repo_add.md +++ b/docs/helm/helm_repo_add.md @@ -29,6 +29,7 @@ helm repo add [flags] [NAME] [URL] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -36,4 +37,4 @@ helm repo add [flags] [NAME] [URL] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_repo_index.md b/docs/helm/helm_repo_index.md index 14b412b29..baa1291de 100644 --- a/docs/helm/helm_repo_index.md +++ b/docs/helm/helm_repo_index.md @@ -34,6 +34,7 @@ helm repo index [flags] [DIR] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -41,4 +42,4 @@ helm repo index [flags] [DIR] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_repo_list.md b/docs/helm/helm_repo_list.md index 858ef957f..00221ed24 100644 --- a/docs/helm/helm_repo_list.md +++ b/docs/helm/helm_repo_list.md @@ -18,6 +18,7 @@ helm repo list [flags] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -25,4 +26,4 @@ helm repo list [flags] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_repo_remove.md b/docs/helm/helm_repo_remove.md index 801bc3c3f..272ecea47 100644 --- a/docs/helm/helm_repo_remove.md +++ b/docs/helm/helm_repo_remove.md @@ -18,6 +18,7 @@ helm repo remove [flags] [NAME] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -25,4 +26,4 @@ helm repo remove [flags] [NAME] ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_repo_update.md b/docs/helm/helm_repo_update.md index 897ed24b7..f0215da48 100644 --- a/docs/helm/helm_repo_update.md +++ b/docs/helm/helm_repo_update.md @@ -24,6 +24,7 @@ helm repo update --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -31,4 +32,4 @@ helm repo update ### SEE ALSO * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index ed68b1b84..507a94bfd 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -34,6 +34,7 @@ helm reset --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -41,4 +42,4 @@ helm reset ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index ae64a0a26..b40fb883a 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -41,6 +41,7 @@ helm rollback [flags] [RELEASE] [REVISION] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -48,4 +49,4 @@ helm rollback [flags] [RELEASE] [REVISION] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 13-Apr-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_search.md b/docs/helm/helm_search.md index 1ed04e880..ffee22ce4 100644 --- a/docs/helm/helm_search.md +++ b/docs/helm/helm_search.md @@ -32,6 +32,7 @@ helm search [keyword] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -39,4 +40,4 @@ helm search [keyword] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 23-Apr-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index 90ebb6da9..e300ee633 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -39,6 +39,7 @@ helm serve --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -46,4 +47,4 @@ helm serve ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_status.md b/docs/helm/helm_status.md index 02ec0ad66..5317875e6 100644 --- a/docs/helm/helm_status.md +++ b/docs/helm/helm_status.md @@ -39,6 +39,7 @@ helm status [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -46,4 +47,4 @@ helm status [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index cdc8a84a6..81c7fa00e 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -45,6 +45,7 @@ helm template [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -52,4 +53,4 @@ helm template [flags] CHART ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 22-May-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index 062244e73..688b67a34 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -35,6 +35,7 @@ helm test [RELEASE] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -42,4 +43,4 @@ helm test [RELEASE] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index b952624a5..d83231fcb 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -75,6 +75,7 @@ helm upgrade [RELEASE] [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -82,4 +83,4 @@ helm upgrade [RELEASE] [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 4-Apr-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_verify.md b/docs/helm/helm_verify.md index bc5343937..866b3fbd8 100644 --- a/docs/helm/helm_verify.md +++ b/docs/helm/helm_verify.md @@ -33,6 +33,7 @@ helm verify [flags] PATH --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -40,4 +41,4 @@ helm verify [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index 1f48cceba..61636c404 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -48,6 +48,7 @@ helm version --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` @@ -55,4 +56,4 @@ helm version ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 17-Jun-2018 diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index 2980e6dc9..9b0acce4c 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -49,6 +49,8 @@ type EnvSettings struct { Debug bool // KubeContext is the name of the kubeconfig context. KubeContext string + // KubeConfig is the path to an explicit kubeconfig file. This overwrites the value in $KUBECONFIG + KubeConfig string } // AddFlags binds flags to the given flagset. @@ -56,6 +58,7 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.StringVar((*string)(&s.Home), "home", DefaultHelmHome, "location of your Helm config. Overrides $HELM_HOME") fs.StringVar(&s.TillerHost, "host", "", "address of Tiller. Overrides $HELM_HOST") fs.StringVar(&s.KubeContext, "kube-context", "", "name of the kubeconfig context to use") + fs.StringVar(&s.KubeConfig, "kubeconfig", "", "absolute path to the kubeconfig file to use") fs.BoolVar(&s.Debug, "debug", false, "enable verbose output") fs.StringVar(&s.TillerNamespace, "tiller-namespace", "kube-system", "namespace of Tiller") fs.Int64Var(&s.TillerConnectionTimeout, "tiller-connection-timeout", int64(300), "the duration (in seconds) Helm will wait to establish a connection to tiller") diff --git a/pkg/helm/environment/environment_test.go b/pkg/helm/environment/environment_test.go index 8f0caa388..c7d65cd5a 100644 --- a/pkg/helm/environment/environment_test.go +++ b/pkg/helm/environment/environment_test.go @@ -35,8 +35,8 @@ func TestEnvSettings(t *testing.T) { envars map[string]string // expected values - home, host, ns, kcontext, plugins string - debug bool + home, host, ns, kcontext, kconfig, plugins string + debug bool }{ { name: "defaults", @@ -47,11 +47,12 @@ func TestEnvSettings(t *testing.T) { }, { name: "with flags set", - args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns"}, + args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns", "--kubeconfig", "/bar"}, home: "/foo", plugins: helmpath.Home("/foo").Plugins(), host: "here", ns: "myns", + kconfig: "/bar", debug: true, }, { @@ -111,6 +112,9 @@ func TestEnvSettings(t *testing.T) { if settings.KubeContext != tt.kcontext { t.Errorf("expected kube-context %q, got %q", tt.kcontext, settings.KubeContext) } + if settings.KubeConfig != tt.kconfig { + t.Errorf("expected kubeconfig %q, got %q", tt.kconfig, settings.KubeConfig) + } cleanup() }) diff --git a/pkg/kube/config.go b/pkg/kube/config.go index b6560486e..ac0a9015d 100644 --- a/pkg/kube/config.go +++ b/pkg/kube/config.go @@ -16,10 +16,12 @@ limitations under the License. package kube // import "k8s.io/helm/pkg/kube" -import "k8s.io/client-go/tools/clientcmd" +import ( + "k8s.io/client-go/tools/clientcmd" +) // GetConfig returns a Kubernetes client config for a given context. -func GetConfig(context string) clientcmd.ClientConfig { +func GetConfig(context string, kubeconfig string) clientcmd.ClientConfig { rules := clientcmd.NewDefaultClientConfigLoadingRules() rules.DefaultClientConfig = &clientcmd.DefaultClientConfig @@ -28,5 +30,10 @@ func GetConfig(context string) clientcmd.ClientConfig { if context != "" { overrides.CurrentContext = context } + + if kubeconfig != "" { + rules.ExplicitPath = kubeconfig + } + return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides) } From 133c3c08379551de44f238be209b2c6a8ba685d5 Mon Sep 17 00:00:00 2001 From: KUOKA Yusuke Date: Tue, 24 Jul 2018 04:49:42 +0900 Subject: [PATCH 290/449] feat(helm): Detailed exit code for helm plugins (#4367) Resolves #4170 --- cmd/helm/helm.go | 7 ++++++- cmd/helm/load_plugins.go | 12 +++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index be3ced376..3f859392d 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -158,7 +158,12 @@ func init() { func main() { cmd := newRootCmd(os.Args[1:]) if err := cmd.Execute(); err != nil { - os.Exit(1) + switch e := err.(type) { + case pluginError: + os.Exit(e.code) + default: + os.Exit(1) + } } } diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index f4c97bde7..67de8bae5 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -22,12 +22,18 @@ import ( "os/exec" "path/filepath" "strings" + "syscall" "github.com/spf13/cobra" "k8s.io/helm/pkg/plugin" ) +type pluginError struct { + error + code int +} + // loadPlugins loads plugins into the command list. // // This follows a different pattern than the other commands because it has @@ -87,7 +93,11 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) { if err := prog.Run(); err != nil { if eerr, ok := err.(*exec.ExitError); ok { os.Stderr.Write(eerr.Stderr) - return fmt.Errorf("plugin %q exited with error", md.Name) + status := eerr.Sys().(syscall.WaitStatus) + return pluginError{ + error: fmt.Errorf("plugin %q exited with error", md.Name), + code: status.ExitStatus(), + } } return err } From 61d939d2f22c0a310c9019bf95e57fb5c119eec9 Mon Sep 17 00:00:00 2001 From: Ihor Dvoretskyi Date: Mon, 23 Jul 2018 22:51:24 +0300 Subject: [PATCH 291/449] Snap installation information added (#4366) * Snap installation information added Signed-off-by: Ihor Dvoretskyi * Moved Snap instructions to the different section Signed-off-by: Ihor Dvoretskyi --- docs/install.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/install.md b/docs/install.md index cc7f75a3a..52b55baef 100755 --- a/docs/install.md +++ b/docs/install.md @@ -24,6 +24,15 @@ can be manually downloaded and installed. From there, you should be able to run the client: `helm help`. +### From Snap (Linux) + +The Snap package for Helm is maintained by +[Snapcrafters](https://github.com/snapcrafters/helm). + +``` +$ sudo snap install helm +``` + ### From Homebrew (macOS) Members of the Kubernetes community have contributed a Helm formula build to From 73d2077ae46e3efaf2ccf2d0cb02bdc15849c0b4 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Mon, 23 Jul 2018 15:26:40 -0600 Subject: [PATCH 292/449] docs(OWNERS): add rimusz as emeritus maintainer (#4357) This PR was approved by vote of the core maintainers. It adds Rimus, one of the project's founders, as an emeritus Helm maintainer. --- OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/OWNERS b/OWNERS index 32b26efa2..39f8c8448 100644 --- a/OWNERS +++ b/OWNERS @@ -28,3 +28,4 @@ emeritus: - migmartri - seh - vaikas-google + - rimusz From 19785cb40d4710ed173039b693533f8d6f2f22ad Mon Sep 17 00:00:00 2001 From: nashasha1 Date: Tue, 24 Jul 2018 23:49:50 +0800 Subject: [PATCH 293/449] Dashes are not allowed in the name --- docs/chart_best_practices/conventions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/chart_best_practices/conventions.md b/docs/chart_best_practices/conventions.md index 324ef88f9..4d080ceb1 100644 --- a/docs/chart_best_practices/conventions.md +++ b/docs/chart_best_practices/conventions.md @@ -4,14 +4,14 @@ This part of the Best Practices Guide explains general conventions. ## Chart Names -Chart names should be lower case letters and numbers. Words _may_ be separated with dashes (-): +Chart names should be lower case letters and numbers. Dashes (-) are not allowed: Examples: ``` drupal -nginx-lego -aws-cluster-autoscaler +cluster01 +aws-cluster-autoscaler #incorrect do not use dashes in the name ``` Neither uppercase letters nor underscores should be used in chart names. Dots should not be used in chart names. From 5de955d6061b0ccd49d3827fb89492f97c36a566 Mon Sep 17 00:00:00 2001 From: KUOKA Yusuke Date: Thu, 26 Jul 2018 06:12:40 +0900 Subject: [PATCH 294/449] feat: Set values from local files (#3758) Adds the `--set-file key=filepath` flag to `install`, `upgrade`, `template` and `lint` sub-commands so that the content of the file at the `filepath` is set to the value for the `key`. Resolves #1754 --- cmd/helm/install.go | 28 +++++++++--- cmd/helm/lint.go | 19 ++++++++ cmd/helm/template.go | 4 +- cmd/helm/upgrade.go | 11 +++-- docs/chart_best_practices/values.md | 1 + docs/helm/helm_install.md | 12 +++-- docs/helm/helm_lint.md | 3 +- docs/helm/helm_template.md | 3 +- docs/helm/helm_upgrade.md | 9 ++-- docs/using_helm.md | 31 ++++++++++++- pkg/strvals/parser.go | 69 ++++++++++++++++++++++++----- pkg/strvals/parser_test.go | 33 ++++++++++++++ 12 files changed, 193 insertions(+), 30 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 61de8d63b..003466146 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -50,8 +50,10 @@ The install argument must be a chart reference, a path to a packaged chart, a path to an unpacked chart directory or a URL. To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line, to force -a string value use '--set-string'. +or use the '--set' flag and pass configuration from the command line. To force string +values in '--set', use '--set-string' instead. In case a value is large and therefore +you want not to use neither '--values' nor '--set', use '--set-file' to read the +single large value from file. $ helm install -f myvalues.yaml ./redis @@ -63,6 +65,9 @@ or $ helm install --set-string long_int=1234567890 ./redis +or + $ helm install --set-file multiline_text=path/to/textfile + You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml contained a key called 'Test', the value set in override.yaml would take precedence: @@ -120,6 +125,7 @@ type installCmd struct { client helm.Interface values []string stringValues []string + fileValues []string nameTemplate string version string timeout int64 @@ -196,6 +202,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&inst.replace, "replace", false, "re-use the given name, even if that name is already used. This is unsafe in production") f.StringArrayVar(&inst.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringArrayVar(&inst.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&inst.fileValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)") f.StringVar(&inst.nameTemplate, "name-template", "", "specify template used to name the release") f.BoolVar(&inst.verify, "verify", false, "verify the package before installing it") f.StringVar(&inst.keyring, "keyring", defaultKeyring(), "location of public keys used for verification") @@ -222,7 +229,7 @@ func (i *installCmd) run() error { i.namespace = defaultNamespace() } - rawVals, err := vals(i.valueFiles, i.values, i.stringValues, i.certFile, i.keyFile, i.caFile) + rawVals, err := vals(i.valueFiles, i.values, i.stringValues, i.fileValues, i.certFile, i.keyFile, i.caFile) if err != nil { return err } @@ -353,8 +360,8 @@ func mergeValues(dest map[string]interface{}, src map[string]interface{}) map[st } // vals merges values from files specified via -f/--values and -// directly via --set or --set-string, marshaling them to YAML -func vals(valueFiles valueFiles, values []string, stringValues []string, CertFile, KeyFile, CAFile string) ([]byte, error) { +// directly via --set or --set-string or --set-file, marshaling them to YAML +func vals(valueFiles valueFiles, values []string, stringValues []string, fileValues []string, CertFile, KeyFile, CAFile string) ([]byte, error) { base := map[string]interface{}{} // User specified a values files via -f/--values @@ -394,6 +401,17 @@ func vals(valueFiles valueFiles, values []string, stringValues []string, CertFil } } + // User specified a value via --set-file + for _, value := range fileValues { + reader := func(rs []rune) (interface{}, error) { + bytes, err := readFile(string(rs), CertFile, KeyFile, CAFile) + return string(bytes), err + } + if err := strvals.ParseIntoFile(value, base, reader); err != nil { + return []byte{}, fmt.Errorf("failed parsing --set-file data: %s", err) + } + } + return yaml.Marshal(base) } diff --git a/cmd/helm/lint.go b/cmd/helm/lint.go index c81468e50..3221368ce 100644 --- a/cmd/helm/lint.go +++ b/cmd/helm/lint.go @@ -47,6 +47,7 @@ type lintCmd struct { valueFiles valueFiles values []string sValues []string + fValues []string namespace string strict bool paths []string @@ -73,6 +74,7 @@ func newLintCmd(out io.Writer) *cobra.Command { cmd.Flags().VarP(&l.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)") cmd.Flags().StringArrayVar(&l.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") cmd.Flags().StringArrayVar(&l.sValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + cmd.Flags().StringArrayVar(&l.fValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)") cmd.Flags().StringVar(&l.namespace, "namespace", "default", "namespace to put the release into") cmd.Flags().BoolVar(&l.strict, "strict", false, "fail on lint warnings") @@ -172,6 +174,12 @@ func lintChart(path string, vals []byte, namespace string, strict bool) (support return lint.All(chartPath, vals, namespace, strict), nil } +// vals merges values from files specified via -f/--values and +// directly via --set or --set-string or --set-file, marshaling them to YAML +// +// This func is implemented intentionally and separately from the `vals` func for the `install` and `upgrade` comammdsn. +// Compared to the alternative func, this func lacks the parameters for tls opts - ca key, cert, and ca cert. +// That's because this command, `lint`, is explicitly forbidden from making server connections. func (l *lintCmd) vals() ([]byte, error) { base := map[string]interface{}{} @@ -204,5 +212,16 @@ func (l *lintCmd) vals() ([]byte, error) { } } + // User specified a value via --set-file + for _, value := range l.fValues { + reader := func(rs []rune) (interface{}, error) { + bytes, err := ioutil.ReadFile(string(rs)) + return string(bytes), err + } + if err := strvals.ParseIntoFile(value, base, reader); err != nil { + return []byte{}, fmt.Errorf("failed parsing --set-file data: %s", err) + } + } + return yaml.Marshal(base) } diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 9ba217871..bcfb6a7e4 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -69,6 +69,7 @@ type templateCmd struct { out io.Writer values []string stringValues []string + fileValues []string nameTemplate string showNotes bool releaseName string @@ -100,6 +101,7 @@ func newTemplateCmd(out io.Writer) *cobra.Command { f.StringVar(&t.namespace, "namespace", "", "namespace to install the release into") f.StringArrayVar(&t.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringArrayVar(&t.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&t.fileValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)") f.StringVar(&t.nameTemplate, "name-template", "", "specify template used to name the release") f.StringVar(&t.kubeVersion, "kube-version", defaultKubeVersion, "kubernetes version used as Capabilities.KubeVersion.Major/Minor") f.StringVar(&t.outputDir, "output-dir", "", "writes the executed templates to files in output-dir instead of stdout") @@ -132,7 +134,7 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { t.namespace = defaultNamespace() } // get combined values and create config - rawVals, err := vals(t.valueFiles, t.values, t.stringValues, "", "", "") + rawVals, err := vals(t.valueFiles, t.values, t.stringValues, t.fileValues, "", "", "") if err != nil { return err } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 104b4c6ba..b2907031f 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -37,8 +37,10 @@ a packaged chart, or a fully qualified URL. For chart references, the latest version will be specified unless the '--version' flag is set. To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line, to force string -values, use '--set-string'. +or use the '--set' flag and pass configuration from the command line. To force string +values in '--set', use '--set-string' instead. In case a value is large and therefore +you want not to use neither '--values' nor '--set', use '--set-file' to read the +single large value from file. You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml @@ -65,6 +67,7 @@ type upgradeCmd struct { valueFiles valueFiles values []string stringValues []string + fileValues []string verify bool keyring string install bool @@ -122,6 +125,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&upgrade.force, "force", false, "force resource update through delete/recreate if needed") f.StringArrayVar(&upgrade.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringArrayVar(&upgrade.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&upgrade.fileValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)") f.BoolVar(&upgrade.disableHooks, "disable-hooks", false, "disable pre/post upgrade hooks. DEPRECATED. Use no-hooks") f.BoolVar(&upgrade.disableHooks, "no-hooks", false, "disable pre/post upgrade hooks") f.BoolVar(&upgrade.verify, "verify", false, "verify the provenance of the chart before upgrading") @@ -189,6 +193,7 @@ func (u *upgradeCmd) run() error { keyring: u.keyring, values: u.values, stringValues: u.stringValues, + fileValues: u.fileValues, namespace: u.namespace, timeout: u.timeout, wait: u.wait, @@ -198,7 +203,7 @@ func (u *upgradeCmd) run() error { } } - rawVals, err := vals(u.valueFiles, u.values, u.stringValues, u.certFile, u.keyFile, u.caFile) + rawVals, err := vals(u.valueFiles, u.values, u.stringValues, u.fileValues, u.certFile, u.keyFile, u.caFile) if err != nil { return err } diff --git a/docs/chart_best_practices/values.md b/docs/chart_best_practices/values.md index 2962e7d45..28e3a3eac 100644 --- a/docs/chart_best_practices/values.md +++ b/docs/chart_best_practices/values.md @@ -93,6 +93,7 @@ There are three potential sources of values: - A chart's `values.yaml` file - A values file supplied by `helm install -f` or `helm upgrade -f` - The values passed to a `--set` or `--set-string` flag on `helm install` or `helm upgrade` +- The content of a file passed to `--set-file` flag on `helm install` or `helm upgrade` When designing the structure of your values, keep in mind that users of your chart may want to override them via either the `-f` flag or with the `--set` diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index dbb087964..c266222b8 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -12,8 +12,10 @@ The install argument must be a chart reference, a path to a packaged chart, a path to an unpacked chart directory or a URL. To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line, to force -a string value use '--set-string'. +or use the '--set' flag and pass configuration from the command line. To force string +values in '--set', use '--set-string' instead. In case a value is large and therefore +you want not to use neither '--values' nor '--set', use '--set-file' to read the +single large value from file. $ helm install -f myvalues.yaml ./redis @@ -25,6 +27,9 @@ or $ helm install --set-string long_int=1234567890 ./redis +or + $ helm install --set-file multiline_text=path/to/textfile + You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml contained a key called 'Test', the value set in override.yaml would take precedence: @@ -91,6 +96,7 @@ helm install [CHART] --replace re-use the given name, even if that name is already used. This is unsafe in production --repo string chart repository url where to locate the requested chart --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) --tls enable TLS for request @@ -120,4 +126,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 17-Jul-2018 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index 319939bcf..9c328a086 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -23,6 +23,7 @@ helm lint [flags] PATH ``` --namespace string namespace to put the release into (default "default") --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --strict fail on lint warnings -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) @@ -43,4 +44,4 @@ helm lint [flags] PATH ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 25-Jul-2018 diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index 81c7fa00e..f456f74be 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -34,6 +34,7 @@ helm template [flags] CHART --notes show the computed NOTES.txt file as well --output-dir string writes the executed templates to files in output-dir instead of stdout --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) ``` @@ -53,4 +54,4 @@ helm template [flags] CHART ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 17-Jul-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index d83231fcb..ecd51e65c 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -14,8 +14,10 @@ a packaged chart, or a fully qualified URL. For chart references, the latest version will be specified unless the '--version' flag is set. To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line, to force string -values, use '--set-string'. +or use the '--set' flag and pass configuration from the command line. To force string +values in '--set', use '--set-string' instead. In case a value is large and therefore +you want not to use neither '--values' nor '--set', use '--set-file' to read the +single large value from file. You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml @@ -54,6 +56,7 @@ helm upgrade [RELEASE] [CHART] --reset-values when upgrading, reset the values to the ones built into the chart --reuse-values when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored. --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) --tls enable TLS for request @@ -83,4 +86,4 @@ helm upgrade [RELEASE] [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 17-May-2018 diff --git a/docs/using_helm.md b/docs/using_helm.md index 5490abbe1..b7fec60ed 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -227,7 +227,7 @@ There are two ways to pass configuration data during install: - `--values` (or `-f`): Specify a YAML file with overrides. This can be specified multiple times and the rightmost file will take precedence -- `--set`: Specify overrides on the command line. +- `--set` (and its variants `--set-string` and `--set-file`): Specify overrides on the command line. If both are used, `--set` values are merged into `--values` with higher precedence. Overrides specified with `--set` are persisted in a configmap. Values that have been @@ -304,6 +304,35 @@ Deeply nested data structures can be difficult to express using `--set`. Chart designers are encouraged to consider the `--set` usage when designing the format of a `values.yaml` file. +Helm will cast certain values specified with `--set` to integers. +For example, `--set foo=true` results Helm to cast `true` into an int64 value. +In case you want a string, use a `--set`'s variant named `--set-string`. `--set-string foo=true` results in a string value of `"true"`. + +`--set-file key=filepath` is another variant of `--set`. +It reads the file and use its content as a value. +An example use case of it is to inject a multi-line text into values without dealing with indentation in YAML. +Say you want to create a [brigade](https://github.com/Azure/brigade) project with certain value containing 5 lines JavaScript code, you might write a `values.yaml` like: + +```yaml +defaultScript: | + const { events, Job } = require("brigadier") + function run(e, project) { + console.log("hello default script") + } + events.on("run", run) +``` + +Being embedded in a YAML, this makes it harder for you to use IDE features and testing framework and so on that supports writing code. +Instead, you can use `--set-file defaultScript=brigade.js` with `brigade.js` containing: + +```javascript +const { events, Job } = require("brigadier") +function run(e, project) { + console.log("hello default script") +} +events.on("run", run) +``` + ### More Installation Methods The `helm install` command can install from several sources: diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index dae949d8e..eb29c250f 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -50,6 +50,20 @@ func Parse(s string) (map[string]interface{}, error) { return vals, err } +// ParseFile parses a set line, but its final value is loaded from the file at the path specified by the original value. +// +// A set line is of the form name1=path1,name2=path2 +// +// When the files at path1 and path2 contained "val1" and "val2" respectively, the set line is consumed as +// name1=val1,name2=val2 +func ParseFile(s string, runesToVal runesToVal) (map[string]interface{}, error) { + vals := map[string]interface{}{} + scanner := bytes.NewBufferString(s) + t := newFileParser(scanner, vals, runesToVal) + err := t.parse() + return vals, err +} + // ParseString parses a set line and forces a string value. // // A set line is of the form name1=value1,name2=value2 @@ -71,6 +85,15 @@ func ParseInto(s string, dest map[string]interface{}) error { return t.parse() } +// ParseIntoFile parses a filevals line and merges the result into dest. +// +// This method always returns a string as the value. +func ParseIntoFile(s string, dest map[string]interface{}, runesToVal runesToVal) error { + scanner := bytes.NewBufferString(s) + t := newFileParser(scanner, dest, runesToVal) + return t.parse() +} + // ParseIntoString parses a strvals line nad merges the result into dest. // // This method always returns a string as the value. @@ -87,13 +110,22 @@ func ParseIntoString(s string, dest map[string]interface{}) error { // where data is the final parsed data from the parses with correct types // where st is a boolean to figure out if we're forcing it to parse values as string type parser struct { - sc *bytes.Buffer - data map[string]interface{} - st bool + sc *bytes.Buffer + data map[string]interface{} + runesToVal runesToVal } +type runesToVal func([]rune) (interface{}, error) + func newParser(sc *bytes.Buffer, data map[string]interface{}, stringBool bool) *parser { - return &parser{sc: sc, data: data, st: stringBool} + rs2v := func(rs []rune) (interface{}, error) { + return typedVal(rs, stringBool), nil + } + return &parser{sc: sc, data: data, runesToVal: rs2v} +} + +func newFileParser(sc *bytes.Buffer, data map[string]interface{}, runesToVal runesToVal) *parser { + return &parser{sc: sc, data: data, runesToVal: runesToVal} } func (t *parser) parse() error { @@ -157,8 +189,12 @@ func (t *parser) key(data map[string]interface{}) error { set(data, string(k), "") return e case ErrNotList: - v, e := t.val() - set(data, string(k), typedVal(v, t.st)) + rs, e := t.val() + if e != nil && e != io.EOF { + return e + } + v, e := t.runesToVal(rs) + set(data, string(k), v) return e default: return e @@ -230,8 +266,12 @@ func (t *parser) listItem(list []interface{}, i int) ([]interface{}, error) { case io.EOF: return setIndex(list, i, ""), err case ErrNotList: - v, e := t.val() - return setIndex(list, i, typedVal(v, t.st)), e + rs, e := t.val() + if e != nil && e != io.EOF { + return list, e + } + v, e := t.runesToVal(rs) + return setIndex(list, i, v), e default: return list, e } @@ -279,7 +319,7 @@ func (t *parser) valList() ([]interface{}, error) { list := []interface{}{} stop := runeSet([]rune{',', '}'}) for { - switch v, last, err := runesUntil(t.sc, stop); { + switch rs, last, err := runesUntil(t.sc, stop); { case err != nil: if err == io.EOF { err = errors.New("list must terminate with '}'") @@ -290,10 +330,15 @@ func (t *parser) valList() ([]interface{}, error) { if r, _, e := t.sc.ReadRune(); e == nil && r != ',' { t.sc.UnreadRune() } - list = append(list, typedVal(v, t.st)) - return list, nil + v, e := t.runesToVal(rs) + list = append(list, v) + return list, e case last == ',': - list = append(list, typedVal(v, t.st)) + v, e := t.runesToVal(rs) + if e != nil { + return list, e + } + list = append(list, v) } } } diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index 22f0e753a..f23a57e0a 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -416,6 +416,39 @@ func TestParseIntoString(t *testing.T) { } } +func TestParseIntoFile(t *testing.T) { + got := map[string]interface{}{} + input := "name1=path1" + expect := map[string]interface{}{ + "name1": "value1", + } + rs2v := func(rs []rune) (interface{}, error) { + v := string(rs) + if v != "path1" { + t.Errorf("%s: runesToVal: Expected value path1, got %s", input, v) + return "", nil + } + return "value1", nil + } + + if err := ParseIntoFile(input, got, rs2v); err != nil { + t.Fatal(err) + } + + y1, err := yaml.Marshal(expect) + if err != nil { + t.Fatal(err) + } + y2, err := yaml.Marshal(got) + if err != nil { + t.Fatalf("Error serializing parsed value: %s", err) + } + + if string(y1) != string(y2) { + t.Errorf("%s: Expected:\n%s\nGot:\n%s", input, y1, y2) + } +} + func TestToYAML(t *testing.T) { // The TestParse does the hard part. We just verify that YAML formatting is // happening. From b699a472b9ee55dce6da31f06b9f22b8a69d704f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Magnusson?= Date: Thu, 26 Jul 2018 12:08:34 +0200 Subject: [PATCH 295/449] README: updated links to helm/helm --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b3d90247..32627d606 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Kubernetes Helm -[![CircleCI](https://circleci.com/gh/kubernetes/helm.svg?style=svg)](https://circleci.com/gh/kubernetes/helm) -[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes/helm)](https://goreportcard.com/report/github.com/kubernetes/helm) +[![CircleCI](https://circleci.com/gh/helm/helm.svg?style=svg)](https://circleci.com/gh/helm/helm) +[![Go Report Card](https://goreportcard.com/badge/github.com/helm/helm)](https://goreportcard.com/report/github.com/helm/helm) [![GoDoc](https://godoc.org/github.com/kubernetes/helm?status.svg)](https://godoc.org/github.com/kubernetes/helm) Helm is a tool for managing Kubernetes charts. Charts are packages of @@ -9,7 +9,7 @@ pre-configured Kubernetes resources. Use Helm to: -- Find and use [popular software packaged as Kubernetes charts](https://github.com/kubernetes/charts) +- Find and use [popular software packaged as Kubernetes charts](https://github.com/helm/charts) - Share your own applications as Kubernetes charts - Create reproducible builds of your Kubernetes applications - Intelligently manage your Kubernetes manifest files @@ -32,7 +32,7 @@ Think of it like apt/yum/homebrew for Kubernetes. ## Install -Binary downloads of the Helm client can be found on [the latest Releases page](https://github.com/kubernetes/helm/releases/latest). +Binary downloads of the Helm client can be found on [the latest Releases page](https://github.com/helm/helm/releases/latest). Unpack the `helm` binary and add it to your PATH and you are good to go! @@ -52,7 +52,7 @@ Get started with the [Quick Start guide](https://docs.helm.sh/using_helm/#quicks ## Roadmap -The [Helm roadmap uses Github milestones](https://github.com/kubernetes/helm/milestones) to track the progress of the project. +The [Helm roadmap uses Github milestones](https://github.com/helm/helm/milestones) to track the progress of the project. ## Community, discussion, contribution, and support From 44b7b881ddd3d39f7c5d6f91fad94cd3eea10c62 Mon Sep 17 00:00:00 2001 From: Anders Rasmussen Date: Sun, 29 Jul 2018 23:34:09 +0200 Subject: [PATCH 296/449] Adding space for correct formatting on docs.helm.sh The rendering of the bullet list is not rendered correctly on https://docs.helm.sh/developing_charts/#hooks --- docs/charts_hooks.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/charts_hooks.md b/docs/charts_hooks.md index b6c276bba..8d5006d1f 100644 --- a/docs/charts_hooks.md +++ b/docs/charts_hooks.md @@ -193,6 +193,7 @@ It is also possible to define policies that determine when to delete correspondi ``` You can choose one or more defined annotation values: + * `"hook-succeeded"` specifies Tiller should delete the hook after the hook is successfully executed. * `"hook-failed"` specifies Tiller should delete the hook if the hook failed during execution. * `"before-hook-creation"` specifies Tiller should delete the previous hook before the new hook is launched. From 4b75488edfdddb8478ef3f7648a7fbffac7c7d2b Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 30 Jul 2018 08:27:12 -0700 Subject: [PATCH 297/449] fix path output for Windows --- cmd/helm/dependency.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/dependency.go b/cmd/helm/dependency.go index 231659691..a0388e18d 100644 --- a/cmd/helm/dependency.go +++ b/cmd/helm/dependency.go @@ -141,7 +141,7 @@ func (l *dependencyListCmd) run() error { r, err := chartutil.LoadRequirements(c) if err != nil { if err == chartutil.ErrRequirementsNotFound { - fmt.Fprintf(l.out, "WARNING: no requirements at %s/charts\n", l.chartpath) + fmt.Fprintf(l.out, "WARNING: no requirements at %s\n", filepath.Join(l.chartpath, "charts")) return nil } return err From 109064048eaca7433b5ceb260ebfa2331ad430fb Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 8 Jun 2018 07:59:37 -0700 Subject: [PATCH 298/449] change copyright to "Copyright The Helm Authors" --- .circleci/bootstrap.sh | 2 +- .circleci/deploy.sh | 2 +- .circleci/test.sh | 2 +- LICENSE | 2 +- _proto/hapi/chart/chart.proto | 2 +- _proto/hapi/chart/config.proto | 2 +- _proto/hapi/chart/metadata.proto | 2 +- _proto/hapi/chart/template.proto | 2 +- _proto/hapi/release/hook.proto | 2 +- _proto/hapi/release/info.proto | 2 +- _proto/hapi/release/release.proto | 2 +- _proto/hapi/release/status.proto | 2 +- _proto/hapi/release/test_run.proto | 2 +- _proto/hapi/release/test_suite.proto | 2 +- _proto/hapi/rudder/rudder.proto | 2 +- _proto/hapi/services/tiller.proto | 2 +- _proto/hapi/version/version.proto | 2 +- cmd/helm/completion.go | 2 +- cmd/helm/create.go | 2 +- cmd/helm/create_test.go | 2 +- cmd/helm/delete.go | 2 +- cmd/helm/delete_test.go | 2 +- cmd/helm/dependency.go | 2 +- cmd/helm/dependency_build.go | 2 +- cmd/helm/dependency_build_test.go | 2 +- cmd/helm/dependency_test.go | 2 +- cmd/helm/dependency_update.go | 2 +- cmd/helm/dependency_update_test.go | 2 +- cmd/helm/docs.go | 2 +- cmd/helm/fetch.go | 2 +- cmd/helm/fetch_test.go | 2 +- cmd/helm/get.go | 2 +- cmd/helm/get_hooks.go | 2 +- cmd/helm/get_hooks_test.go | 2 +- cmd/helm/get_manifest.go | 2 +- cmd/helm/get_manifest_test.go | 2 +- cmd/helm/get_test.go | 2 +- cmd/helm/get_values.go | 2 +- cmd/helm/get_values_test.go | 2 +- cmd/helm/helm.go | 2 +- cmd/helm/helm_test.go | 2 +- cmd/helm/history.go | 2 +- cmd/helm/history_test.go | 2 +- cmd/helm/home.go | 2 +- cmd/helm/init.go | 2 +- cmd/helm/init_test.go | 2 +- cmd/helm/init_unix.go | 2 +- cmd/helm/init_windows.go | 2 +- cmd/helm/inspect.go | 2 +- cmd/helm/inspect_test.go | 2 +- cmd/helm/install.go | 2 +- cmd/helm/install_test.go | 2 +- cmd/helm/installer/install.go | 2 +- cmd/helm/installer/install_test.go | 2 +- cmd/helm/installer/options.go | 2 +- cmd/helm/installer/uninstall.go | 2 +- cmd/helm/installer/uninstall_test.go | 2 +- cmd/helm/lint.go | 2 +- cmd/helm/lint_test.go | 2 +- cmd/helm/list.go | 2 +- cmd/helm/list_test.go | 2 +- cmd/helm/load_plugins.go | 2 +- cmd/helm/package.go | 2 +- cmd/helm/package_test.go | 2 +- cmd/helm/plugin.go | 2 +- cmd/helm/plugin_install.go | 2 +- cmd/helm/plugin_list.go | 2 +- cmd/helm/plugin_remove.go | 2 +- cmd/helm/plugin_test.go | 2 +- cmd/helm/plugin_update.go | 2 +- cmd/helm/printer.go | 2 +- cmd/helm/release_testing.go | 2 +- cmd/helm/release_testing_test.go | 2 +- cmd/helm/repo.go | 2 +- cmd/helm/repo_add.go | 2 +- cmd/helm/repo_add_test.go | 2 +- cmd/helm/repo_index.go | 2 +- cmd/helm/repo_index_test.go | 2 +- cmd/helm/repo_list.go | 2 +- cmd/helm/repo_remove.go | 2 +- cmd/helm/repo_remove_test.go | 2 +- cmd/helm/repo_update.go | 2 +- cmd/helm/repo_update_test.go | 2 +- cmd/helm/reset.go | 2 +- cmd/helm/reset_test.go | 2 +- cmd/helm/rollback.go | 2 +- cmd/helm/rollback_test.go | 2 +- cmd/helm/search.go | 2 +- cmd/helm/search/search.go | 2 +- cmd/helm/search/search_test.go | 2 +- cmd/helm/search_test.go | 2 +- cmd/helm/serve.go | 2 +- cmd/helm/status.go | 2 +- cmd/helm/status_test.go | 2 +- cmd/helm/template.go | 2 +- cmd/helm/template_test.go | 2 +- cmd/helm/upgrade.go | 2 +- cmd/helm/upgrade_test.go | 2 +- cmd/helm/verify.go | 2 +- cmd/helm/verify_test.go | 2 +- cmd/helm/version.go | 2 +- cmd/helm/version_test.go | 2 +- cmd/rudder/rudder.go | 2 +- cmd/tiller/probes.go | 2 +- cmd/tiller/probes_test.go | 2 +- cmd/tiller/tiller.go | 2 +- cmd/tiller/tiller_test.go | 2 +- cmd/tiller/trace.go | 2 +- pkg/chartutil/capabilities.go | 2 +- pkg/chartutil/capabilities_test.go | 2 +- pkg/chartutil/chartfile.go | 2 +- pkg/chartutil/chartfile_test.go | 2 +- pkg/chartutil/create.go | 2 +- pkg/chartutil/create_test.go | 2 +- pkg/chartutil/doc.go | 2 +- pkg/chartutil/expand.go | 2 +- pkg/chartutil/files.go | 2 +- pkg/chartutil/files_test.go | 2 +- pkg/chartutil/load.go | 2 +- pkg/chartutil/load_test.go | 2 +- pkg/chartutil/requirements.go | 2 +- pkg/chartutil/requirements_test.go | 2 +- pkg/chartutil/save.go | 2 +- pkg/chartutil/save_test.go | 2 +- pkg/chartutil/transform.go | 2 +- pkg/chartutil/values.go | 2 +- pkg/chartutil/values_test.go | 2 +- pkg/downloader/chart_downloader.go | 2 +- pkg/downloader/chart_downloader_test.go | 2 +- pkg/downloader/doc.go | 2 +- pkg/downloader/manager.go | 2 +- pkg/downloader/manager_test.go | 2 +- pkg/engine/doc.go | 2 +- pkg/engine/engine.go | 2 +- pkg/engine/engine_test.go | 2 +- pkg/getter/doc.go | 2 +- pkg/getter/getter.go | 2 +- pkg/getter/getter_test.go | 2 +- pkg/getter/httpgetter.go | 2 +- pkg/getter/httpgetter_test.go | 2 +- pkg/getter/plugingetter.go | 2 +- pkg/getter/plugingetter_test.go | 2 +- pkg/helm/client.go | 2 +- pkg/helm/client_test.go | 2 +- pkg/helm/environment/environment.go | 2 +- pkg/helm/environment/environment_test.go | 2 +- pkg/helm/fake.go | 2 +- pkg/helm/fake_test.go | 2 +- pkg/helm/helm_test.go | 2 +- pkg/helm/helmpath/helmhome.go | 2 +- pkg/helm/helmpath/helmhome_unix_test.go | 2 +- pkg/helm/helmpath/helmhome_windows_test.go | 2 +- pkg/helm/interface.go | 2 +- pkg/helm/option.go | 2 +- pkg/helm/portforwarder/pod.go | 2 +- pkg/helm/portforwarder/portforwarder.go | 2 +- pkg/helm/portforwarder/portforwarder_test.go | 2 +- pkg/hooks/hooks.go | 2 +- pkg/ignore/doc.go | 2 +- pkg/ignore/rules.go | 2 +- pkg/ignore/rules_test.go | 2 +- pkg/kube/client.go | 2 +- pkg/kube/client_test.go | 2 +- pkg/kube/config.go | 2 +- pkg/kube/log.go | 2 +- pkg/kube/namespace.go | 2 +- pkg/kube/namespace_test.go | 2 +- pkg/kube/result.go | 2 +- pkg/kube/result_test.go | 2 +- pkg/kube/tunnel.go | 2 +- pkg/kube/tunnel_test.go | 2 +- pkg/kube/wait.go | 2 +- pkg/lint/lint.go | 2 +- pkg/lint/lint_test.go | 2 +- pkg/lint/rules/chartfile.go | 2 +- pkg/lint/rules/chartfile_test.go | 2 +- pkg/lint/rules/template.go | 2 +- pkg/lint/rules/template_test.go | 2 +- pkg/lint/rules/values.go | 2 +- pkg/lint/support/doc.go | 2 +- pkg/lint/support/message.go | 2 +- pkg/lint/support/message_test.go | 2 +- pkg/plugin/cache/cache.go | 2 +- pkg/plugin/hooks.go | 2 +- pkg/plugin/installer/base.go | 2 +- pkg/plugin/installer/doc.go | 2 +- pkg/plugin/installer/http_installer.go | 2 +- pkg/plugin/installer/http_installer_test.go | 2 +- pkg/plugin/installer/installer.go | 2 +- pkg/plugin/installer/local_installer.go | 2 +- pkg/plugin/installer/local_installer_test.go | 2 +- pkg/plugin/installer/vcs_installer.go | 2 +- pkg/plugin/installer/vcs_installer_test.go | 2 +- pkg/plugin/plugin.go | 2 +- pkg/plugin/plugin_test.go | 2 +- pkg/provenance/doc.go | 2 +- pkg/provenance/sign.go | 2 +- pkg/provenance/sign_test.go | 2 +- pkg/releasetesting/environment.go | 2 +- pkg/releasetesting/environment_test.go | 2 +- pkg/releasetesting/test_suite.go | 2 +- pkg/releasetesting/test_suite_test.go | 2 +- pkg/releaseutil/filter.go | 2 +- pkg/releaseutil/filter_test.go | 2 +- pkg/releaseutil/manifest.go | 2 +- pkg/releaseutil/manifest_test.go | 2 +- pkg/releaseutil/sorter.go | 2 +- pkg/releaseutil/sorter_test.go | 2 +- pkg/repo/chartrepo.go | 2 +- pkg/repo/chartrepo_test.go | 2 +- pkg/repo/doc.go | 2 +- pkg/repo/index.go | 2 +- pkg/repo/index_test.go | 2 +- pkg/repo/local.go | 2 +- pkg/repo/local_test.go | 2 +- pkg/repo/repo.go | 2 +- pkg/repo/repo_test.go | 2 +- pkg/repo/repotest/doc.go | 2 +- pkg/repo/repotest/server.go | 2 +- pkg/repo/repotest/server_test.go | 2 +- pkg/resolver/resolver.go | 2 +- pkg/resolver/resolver_test.go | 2 +- pkg/rudder/client.go | 2 +- pkg/storage/driver/cfgmaps.go | 2 +- pkg/storage/driver/cfgmaps_test.go | 2 +- pkg/storage/driver/driver.go | 2 +- pkg/storage/driver/labels.go | 2 +- pkg/storage/driver/labels_test.go | 2 +- pkg/storage/driver/memory.go | 2 +- pkg/storage/driver/memory_test.go | 2 +- pkg/storage/driver/mock_test.go | 2 +- pkg/storage/driver/records.go | 2 +- pkg/storage/driver/records_test.go | 2 +- pkg/storage/driver/secrets.go | 2 +- pkg/storage/driver/secrets_test.go | 2 +- pkg/storage/driver/util.go | 2 +- pkg/storage/storage.go | 2 +- pkg/storage/storage_test.go | 2 +- pkg/strvals/doc.go | 2 +- pkg/strvals/parser.go | 2 +- pkg/strvals/parser_test.go | 2 +- pkg/sympath/walk.go | 2 +- pkg/sympath/walk_test.go | 2 +- pkg/tiller/environment/environment.go | 2 +- pkg/tiller/environment/environment_test.go | 2 +- pkg/tiller/hook_sorter.go | 2 +- pkg/tiller/hook_sorter_test.go | 2 +- pkg/tiller/hooks.go | 2 +- pkg/tiller/hooks_test.go | 2 +- pkg/tiller/kind_sorter.go | 2 +- pkg/tiller/kind_sorter_test.go | 2 +- pkg/tiller/release_content.go | 2 +- pkg/tiller/release_content_test.go | 2 +- pkg/tiller/release_history.go | 2 +- pkg/tiller/release_history_test.go | 2 +- pkg/tiller/release_install.go | 2 +- pkg/tiller/release_install_test.go | 2 +- pkg/tiller/release_list.go | 2 +- pkg/tiller/release_list_test.go | 2 +- pkg/tiller/release_modules.go | 2 +- pkg/tiller/release_rollback.go | 2 +- pkg/tiller/release_rollback_test.go | 2 +- pkg/tiller/release_server.go | 2 +- pkg/tiller/release_server_test.go | 2 +- pkg/tiller/release_status.go | 2 +- pkg/tiller/release_status_test.go | 2 +- pkg/tiller/release_testing.go | 2 +- pkg/tiller/release_testing_test.go | 2 +- pkg/tiller/release_uninstall.go | 2 +- pkg/tiller/release_uninstall_test.go | 2 +- pkg/tiller/release_update.go | 2 +- pkg/tiller/release_update_test.go | 2 +- pkg/tiller/release_version.go | 2 +- pkg/tiller/resource_policy.go | 2 +- pkg/tiller/server.go | 2 +- pkg/timeconv/doc.go | 2 +- pkg/timeconv/timeconv.go | 2 +- pkg/timeconv/timeconv_test.go | 2 +- pkg/tlsutil/cfg.go | 2 +- pkg/tlsutil/tls.go | 2 +- pkg/tlsutil/tlsutil_test.go | 2 +- pkg/urlutil/urlutil.go | 2 +- pkg/urlutil/urlutil_test.go | 2 +- pkg/version/compatible.go | 2 +- pkg/version/compatible_test.go | 2 +- pkg/version/doc.go | 2 +- pkg/version/version.go | 2 +- pkg/version/version_test.go | 2 +- rootfs/Dockerfile | 2 +- rootfs/Dockerfile.experimental | 2 +- rootfs/Dockerfile.rudder | 2 +- scripts/coverage.sh | 2 +- scripts/get | 2 +- scripts/sync-repo.sh | 2 +- scripts/update-docs.sh | 2 +- scripts/util.sh | 2 +- scripts/validate-go.sh | 2 +- scripts/validate-license.sh | 17 +++++++++++++---- scripts/verify-docs.sh | 2 +- 299 files changed, 311 insertions(+), 302 deletions(-) diff --git a/.circleci/bootstrap.sh b/.circleci/bootstrap.sh index 978464efe..30dc0b316 100755 --- a/.circleci/bootstrap.sh +++ b/.circleci/bootstrap.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh index 6ad91109d..08adad568 100755 --- a/.circleci/deploy.sh +++ b/.circleci/deploy.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.circleci/test.sh b/.circleci/test.sh index e0faf9c18..a6acd8f6a 100755 --- a/.circleci/test.sh +++ b/.circleci/test.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/LICENSE b/LICENSE index 21c57fae2..393b7a33b 100644 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2016 The Kubernetes Authors All Rights Reserved + Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/_proto/hapi/chart/chart.proto b/_proto/hapi/chart/chart.proto index 9b838fd1a..68aea8f05 100644 --- a/_proto/hapi/chart/chart.proto +++ b/_proto/hapi/chart/chart.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/chart/config.proto b/_proto/hapi/chart/config.proto index a1404476b..a851d212f 100644 --- a/_proto/hapi/chart/config.proto +++ b/_proto/hapi/chart/config.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/chart/metadata.proto b/_proto/hapi/chart/metadata.proto index 49d6a217a..0ac695ce2 100644 --- a/_proto/hapi/chart/metadata.proto +++ b/_proto/hapi/chart/metadata.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/chart/template.proto b/_proto/hapi/chart/template.proto index d13543ea9..879d2071a 100644 --- a/_proto/hapi/chart/template.proto +++ b/_proto/hapi/chart/template.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/hook.proto b/_proto/hapi/release/hook.proto index 0d96dd9ae..cf7e25bf6 100644 --- a/_proto/hapi/release/hook.proto +++ b/_proto/hapi/release/hook.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/info.proto b/_proto/hapi/release/info.proto index e23175d3d..ee03056c7 100644 --- a/_proto/hapi/release/info.proto +++ b/_proto/hapi/release/info.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/release.proto b/_proto/hapi/release/release.proto index 4a6afa0fe..ce9208e29 100644 --- a/_proto/hapi/release/release.proto +++ b/_proto/hapi/release/release.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/status.proto b/_proto/hapi/release/status.proto index ef28a233c..aa90760b3 100644 --- a/_proto/hapi/release/status.proto +++ b/_proto/hapi/release/status.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/test_run.proto b/_proto/hapi/release/test_run.proto index 60734ae03..7c281669f 100644 --- a/_proto/hapi/release/test_run.proto +++ b/_proto/hapi/release/test_run.proto @@ -1,5 +1,5 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/test_suite.proto b/_proto/hapi/release/test_suite.proto index 2f6feb08c..9ac6583b2 100644 --- a/_proto/hapi/release/test_suite.proto +++ b/_proto/hapi/release/test_suite.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/rudder/rudder.proto b/_proto/hapi/rudder/rudder.proto index 3a37c9e99..188491512 100644 --- a/_proto/hapi/rudder/rudder.proto +++ b/_proto/hapi/rudder/rudder.proto @@ -1,4 +1,4 @@ -// Copyright 2017 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 25bf7af44..a94a90a4a 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/version/version.proto b/_proto/hapi/version/version.proto index 0ae0985b7..5c50e852f 100644 --- a/_proto/hapi/version/version.proto +++ b/_proto/hapi/version/version.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index e83a32a13..b6fbc82d1 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/create.go b/cmd/helm/create.go index 556ff171d..eaea81e5b 100644 --- a/cmd/helm/create.go +++ b/cmd/helm/create.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go index 84ccebece..214432b83 100644 --- a/cmd/helm/create_test.go +++ b/cmd/helm/create_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go index 46c7abcb1..ad7c6049a 100755 --- a/cmd/helm/delete.go +++ b/cmd/helm/delete.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/delete_test.go b/cmd/helm/delete_test.go index 6b5c444b1..b71860e67 100644 --- a/cmd/helm/delete_test.go +++ b/cmd/helm/delete_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/dependency.go b/cmd/helm/dependency.go index a0388e18d..1e3079ded 100644 --- a/cmd/helm/dependency.go +++ b/cmd/helm/dependency.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_build.go b/cmd/helm/dependency_build.go index ec5fd14b7..3af3c1243 100644 --- a/cmd/helm/dependency_build.go +++ b/cmd/helm/dependency_build.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_build_test.go b/cmd/helm/dependency_build_test.go index 2d7c88654..207313bf5 100644 --- a/cmd/helm/dependency_build_test.go +++ b/cmd/helm/dependency_build_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_test.go b/cmd/helm/dependency_test.go index cc4519147..e98f436ec 100644 --- a/cmd/helm/dependency_test.go +++ b/cmd/helm/dependency_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_update.go b/cmd/helm/dependency_update.go index d6a998639..a8e54137b 100644 --- a/cmd/helm/dependency_update.go +++ b/cmd/helm/dependency_update.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_update_test.go b/cmd/helm/dependency_update_test.go index e29cb35de..f7ef84e6f 100644 --- a/cmd/helm/dependency_update_test.go +++ b/cmd/helm/dependency_update_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/docs.go b/cmd/helm/docs.go index e5b9f7521..56e3beaf5 100644 --- a/cmd/helm/docs.go +++ b/cmd/helm/docs.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/fetch.go b/cmd/helm/fetch.go index 069f57eff..d6f622bb6 100644 --- a/cmd/helm/fetch.go +++ b/cmd/helm/fetch.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/fetch_test.go b/cmd/helm/fetch_test.go index 13247ee99..3fba37dd6 100644 --- a/cmd/helm/fetch_test.go +++ b/cmd/helm/fetch_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get.go b/cmd/helm/get.go index a2eb1d137..5744beb62 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_hooks.go b/cmd/helm/get_hooks.go index 1b6f2f8fe..9192db998 100644 --- a/cmd/helm/get_hooks.go +++ b/cmd/helm/get_hooks.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_hooks_test.go b/cmd/helm/get_hooks_test.go index e578c2533..fe9133feb 100644 --- a/cmd/helm/get_hooks_test.go +++ b/cmd/helm/get_hooks_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_manifest.go b/cmd/helm/get_manifest.go index c01febfb4..f4ae11e58 100644 --- a/cmd/helm/get_manifest.go +++ b/cmd/helm/get_manifest.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_manifest_test.go b/cmd/helm/get_manifest_test.go index 286b5628a..c95a1f265 100644 --- a/cmd/helm/get_manifest_test.go +++ b/cmd/helm/get_manifest_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_test.go b/cmd/helm/get_test.go index a6e72987a..cb230a8a5 100644 --- a/cmd/helm/get_test.go +++ b/cmd/helm/get_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_values.go b/cmd/helm/get_values.go index b6ce648e5..12a48f1da 100644 --- a/cmd/helm/get_values.go +++ b/cmd/helm/get_values.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_values_test.go b/cmd/helm/get_values_test.go index 30b2ba4b8..35c84f2ec 100644 --- a/cmd/helm/get_values_test.go +++ b/cmd/helm/get_values_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 3f859392d..8607129e4 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index d80b1a2c2..e79ad3c4b 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/history.go b/cmd/helm/history.go index e6366d31d..6e0b48d33 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/history_test.go b/cmd/helm/history_test.go index fef433742..5d5146228 100644 --- a/cmd/helm/history_test.go +++ b/cmd/helm/history_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/home.go b/cmd/helm/home.go index e96edd7a1..ca21088a7 100644 --- a/cmd/helm/home.go +++ b/cmd/helm/home.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 51bf2139c..138fa14d7 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/init_test.go b/cmd/helm/init_test.go index a4bb0646a..fd6ef97c4 100644 --- a/cmd/helm/init_test.go +++ b/cmd/helm/init_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/init_unix.go b/cmd/helm/init_unix.go index 1117dd487..bf61f1925 100644 --- a/cmd/helm/init_unix.go +++ b/cmd/helm/init_unix.go @@ -1,7 +1,7 @@ // +build !windows /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/init_windows.go b/cmd/helm/init_windows.go index be17bccda..447044bba 100644 --- a/cmd/helm/init_windows.go +++ b/cmd/helm/init_windows.go @@ -1,7 +1,7 @@ // +build windows /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/inspect.go b/cmd/helm/inspect.go index 999856959..c1861f7c5 100644 --- a/cmd/helm/inspect.go +++ b/cmd/helm/inspect.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/inspect_test.go b/cmd/helm/inspect_test.go index 44d71fbbd..b9dbf2ab6 100644 --- a/cmd/helm/inspect_test.go +++ b/cmd/helm/inspect_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 003466146..857fb0d46 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index 236174bec..48d9fc8c1 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index c5fb1dc80..055601440 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index 72d2d7039..d5f3dfec0 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index 3769d12e1..95aa3988d 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/installer/uninstall.go b/cmd/helm/installer/uninstall.go index 818827ddb..14735ea85 100644 --- a/cmd/helm/installer/uninstall.go +++ b/cmd/helm/installer/uninstall.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/installer/uninstall_test.go b/cmd/helm/installer/uninstall_test.go index 91b257d47..195b209bc 100644 --- a/cmd/helm/installer/uninstall_test.go +++ b/cmd/helm/installer/uninstall_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/lint.go b/cmd/helm/lint.go index 3221368ce..d0159d34b 100644 --- a/cmd/helm/lint.go +++ b/cmd/helm/lint.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/lint_test.go b/cmd/helm/lint_test.go index 973af9b63..67775893b 100644 --- a/cmd/helm/lint_test.go +++ b/cmd/helm/lint_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 47417749f..ed70702d5 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index e0faee935..934f10712 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index 67de8bae5..158a69c88 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/package.go b/cmd/helm/package.go index ed44382c7..81603e67b 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/package_test.go b/cmd/helm/package_test.go index 4404586e0..7ed9829a5 100644 --- a/cmd/helm/package_test.go +++ b/cmd/helm/package_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin.go b/cmd/helm/plugin.go index cf0b02f09..fbdd1245b 100644 --- a/cmd/helm/plugin.go +++ b/cmd/helm/plugin.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_install.go b/cmd/helm/plugin_install.go index f36178808..7d77be3fc 100644 --- a/cmd/helm/plugin_install.go +++ b/cmd/helm/plugin_install.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_list.go b/cmd/helm/plugin_list.go index e7618f38a..9693baaa2 100644 --- a/cmd/helm/plugin_list.go +++ b/cmd/helm/plugin_list.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_remove.go b/cmd/helm/plugin_remove.go index ec1154734..f30e5b516 100644 --- a/cmd/helm/plugin_remove.go +++ b/cmd/helm/plugin_remove.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_test.go b/cmd/helm/plugin_test.go index 2a4a0e9aa..2d06c3797 100644 --- a/cmd/helm/plugin_test.go +++ b/cmd/helm/plugin_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_update.go b/cmd/helm/plugin_update.go index d3778764d..f9d5a3fac 100644 --- a/cmd/helm/plugin_update.go +++ b/cmd/helm/plugin_update.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/printer.go b/cmd/helm/printer.go index ebb24bf7d..e98b71c64 100644 --- a/cmd/helm/printer.go +++ b/cmd/helm/printer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/release_testing.go b/cmd/helm/release_testing.go index bdfa87a60..0c9debb3f 100644 --- a/cmd/helm/release_testing.go +++ b/cmd/helm/release_testing.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/release_testing_test.go b/cmd/helm/release_testing_test.go index b946746d0..f4f64c16d 100644 --- a/cmd/helm/release_testing_test.go +++ b/cmd/helm/release_testing_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo.go b/cmd/helm/repo.go index 8acc762e2..9f1dc8928 100644 --- a/cmd/helm/repo.go +++ b/cmd/helm/repo.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index 77a64cc89..906a9aef4 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go index 157b1cc5b..5a458cef7 100644 --- a/cmd/helm/repo_add_test.go +++ b/cmd/helm/repo_add_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_index.go b/cmd/helm/repo_index.go index 939f35ac0..b3f49fb97 100644 --- a/cmd/helm/repo_index.go +++ b/cmd/helm/repo_index.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_index_test.go b/cmd/helm/repo_index_test.go index 4d6313f6c..0d5571ef7 100644 --- a/cmd/helm/repo_index_test.go +++ b/cmd/helm/repo_index_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_list.go b/cmd/helm/repo_list.go index 0f795b2b0..36887c69b 100644 --- a/cmd/helm/repo_list.go +++ b/cmd/helm/repo_list.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_remove.go b/cmd/helm/repo_remove.go index 728852fa1..f13b8dadb 100644 --- a/cmd/helm/repo_remove.go +++ b/cmd/helm/repo_remove.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_remove_test.go b/cmd/helm/repo_remove_test.go index bc071b989..f52c3afc4 100644 --- a/cmd/helm/repo_remove_test.go +++ b/cmd/helm/repo_remove_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_update.go b/cmd/helm/repo_update.go index 51e5c0868..291b21b72 100644 --- a/cmd/helm/repo_update.go +++ b/cmd/helm/repo_update.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go index 68f964f32..71dc87966 100644 --- a/cmd/helm/repo_update_test.go +++ b/cmd/helm/repo_update_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index 1fe0ce39f..5b0914e82 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/reset_test.go b/cmd/helm/reset_test.go index 189b69273..8a74e8af5 100644 --- a/cmd/helm/reset_test.go +++ b/cmd/helm/reset_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index c47a8272d..8e97ee6a9 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/rollback_test.go b/cmd/helm/rollback_test.go index 62bfd6477..a98a4096a 100644 --- a/cmd/helm/rollback_test.go +++ b/cmd/helm/rollback_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/search.go b/cmd/helm/search.go index ab284a898..84f328d41 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/search/search.go b/cmd/helm/search/search.go index 6c4cb4aa4..04acb8690 100644 --- a/cmd/helm/search/search.go +++ b/cmd/helm/search/search.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/search/search_test.go b/cmd/helm/search/search_test.go index 574f55448..8432685fa 100644 --- a/cmd/helm/search/search_test.go +++ b/cmd/helm/search/search_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/search_test.go b/cmd/helm/search_test.go index 734f752f5..233f94572 100644 --- a/cmd/helm/search_test.go +++ b/cmd/helm/search_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/serve.go b/cmd/helm/serve.go index 21ae36da1..81f2785c3 100644 --- a/cmd/helm/serve.go +++ b/cmd/helm/serve.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/status.go b/cmd/helm/status.go index b73b6f56e..be057a28e 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/status_test.go b/cmd/helm/status_test.go index 616b027f3..4a00b8698 100644 --- a/cmd/helm/status_test.go +++ b/cmd/helm/status_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/template.go b/cmd/helm/template.go index bcfb6a7e4..208032029 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index 263b6bb35..64924c2f2 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index b2907031f..a092492a7 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/upgrade_test.go b/cmd/helm/upgrade_test.go index 032df2f32..60b529f63 100644 --- a/cmd/helm/upgrade_test.go +++ b/cmd/helm/upgrade_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/verify.go b/cmd/helm/verify.go index e82eb4e33..bbc8347c1 100644 --- a/cmd/helm/verify.go +++ b/cmd/helm/verify.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/verify_test.go b/cmd/helm/verify_test.go index 6e8b906fc..4d683df75 100644 --- a/cmd/helm/verify_test.go +++ b/cmd/helm/verify_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/version.go b/cmd/helm/version.go index 407c2bf43..605e96b52 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/version_test.go b/cmd/helm/version_test.go index e25724f4c..5519131c2 100644 --- a/cmd/helm/version_test.go +++ b/cmd/helm/version_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/rudder/rudder.go b/cmd/rudder/rudder.go index 30ece3998..8897e78be 100644 --- a/cmd/rudder/rudder.go +++ b/cmd/rudder/rudder.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/tiller/probes.go b/cmd/tiller/probes.go index 144ad8a1b..7d209aa42 100644 --- a/cmd/tiller/probes.go +++ b/cmd/tiller/probes.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/tiller/probes_test.go b/cmd/tiller/probes_test.go index 0b13460e0..d13979a8a 100644 --- a/cmd/tiller/probes_test.go +++ b/cmd/tiller/probes_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index c97187b2a..0208fe741 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/tiller/tiller_test.go b/cmd/tiller/tiller_test.go index 0698e9d94..9ce153fc7 100644 --- a/cmd/tiller/tiller_test.go +++ b/cmd/tiller/tiller_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/tiller/trace.go b/cmd/tiller/trace.go index 71d7e8f72..126bbf83a 100644 --- a/cmd/tiller/trace.go +++ b/cmd/tiller/trace.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/capabilities.go b/pkg/chartutil/capabilities.go index d26aa1707..d7e660b8a 100644 --- a/pkg/chartutil/capabilities.go +++ b/pkg/chartutil/capabilities.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/capabilities_test.go b/pkg/chartutil/capabilities_test.go index ac20f0038..1f7020a39 100644 --- a/pkg/chartutil/capabilities_test.go +++ b/pkg/chartutil/capabilities_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/chartfile.go b/pkg/chartutil/chartfile.go index c2879cdae..f997d15fe 100644 --- a/pkg/chartutil/chartfile.go +++ b/pkg/chartutil/chartfile.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/chartfile_test.go b/pkg/chartutil/chartfile_test.go index 5b36dc955..e55fbbd48 100755 --- a/pkg/chartutil/chartfile_test.go +++ b/pkg/chartutil/chartfile_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index fa6fb2783..97056c175 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/create_test.go b/pkg/chartutil/create_test.go index e9af83ad2..96c467e7e 100644 --- a/pkg/chartutil/create_test.go +++ b/pkg/chartutil/create_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/doc.go b/pkg/chartutil/doc.go index 1190d968d..cb3f5d1f1 100644 --- a/pkg/chartutil/doc.go +++ b/pkg/chartutil/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/expand.go b/pkg/chartutil/expand.go index 126e14e80..1d49b159f 100644 --- a/pkg/chartutil/expand.go +++ b/pkg/chartutil/expand.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index a09bb8f43..c5496a8b0 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/files_test.go b/pkg/chartutil/files_test.go index 731c82e6f..1488b7986 100644 --- a/pkg/chartutil/files_test.go +++ b/pkg/chartutil/files_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/load.go b/pkg/chartutil/load.go index c5246b8d7..b3daefac7 100644 --- a/pkg/chartutil/load.go +++ b/pkg/chartutil/load.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/load_test.go b/pkg/chartutil/load_test.go index 454500489..5cb15fbdc 100644 --- a/pkg/chartutil/load_test.go +++ b/pkg/chartutil/load_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/requirements.go b/pkg/chartutil/requirements.go index 6ef6508d9..566123122 100644 --- a/pkg/chartutil/requirements.go +++ b/pkg/chartutil/requirements.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/requirements_test.go b/pkg/chartutil/requirements_test.go index 24388f86c..0afde17e1 100644 --- a/pkg/chartutil/requirements_test.go +++ b/pkg/chartutil/requirements_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index 8a2746993..9b85d0714 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/save_test.go b/pkg/chartutil/save_test.go index 3279281b2..0ec305e78 100644 --- a/pkg/chartutil/save_test.go +++ b/pkg/chartutil/save_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/transform.go b/pkg/chartutil/transform.go index 7cbb754fb..fbee8e690 100644 --- a/pkg/chartutil/transform.go +++ b/pkg/chartutil/transform.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index 66a2658d5..1ea7edd8c 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index d9b03c21a..f54b25827 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 59b9d4d75..92c8f9165 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/downloader/chart_downloader_test.go b/pkg/downloader/chart_downloader_test.go index 80efa77e8..5967eee70 100644 --- a/pkg/downloader/chart_downloader_test.go +++ b/pkg/downloader/chart_downloader_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/downloader/doc.go b/pkg/downloader/doc.go index fb54936b8..c70b2f695 100644 --- a/pkg/downloader/doc.go +++ b/pkg/downloader/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 9ee1f6f6d..67f9dc7bf 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/downloader/manager_test.go b/pkg/downloader/manager_test.go index 1ff2a9c17..8c2377e47 100644 --- a/pkg/downloader/manager_test.go +++ b/pkg/downloader/manager_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/engine/doc.go b/pkg/engine/doc.go index 53c4084b0..63c036605 100644 --- a/pkg/engine/doc.go +++ b/pkg/engine/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index c2e74af5c..b6cffc56b 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/engine/engine_test.go b/pkg/engine/engine_test.go index 8ffb3d87c..91a3fd795 100644 --- a/pkg/engine/engine_test.go +++ b/pkg/engine/engine_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/getter/doc.go b/pkg/getter/doc.go index fe51e4967..c53ef1ae0 100644 --- a/pkg/getter/doc.go +++ b/pkg/getter/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/getter/getter.go b/pkg/getter/getter.go index ca018884a..c595fec69 100644 --- a/pkg/getter/getter.go +++ b/pkg/getter/getter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/getter/getter_test.go b/pkg/getter/getter_test.go index 6d38a0d28..d03c82686 100644 --- a/pkg/getter/getter_test.go +++ b/pkg/getter/getter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index 1df6b0f62..4987e951a 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/getter/httpgetter_test.go b/pkg/getter/httpgetter_test.go index fa4863de8..fbe330390 100644 --- a/pkg/getter/httpgetter_test.go +++ b/pkg/getter/httpgetter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/getter/plugingetter.go b/pkg/getter/plugingetter.go index a73ccc853..8f2099de0 100644 --- a/pkg/getter/plugingetter.go +++ b/pkg/getter/plugingetter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/getter/plugingetter_test.go b/pkg/getter/plugingetter_test.go index f1fe9bf29..9bfe6144d 100644 --- a/pkg/getter/plugingetter_test.go +++ b/pkg/getter/plugingetter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 465ca0af8..f9774392f 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/client_test.go b/pkg/helm/client_test.go index 95e044499..30d8e2002 100644 --- a/pkg/helm/client_test.go +++ b/pkg/helm/client_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index 9b0acce4c..4241bbb8a 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/environment/environment_test.go b/pkg/helm/environment/environment_test.go index c7d65cd5a..35958e791 100644 --- a/pkg/helm/environment/environment_test.go +++ b/pkg/helm/environment/environment_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index 05235c92a..a3b0ebc84 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/fake_test.go b/pkg/helm/fake_test.go index f6de572b5..f16fbaf4c 100644 --- a/pkg/helm/fake_test.go +++ b/pkg/helm/fake_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/helm_test.go b/pkg/helm/helm_test.go index 2b0436581..fe7150cc0 100644 --- a/pkg/helm/helm_test.go +++ b/pkg/helm/helm_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/helmpath/helmhome.go b/pkg/helm/helmpath/helmhome.go index b5ec4909e..9608ea6dd 100644 --- a/pkg/helm/helmpath/helmhome.go +++ b/pkg/helm/helmpath/helmhome.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/helm/helmpath/helmhome_unix_test.go b/pkg/helm/helmpath/helmhome_unix_test.go index 494d0f6b4..ca9035554 100644 --- a/pkg/helm/helmpath/helmhome_unix_test.go +++ b/pkg/helm/helmpath/helmhome_unix_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/helm/helmpath/helmhome_windows_test.go b/pkg/helm/helmpath/helmhome_windows_test.go index e416bfd58..db1341421 100644 --- a/pkg/helm/helmpath/helmhome_windows_test.go +++ b/pkg/helm/helmpath/helmhome_windows_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/helm/interface.go b/pkg/helm/interface.go index 10c04c710..d09b6cf8f 100644 --- a/pkg/helm/interface.go +++ b/pkg/helm/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 4babec073..5579ae76d 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/portforwarder/pod.go b/pkg/helm/portforwarder/pod.go index 5eae5b5e6..239eb2730 100644 --- a/pkg/helm/portforwarder/pod.go +++ b/pkg/helm/portforwarder/pod.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/portforwarder/portforwarder.go b/pkg/helm/portforwarder/portforwarder.go index 878610d5f..cc3261d1c 100644 --- a/pkg/helm/portforwarder/portforwarder.go +++ b/pkg/helm/portforwarder/portforwarder.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/portforwarder/portforwarder_test.go b/pkg/helm/portforwarder/portforwarder_test.go index e4c148991..ad5a23bc8 100644 --- a/pkg/helm/portforwarder/portforwarder_test.go +++ b/pkg/helm/portforwarder/portforwarder_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/hooks/hooks.go b/pkg/hooks/hooks.go index 64118333d..5083672cd 100644 --- a/pkg/hooks/hooks.go +++ b/pkg/hooks/hooks.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/ignore/doc.go b/pkg/ignore/doc.go index 7281c33a9..85cc91060 100644 --- a/pkg/ignore/doc.go +++ b/pkg/ignore/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/ignore/rules.go b/pkg/ignore/rules.go index 185d289bb..9a8e08327 100644 --- a/pkg/ignore/rules.go +++ b/pkg/ignore/rules.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/ignore/rules_test.go b/pkg/ignore/rules_test.go index 17b8bf403..a2f709097 100644 --- a/pkg/ignore/rules_test.go +++ b/pkg/ignore/rules_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 926174ef1..39187da42 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index 47049810a..6e33ca27f 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/config.go b/pkg/kube/config.go index ac0a9015d..7504d9028 100644 --- a/pkg/kube/config.go +++ b/pkg/kube/config.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/log.go b/pkg/kube/log.go index fbe51823a..fc3683b1d 100644 --- a/pkg/kube/log.go +++ b/pkg/kube/log.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/namespace.go b/pkg/kube/namespace.go index c6878bd0f..57e62bab7 100644 --- a/pkg/kube/namespace.go +++ b/pkg/kube/namespace.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/namespace_test.go b/pkg/kube/namespace_test.go index eb96557d0..79e8e880c 100644 --- a/pkg/kube/namespace_test.go +++ b/pkg/kube/namespace_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/result.go b/pkg/kube/result.go index 87c7e6ac1..f90d77ad5 100644 --- a/pkg/kube/result.go +++ b/pkg/kube/result.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/result_test.go b/pkg/kube/result_test.go index 962e90426..0780ad9fc 100644 --- a/pkg/kube/result_test.go +++ b/pkg/kube/result_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/tunnel.go b/pkg/kube/tunnel.go index 08280f25d..f4eaa7e26 100644 --- a/pkg/kube/tunnel.go +++ b/pkg/kube/tunnel.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/tunnel_test.go b/pkg/kube/tunnel_test.go index 264200ddf..37fb296a3 100644 --- a/pkg/kube/tunnel_test.go +++ b/pkg/kube/tunnel_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/wait.go b/pkg/kube/wait.go index 88f3c7d34..ed9bc10a6 100644 --- a/pkg/kube/wait.go +++ b/pkg/kube/wait.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/lint.go b/pkg/lint/lint.go index 256eab906..aa8df5814 100644 --- a/pkg/lint/lint.go +++ b/pkg/lint/lint.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/lint_test.go b/pkg/lint/lint_test.go index d84faa10b..84dfbf508 100644 --- a/pkg/lint/lint_test.go +++ b/pkg/lint/lint_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/chartfile.go b/pkg/lint/rules/chartfile.go index 0dab0d250..12f028af1 100644 --- a/pkg/lint/rules/chartfile.go +++ b/pkg/lint/rules/chartfile.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/chartfile_test.go b/pkg/lint/rules/chartfile_test.go index 99dc4de0f..235e5fc4c 100644 --- a/pkg/lint/rules/chartfile_test.go +++ b/pkg/lint/rules/chartfile_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index 3bddcf5fc..192150737 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/template_test.go b/pkg/lint/rules/template_test.go index cb1be94a2..41a7384e7 100644 --- a/pkg/lint/rules/template_test.go +++ b/pkg/lint/rules/template_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/values.go b/pkg/lint/rules/values.go index 9b97598f0..4781cc176 100644 --- a/pkg/lint/rules/values.go +++ b/pkg/lint/rules/values.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/support/doc.go b/pkg/lint/support/doc.go index 4cf7272e4..ede608906 100644 --- a/pkg/lint/support/doc.go +++ b/pkg/lint/support/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/support/message.go b/pkg/lint/support/message.go index 6a878031a..4dd485c98 100644 --- a/pkg/lint/support/message.go +++ b/pkg/lint/support/message.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/support/message_test.go b/pkg/lint/support/message_test.go index 4a9c33c34..55675eeee 100644 --- a/pkg/lint/support/message_test.go +++ b/pkg/lint/support/message_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/plugin/cache/cache.go b/pkg/plugin/cache/cache.go index a1d3224c8..d846126f1 100644 --- a/pkg/plugin/cache/cache.go +++ b/pkg/plugin/cache/cache.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/hooks.go b/pkg/plugin/hooks.go index b5ca032ac..70ce5d122 100644 --- a/pkg/plugin/hooks.go +++ b/pkg/plugin/hooks.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/base.go b/pkg/plugin/installer/base.go index 0664dae76..15ce3cbcf 100644 --- a/pkg/plugin/installer/base.go +++ b/pkg/plugin/installer/base.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/doc.go b/pkg/plugin/installer/doc.go index a2a66f3e1..0089e33f8 100644 --- a/pkg/plugin/installer/doc.go +++ b/pkg/plugin/installer/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/http_installer.go b/pkg/plugin/installer/http_installer.go index b5c205de6..fd58b88ca 100644 --- a/pkg/plugin/installer/http_installer.go +++ b/pkg/plugin/installer/http_installer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/http_installer_test.go b/pkg/plugin/installer/http_installer_test.go index bab5f7a92..73af75e8c 100644 --- a/pkg/plugin/installer/http_installer_test.go +++ b/pkg/plugin/installer/http_installer_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/installer.go b/pkg/plugin/installer/installer.go index 02aee9f46..76c751d50 100644 --- a/pkg/plugin/installer/installer.go +++ b/pkg/plugin/installer/installer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/local_installer.go b/pkg/plugin/installer/local_installer.go index 3cf6bb422..f39086a6e 100644 --- a/pkg/plugin/installer/local_installer.go +++ b/pkg/plugin/installer/local_installer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/local_installer_test.go b/pkg/plugin/installer/local_installer_test.go index 6a7c957d6..fb5fa2675 100644 --- a/pkg/plugin/installer/local_installer_test.go +++ b/pkg/plugin/installer/local_installer_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/vcs_installer.go b/pkg/plugin/installer/vcs_installer.go index 0a373a971..4b502dae4 100644 --- a/pkg/plugin/installer/vcs_installer.go +++ b/pkg/plugin/installer/vcs_installer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/vcs_installer_test.go b/pkg/plugin/installer/vcs_installer_test.go index d6eb32c1b..548a7a49a 100644 --- a/pkg/plugin/installer/vcs_installer_test.go +++ b/pkg/plugin/installer/vcs_installer_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index b3458c2d8..07fcc700a 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/plugin_test.go b/pkg/plugin/plugin_test.go index 5ddbf15f3..338d949f8 100644 --- a/pkg/plugin/plugin_test.go +++ b/pkg/plugin/plugin_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/provenance/doc.go b/pkg/provenance/doc.go index dacfa9e69..bee484944 100644 --- a/pkg/provenance/doc.go +++ b/pkg/provenance/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/provenance/sign.go b/pkg/provenance/sign.go index ecd6612a3..5e23c2dda 100644 --- a/pkg/provenance/sign.go +++ b/pkg/provenance/sign.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/provenance/sign_test.go b/pkg/provenance/sign_test.go index 388941deb..d74e23887 100644 --- a/pkg/provenance/sign_test.go +++ b/pkg/provenance/sign_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/releasetesting/environment.go b/pkg/releasetesting/environment.go index 3b3d07933..17a22c21d 100644 --- a/pkg/releasetesting/environment.go +++ b/pkg/releasetesting/environment.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releasetesting/environment_test.go b/pkg/releasetesting/environment_test.go index 0199b74eb..4403ab6a9 100644 --- a/pkg/releasetesting/environment_test.go +++ b/pkg/releasetesting/environment_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releasetesting/test_suite.go b/pkg/releasetesting/test_suite.go index 2e42400ce..79f00301e 100644 --- a/pkg/releasetesting/test_suite.go +++ b/pkg/releasetesting/test_suite.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releasetesting/test_suite_test.go b/pkg/releasetesting/test_suite_test.go index 0c2fae876..828b14e99 100644 --- a/pkg/releasetesting/test_suite_test.go +++ b/pkg/releasetesting/test_suite_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/filter.go b/pkg/releaseutil/filter.go index fdd2cc381..458da705f 100644 --- a/pkg/releaseutil/filter.go +++ b/pkg/releaseutil/filter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/filter_test.go b/pkg/releaseutil/filter_test.go index 590952363..802b1db7a 100644 --- a/pkg/releaseutil/filter_test.go +++ b/pkg/releaseutil/filter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/manifest.go b/pkg/releaseutil/manifest.go index a0449cc55..78c2979c4 100644 --- a/pkg/releaseutil/manifest.go +++ b/pkg/releaseutil/manifest.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/manifest_test.go b/pkg/releaseutil/manifest_test.go index 7906279ad..8e0793d5f 100644 --- a/pkg/releaseutil/manifest_test.go +++ b/pkg/releaseutil/manifest_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/sorter.go b/pkg/releaseutil/sorter.go index 1b744d72c..1a13298b0 100644 --- a/pkg/releaseutil/sorter.go +++ b/pkg/releaseutil/sorter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/sorter_test.go b/pkg/releaseutil/sorter_test.go index 7d4e31e2e..a3323bd96 100644 --- a/pkg/releaseutil/sorter_test.go +++ b/pkg/releaseutil/sorter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index 438f66d7c..6e14d8c03 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/chartrepo_test.go b/pkg/repo/chartrepo_test.go index 948ee12d3..44834178e 100644 --- a/pkg/repo/chartrepo_test.go +++ b/pkg/repo/chartrepo_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/doc.go b/pkg/repo/doc.go index fb8b3f4b2..19ccf267c 100644 --- a/pkg/repo/doc.go +++ b/pkg/repo/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/index.go b/pkg/repo/index.go index 174ceea01..01bf4a8ca 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/index_test.go b/pkg/repo/index_test.go index ba426b174..2ce817ce3 100644 --- a/pkg/repo/index_test.go +++ b/pkg/repo/index_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/local.go b/pkg/repo/local.go index f13a4d0ac..caca1b9c2 100644 --- a/pkg/repo/local.go +++ b/pkg/repo/local.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/local_test.go b/pkg/repo/local_test.go index 1e5359dee..cf6cf2d11 100644 --- a/pkg/repo/local_test.go +++ b/pkg/repo/local_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index b5bba164e..fa550357a 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/repo_test.go b/pkg/repo/repo_test.go index 4b5bcdbf5..264e9bc3c 100644 --- a/pkg/repo/repo_test.go +++ b/pkg/repo/repo_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/repotest/doc.go b/pkg/repo/repotest/doc.go index 34d4bc6b0..3bf98aa7e 100644 --- a/pkg/repo/repotest/doc.go +++ b/pkg/repo/repotest/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/repo/repotest/server.go b/pkg/repo/repotest/server.go index 8ea9103a0..36ab10d70 100644 --- a/pkg/repo/repotest/server.go +++ b/pkg/repo/repotest/server.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/repo/repotest/server_test.go b/pkg/repo/repotest/server_test.go index 61c056172..e4819fbf7 100644 --- a/pkg/repo/repotest/server_test.go +++ b/pkg/repo/repotest/server_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/resolver/resolver.go b/pkg/resolver/resolver.go index ec8ea2cce..8177df2d3 100644 --- a/pkg/resolver/resolver.go +++ b/pkg/resolver/resolver.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/resolver/resolver_test.go b/pkg/resolver/resolver_test.go index 78a0bc46c..689ffbc32 100644 --- a/pkg/resolver/resolver_test.go +++ b/pkg/resolver/resolver_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/rudder/client.go b/pkg/rudder/client.go index 219bb010a..093a0c360 100644 --- a/pkg/rudder/client.go +++ b/pkg/rudder/client.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/cfgmaps.go b/pkg/storage/driver/cfgmaps.go index 51fa8f8f6..3f5ee204a 100644 --- a/pkg/storage/driver/cfgmaps.go +++ b/pkg/storage/driver/cfgmaps.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/cfgmaps_test.go b/pkg/storage/driver/cfgmaps_test.go index 7501ad9cb..c028e9fdf 100644 --- a/pkg/storage/driver/cfgmaps_test.go +++ b/pkg/storage/driver/cfgmaps_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/storage/driver/driver.go b/pkg/storage/driver/driver.go index e01d35d64..d8c4122b5 100644 --- a/pkg/storage/driver/driver.go +++ b/pkg/storage/driver/driver.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/labels.go b/pkg/storage/driver/labels.go index 8668d665b..eb7118fe5 100644 --- a/pkg/storage/driver/labels.go +++ b/pkg/storage/driver/labels.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/labels_test.go b/pkg/storage/driver/labels_test.go index af0bd24e5..e8d7fc90c 100644 --- a/pkg/storage/driver/labels_test.go +++ b/pkg/storage/driver/labels_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/memory.go b/pkg/storage/driver/memory.go index ceb0d67dd..ea3faf26b 100644 --- a/pkg/storage/driver/memory.go +++ b/pkg/storage/driver/memory.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/memory_test.go b/pkg/storage/driver/memory_test.go index 1062071e7..4f45cf72b 100644 --- a/pkg/storage/driver/memory_test.go +++ b/pkg/storage/driver/memory_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/mock_test.go b/pkg/storage/driver/mock_test.go index 979d11cb6..1ebe7f650 100644 --- a/pkg/storage/driver/mock_test.go +++ b/pkg/storage/driver/mock_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/records.go b/pkg/storage/driver/records.go index ce72308a8..bc793d8b3 100644 --- a/pkg/storage/driver/records.go +++ b/pkg/storage/driver/records.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/records_test.go b/pkg/storage/driver/records_test.go index 79380afb8..8063ab9dc 100644 --- a/pkg/storage/driver/records_test.go +++ b/pkg/storage/driver/records_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/secrets.go b/pkg/storage/driver/secrets.go index e8f3984f6..1b8064e53 100644 --- a/pkg/storage/driver/secrets.go +++ b/pkg/storage/driver/secrets.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/secrets_test.go b/pkg/storage/driver/secrets_test.go index e6f62e702..6c9c63ad4 100644 --- a/pkg/storage/driver/secrets_test.go +++ b/pkg/storage/driver/secrets_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/storage/driver/util.go b/pkg/storage/driver/util.go index 65fb17e7c..7807382b6 100644 --- a/pkg/storage/driver/util.go +++ b/pkg/storage/driver/util.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index d308cef1b..40fc558a1 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/storage_test.go b/pkg/storage/storage_test.go index fb2824de7..19d786ad9 100644 --- a/pkg/storage/storage_test.go +++ b/pkg/storage/storage_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/strvals/doc.go b/pkg/strvals/doc.go index d2b859e67..f17290587 100644 --- a/pkg/strvals/doc.go +++ b/pkg/strvals/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index eb29c250f..1fd9ab81e 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index f23a57e0a..e5d878149 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/sympath/walk.go b/pkg/sympath/walk.go index 77fa04153..b2500284a 100644 --- a/pkg/sympath/walk.go +++ b/pkg/sympath/walk.go @@ -4,7 +4,7 @@ the BSD license. https://github.com/golang/go/blob/master/LICENSE -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/sympath/walk_test.go b/pkg/sympath/walk_test.go index d86d8dabd..ab8e0eb4c 100644 --- a/pkg/sympath/walk_test.go +++ b/pkg/sympath/walk_test.go @@ -4,7 +4,7 @@ the BSD license. https://github.com/golang/go/blob/master/LICENSE -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/tiller/environment/environment.go b/pkg/tiller/environment/environment.go index 18518dfc1..b38230bab 100644 --- a/pkg/tiller/environment/environment.go +++ b/pkg/tiller/environment/environment.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/environment/environment_test.go b/pkg/tiller/environment/environment_test.go index d8c82b901..0c10cda37 100644 --- a/pkg/tiller/environment/environment_test.go +++ b/pkg/tiller/environment/environment_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/hook_sorter.go b/pkg/tiller/hook_sorter.go index 42d546620..11fa61533 100644 --- a/pkg/tiller/hook_sorter.go +++ b/pkg/tiller/hook_sorter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/hook_sorter_test.go b/pkg/tiller/hook_sorter_test.go index ac5b9bf8d..efe960ca4 100644 --- a/pkg/tiller/hook_sorter_test.go +++ b/pkg/tiller/hook_sorter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/hooks.go b/pkg/tiller/hooks.go index 2dd085ed7..d53ed504f 100644 --- a/pkg/tiller/hooks.go +++ b/pkg/tiller/hooks.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/hooks_test.go b/pkg/tiller/hooks_test.go index 658f859f4..8bd928500 100644 --- a/pkg/tiller/hooks_test.go +++ b/pkg/tiller/hooks_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index 43726d53e..65e3f478d 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/kind_sorter_test.go b/pkg/tiller/kind_sorter_test.go index 8d01fac17..fb3e8ad57 100644 --- a/pkg/tiller/kind_sorter_test.go +++ b/pkg/tiller/kind_sorter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_content.go b/pkg/tiller/release_content.go index fd783d6b6..2315f1aaa 100644 --- a/pkg/tiller/release_content.go +++ b/pkg/tiller/release_content.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_content_test.go b/pkg/tiller/release_content_test.go index 7c003f709..4a29c5d3e 100644 --- a/pkg/tiller/release_content_test.go +++ b/pkg/tiller/release_content_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_history.go b/pkg/tiller/release_history.go index 0dd525978..fe7ad1395 100644 --- a/pkg/tiller/release_history.go +++ b/pkg/tiller/release_history.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_history_test.go b/pkg/tiller/release_history_test.go index 5df98410f..58b7fad9a 100644 --- a/pkg/tiller/release_history_test.go +++ b/pkg/tiller/release_history_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_install.go b/pkg/tiller/release_install.go index 01ef88c98..973da3581 100644 --- a/pkg/tiller/release_install.go +++ b/pkg/tiller/release_install.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index bbea3b9dd..f5e84d870 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_list.go b/pkg/tiller/release_list.go index 72c21d97c..3344888dc 100644 --- a/pkg/tiller/release_list.go +++ b/pkg/tiller/release_list.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_list_test.go b/pkg/tiller/release_list_test.go index 64877422a..7b0fe6830 100644 --- a/pkg/tiller/release_list_test.go +++ b/pkg/tiller/release_list_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_modules.go b/pkg/tiller/release_modules.go index 876e1ba37..a587581ed 100644 --- a/pkg/tiller/release_modules.go +++ b/pkg/tiller/release_modules.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_rollback.go b/pkg/tiller/release_rollback.go index ab6462db9..75e282fb8 100644 --- a/pkg/tiller/release_rollback.go +++ b/pkg/tiller/release_rollback.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_rollback_test.go b/pkg/tiller/release_rollback_test.go index 710f0ebbe..d7909ed8b 100644 --- a/pkg/tiller/release_rollback_test.go +++ b/pkg/tiller/release_rollback_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index a75b7fc86..bde4c8465 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index 96cb84a75..b3b1bc49d 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_status.go b/pkg/tiller/release_status.go index e0d75877d..3f8047118 100644 --- a/pkg/tiller/release_status.go +++ b/pkg/tiller/release_status.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_status_test.go b/pkg/tiller/release_status_test.go index 4ba0f6cd5..69a710143 100644 --- a/pkg/tiller/release_status_test.go +++ b/pkg/tiller/release_status_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_testing.go b/pkg/tiller/release_testing.go index a44b67e6f..06d41e323 100644 --- a/pkg/tiller/release_testing.go +++ b/pkg/tiller/release_testing.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_testing_test.go b/pkg/tiller/release_testing_test.go index f8d92ebcc..e0fc7df41 100644 --- a/pkg/tiller/release_testing_test.go +++ b/pkg/tiller/release_testing_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_uninstall.go b/pkg/tiller/release_uninstall.go index 294645ae7..2ae3e4c36 100644 --- a/pkg/tiller/release_uninstall.go +++ b/pkg/tiller/release_uninstall.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_uninstall_test.go b/pkg/tiller/release_uninstall_test.go index a68ac55f7..d33e9c2a6 100644 --- a/pkg/tiller/release_uninstall_test.go +++ b/pkg/tiller/release_uninstall_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index e94de705d..1187226e5 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 56dcca874..519b839fc 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_version.go b/pkg/tiller/release_version.go index 66b7137bb..0656a1ab9 100644 --- a/pkg/tiller/release_version.go +++ b/pkg/tiller/release_version.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/resource_policy.go b/pkg/tiller/resource_policy.go index 66da1283f..cca2391d8 100644 --- a/pkg/tiller/resource_policy.go +++ b/pkg/tiller/resource_policy.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/server.go b/pkg/tiller/server.go index 818cfd47a..0fbcd4533 100644 --- a/pkg/tiller/server.go +++ b/pkg/tiller/server.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/timeconv/doc.go b/pkg/timeconv/doc.go index 235167391..0565a45cd 100644 --- a/pkg/timeconv/doc.go +++ b/pkg/timeconv/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/timeconv/timeconv.go b/pkg/timeconv/timeconv.go index 24ff10f4e..4d11abfe6 100644 --- a/pkg/timeconv/timeconv.go +++ b/pkg/timeconv/timeconv.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/timeconv/timeconv_test.go b/pkg/timeconv/timeconv_test.go index f673df3c9..bd22a238d 100644 --- a/pkg/timeconv/timeconv_test.go +++ b/pkg/timeconv/timeconv_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tlsutil/cfg.go b/pkg/tlsutil/cfg.go index 9ce3109e1..408867db1 100644 --- a/pkg/tlsutil/cfg.go +++ b/pkg/tlsutil/cfg.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tlsutil/tls.go b/pkg/tlsutil/tls.go index c166a1662..6b0052acc 100644 --- a/pkg/tlsutil/tls.go +++ b/pkg/tlsutil/tls.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tlsutil/tlsutil_test.go b/pkg/tlsutil/tlsutil_test.go index 4f04d50ab..a4b3c9c22 100644 --- a/pkg/tlsutil/tlsutil_test.go +++ b/pkg/tlsutil/tlsutil_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/urlutil/urlutil.go b/pkg/urlutil/urlutil.go index fb67708ae..272907de0 100644 --- a/pkg/urlutil/urlutil.go +++ b/pkg/urlutil/urlutil.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/urlutil/urlutil_test.go b/pkg/urlutil/urlutil_test.go index f0c82c0a9..616c4f14f 100644 --- a/pkg/urlutil/urlutil_test.go +++ b/pkg/urlutil/urlutil_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/compatible.go b/pkg/version/compatible.go index 735610778..d0516a9d0 100644 --- a/pkg/version/compatible.go +++ b/pkg/version/compatible.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/compatible_test.go b/pkg/version/compatible_test.go index adc1c489e..7a3b23a7d 100644 --- a/pkg/version/compatible_test.go +++ b/pkg/version/compatible_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/doc.go b/pkg/version/doc.go index 23c9e500d..3b61dd50e 100644 --- a/pkg/version/doc.go +++ b/pkg/version/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/version.go b/pkg/version/version.go index 6f5a1a452..b2ea2c50f 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/version_test.go b/pkg/version/version_test.go index e0e4cac0f..eba573533 100644 --- a/pkg/version/version_test.go +++ b/pkg/version/version_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index ef426616a..bfc071350 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2016 The Kubernetes Authors. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/rootfs/Dockerfile.experimental b/rootfs/Dockerfile.experimental index 66a218477..329a31086 100644 --- a/rootfs/Dockerfile.experimental +++ b/rootfs/Dockerfile.experimental @@ -1,4 +1,4 @@ -# Copyright 2017 The Kubernetes Authors. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/rootfs/Dockerfile.rudder b/rootfs/Dockerfile.rudder index 6bb3a2d92..61afb8af8 100644 --- a/rootfs/Dockerfile.rudder +++ b/rootfs/Dockerfile.rudder @@ -1,4 +1,4 @@ -# Copyright 2017 The Kubernetes Authors. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 1863d5835..62d495769 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/get b/scripts/get index af0960abf..08c455177 100755 --- a/scripts/get +++ b/scripts/get @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/sync-repo.sh b/scripts/sync-repo.sh index 3795b1a7c..453102072 100755 --- a/scripts/sync-repo.sh +++ b/scripts/sync-repo.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/update-docs.sh b/scripts/update-docs.sh index e014b537e..d3018be50 100755 --- a/scripts/update-docs.sh +++ b/scripts/update-docs.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2017 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/util.sh b/scripts/util.sh index 09caaf972..c1e6c3751 100644 --- a/scripts/util.sh +++ b/scripts/util.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/validate-go.sh b/scripts/validate-go.sh index 2ecf5dfb3..328ce40f9 100755 --- a/scripts/validate-go.sh +++ b/scripts/validate-go.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/validate-license.sh b/scripts/validate-license.sh index fe7ec481b..12c76f75c 100755 --- a/scripts/validate-license.sh +++ b/scripts/validate-license.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,10 +27,19 @@ find_files() { \( -name '*.go' -o -name '*.sh' -o -name 'Dockerfile' \) } -failed=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License");')) -if (( ${#failed[@]} > 0 )); then +failed_license_header=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License");')) +if (( ${#failed_license_header[@]} > 0 )); then echo "Some source files are missing license headers." - for f in "${failed[@]}"; do + for f in "${failed_license_header[@]}"; do + echo " $f" + done + exit 1 +fi + +failed_copyright_header=($(find_files | xargs grep -L 'Copyright The Helm Authors.')) +if (( ${#failed_copyright_header[@]} > 0 )); then + echo "Some source files are missing the copyright header." + for f in "${failed_copyright_header[@]}"; do echo " $f" done exit 1 diff --git a/scripts/verify-docs.sh b/scripts/verify-docs.sh index b0b799eac..b176b036e 100755 --- a/scripts/verify-docs.sh +++ b/scripts/verify-docs.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2017 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 9542f5aed81bb8abae5c23b42f9453dbd751d143 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 4 Jul 2018 15:12:48 -0700 Subject: [PATCH 299/449] fix `helm template -x` pathing issues on Windows tiller's rendering engine converts os filepath separators into unix-style filepath separators, so we need to split template names with a forward slash. --- cmd/helm/template.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 208032029..54eb9ff49 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -246,7 +246,9 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { } for _, manifest := range listManifests { - manifestPathSplit := strings.Split(manifest.Name, string(filepath.Separator)) + // manifest.Name is rendered using linux-style filepath separators on Windows as + // well as macOS/linux. + manifestPathSplit := strings.Split(manifest.Name, "/") // remove the chart name from the path manifestPathSplit = manifestPathSplit[1:] toJoin := append([]string{t.chartPath}, manifestPathSplit...) From 23a3e8eb5fe275416e10f4f92a4b07479fde8090 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 26 Apr 2018 12:58:11 -0700 Subject: [PATCH 300/449] add amendments to release checklist --- README.md | 7 ++++--- docs/release_checklist.md | 16 +++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 32627d606..6a35c3f4d 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,15 @@ Think of it like apt/yum/homebrew for Kubernetes. ## Install -Binary downloads of the Helm client can be found on [the latest Releases page](https://github.com/helm/helm/releases/latest). +Binary downloads of the Helm client can be found on [the Releases page](https://github.com/helm/helm/releases/latest). Unpack the `helm` binary and add it to your PATH and you are good to go! If you want to use a package manager: -- macOS/[homebrew](https://brew.sh/) users can use `brew install kubernetes-helm`. -- Windows/[chocolatey](https://chocolatey.org/) users can use `choco install kubernetes-helm`. +- [Homebrew](https://brew.sh/) users can use `brew install kubernetes-helm`. +- [Chocolatey](https://chocolatey.org/) users can use `choco install kubernetes-helm`. +- [GoFish](https://gofi.sh/) users can use `gofish install helm`. To rapidly get Helm up and running, start with the [Quick Start Guide](https://docs.helm.sh/using_helm/#quickstart-guide). diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 5187b720a..2a0036669 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -51,7 +51,7 @@ In this doc, we are going to reference a few environment variables as well, whic ```shell export RELEASE_NAME=vX.Y.0 -export RELEASE_BRANCH_NAME="release-$RELEASE_NAME" +export RELEASE_BRANCH_NAME="release-X.Y" export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc1" ``` @@ -121,8 +121,6 @@ index 2109a0a..6f5a1a4 100644 BuildMetadata = "unreleased" ``` -For patch releases, the old version number will be the latest patch release, so just bump the patch number, incrementing Z by one. - ```shell git add . git commit -m "bump version to $RELEASE_CANDIDATE_NAME" @@ -168,7 +166,7 @@ wget https://kubernetes-helm.storage.googleapis.com/helm-$RELEASE_CANDIDATE_NAME windows/amd64, using PowerShell: ```shell -PS C:\> Invoke-WebRequest -Uri "https://kubernetes-helm.storage.googleapis.com/helm-$RELEASE_CANDIDATE_NAME-windows-amd64.tar.gz" -OutFile "helm-$ReleaseCandidateName-windows-amd64.tar.gz" +PS C:\> Invoke-WebRequest -Uri "https://kubernetes-helm.storage.googleapis.com/helm-$RELEASE_CANDIDATE_NAME-windows-amd64.zip" -OutFile "helm-$ReleaseCandidateName-windows-amd64.zip" ``` Then, unpack and move the binary to somewhere on your $PATH, or move it somewhere and add it to your $PATH (e.g. /usr/local/bin/helm for linux/macOS, C:\Program Files\helm\helm.exe for Windows). @@ -220,7 +218,7 @@ An example release note for a minor release would look like this: Helm vX.Y.Z is a feature release. This release, we focused on . Users are encouraged to upgrade for the best experience. -The community keeps growing, and we'd love to see you there. +The community keeps growing, and we'd love to see you there! - Join the discussion in [Kubernetes Slack](https://slack.k8s.io/): - `#helm-users` for questions and just to hang out @@ -232,9 +230,9 @@ The community keeps growing, and we'd love to see you there. Download Helm X.Y. The common platform binaries are here: -- [OSX](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz) -- [Linux](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz) -- [Windows](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.tar.gz) +- [OSX](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz.sha256)) +- [Linux](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz.sha256)) +- [Windows](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.tar.gz.sha256)) Once you have the client installed, upgrade Tiller with `helm init --upgrade`. @@ -260,7 +258,7 @@ git log --no-merges --pretty=format:'- %s %H (%aN)' $RELEASE_NAME $PREVIOUS_RELE Once finished, go into GitHub and edit the release notes for the tagged release with the notes written here. -## 9. Evangelize +## 8. Evangelize Congratulations! You're done. Go grab yourself a $DRINK_OF_CHOICE. You've earned it. From 6da6ac461fa745fbad10032b63386e84ff9afed8 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 24 May 2018 11:54:45 -0700 Subject: [PATCH 301/449] add every release artifact to the release notes --- docs/release_checklist.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 2a0036669..12b31aa5b 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -230,9 +230,13 @@ The community keeps growing, and we'd love to see you there! Download Helm X.Y. The common platform binaries are here: -- [OSX](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz.sha256)) -- [Linux](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz.sha256)) -- [Windows](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.tar.gz.sha256)) +- [MacOS amd64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz.sha256)) +- [Linux amd64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz.sha256)) +- [Linux arm](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm.tar.gz.sha256)) +- [Linux arm64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm64.tar.gz.sha256)) +- [Linux i386](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-386.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-386.tar.gz.sha256)) +- [Linux ppc64le](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-ppc64le.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-ppc64le.tar.gz.sha256)) +- [Windows amd64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.zip) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.zip.sha256)) Once you have the client installed, upgrade Tiller with `helm init --upgrade`. From d7d8c0a81d4b4c342a8b2ed7b5c168d24737c2df Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 30 Jul 2018 10:13:14 -0700 Subject: [PATCH 302/449] soften the recommendation of hypens in chart names We definitely still suggest that dashes are acceptable for chart packages, but users should be aware of the limitations of dashes in variable names in Go templates. --- docs/chart_best_practices/conventions.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/chart_best_practices/conventions.md b/docs/chart_best_practices/conventions.md index 4d080ceb1..524928e25 100644 --- a/docs/chart_best_practices/conventions.md +++ b/docs/chart_best_practices/conventions.md @@ -4,19 +4,21 @@ This part of the Best Practices Guide explains general conventions. ## Chart Names -Chart names should be lower case letters and numbers. Dashes (-) are not allowed: +Chart names should use lower case letters and numbers, and start with a letter. -Examples: +Hyphens (-) are allowed, but are known to be a little trickier to work with in Helm templates (see [issue #2192](https://github.com/helm/helm/issues/2192) for more information). + +Here are a few examples of good chart names from the [Helm Community Charts](https://github.com/helm/charts): ``` drupal -cluster01 -aws-cluster-autoscaler #incorrect do not use dashes in the name +cert-manager +oauth2-proxy ``` Neither uppercase letters nor underscores should be used in chart names. Dots should not be used in chart names. -The directory that contains a chart MUST have the same name as the chart. Thus, the chart `nginx-lego` MUST be created in a directory called `nginx-lego/`. This is not merely a stylistic detail, but a requirement of the Helm Chart format. +The directory that contains a chart MUST have the same name as the chart. Thus, the chart `cert-manager` MUST be created in a directory called `cert-manager/`. This is not merely a stylistic detail, but a requirement of the Helm Chart format. ## Version Numbers From 3800c57ed2fd26ac405e6fb28f3eb5b107746dd9 Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Mon, 30 Jul 2018 14:18:00 -0700 Subject: [PATCH 303/449] [tiller] make update --force --dry-run obey dry-run --- pkg/tiller/release_update.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 1187226e5..5cd82dfc5 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -161,6 +161,10 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( Timeout: req.Timeout, Wait: req.Wait, }) + + // update new release with next revision number so as to append to the old release's history + newRelease.Version = oldRelease.Version + 1 + res := &services.UpdateReleaseResponse{Release: newRelease} if err != nil { s.Log("failed update prepare step: %s", err) @@ -172,6 +176,12 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( return res, err } + if req.DryRun { + s.Log("dry run for %s", newRelease.Name) + res.Release.Info.Description = "Dry run complete" + return res, nil + } + // From here on out, the release is considered to be in Status_DELETING or Status_DELETED // state. There is no turning back. oldRelease.Info.Status.Code = release.Status_DELETING @@ -218,8 +228,6 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( } } - // update new release with next revision number so as to append to the old release's history - newRelease.Version = oldRelease.Version + 1 s.recordRelease(newRelease, false) if err := s.ReleaseModule.Update(oldRelease, newRelease, req, s.env); err != nil { msg := fmt.Sprintf("Upgrade %q failed: %s", newRelease.Name, err) From 9f8824bcd5d8d00de9338ea3e68fe2725208f7c1 Mon Sep 17 00:00:00 2001 From: Rimas Date: Tue, 31 Jul 2018 12:34:02 +0100 Subject: [PATCH 304/449] replace github org with The Kubernetes package manager To begin working with Helm, run the 'helm init' command: $ helm init This will install Tiller to your running Kubernetes cluster. It will also set up any necessary local configuration. Common actions from this point include: - helm search: search for charts - helm fetch: download a chart to your local directory to view - helm install: upload the chart to Kubernetes - helm list: list releases of charts Environment: $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm $HELM_HOST set an alternative Tiller host. The format is host:port $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") Usage: helm [command] Available Commands: completion Generate autocompletions script for the specified shell (bash or zsh) create create a new chart with the given name delete given a release name, delete the release from Kubernetes dependency manage a chart's dependencies fetch download a chart from a repository and (optionally) unpack it in local directory get download a named release history fetch release history home displays the location of HELM_HOME init initialize Helm on both client and server inspect inspect a chart install install a chart archive lint examines a chart for possible issues list list releases package package a chart directory into a chart archive plugin add, list, or remove Helm plugins repo add, list, remove, update, and index chart repositories reset uninstalls Tiller from a cluster rollback roll back a release to a previous revision search search for a keyword in charts serve start a local http web server status displays the status of the named release template locally render templates test test a release upgrade upgrade a release verify verify that a chart at the given path has been signed and is valid version print the client/server version information Flags: --debug enable verbose output -h, --help help for helm --home string location of your Helm config. Overrides $HELM_HOME (default "/Users/rimas/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") Use "helm [command] --help" for more information about a command. one --- scripts/get | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/get b/scripts/get index 08c455177..79dd69500 100755 --- a/scripts/get +++ b/scripts/get @@ -63,7 +63,7 @@ verifySupported() { local supported="darwin-386\ndarwin-amd64\nlinux-386\nlinux-amd64\nlinux-arm\nlinux-arm64\nlinux-ppc64le\nwindows-386\nwindows-amd64" if ! echo "${supported}" | grep -q "${OS}-${ARCH}"; then echo "No prebuilt binary for ${OS}-${ARCH}." - echo "To build from source, go to https://github.com/kubernetes/helm" + echo "To build from source, go to https://github.com/helm/helm" exit 1 fi @@ -76,7 +76,7 @@ verifySupported() { # checkDesiredVersion checks if the desired version is available. checkDesiredVersion() { # Use the GitHub releases webpage for the project to find the desired version for this project. - local release_url="https://github.com/kubernetes/helm/releases/${DESIRED_VERSION:-latest}" + local release_url="https://github.com/helm/helm/releases/${DESIRED_VERSION:-latest}" if type "curl" > /dev/null; then TAG=$(curl -SsL $release_url | awk '/\/tag\//' | grep -v no-underline | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') elif type "wget" > /dev/null; then @@ -155,7 +155,7 @@ fail_trap() { else echo "Failed to install $PROJECT_NAME" fi - echo -e "\tFor support, go to https://github.com/kubernetes/helm." + echo -e "\tFor support, go to https://github.com/helm/helm." fi cleanup exit $result @@ -182,7 +182,7 @@ help () { echo -e "\te.g. --version v2.4.0 or -v latest" } -# cleanup temporary files to avoid https://github.com/kubernetes/helm/issues/2977 +# cleanup temporary files to avoid https://github.com/helm/helm/issues/2977 cleanup() { if [[ -d "${HELM_TMP_ROOT:-}" ]]; then rm -rf "$HELM_TMP_ROOT" From 92a5a7719551ada638c43055ba00607406ee9b42 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 31 Jul 2018 10:27:51 -0700 Subject: [PATCH 305/449] use dot notation for release candidates --- docs/release_checklist.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 12b31aa5b..fcd3429ad 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -4,7 +4,7 @@ ## Release Meetings As part of the release process, two of the weekly developer calls will be co-opted -as "release meetings." +as "release meetings." ### Start of the Release Cycle The first developer call after a release will be used as the release meeting to @@ -52,7 +52,7 @@ In this doc, we are going to reference a few environment variables as well, whic ```shell export RELEASE_NAME=vX.Y.0 export RELEASE_BRANCH_NAME="release-X.Y" -export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc1" +export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc.1" ``` If you are creating a patch release, you may want to use the following instead: @@ -61,7 +61,7 @@ If you are creating a patch release, you may want to use the following instead: export PREVIOUS_PATCH_RELEASE=vX.Y.Z export RELEASE_NAME=vX.Y.Z+1 export RELEASE_BRANCH_NAME="release-X.Y" -export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc1" +export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc.1" ``` ## 1. Create the Release Branch @@ -188,7 +188,7 @@ You will also want to update the release version number and the CHANGELOG as we After that, tag it and notify users of the new release candidate: ```shell -export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc2" +export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc.2" git tag --sign --annotate "${RELEASE_CANDIDATE_NAME}" --message "Helm release ${RELEASE_CANDIDATE_NAME}" git push upstream $RELEASE_CANDIDATE_NAME ``` From 75be9059ba19dd7ac1e0a03ed1caf97e785d59a4 Mon Sep 17 00:00:00 2001 From: Michael Huttner Date: Wed, 1 Aug 2018 15:38:34 +0200 Subject: [PATCH 306/449] Fixed error in docs for file access $path.base gives the error "can't evaluate field base in type string", it should be "base $path" --- docs/chart_template_guide/accessing_files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/accessing_files.md b/docs/chart_template_guide/accessing_files.md index 11747d4f0..c959002b7 100644 --- a/docs/chart_template_guide/accessing_files.md +++ b/docs/chart_template_guide/accessing_files.md @@ -130,7 +130,7 @@ Or ```yaml {{ range $path, $bytes := .Files.Glob "foo/*" }} -{{ $path.base }}: '{{ $root.Files.Get $path | b64enc }}' +{{ base $path }}: '{{ $root.Files.Get $path | b64enc }}' {{ end }} ``` From 424aa254892f32a86c3cf12eb83b918c85c7f384 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 1 Aug 2018 07:49:35 -0700 Subject: [PATCH 307/449] revert back to /tiller when running `helm init --upgrade`, the entrypoint since v2.9.1 changed which caused tiller to never start. Kubernetes may be holding onto the same entrypoint during upgrades. --- rootfs/Dockerfile | 6 +++--- rootfs/Dockerfile.experimental | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index bfc071350..82dfa0d4c 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -18,10 +18,10 @@ RUN apk update && apk add ca-certificates socat && rm -rf /var/cache/apk/* ENV HOME /tmp -COPY helm /bin/helm -COPY tiller /bin/tiller +COPY helm /helm +COPY tiller /tiller EXPOSE 44134 USER nobody -ENTRYPOINT ["/bin/tiller"] +ENTRYPOINT ["/tiller"] diff --git a/rootfs/Dockerfile.experimental b/rootfs/Dockerfile.experimental index 329a31086..ca0c87f30 100644 --- a/rootfs/Dockerfile.experimental +++ b/rootfs/Dockerfile.experimental @@ -18,9 +18,9 @@ RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* ENV HOME /tmp -COPY tiller /bin/tiller +COPY tiller /tiller EXPOSE 44134 USER nobody -ENTRYPOINT ["/bin/tiller", "--experimental-release"] +ENTRYPOINT ["/tiller", "--experimental-release"] From 36971c61f8bff8f3366ce9305373ac2f2638187d Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 31 Jul 2018 17:28:10 -0700 Subject: [PATCH 308/449] setup connection after displaying client version --- cmd/helm/version.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cmd/helm/version.go b/cmd/helm/version.go index 605e96b52..922e744b2 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -73,15 +73,6 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { if !version.showClient && !version.showServer { version.showClient, version.showServer = true, true } - if version.showServer { - // We do this manually instead of in PreRun because we only - // need a tunnel if server version is requested. - err := setupConnection() - if err != nil { - return err - } - } - version.client = ensureHelmClient(version.client) return version.run() }, } @@ -111,6 +102,13 @@ func (v *versionCmd) run() error { return tpl(v.template, data, v.out) } + // We do this manually instead of in PreRun because we only + // need a tunnel if server version is requested. + if err := setupConnection(); err != nil { + return err + } + v.client = ensureHelmClient(v.client) + if settings.Debug { k8sVersion, err := getK8sVersion() if err != nil { From f7410c0f33be0352579b550cdb4a71cfd3ff099a Mon Sep 17 00:00:00 2001 From: Rimas Date: Fri, 3 Aug 2018 10:32:53 +0100 Subject: [PATCH 309/449] add support for `auth-provider` from kubeconfig files, addreses #4422 --- cmd/tiller/tiller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index 0208fe741..4c3623e59 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -37,6 +37,8 @@ import ( healthpb "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/keepalive" + // Import to initialize client auth plugins. + _ "k8s.io/client-go/plugin/pkg/client/auth" "k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/storage" From 0cad20c2f479099d20096fa0c72cade057e1d968 Mon Sep 17 00:00:00 2001 From: Tomas Restrepo Date: Mon, 6 Aug 2018 18:17:24 -0500 Subject: [PATCH 310/449] Propagate query string arguments in repository URL to absolute chart URL --- pkg/repo/chartrepo.go | 5 ++++- pkg/repo/chartrepo_test.go | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index 6e14d8c03..4e4bc6fe2 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -270,5 +270,8 @@ func ResolveReferenceURL(baseURL, refURL string) (string, error) { return "", fmt.Errorf("failed to parse %s as URL: %v", refURL, err) } - return parsedBaseURL.ResolveReference(parsedRefURL).String(), nil + resolvedURL := parsedBaseURL.ResolveReference(parsedRefURL) + resolvedURL.RawQuery = parsedBaseURL.RawQuery + + return resolvedURL.String(), nil } diff --git a/pkg/repo/chartrepo_test.go b/pkg/repo/chartrepo_test.go index 44834178e..4b290a0d1 100644 --- a/pkg/repo/chartrepo_test.go +++ b/pkg/repo/chartrepo_test.go @@ -287,6 +287,14 @@ func TestResolveReferenceURL(t *testing.T) { t.Errorf("%s", chartURL) } + chartURL, err = ResolveReferenceURL("http://localhost:8123/charts/?st=2018-08-06T22%3A59%3A04Z&se=2018-08-07T22%3A59%3A04Z&sp=rl&sv=2018-03-28&sr=c&sig=cyqM4%2F5G7HNk%2F3faaHSDMaWxFxefCglvZlYSnmQBwiY%3D", "nginx-0.2.0.tgz") + if err != nil { + t.Errorf("%s", err) + } + if chartURL != "http://localhost:8123/charts/nginx-0.2.0.tgz?st=2018-08-06T22%3A59%3A04Z&se=2018-08-07T22%3A59%3A04Z&sp=rl&sv=2018-03-28&sr=c&sig=cyqM4%2F5G7HNk%2F3faaHSDMaWxFxefCglvZlYSnmQBwiY%3D" { + t.Errorf("%s does not contain the query string of the base URL", chartURL) + } + chartURL, err = ResolveReferenceURL("http://localhost:8123", "https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz") if err != nil { t.Errorf("%s", err) From 3241d3e063a5178bbff852d6ba76ed8e107e2ed5 Mon Sep 17 00:00:00 2001 From: Tomas Restrepo Date: Mon, 6 Aug 2018 18:25:02 -0500 Subject: [PATCH 311/449] Only propagate query string if refURL is relative to baseURL --- pkg/repo/chartrepo.go | 7 ++++++- pkg/repo/chartrepo_test.go | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index 4e4bc6fe2..cd9d6c547 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -270,8 +270,13 @@ func ResolveReferenceURL(baseURL, refURL string) (string, error) { return "", fmt.Errorf("failed to parse %s as URL: %v", refURL, err) } + // if the base URL contains query string parameters, + // propagate them to the child URL but only if the + // refURL is relative to baseURL resolvedURL := parsedBaseURL.ResolveReference(parsedRefURL) - resolvedURL.RawQuery = parsedBaseURL.RawQuery + if (resolvedURL.Hostname() == parsedBaseURL.Hostname()) && (resolvedURL.Port() == parsedBaseURL.Port()) { + resolvedURL.RawQuery = parsedBaseURL.RawQuery + } return resolvedURL.String(), nil } diff --git a/pkg/repo/chartrepo_test.go b/pkg/repo/chartrepo_test.go index 4b290a0d1..19071872d 100644 --- a/pkg/repo/chartrepo_test.go +++ b/pkg/repo/chartrepo_test.go @@ -302,4 +302,12 @@ func TestResolveReferenceURL(t *testing.T) { if chartURL != "https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz" { t.Errorf("%s", chartURL) } + + chartURL, err = ResolveReferenceURL("http://localhost:8123/?querystring", "https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz") + if err != nil { + t.Errorf("%s", err) + } + if chartURL != "https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz" { + t.Errorf("%s contains query string from base URL when it shouldn't", chartURL) + } } From 5ca67c3f807c596c2dad000023e3433e6427870f Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Wed, 18 Jul 2018 17:31:39 -0700 Subject: [PATCH 312/449] [tiller] move the Manifest type to its own pkg It's really easy to cause an import cycle on this type; this resolves the problem by moving it out of the tiller pkg into its own. An alias is left behind in order to prevent downstream breakage. --- pkg/manifest/doc.go | 23 +++++++++++++++++++++++ pkg/manifest/types.go | 28 ++++++++++++++++++++++++++++ pkg/tiller/hooks.go | 8 ++------ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 pkg/manifest/doc.go create mode 100644 pkg/manifest/types.go diff --git a/pkg/manifest/doc.go b/pkg/manifest/doc.go new file mode 100644 index 000000000..c2f127cda --- /dev/null +++ b/pkg/manifest/doc.go @@ -0,0 +1,23 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/*Package manifest contains tools for working with kubernetes manifests. + +Much like other parts of helm, it does not generally require that the manifests +be correct yaml, so these functions can be run on broken manifests to aid in +user debugging +*/ +package manifest // import "k8s.io/helm/pkg/manifest" diff --git a/pkg/manifest/types.go b/pkg/manifest/types.go new file mode 100644 index 000000000..4c748c9e5 --- /dev/null +++ b/pkg/manifest/types.go @@ -0,0 +1,28 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package manifest + +import ( + "k8s.io/helm/pkg/releaseutil" +) + +// Manifest represents a manifest file, which has a name and some content. +type Manifest struct { + Name string + Content string + Head *releaseutil.SimpleHead +} diff --git a/pkg/tiller/hooks.go b/pkg/tiller/hooks.go index d53ed504f..6c3543f61 100644 --- a/pkg/tiller/hooks.go +++ b/pkg/tiller/hooks.go @@ -27,6 +27,7 @@ import ( "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/hooks" + "k8s.io/helm/pkg/manifest" "k8s.io/helm/pkg/proto/hapi/release" util "k8s.io/helm/pkg/releaseutil" ) @@ -52,12 +53,7 @@ var deletePolices = map[string]release.Hook_DeletePolicy{ hooks.BeforeHookCreation: release.Hook_BEFORE_HOOK_CREATION, } -// Manifest represents a manifest file, which has a name and some content. -type Manifest struct { - Name string - Content string - Head *util.SimpleHead -} +type Manifest = manifest.Manifest type result struct { hooks []*release.Hook From bd8c75211bda95de120ed998fdebbcb001b3e973 Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Tue, 17 Jul 2018 17:41:02 -0700 Subject: [PATCH 313/449] [templates] extract some rendering code into a package --- cmd/helm/install.go | 27 +----- cmd/helm/package.go | 3 +- cmd/helm/template.go | 77 ++++------------- cmd/helm/upgrade.go | 3 +- pkg/manifest/splitter.go | 43 ++++++++++ pkg/renderutil/deps.go | 50 +++++++++++ pkg/renderutil/doc.go | 24 ++++++ pkg/renderutil/render.go | 88 +++++++++++++++++++ pkg/renderutil/render_test.go | 153 ++++++++++++++++++++++++++++++++++ 9 files changed, 378 insertions(+), 90 deletions(-) create mode 100644 pkg/manifest/splitter.go create mode 100644 pkg/renderutil/deps.go create mode 100644 pkg/renderutil/doc.go create mode 100644 pkg/renderutil/render.go create mode 100644 pkg/renderutil/render_test.go diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 857fb0d46..adc8ba759 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -37,8 +37,8 @@ import ( "k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/kube" - "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" + "k8s.io/helm/pkg/renderutil" "k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/strvals" ) @@ -254,7 +254,7 @@ func (i *installCmd) run() error { // If checkDependencies returns an error, we have unfulfilled dependencies. // As of Helm 2.4.0, this is treated as a stopping condition: // https://github.com/kubernetes/helm/issues/2209 - if err := checkDependencies(chartRequested, req); err != nil { + if err := renderutil.CheckDependencies(chartRequested, req); err != nil { if i.depUp { man := &downloader.Manager{ Out: i.out, @@ -525,29 +525,6 @@ func defaultNamespace() string { return "default" } -func checkDependencies(ch *chart.Chart, reqs *chartutil.Requirements) error { - missing := []string{} - - deps := ch.GetDependencies() - for _, r := range reqs.Dependencies { - found := false - for _, d := range deps { - if d.Metadata.Name == r.Name { - found = true - break - } - } - if !found { - missing = append(missing, r.Name) - } - } - - if len(missing) > 0 { - return fmt.Errorf("found in requirements.yaml, but missing in charts/ directory: %s", strings.Join(missing, ", ")) - } - return nil -} - //readFile load a file from the local directory or a remote file with a url. func readFile(filePath, CertFile, KeyFile, CAFile string) ([]byte, error) { u, _ := url.Parse(filePath) diff --git a/cmd/helm/package.go b/cmd/helm/package.go index 81603e67b..51686dba7 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -35,6 +35,7 @@ import ( "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/provenance" + "k8s.io/helm/pkg/renderutil" "k8s.io/helm/pkg/repo" ) @@ -151,7 +152,7 @@ func (p *packageCmd) run() error { } if reqs, err := chartutil.LoadRequirements(ch); err == nil { - if err := checkDependencies(ch, reqs); err != nil { + if err := renderutil.CheckDependencies(ch, reqs); err != nil { return err } } else { diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 54eb9ff49..63609c18c 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -27,17 +27,15 @@ import ( "strings" "time" - "github.com/Masterminds/semver" "github.com/spf13/cobra" "k8s.io/helm/pkg/chartutil" - "k8s.io/helm/pkg/engine" + "k8s.io/helm/pkg/manifest" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" - util "k8s.io/helm/pkg/releaseutil" + "k8s.io/helm/pkg/renderutil" "k8s.io/helm/pkg/tiller" "k8s.io/helm/pkg/timeconv" - tversion "k8s.io/helm/pkg/version" ) const defaultDirectoryPermission = 0755 @@ -154,69 +152,21 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { return prettyError(err) } - if req, err := chartutil.LoadRequirements(c); err == nil { - if err := checkDependencies(c, req); err != nil { - return prettyError(err) - } - } else if err != chartutil.ErrRequirementsNotFound { - return fmt.Errorf("cannot load requirements: %v", err) - } - options := chartutil.ReleaseOptions{ - Name: t.releaseName, - IsInstall: !t.releaseIsUpgrade, - IsUpgrade: t.releaseIsUpgrade, - Time: timeconv.Now(), - Namespace: t.namespace, - } - - err = chartutil.ProcessRequirementsEnabled(c, config) - if err != nil { - return err - } - err = chartutil.ProcessRequirementsImportValues(c) - if err != nil { - return err - } - - // Set up engine. - renderer := engine.New() - - caps := &chartutil.Capabilities{ - APIVersions: chartutil.DefaultVersionSet, - KubeVersion: chartutil.DefaultKubeVersion, - TillerVersion: tversion.GetVersionProto(), - } - - // kubernetes version - kv, err := semver.NewVersion(t.kubeVersion) - if err != nil { - return fmt.Errorf("could not parse a kubernetes version: %v", err) - } - caps.KubeVersion.Major = fmt.Sprint(kv.Major()) - caps.KubeVersion.Minor = fmt.Sprint(kv.Minor()) - caps.KubeVersion.GitVersion = fmt.Sprintf("v%d.%d.0", kv.Major(), kv.Minor()) - - vals, err := chartutil.ToRenderValuesCaps(c, config, options, caps) - if err != nil { - return err + renderOpts := renderutil.Options{ + ReleaseOptions: chartutil.ReleaseOptions{ + Name: t.releaseName, + IsInstall: !t.releaseIsUpgrade, + IsUpgrade: t.releaseIsUpgrade, + Time: timeconv.Now(), + Namespace: t.namespace, + }, + KubeVersion: t.kubeVersion, } - out, err := renderer.Render(c, vals) - listManifests := []tiller.Manifest{} + renderedTemplates, err := renderutil.Render(c, config, renderOpts) if err != nil { return err } - // extract kind and name - re := regexp.MustCompile("kind:(.*)\n") - for k, v := range out { - match := re.FindStringSubmatch(v) - h := "Unknown" - if len(match) == 2 { - h = strings.TrimSpace(match[1]) - } - m := tiller.Manifest{Name: k, Content: v, Head: &util.SimpleHead{Kind: h}} - listManifests = append(listManifests, m) - } if settings.Debug { rel := &release.Release{ @@ -230,7 +180,8 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { printRelease(os.Stdout, rel) } - var manifestsToRender []tiller.Manifest + listManifests := manifest.SplitManifests(renderedTemplates) + var manifestsToRender []manifest.Manifest // if we have a list of files to render, then check that each of the // provided files exists in the chart. diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index a092492a7..4f91e61b1 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -25,6 +25,7 @@ import ( "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/renderutil" "k8s.io/helm/pkg/storage/driver" ) @@ -211,7 +212,7 @@ func (u *upgradeCmd) run() error { // Check chart requirements to make sure all dependencies are present in /charts if ch, err := chartutil.Load(chartPath); err == nil { if req, err := chartutil.LoadRequirements(ch); err == nil { - if err := checkDependencies(ch, req); err != nil { + if err := renderutil.CheckDependencies(ch, req); err != nil { return err } } else if err != chartutil.ErrRequirementsNotFound { diff --git a/pkg/manifest/splitter.go b/pkg/manifest/splitter.go new file mode 100644 index 000000000..25b77326d --- /dev/null +++ b/pkg/manifest/splitter.go @@ -0,0 +1,43 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package manifest + +import ( + "regexp" + "strings" + + "k8s.io/helm/pkg/releaseutil" +) + +// SplitManifests takes a map of rendered templates and splits them into the +// detected manifests. +func SplitManifests(templates map[string]string) []Manifest { + var listManifests []Manifest + // extract kind and name + re := regexp.MustCompile("kind:(.*)\n") + for k, v := range templates { + match := re.FindStringSubmatch(v) + h := "Unknown" + if len(match) == 2 { + h = strings.TrimSpace(match[1]) + } + m := Manifest{Name: k, Content: v, Head: &releaseutil.SimpleHead{Kind: h}} + listManifests = append(listManifests, m) + } + + return listManifests +} diff --git a/pkg/renderutil/deps.go b/pkg/renderutil/deps.go new file mode 100644 index 000000000..72e4d12a1 --- /dev/null +++ b/pkg/renderutil/deps.go @@ -0,0 +1,50 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package renderutil + +import ( + "fmt" + "strings" + + "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/proto/hapi/chart" +) + +// CheckDependencies will do a simple dependency check on the chart for local +// rendering +func CheckDependencies(ch *chart.Chart, reqs *chartutil.Requirements) error { + missing := []string{} + + deps := ch.GetDependencies() + for _, r := range reqs.Dependencies { + found := false + for _, d := range deps { + if d.Metadata.Name == r.Name { + found = true + break + } + } + if !found { + missing = append(missing, r.Name) + } + } + + if len(missing) > 0 { + return fmt.Errorf("found in requirements.yaml, but missing in charts/ directory: %s", strings.Join(missing, ", ")) + } + return nil +} diff --git a/pkg/renderutil/doc.go b/pkg/renderutil/doc.go new file mode 100644 index 000000000..38c3ae60d --- /dev/null +++ b/pkg/renderutil/doc.go @@ -0,0 +1,24 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/*Package renderutil contains tools related to the local rendering of charts. + +Local rendering means rendering without the tiller; this is generally used for +local debugging and testing (see the `helm template` command for examples of +use). This package will not render charts exactly the same way as the tiller +will, but will be generally close enough for local debug purposes. +*/ +package renderutil // import "k8s.io/helm/pkg/renderutil" diff --git a/pkg/renderutil/render.go b/pkg/renderutil/render.go new file mode 100644 index 000000000..1996e1dc2 --- /dev/null +++ b/pkg/renderutil/render.go @@ -0,0 +1,88 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package renderutil + +import ( + "fmt" + + "github.com/Masterminds/semver" + + "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/engine" + "k8s.io/helm/pkg/proto/hapi/chart" + tversion "k8s.io/helm/pkg/version" +) + +// Options are options for this simple local render +type Options struct { + ReleaseOptions chartutil.ReleaseOptions + KubeVersion string +} + +// Render chart templates locally and display the output. +// This does not require the Tiller. Any values that would normally be +// looked up or retrieved in-cluster will be faked locally. Additionally, none +// of the server-side testing of chart validity (e.g. whether an API is supported) +// is done. +// +// Note: a `nil` config passed here means "ignore the chart's default values"; +// if you want the normal behavior of merging the defaults with the new config, +// you should pass `&chart.Config{Raw: "{}"}, +func Render(c *chart.Chart, config *chart.Config, opts Options) (map[string]string, error) { + if req, err := chartutil.LoadRequirements(c); err == nil { + if err := CheckDependencies(c, req); err != nil { + return nil, err + } + } else if err != chartutil.ErrRequirementsNotFound { + return nil, fmt.Errorf("cannot load requirements: %v", err) + } + + err := chartutil.ProcessRequirementsEnabled(c, config) + if err != nil { + return nil, err + } + err = chartutil.ProcessRequirementsImportValues(c) + if err != nil { + return nil, err + } + + // Set up engine. + renderer := engine.New() + + caps := &chartutil.Capabilities{ + APIVersions: chartutil.DefaultVersionSet, + KubeVersion: chartutil.DefaultKubeVersion, + TillerVersion: tversion.GetVersionProto(), + } + + if opts.KubeVersion != "" { + kv, verErr := semver.NewVersion(opts.KubeVersion) + if verErr != nil { + return nil, fmt.Errorf("could not parse a kubernetes version: %v", verErr) + } + caps.KubeVersion.Major = fmt.Sprint(kv.Major()) + caps.KubeVersion.Minor = fmt.Sprint(kv.Minor()) + caps.KubeVersion.GitVersion = fmt.Sprintf("v%d.%d.0", kv.Major(), kv.Minor()) + } + + vals, err := chartutil.ToRenderValuesCaps(c, config, opts.ReleaseOptions, caps) + if err != nil { + return nil, err + } + + return renderer.Render(c, vals) +} diff --git a/pkg/renderutil/render_test.go b/pkg/renderutil/render_test.go new file mode 100644 index 000000000..e10ff883c --- /dev/null +++ b/pkg/renderutil/render_test.go @@ -0,0 +1,153 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package renderutil + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/proto/hapi/chart" +) + +const cmTemplate = `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Chart: +{{.Chart | toYaml | indent 4}} + Release: +{{.Release | toYaml | indent 4}} + Values: +{{.Values | toYaml | indent 4}} +` + +func TestRender(t *testing.T) { + + testChart := &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/cm.yaml", Data: []byte(cmTemplate)}, + }, + Values: &chart.Config{Raw: "meow: defaultmeow"}, + } + + newConfig := &chart.Config{Raw: "meow: newmeow"} + defaultConfig := &chart.Config{Raw: "{}"} + + tests := map[string]struct { + chart *chart.Chart + config *chart.Config + opts Options + want map[string]string + }{ + "BasicWithValues": { + chart: testChart, + config: newConfig, + opts: Options{}, + want: map[string]string{ + "hello/templates/cm.yaml": `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Chart: + name: hello + + Release: + IsInstall: false + IsUpgrade: false + Name: "" + Namespace: "" + Revision: 0 + Service: Tiller + Time: null + + Values: + meow: newmeow + +`, + }, + }, + "BasicNoValues": { + chart: testChart, + config: defaultConfig, + opts: Options{}, + want: map[string]string{ + "hello/templates/cm.yaml": `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Chart: + name: hello + + Release: + IsInstall: false + IsUpgrade: false + Name: "" + Namespace: "" + Revision: 0 + Service: Tiller + Time: null + + Values: + meow: defaultmeow + +`, + }, + }, + "SetSomeReleaseValues": { + chart: testChart, + config: defaultConfig, + opts: Options{ReleaseOptions: chartutil.ReleaseOptions{Name: "meow"}}, + want: map[string]string{ + "hello/templates/cm.yaml": `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Chart: + name: hello + + Release: + IsInstall: false + IsUpgrade: false + Name: meow + Namespace: "" + Revision: 0 + Service: Tiller + Time: null + + Values: + meow: defaultmeow + +`, + }, + }, + } + + for testName, tt := range tests { + t.Run(testName, func(t *testing.T) { + got, err := Render(tt.chart, tt.config, tt.opts) + require.NoError(t, err) + require.Equal(t, tt.want, got) + }) + } +} From 8520d3e2baa83f60c14b0bbebdbd644b288f0192 Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Tue, 17 Jul 2018 18:39:24 -0700 Subject: [PATCH 314/449] [fake] implement rendering and simulated upgrades --- pkg/helm/fake.go | 111 ++++++++++++++++++++++++++-- pkg/helm/fake_test.go | 168 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 261 insertions(+), 18 deletions(-) diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index a3b0ebc84..ffb5b40c9 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -17,23 +17,29 @@ limitations under the License. package helm // import "k8s.io/helm/pkg/helm" import ( + "bytes" "errors" "math/rand" + "strings" "sync" "github.com/golang/protobuf/ptypes/timestamp" + "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/manifest" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" rls "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/proto/hapi/version" + "k8s.io/helm/pkg/renderutil" storage "k8s.io/helm/pkg/storage/driver" ) // FakeClient implements Interface type FakeClient struct { - Rels []*release.Release - Responses map[string]release.TestRun_Status - Opts options + Rels []*release.Release + Responses map[string]release.TestRun_Status + Opts options + RenderManifests bool } // Option returns the fake release client @@ -96,7 +102,22 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts return nil, errors.New("cannot re-use a name that is still in use") } - release := ReleaseMock(&MockReleaseOptions{Name: releaseName, Namespace: ns, Description: releaseDescription}) + mockOpts := &MockReleaseOptions{ + Name: releaseName, + Chart: chart, + Config: c.Opts.instReq.Values, + Namespace: ns, + Description: releaseDescription, + } + + release := ReleaseMock(mockOpts) + + if c.RenderManifests { + if err := RenderReleaseMock(release, false); err != nil { + return nil, err + } + } + if !c.Opts.dryRun { c.Rels = append(c.Rels, release) } @@ -135,14 +156,44 @@ func (c *FakeClient) UpdateRelease(rlsName string, chStr string, opts ...UpdateO } // UpdateReleaseFromChart returns an UpdateReleaseResponse containing the updated release, if it exists -func (c *FakeClient) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) { +func (c *FakeClient) UpdateReleaseFromChart(rlsName string, newChart *chart.Chart, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) { + for _, opt := range opts { + opt(&c.Opts) + } // Check to see if the release already exists. rel, err := c.ReleaseContent(rlsName, nil) if err != nil { return nil, err } - return &rls.UpdateReleaseResponse{Release: rel.Release}, nil + mockOpts := &MockReleaseOptions{ + Name: rel.Release.Name, + Version: rel.Release.Version + 1, + Chart: newChart, + Config: c.Opts.updateReq.Values, + Namespace: rel.Release.Namespace, + Description: c.Opts.updateReq.Description, + } + + newRelease := ReleaseMock(mockOpts) + + if c.Opts.updateReq.ResetValues { + newRelease.Config = &chart.Config{Raw: "{}"} + } else if c.Opts.updateReq.ReuseValues { + // TODO: This should merge old and new values but does not. + } + + if c.RenderManifests { + if err := RenderReleaseMock(newRelease, true); err != nil { + return nil, err + } + } + + if !c.Opts.dryRun { + *rel.Release = *newRelease + } + + return &rls.UpdateReleaseResponse{Release: newRelease}, nil } // RollbackRelease returns nil, nil @@ -231,12 +282,15 @@ type MockReleaseOptions struct { Name string Version int32 Chart *chart.Chart + Config *chart.Config StatusCode release.Status_Code Namespace string Description string } -// ReleaseMock creates a mock release object based on options set by MockReleaseOptions. This function should typically not be used outside of testing. +// ReleaseMock creates a mock release object based on options set by +// MockReleaseOptions. This function should typically not be used outside of +// testing. func ReleaseMock(opts *MockReleaseOptions) *release.Release { date := timestamp.Timestamp{Seconds: 242085845, Nanos: 0} @@ -273,6 +327,11 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { } } + config := opts.Config + if config == nil { + config = &chart.Config{Raw: `name: "value"`} + } + scode := release.Status_DEPLOYED if opts.StatusCode > 0 { scode = opts.StatusCode @@ -287,7 +346,7 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { Description: description, }, Chart: ch, - Config: &chart.Config{Raw: `name: "value"`}, + Config: config, Version: version, Namespace: namespace, Hooks: []*release.Hook{ @@ -303,3 +362,39 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { Manifest: MockManifest, } } + +// RenderReleaseMock will take a release (usually produced by helm.ReleaseMock) +// and will render the Manifest inside using the local mechanism (no tiller). +// (Compare to renderResources in pkg/tiller) +func RenderReleaseMock(r *release.Release, asUpgrade bool) error { + if r == nil || r.Chart == nil || r.Chart.Metadata == nil { + return errors.New("a release with a chart with metadata must be provided to render the manifests") + } + + renderOpts := renderutil.Options{ + ReleaseOptions: chartutil.ReleaseOptions{ + Name: r.Name, + Namespace: r.Namespace, + Time: r.Info.LastDeployed, + Revision: int(r.Version), + IsUpgrade: asUpgrade, + IsInstall: !asUpgrade, + }, + } + rendered, err := renderutil.Render(r.Chart, r.Config, renderOpts) + if err != nil { + return err + } + + b := bytes.NewBuffer(nil) + for _, m := range manifest.SplitManifests(rendered) { + // Remove empty manifests + if len(strings.TrimSpace(m.Content)) == 0 { + continue + } + b.WriteString("\n---\n# Source: " + m.Name + "\n") + b.WriteString(m.Content) + } + r.Manifest = b.String() + return nil +} diff --git a/pkg/helm/fake_test.go b/pkg/helm/fake_test.go index f16fbaf4c..ecb0a2855 100644 --- a/pkg/helm/fake_test.go +++ b/pkg/helm/fake_test.go @@ -17,6 +17,7 @@ limitations under the License. package helm import ( + "fmt" "reflect" "testing" @@ -25,6 +26,57 @@ import ( rls "k8s.io/helm/pkg/proto/hapi/services" ) +const cmInputTemplate = `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Release: +{{.Release | toYaml | indent 4}} +` +const cmOutputTemplate = ` +--- +# Source: installChart/templates/cm.yaml +kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Release: + IsInstall: %t + IsUpgrade: %t + Name: new-release + Namespace: default + Revision: %d + Service: Tiller + Time: + seconds: 242085845 + +` + +var installChart *chart.Chart + +func init() { + installChart = &chart.Chart{ + Metadata: &chart.Metadata{Name: "installChart"}, + Templates: []*chart.Template{ + {Name: "templates/cm.yaml", Data: []byte(cmInputTemplate)}, + }, + } +} + +func releaseWithChart(opts *MockReleaseOptions) *release.Release { + if opts.Chart == nil { + opts.Chart = installChart + } + return ReleaseMock(opts) +} + +func withManifest(r *release.Release, isUpgrade bool) *release.Release { + r.Manifest = fmt.Sprintf(cmOutputTemplate, !isUpgrade, isUpgrade, r.Version) + return r +} + func TestFakeClient_ReleaseStatus(t *testing.T) { releasePresent := ReleaseMock(&MockReleaseOptions{Name: "release-present"}) releaseNotPresent := ReleaseMock(&MockReleaseOptions{Name: "release-not-present"}) @@ -117,9 +169,9 @@ func TestFakeClient_ReleaseStatus(t *testing.T) { } func TestFakeClient_InstallReleaseFromChart(t *testing.T) { - installChart := &chart.Chart{} type fields struct { - Rels []*release.Release + Rels []*release.Release + RenderManifests bool } type args struct { ns string @@ -143,10 +195,10 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { opts: []InstallOption{ReleaseName("new-release")}, }, want: &rls.InstallReleaseResponse{ - Release: ReleaseMock(&MockReleaseOptions{Name: "new-release"}), + Release: releaseWithChart(&MockReleaseOptions{Name: "new-release"}), }, relsAfter: []*release.Release{ - ReleaseMock(&MockReleaseOptions{Name: "new-release"}), + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), }, wantErr: false, }, @@ -160,10 +212,10 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { opts: []InstallOption{ReleaseName("new-release"), InstallDescription("foo-bar")}, }, want: &rls.InstallReleaseResponse{ - Release: ReleaseMock(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), + Release: releaseWithChart(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), }, relsAfter: []*release.Release{ - ReleaseMock(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), + releaseWithChart(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), }, wantErr: false, }, @@ -171,7 +223,7 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { name: "Try to add a release where the name already exists.", fields: fields{ Rels: []*release.Release{ - ReleaseMock(&MockReleaseOptions{Name: "new-release"}), + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), }, }, args: args{ @@ -179,16 +231,35 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { opts: []InstallOption{ReleaseName("new-release")}, }, relsAfter: []*release.Release{ - ReleaseMock(&MockReleaseOptions{Name: "new-release"}), + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), }, want: nil, wantErr: true, }, + { + name: "Render the given chart.", + fields: fields{ + Rels: []*release.Release{}, + RenderManifests: true, + }, + args: args{ + ns: "default", + opts: []InstallOption{ReleaseName("new-release")}, + }, + want: &rls.InstallReleaseResponse{ + Release: withManifest(releaseWithChart(&MockReleaseOptions{Name: "new-release"}), false), + }, + relsAfter: []*release.Release{ + withManifest(releaseWithChart(&MockReleaseOptions{Name: "new-release"}), false), + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c := &FakeClient{ - Rels: tt.fields.Rels, + Rels: tt.fields.Rels, + RenderManifests: tt.fields.RenderManifests, } got, err := c.InstallReleaseFromChart(installChart, tt.args.ns, tt.args.opts...) if (err != nil) != tt.wantErr { @@ -293,7 +364,84 @@ func TestFakeClient_DeleteRelease(t *testing.T) { } if !reflect.DeepEqual(c.Rels, tt.relsAfter) { - t.Errorf("FakeClient.InstallReleaseFromChart() rels = %v, expected %v", got, tt.relsAfter) + t.Errorf("FakeClient.InstallReleaseFromChart() rels = %v, expected %v", c.Rels, tt.relsAfter) + } + }) + } +} + +func TestFakeClient_UpdateReleaseFromChart(t *testing.T) { + type fields struct { + Rels []*release.Release + RenderManifests bool + } + type args struct { + release string + opts []UpdateOption + } + tests := []struct { + name string + fields fields + args args + want *rls.UpdateReleaseResponse + relsAfter []*release.Release + wantErr bool + }{ + { + name: "Update release.", + fields: fields{ + Rels: []*release.Release{ + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), + }, + }, + args: args{ + release: "new-release", + opts: []UpdateOption{}, + }, + want: &rls.UpdateReleaseResponse{ + Release: releaseWithChart(&MockReleaseOptions{Name: "new-release", Version: 2}), + }, + relsAfter: []*release.Release{ + releaseWithChart(&MockReleaseOptions{Name: "new-release", Version: 2}), + }, + }, + { + name: "Update and render given chart.", + fields: fields{ + Rels: []*release.Release{ + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), + }, + RenderManifests: true, + }, + args: args{ + release: "new-release", + opts: []UpdateOption{}, + }, + want: &rls.UpdateReleaseResponse{ + Release: withManifest(releaseWithChart(&MockReleaseOptions{Name: "new-release", Version: 2}), true), + }, + relsAfter: []*release.Release{ + withManifest(releaseWithChart(&MockReleaseOptions{Name: "new-release", Version: 2}), true), + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + c := &FakeClient{ + Rels: tt.fields.Rels, + RenderManifests: tt.fields.RenderManifests, + } + got, err := c.UpdateReleaseFromChart(tt.args.release, installChart, tt.args.opts...) + if (err != nil) != tt.wantErr { + t.Errorf("FakeClient.UpdateReleaseFromChart() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("FakeClient.UpdateReleaseFromChart() =\n%v\nwant\n%v", got, tt.want) + } + if !reflect.DeepEqual(c.Rels, tt.relsAfter) { + t.Errorf("FakeClient.UpdateReleaseFromChart() rels =\n%v\nwant\n%v", c.Rels, tt.relsAfter) } }) } From 432176ec107123bfdfb3f4b2cb33ce0ffc3037f7 Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Mon, 6 Aug 2018 17:19:38 -0700 Subject: [PATCH 315/449] [manifests] hoist the regex out of SplitManifests --- pkg/manifest/splitter.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/manifest/splitter.go b/pkg/manifest/splitter.go index 25b77326d..7081e7aa7 100644 --- a/pkg/manifest/splitter.go +++ b/pkg/manifest/splitter.go @@ -23,14 +23,17 @@ import ( "k8s.io/helm/pkg/releaseutil" ) +var ( + kindRegex = regexp.MustCompile("kind:(.*)\n") +) + // SplitManifests takes a map of rendered templates and splits them into the // detected manifests. func SplitManifests(templates map[string]string) []Manifest { var listManifests []Manifest // extract kind and name - re := regexp.MustCompile("kind:(.*)\n") for k, v := range templates { - match := re.FindStringSubmatch(v) + match := kindRegex.FindStringSubmatch(v) h := "Unknown" if len(match) == 2 { h = strings.TrimSpace(match[1]) From ed460dfb4c9f631fad1e257d95d61bf9cb8e9e2f Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 7 Aug 2018 12:48:54 -0700 Subject: [PATCH 316/449] distribute tiller binary with each release --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 77d7c8ff7..6264cd814 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ SHORT_NAME ?= tiller SHORT_NAME_RUDDER ?= rudder TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x windows/amd64 DIST_DIRS = find * -type d -exec -APP = helm # go option GO ?= go @@ -27,11 +26,12 @@ all: build build: GOBIN=$(BINDIR) $(GO) install $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/... -# usage: make clean build-cross dist APP=helm|tiller VERSION=v2.0.0-alpha.3 +# usage: make clean build-cross dist VERSION=v2.0.0-alpha.3 .PHONY: build-cross build-cross: LDFLAGS += -extldflags "-static" build-cross: - CGO_ENABLED=0 gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/$(APP) + CGO_ENABLED=0 gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/helm + CGO_ENABLED=0 gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/tiller .PHONY: dist dist: From 9fa699960d45e8343b913e97a6fa70b5d56545fe Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Thu, 19 Jul 2018 15:54:47 -0400 Subject: [PATCH 317/449] fix(release_server): fix how we merge values resolves #4337 Merging maps inside of strings gets a bit tricky. When two strings consisting of "{}" were being added together, this resulted in "{}\n{}" instead of "{}" which is what we wanted. This led to YAML parsing errors and showed up when the `--reuse-values` flag was used when no overrides via `--set` were provided during install and/or upgrade. --- pkg/tiller/release_server.go | 4 +++- pkg/tiller/release_update_test.go | 40 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index bde4c8465..e847c63fc 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -138,7 +138,9 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current } // merge new values with current - req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw + if current.Config != nil && current.Config.Raw != "" && current.Config.Raw != "{}\n" { + req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw + } req.Chart.Values = &chart.Config{Raw: nv} // yaml unmarshal and marshal to remove duplicate keys diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 519b839fc..5edd53b82 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -129,6 +129,46 @@ func TestUpdateRelease_ResetValues(t *testing.T) { } } +func TestUpdateRelease_ReuseValuesWithNoValues(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + + installReq := &services.InstallReleaseRequest{ + Namespace: "spaced", + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + {Name: "templates/hooks", Data: []byte(manifestWithHook)}, + }, + Values: &chart.Config{Raw: "defaultFoo: defaultBar"}, + }, + } + + installResp, err := rs.InstallRelease(c, installReq) + if err != nil { + t.Fatal(err) + } + + rel := installResp.Release + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + }, + }, + Values: &chart.Config{Raw: ""}, + ReuseValues: true, + } + + _, err = rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } +} + // This is a regression test for bug found in issue #3655 func TestUpdateRelease_ComplexReuseValues(t *testing.T) { c := helm.NewContext() From 7768e805c815c276359914e5537bc8a3ea0f9773 Mon Sep 17 00:00:00 2001 From: fibonacci1729 Date: Mon, 16 Jul 2018 15:16:21 -0600 Subject: [PATCH 318/449] fix(helm): fix(helm): add `--tls-hostname` flag to tls flags docs(*): update tiller_ssl.md to reflect IP SAN usage. When using helm/tiller in tls-verify mode, 127.0.0.1 should be listed as an IP SAN in the tiller certificate to pass hostname verficiation of the TLS handshake. Closes #4149 --- cmd/helm/helm.go | 11 +++++++-- docs/helm/helm_delete.md | 23 ++++++++++--------- docs/helm/helm_get.md | 15 +++++++------ docs/helm/helm_get_hooks.md | 15 +++++++------ docs/helm/helm_get_manifest.md | 15 +++++++------ docs/helm/helm_get_values.md | 17 +++++++------- docs/helm/helm_history.md | 19 ++++++++-------- docs/helm/helm_install.md | 3 ++- docs/helm/helm_list.md | 41 +++++++++++++++++----------------- docs/helm/helm_reset.md | 17 +++++++------- docs/helm/helm_rollback.md | 27 +++++++++++----------- docs/helm/helm_status.md | 17 +++++++------- docs/helm/helm_test.md | 17 +++++++------- docs/helm/helm_upgrade.md | 3 ++- docs/helm/helm_version.md | 21 ++++++++--------- docs/tiller_ssl.md | 17 ++++++++++++++ pkg/tlsutil/cfg.go | 11 +++++++-- 17 files changed, 167 insertions(+), 122 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 8607129e4..cdb6313e2 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -40,6 +40,7 @@ import ( ) var ( + tlsServerName string // overrides the server name used to verify the hostname on the returned certificates from the server. tlsCaCertFile string // path to TLS CA certificate file tlsCertFile string // path to TLS certificate file tlsKeyFile string // path to TLS key file @@ -285,8 +286,13 @@ func newClient() helm.Interface { if tlsKeyFile == "" { tlsKeyFile = settings.Home.TLSKey() } - debug("Key=%q, Cert=%q, CA=%q\n", tlsKeyFile, tlsCertFile, tlsCaCertFile) - tlsopts := tlsutil.Options{KeyFile: tlsKeyFile, CertFile: tlsCertFile, InsecureSkipVerify: true} + debug("Host=%q, Key=%q, Cert=%q, CA=%q\n", tlsKeyFile, tlsCertFile, tlsCaCertFile) + tlsopts := tlsutil.Options{ + ServerName: tlsServerName, + KeyFile: tlsKeyFile, + CertFile: tlsCertFile, + InsecureSkipVerify: true, + } if tlsVerify { tlsopts.CaCertFile = tlsCaCertFile tlsopts.InsecureSkipVerify = false @@ -306,6 +312,7 @@ func newClient() helm.Interface { func addFlagsTLS(cmd *cobra.Command) *cobra.Command { // add flags + cmd.Flags().StringVar(&tlsServerName, "tls-hostname", settings.TillerHost, "the server name used to verify the hostname on the returned certificates from the server") cmd.Flags().StringVar(&tlsCaCertFile, "tls-ca-cert", tlsCaCertDefault, "path to TLS CA certificate file") cmd.Flags().StringVar(&tlsCertFile, "tls-cert", tlsCertDefault, "path to TLS certificate file") cmd.Flags().StringVar(&tlsKeyFile, "tls-key", tlsKeyDefault, "path to TLS key file") diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index e181f439e..442e5e96c 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -20,16 +20,17 @@ helm delete [flags] RELEASE_NAME [...] ### Options ``` - --description string specify a description for the release - --dry-run simulate a delete - --no-hooks prevent hooks from running during deletion - --purge remove the release from the store and make its name free for later use - --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --description string specify a description for the release + --dry-run simulate a delete + --no-hooks prevent hooks from running during deletion + --purge remove the release from the store and make its name free for later use + --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -47,4 +48,4 @@ helm delete [flags] RELEASE_NAME [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index f233cd2a7..3a1b3d442 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -25,12 +25,13 @@ helm get [flags] RELEASE_NAME ### Options ``` - --revision int32 get the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --revision int32 get the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -51,4 +52,4 @@ helm get [flags] RELEASE_NAME * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_get_hooks.md b/docs/helm/helm_get_hooks.md index 4f9fa1887..9f3d5b0b2 100644 --- a/docs/helm/helm_get_hooks.md +++ b/docs/helm/helm_get_hooks.md @@ -18,12 +18,13 @@ helm get hooks [flags] RELEASE_NAME ### Options ``` - --revision int32 get the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --revision int32 get the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -41,4 +42,4 @@ helm get hooks [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_get_manifest.md b/docs/helm/helm_get_manifest.md index 3ae55ef3e..6cae9001f 100644 --- a/docs/helm/helm_get_manifest.md +++ b/docs/helm/helm_get_manifest.md @@ -20,12 +20,13 @@ helm get manifest [flags] RELEASE_NAME ### Options ``` - --revision int32 get the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --revision int32 get the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -43,4 +44,4 @@ helm get manifest [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index 12d973122..01fee2cd2 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -16,13 +16,14 @@ helm get values [flags] RELEASE_NAME ### Options ``` - -a, --all dump all (computed) values - --revision int32 get the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -a, --all dump all (computed) values + --revision int32 get the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -40,4 +41,4 @@ helm get values [flags] RELEASE_NAME ### SEE ALSO * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index 437e70f03..e5028f9cb 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -28,14 +28,15 @@ helm history [flags] RELEASE_NAME ### Options ``` - --col-width uint specifies the max column width of output (default 60) - --max int32 maximum number of revision to include in history (default 256) - -o, --output string prints the output in the specified format (json|table|yaml) (default "table") - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --col-width uint specifies the max column width of output (default 60) + --max int32 maximum number of revision to include in history (default 256) + -o, --output string prints the output in the specified format (json|table|yaml) (default "table") + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -53,4 +54,4 @@ helm history [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index c266222b8..6e0948e8f 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -102,6 +102,7 @@ helm install [CHART] --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") --tls-verify enable TLS for request and verify remote --username string chart repository username where to locate the requested chart @@ -126,4 +127,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jul-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index c7e99e403..17b2573b8 100755 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -39,25 +39,26 @@ helm list [flags] [FILTER] ### Options ``` - -a, --all show all releases, not just the ones marked DEPLOYED - --col-width uint specifies the max column width of output (default 60) - -d, --date sort by release date - --deleted show deleted releases - --deleting show releases that are currently being deleted - --deployed show deployed releases. If no other is specified, this will be automatically enabled - --failed show failed releases - -m, --max int maximum number of releases to fetch (default 256) - --namespace string show releases within a specific namespace - -o, --offset string next release name in the list, used to offset from start value - --output string output the specified format (json or yaml) - --pending show pending releases - -r, --reverse reverse the sort order - -q, --short output short (quiet) listing format - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -a, --all show all releases, not just the ones marked DEPLOYED + --col-width uint specifies the max column width of output (default 60) + -d, --date sort by release date + --deleted show deleted releases + --deleting show releases that are currently being deleted + --deployed show deployed releases. If no other is specified, this will be automatically enabled + --failed show failed releases + -m, --max int maximum number of releases to fetch (default 256) + --namespace string show releases within a specific namespace + -o, --offset string next release name in the list, used to offset from start value + --output string output the specified format (json or yaml) + --pending show pending releases + -r, --reverse reverse the sort order + -q, --short output short (quiet) listing format + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -75,4 +76,4 @@ helm list [flags] [FILTER] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index 507a94bfd..74d5ecc0e 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -18,13 +18,14 @@ helm reset ### Options ``` - -f, --force forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.) - --remove-helm-home if set deletes $HELM_HOME - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -f, --force forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.) + --remove-helm-home if set deletes $HELM_HOME + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -42,4 +43,4 @@ helm reset ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index b40fb883a..40d3ad83b 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -20,18 +20,19 @@ helm rollback [flags] [RELEASE] [REVISION] ### Options ``` - --description string specify a description for the release - --dry-run simulate a rollback - --force force resource update through delete/recreate if needed - --no-hooks prevent hooks from running during rollback - --recreate-pods performs pods restart for the resource if applicable - --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote - --wait if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout + --description string specify a description for the release + --dry-run simulate a rollback + --force force resource update through delete/recreate if needed + --no-hooks prevent hooks from running during rollback + --recreate-pods performs pods restart for the resource if applicable + --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote + --wait if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout ``` ### Options inherited from parent commands @@ -49,4 +50,4 @@ helm rollback [flags] [RELEASE] [REVISION] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_status.md b/docs/helm/helm_status.md index 5317875e6..22b47c851 100644 --- a/docs/helm/helm_status.md +++ b/docs/helm/helm_status.md @@ -23,13 +23,14 @@ helm status [flags] RELEASE_NAME ### Options ``` - -o, --output string output the status in the specified format (json or yaml) - --revision int32 if set, display the status of the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -o, --output string output the status in the specified format (json or yaml) + --revision int32 if set, display the status of the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -47,4 +48,4 @@ helm status [flags] RELEASE_NAME ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index 688b67a34..5a84c3b18 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -19,13 +19,14 @@ helm test [RELEASE] ### Options ``` - --cleanup delete test pods upon completion - --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --cleanup delete test pods upon completion + --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -43,4 +44,4 @@ helm test [RELEASE] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index ecd51e65c..679070233 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -62,6 +62,7 @@ helm upgrade [RELEASE] [CHART] --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") --tls-verify enable TLS for request and verify remote --username string chart repository username where to locate the requested chart @@ -86,4 +87,4 @@ helm upgrade [RELEASE] [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-May-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index 61636c404..3db529120 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -30,15 +30,16 @@ helm version ### Options ``` - -c, --client client version only - -s, --server server version only - --short print the version number - --template string template for version string format - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -c, --client client version only + -s, --server server version only + --short print the version number + --template string template for version string format + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -56,4 +57,4 @@ helm version ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 7-Aug-2018 diff --git a/docs/tiller_ssl.md b/docs/tiller_ssl.md index 6db195507..41e704653 100644 --- a/docs/tiller_ssl.md +++ b/docs/tiller_ssl.md @@ -284,6 +284,23 @@ the host name that Helm connects to matches the host name on the certificate. In some cases this is awkward, since Helm will connect over localhost, or the FQDN is not available for public resolution. +*If I use `--tls-verify` on the client, I get `Error: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs`* + +By default, the Helm client connects to Tiller via tunnel (i.e. kube proxy) at 127.0.0.1. During the TLS handshake, +a target, usually provided as a hostname (e.g. example.com), is checked against the subject and subject alternative +names of the certificate (i.e. hostname verficiation). However, because of the tunnel, the target is an IP address. +Therefore, to validate the certificate, the IP address 127.0.0.1 must be listed as an IP subject alternative name +(IP SAN) in the Tiller certificate. + +For example, to list 127.0.0.1 as an IP SAN when generating the Tiller certificate: + +```console +$ echo subjectAltName=IP:127.0.0.1 > extfile.cnf +$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in tiller.csr.pem -out tiller.cert.pem -days 365 -extfile extfile.cnf +``` + +Alternatively, you can override the expected hostname of the tiller certificate using the `--tls-hostname` flag. + *If I use `--tls-verify` on the client, I get `Error: x509: certificate has expired or is not yet valid`* Your helm certificate has expired, you need to sign a new certificate using your private key and the CA (and consider increasing the number of days) diff --git a/pkg/tlsutil/cfg.go b/pkg/tlsutil/cfg.go index 408867db1..2c1dfd340 100644 --- a/pkg/tlsutil/cfg.go +++ b/pkg/tlsutil/cfg.go @@ -33,6 +33,9 @@ type Options struct { CertFile string // Client-only options InsecureSkipVerify bool + // Overrides the server name used to verify the hostname on the returned + // certificates from the server. + ServerName string // Server-only options ClientAuth tls.ClientAuthType } @@ -55,8 +58,12 @@ func ClientConfig(opts Options) (cfg *tls.Config, err error) { return nil, err } } - - cfg = &tls.Config{InsecureSkipVerify: opts.InsecureSkipVerify, Certificates: []tls.Certificate{*cert}, RootCAs: pool} + cfg = &tls.Config{ + InsecureSkipVerify: opts.InsecureSkipVerify, + Certificates: []tls.Certificate{*cert}, + ServerName: opts.ServerName, + RootCAs: pool, + } return cfg, nil } From e4cc308ad20b4e167445a5c3c59cee1c4f850769 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Wed, 8 Aug 2018 12:21:38 -0400 Subject: [PATCH 319/449] Updating to the k8s label convention Closes #4335 Signed-off-by: Matt Farina --- .../alpine/templates/alpine-pod.yaml | 6 ++-- .../novals/templates/alpine-pod.yaml | 6 ++-- .../signtest/alpine/templates/alpine-pod.yaml | 2 +- docs/chart_best_practices/labels.md | 16 +++++---- docs/chart_best_practices/pods.md | 4 +-- docs/chart_template_guide/variables.md | 8 ++--- docs/charts.md | 12 +++---- docs/charts_hooks.md | 12 +++---- .../examples/alpine/templates/alpine-pod.yaml | 12 +++---- docs/examples/nginx/templates/configmap.yaml | 8 ++--- docs/examples/nginx/templates/deployment.yaml | 16 ++++----- .../nginx/templates/post-install-job.yaml | 16 ++++----- .../nginx/templates/pre-install-secret.yaml | 8 ++--- .../nginx/templates/service-test.yaml | 8 ++--- docs/examples/nginx/templates/service.yaml | 12 +++---- pkg/chartutil/create.go | 36 +++++++++---------- .../charts/alpine/templates/alpine-pod.yaml | 2 +- .../charts/alpine/templates/alpine-pod.yaml | 2 +- .../charts/alpine/templates/alpine-pod.yaml | 2 +- .../charts/alpine/templates/alpine-pod.yaml | 2 +- .../charts/alpine/templates/alpine-pod.yaml | 2 +- .../charts/alpine/templates/alpine-pod.yaml | 2 +- .../charts/alpine/templates/alpine-pod.yaml | 2 +- .../signtest/alpine/templates/alpine-pod.yaml | 2 +- .../testdata/albatross/templates/svc.yaml | 6 ++-- 25 files changed, 104 insertions(+), 100 deletions(-) diff --git a/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml index 424920782..b8ae22b6c 100644 --- a/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml @@ -6,12 +6,12 @@ metadata: # The "heritage" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{.Release.Service | quote }} + app.kubernetes.io/managed-by: {{.Release.Service | quote }} # The "release" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{.Release.Name | quote }} + app.kubernetes.io/instance: {{.Release.Name | quote }} # This makes it easy to audit chart usage. - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" values: {{.Values.test.Name}} annotations: "helm.sh/created": {{.Release.Time.Seconds | quote }} diff --git a/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml index c15ab8efc..f569d556c 100644 --- a/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml @@ -6,12 +6,12 @@ metadata: # The "heritage" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{.Release.Service | quote }} + app.kubernetes.io/managed-by: {{.Release.Service | quote }} # The "release" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{.Release.Name | quote }} + app.kubernetes.io/instance: {{.Release.Name | quote }} # This makes it easy to audit chart usage. - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" annotations: "helm.sh/created": {{.Release.Time.Seconds | quote }} spec: diff --git a/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/docs/chart_best_practices/labels.md b/docs/chart_best_practices/labels.md index 7c3ac51db..a43ad9087 100644 --- a/docs/chart_best_practices/labels.md +++ b/docs/chart_best_practices/labels.md @@ -10,7 +10,7 @@ An item of metadata should be a label under the following conditions: - It is used by Kubernetes to identify this resource - It is useful to expose to operators for the purpose of querying the system. -For example, we suggest using `chart: NAME-VERSION` as a label so that operators +For example, we suggest using `helm.sh/chart: NAME-VERSION` as a label so that operators can conveniently find all of the instances of a particular chart to use. If an item of metadata is not used for querying, it should be set as an annotation @@ -25,8 +25,12 @@ are recommended, and _should_ be placed onto a chart for global consistency. Tho Name|Status|Description -----|------|---------- -heritage | REC | This should always be set to `{{ .Release.Service }}`. It is for finding all things managed by Tiller. -release | REC | This should be the `{{ .Release.Name }}`. -chart | REC | This should be the chart name and version: `{{ .Chart.Name }}-{{ .Chart.Version \| replace "+" "_" }}`. -app | REC | This should be the app name, reflecting the entire app. Usually `{{ template "name" . }}` is used for this. This is used by many Kubernetes manifests, and is not Helm-specific. -component | OPT | This is a common label for marking the different roles that pieces may play in an application. For example, `component: frontend`. +`app.kubernetes.io/name` | REC | This should be the app name, reflecting the entire app. Usually `{{ template "name" . }}` is used for this. This is used by many Kubernetes manifests, and is not Helm-specific. +`helm.sh/chart` | REC | This should be the chart name and version: `{{ .Chart.Name }}-{{ .Chart.Version \| replace "+" "_" }}`. +`app.kubernetes.io/managed-by` | REC | This should always be set to `{{ .Release.Service }}`. It is for finding all things managed by Tiller. +`app.kubernetes.io/instance` | REC | This should be the `{{ .Release.Name }}`. It aid in differentiating between different instances of the same application. +`app.kubernetes.io/version` | OPT | The version of the app and can be set to `{{ .Chart.AppVersion }}`. +`app.kubernetes.io/component` | OPT | This is a common label for marking the different roles that pieces may play in an application. For example, `app.kubernetes.io/component: frontend`. +`app.kubernetes.io/part-of` | OPT | When multiple charts or pieces of software are used together to make one application. For example, application software and a database to produce a website. This can be set to the top level application being supported. + +You can find more information on the Kubernetes labels, prefixed with `app.kubernetes.io`, in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/). \ No newline at end of file diff --git a/docs/chart_best_practices/pods.md b/docs/chart_best_practices/pods.md index 3f26b0253..bc9b42dd9 100644 --- a/docs/chart_best_practices/pods.md +++ b/docs/chart_best_practices/pods.md @@ -52,11 +52,11 @@ All PodTemplate sections should specify a selector. For example: ```yaml selector: matchLabels: - app: MyName + app.kubernetes.io/name: MyName template: metadata: labels: - app: MyName + app.kubernetes.io/name: MyName ``` This is a good practice because it makes the relationship between the set and diff --git a/docs/chart_template_guide/variables.md b/docs/chart_template_guide/variables.md index b55e6e422..d924fe2cf 100644 --- a/docs/chart_template_guide/variables.md +++ b/docs/chart_template_guide/variables.md @@ -113,11 +113,11 @@ metadata: labels: # Many helm templates would use `.` below, but that will not work, # however `$` will work here - app: {{ template "fullname" $ }} + app.kubernetes.io/name: {{ template "fullname" $ }} # I cannot reference .Chart.Name, but I can do $.Chart.Name - chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" - release: "{{ $.Release.Name }}" - heritage: "{{ $.Release.Service }}" + helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" + app.kubernetes.io/instance: "{{ $.Release.Name }}" + app.kubernetes.io/managed-by: "{{ $.Release.Service }}" type: kubernetes.io/tls data: tls.crt: {{ .certificate }} diff --git a/docs/charts.md b/docs/charts.md index 656731182..0414136ce 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -526,15 +526,15 @@ metadata: name: deis-database namespace: deis labels: - heritage: deis + app.kubernetes.io/managed-by: deis spec: replicas: 1 selector: - app: deis-database + app.kubernetes.io/name: deis-database template: metadata: labels: - app: deis-database + app.kubernetes.io/name: deis-database spec: serviceAccount: deis-database containers: @@ -663,15 +663,15 @@ metadata: name: deis-database namespace: deis labels: - heritage: deis + app.kubernetes.io/managed-by: deis spec: replicas: 1 selector: - app: deis-database + app.kubernetes.io/name: deis-database template: metadata: labels: - app: deis-database + app.kubernetes.io/name: deis-database spec: serviceAccount: deis-database containers: diff --git a/docs/charts_hooks.md b/docs/charts_hooks.md index 8d5006d1f..59c9c91a2 100644 --- a/docs/charts_hooks.md +++ b/docs/charts_hooks.md @@ -127,9 +127,9 @@ kind: Job metadata: name: "{{.Release.Name}}" labels: - heritage: {{.Release.Service | quote }} - release: {{.Release.Name | quote }} - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + app.kubernetes.io/managed-by: {{.Release.Service | quote }} + app.kubernetes.io/instance: {{.Release.Name | quote }} + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" annotations: # This is what defines this resource as a hook. Without this line, the # job is considered part of the release. @@ -141,9 +141,9 @@ spec: metadata: name: "{{.Release.Name}}" labels: - heritage: {{.Release.Service | quote }} - release: {{.Release.Name | quote }} - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + app.kubernetes.io/managed-by: {{.Release.Service | quote }} + app.kubernetes.io/instance: {{.Release.Name | quote }} + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" spec: restartPolicy: Never containers: diff --git a/docs/examples/alpine/templates/alpine-pod.yaml b/docs/examples/alpine/templates/alpine-pod.yaml index da9caef78..beafd7668 100644 --- a/docs/examples/alpine/templates/alpine-pod.yaml +++ b/docs/examples/alpine/templates/alpine-pod.yaml @@ -3,16 +3,16 @@ kind: Pod metadata: name: {{ template "alpine.fullname" . }} labels: - # The "heritage" label is used to track which tool deployed a given chart. + # The "app.kubernetes.io/managed-by" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{ .Release.Service }} - # The "release" convention makes it easy to tie a release to all of the + app.kubernetes.io/managed-by: {{ .Release.Service }} + # The "app.kubernetes.io/instance" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} # This makes it easy to audit chart usage. - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "alpine.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "alpine.name" . }} spec: # This shows how to use a simple value. This will look for a passed-in value called restartPolicy. restartPolicy: {{ .Values.restartPolicy }} diff --git a/docs/examples/nginx/templates/configmap.yaml b/docs/examples/nginx/templates/configmap.yaml index b90d6c0c7..0141cbc69 100644 --- a/docs/examples/nginx/templates/configmap.yaml +++ b/docs/examples/nginx/templates/configmap.yaml @@ -4,10 +4,10 @@ kind: ConfigMap metadata: name: {{ template "nginx.fullname" . }} labels: - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} data: # When the config map is mounted as a volume, these will be created as files. index.html: {{ .Values.index | quote }} diff --git a/docs/examples/nginx/templates/deployment.yaml b/docs/examples/nginx/templates/deployment.yaml index 5fa2633ea..08850935a 100644 --- a/docs/examples/nginx/templates/deployment.yaml +++ b/docs/examples/nginx/templates/deployment.yaml @@ -6,16 +6,16 @@ metadata: # multiple times into the same namespace. name: {{ template "nginx.fullname" . }} labels: - # The "heritage" label is used to track which tool deployed a given chart. + # The "app.kubernetes.io/managed-by" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{ .Release.Service }} - # The "release" convention makes it easy to tie a release to all of the + app.kubernetes.io/managed-by: {{ .Release.Service }} + # The "app.kubernetes.io/instance" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} # This makes it easy to audit chart usage. - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} spec: replicas: {{ .Values.replicaCount }} template: @@ -26,8 +26,8 @@ spec: {{ toYaml .Values.podAnnotations | indent 8 }} {{- end }} labels: - app: {{ template "nginx.name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "nginx.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: containers: - name: {{ template "nginx.name" . }} diff --git a/docs/examples/nginx/templates/post-install-job.yaml b/docs/examples/nginx/templates/post-install-job.yaml index 9ec90cd0a..6e32086ab 100644 --- a/docs/examples/nginx/templates/post-install-job.yaml +++ b/docs/examples/nginx/templates/post-install-job.yaml @@ -3,16 +3,16 @@ kind: Job metadata: name: {{ template "nginx.fullname" . }} labels: - # The "heritage" label is used to track which tool deployed a given chart. + # The "app.kubernetes.io/managed-by" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{ .Release.Service }} - # The "release" convention makes it easy to tie a release to all of the + app.kubernetes.io/managed-by: {{ .Release.Service }} + # The "app.kubernetes.io/instance" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} # This makes it easy to audit chart usage. - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} annotations: # This is what defines this resource as a hook. Without this line, the # job is considered part of the release. @@ -22,8 +22,8 @@ spec: metadata: name: {{ template "nginx.fullname" . }} labels: - release: {{ .Release.Name }} - app: {{ template "nginx.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "nginx.name" . }} spec: # This shows how to use a simple value. This will look for a passed-in value # called restartPolicy. If it is not found, it will use the default value. diff --git a/docs/examples/nginx/templates/pre-install-secret.yaml b/docs/examples/nginx/templates/pre-install-secret.yaml index 6392f9684..07a9504b5 100644 --- a/docs/examples/nginx/templates/pre-install-secret.yaml +++ b/docs/examples/nginx/templates/pre-install-secret.yaml @@ -5,10 +5,10 @@ kind: Secret metadata: name: {{ template "nginx.fullname" . }} labels: - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} # This declares the resource to be a hook. By convention, we also name the # file "pre-install-XXX.yaml", but Helm itself doesn't care about file names. annotations: diff --git a/docs/examples/nginx/templates/service-test.yaml b/docs/examples/nginx/templates/service-test.yaml index 3913ead9c..ffb37e9f4 100644 --- a/docs/examples/nginx/templates/service-test.yaml +++ b/docs/examples/nginx/templates/service-test.yaml @@ -3,10 +3,10 @@ kind: Pod metadata: name: "{{ template "nginx.fullname" . }}-service-test" labels: - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} annotations: "helm.sh/hook": test-success spec: diff --git a/docs/examples/nginx/templates/service.yaml b/docs/examples/nginx/templates/service.yaml index 1481e34f0..03f7aa2c6 100644 --- a/docs/examples/nginx/templates/service.yaml +++ b/docs/examples/nginx/templates/service.yaml @@ -6,10 +6,10 @@ metadata: {{ toYaml .Values.service.annotations | indent 4 }} {{- end }} labels: - app: {{ template "nginx.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "nginx.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} name: {{ template "nginx.fullname" . }} spec: # Provides options for the service so chart users have the full choice @@ -35,5 +35,5 @@ spec: nodePort: {{ .Values.service.nodePort }} {{- end }} selector: - app: {{ template "nginx.name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "nginx.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 97056c175..ef70efed9 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -129,10 +129,10 @@ kind: Ingress metadata: name: {{ $fullName }} labels: - app: {{ include ".name" . }} - chart: {{ include ".chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ include ".name" . }} + helm.sh/chart: {{ include ".chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} {{- with .Values.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} @@ -166,21 +166,21 @@ kind: Deployment metadata: name: {{ include ".fullname" . }} labels: - app: {{ include ".name" . }} - chart: {{ include ".chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ include ".name" . }} + helm.sh/chart: {{ include ".chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: - app: {{ include ".name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ include ".name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: labels: - app: {{ include ".name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ include ".name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: containers: - name: {{ .Chart.Name }} @@ -219,10 +219,10 @@ kind: Service metadata: name: {{ include ".fullname" . }} labels: - app: {{ include ".name" . }} - chart: {{ include ".chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ include ".name" . }} + helm.sh/chart: {{ include ".chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} spec: type: {{ .Values.service.type }} ports: @@ -231,8 +231,8 @@ spec: protocol: TCP name: http selector: - app: {{ include ".name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ include ".name" . }} + app.kubernetes.io/instancelease: {{ .Release.Name }} ` const defaultNotes = `1. Get the application URL by running these commands: diff --git a/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100755 --- a/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml b/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml +++ b/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/lint/rules/testdata/albatross/templates/svc.yaml b/pkg/lint/rules/testdata/albatross/templates/svc.yaml index 167148112..aea11d833 100644 --- a/pkg/lint/rules/testdata/albatross/templates/svc.yaml +++ b/pkg/lint/rules/testdata/albatross/templates/svc.yaml @@ -5,9 +5,9 @@ kind: Service metadata: name: "{{ .Values.name }}" labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" kubeVersion: {{ .Capabilities.KubeVersion.Major }} tillerVersion: {{ .Capabilities.TillerVersion }} spec: From 044191e49011ac08fcdcc14fcda7e505a0f14143 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 8 Aug 2018 11:02:39 -0700 Subject: [PATCH 320/449] bump version to v2.10 --- pkg/version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/version/version.go b/pkg/version/version.go index b2ea2c50f..c4ce4b381 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -26,7 +26,7 @@ var ( // Increment major number for new feature additions and behavioral changes. // Increment minor number for bug fixes and performance enhancements. // Increment patch number for critical fixes to existing releases. - Version = "v2.8" + Version = "v2.10" // BuildMetadata is extra build time data BuildMetadata = "unreleased" From 27066d3892aefc8af864ce58ac0cac670df27d32 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Wed, 1 Aug 2018 14:33:43 -0700 Subject: [PATCH 321/449] ref(*): kubernetes v1.11 support --- cmd/helm/installer/uninstall.go | 5 +- cmd/helm/installer/uninstall_test.go | 16 +-- glide.lock | 160 ++++++--------------- glide.yaml | 14 +- pkg/kube/client.go | 69 ++++----- pkg/kube/client_test.go | 46 ++---- pkg/kube/result.go | 2 +- pkg/kube/result_test.go | 9 +- pkg/kube/wait.go | 27 ++-- pkg/tiller/environment/environment.go | 2 +- pkg/tiller/environment/environment_test.go | 2 +- pkg/tiller/release_server_test.go | 2 +- 12 files changed, 119 insertions(+), 235 deletions(-) diff --git a/cmd/helm/installer/uninstall.go b/cmd/helm/installer/uninstall.go index 14735ea85..54e79bdf4 100644 --- a/cmd/helm/installer/uninstall.go +++ b/cmd/helm/installer/uninstall.go @@ -19,10 +19,8 @@ package installer // import "k8s.io/helm/cmd/helm/installer" import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" - "k8s.io/kubernetes/pkg/kubectl" ) const ( @@ -52,8 +50,7 @@ func deleteService(client coreclient.ServicesGetter, namespace string) error { // We need to use the reaper instead of the kube API because GC for deployment dependents // is not yet supported at the k8s server level (<= 1.5) func deleteDeployment(client internalclientset.Interface, namespace string) error { - reaper, _ := kubectl.ReaperFor(extensions.Kind("Deployment"), client) - err := reaper.Stop(namespace, deploymentName, 0, nil) + err := client.Extensions().Deployments(namespace).Delete(deploymentName, &metav1.DeleteOptions{}) return ingoreNotFound(err) } diff --git a/cmd/helm/installer/uninstall_test.go b/cmd/helm/installer/uninstall_test.go index 195b209bc..7e5be8aaa 100644 --- a/cmd/helm/installer/uninstall_test.go +++ b/cmd/helm/installer/uninstall_test.go @@ -34,8 +34,8 @@ func TestUninstall(t *testing.T) { t.Errorf("unexpected error: %#+v", err) } - if actions := fc.Actions(); len(actions) != 7 { - t.Errorf("unexpected actions: %v, expected 7 actions got %d", actions, len(actions)) + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) } } @@ -50,8 +50,8 @@ func TestUninstall_serviceNotFound(t *testing.T) { t.Errorf("unexpected error: %#+v", err) } - if actions := fc.Actions(); len(actions) != 7 { - t.Errorf("unexpected actions: %v, expected 7 actions got %d", actions, len(actions)) + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) } } @@ -66,8 +66,8 @@ func TestUninstall_deploymentNotFound(t *testing.T) { t.Errorf("unexpected error: %#+v", err) } - if actions := fc.Actions(); len(actions) != 7 { - t.Errorf("unexpected actions: %v, expected 7 actions got %d", actions, len(actions)) + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) } } @@ -82,7 +82,7 @@ func TestUninstall_secretNotFound(t *testing.T) { t.Errorf("unexpected error: %#+v", err) } - if actions := fc.Actions(); len(actions) != 7 { - t.Errorf("unexpected actions: %v, expect 7 actions got %d", actions, len(actions)) + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expect 3 actions got %d", actions, len(actions)) } } diff --git a/glide.lock b/glide.lock index eef256fd1..9a89616ef 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 41304a2eabc68608507c034304ce87cbf76924c90caaafbe42a9be16e6265868 -updated: 2018-06-19T14:50:56.238468981-05:00 +hash: 9d3eee153a34027ed93ccbcbfb4778baead73ed3f5bd4c665114e02aef747606 +updated: 2018-08-01T07:48:30.2009451Z imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -15,7 +15,7 @@ imports: subpackages: - winterm - name: github.com/Azure/go-autorest - version: d4e6b95c12a08b4de2d48b45d5b4d594e5d32fab + version: 1ff28809256a84bb6966640ff3d0371af82ccba4 subpackages: - autorest - autorest/adal @@ -27,6 +27,13 @@ imports: - quantile - name: github.com/BurntSushi/toml version: b26d9c308763d68093482582cea63d69be07a0f0 +- name: github.com/chai2010/gettext-go + version: c6fed771bfd517099caf0f7a961671fa8ed08723 + subpackages: + - gettext + - gettext/mo + - gettext/plural + - gettext/po - name: github.com/cpuguy83/go-md2man version: 71acacd42f85e5e82f70a55327789582a5200a90 subpackages: @@ -70,6 +77,7 @@ imports: - pkg/longpath - pkg/mount - pkg/parsers + - pkg/parsers/operatingsystem - pkg/stdcopy - pkg/sysinfo - pkg/system @@ -146,7 +154,7 @@ imports: - compiler - extensions - name: github.com/gophercloud/gophercloud - version: 6da026c32e2d622cc242d32984259c77237aefe1 + version: 781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d subpackages: - openstack - openstack/identity/v2/tenants @@ -169,8 +177,6 @@ imports: version: a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4 subpackages: - simplelru -- name: github.com/howeyc/gopass - version: bf9dde6d0d2c004a008c27aaee91170c786f6db8 - name: github.com/huandu/xstrings version: 3959339b333561bf62a38b424fd41517c2c90f40 - name: github.com/imdario/mergo @@ -178,7 +184,7 @@ imports: - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - name: github.com/json-iterator/go - version: 13f86432b882000a51c6e610c620974462691a97 + version: f2b4162afba35581b6d4a50d3b8f34e33c144682 - name: github.com/mailru/easyjson version: 2f5df55504ebc322e4d52d34df6a1f5b503bf26d subpackages: @@ -201,6 +207,10 @@ imports: - pbutil - name: github.com/mitchellh/go-wordwrap version: ad45545899c7b13c020ea92b2072220eefad42b8 +- name: github.com/modern-go/concurrent + version: bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 +- name: github.com/modern-go/reflect2 + version: 05fbef0ca5da472bbf96c9322b84a53edc03c9fd - name: github.com/opencontainers/go-digest version: a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb - name: github.com/opencontainers/image-spec @@ -208,8 +218,6 @@ imports: subpackages: - specs-go - specs-go/v1 -- name: github.com/pborman/uuid - version: ca53cad383cad2479bbba7f7a1a05797ec1386e4 - name: github.com/peterbourgon/diskv version: 5f041e8faa004a95c88a202771f4cc3e991971e6 - name: github.com/pkg/errors @@ -244,15 +252,15 @@ imports: - name: github.com/sirupsen/logrus version: 89742aefa4b206dcf400792f3bd35b542998eb3b - name: github.com/spf13/cobra - version: f62e98d28ab7ad31d707ba837a966378465c7b57 + version: c439c4fa093711d42e1b01acb1235b52004753c1 subpackages: - doc - name: github.com/spf13/pflag - version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7 + version: 583c0c0531f06d5278b7d917446061adc344b5cd - name: github.com/technosophos/moniker version: a5dbd03a2245d554160e3ae6bfdcf969fe58b431 - name: golang.org/x/crypto - version: 81e90905daefcd6fd217b62423c0908922eadb30 + version: 49796115aa4b964c318aad4f3084fdb41e9aa067 subpackages: - cast5 - ed25519 @@ -361,7 +369,7 @@ imports: - name: gopkg.in/yaml.v2 version: 670d4cfef0544295bc27a114dbac37980d83185a - name: k8s.io/api - version: 8b7507fac302640dd5f1efbf9643199952cc58db + version: 2d6f90ab1293a1fb871cf149423ebb72aa7423aa subpackages: - admission/v1beta1 - admissionregistration/v1alpha1 @@ -389,6 +397,7 @@ imports: - rbac/v1alpha1 - rbac/v1beta1 - scheduling/v1alpha1 + - scheduling/v1beta1 - settings/v1alpha1 - storage/v1 - storage/v1alpha1 @@ -398,19 +407,19 @@ imports: subpackages: - pkg/features - name: k8s.io/apimachinery - version: f6313580a4d36c7c74a3d845dda6e116642c4f90 + version: 103fd098999dc9c0c88536f5c9ad2e5da39373ae subpackages: - pkg/api/equality - pkg/api/errors - pkg/api/meta + - pkg/api/meta/testrestmapper - pkg/api/resource - pkg/api/validation - - pkg/apimachinery - - pkg/apimachinery/announced - - pkg/apimachinery/registered + - pkg/api/validation/path - pkg/apis/meta/internalversion - pkg/apis/meta/v1 - pkg/apis/meta/v1/unstructured + - pkg/apis/meta/v1/unstructured/unstructuredscheme - pkg/apis/meta/v1/validation - pkg/apis/meta/v1beta1 - pkg/conversion @@ -444,7 +453,6 @@ imports: - pkg/util/runtime - pkg/util/sets - pkg/util/strategicpatch - - pkg/util/uuid - pkg/util/validation - pkg/util/validation/field - pkg/util/wait @@ -455,7 +463,7 @@ imports: - third_party/forked/golang/netutil - third_party/forked/golang/reflect - name: k8s.io/apiserver - version: f7914ed3085badf66a1b6f3a5218ada28f7bd084 + version: 8b122ec9e3bbab91a262d17a39325e69349dc44d subpackages: - pkg/apis/audit - pkg/authentication/authenticator @@ -464,53 +472,13 @@ imports: - pkg/endpoints/request - pkg/features - pkg/util/feature - - pkg/util/flag - name: k8s.io/client-go - version: 23781f4d6632d88e869066eaebb743857aa1ef9b + version: 59698c7d9724b0f95f9dc9e7f7dfdcc3dfeceb82 subpackages: - discovery - discovery/fake - dynamic - - informers - - informers/admissionregistration - - informers/admissionregistration/v1alpha1 - - informers/admissionregistration/v1beta1 - - informers/apps - - informers/apps/v1 - - informers/apps/v1beta1 - - informers/apps/v1beta2 - - informers/autoscaling - - informers/autoscaling/v1 - - informers/autoscaling/v2beta1 - - informers/batch - - informers/batch/v1 - - informers/batch/v1beta1 - - informers/batch/v2alpha1 - - informers/certificates - - informers/certificates/v1beta1 - - informers/core - - informers/core/v1 - - informers/events - - informers/events/v1beta1 - - informers/extensions - - informers/extensions/v1beta1 - - informers/internalinterfaces - - informers/networking - - informers/networking/v1 - - informers/policy - - informers/policy/v1beta1 - - informers/rbac - - informers/rbac/v1 - - informers/rbac/v1alpha1 - - informers/rbac/v1beta1 - - informers/scheduling - - informers/scheduling/v1alpha1 - - informers/settings - - informers/settings/v1alpha1 - - informers/storage - - informers/storage/v1 - - informers/storage/v1alpha1 - - informers/storage/v1beta1 + - dynamic/fake - kubernetes - kubernetes/fake - kubernetes/scheme @@ -562,6 +530,8 @@ imports: - kubernetes/typed/rbac/v1beta1/fake - kubernetes/typed/scheduling/v1alpha1 - kubernetes/typed/scheduling/v1alpha1/fake + - kubernetes/typed/scheduling/v1beta1 + - kubernetes/typed/scheduling/v1beta1/fake - kubernetes/typed/settings/v1alpha1 - kubernetes/typed/settings/v1alpha1/fake - kubernetes/typed/storage/v1 @@ -570,32 +540,11 @@ imports: - kubernetes/typed/storage/v1alpha1/fake - kubernetes/typed/storage/v1beta1 - kubernetes/typed/storage/v1beta1/fake - - listers/admissionregistration/v1alpha1 - - listers/admissionregistration/v1beta1 - listers/apps/v1 - - listers/apps/v1beta1 - - listers/apps/v1beta2 - - listers/autoscaling/v1 - - listers/autoscaling/v2beta1 - - listers/batch/v1 - - listers/batch/v1beta1 - - listers/batch/v2alpha1 - - listers/certificates/v1beta1 - listers/core/v1 - - listers/events/v1beta1 - - listers/extensions/v1beta1 - - listers/networking/v1 - - listers/policy/v1beta1 - - listers/rbac/v1 - - listers/rbac/v1alpha1 - - listers/rbac/v1beta1 - - listers/scheduling/v1alpha1 - - listers/settings/v1alpha1 - - listers/storage/v1 - - listers/storage/v1alpha1 - - listers/storage/v1beta1 - pkg/apis/clientauthentication - pkg/apis/clientauthentication/v1alpha1 + - pkg/apis/clientauthentication/v1beta1 - pkg/version - plugin/pkg/client/auth - plugin/pkg/client/auth/azure @@ -606,6 +555,7 @@ imports: - rest - rest/fake - rest/watch + - restmapper - scale - scale/scheme - scale/scheme/appsint @@ -632,20 +582,21 @@ imports: - transport/spdy - util/buffer - util/cert + - util/connrotation - util/exec - util/flowcontrol - util/homedir - util/integer - util/jsonpath - util/retry - - util/workqueue - name: k8s.io/kube-openapi - version: 39cb288412c48cb533ba4be5d6c28620b9a0c1b4 + version: 91cfa479c814065e420cee7ed227db0f63a5854e subpackages: - pkg/util/proto + - pkg/util/proto/testing - pkg/util/proto/validation - name: k8s.io/kubernetes - version: 32ac1c9073b132b8ba18aa830f46b77dcceb0723 + version: 8b3d76091fd500b7c59c83e113c9048ee612b205 subpackages: - pkg/api/events - pkg/api/legacyscheme @@ -697,7 +648,6 @@ imports: - pkg/apis/core/pods - pkg/apis/core/v1 - pkg/apis/core/v1/helper - - pkg/apis/core/v1/helper/qos - pkg/apis/core/validation - pkg/apis/events - pkg/apis/events/install @@ -722,6 +672,7 @@ imports: - pkg/apis/scheduling - pkg/apis/scheduling/install - pkg/apis/scheduling/v1alpha1 + - pkg/apis/scheduling/v1beta1 - pkg/apis/settings - pkg/apis/settings/install - pkg/apis/settings/v1alpha1 @@ -767,36 +718,30 @@ imports: - pkg/client/clientset_generated/internalclientset/typed/settings/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion/fake - - pkg/cloudprovider - pkg/controller - - pkg/controller/daemon - - pkg/controller/daemon/util - pkg/controller/deployment/util - - pkg/controller/history - - pkg/controller/statefulset - - pkg/controller/volume/events - - pkg/controller/volume/persistentvolume - - pkg/controller/volume/persistentvolume/metrics - pkg/credentialprovider - pkg/features - pkg/fieldpath + - pkg/generated - pkg/kubectl - pkg/kubectl/apps - - pkg/kubectl/categories + - pkg/kubectl/cmd/get - pkg/kubectl/cmd/templates - pkg/kubectl/cmd/testing - pkg/kubectl/cmd/util - pkg/kubectl/cmd/util/openapi - pkg/kubectl/cmd/util/openapi/testing - pkg/kubectl/cmd/util/openapi/validation - - pkg/kubectl/plugins - - pkg/kubectl/resource + - pkg/kubectl/genericclioptions + - pkg/kubectl/genericclioptions/printers + - pkg/kubectl/genericclioptions/resource - pkg/kubectl/scheme - pkg/kubectl/util - pkg/kubectl/util/hash + - pkg/kubectl/util/i18n - pkg/kubectl/util/slice - pkg/kubectl/util/term - - pkg/kubectl/util/transport - pkg/kubectl/validation - pkg/kubelet/apis - pkg/kubelet/types @@ -805,38 +750,25 @@ imports: - pkg/printers/internalversion - pkg/registry/rbac/validation - pkg/scheduler/algorithm - - pkg/scheduler/algorithm/predicates - pkg/scheduler/algorithm/priorities/util - pkg/scheduler/api - - pkg/scheduler/schedulercache + - pkg/scheduler/cache - pkg/scheduler/util - - pkg/scheduler/volumebinder - pkg/security/apparmor - pkg/serviceaccount - pkg/util/file - - pkg/util/goroutinemap - - pkg/util/goroutinemap/exponentialbackoff - pkg/util/hash - pkg/util/interrupt - - pkg/util/io - pkg/util/labels - - pkg/util/metrics - - pkg/util/mount - pkg/util/net/sets - pkg/util/node - - pkg/util/nsenter - pkg/util/parsers - pkg/util/pointer - pkg/util/slice - pkg/util/taints - pkg/version - - pkg/volume - - pkg/volume/util - - pkg/volume/util/fs - - pkg/volume/util/recyclerclient - - pkg/volume/util/types - name: k8s.io/utils - version: aedf551cdb8b0119df3a19c65fde413a13b34997 + version: 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e subpackages: - clock - exec diff --git a/glide.yaml b/glide.yaml index a101a11ee..e32df1d4e 100644 --- a/glide.yaml +++ b/glide.yaml @@ -4,9 +4,9 @@ import: subpackages: - context - package: github.com/spf13/cobra - version: f62e98d28ab7ad31d707ba837a966378465c7b57 + version: c439c4fa093711d42e1b01acb1235b52004753c1 - package: github.com/spf13/pflag - version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7 + version: 583c0c0531f06d5278b7d917446061adc344b5cd - package: github.com/Masterminds/vcs version: ~1.11.0 # Pin version of mergo that is compatible with both sprig and Kubernetes @@ -49,15 +49,15 @@ import: - package: github.com/grpc-ecosystem/go-grpc-prometheus - package: k8s.io/kubernetes - version: release-1.10 + version: release-1.11 - package: k8s.io/client-go - version: kubernetes-1.10.0 + version: kubernetes-1.11.1 - package: k8s.io/api - version: release-1.10 + version: kubernetes-1.11.1 - package: k8s.io/apimachinery - version: release-1.10 + version: kubernetes-1.11.1 - package: k8s.io/apiserver - version: release-1.10 + version: kubernetes-1.11.1 - package: github.com/cyphar/filepath-securejoin version: ^0.2.1 diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 39187da42..167da9eef 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -42,14 +42,14 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/tools/clientcmd" + "k8s.io/kubernetes/pkg/api/legacyscheme" batchinternal "k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl" + "k8s.io/kubernetes/pkg/kubectl/cmd/get" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/kubectl/genericclioptions" + "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" "k8s.io/kubernetes/pkg/kubectl/validation" - "k8s.io/kubernetes/pkg/printers" ) const ( @@ -63,18 +63,17 @@ var ErrNoObjectsVisited = goerrors.New("no objects visited") // Client represents a client capable of communicating with the Kubernetes API. type Client struct { cmdutil.Factory - // SchemaCacheDir is the path for loading cached schema. - SchemaCacheDir string - Log func(string, ...interface{}) } // New creates a new Client. -func New(config clientcmd.ClientConfig) *Client { +func New(getter genericclioptions.RESTClientGetter) *Client { + if getter == nil { + getter = genericclioptions.NewConfigFlags() + } return &Client{ - Factory: cmdutil.NewFactory(config), - SchemaCacheDir: clientcmd.RecommendedSchemaFile, - Log: nopLogger, + Factory: cmdutil.NewFactory(getter), + Log: nopLogger, } } @@ -111,8 +110,8 @@ func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shoul func (c *Client) newBuilder(namespace string, reader io.Reader) *resource.Result { return c.NewBuilder(). - Internal(). ContinueOnError(). + WithScheme(legacyscheme.Scheme). Schema(c.validator()). NamespaceParam(namespace). DefaultNamespace(). @@ -179,7 +178,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // versions per cluster, but this certainly won't hurt anything, so let's be safe. gvk := info.ResourceMapping().GroupVersionKind vk := gvk.Version + "/" + gvk.Kind - objs[vk] = append(objs[vk], info.AsInternal()) + objs[vk] = append(objs[vk], asVersioned(info)) //Get the relation pods objPods, err = c.getSelectRelationPod(info, objPods) @@ -205,10 +204,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // an object type changes, so we can just rely on that. Problem is it doesn't seem to keep // track of tab widths. buf := new(bytes.Buffer) - p, err := cmdutil.PrinterForOptions(&printers.PrintOptions{}) - if err != nil { - return "", err - } + p, _ := get.NewHumanPrintFlags().ToPrinter("") for t, ot := range objs { if _, err = buf.WriteString("==> " + t + "\n"); err != nil { return "", err @@ -297,7 +293,7 @@ func (c *Client) Update(namespace string, originalReader, targetReader io.Reader for _, info := range original.Difference(target) { c.Log("Deleting %q in %s...", info.Name, info.Namespace) - if err := deleteResource(c, info); err != nil { + if err := deleteResource(info); err != nil { c.Log("Failed to delete %q, err: %s", info.Name, err) } } @@ -317,7 +313,7 @@ func (c *Client) Delete(namespace string, reader io.Reader) error { } return perform(infos, func(info *resource.Info) error { c.Log("Starting delete for %q %s", info.Name, info.Mapping.GroupVersionKind.Kind) - err := deleteResource(c, info) + err := deleteResource(info) return c.skipIfNotFound(err) }) } @@ -379,17 +375,11 @@ func createResource(info *resource.Info) error { return info.Refresh(obj, true) } -func deleteResource(c *Client, info *resource.Info) error { - reaper, err := c.Reaper(info.Mapping) - if err != nil { - // If there is no reaper for this resources, delete it. - if kubectl.IsNoSuchReaperError(err) { - return resource.NewHelper(info.Client, info.Mapping).Delete(info.Namespace, info.Name) - } - return err - } - c.Log("Using reaper for deleting %q", info.Name) - return reaper.Stop(info.Namespace, info.Name, 0, nil) +func deleteResource(info *resource.Info) error { + policy := metav1.DeletePropagationBackground + opts := &metav1.DeleteOptions{PropagationPolicy: &policy} + _, err := resource.NewHelper(info.Client, info.Mapping).DeleteWithOptions(info.Namespace, info.Name, opts) + return err } func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.PatchType, error) { @@ -411,7 +401,7 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P } // Get a versioned object - versionedObject, err := target.Versioned() + versionedObject := asVersioned(target) // Unstructured objects, such as CRDs, may not have an not registered error // returned from ConvertToVersion. Anything that's unstructured should @@ -455,7 +445,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, if force { // Attempt to delete... - if err := deleteResource(c, target); err != nil { + if err := deleteResource(target); err != nil { return err } log.Printf("Deleted %s: %q", kind, target.Name) @@ -483,7 +473,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, return nil } - versioned := target.AsVersioned() + versioned := asVersioned(target) selector, ok := getSelectorFromObject(versioned) if !ok { return nil @@ -695,14 +685,7 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] c.Log("get relation pod of object: %s/%s/%s", info.Namespace, info.Mapping.GroupVersionKind.Kind, info.Name) - versioned, err := info.Versioned() - switch { - case runtime.IsNotRegisteredError(err): - return objPods, nil - case err != nil: - return objPods, err - } - + versioned := asVersioned(info) selector, ok := getSelectorFromObject(versioned) if !ok { return objPods, nil @@ -743,3 +726,7 @@ func isFoundPod(podItem []core.Pod, pod core.Pod) bool { } return false } + +func asVersioned(info *resource.Info) runtime.Object { + return cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping) +} diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index 6e33ca27f..617fce352 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -23,25 +23,20 @@ import ( "net/http" "strings" "testing" - "time" - "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/dynamic" "k8s.io/client-go/rest/fake" "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" - cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" "k8s.io/kubernetes/pkg/kubectl/scheme" ) -var unstructuredSerializer = dynamic.ContentConfig().NegotiatedSerializer +var unstructuredSerializer = resource.UnstructuredPlusDefaultContentConfig().NegotiatedSerializer func objBody(codec runtime.Codec, obj runtime.Object) io.ReadCloser { return ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(codec, obj)))) @@ -98,24 +93,6 @@ func newResponse(code int, obj runtime.Object) (*http.Response, error) { return &http.Response{StatusCode: code, Header: header, Body: body}, nil } -type fakeReaper struct { - name string -} - -func (r *fakeReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error { - r.name = name - return nil -} - -type fakeReaperFactory struct { - cmdutil.Factory - reaper kubectl.Reaper -} - -func (f *fakeReaperFactory) Reaper(mapping *meta.RESTMapping) (kubectl.Reaper, error) { - return f.reaper, nil -} - type testClient struct { *Client *cmdtesting.TestFactory @@ -144,8 +121,8 @@ func TestUpdate(t *testing.T) { tf := cmdtesting.NewTestFactory() defer tf.Cleanup() + tf.UnstructuredClient = &fake.RESTClient{ - GroupVersion: schema.GroupVersion{Version: "v1"}, NegotiatedSerializer: unstructuredSerializer, Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { p, m := req.URL.Path, req.Method @@ -180,11 +157,12 @@ func TestUpdate(t *testing.T) { }), } - c := newTestClient() - reaper := &fakeReaper{} - rf := &fakeReaperFactory{Factory: tf, reaper: reaper} - c.Client.Factory = rf - codec := legacyscheme.Codecs.LegacyCodec(scheme.Versions...) + c := &Client{ + Factory: tf, + Log: nopLogger, + } + codec := legacyscheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) + if err := c.Update(core.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil { t.Fatal(err) } @@ -205,6 +183,7 @@ func TestUpdate(t *testing.T) { "/namespaces/default/pods/otter:GET", "/namespaces/default/pods/dolphin:GET", "/namespaces/default/pods:POST", + "/namespaces/default/pods/squid:DELETE", } if len(expectedActions) != len(actions) { t.Errorf("unexpected number of requests, expected %d, got %d", len(expectedActions), len(actions)) @@ -215,11 +194,6 @@ func TestUpdate(t *testing.T) { t.Errorf("expected %s request got %s", v, actions[k]) } } - - if reaper.name != "squid" { - t.Errorf("unexpected reaper: %#v", reaper) - } - } func TestBuild(t *testing.T) { diff --git a/pkg/kube/result.go b/pkg/kube/result.go index f90d77ad5..0c6289e49 100644 --- a/pkg/kube/result.go +++ b/pkg/kube/result.go @@ -16,7 +16,7 @@ limitations under the License. package kube // import "k8s.io/helm/pkg/kube" -import "k8s.io/kubernetes/pkg/kubectl/resource" +import "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" // Result provides convenience methods for comparing collections of Infos. type Result []*resource.Info diff --git a/pkg/kube/result_test.go b/pkg/kube/result_test.go index 0780ad9fc..503473c05 100644 --- a/pkg/kube/result_test.go +++ b/pkg/kube/result_test.go @@ -19,15 +19,14 @@ package kube // import "k8s.io/helm/pkg/kube" import ( "testing" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" ) func TestResult(t *testing.T) { - mapping, err := testapi.Default.RESTMapper().RESTMapping(schema.GroupKind{Kind: "Pod"}) - if err != nil { - t.Fatal(err) + mapping := &meta.RESTMapping{ + Resource: schema.GroupVersionResource{Group: "group", Version: "version", Resource: "pod"}, } info := func(name string) *resource.Info { diff --git a/pkg/kube/wait.go b/pkg/kube/wait.go index ed9bc10a6..960409df9 100644 --- a/pkg/kube/wait.go +++ b/pkg/kube/wait.go @@ -27,7 +27,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" podutil "k8s.io/kubernetes/pkg/api/v1/pod" @@ -37,8 +36,8 @@ import ( // deployment holds associated replicaSets for a deployment type deployment struct { - replicaSets *extensions.ReplicaSet - deployment *extensions.Deployment + replicaSets *appsv1.ReplicaSet + deployment *appsv1.Deployment } // waitForResources polls to get the current status of all pods, PVCs, and Services @@ -56,11 +55,7 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { pvc := []v1.PersistentVolumeClaim{} deployments := []deployment{} for _, v := range created { - obj, err := v.Versioned() - if err != nil && !runtime.IsNotRegisteredError(err) { - return false, err - } - switch value := obj.(type) { + switch value := asVersioned(v).(type) { case *v1.ReplicationController: list, err := getPods(kcs, value.Namespace, value.Spec.Selector) if err != nil { @@ -74,12 +69,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { } pods = append(pods, *pod) case *appsv1.Deployment: - currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) + currentDeployment, err := kcs.AppsV1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) if err != nil { return false, err } // Find RS associated with deployment - newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1()) + newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.AppsV1()) if err != nil || newReplicaSet == nil { return false, err } @@ -89,12 +84,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { } deployments = append(deployments, newDeployment) case *appsv1beta1.Deployment: - currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) + currentDeployment, err := kcs.AppsV1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) if err != nil { return false, err } // Find RS associated with deployment - newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1()) + newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.AppsV1()) if err != nil || newReplicaSet == nil { return false, err } @@ -104,12 +99,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { } deployments = append(deployments, newDeployment) case *appsv1beta2.Deployment: - currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) + currentDeployment, err := kcs.AppsV1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) if err != nil { return false, err } // Find RS associated with deployment - newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1()) + newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.AppsV1()) if err != nil || newReplicaSet == nil { return false, err } @@ -119,12 +114,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { } deployments = append(deployments, newDeployment) case *extensions.Deployment: - currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) + currentDeployment, err := kcs.AppsV1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) if err != nil { return false, err } // Find RS associated with deployment - newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1()) + newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.AppsV1()) if err != nil || newReplicaSet == nil { return false, err } diff --git a/pkg/tiller/environment/environment.go b/pkg/tiller/environment/environment.go index b38230bab..c9ddab3ab 100644 --- a/pkg/tiller/environment/environment.go +++ b/pkg/tiller/environment/environment.go @@ -27,7 +27,7 @@ import ( "time" "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/engine" diff --git a/pkg/tiller/environment/environment_test.go b/pkg/tiller/environment/environment_test.go index 0c10cda37..b835a976d 100644 --- a/pkg/tiller/environment/environment_test.go +++ b/pkg/tiller/environment/environment_test.go @@ -23,7 +23,7 @@ import ( "time" "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/kube" diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index b3b1bc49d..122ab9dd4 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -32,7 +32,7 @@ import ( "google.golang.org/grpc/metadata" "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/hooks" From 054036e9d49558420b5ff229ee4553139b1a6a3d Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Wed, 1 Aug 2018 15:45:34 -0700 Subject: [PATCH 322/449] docs(generated): regenerate markdown docs --- docs/helm/helm.md | 5 +++-- docs/helm/helm_completion.md | 12 +++++++++--- docs/helm/helm_create.md | 7 ++++--- docs/helm/helm_delete.md | 5 +++-- docs/helm/helm_dependency.md | 10 ++++++++-- docs/helm/helm_dependency_build.md | 5 +++-- docs/helm/helm_dependency_list.md | 10 ++++++++-- docs/helm/helm_dependency_update.md | 5 +++-- docs/helm/helm_fetch.md | 5 +++-- docs/helm/helm_get.md | 5 +++-- docs/helm/helm_get_hooks.md | 5 +++-- docs/helm/helm_get_manifest.md | 5 +++-- docs/helm/helm_get_values.md | 5 +++-- docs/helm/helm_history.md | 5 +++-- docs/helm/helm_home.md | 12 +++++++++--- docs/helm/helm_init.md | 7 ++++--- docs/helm/helm_inspect.md | 7 ++++--- docs/helm/helm_inspect_chart.md | 7 ++++--- docs/helm/helm_inspect_readme.md | 7 ++++--- docs/helm/helm_inspect_values.md | 7 ++++--- docs/helm/helm_install.md | 7 ++++--- docs/helm/helm_lint.md | 5 +++-- docs/helm/helm_list.md | 5 +++-- docs/helm/helm_package.md | 5 +++-- docs/helm/helm_plugin.md | 10 ++++++++-- docs/helm/helm_plugin_install.md | 7 ++++--- docs/helm/helm_plugin_list.md | 12 +++++++++--- docs/helm/helm_plugin_remove.md | 12 +++++++++--- docs/helm/helm_plugin_update.md | 12 +++++++++--- docs/helm/helm_repo.md | 10 ++++++++-- docs/helm/helm_repo_add.md | 5 +++-- docs/helm/helm_repo_index.md | 5 +++-- docs/helm/helm_repo_list.md | 10 ++++++++-- docs/helm/helm_repo_remove.md | 10 ++++++++-- docs/helm/helm_repo_update.md | 12 +++++++++--- docs/helm/helm_reset.md | 7 ++++--- docs/helm/helm_rollback.md | 5 +++-- docs/helm/helm_search.md | 7 ++++--- docs/helm/helm_serve.md | 7 ++++--- docs/helm/helm_status.md | 5 +++-- docs/helm/helm_template.md | 5 +++-- docs/helm/helm_test.md | 7 ++++--- docs/helm/helm_upgrade.md | 7 ++++--- docs/helm/helm_verify.md | 5 +++-- docs/helm/helm_version.md | 7 ++++--- 45 files changed, 215 insertions(+), 110 deletions(-) diff --git a/docs/helm/helm.md b/docs/helm/helm.md index ae27de401..67ac9a4a2 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -4,7 +4,6 @@ The Helm package manager for Kubernetes. ### Synopsis - The Kubernetes package manager To begin working with Helm, run the 'helm init' command: @@ -33,6 +32,7 @@ Environment: ``` --debug enable verbose output + -h, --help help for helm --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use @@ -42,6 +42,7 @@ Environment: ``` ### SEE ALSO + * [helm completion](helm_completion.md) - Generate autocompletions script for the specified shell (bash or zsh) * [helm create](helm_create.md) - create a new chart with the given name * [helm delete](helm_delete.md) - given a release name, delete the release from Kubernetes @@ -69,4 +70,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_completion.md b/docs/helm/helm_completion.md index 64a6056f8..440393076 100644 --- a/docs/helm/helm_completion.md +++ b/docs/helm/helm_completion.md @@ -5,7 +5,6 @@ Generate autocompletions script for the specified shell (bash or zsh) ### Synopsis - Generate autocompletions script for Helm for the specified shell (bash or zsh). This command can generate shell autocompletions. e.g. @@ -18,7 +17,13 @@ Can be sourced as such ``` -helm completion SHELL +helm completion SHELL [flags] +``` + +### Options + +``` + -h, --help help for completion ``` ### Options inherited from parent commands @@ -34,6 +39,7 @@ helm completion SHELL ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index 7ae947ed7..0e20d9860 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -5,7 +5,6 @@ create a new chart with the given name ### Synopsis - This command creates a chart directory along with the common files and directories used in a chart. @@ -31,12 +30,13 @@ will be overwritten, but other files will be left alone. ``` -helm create NAME +helm create NAME [flags] ``` ### Options ``` + -h, --help help for create -p, --starter string the named Helm starter scaffold ``` @@ -53,6 +53,7 @@ helm create NAME ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index 442e5e96c..3c6a46844 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -5,7 +5,6 @@ given a release name, delete the release from Kubernetes ### Synopsis - This command takes a release name, and then deletes the release from Kubernetes. It removes all of the resources associated with the last release of the chart. @@ -22,6 +21,7 @@ helm delete [flags] RELEASE_NAME [...] ``` --description string specify a description for the release --dry-run simulate a delete + -h, --help help for delete --no-hooks prevent hooks from running during deletion --purge remove the release from the store and make its name free for later use --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) @@ -46,6 +46,7 @@ helm delete [flags] RELEASE_NAME [...] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_dependency.md b/docs/helm/helm_dependency.md index b0085c6c7..317860bdb 100644 --- a/docs/helm/helm_dependency.md +++ b/docs/helm/helm_dependency.md @@ -5,7 +5,6 @@ manage a chart's dependencies ### Synopsis - Manage the dependencies of a chart. Helm charts store their dependencies in 'charts/'. For chart developers, it is @@ -54,6 +53,12 @@ repository added to helm by "helm add repo". Version matching is also supported for this case. +### Options + +``` + -h, --help help for dependency +``` + ### Options inherited from parent commands ``` @@ -67,9 +72,10 @@ for this case. ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm dependency build](helm_dependency_build.md) - rebuild the charts/ directory based on the requirements.lock file * [helm dependency list](helm_dependency_list.md) - list the dependencies for the given chart * [helm dependency update](helm_dependency_update.md) - update charts/ based on the contents of requirements.yaml -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_dependency_build.md b/docs/helm/helm_dependency_build.md index eea2fa02c..fba70f2ec 100644 --- a/docs/helm/helm_dependency_build.md +++ b/docs/helm/helm_dependency_build.md @@ -5,7 +5,6 @@ rebuild the charts/ directory based on the requirements.lock file ### Synopsis - Build out the charts/ directory from the requirements.lock file. Build is used to reconstruct a chart's dependencies to the state specified in @@ -23,6 +22,7 @@ helm dependency build [flags] CHART ### Options ``` + -h, --help help for build --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") --verify verify the packages against signatures ``` @@ -40,6 +40,7 @@ helm dependency build [flags] CHART ``` ### SEE ALSO + * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_dependency_list.md b/docs/helm/helm_dependency_list.md index d6bc0175a..da754c5d1 100644 --- a/docs/helm/helm_dependency_list.md +++ b/docs/helm/helm_dependency_list.md @@ -5,7 +5,6 @@ list the dependencies for the given chart ### Synopsis - List all of the dependencies declared in a chart. This can take chart archives and chart directories as input. It will not alter @@ -19,6 +18,12 @@ if it cannot find a requirements.yaml. helm dependency list [flags] CHART ``` +### Options + +``` + -h, --help help for list +``` + ### Options inherited from parent commands ``` @@ -32,6 +37,7 @@ helm dependency list [flags] CHART ``` ### SEE ALSO + * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_dependency_update.md b/docs/helm/helm_dependency_update.md index 90b81ecea..88bf3fafd 100644 --- a/docs/helm/helm_dependency_update.md +++ b/docs/helm/helm_dependency_update.md @@ -5,7 +5,6 @@ update charts/ based on the contents of requirements.yaml ### Synopsis - Update the on-disk dependencies to mirror the requirements.yaml file. This command verifies that the required charts, as expressed in 'requirements.yaml', @@ -27,6 +26,7 @@ helm dependency update [flags] CHART ### Options ``` + -h, --help help for update --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") --skip-refresh do not refresh the local repository cache --verify verify the packages against signatures @@ -45,6 +45,7 @@ helm dependency update [flags] CHART ``` ### SEE ALSO + * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_fetch.md b/docs/helm/helm_fetch.md index c347d1620..81c0a9596 100644 --- a/docs/helm/helm_fetch.md +++ b/docs/helm/helm_fetch.md @@ -5,7 +5,6 @@ download a chart from a repository and (optionally) unpack it in local directory ### Synopsis - Retrieve a package from a package repository, and download it locally. This is useful for fetching packages to inspect, modify, or repackage. It can @@ -31,6 +30,7 @@ helm fetch [flags] [chart URL | repo/chartname] [...] --cert-file string identify HTTPS client using this SSL certificate file -d, --destination string location to write the chart. If this and tardir are specified, tardir is appended to this (default ".") --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. + -h, --help help for fetch --key-file string identify HTTPS client using this SSL key file --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") --password string chart repository password @@ -56,6 +56,7 @@ helm fetch [flags] [chart URL | repo/chartname] [...] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index 3a1b3d442..e7337b533 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -5,7 +5,6 @@ download a named release ### Synopsis - This command shows the details of a named release. It can be used to get extended information about the release, including: @@ -25,6 +24,7 @@ helm get [flags] RELEASE_NAME ### Options ``` + -h, --help help for get --revision int32 get the named release with revision --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -47,9 +47,10 @@ helm get [flags] RELEASE_NAME ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm get hooks](helm_get_hooks.md) - download all hooks for a named release * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_get_hooks.md b/docs/helm/helm_get_hooks.md index 9f3d5b0b2..d7097fd59 100644 --- a/docs/helm/helm_get_hooks.md +++ b/docs/helm/helm_get_hooks.md @@ -5,7 +5,6 @@ download all hooks for a named release ### Synopsis - This command downloads hooks for a given release. Hooks are formatted in YAML and separated by the YAML '---\n' separator. @@ -18,6 +17,7 @@ helm get hooks [flags] RELEASE_NAME ### Options ``` + -h, --help help for hooks --revision int32 get the named release with revision --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -40,6 +40,7 @@ helm get hooks [flags] RELEASE_NAME ``` ### SEE ALSO + * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_get_manifest.md b/docs/helm/helm_get_manifest.md index 6cae9001f..60bfeac0b 100644 --- a/docs/helm/helm_get_manifest.md +++ b/docs/helm/helm_get_manifest.md @@ -5,7 +5,6 @@ download the manifest for a named release ### Synopsis - This command fetches the generated manifest for a given release. A manifest is a YAML-encoded representation of the Kubernetes resources that @@ -20,6 +19,7 @@ helm get manifest [flags] RELEASE_NAME ### Options ``` + -h, --help help for manifest --revision int32 get the named release with revision --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -42,6 +42,7 @@ helm get manifest [flags] RELEASE_NAME ``` ### SEE ALSO + * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index 01fee2cd2..7208d5885 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -5,7 +5,6 @@ download the values file for a named release ### Synopsis - This command downloads a values file for a given release. @@ -17,6 +16,7 @@ helm get values [flags] RELEASE_NAME ``` -a, --all dump all (computed) values + -h, --help help for values --revision int32 get the named release with revision --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -39,6 +39,7 @@ helm get values [flags] RELEASE_NAME ``` ### SEE ALSO + * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index e5028f9cb..7f0a68928 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -5,7 +5,6 @@ fetch release history ### Synopsis - History prints historical revisions for a given release. A default maximum of 256 revisions will be returned. Setting '--max' @@ -29,6 +28,7 @@ helm history [flags] RELEASE_NAME ``` --col-width uint specifies the max column width of output (default 60) + -h, --help help for history --max int32 maximum number of revision to include in history (default 256) -o, --output string prints the output in the specified format (json|table|yaml) (default "table") --tls enable TLS for request @@ -52,6 +52,7 @@ helm history [flags] RELEASE_NAME ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_home.md b/docs/helm/helm_home.md index 9af12c91a..192302424 100644 --- a/docs/helm/helm_home.md +++ b/docs/helm/helm_home.md @@ -5,13 +5,18 @@ displays the location of HELM_HOME ### Synopsis - This command displays the location of HELM_HOME. This is where any helm configuration files live. ``` -helm home +helm home [flags] +``` + +### Options + +``` + -h, --help help for home ``` ### Options inherited from parent commands @@ -27,6 +32,7 @@ helm home ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index ec775520a..430cc3d0e 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -5,7 +5,6 @@ initialize Helm on both client and server ### Synopsis - This command installs Tiller (the Helm server-side component) onto your Kubernetes Cluster and sets up local configuration in $HELM_HOME (default ~/.helm/). @@ -27,7 +26,7 @@ To dump a manifest containing the Tiller deployment YAML, combine the ``` -helm init +helm init [flags] ``` ### Options @@ -37,6 +36,7 @@ helm init -c, --client-only if set does not install Tiller --dry-run do not install local or remote --force-upgrade force upgrade of Tiller to the current helm version + -h, --help help for init --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") --net-host install Tiller with net=host @@ -70,6 +70,7 @@ helm init ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index 4bc904f63..86689eeaa 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -5,7 +5,6 @@ inspect a chart ### Synopsis - 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. @@ -13,7 +12,7 @@ Inspect prints the contents of the Chart.yaml file and the values.yaml file. ``` -helm inspect [CHART] +helm inspect [CHART] [flags] ``` ### Options @@ -21,6 +20,7 @@ helm inspect [CHART] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + -h, --help help for inspect --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") --password string chart repository password where to locate the requested chart @@ -43,9 +43,10 @@ helm inspect [CHART] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm inspect chart](helm_inspect_chart.md) - shows inspect chart * [helm inspect readme](helm_inspect_readme.md) - shows inspect readme * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index 257f26051..2b9adbb7e 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -5,13 +5,12 @@ shows inspect chart ### Synopsis - This command inspects a chart (directory, file, or URL) and displays the contents of the Charts.yaml file ``` -helm inspect chart [CHART] +helm inspect chart [CHART] [flags] ``` ### Options @@ -19,6 +18,7 @@ helm inspect chart [CHART] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + -h, --help help for chart --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") --password string chart repository password where to locate the requested chart @@ -41,6 +41,7 @@ helm inspect chart [CHART] ``` ### SEE ALSO + * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_inspect_readme.md b/docs/helm/helm_inspect_readme.md index 8ff7d892e..d222cd53a 100644 --- a/docs/helm/helm_inspect_readme.md +++ b/docs/helm/helm_inspect_readme.md @@ -5,13 +5,12 @@ shows inspect readme ### Synopsis - This command inspects a chart (directory, file, or URL) and displays the contents of the README file ``` -helm inspect readme [CHART] +helm inspect readme [CHART] [flags] ``` ### Options @@ -19,6 +18,7 @@ helm inspect readme [CHART] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + -h, --help help for readme --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") --repo string chart repository url where to locate the requested chart @@ -39,6 +39,7 @@ helm inspect readme [CHART] ``` ### SEE ALSO + * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index 50ff6ac24..9cca2fc32 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -5,13 +5,12 @@ shows inspect values ### Synopsis - This command inspects a chart (directory, file, or URL) and displays the contents of the values.yaml file ``` -helm inspect values [CHART] +helm inspect values [CHART] [flags] ``` ### Options @@ -19,6 +18,7 @@ helm inspect values [CHART] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + -h, --help help for values --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") --password string chart repository password where to locate the requested chart @@ -41,6 +41,7 @@ helm inspect values [CHART] ``` ### SEE ALSO + * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 6e0948e8f..05cdf1e4a 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -5,7 +5,6 @@ install a chart archive ### Synopsis - This command installs a chart archive. The install argument must be a chart reference, a path to a packaged chart, @@ -73,7 +72,7 @@ charts in a repository, use 'helm search'. ``` -helm install [CHART] +helm install [CHART] [flags] ``` ### Options @@ -85,6 +84,7 @@ helm install [CHART] --description string specify a description for the release --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --dry-run simulate an install + -h, --help help for install --key-file string identify HTTPS client using this SSL key file --keyring string location of public keys used for verification (default "~/.gnupg/pubring.gpg") -n, --name string release name. If unspecified, it will autogenerate one for you @@ -125,6 +125,7 @@ helm install [CHART] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index 9c328a086..bf168184e 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -5,7 +5,6 @@ examines a chart for possible issues ### Synopsis - This command takes a path to a chart and runs a series of tests to verify that the chart is well-formed. @@ -21,6 +20,7 @@ helm lint [flags] PATH ### Options ``` + -h, --help help for lint --namespace string namespace to put the release into (default "default") --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) @@ -42,6 +42,7 @@ helm lint [flags] PATH ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 25-Jul-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index 17b2573b8..bf740239d 100755 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -5,7 +5,6 @@ list releases ### Synopsis - This command lists all of the releases. By default, it lists only releases that are deployed or failed. Flags like @@ -46,6 +45,7 @@ helm list [flags] [FILTER] --deleting show releases that are currently being deleted --deployed show deployed releases. If no other is specified, this will be automatically enabled --failed show failed releases + -h, --help help for list -m, --max int maximum number of releases to fetch (default 256) --namespace string show releases within a specific namespace -o, --offset string next release name in the list, used to offset from start value @@ -74,6 +74,7 @@ helm list [flags] [FILTER] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index 30d06fcf0..b772fa70c 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -5,7 +5,6 @@ package a chart directory into a chart archive ### Synopsis - This command packages a chart into a versioned chart archive file. If a path is given, this will look at that path for a chart (which must contain a Chart.yaml file) and then package that directory. @@ -26,6 +25,7 @@ helm package [flags] [CHART_PATH] [...] --app-version string set the appVersion on the chart to this version -u, --dependency-update update dependencies from "requirements.yaml" to dir "charts/" before packaging -d, --destination string location to write the chart. (default ".") + -h, --help help for package --key string name of the key to use when signing. Used if --sign is true --keyring string location of a public keyring (default "~/.gnupg/pubring.gpg") --save save packaged chart to local chart repository (default true) @@ -46,6 +46,7 @@ helm package [flags] [CHART_PATH] [...] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin.md b/docs/helm/helm_plugin.md index bb0498d87..5aa57b69c 100644 --- a/docs/helm/helm_plugin.md +++ b/docs/helm/helm_plugin.md @@ -5,10 +5,15 @@ add, list, or remove Helm plugins ### Synopsis - Manage client-side Helm plugins. +### Options + +``` + -h, --help help for plugin +``` + ### Options inherited from parent commands ``` @@ -22,10 +27,11 @@ Manage client-side Helm plugins. ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm plugin install](helm_plugin_install.md) - install one or more Helm plugins * [helm plugin list](helm_plugin_list.md) - list installed Helm plugins * [helm plugin remove](helm_plugin_remove.md) - remove one or more Helm plugins * [helm plugin update](helm_plugin_update.md) - update one or more Helm plugins -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin_install.md b/docs/helm/helm_plugin_install.md index ab45850bf..f30bfff55 100644 --- a/docs/helm/helm_plugin_install.md +++ b/docs/helm/helm_plugin_install.md @@ -5,7 +5,6 @@ install one or more Helm plugins ### Synopsis - This command allows you to install a plugin from a url to a VCS repo or a local path. Example usage: @@ -13,12 +12,13 @@ Example usage: ``` -helm plugin install [options] ... +helm plugin install [options] ... [flags] ``` ### Options ``` + -h, --help help for install --version string specify a version constraint. If this is not specified, the latest version is installed ``` @@ -35,6 +35,7 @@ helm plugin install [options] ... ``` ### SEE ALSO + * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin_list.md b/docs/helm/helm_plugin_list.md index dc13cdf7a..373462e2b 100644 --- a/docs/helm/helm_plugin_list.md +++ b/docs/helm/helm_plugin_list.md @@ -4,11 +4,16 @@ list installed Helm plugins ### Synopsis - list installed Helm plugins ``` -helm plugin list +helm plugin list [flags] +``` + +### Options + +``` + -h, --help help for list ``` ### Options inherited from parent commands @@ -24,6 +29,7 @@ helm plugin list ``` ### SEE ALSO + * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin_remove.md b/docs/helm/helm_plugin_remove.md index 2ef833217..30f222c9f 100644 --- a/docs/helm/helm_plugin_remove.md +++ b/docs/helm/helm_plugin_remove.md @@ -4,11 +4,16 @@ remove one or more Helm plugins ### Synopsis - remove one or more Helm plugins ``` -helm plugin remove ... +helm plugin remove ... [flags] +``` + +### Options + +``` + -h, --help help for remove ``` ### Options inherited from parent commands @@ -24,6 +29,7 @@ helm plugin remove ... ``` ### SEE ALSO + * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin_update.md b/docs/helm/helm_plugin_update.md index 93bc3e764..65b16cd9d 100644 --- a/docs/helm/helm_plugin_update.md +++ b/docs/helm/helm_plugin_update.md @@ -4,11 +4,16 @@ update one or more Helm plugins ### Synopsis - update one or more Helm plugins ``` -helm plugin update ... +helm plugin update ... [flags] +``` + +### Options + +``` + -h, --help help for update ``` ### Options inherited from parent commands @@ -24,6 +29,7 @@ helm plugin update ... ``` ### SEE ALSO + * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo.md b/docs/helm/helm_repo.md index 32e9d02b2..0b73fbcd0 100644 --- a/docs/helm/helm_repo.md +++ b/docs/helm/helm_repo.md @@ -5,7 +5,6 @@ add, list, remove, update, and index chart repositories ### Synopsis - This command consists of multiple subcommands to interact with chart repositories. It can be used to add, remove, list, and index chart repositories. @@ -13,6 +12,12 @@ Example usage: $ helm repo add [NAME] [REPO_URL] +### Options + +``` + -h, --help help for repo +``` + ### Options inherited from parent commands ``` @@ -26,6 +31,7 @@ Example usage: ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm repo add](helm_repo_add.md) - add a chart repository * [helm repo index](helm_repo_index.md) - generate an index file given a directory containing packaged charts @@ -33,4 +39,4 @@ Example usage: * [helm repo remove](helm_repo_remove.md) - remove a chart repository * [helm repo update](helm_repo_update.md) - update information of available charts locally from chart repositories -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_add.md b/docs/helm/helm_repo_add.md index 1deb0cb5c..29947147d 100644 --- a/docs/helm/helm_repo_add.md +++ b/docs/helm/helm_repo_add.md @@ -4,7 +4,6 @@ add a chart repository ### Synopsis - add a chart repository ``` @@ -16,6 +15,7 @@ helm repo add [flags] [NAME] [URL] ``` --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle --cert-file string identify HTTPS client using this SSL certificate file + -h, --help help for add --key-file string identify HTTPS client using this SSL key file --no-update raise error if repo is already registered --password string chart repository password @@ -35,6 +35,7 @@ helm repo add [flags] [NAME] [URL] ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_index.md b/docs/helm/helm_repo_index.md index baa1291de..4660489f9 100644 --- a/docs/helm/helm_repo_index.md +++ b/docs/helm/helm_repo_index.md @@ -5,7 +5,6 @@ generate an index file given a directory containing packaged charts ### Synopsis - Read the current directory and generate an index file based on the charts found. This tool is used for creating an 'index.yaml' file for a chart repository. To @@ -23,6 +22,7 @@ helm repo index [flags] [DIR] ### Options ``` + -h, --help help for index --merge string merge the generated index into the given index --url string url of chart repository ``` @@ -40,6 +40,7 @@ helm repo index [flags] [DIR] ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_list.md b/docs/helm/helm_repo_list.md index 00221ed24..bebaa6333 100644 --- a/docs/helm/helm_repo_list.md +++ b/docs/helm/helm_repo_list.md @@ -4,13 +4,18 @@ list chart repositories ### Synopsis - list chart repositories ``` helm repo list [flags] ``` +### Options + +``` + -h, --help help for list +``` + ### Options inherited from parent commands ``` @@ -24,6 +29,7 @@ helm repo list [flags] ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_remove.md b/docs/helm/helm_repo_remove.md index 272ecea47..89f43a130 100644 --- a/docs/helm/helm_repo_remove.md +++ b/docs/helm/helm_repo_remove.md @@ -4,13 +4,18 @@ remove a chart repository ### Synopsis - remove a chart repository ``` helm repo remove [flags] [NAME] ``` +### Options + +``` + -h, --help help for remove +``` + ### Options inherited from parent commands ``` @@ -24,6 +29,7 @@ helm repo remove [flags] [NAME] ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_update.md b/docs/helm/helm_repo_update.md index f0215da48..0d14f63ed 100644 --- a/docs/helm/helm_repo_update.md +++ b/docs/helm/helm_repo_update.md @@ -5,7 +5,6 @@ update information of available charts locally from chart repositories ### Synopsis - Update gets the latest information about charts from the respective chart repositories. Information is cached locally, where it is used by commands like 'helm search'. @@ -14,7 +13,13 @@ future releases. ``` -helm repo update +helm repo update [flags] +``` + +### Options + +``` + -h, --help help for update ``` ### Options inherited from parent commands @@ -30,6 +35,7 @@ helm repo update ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index 74d5ecc0e..772ac42c3 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -5,20 +5,20 @@ uninstalls Tiller from a cluster ### Synopsis - This command uninstalls Tiller (the Helm server-side component) from your Kubernetes Cluster and optionally deletes local configuration in $HELM_HOME (default ~/.helm/) ``` -helm reset +helm reset [flags] ``` ### Options ``` -f, --force forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.) + -h, --help help for reset --remove-helm-home if set deletes $HELM_HOME --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -41,6 +41,7 @@ helm reset ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index 40d3ad83b..5862b180a 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -5,7 +5,6 @@ roll back a release to a previous revision ### Synopsis - This command rolls back a release to a previous revision. The first argument of the rollback command is the name of a release, and the @@ -23,6 +22,7 @@ helm rollback [flags] [RELEASE] [REVISION] --description string specify a description for the release --dry-run simulate a rollback --force force resource update through delete/recreate if needed + -h, --help help for rollback --no-hooks prevent hooks from running during rollback --recreate-pods performs pods restart for the resource if applicable --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) @@ -48,6 +48,7 @@ helm rollback [flags] [RELEASE] [REVISION] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_search.md b/docs/helm/helm_search.md index ffee22ce4..c45a397e3 100644 --- a/docs/helm/helm_search.md +++ b/docs/helm/helm_search.md @@ -5,7 +5,6 @@ search for a keyword in charts ### Synopsis - Search reads through all of the repositories configured on the system, and looks for matches. @@ -13,13 +12,14 @@ Repositories are managed with 'helm repo' commands. ``` -helm search [keyword] +helm search [keyword] [flags] ``` ### Options ``` --col-width uint specifies the max column width of output (default 60) + -h, --help help for search -r, --regexp use regular expressions for searching -v, --version string search using semantic versioning constraints -l, --versions show the long listing, with each version of each chart on its own line @@ -38,6 +38,7 @@ helm search [keyword] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index e300ee633..5e25f2a2f 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -5,7 +5,6 @@ start a local http web server ### Synopsis - This command starts a local chart repository server that serves charts from a local directory. The new server will provide HTTP access to a repository. By default, it will @@ -21,13 +20,14 @@ for more information on hosting chart repositories in a production setting. ``` -helm serve +helm serve [flags] ``` ### Options ``` --address string address to listen on (default "127.0.0.1:8879") + -h, --help help for serve --repo-path string local directory path from which to serve charts --url string external URL of chart repository ``` @@ -45,6 +45,7 @@ helm serve ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_status.md b/docs/helm/helm_status.md index 22b47c851..9dca005fd 100644 --- a/docs/helm/helm_status.md +++ b/docs/helm/helm_status.md @@ -5,7 +5,6 @@ displays the status of the named release ### Synopsis - This command shows the status of a named release. The status consists of: - last deployment time @@ -23,6 +22,7 @@ helm status [flags] RELEASE_NAME ### Options ``` + -h, --help help for status -o, --output string output the status in the specified format (json or yaml) --revision int32 if set, display the status of the named release with revision --tls enable TLS for request @@ -46,6 +46,7 @@ helm status [flags] RELEASE_NAME ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index f456f74be..d7770fb7f 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -5,7 +5,6 @@ locally render templates ### Synopsis - Render chart templates locally and display the output. This does not require Tiller. However, any values that would normally be @@ -26,6 +25,7 @@ helm template [flags] CHART ``` -x, --execute stringArray only execute the given templates + -h, --help help for template --is-upgrade set .Release.IsUpgrade instead of .Release.IsInstall --kube-version string kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9") -n, --name string release name (default "RELEASE-NAME") @@ -52,6 +52,7 @@ helm template [flags] CHART ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jul-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index 5a84c3b18..e55c5df68 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -5,7 +5,6 @@ test a release ### Synopsis - The test command runs the tests for a release. The argument this command takes is the name of a deployed release. @@ -13,13 +12,14 @@ The tests to be run are defined in the chart that was installed. ``` -helm test [RELEASE] +helm test [RELEASE] [flags] ``` ### Options ``` --cleanup delete test pods upon completion + -h, --help help for test --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -42,6 +42,7 @@ helm test [RELEASE] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 679070233..522464c6b 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -5,7 +5,6 @@ upgrade a release ### Synopsis - This command upgrades a release to a new version of a chart. The upgrade arguments must be a release and chart. The chart @@ -33,7 +32,7 @@ set for a key called 'foo', the 'newbar' value would take precedence: ``` -helm upgrade [RELEASE] [CHART] +helm upgrade [RELEASE] [CHART] [flags] ``` ### Options @@ -45,6 +44,7 @@ helm upgrade [RELEASE] [CHART] --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --dry-run simulate an upgrade --force force resource update through delete/recreate if needed + -h, --help help for upgrade -i, --install if a release by this name doesn't already exist, run an install --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring that contains public signing keys (default "~/.gnupg/pubring.gpg") @@ -85,6 +85,7 @@ helm upgrade [RELEASE] [CHART] ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_verify.md b/docs/helm/helm_verify.md index 866b3fbd8..30ed43679 100644 --- a/docs/helm/helm_verify.md +++ b/docs/helm/helm_verify.md @@ -5,7 +5,6 @@ verify that a chart at the given path has been signed and is valid ### Synopsis - Verify that the given chart has a valid provenance file. Provenance files provide crytographic verification that a chart has not been @@ -23,6 +22,7 @@ helm verify [flags] PATH ### Options ``` + -h, --help help for verify --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") ``` @@ -39,6 +39,7 @@ helm verify [flags] PATH ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Jun-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index 3db529120..33d33cf12 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -5,7 +5,6 @@ print the client/server version information ### Synopsis - Show the client and server versions for Helm and tiller. This will print a representation of the client and server versions of Helm and @@ -24,13 +23,14 @@ use '--server'. ``` -helm version +helm version [flags] ``` ### Options ``` -c, --client client version only + -h, --help help for version -s, --server server version only --short print the version number --template string template for version string format @@ -55,6 +55,7 @@ helm version ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 7-Aug-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 From bc017e8f3ec57de75135f8cad6a9e6404c31d868 Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Fri, 10 Aug 2018 11:57:57 +0100 Subject: [PATCH 323/449] Add link to doc for Helm Stop plugin Link added to https://github.com/helm/helm/blob/master/docs/related.md#helm-plugins --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index bac9e899b..ca5fbf117 100644 --- a/docs/related.md +++ b/docs/related.md @@ -45,6 +45,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp - [helm-hashtag](https://github.com/balboah/helm-hashtag) - Plugin for tracking docker tag hash digests as values - [helm-unittest](https://github.com/lrills/helm-unittest) - Plugin for unit testing chart locally with YAML +- [helm-stop](https://github.com/IBM/helm-stop) - Plugin for stopping a release pods We also encourage GitHub authors to use the [helm-plugin](https://github.com/search?q=topic%3Ahelm-plugin&type=Repositories) tag on their plugin repositories. From 3f674a7411f66c3c8fb7a45b0650b94f83219446 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Fri, 10 Aug 2018 15:26:53 -0600 Subject: [PATCH 324/449] docs(alpine): quote release label value (#4460) Labels should be quoted so that values such as "true" or "1" are not interpolated to the wrong type. --- docs/examples/alpine/templates/alpine-pod.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/alpine/templates/alpine-pod.yaml b/docs/examples/alpine/templates/alpine-pod.yaml index beafd7668..e6b2fe5e8 100644 --- a/docs/examples/alpine/templates/alpine-pod.yaml +++ b/docs/examples/alpine/templates/alpine-pod.yaml @@ -9,7 +9,7 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} # The "app.kubernetes.io/instance" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - app.kubernetes.io/instance: {{ .Release.Name }} + release: {{ .Release.Name | quote }} # This makes it easy to audit chart usage. helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} app.kubernetes.io/name: {{ template "alpine.name" . }} From eba4ad04fb23e6dcee684005567b011f6c72afa8 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 13 Aug 2018 09:26:40 -0700 Subject: [PATCH 325/449] sort links alphabetically --- docs/related.md | 75 +++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/docs/related.md b/docs/related.md index ca5fbf117..ecd86f7e2 100644 --- a/docs/related.md +++ b/docs/related.md @@ -6,46 +6,47 @@ add to this list, please open an [issue](https://github.com/kubernetes/helm/issu or [pull request](https://github.com/kubernetes/helm/pulls). ## Article, Blogs, How-Tos, and Extra Documentation -- [Using Helm to Deploy to Kubernetes](https://daemonza.github.io/2017/02/20/using-helm-to-deploy-to-kubernetes/) -- [Honestbee's Helm Chart Conventions](https://gist.github.com/so0k/f927a4b60003cedd101a0911757c605a) + +- [Awesome Helm](https://github.com/cdwv/awesome-helm) - List of awesome Helm resources +- [CI/CD with Kubernetes, Helm & Wercker ](http://www.slideshare.net/Diacode/cicd-with-kubernetes-helm-wercker-madscalability) +- [Creating a Helm Plugin in 3 Steps](http://technosophos.com/2017/03/21/creating-a-helm-plugin.html) - [Deploying Kubernetes Applications with Helm](http://cloudacademy.com/blog/deploying-kubernetes-applications-with-helm/) +- [GitLab, Consumer Driven Contracts, Helm and Kubernetes](https://medium.com/@enxebre/gitlab-consumer-driven-contracts-helm-and-kubernetes-b7235a60a1cb#.xwp1y4tgi) +- [Honestbee's Helm Chart Conventions](https://gist.github.com/so0k/f927a4b60003cedd101a0911757c605a) - [Releasing backward-incompatible changes: Kubernetes, Jenkins, Prometheus Operator, Helm and Traefik](https://medium.com/@enxebre/releasing-backward-incompatible-changes-kubernetes-jenkins-plugin-prometheus-operator-helm-self-6263ca61a1b1#.e0c7elxhq) -- [CI/CD with Kubernetes, Helm & Wercker ](http://www.slideshare.net/Diacode/cicd-with-kubernetes-helm-wercker-madscalability) -- [The missing CI/CD Kubernetes component: Helm package manager](https://hackernoon.com/the-missing-ci-cd-kubernetes-component-helm-package-manager-1fe002aac680#.691sk2zhu) +- [The Missing CI/CD Kubernetes Component: Helm package manager](https://hackernoon.com/the-missing-ci-cd-kubernetes-component-helm-package-manager-1fe002aac680#.691sk2zhu) - [The Workflow "Umbrella" Helm Chart](https://deis.com/blog/2017/workflow-chart-assembly) -- [GitLab, Consumer Driven Contracts, Helm and Kubernetes](https://medium.com/@enxebre/gitlab-consumer-driven-contracts-helm-and-kubernetes-b7235a60a1cb#.xwp1y4tgi) +- [Using Helm to Deploy to Kubernetes](https://daemonza.github.io/2017/02/20/using-helm-to-deploy-to-kubernetes/) - [Writing a Helm Chart](https://www.influxdata.com/packaged-kubernetes-deployments-writing-helm-chart/) -- [Creating a Helm Plugin in 3 Steps](http://technosophos.com/2017/03/21/creating-a-helm-plugin.html) -- [Awesome Helm](https://github.com/cdwv/awesome-helm) - List of awesome Helm resources ## Video, Audio, and Podcast - [CI/CD with Jenkins, Kubernetes, and Helm](https://www.youtube.com/watch?v=NVoln4HdZOY): AKA "The Infamous Croc Hunter Video". -- [KubeCon2016: Delivering Kubernetes-Native Applications by Michelle Noorali](https://www.youtube.com/watch?v=zBc1goRfk3k&index=49&list=PLj6h78yzYM2PqgIGU1Qmi8nY7dqn9PCr4) - [Helm with Michelle Noorali and Matthew Butcher](https://gcppodcast.com/post/episode-50-helm-with-michelle-noorali-and-matthew-butcher/): The official Google CloudPlatform Podcast interviews Michelle and Matt about Helm. +- [KubeCon2016: Delivering Kubernetes-Native Applications by Michelle Noorali](https://www.youtube.com/watch?v=zBc1goRfk3k&index=49&list=PLj6h78yzYM2PqgIGU1Qmi8nY7dqn9PCr4) ## Helm Plugins -- [helm-tiller](https://github.com/adamreese/helm-tiller) - Additional commands to work with Tiller -- [Technosophos's Helm Plugins](https://github.com/technosophos/helm-plugins) - Plugins for GitHub, Keybase, and GPG -- [helm-template](https://github.com/technosophos/helm-template) - Debug/render templates client-side -- [Helm Value Store](https://github.com/skuid/helm-value-store) - Plugin for working with Helm deployment values -- [Helm Diff](https://github.com/databus23/helm-diff) - Preview `helm upgrade` as a coloured diff -- [helm-env](https://github.com/adamreese/helm-env) - Plugin to show current environment -- [helm-last](https://github.com/adamreese/helm-last) - Plugin to show the latest release -- [helm-nuke](https://github.com/adamreese/helm-nuke) - Plugin to destroy all releases -- [helm-local](https://github.com/adamreese/helm-local) - Plugin to run Tiller as a local daemon - [App Registry](https://github.com/app-registry/helm-plugin) - Plugin to manage charts via the [App Registry specification](https://github.com/app-registry/spec) -- [helm-secrets](https://github.com/futuresimple/helm-secrets) - Plugin to manage and store secrets safely +- [Helm Diff](https://github.com/databus23/helm-diff) - Preview `helm upgrade` as a coloured diff +- [Helm Value Store](https://github.com/skuid/helm-value-store) - Plugin for working with Helm deployment values +- [Technosophos's Helm Plugins](https://github.com/technosophos/helm-plugins) - Plugins for GitHub, Keybase, and GPG +- [helm-cos](https://github.com/imroc/helm-cos) - Plugin to manage repositories on Tencent Cloud Object Storage - [helm-edit](https://github.com/mstrzele/helm-edit) - Plugin for editing release's values +- [helm-env](https://github.com/adamreese/helm-env) - Plugin to show current environment - [helm-gcs](https://github.com/nouney/helm-gcs) - Plugin to manage repositories on Google Cloud Storage -- [helm-cos](https://github.com/imroc/helm-cos) - Plugin to manage repositories on Tencent Cloud Object Storage - [helm-github](https://github.com/sagansystems/helm-github) - Plugin to install Helm Charts from Github repositories -- [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query -- [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp - [helm-hashtag](https://github.com/balboah/helm-hashtag) - Plugin for tracking docker tag hash digests as values -- [helm-unittest](https://github.com/lrills/helm-unittest) - Plugin for unit testing chart locally with YAML +- [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp +- [helm-last](https://github.com/adamreese/helm-last) - Plugin to show the latest release +- [helm-local](https://github.com/adamreese/helm-local) - Plugin to run Tiller as a local daemon +- [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query +- [helm-nuke](https://github.com/adamreese/helm-nuke) - Plugin to destroy all releases +- [helm-secrets](https://github.com/futuresimple/helm-secrets) - Plugin to manage and store secrets safely - [helm-stop](https://github.com/IBM/helm-stop) - Plugin for stopping a release pods +- [helm-template](https://github.com/technosophos/helm-template) - Debug/render templates client-side +- [helm-tiller](https://github.com/adamreese/helm-tiller) - Additional commands to work with Tiller +- [helm-unittest](https://github.com/lrills/helm-unittest) - Plugin for unit testing chart locally with YAML We also encourage GitHub authors to use the [helm-plugin](https://github.com/search?q=topic%3Ahelm-plugin&type=Repositories) tag on their plugin repositories. @@ -55,33 +56,33 @@ tag on their plugin repositories. Tools layered on top of Helm or Tiller. - [AppsCode Swift](https://github.com/appscode/swift) - Ajax friendly Helm Tiller Proxy using [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway) -- [Quay App Registry](https://coreos.com/blog/quay-application-registry-for-kubernetes.html) - Open Kubernetes application registry, including a Helm access client -- [Chartify](https://github.com/appscode/chartify) - Generate Helm charts from existing Kubernetes resources. -- [VIM-Kubernetes](https://github.com/andrewstuart/vim-kubernetes) - VIM plugin for Kubernetes and Helm -- [Landscaper](https://github.com/Eneco/landscaper/) - "Landscaper takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster." -- [Rudder](https://github.com/AcalephStorage/rudder) - RESTful (JSON) proxy for Tiller's API -- [Helmfile](https://github.com/roboll/helmfile) - Helmfile is a declarative spec for deploying helm charts +- [Armada](https://github.com/att-comdev/armada) - Manage prefixed releases throughout various Kubernetes namespaces, and removes completed jobs for complex deployments. Used by the [Openstack-Helm](https://github.com/openstack/openstack-helm) team. - [Autohelm](https://github.com/reactiveops/autohelm) - Autohelm is _another_ simple declarative spec for deploying helm charts. Written in python and supports git urls as a source for helm charts. -- [Helmsman](https://github.com/Praqma/helmsman) - Helmsman is a helm-charts-as-code tool which enables installing/upgrading/protecting/moving/deleting releases from version controlled desired state files (described in a simple TOML format). -- [Schelm](https://github.com/databus23/schelm) - Render a Helm manifest to a directory -- [Drone.io Helm Plugin](http://plugins.drone.io/ipedrazas/drone-helm/) - Run Helm inside of the Drone CI/CD system +- [ChartMuseum](https://github.com/chartmuseum/chartmuseum) - Helm Chart Repository with support for Amazon S3 and Google Cloud Storage +- [Chartify](https://github.com/appscode/chartify) - Generate Helm charts from existing Kubernetes resources. +- [Codefresh](https://codefresh.io) - Kubernetes native CI/CD and management platform with UI dashboards for managing Helm charts and releases - [Cog](https://github.com/ohaiwalt/cog-helm) - Helm chart to deploy Cog on Kubernetes -- [Monocular](https://github.com/helm/monocular) - Web UI for Helm Chart repositories +- [Drone.io Helm Plugin](http://plugins.drone.io/ipedrazas/drone-helm/) - Run Helm inside of the Drone CI/CD system - [Helm Chart Publisher](https://github.com/luizbafilho/helm-chart-publisher) - HTTP API for publishing Helm Charts in an easy way -- [Armada](https://github.com/att-comdev/armada) - Manage prefixed releases throughout various Kubernetes namespaces, and removes completed jobs for complex deployments. Used by the [Openstack-Helm](https://github.com/openstack/openstack-helm) team. -- [ChartMuseum](https://github.com/chartmuseum/chartmuseum) - Helm Chart Repository with support for Amazon S3 and Google Cloud Storage - [Helm.NET](https://github.com/qmfrederik/helm) - A .NET client for Tiller's API -- [Codefresh](https://codefresh.io) - Kubernetes native CI/CD and management platform with UI dashboards for managing Helm charts and releases +- [Helmfile](https://github.com/roboll/helmfile) - Helmfile is a declarative spec for deploying helm charts +- [Helmsman](https://github.com/Praqma/helmsman) - Helmsman is a helm-charts-as-code tool which enables installing/upgrading/protecting/moving/deleting releases from version controlled desired state files (described in a simple TOML format). +- [Landscaper](https://github.com/Eneco/landscaper/) - "Landscaper takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster." +- [Monocular](https://github.com/helm/monocular) - Web UI for Helm Chart repositories +- [Quay App Registry](https://coreos.com/blog/quay-application-registry-for-kubernetes.html) - Open Kubernetes application registry, including a Helm access client +- [Rudder](https://github.com/AcalephStorage/rudder) - RESTful (JSON) proxy for Tiller's API +- [Schelm](https://github.com/databus23/schelm) - Render a Helm manifest to a directory +- [VIM-Kubernetes](https://github.com/andrewstuart/vim-kubernetes) - VIM plugin for Kubernetes and Helm ## Helm Included Platforms, distributions, and services that include Helm support. -- [Kubernetic](https://kubernetic.com/) - Kubernetes Desktop Client - [Cabin](http://www.skippbox.com/cabin/) - Mobile App for Managing Kubernetes -- [Qstack](https://qstack.com) - [Fabric8](https://fabric8.io) - Integrated development platform for Kubernetes - [Jenkins X](http://jenkins-x.io/) - open source automated CI/CD for Kubernetes which uses Helm for [promoting](http://jenkins-x.io/about/features/#promotion) applications through [environments via GitOps](http://jenkins-x.io/about/features/#environments) +- [Kubernetic](https://kubernetic.com/) - Kubernetes Desktop Client +- [Qstack](https://qstack.com) ## Misc From 22e2443c5033b707d7b2761fc00c7ef7b9de40bc Mon Sep 17 00:00:00 2001 From: muffin87 Date: Tue, 14 Aug 2018 19:13:02 +0200 Subject: [PATCH 326/449] Add basic tutorial for beginners (#4466) --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index ecd86f7e2..09501a598 100644 --- a/docs/related.md +++ b/docs/related.md @@ -18,6 +18,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [The Workflow "Umbrella" Helm Chart](https://deis.com/blog/2017/workflow-chart-assembly) - [Using Helm to Deploy to Kubernetes](https://daemonza.github.io/2017/02/20/using-helm-to-deploy-to-kubernetes/) - [Writing a Helm Chart](https://www.influxdata.com/packaged-kubernetes-deployments-writing-helm-chart/) +- [A basic walk through Kubernetes Helm](https://github.com/muffin87/helm-tutorial) ## Video, Audio, and Podcast From 3be4bcb8e84937ea92b16084173a05302290400a Mon Sep 17 00:00:00 2001 From: rimas Date: Tue, 14 Aug 2018 10:33:25 -0700 Subject: [PATCH 327/449] add Tillerless Helm blog post and plugin references --- docs/related.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/related.md b/docs/related.md index 09501a598..082684d9c 100644 --- a/docs/related.md +++ b/docs/related.md @@ -19,6 +19,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [Using Helm to Deploy to Kubernetes](https://daemonza.github.io/2017/02/20/using-helm-to-deploy-to-kubernetes/) - [Writing a Helm Chart](https://www.influxdata.com/packaged-kubernetes-deployments-writing-helm-chart/) - [A basic walk through Kubernetes Helm](https://github.com/muffin87/helm-tutorial) +- [Tillerless Helm v2](https://rimusz.net/tillerless-helm/) ## Video, Audio, and Podcast @@ -48,6 +49,7 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [helm-template](https://github.com/technosophos/helm-template) - Debug/render templates client-side - [helm-tiller](https://github.com/adamreese/helm-tiller) - Additional commands to work with Tiller - [helm-unittest](https://github.com/lrills/helm-unittest) - Plugin for unit testing chart locally with YAML +- [Tillerless Helm v2](https://github.com/rimusz/helm-tiller) - Helm plugin for using Tiller locally and in CI/CD pipelines We also encourage GitHub authors to use the [helm-plugin](https://github.com/search?q=topic%3Ahelm-plugin&type=Repositories) tag on their plugin repositories. From bae3352fc615fc522d0fadb32b70626252caee1c Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Wed, 15 Aug 2018 15:03:18 -0600 Subject: [PATCH 328/449] fix(client): fix bug in list releases to append all releases --- pkg/helm/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index f9774392f..771c7f3d1 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -360,7 +360,7 @@ func (h *Client) list(ctx context.Context, req *rls.ListReleasesRequest) (*rls.L resp = r continue } - resp.Releases = append(resp.Releases, r.GetReleases()[0]) + resp.Releases = append(resp.Releases, r.GetReleases()...) } return resp, nil } From e3cbce273d51f65d3c5f317ab1a3332df02436eb Mon Sep 17 00:00:00 2001 From: Alexey Volkov Date: Thu, 16 Aug 2018 01:31:40 +0300 Subject: [PATCH 329/449] fix: link to custom resource definitions section --- docs/chart_best_practices/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_best_practices/README.md b/docs/chart_best_practices/README.md index 58cc65407..1160dc287 100644 --- a/docs/chart_best_practices/README.md +++ b/docs/chart_best_practices/README.md @@ -17,5 +17,5 @@ may find that their internal interests override our suggestions here. - Kubernetes Resources: - [Pods and Pod Specs](pods.md): See the best practices for working with pod specifications. - [Role-Based Access Control](rbac.md): Guidance on creating and using service accounts, roles, and role bindings. - - [Third Party Resources](third_party_resources.md): Third Party Resources (TPRs) have their own associated best practices. + - [Custom Resource Definitions](custom_resource_definitions.md): Custom Resource Definitions (CRDs) have their own associated best practices. From 869d3be002aeed1f8db666aa47010f516e6b3554 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Thu, 16 Aug 2018 13:28:08 -0400 Subject: [PATCH 330/449] docs(README): Updating for Helm in CNCF Signed-off-by: Matt Farina --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6a35c3f4d..018099e01 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# Kubernetes Helm +# Helm [![CircleCI](https://circleci.com/gh/helm/helm.svg?style=svg)](https://circleci.com/gh/helm/helm) [![Go Report Card](https://goreportcard.com/badge/github.com/helm/helm)](https://goreportcard.com/report/github.com/helm/helm) -[![GoDoc](https://godoc.org/github.com/kubernetes/helm?status.svg)](https://godoc.org/github.com/kubernetes/helm) +[![GoDoc](https://godoc.org/k8s.io/helm?status.svg)](https://godoc.org/k8s.io/helm) Helm is a tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources. Use Helm to: -- Find and use [popular software packaged as Kubernetes charts](https://github.com/helm/charts) -- Share your own applications as Kubernetes charts +- Find and use [popular software packaged as Helm charts](https://github.com/helm/charts) to run in Kubernetes +- Share your own applications as Helm charts - Create reproducible builds of your Kubernetes applications - Intelligently manage your Kubernetes manifest files - Manage releases of Helm packages @@ -63,11 +63,10 @@ You can reach the Helm community and developers via the following channels: - [#helm-users](https://kubernetes.slack.com/messages/helm-users) - [#helm-dev](https://kubernetes.slack.com/messages/helm-dev) - [#charts](https://kubernetes.slack.com/messages/charts) -- Mailing Lists: - - [Helm Mailing List](https://lists.cncf.io/g/cncf-kubernetes-helm) - - [Kubernetes SIG Apps Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-apps) -- Developer Call: Thursdays at 9:30-10:00 Pacific. [https://zoom.us/j/4526666954](https://zoom.us/j/4526666954) +- Mailing List: + - [Helm Mailing List](https://lists.cncf.io/g/cncf-helm) +- Developer Call: Thursdays at 9:30-10:00 Pacific. [https://zoom.us/j/696660622](https://zoom.us/j/696660622) ### Code of conduct -Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md). +Participation in the Helm community is governed by the [Code of Conduct](code-of-conduct.md). From 46571af6ce851495dd9815aade8710e70f129a70 Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Fri, 17 Aug 2018 13:23:19 +1000 Subject: [PATCH 331/449] Update zoom.us link --- README.md | 5 +++-- docs/release_checklist.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 018099e01..fcb9e1636 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,9 @@ You can reach the Helm community and developers via the following channels: - [#helm-users](https://kubernetes.slack.com/messages/helm-users) - [#helm-dev](https://kubernetes.slack.com/messages/helm-dev) - [#charts](https://kubernetes.slack.com/messages/charts) -- Mailing List: - - [Helm Mailing List](https://lists.cncf.io/g/cncf-helm) +- Mailing Lists: + - [Helm Mailing List](https://lists.cncf.io/g/cncf-kubernetes-helm) + - [Kubernetes SIG Apps Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-apps) - Developer Call: Thursdays at 9:30-10:00 Pacific. [https://zoom.us/j/696660622](https://zoom.us/j/696660622) ### Code of conduct diff --git a/docs/release_checklist.md b/docs/release_checklist.md index fcd3429ad..96d7e5625 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -223,7 +223,7 @@ The community keeps growing, and we'd love to see you there! - Join the discussion in [Kubernetes Slack](https://slack.k8s.io/): - `#helm-users` for questions and just to hang out - `#helm-dev` for discussing PRs, code, and bugs -- Hang out at the Public Developer Call: Thursday, 9:30 Pacific via [Zoom](https://zoom.us/j/4526666954) +- Hang out at the Public Developer Call: Thursday, 9:30 Pacific via [Zoom](https://zoom.us/j/696660622) - Test, debug, and contribute charts: [GitHub/kubernetes/charts](https://github.com/kubernetes/charts) ## Installation and Upgrading From ba82968e20da41e260fb8ff567fffd5f3bcdde33 Mon Sep 17 00:00:00 2001 From: Jon Huhn Date: Fri, 17 Aug 2018 09:34:59 -0500 Subject: [PATCH 332/449] Fix typo in parser.go --- pkg/strvals/parser.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 1fd9ab81e..532a8c4ac 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -94,7 +94,7 @@ func ParseIntoFile(s string, dest map[string]interface{}, runesToVal runesToVal) return t.parse() } -// ParseIntoString parses a strvals line nad merges the result into dest. +// ParseIntoString parses a strvals line and merges the result into dest. // // This method always returns a string as the value. func ParseIntoString(s string, dest map[string]interface{}) error { From fac185af2b7b54cfaa6e99400fa7fc2177046739 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 17 Aug 2018 13:09:24 -0700 Subject: [PATCH 333/449] strip out all extra lines other than the first for parsing --- scripts/get | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/get b/scripts/get index 79dd69500..29cd47e1a 100755 --- a/scripts/get +++ b/scripts/get @@ -78,9 +78,9 @@ checkDesiredVersion() { # Use the GitHub releases webpage for the project to find the desired version for this project. local release_url="https://github.com/helm/helm/releases/${DESIRED_VERSION:-latest}" if type "curl" > /dev/null; then - TAG=$(curl -SsL $release_url | awk '/\/tag\//' | grep -v no-underline | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') + TAG=$(curl -SsL $release_url | awk '/\/tag\//' | grep -v no-underline | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') elif type "wget" > /dev/null; then - TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | grep -v no-underline | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') + TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | grep -v no-underline | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') fi if [ "x$TAG" == "x" ]; then echo "Cannot determine ${DESIRED_VERSION} tag." From 64aae7b73f4429aba18ceb861ab7db3e5ff8b638 Mon Sep 17 00:00:00 2001 From: Dustin Specker Date: Fri, 24 Aug 2018 06:58:20 -0500 Subject: [PATCH 334/449] docs: remove extraneous "it" --- docs/chart_template_guide/subcharts_and_globals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/subcharts_and_globals.md b/docs/chart_template_guide/subcharts_and_globals.md index 33274effe..a288556d8 100644 --- a/docs/chart_template_guide/subcharts_and_globals.md +++ b/docs/chart_template_guide/subcharts_and_globals.md @@ -201,7 +201,7 @@ will only accept a string literal. The Go template language provides a `block` keyword that allows developers to provide a default implementation which is overridden later. In Helm charts, blocks are not -the best tool for overriding because it if multiple implementations of the same block +the best tool for overriding because if multiple implementations of the same block are provided, the one selected is unpredictable. The suggestion is to instead use `include`. From a741868dd0b1afe4ed731c61edeec759db6de84c Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Fri, 24 Aug 2018 16:17:41 +0100 Subject: [PATCH 335/449] Fix helm create note for k8 label convention changes Update to note as per changes in Issue #4335 . Otherwise cannot retrieve the pod with the label names. --- pkg/chartutil/create.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index ef70efed9..cff3b89eb 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -250,7 +250,7 @@ const defaultNotes = `1. Get the application URL by running these commands: export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include ".fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include ".name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include ".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 port-forward $POD_NAME 8080:80 {{- end }} From 16243cd83f387dcc7260c58e25719a6066026c93 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Thu, 23 Aug 2018 16:54:44 -0400 Subject: [PATCH 336/449] Moving from CLA to DCO in contribution guide Signed-off-by: Matt Farina --- CONTRIBUTING.md | 78 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 81ed009d4..715bf7490 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,21 +10,75 @@ you are reporting a _security vulnerability_, please email a report to [cncf-kubernetes-helm-security@lists.cncf.io](mailto:cncf-kubernetes-helm-security@lists.cncf.io). This will give us a chance to try to fix the issue before it is exploited in the wild. -## Contributor License Agreements +## Sign Your Work -We'd love to accept your patches! Before we can take them, we have to jump a -couple of legal hurdles. +The sign-off is a simple line at the end of the explanation for a commit. All +commits needs to be signed. Your signature certifies that you wrote the patch or +otherwise have the right to contribute the material. The rules are pretty simple, +if you can certify the below (from [developercertificate.org](http://developercertificate.org/)): -The Cloud Native Computing Foundation (CNCF) CLA [must be signed](https://github.com/kubernetes/community/blob/master/CLA.md) by all contributors. -Please fill out either the individual or corporate Contributor License -Agreement (CLA). +``` +Developer Certificate of Origin +Version 1.1 -Once you are CLA'ed, we'll be able to accept your pull requests. For any issues that you face during this process, -please add a comment [here](https://github.com/kubernetes/kubernetes/issues/27796) explaining the issue and we will help get it sorted out. +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +1 Letterman Drive +Suite D4700 +San Francisco, CA, 94129 -***NOTE***: Only original source code from you and other people that have -signed the CLA can be accepted into the repository. This policy does not -apply to [third_party](third_party/) and [vendor](vendor/). +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. + +Note: If your git config information is set properly then viewing the + `git log` information for your commit will look something like this: + +``` +Author: Joe Smith +Date: Thu Feb 2 11:41:15 2018 -0800 + + Update README + + Signed-off-by: Joe Smith +``` + +Notice the `Author` and `Signed-off-by` lines match. If they don't +your PR will be rejected by the automated DCO check. ## Support Channels @@ -215,8 +269,6 @@ The following tables define all label types used for Helm. It is split up by cat | ----- | ----------- | | `awaiting review` | The PR has been triaged and is ready for someone to review | | `breaking` | The PR has breaking changes (such as API changes) | -| `cncf-cla: no` | The PR submitter has **not** signed the project CLA. | -| `cncf-cla: yes` | The PR submitter has signed the project CLA. This is required to merge. | | `in progress` | Indicates that a maintainer is looking at the PR, even if no review has been posted yet | | `needs pick` | Indicates that the PR needs to be picked into a feature branch (generally bugfix branches). Once it has been, the `picked` label should be applied and this one removed | | `needs rebase` | A helper label used to indicate that the PR needs to be rebased before it can be merged. Used for easy filtering | From b67d1b6f77059ae4c973380e65f1e0becbd6ea95 Mon Sep 17 00:00:00 2001 From: Tim Hobbs Date: Fri, 24 Aug 2018 18:03:23 +0200 Subject: [PATCH 337/449] Messages are encrypted when using TLS When helm client and tiller use TLS their messages are encrypted, not unencrypted ;) --- docs/securing_installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index a489cc837..454e0cc12 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -57,7 +57,7 @@ Shared and production clusters -- for the most part -- should use Helm 2.7.2 at For more information about the proper steps to configure Tiller and use Helm properly with TLS configured, see [Using SSL between Helm and Tiller](tiller_ssl.md). -When Helm clients are connecting from outside of the cluster, the security between the Helm client and the API server is managed by Kubernetes itself. You may want to ensure that this link is secure. Note that if you are using the TLS configuration recommended above, not even the Kubernetes API server has access to the unencrypted messages between the client and Tiller. +When Helm clients are connecting from outside of the cluster, the security between the Helm client and the API server is managed by Kubernetes itself. You may want to ensure that this link is secure. Note that if you are using the TLS configuration recommended above, not even the Kubernetes API server has access to the encrypted messages between the client and Tiller. ### Tiller's Release Information From e6e3755ebe49afb3494a9eb4605c7aa321e95d1d Mon Sep 17 00:00:00 2001 From: Jon Huhn Date: Fri, 24 Aug 2018 13:38:36 -0500 Subject: [PATCH 338/449] Fix typo in message.go --- pkg/lint/support/message.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/lint/support/message.go b/pkg/lint/support/message.go index 4dd485c98..5efbc7a61 100644 --- a/pkg/lint/support/message.go +++ b/pkg/lint/support/message.go @@ -18,7 +18,7 @@ package support import "fmt" -// Severity indicatest the severity of a Message. +// Severity indicates the severity of a Message. const ( // UnknownSev indicates that the severity of the error is unknown, and should not stop processing. UnknownSev = iota From b5674da694167daf26b1d2a17fafc1bcac94c69b Mon Sep 17 00:00:00 2001 From: smurfralf Date: Fri, 17 Aug 2018 17:45:36 -0400 Subject: [PATCH 339/449] Improve documentation for helm upgrade (#4030) Expand and clarify documentation for `helm upgrade` to include nuances of command line values setting. Fixes issue #4030 --- cmd/helm/upgrade.go | 61 ++++++++++++----- docs/helm/helm_upgrade.md | 63 +++++++++++++----- docs/man/man1/helm_upgrade.1 | 126 +++++++++++++++++++++++++++-------- 3 files changed, 189 insertions(+), 61 deletions(-) diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 4f91e61b1..1ed6ca962 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -30,30 +30,57 @@ import ( ) const upgradeDesc = ` -This command upgrades a release to a new version of a chart. +This command upgrades a release to a specified version of a chart and/or updates chart values. -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, -a packaged chart, or a fully qualified URL. For chart references, the latest -version will be specified unless the '--version' flag is set. +Required arguments are release and chart. The chart argument can be one of: + - a chart reference('stable/mariadb'); use '--version' and '--devel' flags for versions other than latest, + - a path to a chart directory, + - a packaged chart, + - a fully qualified URL. -To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line. To force string -values in '--set', use '--set-string' instead. In case a value is large and therefore -you want not to use neither '--values' nor '--set', use '--set-file' to read the -single large value from file. +To customize the chart values use any of + - '--values'/'-f' to pass in a yaml file holding settings, + - '--set' to provide one or more key=val pairs directly, + - '--set-string' to provide key=val forcing val to be stored as a string, + - '--set-file' to provide key=path to read a single large value from a file at path. -You can specify the '--values'/'-f' flag multiple times. The priority will be given to the -last (right-most) file specified. For example, if both myvalues.yaml and override.yaml -contained a key called 'Test', the value set in override.yaml would take precedence: +To edit or append to the existing customized values add the + '--reuse-values' flag, otherwise any existing customized values are ignored. + +If no chart value arguments are provided on the command line, any existing customized values are carried +forward. To revert to use only values provided in the chart, use the '--reset-values' flag. + +You can specify any of the chart value flags multiple times. The priority will be given to the last +(right-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key +called 'Test', the value set in override.yaml would take precedence: $ helm upgrade -f myvalues.yaml -f override.yaml redis ./redis -You can specify the '--set' flag multiple times. The priority will be given to the -last (right-most) set specified. For example, if both 'bar' and 'newbar' values are -set for a key called 'foo', the 'newbar' value would take precedence: +Note that the key name provided to the '--set', '--set-string' and '--set-file' flags can reference +structure elements. Examples: + - mybool=TRUE + - livenessProbe.timeoutSeconds=10 + - metrics.annotations[0]=hey,metrics.annotations[1]=ho + +which sets the top level key mybool to true, the nested timeoutSeconds to 10 and two array values respectively. + +Note that the value side of the key=val provided to '--set' and '--set-string' flags will pass through +shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with +special characters in unexpected ways, for example + + $ helm upgrade --set pwd=3jk$o2,z=f\30.e redis ./redis + +results in "pwd: 3jk" and "z: f30.e". Use single quotes to avoid shell evaluation and argument delimiters, +and use backslash to escape yaml special characters: + + $ helm upgrade --set pwd='3jk$o2z=f\\30.e' redis ./redis + +which results in the expected "pwd: 3jk$o2z=f\30.e". If a single quote occurs in your value then follow +your shell convention for escaping it; for example in bash: + + $ helm upgrade --set pwd='3jk$o2z=f\\30with'\''quote' - $ helm upgrade --set foo=bar --set foo=newbar redis ./redis +which results in "pwd: 3jk$o2z=f\30with'quote". ` type upgradeCmd struct { diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 522464c6b..6dcb25387 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -5,30 +5,57 @@ upgrade a release ### Synopsis -This command upgrades a release to a new version of a chart. +This command upgrades a release to a specified version of a chart and/or updates chart values. -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, -a packaged chart, or a fully qualified URL. For chart references, the latest -version will be specified unless the '--version' flag is set. +Required arguments are release and chart. The chart argument can be one of: + - a chart reference('stable/mariadb'); use '--version' and '--devel' flags for versions other than latest, + - a path to a chart directory, + - a packaged chart, + - a fully qualified URL. -To override values in a chart, use either the '--values' flag and pass in a file -or use the '--set' flag and pass configuration from the command line. To force string -values in '--set', use '--set-string' instead. In case a value is large and therefore -you want not to use neither '--values' nor '--set', use '--set-file' to read the -single large value from file. +To customize the chart values use any of + - '--values'/'-f' to pass in a yaml file holding settings, + - '--set' to provide one or more key=val pairs directly, + - '--set-string' to provide key=val forcing val to be stored as a string, + - '--set-file' to provide key=path to read a single large value from a file at path. -You can specify the '--values'/'-f' flag multiple times. The priority will be given to the -last (right-most) file specified. For example, if both myvalues.yaml and override.yaml -contained a key called 'Test', the value set in override.yaml would take precedence: +To edit or append to the existing customized values add the + '--reuse-values' flag, otherwise any existing customized values are ignored. + +If no chart value arguments are provided on the command line, any existing customized values are carried +forward. To revert to use only values provided in the chart, use the '--reset-values' flag. + +You can specify any of the chart value flags multiple times. The priority will be given to the last +(right-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key +called 'Test', the value set in override.yaml would take precedence: $ helm upgrade -f myvalues.yaml -f override.yaml redis ./redis -You can specify the '--set' flag multiple times. The priority will be given to the -last (right-most) set specified. For example, if both 'bar' and 'newbar' values are -set for a key called 'foo', the 'newbar' value would take precedence: +Note that the key name provided to the '--set', '--set-string' and '--set-file' flags can reference +structure elements. Examples: + - mybool=TRUE + - livenessProbe.timeoutSeconds=10 + - metrics.annotations[0]=hey,metrics.annotations[1]=ho + +which sets the top level key mybool to true, the nested timeoutSeconds to 10 and two array values respectively. + +Note that the value side of the key=val provided to '--set' and '--set-string' flags will pass through +shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with +special characters in unexpected ways, for example + + $ helm upgrade --set pwd=3jk$o2,z=f\30.e redis ./redis + +results in "pwd: 3jk" and "z: f30.e". Use single quotes to avoid shell evaluation and argument delimiters, +and use backslash to escape yaml special characters: + + $ helm upgrade --set pwd='3jk$o2z=f\\30.e' redis ./redis + +which results in the expected "pwd: 3jk$o2z=f\30.e". If a single quote occurs in your value then follow +your shell convention for escaping it; for example in bash: + + $ helm upgrade --set pwd='3jk$o2z=f\\30with'\''quote' - $ helm upgrade --set foo=bar --set foo=newbar redis ./redis +which results in "pwd: 3jk$o2z=f\30with'quote". ``` @@ -88,4 +115,4 @@ helm upgrade [RELEASE] [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 10-Aug-2018 +###### Auto generated by spf13/cobra on 17-Aug-2018 diff --git a/docs/man/man1/helm_upgrade.1 b/docs/man/man1/helm_upgrade.1 index 24bba7c85..202f3d8c1 100644 --- a/docs/man/man1/helm_upgrade.1 +++ b/docs/man/man1/helm_upgrade.1 @@ -1,6 +1,4 @@ -.TH "HELM" "1" "May 2017" "Auto generated by spf13/cobra" "" -.nh -.ad l +.TH "HELM" "1" "Aug 2018" "Auto generated by spf13/cobra" "" "" .SH NAME @@ -15,22 +13,32 @@ helm\-upgrade \- upgrade a release .SH DESCRIPTION .PP -This command upgrades a release to a new version of a chart. +This command upgrades a release to a specified version of a chart +and/or updates chart values. .PP -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, -a packaged chart, or a fully qualified URL. For chart references, the latest -version will be specified unless the '\-\-version' flag is set. +Required arguments are release and chart. The chart argument can be one of: + \- a chart reference('stable/mariadb'); use '\-\-version' and '\-\-devel' flags for versions other than latest, + \- a path to a chart directory, + \- a packaged chart, + \- a fully qualified URL. .PP -To override values in a chart, use either the '\-\-values' flag and pass in a file -or use the '\-\-set' flag and pass configuration from the command line. +To customize the chart values use any of + \- '\-\-values'/'\-f' to pass in a yaml file holding settings, + \- '\-\-set' to provide one or more key=val pairs directly, + \- '\-\-set\-string' to provide key=val forcing val to be stored as a string, + \- '\-\-set\-file' to provide key=path to read a single large value from a file at path. .PP -You can specify the '\-\-values'/'\-f' flag multiple times. The priority will be given to the -last (right\-most) file specified. For example, if both myvalues.yaml and override.yaml -contained a key called 'Test', the value set in override.yaml would take precedence: +To edit or append to the existing customized values add the + '\-\-reuse\-values' flag, otherwise any existing customized values are ignored. + +.PP +If no chart value arguments are provided on the command line, any existing customized values are carried forward. To revert to use only values provided in the chart, use the '\-\-reset\-values' flag. + +.PP +You can specify any of the chart value flags multiple times. The priority will be given to the last (right\-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key called 'Test', the value set in override.yaml would take precedence: .PP .RS @@ -42,19 +50,53 @@ $ helm upgrade \-f myvalues.yaml \-f override.yaml redis ./redis .RE .PP -You can specify the '\-\-set' flag multiple times. The priority will be given to the -last (right\-most) set specified. For example, if both 'bar' and 'newbar' values are -set for a key called 'foo', the 'newbar' value would take precedence: +Note that the key name provided to the '\-\-set', '\-\-set\-string' and '\-\-set\-file' flags can reference structure elements. Examples: + \- mybool=TRUE + \- livenessProbe.timeoutSeconds=10 + \- metrics.annotations[0]=hey,metrics.annotations[1]=ho + +.PP +which sets the top level key mybool to true, the nested timeoutSeconds to 10 and two array values respectively. + +.PP +Note that the value side of the key=val provided to '\-\-set' and '\-\-set\-string' flags will pass through shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with special characters in unexpected ways, for example + +.PP +.RS + +.nf +$ helm upgrade \-\-set pwd=3jk$o2,z=f\\30.e redis ./redis + +.fi +.RE + +.PP +results in "pwd: 3jk" and "z: f30.e". Use single quotes to avoid shell evaulation and argument delimiters, and use backslash to escape yaml special characters: + +.PP +.RS + +.nf +$ helm upgrade \-\-set pwd='3jk$o2z=f\\\\30.e' redis ./redis + +.fi +.RE + +.PP +which results in the expected "pwd: 3jk$o2z=f\\30.e". If a single quote occurs in your value then follow your shell convention for escaping it; for example in bash: .PP .RS .nf -$ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis +$ helm upgrade \-\-set pwd='3jk$o2z=f\\\\30with'\\''quote' .fi .RE +.PP +which results in "pwd: 3jk$o2z=f\\30with'quote". + .SH OPTIONS .PP @@ -65,9 +107,13 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis \fB\-\-cert\-file\fP="" identify HTTPS client using this SSL certificate file +.PP +\fB\-\-description\fP="" + specify the description to use for the upgrade, rather than the default + .PP \fB\-\-devel\fP[=false] - use development versions, too. Equivalent to version '>0.0.0\-a'. If \-\-version is set, this is ignored. + use development versions, too. Equivalent to version '>0.0.0\-0'. If \-\-version is set, this is ignored. .PP \fB\-\-dry\-run\fP[=false] @@ -90,13 +136,17 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis path to the keyring that contains public signing keys .PP -\fB\-\-namespace\fP="default" - namespace to install the release into (only used if \-\-install is set) +\fB\-\-namespace\fP="" + namespace to install the release into (only used if \-\-install is set). Defaults to the current kube config namespace .PP \fB\-\-no\-hooks\fP[=false] disable pre/post upgrade hooks +.PP +\fB\-\-password\fP="" + chart repository password where to locate the requested chart + .PP \fB\-\-recreate\-pods\fP[=false] performs pods restart for the resource if applicable @@ -111,15 +161,23 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis .PP \fB\-\-reuse\-values\fP[=false] - when upgrading, reuse the last release's values, and merge in any new values. If '\-\-reset\-values' is specified, this is ignored. + when upgrading, reuse the last release's values and merge in any overrides from the command line via \-\-set and \-f. If '\-\-reset\-values' is specified, this is ignored. .PP \fB\-\-set\fP=[] set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) +.PP +\fB\-\-set\-file\fP=[] + set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) + +.PP +\fB\-\-set\-string\fP=[] + set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + .PP \fB\-\-timeout\fP=300 - time in seconds to wait for any individual kubernetes operation (like Jobs for hooks) + time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) .PP \fB\-\-tls\fP[=false] @@ -133,6 +191,10 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis \fB\-\-tls\-cert\fP="$HELM\_HOME/cert.pem" path to TLS certificate file +.PP +\fB\-\-tls\-hostname\fP="" + the server name used to verify the hostname on the returned certificates from the server + .PP \fB\-\-tls\-key\fP="$HELM\_HOME/key.pem" path to TLS key file @@ -141,6 +203,10 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis \fB\-\-tls\-verify\fP[=false] enable TLS for request and verify remote +.PP +\fB\-\-username\fP="" + chart repository username where to locate the requested chart + .PP \fB\-f\fP, \fB\-\-values\fP=[] specify values in a YAML file or a URL(can specify multiple) @@ -168,16 +234,24 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis location of your Helm config. Overrides $HELM\_HOME .PP -\fB\-\-host\fP="localhost:44134" - address of tiller. Overrides $HELM\_HOST +\fB\-\-host\fP="" + address of Tiller. Overrides $HELM\_HOST .PP \fB\-\-kube\-context\fP="" name of the kubeconfig context to use +.PP +\fB\-\-kubeconfig\fP="" + absolute path to the kubeconfig file to use + +.PP +\fB\-\-tiller\-connection\-timeout\fP=300 + the duration (in seconds) Helm will wait to establish a connection to tiller + .PP \fB\-\-tiller\-namespace\fP="kube\-system" - namespace of tiller + namespace of Tiller .SH SEE ALSO @@ -187,4 +261,4 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis .SH HISTORY .PP -19\-May\-2017 Auto generated by spf13/cobra +17\-Aug\-2018 Auto generated by spf13/cobra From 31d7162dfe237ae925025f01990c933c6ac9ee15 Mon Sep 17 00:00:00 2001 From: smurfralf Date: Fri, 24 Aug 2018 14:40:30 -0400 Subject: [PATCH 340/449] Tweeks per bacon review --- cmd/helm/upgrade.go | 8 +++---- docs/helm/helm_upgrade.md | 10 ++++----- docs/man/man1/helm_upgrade.1 | 41 +++++++++++++++++++++++------------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 1ed6ca962..a602a7000 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -38,17 +38,17 @@ Required arguments are release and chart. The chart argument can be one of: - a packaged chart, - a fully qualified URL. -To customize the chart values use any of +To customize the chart values, use any of - '--values'/'-f' to pass in a yaml file holding settings, - '--set' to provide one or more key=val pairs directly, - '--set-string' to provide key=val forcing val to be stored as a string, - '--set-file' to provide key=path to read a single large value from a file at path. -To edit or append to the existing customized values add the +To edit or append to the existing customized values, add the '--reuse-values' flag, otherwise any existing customized values are ignored. If no chart value arguments are provided on the command line, any existing customized values are carried -forward. To revert to use only values provided in the chart, use the '--reset-values' flag. +forward. If you want to revert to just the values provided in the chart, use the '--reset-values' flag. You can specify any of the chart value flags multiple times. The priority will be given to the last (right-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key @@ -62,7 +62,7 @@ structure elements. Examples: - livenessProbe.timeoutSeconds=10 - metrics.annotations[0]=hey,metrics.annotations[1]=ho -which sets the top level key mybool to true, the nested timeoutSeconds to 10 and two array values respectively. +which sets the top level key mybool to true, the nested timeoutSeconds to 10, and two array values, respectively. Note that the value side of the key=val provided to '--set' and '--set-string' flags will pass through shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 6dcb25387..f18bcf6a7 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -13,17 +13,17 @@ Required arguments are release and chart. The chart argument can be one of: - a packaged chart, - a fully qualified URL. -To customize the chart values use any of +To customize the chart values, use any of - '--values'/'-f' to pass in a yaml file holding settings, - '--set' to provide one or more key=val pairs directly, - '--set-string' to provide key=val forcing val to be stored as a string, - '--set-file' to provide key=path to read a single large value from a file at path. -To edit or append to the existing customized values add the +To edit or append to the existing customized values, add the '--reuse-values' flag, otherwise any existing customized values are ignored. If no chart value arguments are provided on the command line, any existing customized values are carried -forward. To revert to use only values provided in the chart, use the '--reset-values' flag. +forward. If you want to revert to just the values provided in the chart, use the '--reset-values' flag. You can specify any of the chart value flags multiple times. The priority will be given to the last (right-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key @@ -37,7 +37,7 @@ structure elements. Examples: - livenessProbe.timeoutSeconds=10 - metrics.annotations[0]=hey,metrics.annotations[1]=ho -which sets the top level key mybool to true, the nested timeoutSeconds to 10 and two array values respectively. +which sets the top level key mybool to true, the nested timeoutSeconds to 10, and two array values, respectively. Note that the value side of the key=val provided to '--set' and '--set-string' flags will pass through shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with @@ -115,4 +115,4 @@ helm upgrade [RELEASE] [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-Aug-2018 +###### Auto generated by spf13/cobra on 24-Aug-2018 diff --git a/docs/man/man1/helm_upgrade.1 b/docs/man/man1/helm_upgrade.1 index 202f3d8c1..602c3136f 100644 --- a/docs/man/man1/helm_upgrade.1 +++ b/docs/man/man1/helm_upgrade.1 @@ -8,13 +8,12 @@ helm\-upgrade \- upgrade a release .SH SYNOPSIS .PP -\fBhelm upgrade [RELEASE] [CHART]\fP +\fBhelm upgrade [RELEASE] [CHART] [flags]\fP .SH DESCRIPTION .PP -This command upgrades a release to a specified version of a chart -and/or updates chart values. +This command upgrades a release to a specified version of a chart and/or updates chart values. .PP Required arguments are release and chart. The chart argument can be one of: @@ -24,21 +23,24 @@ Required arguments are release and chart. The chart argument can be one of: \- a fully qualified URL. .PP -To customize the chart values use any of +To customize the chart values, use any of \- '\-\-values'/'\-f' to pass in a yaml file holding settings, \- '\-\-set' to provide one or more key=val pairs directly, \- '\-\-set\-string' to provide key=val forcing val to be stored as a string, \- '\-\-set\-file' to provide key=path to read a single large value from a file at path. .PP -To edit or append to the existing customized values add the +To edit or append to the existing customized values, add the '\-\-reuse\-values' flag, otherwise any existing customized values are ignored. .PP -If no chart value arguments are provided on the command line, any existing customized values are carried forward. To revert to use only values provided in the chart, use the '\-\-reset\-values' flag. +If no chart value arguments are provided on the command line, any existing customized values are carried +forward. If you want to revert to just the values provided in the chart, use the '\-\-reset\-values' flag. .PP -You can specify any of the chart value flags multiple times. The priority will be given to the last (right\-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key called 'Test', the value set in override.yaml would take precedence: +You can specify any of the chart value flags multiple times. The priority will be given to the last +(right\-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key +called 'Test', the value set in override.yaml would take precedence: .PP .RS @@ -50,16 +52,19 @@ $ helm upgrade \-f myvalues.yaml \-f override.yaml redis ./redis .RE .PP -Note that the key name provided to the '\-\-set', '\-\-set\-string' and '\-\-set\-file' flags can reference structure elements. Examples: +Note that the key name provided to the '\-\-set', '\-\-set\-string' and '\-\-set\-file' flags can reference +structure elements. Examples: \- mybool=TRUE \- livenessProbe.timeoutSeconds=10 \- metrics.annotations[0]=hey,metrics.annotations[1]=ho .PP -which sets the top level key mybool to true, the nested timeoutSeconds to 10 and two array values respectively. +which sets the top level key mybool to true, the nested timeoutSeconds to 10, and two array values, respectively. .PP -Note that the value side of the key=val provided to '\-\-set' and '\-\-set\-string' flags will pass through shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with special characters in unexpected ways, for example +Note that the value side of the key=val provided to '\-\-set' and '\-\-set\-string' flags will pass through +shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with +special characters in unexpected ways, for example .PP .RS @@ -71,7 +76,8 @@ $ helm upgrade \-\-set pwd=3jk$o2,z=f\\30.e redis ./redis .RE .PP -results in "pwd: 3jk" and "z: f30.e". Use single quotes to avoid shell evaulation and argument delimiters, and use backslash to escape yaml special characters: +results in "pwd: 3jk" and "z: f30.e". Use single quotes to avoid shell evaluation and argument delimiters, +and use backslash to escape yaml special characters: .PP .RS @@ -83,7 +89,8 @@ $ helm upgrade \-\-set pwd='3jk$o2z=f\\\\30.e' redis ./redis .RE .PP -which results in the expected "pwd: 3jk$o2z=f\\30.e". If a single quote occurs in your value then follow your shell convention for escaping it; for example in bash: +which results in the expected "pwd: 3jk$o2z=f\\30.e". If a single quote occurs in your value then follow +your shell convention for escaping it; for example in bash: .PP .RS @@ -123,6 +130,10 @@ which results in "pwd: 3jk$o2z=f\\30with'quote". \fB\-\-force\fP[=false] force resource update through delete/recreate if needed +.PP +\fB\-h\fP, \fB\-\-help\fP[=false] + help for upgrade + .PP \fB\-i\fP, \fB\-\-install\fP[=false] if a release by this name doesn't already exist, run an install @@ -132,7 +143,7 @@ which results in "pwd: 3jk$o2z=f\\30with'quote". identify HTTPS client using this SSL key file .PP -\fB\-\-keyring\fP="~/.gnupg/pubring.gpg" +\fB\-\-keyring\fP="/Users/grapevine/.gnupg/pubring.gpg" path to the keyring that contains public signing keys .PP @@ -230,7 +241,7 @@ which results in "pwd: 3jk$o2z=f\\30with'quote". enable verbose output .PP -\fB\-\-home\fP="~/.helm" +\fB\-\-home\fP="/Users/grapevine/.helm" location of your Helm config. Overrides $HELM\_HOME .PP @@ -261,4 +272,4 @@ which results in "pwd: 3jk$o2z=f\\30with'quote". .SH HISTORY .PP -17\-Aug\-2018 Auto generated by spf13/cobra +24\-Aug\-2018 Auto generated by spf13/cobra From e84d7ac307e993975e1b67c11dc50147a6d1fcff Mon Sep 17 00:00:00 2001 From: mattjmcnaughton Date: Mon, 4 Jun 2018 21:17:54 -0400 Subject: [PATCH 341/449] Add containerized options for tests in Makefile Add an option to run the `test-unit`, `test-style`, and `test` steps from the `Makefile` insides of a docker container. Doing so isolates this component of helm development from any other aspect of your global go environment. These commands all have the name `docker-*`. Long term, there may be reproducibility benefits to running all of the Make steps in a container by default, in which case `containerized-test-unit` could become `test-unit`. --- Makefile | 23 +++++++++++++++++++++++ docs/developers.md | 6 +++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6264cd814..9b8588712 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ DOCKER_REGISTRY ?= gcr.io IMAGE_PREFIX ?= kubernetes-helm +DEV_IMAGE ?= golang:1.10 SHORT_NAME ?= tiller SHORT_NAME_RUDDER ?= rudder TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x windows/amd64 @@ -87,17 +88,39 @@ test: TESTFLAGS += -race -v test: test-style test: test-unit +.PHONY: docker-test +docker-test: docker-binary +docker-test: TESTFLAGS += -race -v +docker-test: docker-test-style +docker-test: docker-test-unit + .PHONY: test-unit test-unit: @echo @echo "==> Running unit tests <==" HELM_HOME=/no/such/dir $(GO) test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS) +.PHONY: docker-test-unit +docker-test-unit: check-docker + docker run \ + -v $(shell pwd):/go/src/k8s.io/helm \ + -w /go/src/k8s.io/helm \ + $(DEV_IMAGE) \ + bash -c "HELM_HOME=/no/such/dir go test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS)" + .PHONY: test-style test-style: @scripts/validate-go.sh @scripts/validate-license.sh +.PHONY: docker-test-style +docker-test-style: check-docker + docker run \ + -v $(CURDIR):/go/src/k8s.io/helm \ + -w /go/src/k8s.io/helm \ + $(DEV_IMAGE) \ + bash -c "scripts/validate-go.sh && scripts/validate-license.sh" + .PHONY: protoc protoc: $(MAKE) -C _proto/ all diff --git a/docs/developers.md b/docs/developers.md index e18c28d5d..ca6b591fe 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -27,7 +27,8 @@ This will build both Helm and Tiller. `make bootstrap` will attempt to install certain tools if they are missing. To run all the tests (without running the tests for `vendor/`), run -`make test`. +`make test`. To run all tests in a containerized environment, run `make +docker-test`. To run Helm and Tiller locally, you can run `bin/helm` or `bin/tiller`. @@ -209,6 +210,9 @@ We follow the Go coding style standards very closely. Typically, running We also typically follow the conventions recommended by `go lint` and `gometalinter`. Run `make test-style` to test the style conformance. +If you do not want to install all the linters from `gometalinter` into your +global Go environment, you can run `make docker-test-style` which will +run the same tests, but isolated within a docker container. Read more: From bc236f4b84435c3475f46d8253ca37c6c5f1a573 Mon Sep 17 00:00:00 2001 From: roc Date: Wed, 11 Jul 2018 20:44:28 +0800 Subject: [PATCH 342/449] feat(helm): hiding password input on terminal When using "helm repo add" with "--username" and without "--password", hide user's input with a password prompt. This allows users to not expose their passwords to the command line history. --- cmd/helm/repo_add.go | 20 ++++++++++++++++++++ glide.yaml | 1 + 2 files changed, 21 insertions(+) diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index 906a9aef4..bfb3f0174 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -22,9 +22,11 @@ import ( "github.com/spf13/cobra" + "golang.org/x/crypto/ssh/terminal" "k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" + "syscall" ) type repoAddCmd struct { @@ -73,6 +75,16 @@ func newRepoAddCmd(out io.Writer) *cobra.Command { } func (a *repoAddCmd) run() error { + if a.username != "" && a.password == "" { + fmt.Fprint(a.out, "Password:") + password, err := readPassword() + fmt.Fprintln(a.out) + if err != nil { + return err + } + a.password = password + } + if err := addRepository(a.name, a.url, a.username, a.password, a.home, a.certFile, a.keyFile, a.caFile, a.noupdate); err != nil { return err } @@ -80,6 +92,14 @@ func (a *repoAddCmd) run() error { return nil } +func readPassword() (string, error) { + password, err := terminal.ReadPassword(int(syscall.Stdin)) + if err != nil { + return "", err + } + return string(password), nil +} + func addRepository(name, url, username, password string, home helmpath.Home, certFile, keyFile, caFile string, noUpdate bool) error { f, err := repo.LoadRepositoriesFile(home.RepositoryFile()) if err != nil { diff --git a/glide.yaml b/glide.yaml index e32df1d4e..68a5d91ad 100644 --- a/glide.yaml +++ b/glide.yaml @@ -33,6 +33,7 @@ import: - package: golang.org/x/crypto subpackages: - openpgp + - ssh/terminal # pin version of golang.org/x/sys that is compatible with golang.org/x/crypto - package: golang.org/x/sys version: 43eea11 From 519491b42b1cfd33f8057b14f32c5e89a64933ac Mon Sep 17 00:00:00 2001 From: aswinkarthik Date: Wed, 15 Aug 2018 18:20:15 +0530 Subject: [PATCH 343/449] fix(helm): Add --tiller-tls-hostname flag to 'helm init' This will fix the bug where 'helm init --wait' fails when TLS is used. Signed-off-by: aswinkarthik --- cmd/helm/helm.go | 2 +- cmd/helm/init.go | 1 + docs/helm/helm_init.md | 49 +++++++++++++++++++++--------------------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index cdb6313e2..6cb1c78ea 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -286,7 +286,7 @@ func newClient() helm.Interface { if tlsKeyFile == "" { tlsKeyFile = settings.Home.TLSKey() } - debug("Host=%q, Key=%q, Cert=%q, CA=%q\n", tlsKeyFile, tlsCertFile, tlsCaCertFile) + debug("Host=%q, Key=%q, Cert=%q, CA=%q\n", tlsServerName, tlsKeyFile, tlsCertFile, tlsCaCertFile) tlsopts := tlsutil.Options{ ServerName: tlsServerName, KeyFile: tlsKeyFile, diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 138fa14d7..630847f3b 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -126,6 +126,7 @@ func newInitCmd(out io.Writer) *cobra.Command { f.StringVar(&tlsKeyFile, "tiller-tls-key", "", "path to TLS key file to install with Tiller") f.StringVar(&tlsCertFile, "tiller-tls-cert", "", "path to TLS certificate file to install with Tiller") f.StringVar(&tlsCaCertFile, "tls-ca-cert", "", "path to CA root certificate") + f.StringVar(&tlsServerName, "tiller-tls-hostname", settings.TillerHost, "the server name used to verify the hostname on the returned certificates from Tiller") f.StringVar(&stableRepositoryURL, "stable-repo-url", stableRepositoryURL, "URL for stable repository") f.StringVar(&localRepositoryURL, "local-repo-url", localRepositoryURL, "URL for local repository") diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index 430cc3d0e..f1aad3159 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -32,29 +32,30 @@ helm init [flags] ### Options ``` - --canary-image use the canary Tiller image - -c, --client-only if set does not install Tiller - --dry-run do not install local or remote - --force-upgrade force upgrade of Tiller to the current helm version - -h, --help help for init - --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") - --net-host install Tiller with net=host - --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) - --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) - --service-account string name of service account - --skip-refresh do not refresh (download) the local repository cache - --stable-repo-url string URL for stable repository (default "https://kubernetes-charts.storage.googleapis.com") - -i, --tiller-image string override Tiller image - --tiller-tls install Tiller with TLS enabled - --tiller-tls-cert string path to TLS certificate 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 - --tls-ca-cert string path to CA root certificate - --upgrade upgrade if Tiller is already installed - --wait block until Tiller is running and ready to receive requests + --canary-image use the canary Tiller image + -c, --client-only if set does not install Tiller + --dry-run do not install local or remote + --force-upgrade force upgrade of Tiller to the current helm version + -h, --help help for init + --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") + --net-host install Tiller with net=host + --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) + --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) + --service-account string name of service account + --skip-refresh do not refresh (download) the local repository cache + --stable-repo-url string URL for stable repository (default "https://kubernetes-charts.storage.googleapis.com") + -i, --tiller-image string override Tiller image + --tiller-tls install Tiller with TLS enabled + --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-key string path to TLS key file to install with Tiller + --tiller-tls-verify install Tiller with TLS enabled and to verify remote certificates + --tls-ca-cert string path to CA root certificate + --upgrade upgrade if Tiller is already installed + --wait block until Tiller is running and ready to receive requests ``` ### Options inherited from parent commands @@ -73,4 +74,4 @@ helm init [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 1-Aug-2018 +###### Auto generated by spf13/cobra on 1-Sep-2018 From 0baaf1f06c088e395216ee47007a26bbf9e8700c Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Mon, 16 Jul 2018 15:14:00 -0400 Subject: [PATCH 344/449] feat(helm): add ability to sort release list by chart name Signed-off-by: Arash Deshmeh --- _proto/hapi/services/tiller.proto | 1 + cmd/helm/list.go | 41 ++++--- docs/helm/helm_list.md | 3 +- pkg/proto/hapi/services/tiller.pb.go | 171 ++++++++++++++------------- pkg/releaseutil/sorter.go | 23 ++++ pkg/releaseutil/sorter_test.go | 16 +++ pkg/tiller/release_list.go | 2 + pkg/tiller/release_list_test.go | 43 +++++++ 8 files changed, 197 insertions(+), 103 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index a94a90a4a..6c44ce6e0 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -124,6 +124,7 @@ message ListSort{ UNKNOWN = 0; NAME = 1; LAST_RELEASED = 2; + CHART_NAME = 3; } // SortOrder defines sort orders to augment sorting operations. diff --git a/cmd/helm/list.go b/cmd/helm/list.go index ed70702d5..4467b6ec7 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -60,24 +60,25 @@ flag with the '--offset' flag allows you to page through results. ` type listCmd struct { - filter string - short bool - limit int - offset string - byDate bool - sortDesc bool - out io.Writer - all bool - deleted bool - deleting bool - deployed bool - failed bool - namespace string - superseded bool - pending bool - client helm.Interface - colWidth uint - output string + filter string + short bool + limit int + offset string + byDate bool + sortDesc bool + out io.Writer + all bool + deleted bool + deleting bool + deployed bool + failed bool + namespace string + superseded bool + pending bool + client helm.Interface + colWidth uint + output string + byChartName bool } type listResult struct { @@ -133,6 +134,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&list.namespace, "namespace", "", "show releases within a specific namespace") f.UintVar(&list.colWidth, "col-width", 60, "specifies the max column width of output") f.StringVar(&list.output, "output", "", "output the specified format (json or yaml)") + f.BoolVarP(&list.byChartName, "chart-name", "c", false, "sort by chart name") // TODO: Do we want this as a feature of 'helm list'? //f.BoolVar(&list.superseded, "history", true, "show historical releases") @@ -145,6 +147,9 @@ func (l *listCmd) run() error { if l.byDate { sortBy = services.ListSort_LAST_RELEASED } + if l.byChartName { + sortBy = services.ListSort_CHART_NAME + } sortOrder := services.ListSort_ASC if l.sortDesc { diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index bf740239d..5087c8a59 100755 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -39,6 +39,7 @@ helm list [flags] [FILTER] ``` -a, --all show all releases, not just the ones marked DEPLOYED + -c, --chart-name sort by chart name --col-width uint specifies the max column width of output (default 60) -d, --date sort by release date --deleted show deleted releases @@ -77,4 +78,4 @@ helm list [flags] [FILTER] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 10-Aug-2018 +###### Auto generated by spf13/cobra on 1-Sep-2018 diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index c0b9ab7d3..044d54e91 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -66,17 +66,20 @@ const ( ListSort_UNKNOWN ListSort_SortBy = 0 ListSort_NAME ListSort_SortBy = 1 ListSort_LAST_RELEASED ListSort_SortBy = 2 + ListSort_CHART_NAME ListSort_SortBy = 3 ) var ListSort_SortBy_name = map[int32]string{ 0: "UNKNOWN", 1: "NAME", 2: "LAST_RELEASED", + 3: "CHART_NAME", } var ListSort_SortBy_value = map[string]int32{ "UNKNOWN": 0, "NAME": 1, "LAST_RELEASED": 2, + "CHART_NAME": 3, } func (x ListSort_SortBy) String() string { @@ -110,7 +113,7 @@ func (ListSort_SortOrder) EnumDescriptor() ([]byte, []int) { return fileDescript // // Releases can be retrieved in chunks by setting limit and offset. // -// Releases can be sorted according to a few pre-determined sort stategies. +// Releases can be sorted according to a few pre-determined sort strategies. type ListReleasesRequest struct { // Limit is the maximum number of releases to be returned. Limit int64 `protobuf:"varint,1,opt,name=limit" json:"limit,omitempty"` @@ -609,9 +612,9 @@ type InstallReleaseRequest struct { Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"` // DisableHooks causes the server to skip running any hooks for the install. DisableHooks bool `protobuf:"varint,5,opt,name=disable_hooks,json=disableHooks" json:"disable_hooks,omitempty"` - // Namepace is the kubernetes namespace of the release. + // Namespace is the kubernetes namespace of the release. Namespace string `protobuf:"bytes,6,opt,name=namespace" json:"namespace,omitempty"` - // ReuseName requests that Tiller re-uses a name, instead of erroring out. + // Reuse_name requests that Tiller re-uses a name, instead of erroring out. ReuseName bool `protobuf:"varint,7,opt,name=reuse_name,json=reuseName" json:"reuse_name,omitempty"` // timeout specifies the max amount of time any kubernetes client command can run. Timeout int64 `protobuf:"varint,8,opt,name=timeout" json:"timeout,omitempty"` @@ -1412,85 +1415,85 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1267 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xed, 0x6e, 0xe3, 0x44, - 0x17, 0x6e, 0xe2, 0x7c, 0x9e, 0x74, 0xf3, 0x66, 0x67, 0xb3, 0xad, 0xeb, 0x77, 0x41, 0xc1, 0x08, - 0x36, 0xbb, 0xb0, 0x29, 0x04, 0xfe, 0x20, 0x21, 0xa4, 0x6e, 0x36, 0x6a, 0x0b, 0xa5, 0x2b, 0x39, - 0xdb, 0x45, 0x42, 0x40, 0xe4, 0x26, 0x93, 0xd6, 0xac, 0x63, 0x07, 0xcf, 0xb8, 0x6c, 0x2f, 0x00, - 0x24, 0xee, 0x83, 0x0b, 0xe1, 0x3e, 0xb8, 0x0e, 0xfe, 0x23, 0xcf, 0x87, 0xeb, 0x71, 0xec, 0xd4, - 0xf4, 0x4f, 0xe3, 0x99, 0x73, 0xe6, 0x7c, 0x3c, 0xcf, 0x9c, 0x33, 0xa7, 0x60, 0x5c, 0xda, 0x2b, - 0x67, 0x9f, 0xe0, 0xe0, 0xca, 0x99, 0x61, 0xb2, 0x4f, 0x1d, 0xd7, 0xc5, 0xc1, 0x60, 0x15, 0xf8, - 0xd4, 0x47, 0xdd, 0x48, 0x36, 0x90, 0xb2, 0x01, 0x97, 0x19, 0x3b, 0xec, 0xc4, 0xec, 0xd2, 0x0e, - 0x28, 0xff, 0xcb, 0xb5, 0x8d, 0xdd, 0xe4, 0xbe, 0xef, 0x2d, 0x9c, 0x0b, 0x21, 0xe0, 0x2e, 0x02, - 0xec, 0x62, 0x9b, 0x60, 0xf9, 0xab, 0x1c, 0x92, 0x32, 0xc7, 0x5b, 0xf8, 0x42, 0xf0, 0x7f, 0x45, - 0x40, 0x31, 0xa1, 0xd3, 0x20, 0xf4, 0x84, 0x70, 0x4f, 0x11, 0x12, 0x6a, 0xd3, 0x90, 0x28, 0xce, - 0xae, 0x70, 0x40, 0x1c, 0xdf, 0x93, 0xbf, 0x5c, 0x66, 0xfe, 0x55, 0x86, 0x07, 0x27, 0x0e, 0xa1, - 0x16, 0x3f, 0x48, 0x2c, 0xfc, 0x4b, 0x88, 0x09, 0x45, 0x5d, 0xa8, 0xba, 0xce, 0xd2, 0xa1, 0x7a, - 0xa9, 0x57, 0xea, 0x6b, 0x16, 0x5f, 0xa0, 0x1d, 0xa8, 0xf9, 0x8b, 0x05, 0xc1, 0x54, 0x2f, 0xf7, - 0x4a, 0xfd, 0xa6, 0x25, 0x56, 0xe8, 0x2b, 0xa8, 0x13, 0x3f, 0xa0, 0xd3, 0xf3, 0x6b, 0x5d, 0xeb, - 0x95, 0xfa, 0xed, 0xe1, 0x07, 0x83, 0x2c, 0x9c, 0x06, 0x91, 0xa7, 0x89, 0x1f, 0xd0, 0x41, 0xf4, - 0xe7, 0xf9, 0xb5, 0x55, 0x23, 0xec, 0x37, 0xb2, 0xbb, 0x70, 0x5c, 0x8a, 0x03, 0xbd, 0xc2, 0xed, - 0xf2, 0x15, 0x3a, 0x04, 0x60, 0x76, 0xfd, 0x60, 0x8e, 0x03, 0xbd, 0xca, 0x4c, 0xf7, 0x0b, 0x98, - 0x7e, 0x19, 0xe9, 0x5b, 0x4d, 0x22, 0x3f, 0xd1, 0x97, 0xb0, 0xcd, 0x21, 0x99, 0xce, 0xfc, 0x39, - 0x26, 0x7a, 0xad, 0xa7, 0xf5, 0xdb, 0xc3, 0x3d, 0x6e, 0x4a, 0xc2, 0x3f, 0xe1, 0xa0, 0x8d, 0xfc, - 0x39, 0xb6, 0x5a, 0x5c, 0x3d, 0xfa, 0x26, 0xe8, 0x11, 0x34, 0x3d, 0x7b, 0x89, 0xc9, 0xca, 0x9e, - 0x61, 0xbd, 0xce, 0x22, 0xbc, 0xd9, 0x30, 0x7f, 0x82, 0x86, 0x74, 0x6e, 0x0e, 0xa1, 0xc6, 0x53, - 0x43, 0x2d, 0xa8, 0x9f, 0x9d, 0x7e, 0x73, 0xfa, 0xf2, 0xbb, 0xd3, 0xce, 0x16, 0x6a, 0x40, 0xe5, - 0xf4, 0xe0, 0xdb, 0x71, 0xa7, 0x84, 0xee, 0xc3, 0xbd, 0x93, 0x83, 0xc9, 0xab, 0xa9, 0x35, 0x3e, - 0x19, 0x1f, 0x4c, 0xc6, 0x2f, 0x3a, 0x65, 0xf3, 0x5d, 0x68, 0xc6, 0x31, 0xa3, 0x3a, 0x68, 0x07, - 0x93, 0x11, 0x3f, 0xf2, 0x62, 0x3c, 0x19, 0x75, 0x4a, 0xe6, 0x1f, 0x25, 0xe8, 0xaa, 0x14, 0x91, - 0x95, 0xef, 0x11, 0x1c, 0x71, 0x34, 0xf3, 0x43, 0x2f, 0xe6, 0x88, 0x2d, 0x10, 0x82, 0x8a, 0x87, - 0xdf, 0x4a, 0x86, 0xd8, 0x77, 0xa4, 0x49, 0x7d, 0x6a, 0xbb, 0x8c, 0x1d, 0xcd, 0xe2, 0x0b, 0xf4, - 0x29, 0x34, 0x44, 0xea, 0x44, 0xaf, 0xf4, 0xb4, 0x7e, 0x6b, 0xf8, 0x50, 0x05, 0x44, 0x78, 0xb4, - 0x62, 0x35, 0xf3, 0x10, 0x76, 0x0f, 0xb1, 0x8c, 0x84, 0xe3, 0x25, 0x6f, 0x4c, 0xe4, 0xd7, 0x5e, - 0x62, 0x16, 0x4c, 0xe4, 0xd7, 0x5e, 0x62, 0xa4, 0x43, 0x5d, 0x5c, 0x37, 0x16, 0x4e, 0xd5, 0x92, - 0x4b, 0x93, 0x82, 0xbe, 0x6e, 0x48, 0xe4, 0x95, 0x65, 0xe9, 0x43, 0xa8, 0x44, 0x95, 0xc0, 0xcc, - 0xb4, 0x86, 0x48, 0x8d, 0xf3, 0xd8, 0x5b, 0xf8, 0x16, 0x93, 0xab, 0x54, 0x69, 0x69, 0xaa, 0x8e, - 0x92, 0x5e, 0x47, 0xbe, 0x47, 0xb1, 0x47, 0xef, 0x16, 0xff, 0x09, 0xec, 0x65, 0x58, 0x12, 0x09, - 0xec, 0x43, 0x5d, 0x84, 0xc6, 0xac, 0xe5, 0xe2, 0x2a, 0xb5, 0xcc, 0xdf, 0x34, 0xe8, 0x9e, 0xad, - 0xe6, 0x36, 0xc5, 0x52, 0xb4, 0x21, 0xa8, 0xc7, 0x50, 0x65, 0x1d, 0x45, 0x60, 0x71, 0x9f, 0xdb, - 0xe6, 0x6d, 0x67, 0x14, 0xfd, 0xb5, 0xb8, 0x1c, 0x3d, 0x85, 0xda, 0x95, 0xed, 0x86, 0x98, 0x30, - 0x20, 0x62, 0xd4, 0x84, 0x26, 0x6b, 0x47, 0x96, 0xd0, 0x40, 0xbb, 0x50, 0x9f, 0x07, 0xd7, 0x51, - 0x3f, 0x61, 0x25, 0xd8, 0xb0, 0x6a, 0xf3, 0xe0, 0xda, 0x0a, 0x3d, 0xf4, 0x3e, 0xdc, 0x9b, 0x3b, - 0xc4, 0x3e, 0x77, 0xf1, 0xf4, 0xd2, 0xf7, 0xdf, 0x10, 0x56, 0x85, 0x0d, 0x6b, 0x5b, 0x6c, 0x1e, - 0x45, 0x7b, 0xc8, 0x88, 0x6e, 0xd2, 0x2c, 0xc0, 0x36, 0xc5, 0x7a, 0x8d, 0xc9, 0xe3, 0x75, 0x84, - 0x21, 0x75, 0x96, 0xd8, 0x0f, 0x29, 0x2b, 0x1d, 0xcd, 0x92, 0x4b, 0xf4, 0x1e, 0x6c, 0x07, 0x98, - 0x60, 0x3a, 0x15, 0x51, 0x36, 0xd8, 0xc9, 0x16, 0xdb, 0x7b, 0xcd, 0xc3, 0x42, 0x50, 0xf9, 0xd5, - 0x76, 0xa8, 0xde, 0x64, 0x22, 0xf6, 0xcd, 0x8f, 0x85, 0x04, 0xcb, 0x63, 0x20, 0x8f, 0x85, 0x04, - 0x8b, 0x63, 0x5d, 0xa8, 0x2e, 0xfc, 0x60, 0x86, 0xf5, 0x16, 0x93, 0xf1, 0x05, 0xea, 0x41, 0x6b, - 0x8e, 0xc9, 0x2c, 0x70, 0x56, 0x34, 0x62, 0x74, 0x9b, 0x61, 0x9a, 0xdc, 0x32, 0x8f, 0xe0, 0x61, - 0x8a, 0x86, 0xbb, 0x32, 0xfa, 0x7b, 0x19, 0x76, 0x2c, 0xdf, 0x75, 0xcf, 0xed, 0xd9, 0x9b, 0x02, - 0x9c, 0x26, 0xe0, 0x2f, 0x6f, 0x86, 0x5f, 0xcb, 0x80, 0x3f, 0x71, 0x4d, 0x2b, 0xca, 0x35, 0x55, - 0x88, 0xa9, 0xe6, 0x13, 0x53, 0x53, 0x89, 0x91, 0xa8, 0xd7, 0x13, 0xa8, 0xc7, 0x90, 0x36, 0x36, - 0x40, 0xda, 0x5c, 0x87, 0xf4, 0x6b, 0xd8, 0x5d, 0xc3, 0xe1, 0xae, 0xa0, 0xfe, 0x53, 0x86, 0x87, - 0xc7, 0x1e, 0xa1, 0xb6, 0xeb, 0xa6, 0x30, 0x8d, 0x6b, 0xa2, 0x54, 0xb8, 0x26, 0xca, 0xff, 0xa5, - 0x26, 0x34, 0x85, 0x14, 0xc9, 0x60, 0x25, 0xc1, 0x60, 0xa1, 0x3a, 0x51, 0xba, 0x53, 0x2d, 0xd5, - 0x9d, 0xd0, 0x3b, 0x00, 0xfc, 0x62, 0x33, 0xe3, 0x1c, 0xfc, 0x26, 0xdb, 0x39, 0x15, 0xcd, 0x48, - 0xf2, 0xd5, 0xc8, 0xe6, 0x2b, 0x59, 0x25, 0x7d, 0xe8, 0xc8, 0x78, 0x66, 0xc1, 0x9c, 0xc5, 0x24, - 0x2a, 0xa5, 0x2d, 0xf6, 0x47, 0xc1, 0x3c, 0x8a, 0x2a, 0xcd, 0x61, 0x6b, 0x9d, 0xc3, 0x63, 0xd8, - 0x49, 0xc3, 0x7e, 0x57, 0x0a, 0xff, 0x2c, 0xc1, 0xee, 0x99, 0xe7, 0x64, 0x92, 0x98, 0x55, 0x18, - 0x6b, 0xb0, 0x96, 0x33, 0x60, 0xed, 0x42, 0x75, 0x15, 0x06, 0x17, 0x58, 0xd0, 0xc4, 0x17, 0x49, - 0xbc, 0x2a, 0x2a, 0x5e, 0xa9, 0x8c, 0xab, 0xeb, 0x19, 0x4f, 0x41, 0x5f, 0x8f, 0xf2, 0x8e, 0x39, - 0x47, 0x79, 0xc5, 0x6f, 0x57, 0x93, 0xbf, 0x53, 0xe6, 0x03, 0xb8, 0x7f, 0x88, 0xe9, 0x6b, 0x5e, - 0xa6, 0x02, 0x00, 0x73, 0x0c, 0x28, 0xb9, 0x79, 0xe3, 0x4f, 0x6c, 0xa9, 0xfe, 0xe4, 0x20, 0x27, - 0xf5, 0xa5, 0x96, 0xf9, 0x05, 0xb3, 0x7d, 0xe4, 0x10, 0xea, 0x07, 0xd7, 0x9b, 0xc0, 0xed, 0x80, - 0xb6, 0xb4, 0xdf, 0x8a, 0xa7, 0x2d, 0xfa, 0x34, 0x0f, 0x59, 0x04, 0xf1, 0x51, 0x11, 0x41, 0x72, - 0x50, 0x28, 0x15, 0x1b, 0x14, 0x7e, 0x00, 0xf4, 0x0a, 0xc7, 0x33, 0xcb, 0x2d, 0x6f, 0xac, 0xa4, - 0xa9, 0xac, 0xd2, 0xa4, 0x43, 0x7d, 0xe6, 0x62, 0xdb, 0x0b, 0x57, 0x82, 0x58, 0xb9, 0x34, 0x7f, - 0x84, 0x07, 0x8a, 0x75, 0x11, 0x67, 0x94, 0x0f, 0xb9, 0x10, 0xd6, 0xa3, 0x4f, 0xf4, 0x39, 0xd4, - 0xf8, 0x20, 0xc7, 0x6c, 0xb7, 0x87, 0x8f, 0xd4, 0xb8, 0x99, 0x91, 0xd0, 0x13, 0x93, 0x9f, 0x25, - 0x74, 0x87, 0x7f, 0x37, 0xa0, 0x2d, 0x47, 0x13, 0x3e, 0x66, 0x22, 0x07, 0xb6, 0x93, 0x33, 0x18, - 0x7a, 0x92, 0x3f, 0x85, 0xa6, 0x46, 0x69, 0xe3, 0x69, 0x11, 0x55, 0x9e, 0x81, 0xb9, 0xf5, 0x49, - 0x09, 0x11, 0xe8, 0xa4, 0x47, 0x23, 0xf4, 0x2c, 0xdb, 0x46, 0xce, 0x2c, 0x66, 0x0c, 0x8a, 0xaa, - 0x4b, 0xb7, 0xe8, 0x8a, 0xdd, 0x19, 0x75, 0x9e, 0x41, 0xb7, 0x9a, 0x51, 0x47, 0x28, 0x63, 0xbf, - 0xb0, 0x7e, 0xec, 0xf7, 0x67, 0xb8, 0xa7, 0xbc, 0xb8, 0x28, 0x07, 0xad, 0xac, 0xe9, 0xc8, 0xf8, - 0xa8, 0x90, 0x6e, 0xec, 0x6b, 0x09, 0x6d, 0xb5, 0x8d, 0xa1, 0x1c, 0x03, 0x99, 0x6f, 0x8c, 0xf1, - 0x71, 0x31, 0xe5, 0xd8, 0x1d, 0x81, 0x4e, 0xba, 0x87, 0xe4, 0xf1, 0x98, 0xd3, 0x11, 0xf3, 0x78, - 0xcc, 0x6b, 0x4d, 0xe6, 0x16, 0xb2, 0x01, 0x6e, 0x5a, 0x08, 0x7a, 0x9c, 0x4b, 0x88, 0xda, 0x79, - 0x8c, 0xfe, 0xed, 0x8a, 0xb1, 0x8b, 0x15, 0xfc, 0x2f, 0xf5, 0xa2, 0xa3, 0x1c, 0x68, 0xb2, 0x07, - 0x20, 0xe3, 0x59, 0x41, 0xed, 0x54, 0x52, 0xa2, 0x2b, 0x6d, 0x48, 0x4a, 0x6d, 0x79, 0x1b, 0x92, - 0x4a, 0x35, 0x38, 0x73, 0x0b, 0x39, 0xd0, 0xb6, 0x42, 0x4f, 0xb8, 0x8e, 0xda, 0x02, 0xca, 0x39, - 0xbd, 0xde, 0xd5, 0x8c, 0x27, 0x05, 0x34, 0x6f, 0xea, 0xfb, 0x39, 0x7c, 0xdf, 0x90, 0xaa, 0xe7, - 0x35, 0xf6, 0x5f, 0xf8, 0x67, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x73, 0x4f, 0x4d, 0x73, - 0x10, 0x00, 0x00, + // 1276 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0x6e, 0xe2, 0xfc, 0x9e, 0x74, 0x43, 0x76, 0x36, 0xdb, 0x7a, 0xcd, 0x82, 0x82, 0x11, 0x6c, + 0x76, 0x61, 0x53, 0x08, 0xdc, 0x20, 0x21, 0xa4, 0x6e, 0x36, 0x6a, 0x0b, 0xa5, 0x2b, 0x39, 0xed, + 0x22, 0x21, 0x50, 0xe4, 0x26, 0x93, 0xd6, 0xac, 0x63, 0x07, 0xcf, 0xb8, 0x6c, 0x1f, 0x00, 0x24, + 0xde, 0x83, 0x07, 0xe1, 0x3d, 0x78, 0x0e, 0xee, 0x91, 0xe7, 0xc7, 0xf5, 0x38, 0x76, 0x6a, 0x7a, + 0xd3, 0x78, 0xe6, 0x9c, 0x39, 0x3f, 0xdf, 0x37, 0xe7, 0xcc, 0x29, 0x18, 0x97, 0xf6, 0xca, 0xd9, + 0x23, 0x38, 0xb8, 0x72, 0x66, 0x98, 0xec, 0x51, 0xc7, 0x75, 0x71, 0x30, 0x58, 0x05, 0x3e, 0xf5, + 0x51, 0x37, 0x92, 0x0d, 0xa4, 0x6c, 0xc0, 0x65, 0xc6, 0x0e, 0x3b, 0x31, 0xbb, 0xb4, 0x03, 0xca, + 0xff, 0x72, 0x6d, 0x63, 0x37, 0xb9, 0xef, 0x7b, 0x0b, 0xe7, 0x42, 0x08, 0xb8, 0x8b, 0x00, 0xbb, + 0xd8, 0x26, 0x58, 0xfe, 0x2a, 0x87, 0xa4, 0xcc, 0xf1, 0x16, 0xbe, 0x10, 0xbc, 0xab, 0x08, 0x28, + 0x26, 0x74, 0x1a, 0x84, 0x9e, 0x10, 0x3e, 0x52, 0x84, 0x84, 0xda, 0x34, 0x24, 0x8a, 0xb3, 0x2b, + 0x1c, 0x10, 0xc7, 0xf7, 0xe4, 0x2f, 0x97, 0x99, 0x7f, 0x97, 0xe1, 0xc1, 0xb1, 0x43, 0xa8, 0xc5, + 0x0f, 0x12, 0x0b, 0xff, 0x1a, 0x62, 0x42, 0x51, 0x17, 0xaa, 0xae, 0xb3, 0x74, 0xa8, 0x5e, 0xea, + 0x95, 0xfa, 0x9a, 0xc5, 0x17, 0x68, 0x07, 0x6a, 0xfe, 0x62, 0x41, 0x30, 0xd5, 0xcb, 0xbd, 0x52, + 0xbf, 0x69, 0x89, 0x15, 0xfa, 0x06, 0xea, 0xc4, 0x0f, 0xe8, 0xf4, 0xfc, 0x5a, 0xd7, 0x7a, 0xa5, + 0x7e, 0x7b, 0xf8, 0xd1, 0x20, 0x0b, 0xa7, 0x41, 0xe4, 0x69, 0xe2, 0x07, 0x74, 0x10, 0xfd, 0x79, + 0x71, 0x6d, 0xd5, 0x08, 0xfb, 0x8d, 0xec, 0x2e, 0x1c, 0x97, 0xe2, 0x40, 0xaf, 0x70, 0xbb, 0x7c, + 0x85, 0x0e, 0x00, 0x98, 0x5d, 0x3f, 0x98, 0xe3, 0x40, 0xaf, 0x32, 0xd3, 0xfd, 0x02, 0xa6, 0x5f, + 0x45, 0xfa, 0x56, 0x93, 0xc8, 0x4f, 0xf4, 0x35, 0x6c, 0x73, 0x48, 0xa6, 0x33, 0x7f, 0x8e, 0x89, + 0x5e, 0xeb, 0x69, 0xfd, 0xf6, 0xf0, 0x11, 0x37, 0x25, 0xe1, 0x9f, 0x70, 0xd0, 0x46, 0xfe, 0x1c, + 0x5b, 0x2d, 0xae, 0x1e, 0x7d, 0x13, 0xf4, 0x18, 0x9a, 0x9e, 0xbd, 0xc4, 0x64, 0x65, 0xcf, 0xb0, + 0x5e, 0x67, 0x11, 0xde, 0x6c, 0x98, 0x1e, 0x34, 0xa4, 0x73, 0xf3, 0x05, 0xd4, 0x78, 0x6a, 0xa8, + 0x05, 0xf5, 0xb3, 0x93, 0xef, 0x4e, 0x5e, 0xfd, 0x70, 0xd2, 0xd9, 0x42, 0x0d, 0xa8, 0x9c, 0xec, + 0x7f, 0x3f, 0xee, 0x94, 0xd0, 0x7d, 0xb8, 0x77, 0xbc, 0x3f, 0x39, 0x9d, 0x5a, 0xe3, 0xe3, 0xf1, + 0xfe, 0x64, 0xfc, 0xb2, 0x53, 0x46, 0x6d, 0x80, 0xd1, 0xe1, 0xbe, 0x75, 0x3a, 0x65, 0x2a, 0x9a, + 0xf9, 0x3e, 0x34, 0xe3, 0x1c, 0x50, 0x1d, 0xb4, 0xfd, 0xc9, 0x88, 0x9b, 0x78, 0x39, 0x9e, 0x8c, + 0x3a, 0x25, 0xf3, 0xcf, 0x12, 0x74, 0x55, 0xca, 0xc8, 0xca, 0xf7, 0x08, 0x8e, 0x38, 0x9b, 0xf9, + 0xa1, 0x17, 0x73, 0xc6, 0x16, 0x08, 0x41, 0xc5, 0xc3, 0x6f, 0x25, 0x63, 0xec, 0x3b, 0xd2, 0xa4, + 0x3e, 0xb5, 0x5d, 0xc6, 0x96, 0x66, 0xf1, 0x05, 0xfa, 0x1c, 0x1a, 0x02, 0x0a, 0xa2, 0x57, 0x7a, + 0x5a, 0xbf, 0x35, 0x7c, 0xa8, 0x02, 0x24, 0x3c, 0x5a, 0xb1, 0x9a, 0x79, 0x00, 0xbb, 0x07, 0x58, + 0x46, 0xc2, 0xf1, 0x93, 0x37, 0x28, 0xf2, 0x6b, 0x2f, 0x31, 0x0b, 0x26, 0xf2, 0x6b, 0x2f, 0x31, + 0xd2, 0xa1, 0x2e, 0xae, 0x1f, 0x0b, 0xa7, 0x6a, 0xc9, 0xa5, 0x49, 0x41, 0x5f, 0x37, 0x24, 0xf2, + 0xca, 0xb2, 0xf4, 0x31, 0x54, 0xa2, 0xca, 0x60, 0x66, 0x5a, 0x43, 0xa4, 0xc6, 0x79, 0xe4, 0x2d, + 0x7c, 0x8b, 0xc9, 0x55, 0xea, 0xb4, 0x34, 0x75, 0x87, 0x49, 0xaf, 0x23, 0xdf, 0xa3, 0xd8, 0xa3, + 0x77, 0x8b, 0xff, 0x18, 0x1e, 0x65, 0x58, 0x12, 0x09, 0xec, 0x41, 0x5d, 0x84, 0xc6, 0xac, 0xe5, + 0xe2, 0x2a, 0xb5, 0xcc, 0xdf, 0x35, 0xe8, 0x9e, 0xad, 0xe6, 0x36, 0xc5, 0x52, 0xb4, 0x21, 0xa8, + 0x27, 0x50, 0x65, 0x1d, 0x46, 0x60, 0x71, 0x9f, 0xdb, 0xe6, 0x6d, 0x68, 0x14, 0xfd, 0xb5, 0xb8, + 0x1c, 0x3d, 0x83, 0xda, 0x95, 0xed, 0x86, 0x98, 0x30, 0x20, 0x62, 0xd4, 0x84, 0x26, 0x6b, 0x4f, + 0x96, 0xd0, 0x40, 0xbb, 0x50, 0x9f, 0x07, 0xd7, 0x51, 0x7f, 0x61, 0x25, 0xd9, 0xb0, 0x6a, 0xf3, + 0xe0, 0xda, 0x0a, 0x3d, 0xf4, 0x21, 0xdc, 0x9b, 0x3b, 0xc4, 0x3e, 0x77, 0xf1, 0xf4, 0xd2, 0xf7, + 0xdf, 0x10, 0x56, 0x95, 0x0d, 0x6b, 0x5b, 0x6c, 0x1e, 0x46, 0x7b, 0xc8, 0x88, 0x6e, 0xd2, 0x2c, + 0xc0, 0x36, 0xc5, 0x7a, 0x8d, 0xc9, 0xe3, 0x75, 0x84, 0x21, 0x75, 0x96, 0xd8, 0x0f, 0x29, 0x2b, + 0x25, 0xcd, 0x92, 0x4b, 0xf4, 0x01, 0x6c, 0x07, 0x98, 0x60, 0x3a, 0x15, 0x51, 0x36, 0xd8, 0xc9, + 0x16, 0xdb, 0x7b, 0xcd, 0xc3, 0x42, 0x50, 0xf9, 0xcd, 0x76, 0xa8, 0xde, 0x64, 0x22, 0xf6, 0xcd, + 0x8f, 0x85, 0x04, 0xcb, 0x63, 0x20, 0x8f, 0x85, 0x04, 0x8b, 0x63, 0x5d, 0xa8, 0x2e, 0xfc, 0x60, + 0x86, 0xf5, 0x16, 0x93, 0xf1, 0x05, 0xea, 0x41, 0x6b, 0x8e, 0xc9, 0x2c, 0x70, 0x56, 0x34, 0x62, + 0x74, 0x9b, 0x61, 0x9a, 0xdc, 0x32, 0x0f, 0xe1, 0x61, 0x8a, 0x86, 0xbb, 0x32, 0xfa, 0x47, 0x19, + 0x76, 0x2c, 0xdf, 0x75, 0xcf, 0xed, 0xd9, 0x9b, 0x02, 0x9c, 0x26, 0xe0, 0x2f, 0x6f, 0x86, 0x5f, + 0xcb, 0x80, 0x3f, 0x71, 0x4d, 0x2b, 0xca, 0x35, 0x55, 0x88, 0xa9, 0xe6, 0x13, 0x53, 0x53, 0x89, + 0x91, 0xa8, 0xd7, 0x13, 0xa8, 0xc7, 0x90, 0x36, 0x36, 0x40, 0xda, 0x5c, 0x87, 0xf4, 0x5b, 0xd8, + 0x5d, 0xc3, 0xe1, 0xae, 0xa0, 0xfe, 0x5b, 0x86, 0x87, 0x47, 0x1e, 0xa1, 0xb6, 0xeb, 0xa6, 0x30, + 0x8d, 0x6b, 0xa2, 0x54, 0xb8, 0x26, 0xca, 0xff, 0xa7, 0x26, 0x34, 0x85, 0x14, 0xc9, 0x60, 0x25, + 0xc1, 0x60, 0xa1, 0x3a, 0x51, 0xba, 0x53, 0x2d, 0xd5, 0x9d, 0xd0, 0x7b, 0x00, 0xfc, 0x62, 0x33, + 0xe3, 0x1c, 0xfc, 0x26, 0xdb, 0x39, 0x11, 0xcd, 0x48, 0xf2, 0xd5, 0xc8, 0xe6, 0x2b, 0x59, 0x25, + 0x7d, 0xe8, 0xc8, 0x78, 0x66, 0xc1, 0x9c, 0xc5, 0x24, 0x2a, 0xa5, 0x2d, 0xf6, 0x47, 0xc1, 0x3c, + 0x8a, 0x2a, 0xcd, 0x61, 0x6b, 0x9d, 0xc3, 0x23, 0xd8, 0x49, 0xc3, 0x7e, 0x57, 0x0a, 0xff, 0x2a, + 0xc1, 0xee, 0x99, 0xe7, 0x64, 0x92, 0x98, 0x55, 0x18, 0x6b, 0xb0, 0x96, 0x33, 0x60, 0xed, 0x42, + 0x75, 0x15, 0x06, 0x17, 0x58, 0xd0, 0xc4, 0x17, 0x49, 0xbc, 0x2a, 0x2a, 0x5e, 0xa9, 0x8c, 0xab, + 0xeb, 0x19, 0x4f, 0x41, 0x5f, 0x8f, 0xf2, 0x8e, 0x39, 0x47, 0x79, 0xc5, 0x6f, 0x57, 0x93, 0xbf, + 0x53, 0xe6, 0x03, 0xb8, 0x7f, 0x80, 0xe9, 0x6b, 0x5e, 0xa6, 0x02, 0x00, 0x73, 0x0c, 0x28, 0xb9, + 0x79, 0xe3, 0x4f, 0x6c, 0xa9, 0xfe, 0xe4, 0x60, 0x27, 0xf5, 0xa5, 0x96, 0xf9, 0x15, 0xb3, 0x7d, + 0xe8, 0x10, 0xea, 0x07, 0xd7, 0x9b, 0xc0, 0xed, 0x80, 0xb6, 0xb4, 0xdf, 0x8a, 0xa7, 0x2d, 0xfa, + 0x34, 0x0f, 0x58, 0x04, 0xf1, 0x51, 0x11, 0x41, 0x72, 0x50, 0x28, 0x15, 0x1b, 0x14, 0x7e, 0x02, + 0x74, 0x8a, 0xe3, 0x99, 0xe5, 0x96, 0x37, 0x56, 0xd2, 0x54, 0x56, 0x69, 0xd2, 0xa1, 0x3e, 0x73, + 0xb1, 0xed, 0x85, 0x2b, 0x41, 0xac, 0x5c, 0x9a, 0x3f, 0xc3, 0x03, 0xc5, 0xba, 0x88, 0x33, 0xca, + 0x87, 0x5c, 0x08, 0xeb, 0xd1, 0x27, 0xfa, 0x12, 0x6a, 0x7c, 0xb0, 0x63, 0xb6, 0xdb, 0xc3, 0xc7, + 0x6a, 0xdc, 0xcc, 0x48, 0xe8, 0x89, 0x49, 0xd0, 0x12, 0xba, 0xc3, 0x7f, 0x1a, 0xd0, 0x96, 0xa3, + 0x09, 0x1f, 0x3b, 0x91, 0x03, 0xdb, 0xc9, 0x19, 0x0c, 0x3d, 0xcd, 0x9f, 0x4a, 0x53, 0xa3, 0xb5, + 0xf1, 0xac, 0x88, 0x2a, 0xcf, 0xc0, 0xdc, 0xfa, 0xac, 0x84, 0x08, 0x74, 0xd2, 0xa3, 0x11, 0x7a, + 0x9e, 0x6d, 0x23, 0x67, 0x16, 0x33, 0x06, 0x45, 0xd5, 0xa5, 0x5b, 0x74, 0xc5, 0xee, 0x8c, 0x3a, + 0xcf, 0xa0, 0x5b, 0xcd, 0xa8, 0x23, 0x94, 0xb1, 0x57, 0x58, 0x3f, 0xf6, 0xfb, 0x0b, 0xdc, 0x53, + 0x5e, 0x5c, 0x94, 0x83, 0x56, 0xd6, 0x74, 0x64, 0x7c, 0x52, 0x48, 0x37, 0xf6, 0xb5, 0x84, 0xb6, + 0xda, 0xc6, 0x50, 0x8e, 0x81, 0xcc, 0x37, 0xc6, 0xf8, 0xb4, 0x98, 0x72, 0xec, 0x8e, 0x40, 0x27, + 0xdd, 0x43, 0xf2, 0x78, 0xcc, 0xe9, 0x88, 0x79, 0x3c, 0xe6, 0xb5, 0x26, 0x73, 0x0b, 0xd9, 0x00, + 0x37, 0x2d, 0x04, 0x3d, 0xc9, 0x25, 0x44, 0xed, 0x3c, 0x46, 0xff, 0x76, 0xc5, 0xd8, 0xc5, 0x0a, + 0xde, 0x49, 0xbd, 0xe8, 0x28, 0x07, 0x9a, 0xec, 0x01, 0xc8, 0x78, 0x5e, 0x50, 0x3b, 0x95, 0x94, + 0xe8, 0x4a, 0x1b, 0x92, 0x52, 0x5b, 0xde, 0x86, 0xa4, 0x52, 0x0d, 0xce, 0xdc, 0x42, 0x0e, 0xb4, + 0xad, 0xd0, 0x13, 0xae, 0xa3, 0xb6, 0x80, 0x72, 0x4e, 0xaf, 0x77, 0x35, 0xe3, 0x69, 0x01, 0xcd, + 0x9b, 0xfa, 0x7e, 0x01, 0x3f, 0x36, 0xa4, 0xea, 0x79, 0x8d, 0xfd, 0x57, 0xfe, 0xc5, 0x7f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x38, 0x07, 0x4c, 0x12, 0x83, 0x10, 0x00, 0x00, } diff --git a/pkg/releaseutil/sorter.go b/pkg/releaseutil/sorter.go index 1a13298b0..977f49398 100644 --- a/pkg/releaseutil/sorter.go +++ b/pkg/releaseutil/sorter.go @@ -75,3 +75,26 @@ func SortByRevision(list []*rspb.Release) { } sort.Sort(s) } + +// SortByChartName sorts the list of releases by a +// release's chart name in lexicographical order. +func SortByChartName(list []*rspb.Release) { + s := &sorter{list: list} + s.less = func(i, j int) bool { + chi := s.list[i].Chart + chj := s.list[j].Chart + + ni := "" + if chi != nil && chi.Metadata != nil { + ni = chi.Metadata.Name + } + + nj := "" + if chj != nil && chj.Metadata != nil { + nj = chj.Metadata.Name + } + + return ni < nj + } + sort.Sort(s) +} diff --git a/pkg/releaseutil/sorter_test.go b/pkg/releaseutil/sorter_test.go index a3323bd96..4b784c0a0 100644 --- a/pkg/releaseutil/sorter_test.go +++ b/pkg/releaseutil/sorter_test.go @@ -20,6 +20,7 @@ import ( "testing" "time" + "k8s.io/helm/pkg/proto/hapi/chart" rspb "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/timeconv" ) @@ -40,6 +41,11 @@ func tsRelease(name string, vers int32, dur time.Duration, code rspb.Status_Code Name: name, Version: vers, Info: info, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{ + Name: name, + }, + }, } } @@ -80,3 +86,13 @@ func TestSortByRevision(t *testing.T) { return vi < vj }) } + +func TestSortByChartName(t *testing.T) { + SortByChartName(releases) + + check(t, "ByChartName", func(i, j int) bool { + ni := releases[i].Chart.Metadata.Name + nj := releases[j].Chart.Metadata.Name + return ni < nj + }) +} diff --git a/pkg/tiller/release_list.go b/pkg/tiller/release_list.go index 3344888dc..89f7a1100 100644 --- a/pkg/tiller/release_list.go +++ b/pkg/tiller/release_list.go @@ -65,6 +65,8 @@ func (s *ReleaseServer) ListReleases(req *services.ListReleasesRequest, stream s relutil.SortByName(rels) case services.ListSort_LAST_RELEASED: relutil.SortByDate(rels) + case services.ListSort_CHART_NAME: + relutil.SortByChartName(rels) } if req.SortOrder == services.ListSort_DESC { diff --git a/pkg/tiller/release_list_test.go b/pkg/tiller/release_list_test.go index 7b0fe6830..b9ab6fe55 100644 --- a/pkg/tiller/release_list_test.go +++ b/pkg/tiller/release_list_test.go @@ -20,6 +20,7 @@ import ( "fmt" "testing" + "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" ) @@ -147,6 +148,48 @@ func TestListReleasesSort(t *testing.T) { } } +func TestListReleasesSortByChartName(t *testing.T) { + rs := rsFixture() + + // Put them in by reverse order so that the mock doesn't "accidentally" + // sort. + num := 7 + for i := num; i > 0; i-- { + rel := releaseStub() + rel.Name = fmt.Sprintf("rel-%d", num-i) + rel.Chart = &chart.Chart{ + Metadata: &chart.Metadata{ + Name: fmt.Sprintf("chartName-%d", i), + }, + } + if err := rs.env.Releases.Create(rel); err != nil { + t.Fatalf("Could not store mock release: %s", err) + } + } + + limit := 6 + mrs := &mockListServer{} + req := &services.ListReleasesRequest{ + Offset: "", + Limit: int64(limit), + SortBy: services.ListSort_CHART_NAME, + } + if err := rs.ListReleases(req, mrs); err != nil { + t.Fatalf("Failed listing: %s", err) + } + + if len(mrs.val.Releases) != limit { + t.Errorf("Expected %d releases, got %d", limit, len(mrs.val.Releases)) + } + + for i := 0; i < limit; i++ { + n := fmt.Sprintf("chartName-%d", i+1) + if mrs.val.Releases[i].Chart.Metadata.Name != n { + t.Errorf("Expected %q, got %q", n, mrs.val.Releases[i].Chart.Metadata.Name) + } + } +} + func TestListReleasesFilter(t *testing.T) { rs := rsFixture() names := []string{ From abdd0f2f608b542d076c8b9c4395ffaac401916b Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Thu, 17 May 2018 16:50:34 -0400 Subject: [PATCH 345/449] feat(helm): added new helm notes command to display notes provided by the chart of a release Signed-off-by: Arash Deshmeh --- cmd/helm/get.go | 1 + cmd/helm/get_notes.go | 77 +++++++++++++++++++++++++++++++++++++ cmd/helm/get_notes_test.go | 52 +++++++++++++++++++++++++ docs/helm/helm.md | 2 +- docs/helm/helm_get.md | 3 +- docs/helm/helm_get_notes.md | 44 +++++++++++++++++++++ 6 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 cmd/helm/get_notes.go create mode 100644 cmd/helm/get_notes_test.go create mode 100644 docs/helm/helm_get_notes.md diff --git a/cmd/helm/get.go b/cmd/helm/get.go index 5744beb62..4170a7cef 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -75,6 +75,7 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command { cmd.AddCommand(addFlagsTLS(newGetValuesCmd(nil, out))) cmd.AddCommand(addFlagsTLS(newGetManifestCmd(nil, out))) cmd.AddCommand(addFlagsTLS(newGetHooksCmd(nil, out))) + cmd.AddCommand(addFlagsTLS(newGetNotesCmd(nil, out))) return cmd } diff --git a/cmd/helm/get_notes.go b/cmd/helm/get_notes.go new file mode 100644 index 000000000..5b1135ba5 --- /dev/null +++ b/cmd/helm/get_notes.go @@ -0,0 +1,77 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "fmt" + "io" + + "github.com/spf13/cobra" + + "k8s.io/helm/pkg/helm" +) + +var getNotesHelp = ` +This command shows notes provided by the chart of a named release. +` + +type getNotesCmd struct { + release string + out io.Writer + client helm.Interface + version int32 +} + +func newGetNotesCmd(client helm.Interface, out io.Writer) *cobra.Command { + get := &getNotesCmd{ + out: out, + client: client, + } + + cmd := &cobra.Command{ + Use: "notes [flags] RELEASE_NAME", + Short: "displays the notes of the named release", + Long: getNotesHelp, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) == 0 { + return errReleaseRequired + } + get.release = args[0] + if get.client == nil { + get.client = newClient() + } + return get.run() + }, + } + + cmd.PersistentFlags().Int32Var(&get.version, "revision", 0, "get the notes of the named release with revision") + + return cmd +} + +func (n *getNotesCmd) run() error { + res, err := n.client.ReleaseStatus(n.release, helm.StatusReleaseVersion(n.version)) + if err != nil { + return prettyError(err) + } + + if len(res.Info.Status.Notes) > 0 { + fmt.Fprintf(n.out, "NOTES:\n%s\n", res.Info.Status.Notes) + } + return nil +} diff --git a/cmd/helm/get_notes_test.go b/cmd/helm/get_notes_test.go new file mode 100644 index 000000000..de655fef3 --- /dev/null +++ b/cmd/helm/get_notes_test.go @@ -0,0 +1,52 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "io" + "testing" + + "github.com/spf13/cobra" + + "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/proto/hapi/release" +) + +func TestGetNotesCmd(t *testing.T) { + tests := []releaseCase{ + { + name: "get notes of a deployed release", + args: []string{"flummoxed-chickadee"}, + expected: "NOTES:\nrelease notes\n", + rels: []*release.Release{ + releaseMockWithStatus(&release.Status{ + Code: release.Status_DEPLOYED, + Notes: "release notes", + }), + }, + }, + { + name: "get notes requires release name arg", + err: true, + }, + } + + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newGetNotesCmd(c, out) + }) + +} diff --git a/docs/helm/helm.md b/docs/helm/helm.md index 67ac9a4a2..c1a11c4a3 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -70,4 +70,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 1-Aug-2018 +###### Auto generated by spf13/cobra on 1-Sep-2018 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index e7337b533..3b99c93d5 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -51,6 +51,7 @@ helm get [flags] RELEASE_NAME * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm get hooks](helm_get_hooks.md) - download all hooks for a named release * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release +* [helm get notes](helm_get_notes.md) - displays the notes of the named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 10-Aug-2018 +###### Auto generated by spf13/cobra on 1-Sep-2018 diff --git a/docs/helm/helm_get_notes.md b/docs/helm/helm_get_notes.md new file mode 100644 index 000000000..076aaaa59 --- /dev/null +++ b/docs/helm/helm_get_notes.md @@ -0,0 +1,44 @@ +## helm get notes + +displays the notes of the named release + +### Synopsis + + +This command shows notes provided by the chart of a named release. + + +``` +helm get notes [flags] RELEASE_NAME +``` + +### Options + +``` + -h, --help help for notes + --revision int32 get the notes of the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote +``` + +### Options inherited from parent commands + +``` + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") +``` + +### SEE ALSO + +* [helm get](helm_get.md) - download a named release + +###### Auto generated by spf13/cobra on 1-Sep-2018 From 297d942a64527a67868a7f66ce4d54d0c6dcb58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6berl?= Date: Mon, 3 Sep 2018 15:57:41 +0200 Subject: [PATCH 346/449] Set proxy for all connections, fixes #4326 (#4579) Signed-off-by: Christian Koeberl --- pkg/getter/httpgetter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index 4987e951a..66ea82863 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -83,6 +83,7 @@ func NewHTTPGetter(URL, CertFile, KeyFile, CAFile string) (*HttpGetter, error) { var client HttpGetter tr := &http.Transport{ DisableCompression: true, + Proxy: http.ProxyFromEnvironment, } if (CertFile != "" && KeyFile != "") || CAFile != "" { tlsConf, err := tlsutil.NewTLSConfig(URL, CertFile, KeyFile, CAFile) @@ -90,7 +91,6 @@ func NewHTTPGetter(URL, CertFile, KeyFile, CAFile string) (*HttpGetter, error) { return &client, fmt.Errorf("can't create TLS config: %s", err.Error()) } tr.TLSClientConfig = tlsConf - tr.Proxy = http.ProxyFromEnvironment } client.client = &http.Client{Transport: tr} return &client, nil From d27406d9d341c0ebf485f8e6d158d8f50cc7f51c Mon Sep 17 00:00:00 2001 From: Fabian Ruff Date: Tue, 4 Sep 2018 20:19:33 +0200 Subject: [PATCH 347/449] Avoid importing k8s.io/kubernetes from pkg/helm (#4499) * Avoid importing k8s.io/kubernetes from pkg/helm When writing a helm client (e.g. a helm plugin) that talks to tiller importing k8s.io/helm/pkg/helm to get the grpc client is key. This pkg should not have a dependency to the k8s.io/kubernetes to avoid pulling in a lot of code that is only used within tiller and blow up binary sizes. Signed-off-by: Fabian Ruff * Add references to pull request in errors message Signed-off-by: Fabian Ruff * copy helper function from pkg/storage/driver Signed-off-by: Fabian Ruff * Move storage errors to seperate package Signed-off-by: Fabian Ruff * Keep old error variables for backward compatibility Signed-off-by: Fabian Ruff --- cmd/helm/upgrade.go | 4 ++-- pkg/helm/fake.go | 8 ++++---- pkg/helm/helm_test.go | 14 ++++++++++++++ pkg/storage/driver/cfgmaps.go | 9 +++++---- pkg/storage/driver/driver.go | 15 +++++++-------- pkg/storage/driver/memory.go | 15 ++++++++------- pkg/storage/driver/records.go | 3 ++- pkg/storage/driver/secrets.go | 9 +++++---- pkg/storage/errors/errors.go | 27 +++++++++++++++++++++++++++ 9 files changed, 74 insertions(+), 30 deletions(-) create mode 100644 pkg/storage/errors/errors.go diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index a602a7000..4f443aaaa 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -26,7 +26,7 @@ import ( "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/renderutil" - "k8s.io/helm/pkg/storage/driver" + storageerrors "k8s.io/helm/pkg/storage/errors" ) const upgradeDesc = ` @@ -207,7 +207,7 @@ func (u *upgradeCmd) run() error { } } - if err != nil && strings.Contains(err.Error(), driver.ErrReleaseNotFound(u.release).Error()) { + if err != nil && strings.Contains(err.Error(), storageerrors.ErrReleaseNotFound(u.release).Error()) { fmt.Fprintf(u.out, "Release %q does not exist. Installing it now.\n", u.release) ic := &installCmd{ chartPath: chartPath, diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index ffb5b40c9..46be7d398 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -31,7 +31,7 @@ import ( rls "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/proto/hapi/version" "k8s.io/helm/pkg/renderutil" - storage "k8s.io/helm/pkg/storage/driver" + storageerrors "k8s.io/helm/pkg/storage/errors" ) // FakeClient implements Interface @@ -138,7 +138,7 @@ func (c *FakeClient) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.U } } - return nil, storage.ErrReleaseNotFound(rlsName) + return nil, storageerrors.ErrReleaseNotFound(rlsName) } // GetVersion returns a fake version @@ -212,7 +212,7 @@ func (c *FakeClient) ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.G }, nil } } - return nil, storage.ErrReleaseNotFound(rlsName) + return nil, storageerrors.ErrReleaseNotFound(rlsName) } // ReleaseContent returns the configuration for the matching release name in the fake release client. @@ -224,7 +224,7 @@ func (c *FakeClient) ReleaseContent(rlsName string, opts ...ContentOption) (resp }, nil } } - return resp, storage.ErrReleaseNotFound(rlsName) + return resp, storageerrors.ErrReleaseNotFound(rlsName) } // ReleaseHistory returns a release's revision history. diff --git a/pkg/helm/helm_test.go b/pkg/helm/helm_test.go index fe7150cc0..7fb794f54 100644 --- a/pkg/helm/helm_test.go +++ b/pkg/helm/helm_test.go @@ -18,8 +18,10 @@ package helm // import "k8s.io/helm/pkg/helm" import ( "errors" + "os/exec" "path/filepath" "reflect" + "strings" "testing" "github.com/golang/protobuf/proto" @@ -361,3 +363,15 @@ func loadChart(t *testing.T, name string) *cpb.Chart { } return c } + +func TestDoesNotImportKubernetes(t *testing.T) { + cmd := exec.Command("go", "list", "-f", "{{.Deps}}", ".") + output, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("Failed to execute %s %s: %s", cmd.Path, strings.Join(cmd.Args, " "), err) + } + + if strings.Contains(string(output), "k8s.io/kubernetes") { + t.Fatal("k8s.io/helm/pkg/helm contains a dependency on k8s.io/kubernetes. See https://github.com/helm/helm/pull/4499 for more details.") + } +} diff --git a/pkg/storage/driver/cfgmaps.go b/pkg/storage/driver/cfgmaps.go index 3f5ee204a..a534b67ac 100644 --- a/pkg/storage/driver/cfgmaps.go +++ b/pkg/storage/driver/cfgmaps.go @@ -30,6 +30,7 @@ import ( "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) var _ Driver = (*ConfigMaps)(nil) @@ -65,7 +66,7 @@ func (cfgmaps *ConfigMaps) Get(key string) (*rspb.Release, error) { obj, err := cfgmaps.impl.Get(key, metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { - return nil, ErrReleaseNotFound(key) + return nil, storageerrors.ErrReleaseNotFound(key) } cfgmaps.Log("get: failed to get %q: %s", key, err) @@ -131,7 +132,7 @@ func (cfgmaps *ConfigMaps) Query(labels map[string]string) ([]*rspb.Release, err } if len(list.Items) == 0 { - return nil, ErrReleaseNotFound(labels["NAME"]) + return nil, storageerrors.ErrReleaseNotFound(labels["NAME"]) } var results []*rspb.Release @@ -164,7 +165,7 @@ func (cfgmaps *ConfigMaps) Create(key string, rls *rspb.Release) error { // push the configmap object out into the kubiverse if _, err := cfgmaps.impl.Create(obj); err != nil { if apierrors.IsAlreadyExists(err) { - return ErrReleaseExists(key) + return storageerrors.ErrReleaseExists(key) } cfgmaps.Log("create: failed to create: %s", err) @@ -202,7 +203,7 @@ func (cfgmaps *ConfigMaps) Delete(key string) (rls *rspb.Release, err error) { // fetch the release to check existence if rls, err = cfgmaps.Get(key); err != nil { if apierrors.IsNotFound(err) { - return nil, ErrReleaseExists(rls.Name) + return nil, storageerrors.ErrReleaseExists(rls.Name) } cfgmaps.Log("delete: failed to get release %q: %s", key, err) diff --git a/pkg/storage/driver/driver.go b/pkg/storage/driver/driver.go index d8c4122b5..3bcbd4a7e 100644 --- a/pkg/storage/driver/driver.go +++ b/pkg/storage/driver/driver.go @@ -17,18 +17,17 @@ limitations under the License. package driver // import "k8s.io/helm/pkg/storage/driver" import ( - "fmt" - rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) var ( - // ErrReleaseNotFound indicates that a release is not found. - ErrReleaseNotFound = func(release string) error { return fmt.Errorf("release: %q not found", release) } - // ErrReleaseExists indicates that a release already exists. - ErrReleaseExists = func(release string) error { return fmt.Errorf("release: %q already exists", release) } - // ErrInvalidKey indicates that a release key could not be parsed. - ErrInvalidKey = func(release string) error { return fmt.Errorf("release: %q invalid key", release) } + // ErrReleaseNotFound has been deprecated; please use storageerrors.ErrReleaseNotFound instead. + ErrReleaseNotFound = storageerrors.ErrReleaseNotFound + // ErrReleaseExists has been deprecated; please use storageerrors.ErrReleaseExists instead. + ErrReleaseExists = storageerrors.ErrReleaseExists + // ErrInvalidKey has been deprecated; please use storageerrors.ErrInvalidKey instead. + ErrInvalidKey = storageerrors.ErrInvalidKey ) // Creator is the interface that wraps the Create method. diff --git a/pkg/storage/driver/memory.go b/pkg/storage/driver/memory.go index ea3faf26b..700b87e08 100644 --- a/pkg/storage/driver/memory.go +++ b/pkg/storage/driver/memory.go @@ -22,6 +22,7 @@ import ( "sync" rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) var _ Driver = (*Memory)(nil) @@ -53,16 +54,16 @@ func (mem *Memory) Get(key string) (*rspb.Release, error) { case 2: name, ver := elems[0], elems[1] if _, err := strconv.Atoi(ver); err != nil { - return nil, ErrInvalidKey(key) + return nil, storageerrors.ErrInvalidKey(key) } if recs, ok := mem.cache[name]; ok { if r := recs.Get(key); r != nil { return r.rls, nil } } - return nil, ErrReleaseNotFound(key) + return nil, storageerrors.ErrReleaseNotFound(key) default: - return nil, ErrInvalidKey(key) + return nil, storageerrors.ErrInvalidKey(key) } } @@ -131,7 +132,7 @@ func (mem *Memory) Update(key string, rls *rspb.Release) error { rs.Replace(key, newRecord(key, rls)) return nil } - return ErrReleaseNotFound(rls.Name) + return storageerrors.ErrReleaseNotFound(rls.Name) } // Delete deletes a release or returns ErrReleaseNotFound. @@ -141,12 +142,12 @@ func (mem *Memory) Delete(key string) (*rspb.Release, error) { elems := strings.Split(key, ".v") if len(elems) != 2 { - return nil, ErrInvalidKey(key) + return nil, storageerrors.ErrInvalidKey(key) } name, ver := elems[0], elems[1] if _, err := strconv.Atoi(ver); err != nil { - return nil, ErrInvalidKey(key) + return nil, storageerrors.ErrInvalidKey(key) } if recs, ok := mem.cache[name]; ok { if r := recs.Remove(key); r != nil { @@ -155,7 +156,7 @@ func (mem *Memory) Delete(key string) (*rspb.Release, error) { return r.rls, nil } } - return nil, ErrReleaseNotFound(key) + return nil, storageerrors.ErrReleaseNotFound(key) } // wlock locks mem for writing diff --git a/pkg/storage/driver/records.go b/pkg/storage/driver/records.go index bc793d8b3..56d7d694f 100644 --- a/pkg/storage/driver/records.go +++ b/pkg/storage/driver/records.go @@ -23,6 +23,7 @@ import ( "github.com/golang/protobuf/proto" rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) // records holds a list of in-memory release records @@ -38,7 +39,7 @@ func (rs *records) Add(r *record) error { } if rs.Exists(r.key) { - return ErrReleaseExists(r.key) + return storageerrors.ErrReleaseExists(r.key) } *rs = append(*rs, r) diff --git a/pkg/storage/driver/secrets.go b/pkg/storage/driver/secrets.go index 1b8064e53..328da20c4 100644 --- a/pkg/storage/driver/secrets.go +++ b/pkg/storage/driver/secrets.go @@ -30,6 +30,7 @@ import ( "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) var _ Driver = (*Secrets)(nil) @@ -65,7 +66,7 @@ func (secrets *Secrets) Get(key string) (*rspb.Release, error) { obj, err := secrets.impl.Get(key, metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { - return nil, ErrReleaseNotFound(key) + return nil, storageerrors.ErrReleaseNotFound(key) } secrets.Log("get: failed to get %q: %s", key, err) @@ -131,7 +132,7 @@ func (secrets *Secrets) Query(labels map[string]string) ([]*rspb.Release, error) } if len(list.Items) == 0 { - return nil, ErrReleaseNotFound(labels["NAME"]) + return nil, storageerrors.ErrReleaseNotFound(labels["NAME"]) } var results []*rspb.Release @@ -164,7 +165,7 @@ func (secrets *Secrets) Create(key string, rls *rspb.Release) error { // push the secret object out into the kubiverse if _, err := secrets.impl.Create(obj); err != nil { if apierrors.IsAlreadyExists(err) { - return ErrReleaseExists(rls.Name) + return storageerrors.ErrReleaseExists(rls.Name) } secrets.Log("create: failed to create: %s", err) @@ -202,7 +203,7 @@ func (secrets *Secrets) Delete(key string) (rls *rspb.Release, err error) { // fetch the release to check existence if rls, err = secrets.Get(key); err != nil { if apierrors.IsNotFound(err) { - return nil, ErrReleaseExists(rls.Name) + return nil, storageerrors.ErrReleaseExists(rls.Name) } secrets.Log("delete: failed to get release %q: %s", key, err) diff --git a/pkg/storage/errors/errors.go b/pkg/storage/errors/errors.go new file mode 100644 index 000000000..38662d1ca --- /dev/null +++ b/pkg/storage/errors/errors.go @@ -0,0 +1,27 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package errors // import "k8s.io/helm/pkg/storage/errors" +import "fmt" + +var ( + // ErrReleaseNotFound indicates that a release is not found. + ErrReleaseNotFound = func(release string) error { return fmt.Errorf("release: %q not found", release) } + // ErrReleaseExists indicates that a release already exists. + ErrReleaseExists = func(release string) error { return fmt.Errorf("release: %q already exists", release) } + // ErrInvalidKey indicates that a release key could not be parsed. + ErrInvalidKey = func(release string) error { return fmt.Errorf("release: %q invalid key", release) } +) From 4648afc7c0c2da99503ab331db7249301e9837d4 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 7 Sep 2018 12:22:12 -0700 Subject: [PATCH 348/449] fix(release_server): handle the case when requested values is empty (#4604) Signed-off-by: Matthew Fisher --- pkg/tiller/release_server.go | 6 +++++- pkg/tiller/release_update_test.go | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index e847c63fc..e913579aa 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -139,7 +139,11 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current // merge new values with current if current.Config != nil && current.Config.Raw != "" && current.Config.Raw != "{}\n" { - req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw + if req.Values.Raw != "{}\n" { + req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw + } else { + req.Values.Raw = current.Config.Raw + "\n" + } } req.Chart.Values = &chart.Config{Raw: nv} diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 5edd53b82..1f189a8b7 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -159,12 +159,11 @@ func TestUpdateRelease_ReuseValuesWithNoValues(t *testing.T) { {Name: "templates/hello", Data: []byte("hello: world")}, }, }, - Values: &chart.Config{Raw: ""}, + Values: &chart.Config{Raw: "{}\n"}, ReuseValues: true, } - _, err = rs.UpdateRelease(c, req) - if err != nil { + if _, err := rs.UpdateRelease(c, req); err != nil { t.Fatalf("Failed updated: %s", err) } } From dae0d43e76fd6181a28855292ed7e2ac40e6923f Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 7 Sep 2018 13:23:40 -0700 Subject: [PATCH 349/449] allow settings TLS flags from environment variables (#4590) Signed-off-by: Matthew Fisher --- cmd/helm/delete.go | 1 + cmd/helm/get.go | 14 +-- cmd/helm/get_hooks.go | 4 +- cmd/helm/get_manifest.go | 4 +- cmd/helm/get_notes.go | 4 +- cmd/helm/get_values.go | 6 +- cmd/helm/helm.go | 52 ++++-------- cmd/helm/history.go | 1 + cmd/helm/install.go | 1 + cmd/helm/list.go | 1 + cmd/helm/release_testing.go | 1 + cmd/helm/reset.go | 1 + cmd/helm/rollback.go | 1 + cmd/helm/status.go | 6 +- cmd/helm/upgrade.go | 1 + cmd/helm/version.go | 1 + docs/helm/helm.md | 7 +- pkg/helm/environment/environment.go | 69 ++++++++++++--- pkg/helm/environment/environment_test.go | 103 +++++++++++++++-------- 19 files changed, 184 insertions(+), 94 deletions(-) diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go index ad7c6049a..b78956ab6 100755 --- a/cmd/helm/delete.go +++ b/cmd/helm/delete.go @@ -78,6 +78,7 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVar(&del.dryRun, "dry-run", false, "simulate a delete") f.BoolVar(&del.disableHooks, "no-hooks", false, "prevent hooks from running during deletion") f.BoolVar(&del.purge, "purge", false, "remove the release from the store and make its name free for later use") diff --git a/cmd/helm/get.go b/cmd/helm/get.go index 4170a7cef..719e0779d 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -70,12 +70,14 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision") - - cmd.AddCommand(addFlagsTLS(newGetValuesCmd(nil, out))) - cmd.AddCommand(addFlagsTLS(newGetManifestCmd(nil, out))) - cmd.AddCommand(addFlagsTLS(newGetHooksCmd(nil, out))) - cmd.AddCommand(addFlagsTLS(newGetNotesCmd(nil, out))) + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&get.version, "revision", 0, "get the named release with revision") + + cmd.AddCommand(newGetValuesCmd(nil, out)) + cmd.AddCommand(newGetManifestCmd(nil, out)) + cmd.AddCommand(newGetHooksCmd(nil, out)) + cmd.AddCommand(newGetNotesCmd(nil, out)) return cmd } diff --git a/cmd/helm/get_hooks.go b/cmd/helm/get_hooks.go index 9192db998..1f288245d 100644 --- a/cmd/helm/get_hooks.go +++ b/cmd/helm/get_hooks.go @@ -57,7 +57,9 @@ func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command { return ghc.run() }, } - cmd.Flags().Int32Var(&ghc.version, "revision", 0, "get the named release with revision") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&ghc.version, "revision", 0, "get the named release with revision") return cmd } diff --git a/cmd/helm/get_manifest.go b/cmd/helm/get_manifest.go index f4ae11e58..206c9d295 100644 --- a/cmd/helm/get_manifest.go +++ b/cmd/helm/get_manifest.go @@ -60,7 +60,9 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&get.version, "revision", 0, "get the named release with revision") return cmd } diff --git a/cmd/helm/get_notes.go b/cmd/helm/get_notes.go index 5b1135ba5..eaa3bc815 100644 --- a/cmd/helm/get_notes.go +++ b/cmd/helm/get_notes.go @@ -59,7 +59,9 @@ func newGetNotesCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.PersistentFlags().Int32Var(&get.version, "revision", 0, "get the notes of the named release with revision") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&get.version, "revision", 0, "get the notes of the named release with revision") return cmd } diff --git a/cmd/helm/get_values.go b/cmd/helm/get_values.go index 12a48f1da..a4f4fc283 100644 --- a/cmd/helm/get_values.go +++ b/cmd/helm/get_values.go @@ -58,8 +58,10 @@ func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision") - cmd.Flags().BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&get.version, "revision", 0, "get the named release with revision") + f.BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values") return cmd } diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 6cb1c78ea..75fa2dc38 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -47,10 +47,6 @@ var ( tlsVerify bool // enable TLS and verify remote certificates tlsEnable bool // enable TLS - tlsCaCertDefault = "$HELM_HOME/ca.pem" - tlsCertDefault = "$HELM_HOME/cert.pem" - tlsKeyDefault = "$HELM_HOME/key.pem" - tillerTunnel *kube.Tunnel settings helm_env.EnvSettings ) @@ -77,6 +73,11 @@ Environment: $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") + $HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem") + $HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem") + $HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem") + $HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false") + $HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default "false") ` func newRootCmd(args []string) *cobra.Command { @@ -114,18 +115,18 @@ func newRootCmd(args []string) *cobra.Command { newVerifyCmd(out), // release commands - addFlagsTLS(newDeleteCmd(nil, out)), - addFlagsTLS(newGetCmd(nil, out)), - addFlagsTLS(newHistoryCmd(nil, out)), - addFlagsTLS(newInstallCmd(nil, out)), - addFlagsTLS(newListCmd(nil, out)), - addFlagsTLS(newRollbackCmd(nil, out)), - addFlagsTLS(newStatusCmd(nil, out)), - addFlagsTLS(newUpgradeCmd(nil, out)), - - addFlagsTLS(newReleaseTestCmd(nil, out)), - addFlagsTLS(newResetCmd(nil, out)), - addFlagsTLS(newVersionCmd(nil, out)), + newDeleteCmd(nil, out), + newGetCmd(nil, out), + newHistoryCmd(nil, out), + newInstallCmd(nil, out), + newListCmd(nil, out), + newRollbackCmd(nil, out), + newStatusCmd(nil, out), + newUpgradeCmd(nil, out), + + newReleaseTestCmd(nil, out), + newResetCmd(nil, out), + newVersionCmd(nil, out), newCompletionCmd(out), newHomeCmd(out), @@ -142,9 +143,6 @@ func newRootCmd(args []string) *cobra.Command { flags.Parse(args) - // set defaults from environment - settings.Init(flags) - // Find and add plugins loadPlugins(cmd, out) @@ -276,7 +274,7 @@ func ensureHelmClient(h helm.Interface) helm.Interface { func newClient() helm.Interface { options := []helm.Option{helm.Host(settings.TillerHost), helm.ConnectTimeout(settings.TillerConnectionTimeout)} - if tlsVerify || tlsEnable { + if settings.TLSVerify || settings.TLSEnable { if tlsCaCertFile == "" { tlsCaCertFile = settings.Home.TLSCaCert() } @@ -306,17 +304,3 @@ func newClient() helm.Interface { } return helm.NewClient(options...) } - -// addFlagsTLS adds the flags for supporting client side TLS to the -// helm command (only those that invoke communicate to Tiller.) -func addFlagsTLS(cmd *cobra.Command) *cobra.Command { - - // add flags - cmd.Flags().StringVar(&tlsServerName, "tls-hostname", settings.TillerHost, "the server name used to verify the hostname on the returned certificates from the server") - cmd.Flags().StringVar(&tlsCaCertFile, "tls-ca-cert", tlsCaCertDefault, "path to TLS CA certificate file") - cmd.Flags().StringVar(&tlsCertFile, "tls-cert", tlsCertDefault, "path to TLS certificate file") - cmd.Flags().StringVar(&tlsKeyFile, "tls-key", tlsKeyDefault, "path to TLS key file") - cmd.Flags().BoolVar(&tlsVerify, "tls-verify", false, "enable TLS for request and verify remote") - cmd.Flags().BoolVar(&tlsEnable, "tls", false, "enable TLS for request") - return cmd -} diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 6e0b48d33..51bc34e75 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -88,6 +88,7 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.Int32Var(&his.max, "max", 256, "maximum number of revision to include in history") f.UintVar(&his.colWidth, "col-width", 60, "specifies the max column width of output") f.StringVarP(&his.outputFormat, "output", "o", "table", "prints the output in the specified format (json|table|yaml)") diff --git a/cmd/helm/install.go b/cmd/helm/install.go index adc8ba759..a39e76434 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -193,6 +193,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.VarP(&inst.valueFiles, "values", "f", "specify values in a YAML file or a URL(can specify multiple)") f.StringVarP(&inst.name, "name", "n", "", "release name. If unspecified, it will autogenerate one for you") f.StringVar(&inst.namespace, "namespace", "", "namespace to install the release into. Defaults to the current kube config namespace.") diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 4467b6ec7..384fca619 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -120,6 +120,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVarP(&list.short, "short", "q", false, "output short (quiet) listing format") f.BoolVarP(&list.byDate, "date", "d", false, "sort by release date") f.BoolVarP(&list.sortDesc, "reverse", "r", false, "reverse the sort order") diff --git a/cmd/helm/release_testing.go b/cmd/helm/release_testing.go index 0c9debb3f..c7231cf04 100644 --- a/cmd/helm/release_testing.go +++ b/cmd/helm/release_testing.go @@ -64,6 +64,7 @@ func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.Int64Var(&rlsTest.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&rlsTest.cleanup, "cleanup", false, "delete test pods upon completion") diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index 5b0914e82..ffae0a613 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -77,6 +77,7 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVarP(&d.force, "force", "f", false, "forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.)") f.BoolVar(&d.removeHelmHome, "remove-helm-home", false, "if set deletes $HELM_HOME") diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index 8e97ee6a9..9798abf87 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -78,6 +78,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVar(&rollback.dryRun, "dry-run", false, "simulate a rollback") f.BoolVar(&rollback.recreate, "recreate-pods", false, "performs pods restart for the resource if applicable") f.BoolVar(&rollback.force, "force", false, "force resource update through delete/recreate if needed") diff --git a/cmd/helm/status.go b/cmd/helm/status.go index be057a28e..fe53081a4 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -76,8 +76,10 @@ func newStatusCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.PersistentFlags().Int32Var(&status.version, "revision", 0, "if set, display the status of the named release with revision") - cmd.PersistentFlags().StringVarP(&status.outfmt, "output", "o", "", "output the status in the specified format (json or yaml)") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&status.version, "revision", 0, "if set, display the status of the named release with revision") + f.StringVarP(&status.outfmt, "output", "o", "", "output the status in the specified format (json or yaml)") return cmd } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 4f443aaaa..b1bca898a 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -147,6 +147,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.VarP(&upgrade.valueFiles, "values", "f", "specify values in a YAML file or a URL(can specify multiple)") f.BoolVar(&upgrade.dryRun, "dry-run", false, "simulate an upgrade") f.BoolVar(&upgrade.recreate, "recreate-pods", false, "performs pods restart for the resource if applicable") diff --git a/cmd/helm/version.go b/cmd/helm/version.go index 922e744b2..e0d9e5e73 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -77,6 +77,7 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { }, } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVarP(&version.showClient, "client", "c", false, "client version only") f.BoolVarP(&version.showServer, "server", "s", false, "server version only") f.BoolVar(&version.short, "short", false, "print the version number") diff --git a/docs/helm/helm.md b/docs/helm/helm.md index c1a11c4a3..136721c36 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -26,6 +26,11 @@ Environment: $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") + $HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem") + $HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem") + $HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem") + $HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false") + $HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default "false") ### Options @@ -70,4 +75,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 1-Sep-2018 +###### Auto generated by spf13/cobra on 4-Sep-2018 diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index 4241bbb8a..05d955d69 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -32,6 +32,19 @@ import ( "k8s.io/helm/pkg/helm/helmpath" ) +const ( + // DefaultTLSCaCert is the default value for HELM_TLS_CA_CERT + DefaultTLSCaCert = "$HELM_HOME/ca.pem" + // DefaultTLSCert is the default value for HELM_TLS_CERT + DefaultTLSCert = "$HELM_HOME/cert.pem" + // DefaultTLSKeyFile is the default value for HELM_TLS_KEY_FILE + DefaultTLSKeyFile = "$HELM_HOME/key.pem" + // DefaultTLSEnable is the default value for HELM_TLS_ENABLE + DefaultTLSEnable = false + // DefaultTLSVerify is the default value for HELM_TLS_VERIFY + DefaultTLSVerify = false +) + // DefaultHelmHome is the default HELM_HOME. var DefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm") @@ -39,7 +52,7 @@ var DefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm") type EnvSettings struct { // TillerHost is the host and port of Tiller. TillerHost string - // TillerConnectionTimeout is the duration (in seconds) helm will wait to establish a connection to tiller. + // TillerConnectionTimeout is the duration (in seconds) helm will wait to establish a connection to Tiller. TillerConnectionTimeout int64 // TillerNamespace is the namespace in which Tiller runs. TillerNamespace string @@ -51,6 +64,18 @@ type EnvSettings struct { KubeContext string // KubeConfig is the path to an explicit kubeconfig file. This overwrites the value in $KUBECONFIG KubeConfig string + // TLSEnable tells helm to communicate with Tiller via TLS + TLSEnable bool + // TLSVerify tells helm to communicate with Tiller via TLS and to verify remote certificates served by Tiller + TLSVerify bool + // TLSServerName tells helm to verify the hostname on the returned certificates from Tiller + TLSServerName string + // TLSCaCertFile is the path to a TLS CA certificate file + TLSCaCertFile string + // TLSCertFile is the path to a TLS certificate file + TLSCertFile string + // TLSKeyFile is the path to a TLS key file + TLSKeyFile string } // AddFlags binds flags to the given flagset. @@ -62,15 +87,45 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&s.Debug, "debug", false, "enable verbose output") fs.StringVar(&s.TillerNamespace, "tiller-namespace", "kube-system", "namespace of Tiller") fs.Int64Var(&s.TillerConnectionTimeout, "tiller-connection-timeout", int64(300), "the duration (in seconds) Helm will wait to establish a connection to tiller") + + envMap := map[string]string{ + "debug": "HELM_DEBUG", + "home": "HELM_HOME", + "host": "HELM_HOST", + "tiller-namespace": "TILLER_NAMESPACE", + } + + for name, envar := range envMap { + setFlagFromEnv(name, envar, fs) + } } -// Init sets values from the environment. -func (s *EnvSettings) Init(fs *pflag.FlagSet) { +// AddFlagsTLS adds the flags for supporting client side TLS to the given flagset. +func (s *EnvSettings) AddFlagsTLS(fs *pflag.FlagSet) { + fs.StringVar(&s.TLSServerName, "tls-hostname", s.TillerHost, "the server name used to verify the hostname on the returned certificates from the server") + fs.StringVar(&s.TLSCaCertFile, "tls-ca-cert", DefaultTLSCaCert, "path to TLS CA certificate file") + fs.StringVar(&s.TLSCertFile, "tls-cert", DefaultTLSCert, "path to TLS certificate file") + fs.StringVar(&s.TLSKeyFile, "tls-key", DefaultTLSKeyFile, "path to TLS key file") + fs.BoolVar(&s.TLSVerify, "tls-verify", DefaultTLSVerify, "enable TLS for request and verify remote") + fs.BoolVar(&s.TLSEnable, "tls", DefaultTLSEnable, "enable TLS for request") + + envMap := map[string]string{ + "tls-hostname": "HELM_TLS_HOSTNAME", + "tls-ca-cert": "HELM_TLS_CA_CERT", + "tls-cert": "HELM_TLS_CERT", + "tls-key": "HELM_TLS_KEY", + "tls-verify": "HELM_TLS_VERIFY", + "tls": "HELM_TLS_ENABLE", + } + for name, envar := range envMap { setFlagFromEnv(name, envar, fs) } } +// Init is deprecated; calling `.AddFlags` or `.AddFlagsTLS` directly will set the flags to their default values from the environment, so this is a no-op. +func (s *EnvSettings) Init(fs *pflag.FlagSet) {} + // PluginDirs is the path to the plugin directories. func (s EnvSettings) PluginDirs() string { if d, ok := os.LookupEnv("HELM_PLUGIN"); ok { @@ -79,14 +134,6 @@ func (s EnvSettings) PluginDirs() string { return s.Home.Plugins() } -// envMap maps flag names to envvars -var envMap = map[string]string{ - "debug": "HELM_DEBUG", - "home": "HELM_HOME", - "host": "HELM_HOST", - "tiller-namespace": "TILLER_NAMESPACE", -} - func setFlagFromEnv(name, envar string, fs *pflag.FlagSet) { if fs.Changed(name) { return diff --git a/pkg/helm/environment/environment_test.go b/pkg/helm/environment/environment_test.go index 35958e791..fb05254ed 100644 --- a/pkg/helm/environment/environment_test.go +++ b/pkg/helm/environment/environment_test.go @@ -36,49 +36,78 @@ func TestEnvSettings(t *testing.T) { // expected values home, host, ns, kcontext, kconfig, plugins string - debug bool + debug, tlsverify bool }{ { - name: "defaults", - args: []string{}, - home: DefaultHelmHome, - plugins: helmpath.Home(DefaultHelmHome).Plugins(), - ns: "kube-system", + name: "defaults", + args: []string{}, + home: DefaultHelmHome, + plugins: helmpath.Home(DefaultHelmHome).Plugins(), + ns: "kube-system", + tlsverify: false, }, { - name: "with flags set", - args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns", "--kubeconfig", "/bar"}, - home: "/foo", - plugins: helmpath.Home("/foo").Plugins(), - host: "here", - ns: "myns", - kconfig: "/bar", - debug: true, + name: "with flags set", + args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns", "--kubeconfig", "/bar"}, + home: "/foo", + plugins: helmpath.Home("/foo").Plugins(), + host: "here", + ns: "myns", + kconfig: "/bar", + debug: true, + tlsverify: false, }, { - name: "with envvars set", - args: []string{}, - envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns"}, - home: "/bar", - plugins: helmpath.Home("/bar").Plugins(), - host: "there", - ns: "yourns", - debug: true, + name: "with envvars set", + args: []string{}, + envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns"}, + home: "/bar", + plugins: helmpath.Home("/bar").Plugins(), + host: "there", + ns: "yourns", + debug: true, + tlsverify: false, }, { - name: "with flags and envvars set", - args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns"}, - envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns", "HELM_PLUGIN": "glade"}, - home: "/foo", - plugins: "glade", - host: "here", - ns: "myns", - debug: true, + name: "with TLS envvars set", + args: []string{}, + envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns", "HELM_TLS_VERIFY": "1"}, + home: "/bar", + plugins: helmpath.Home("/bar").Plugins(), + host: "there", + ns: "yourns", + debug: true, + tlsverify: true, + }, + { + name: "with flags and envvars set", + args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns"}, + envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns", "HELM_PLUGIN": "glade"}, + home: "/foo", + plugins: "glade", + host: "here", + ns: "myns", + debug: true, + tlsverify: false, }, } - cleanup := resetEnv() - defer cleanup() + allEnvvars := map[string]string{ + "HELM_DEBUG": "", + "HELM_HOME": "", + "HELM_HOST": "", + "TILLER_NAMESPACE": "", + "HELM_PLUGIN": "", + "HELM_TLS_HOSTNAME": "", + "HELM_TLS_CA_CERT": "", + "HELM_TLS_CERT": "", + "HELM_TLS_KEY": "", + "HELM_TLS_VERIFY": "", + "HELM_TLS_ENABLE": "", + } + + resetEnv(allEnvvars) + defer resetEnv(allEnvvars) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -90,6 +119,7 @@ func TestEnvSettings(t *testing.T) { settings := &EnvSettings{} settings.AddFlags(flags) + settings.AddFlagsTLS(flags) flags.Parse(tt.args) settings.Init(flags) @@ -115,17 +145,20 @@ func TestEnvSettings(t *testing.T) { if settings.KubeConfig != tt.kconfig { t.Errorf("expected kubeconfig %q, got %q", tt.kconfig, settings.KubeConfig) } + if settings.TLSVerify != tt.tlsverify { + t.Errorf("expected tls-verify %t, got %t", tt.tlsverify, settings.TLSVerify) + } - cleanup() + resetEnv(tt.envars) }) } } -func resetEnv() func() { +func resetEnv(envars map[string]string) func() { origEnv := os.Environ() // ensure any local envvars do not hose us - for _, e := range envMap { + for e := range envars { os.Unsetenv(e) } From b84f5b53ebc4909f934fe029b3d570db3d809fa8 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 7 Sep 2018 13:24:10 -0700 Subject: [PATCH 350/449] introduce `helm init --automount-service-account-token` (#4589) Signed-off-by: Matthew Fisher --- cmd/helm/init.go | 1 + cmd/helm/installer/install.go | 3 +- cmd/helm/installer/install_test.go | 15 ++++++++- cmd/helm/installer/options.go | 3 ++ docs/helm/helm_init.md | 51 +++++++++++++++--------------- docs/install.md | 1 + 6 files changed, 47 insertions(+), 27 deletions(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 630847f3b..425c10074 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -139,6 +139,7 @@ func newInitCmd(out io.Writer) *cobra.Command { f.StringVar(&i.opts.NodeSelectors, "node-selectors", "", "labels to specify the node on which Tiller is installed (app=tiller,helm=rocks)") f.VarP(&i.opts.Output, "output", "o", "skip installation and output Tiller's manifest in specified format (json or yaml)") f.StringArrayVar(&i.opts.Values, "override", []string{}, "override values for the Tiller Deployment manifest (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.BoolVar(&i.opts.AutoMountServiceAccountToken, "automount-service-account-token", true, "auto-mount the given service account to tiller") return cmd } diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index 055601440..c9ba1b0ca 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -218,7 +218,8 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { Labels: labels, }, Spec: v1.PodSpec{ - ServiceAccountName: opts.ServiceAccount, + ServiceAccountName: opts.ServiceAccount, + AutomountServiceAccountToken: &opts.AutoMountServiceAccountToken, Containers: []v1.Container{ { Name: "tiller", diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index d5f3dfec0..561b3ed6d 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -80,7 +80,8 @@ func TestDeploymentForServiceAccount(t *testing.T) { {"withoutSA", "", false, "gcr.io/kubernetes-helm/tiller:latest", "IfNotPresent", ""}, } for _, tt := range tests { - d, err := Deployment(&Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary, ServiceAccount: tt.serviceAccount}) + opts := &Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary, ServiceAccount: tt.serviceAccount} + d, err := Deployment(opts) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } @@ -88,6 +89,18 @@ func TestDeploymentForServiceAccount(t *testing.T) { if got := d.Spec.Template.Spec.ServiceAccountName; got != tt.serviceAccount { t.Errorf("%s: expected service account value %q, got %q", tt.name, tt.serviceAccount, got) } + if got := *d.Spec.Template.Spec.AutomountServiceAccountToken; got != false { + t.Errorf("%s: expected AutomountServiceAccountToken = %t, got %t", tt.name, false, got) + } + + opts.AutoMountServiceAccountToken = true + d, err = Deployment(opts) + if err != nil { + t.Fatalf("%s: error %q", tt.name, err) + } + if got := *d.Spec.Template.Spec.AutomountServiceAccountToken; got != true { + t.Errorf("%s: expected AutomountServiceAccountToken = %t, got %t", tt.name, true, got) + } } } diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index 95aa3988d..729bdf20b 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -47,6 +47,9 @@ type Options struct { // ServiceAccount is the Kubernetes service account to add to Tiller. ServiceAccount string + // AutoMountServiceAccountToken determines whether or not the service account should be added to Tiller. + AutoMountServiceAccountToken bool + // Force allows to force upgrading tiller if deployed version is greater than current version ForceUpgrade bool diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index f1aad3159..72fd9e86b 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -32,30 +32,31 @@ helm init [flags] ### Options ``` - --canary-image use the canary Tiller image - -c, --client-only if set does not install Tiller - --dry-run do not install local or remote - --force-upgrade force upgrade of Tiller to the current helm version - -h, --help help for init - --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") - --net-host install Tiller with net=host - --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) - --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) - --service-account string name of service account - --skip-refresh do not refresh (download) the local repository cache - --stable-repo-url string URL for stable repository (default "https://kubernetes-charts.storage.googleapis.com") - -i, --tiller-image string override Tiller image - --tiller-tls install Tiller with TLS enabled - --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-key string path to TLS key file to install with Tiller - --tiller-tls-verify install Tiller with TLS enabled and to verify remote certificates - --tls-ca-cert string path to CA root certificate - --upgrade upgrade if Tiller is already installed - --wait block until Tiller is running and ready to receive requests + --automount-service-account-token auto-mount the given service account to tiller (default true) + --canary-image use the canary Tiller image + -c, --client-only if set does not install Tiller + --dry-run do not install local or remote + --force-upgrade force upgrade of Tiller to the current helm version + -h, --help help for init + --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") + --net-host install Tiller with net=host + --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) + --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) + --service-account string name of service account + --skip-refresh do not refresh (download) the local repository cache + --stable-repo-url string URL for stable repository (default "https://kubernetes-charts.storage.googleapis.com") + -i, --tiller-image string override Tiller image + --tiller-tls install Tiller with TLS enabled + --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-key string path to TLS key file to install with Tiller + --tiller-tls-verify install Tiller with TLS enabled and to verify remote certificates + --tls-ca-cert string path to CA root certificate + --upgrade upgrade if Tiller is already installed + --wait block until Tiller is running and ready to receive requests ``` ### Options inherited from parent commands @@ -74,4 +75,4 @@ helm init [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 1-Sep-2018 +###### Auto generated by spf13/cobra on 4-Sep-2018 diff --git a/docs/install.md b/docs/install.md index 52b55baef..6e2426f75 100755 --- a/docs/install.md +++ b/docs/install.md @@ -132,6 +132,7 @@ You can explicitly tell `helm init` to... - Install to a particular cluster with `--kube-context` - Install into a particular namespace with `--tiller-namespace` - Install Tiller with a Service Account with `--service-account` (for [RBAC enabled clusters](securing_installation.md#rbac)) +- Install Tiller without mounting a service account with `--automount-service-account false` Once Tiller is installed, running `helm version` should show you both the client and server version. (If it shows only the client version, From 0c44c05d843abe4484d0e3a65805ed6e5b3d7613 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Sat, 8 Sep 2018 04:36:16 +0800 Subject: [PATCH 351/449] Fix grammer for tests (#4599) Signed-off-by: Ian Chen --- docs/chart_tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_tests.md b/docs/chart_tests.md index d1cfe5017..2d1852eb5 100644 --- a/docs/chart_tests.md +++ b/docs/chart_tests.md @@ -8,7 +8,7 @@ Example tests: - Validate that your configuration from the values.yaml file was properly injected. - Make sure your username and password work correctly - Make sure an incorrect username and password does not work -- Assert that your services are up and correctly load balancing +- Assert that your services are up and correctly loadbalanced. - etc. You can run the pre-defined tests in Helm on a release using the command `helm test `. For a chart consumer, this is a great way to sanity check that their release of a chart (or application) works as expected. From 9a6720536cdca52acd4dc025c3d1db22b04a3b51 Mon Sep 17 00:00:00 2001 From: Anton Osmond Date: Fri, 7 Sep 2018 21:41:40 +0100 Subject: [PATCH 352/449] Be explicit about where occurences of will be replaced in starter charts (#4548) Signed-off-by: Anton Osmond --- docs/charts.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/charts.md b/docs/charts.md index 0414136ce..37e7fe038 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -848,8 +848,10 @@ considerations in mind: - The `Chart.yaml` will be overwritten by the generator. - Users will expect to modify such a chart's contents, so documentation should indicate how users can do so. -- All occurrences of `` will be replaced with the specified chart - name so that starter charts can be used as templates. +- All occurrences of `` in files within the `templates` directory + will be replaced with the specified chart name so that starter charts can be + used as templates. Additionally, occurrences of `` in + `values.yaml` will also be replaced. Currently the only way to add a chart to `$HELM_HOME/starters` is to manually copy it there. In your chart's documentation, you may want to explain that From d9d997eee26d69dbf7534d009facd8a62cfa6436 Mon Sep 17 00:00:00 2001 From: Thomas Garlot Date: Sun, 9 Sep 2018 20:33:27 +0200 Subject: [PATCH 353/449] 4611 - Remove deadlink to deis.com (#4613) Signed-off-by: tgarlot --- docs/related.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/related.md b/docs/related.md index 082684d9c..366cfb6a4 100644 --- a/docs/related.md +++ b/docs/related.md @@ -15,7 +15,6 @@ or [pull request](https://github.com/kubernetes/helm/pulls). - [Honestbee's Helm Chart Conventions](https://gist.github.com/so0k/f927a4b60003cedd101a0911757c605a) - [Releasing backward-incompatible changes: Kubernetes, Jenkins, Prometheus Operator, Helm and Traefik](https://medium.com/@enxebre/releasing-backward-incompatible-changes-kubernetes-jenkins-plugin-prometheus-operator-helm-self-6263ca61a1b1#.e0c7elxhq) - [The Missing CI/CD Kubernetes Component: Helm package manager](https://hackernoon.com/the-missing-ci-cd-kubernetes-component-helm-package-manager-1fe002aac680#.691sk2zhu) -- [The Workflow "Umbrella" Helm Chart](https://deis.com/blog/2017/workflow-chart-assembly) - [Using Helm to Deploy to Kubernetes](https://daemonza.github.io/2017/02/20/using-helm-to-deploy-to-kubernetes/) - [Writing a Helm Chart](https://www.influxdata.com/packaged-kubernetes-deployments-writing-helm-chart/) - [A basic walk through Kubernetes Helm](https://github.com/muffin87/helm-tutorial) From 330b168a01cdc7d66e5cf32664537a0d41f27e1f Mon Sep 17 00:00:00 2001 From: Robert James Hernandez Date: Mon, 10 Sep 2018 15:39:55 +0000 Subject: [PATCH 354/449] Fix for checking helm version slice bounds out of range (#4609) * fix(helm): Use env to locate bash Leverage '/usr/bin/env bash` for find bash instead of hardcoding '/bin/bash' since some *nix OSes have it installed elsewhere. Signed-off-by: Robert James Hernandez * test(helm): Adding case for versions short flag When git sha is empty if being built from tarball running 'helm version --short' should just ignore '--short' since sha is empty. Adding test to ensure this is the case. Signed-off-by: Robert James Hernandez * fix(helm): ignore short flag when sha is empty Signed-off-by: Robert James Hernandez --- Makefile | 2 +- cmd/helm/version.go | 2 +- cmd/helm/version_test.go | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9b8588712..f824481ca 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ BINDIR := $(CURDIR)/bin BINARIES := helm tiller # Required for globs to work correctly -SHELL=/bin/bash +SHELL=/usr/bin/env bash .PHONY: all all: build diff --git a/cmd/helm/version.go b/cmd/helm/version.go index e0d9e5e73..1c292e19d 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -145,7 +145,7 @@ func getK8sVersion() (*apiVersion.Info, error) { } func formatVersion(v *pb.Version, short bool) string { - if short { + if short && v.GitCommit != "" { return fmt.Sprintf("%s+g%s", v.SemVer, v.GitCommit[:7]) } return fmt.Sprintf("%#v", v) diff --git a/cmd/helm/version_test.go b/cmd/helm/version_test.go index 5519131c2..c1223ef91 100644 --- a/cmd/helm/version_test.go +++ b/cmd/helm/version_test.go @@ -57,6 +57,12 @@ func TestVersion(t *testing.T) { flags: []string{"--template", "{{ .Client.SemVer }} {{ .Server.SemVer }}"}, expected: lver + " " + sver, }, + { + name: "client short empty git", + args: []string{}, + flags: []string{"-c", "--short"}, + expected: lver, + }, } settings.TillerHost = "fake-localhost" runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { From 1c42e0afcedc055f8f7f6a60c5ad504afb36f371 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 10 Sep 2018 11:14:03 -0700 Subject: [PATCH 355/449] Fix race condition in `helm list` (#4620) * Fix race in helm list when partitioning Problem: The chunks slice that is passed through the channel is reused for each partition. This means that encoding the release into a message is racing with populating the next partition, causing the results to sometimes not fit in the message, and the release list to be incorrect Solution: Allocate a new slice for each partition Issue #3322 Signed-off-by: Brian Marshall (cherry picked from commit a0858e29d877b8aa19478133865e45958ff21a9e) * fix import sorting Signed-off-by: Matthew Fisher * ref(release_server_test): use NewReleaseServer() Signed-off-by: Matthew Fisher * add unit test for race condition in `helm list` Signed-off-by: Matthew Fisher --- pkg/tiller/release_list.go | 5 +++-- pkg/tiller/release_list_test.go | 23 +++++++++++++++++++++++ pkg/tiller/release_server_test.go | 16 ++++------------ 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/pkg/tiller/release_list.go b/pkg/tiller/release_list.go index 89f7a1100..3299d3ef2 100644 --- a/pkg/tiller/release_list.go +++ b/pkg/tiller/release_list.go @@ -18,11 +18,12 @@ package tiller import ( "fmt" + "regexp" + "github.com/golang/protobuf/proto" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" relutil "k8s.io/helm/pkg/releaseutil" - "regexp" ) // ListReleases lists the releases found by the server. @@ -140,7 +141,7 @@ func (s *ReleaseServer) partition(rels []*release.Release, cap int) <-chan []*re s.Log("partitioned at %d with %d releases (cap=%d)", fill, len(chunk), cap) chunks <- chunk // reset paritioning state - chunk = chunk[:0] + chunk = nil fill = 0 } chunk = append(chunk, rls) diff --git a/pkg/tiller/release_list_test.go b/pkg/tiller/release_list_test.go index b9ab6fe55..f2d19cf96 100644 --- a/pkg/tiller/release_list_test.go +++ b/pkg/tiller/release_list_test.go @@ -274,3 +274,26 @@ func TestReleasesNamespace(t *testing.T) { t.Errorf("Expected 2 releases, got %d", len(mrs.val.Releases)) } } + +func TestReleasePartition(t *testing.T) { + var rl []*release.Release + rs := rsFixture() + rs.Log = t.Logf + num := 7 + for i := 0; i < num; i++ { + rel := releaseStub() + rel.Name = fmt.Sprintf("rel-%d", i) + rl = append(rl, rel) + } + visited := map[string]bool{} + + chunks := rs.partition(rl, 0) + for chunk := range chunks { + for _, rel := range chunk { + if visited[rel.Name] { + t.Errorf("%s was already visited", rel.Name) + } + visited[rel.Name] = true + } + } +} diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index 122ab9dd4..f3fca7390 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -112,24 +112,16 @@ data: name: value ` -func rsFixture() *ReleaseServer { - clientset := fake.NewSimpleClientset() - return &ReleaseServer{ - ReleaseModule: &LocalReleaseModule{ - clientset: clientset, - }, - env: MockEnvironment(), - clientset: clientset, - Log: func(_ string, _ ...interface{}) {}, - } -} - type chartOptions struct { *chart.Chart } type chartOption func(*chartOptions) +func rsFixture() *ReleaseServer { + return NewReleaseServer(MockEnvironment(), fake.NewSimpleClientset(), false) +} + func buildChart(opts ...chartOption) *chart.Chart { c := &chartOptions{ Chart: &chart.Chart{ From b7db701ab3bef650cbefc50f5abb2cd553e4e657 Mon Sep 17 00:00:00 2001 From: adshmh <23505281+adshmh@users.noreply.github.com> Date: Mon, 10 Sep 2018 15:00:57 -0400 Subject: [PATCH 356/449] feat(helm): output option for helm get values command, allow json and yaml formats (#4596) Signed-off-by: Arash Deshmeh --- cmd/helm/get_values.go | 41 +++++++++++++++++++++++++++++------- cmd/helm/get_values_test.go | 33 ++++++++++++++++++++++++++++- docs/helm/helm_get_values.md | 3 ++- 3 files changed, 67 insertions(+), 10 deletions(-) diff --git a/cmd/helm/get_values.go b/cmd/helm/get_values.go index a4f4fc283..38eb5f4bb 100644 --- a/cmd/helm/get_values.go +++ b/cmd/helm/get_values.go @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "encoding/json" "fmt" "io" @@ -36,6 +37,7 @@ type getValuesCmd struct { out io.Writer client helm.Interface version int32 + output string } func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { @@ -62,6 +64,7 @@ func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { settings.AddFlagsTLS(f) f.Int32Var(&get.version, "revision", 0, "get the named release with revision") f.BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values") + f.StringVar(&get.output, "output", "yaml", "output the specified format (json or yaml)") return cmd } @@ -72,20 +75,42 @@ func (g *getValuesCmd) run() error { return prettyError(err) } + values, err := chartutil.ReadValues([]byte(res.Release.Config.Raw)) + if err != nil { + return err + } + // If the user wants all values, compute the values and return. if g.allValues { - cfg, err := chartutil.CoalesceValues(res.Release.Chart, res.Release.Config) - if err != nil { - return err - } - cfgStr, err := cfg.YAML() + values, err = chartutil.CoalesceValues(res.Release.Chart, res.Release.Config) if err != nil { return err } - fmt.Fprintln(g.out, cfgStr) - return nil } - fmt.Fprintln(g.out, res.Release.Config.Raw) + result, err := formatValues(g.output, values) + if err != nil { + return err + } + fmt.Fprintln(g.out, result) return nil } + +func formatValues(format string, values chartutil.Values) (string, error) { + switch format { + case "", "yaml": + out, err := values.YAML() + if err != nil { + return "", err + } + return out, nil + case "json": + out, err := json.Marshal(values) + if err != nil { + return "", fmt.Errorf("Failed to Marshal JSON output: %s", err) + } + return string(out), nil + default: + return "", fmt.Errorf("Unknown output format %q", format) + } +} diff --git a/cmd/helm/get_values_test.go b/cmd/helm/get_values_test.go index 35c84f2ec..aec5ce0c2 100644 --- a/cmd/helm/get_values_test.go +++ b/cmd/helm/get_values_test.go @@ -23,22 +23,53 @@ import ( "github.com/spf13/cobra" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" ) func TestGetValuesCmd(t *testing.T) { + releaseWithValues := helm.ReleaseMock(&helm.MockReleaseOptions{ + Name: "thomas-guide", + Chart: &chart.Chart{Values: &chart.Config{Raw: `foo2: "bar2"`}}, + Config: &chart.Config{Raw: `foo: "bar"`}, + }) + tests := []releaseCase{ { name: "get values with a release", resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), args: []string{"thomas-guide"}, - expected: "name: \"value\"", + expected: "name: value", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"})}, }, + { + name: "get values with json format", + resp: releaseWithValues, + args: []string{"thomas-guide"}, + flags: []string{"--output", "json"}, + expected: "{\"foo\":\"bar\"}", + rels: []*release.Release{releaseWithValues}, + }, + { + name: "get all values with json format", + resp: releaseWithValues, + args: []string{"thomas-guide"}, + flags: []string{"--all", "--output", "json"}, + expected: "{\"foo\":\"bar\",\"foo2\":\"bar2\"}", + rels: []*release.Release{releaseWithValues}, + }, { name: "get values requires release name arg", err: true, }, + { + name: "get values with invalid output format", + resp: releaseWithValues, + args: []string{"thomas-guide"}, + flags: []string{"--output", "INVALID_FORMAT"}, + rels: []*release.Release{releaseWithValues}, + err: true, + }, } cmd := func(c *helm.FakeClient, out io.Writer) *cobra.Command { return newGetValuesCmd(c, out) diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index 7208d5885..87d21b954 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -17,6 +17,7 @@ helm get values [flags] RELEASE_NAME ``` -a, --all dump all (computed) values -h, --help help for values + --output string output the specified format (json or yaml) (default "yaml") --revision int32 get the named release with revision --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -42,4 +43,4 @@ helm get values [flags] RELEASE_NAME * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 10-Aug-2018 +###### Auto generated by spf13/cobra on 7-Sep-2018 From a05afa6c81ed849fe964fc379507af837f17a9cb Mon Sep 17 00:00:00 2001 From: Pratyush Verma Date: Wed, 12 Sep 2018 21:22:27 +0800 Subject: [PATCH 357/449] Fix type in Values File (#4629) Fix typo Signed-off-by: Pratyush Verma --- docs/chart_template_guide/values_files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/values_files.md b/docs/chart_template_guide/values_files.md index 32a178735..a15047667 100644 --- a/docs/chart_template_guide/values_files.md +++ b/docs/chart_template_guide/values_files.md @@ -4,7 +4,7 @@ In the previous section we looked at the built-in objects that Helm templates of - The `values.yaml` file in the chart - If this is a subchart, the `values.yaml` file of a parent chart -- A values file if passed into `helm install` or `helm upgrade` with the `-f` flag (`helm install -f myvals.yaml ./mychart`) +- A values file is passed into `helm install` or `helm upgrade` with the `-f` flag (`helm install -f myvals.yaml ./mychart`) - Individual parameters passed with `--set` (such as `helm install --set foo=bar ./mychart`) The list above is in order of specificity: `values.yaml` is the default, which can be overridden by a parent chart's `values.yaml`, which can in turn be overridden by a user-supplied values file, which can in turn be overridden by `--set` parameters. From bfd2af8eecae6a2ed7d28b8c6fd03cbe12bf171f Mon Sep 17 00:00:00 2001 From: Nenad Stojanovikj Date: Wed, 12 Sep 2018 15:22:12 +0200 Subject: [PATCH 358/449] Clearer wording when using pipelines Signed-off-by: Nenad Stojanovikj --- docs/chart_template_guide/control_structures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/control_structures.md b/docs/chart_template_guide/control_structures.md index 1844bd393..9ecd55142 100644 --- a/docs/chart_template_guide/control_structures.md +++ b/docs/chart_template_guide/control_structures.md @@ -40,7 +40,7 @@ A pipeline is evaluated as _false_ if the value is: - a `nil` (empty or null) - an empty collection (`map`, `slice`, `tuple`, `dict`, `array`) -Under all other conditions, the condition is true. +In any other case, the condition is evaluated to _true_ and the pipeline is executed. Let's add a simple conditional to our ConfigMap. We'll add another setting if the drink is set to coffee: From ad8d3acb8481f064508d07fcfaa8d81be50e2974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helgi=20=C3=9Eormar=20=C3=9Eorbj=C3=B6rnsson?= <70530+helgi@users.noreply.github.com> Date: Wed, 12 Sep 2018 21:09:32 -0700 Subject: [PATCH 359/449] test and build with golang 1.11 (#4637) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit linters were failing with: pkg/urlutil/urlutil_test.go:1::warning: file is not gofmted with -s (gofmt) Signed-off-by: Helgi Þorbjörnsson --- .circleci/config.yml | 2 +- Makefile | 2 +- pkg/urlutil/urlutil_test.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index df9786d82..96f53ee40 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ jobs: working_directory: /go/src/k8s.io/helm parallelism: 3 docker: - - image: golang:1.10 + - image: golang:1.11 environment: PROJECT_NAME: "kubernetes-helm" steps: diff --git a/Makefile b/Makefile index f824481ca..0677cafe4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ DOCKER_REGISTRY ?= gcr.io IMAGE_PREFIX ?= kubernetes-helm -DEV_IMAGE ?= golang:1.10 +DEV_IMAGE ?= golang:1.11 SHORT_NAME ?= tiller SHORT_NAME_RUDDER ?= rudder TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x windows/amd64 diff --git a/pkg/urlutil/urlutil_test.go b/pkg/urlutil/urlutil_test.go index 616c4f14f..b2af24e63 100644 --- a/pkg/urlutil/urlutil_test.go +++ b/pkg/urlutil/urlutil_test.go @@ -65,8 +65,8 @@ func TestEqual(t *testing.T) { func TestExtractHostname(t *testing.T) { tests := map[string]string{ - "http://example.com": "example.com", - "https://example.com/foo": "example.com", + "http://example.com": "example.com", + "https://example.com/foo": "example.com", "https://example.com:31337/not/with/a/bang/but/a/whimper": "example.com", } for start, expect := range tests { From 583b99244119bab48ae6db161d2fde9e5938e1cf Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Fri, 14 Sep 2018 16:36:11 +0200 Subject: [PATCH 360/449] change kubernetes to helm in docs and yaml files when refer the repository (#4640) Signed-off-by: cpanato --- CONTRIBUTING.md | 6 +++--- SECURITY_CONTACTS | 2 +- .../helmhome/repository/cache/testing-index.yaml | 4 ++-- cmd/helm/testdata/testcharts/alpine/Chart.yaml | 2 +- cmd/helm/testdata/testcharts/novals/Chart.yaml | 2 +- .../testdata/testcharts/signtest/alpine/Chart.yaml | 2 +- docs/chart_repository.md | 6 +++--- docs/chart_repository_faq.md | 2 +- docs/chart_repository_sync_example.md | 2 +- docs/chart_template_guide/builtin_objects.md | 2 +- docs/chart_template_guide/wrapping_up.md | 2 +- docs/charts.md | 2 +- docs/developers.md | 4 ++-- docs/examples/alpine/Chart.yaml | 4 ++-- docs/examples/nginx/Chart.yaml | 2 +- docs/helm/helm_serve.md | 2 +- docs/install.md | 12 ++++++------ docs/install_faq.md | 8 ++++---- docs/man/man1/helm_serve.1 | 2 +- docs/quickstart.md | 2 +- docs/related.md | 4 ++-- docs/release_checklist.md | 8 ++++---- .../repository/cache/kubernetes-charts-index.yaml | 4 ++-- .../helmhome/repository/cache/malformed-index.yaml | 2 +- .../helmhome/repository/cache/testing-index.yaml | 4 ++-- .../repository/cache/testing-querystring-index.yaml | 2 +- pkg/downloader/testdata/signtest/alpine/Chart.yaml | 2 +- .../repository/cache/kubernetes-charts-index.yaml | 4 ++-- 28 files changed, 50 insertions(+), 50 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 715bf7490..23dc297b0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ The Kubernetes Helm project accepts contributions via GitHub pull requests. This ## Reporting a Security Issue Most of the time, when you find a bug in Helm, it should be reported -using [GitHub issues](https://github.com/kubernetes/helm/issues). However, if +using [GitHub issues](https://github.com/helm/helm/issues). However, if you are reporting a _security vulnerability_, please email a report to [cncf-kubernetes-helm-security@lists.cncf.io](mailto:cncf-kubernetes-helm-security@lists.cncf.io). This will give us a chance to try to fix the issue before it is exploited in the wild. @@ -84,7 +84,7 @@ your PR will be rejected by the automated DCO check. Whether you are a user or contributor, official support channels include: -- GitHub [issues](https://github.com/kubernetes/helm/issues/new) +- GitHub [issues](https://github.com/helm/helm/issues/new) - Slack [Kubernetes Slack](http://slack.kubernetes.io/): - User: #helm-users - Contributor: #helm-dev @@ -177,7 +177,7 @@ contributing to Helm. All issue types follow the same general lifecycle. Differe 3. Submit a pull request. Coding conventions and standards are explained in the official developer docs: -https://github.com/kubernetes/helm/blob/master/docs/developers.md +https://github.com/helm/helm/blob/master/docs/developers.md The next section contains more information on the workflow followed for PRs diff --git a/SECURITY_CONTACTS b/SECURITY_CONTACTS index 7298ea2d2..28569205d 100644 --- a/SECURITY_CONTACTS +++ b/SECURITY_CONTACTS @@ -8,7 +8,7 @@ # and will be removed and replaced if they violate that agreement. # # DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE -# INSTRUCTIONS AT https://github.com/kubernetes/helm/blob/master/CONTRIBUTING.md#reporting-a-security-issue +# INSTRUCTIONS AT https://github.com/helm/helm/blob/master/CONTRIBUTING.md#reporting-a-security-issue adamreese bacongobbler diff --git a/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml b/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml index 96c98c38c..e18e90d29 100644 --- a/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml +++ b/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml @@ -6,7 +6,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.1.0 appVersion: 1.2.3 description: Deploy a basic Alpine Linux pod @@ -19,7 +19,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.2.0 appVersion: 2.3.4 description: Deploy a basic Alpine Linux pod diff --git a/cmd/helm/testdata/testcharts/alpine/Chart.yaml b/cmd/helm/testdata/testcharts/alpine/Chart.yaml index 6fbb27f18..fea865aa5 100644 --- a/cmd/helm/testdata/testcharts/alpine/Chart.yaml +++ b/cmd/helm/testdata/testcharts/alpine/Chart.yaml @@ -2,5 +2,5 @@ description: Deploy a basic Alpine Linux pod home: https://k8s.io/helm name: alpine sources: -- https://github.com/kubernetes/helm +- https://github.com/helm/helm version: 0.1.0 diff --git a/cmd/helm/testdata/testcharts/novals/Chart.yaml b/cmd/helm/testdata/testcharts/novals/Chart.yaml index ce1a81da6..85f7a5d83 100644 --- a/cmd/helm/testdata/testcharts/novals/Chart.yaml +++ b/cmd/helm/testdata/testcharts/novals/Chart.yaml @@ -2,5 +2,5 @@ description: Deploy a basic Alpine Linux pod home: https://k8s.io/helm name: novals sources: -- https://github.com/kubernetes/helm +- https://github.com/helm/helm version: 0.2.0 diff --git a/cmd/helm/testdata/testcharts/signtest/alpine/Chart.yaml b/cmd/helm/testdata/testcharts/signtest/alpine/Chart.yaml index 6fbb27f18..fea865aa5 100644 --- a/cmd/helm/testdata/testcharts/signtest/alpine/Chart.yaml +++ b/cmd/helm/testdata/testcharts/signtest/alpine/Chart.yaml @@ -2,5 +2,5 @@ description: Deploy a basic Alpine Linux pod home: https://k8s.io/helm name: alpine sources: -- https://github.com/kubernetes/helm +- https://github.com/helm/helm version: 0.1.0 diff --git a/docs/chart_repository.md b/docs/chart_repository.md index 01d457e63..91ae3a3c4 100644 --- a/docs/chart_repository.md +++ b/docs/chart_repository.md @@ -21,7 +21,7 @@ optionally some packaged charts. When you're ready to share your charts, the preferred way to do so is by uploading them to a chart repository. **Note:** For Helm 2.0.0, chart repositories do not have any intrinsic -authentication. There is an [issue tracking progress](https://github.com/kubernetes/helm/issues/1038) +authentication. There is an [issue tracking progress](https://github.com/helm/helm/issues/1038) in GitHub. Because a chart repository can be any HTTP server that can serve YAML and tar @@ -78,7 +78,7 @@ entries: home: https://k8s.io/helm name: alpine sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm urls: - https://technosophos.github.io/tscharts/alpine-0.2.0.tgz version: 0.2.0 @@ -88,7 +88,7 @@ entries: home: https://k8s.io/helm name: alpine sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm urls: - https://technosophos.github.io/tscharts/alpine-0.1.0.tgz version: 0.1.0 diff --git a/docs/chart_repository_faq.md b/docs/chart_repository_faq.md index a3e6392ba..a3340b661 100644 --- a/docs/chart_repository_faq.md +++ b/docs/chart_repository_faq.md @@ -3,7 +3,7 @@ This section tracks some of the more frequently encountered issues with using chart repositories. **We'd love your help** making this document better. To add, correct, or remove -information, [file an issue](https://github.com/kubernetes/helm/issues) or +information, [file an issue](https://github.com/helm/helm/issues) or send us a pull request. ## Fetching diff --git a/docs/chart_repository_sync_example.md b/docs/chart_repository_sync_example.md index de140c636..931275431 100644 --- a/docs/chart_repository_sync_example.md +++ b/docs/chart_repository_sync_example.md @@ -29,7 +29,7 @@ Upload the contents of the directory to your GCS bucket by running `scripts/sync For example: ```console $ pwd -/Users/funuser/go/src/github.com/kubernetes/helm +/Users/funuser/go/src/github.com/helm/helm $ scripts/sync-repo.sh fantastic-charts/ fantastic-charts Getting ready to sync your local directory (fantastic-charts/) to a remote repository at gs://fantastic-charts Verifying Prerequisites.... diff --git a/docs/chart_template_guide/builtin_objects.md b/docs/chart_template_guide/builtin_objects.md index 11982229b..2108940ec 100644 --- a/docs/chart_template_guide/builtin_objects.md +++ b/docs/chart_template_guide/builtin_objects.md @@ -16,7 +16,7 @@ In the previous section, we use `{{.Release.Name}}` to insert the name of a rele - `Release.IsInstall`: This is set to `true` if the current operation is an install. - `Values`: Values passed into the template from the `values.yaml` file and from user-supplied files. By default, `Values` is empty. - `Chart`: The contents of the `Chart.yaml` file. Any data in `Chart.yaml` will be accessible here. For example `{{.Chart.Name}}-{{.Chart.Version}}` will print out the `mychart-0.1.0`. - - The available fields are listed in the [Charts Guide](https://github.com/kubernetes/helm/blob/master/docs/charts.md#the-chartyaml-file) + - The available fields are listed in the [Charts Guide](https://github.com/helm/helm/blob/master/docs/charts.md#the-chartyaml-file) - `Files`: This provides access to all non-special files in a chart. While you cannot use it to access templates, you can use it to access other files in the chart. See the section _Accessing Files_ for more. - `Files.Get` is a function for getting a file by name (`.Files.Get config.ini`) - `Files.GetBytes` is a function for getting the contents of a file as an array of bytes instead of as a string. This is useful for things like images. diff --git a/docs/chart_template_guide/wrapping_up.md b/docs/chart_template_guide/wrapping_up.md index 1ed7c602a..1a8d6c552 100755 --- a/docs/chart_template_guide/wrapping_up.md +++ b/docs/chart_template_guide/wrapping_up.md @@ -17,4 +17,4 @@ Sometimes it's easier to ask a few questions and get answers from experienced de - [Kubernetes Slack](https://slack.k8s.io/): `#helm` -Finally, if you find errors or omissions in this document, want to suggest some new content, or would like to contribute, visit [The Helm Project](https://github.com/kubernetes/helm). +Finally, if you find errors or omissions in this document, want to suggest some new content, or would like to contribute, visit [The Helm Project](https://github.com/helm/helm). diff --git a/docs/charts.md b/docs/charts.md index 37e7fe038..669d90164 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -488,7 +488,7 @@ the Kubernetes objects from the charts and all its dependencies are Hence a single release is created with all the objects for the chart and its dependencies. The install order of Kubernetes types is given by the enumeration InstallOrder in kind_sorter.go -(see [the Helm source file](https://github.com/kubernetes/helm/blob/master/pkg/tiller/kind_sorter.go#L26)). +(see [the Helm source file](https://github.com/helm/helm/blob/master/pkg/tiller/kind_sorter.go#L26)). ## Templates and Values diff --git a/docs/developers.md b/docs/developers.md index ca6b591fe..4f1da2d96 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -132,7 +132,7 @@ elegant and high-quality open source code so that our users will benefit. Make sure you have read and understood the main CONTRIBUTING guide: -https://github.com/kubernetes/helm/blob/master/CONTRIBUTING.md +https://github.com/helm/helm/blob/master/CONTRIBUTING.md ### Structure of the Code @@ -162,7 +162,7 @@ We accept changes to the code via GitHub Pull Requests (PRs). One workflow for doing this is as follows: 1. Go to your `$GOPATH/src/k8s.io` directory and `git clone` the - `github.com/kubernetes/helm` repository. + `github.com/helm/helm` repository. 2. Fork that repository into your GitHub account 3. Add your repository as a remote for `$GOPATH/src/k8s.io/helm` 4. Create a new working branch (`git checkout -b feat/my-feature`) and diff --git a/docs/examples/alpine/Chart.yaml b/docs/examples/alpine/Chart.yaml index f4b660d4f..e56f8a469 100644 --- a/docs/examples/alpine/Chart.yaml +++ b/docs/examples/alpine/Chart.yaml @@ -1,7 +1,7 @@ name: alpine description: Deploy a basic Alpine Linux pod version: 0.1.0 -home: https://github.com/kubernetes/helm +home: https://github.com/helm/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm appVersion: 3.3 diff --git a/docs/examples/nginx/Chart.yaml b/docs/examples/nginx/Chart.yaml index 807455210..3d6f5751b 100644 --- a/docs/examples/nginx/Chart.yaml +++ b/docs/examples/nginx/Chart.yaml @@ -7,7 +7,7 @@ keywords: - nginx - www - web -home: https://github.com/kubernetes/helm +home: https://github.com/helm/helm sources: - https://hub.docker.com/_/nginx/ maintainers: diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index 5e25f2a2f..62a68595a 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -15,7 +15,7 @@ This command is intended to be used for educational and testing purposes only. It is best to rely on a dedicated web server or a cloud-hosted solution like Google Cloud Storage for production use. -See https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories +See https://github.com/helm/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories for more information on hosting chart repositories in a production setting. diff --git a/docs/install.md b/docs/install.md index 6e2426f75..96d9bc9f7 100755 --- a/docs/install.md +++ b/docs/install.md @@ -13,11 +13,11 @@ releases. ### From the Binary Releases -Every [release](https://github.com/kubernetes/helm/releases) of Helm +Every [release](https://github.com/helm/helm/releases) of Helm provides binary releases for a variety of OSes. These binary versions can be manually downloaded and installed. -1. Download your [desired version](https://github.com/kubernetes/helm/releases) +1. Download your [desired version](https://github.com/helm/helm/releases) 2. Unpack it (`tar -zxvf helm-v2.0.0-linux-amd64.tgz`) 3. Find the `helm` binary in the unpacked directory, and move it to its desired destination (`mv linux-amd64/helm /usr/local/bin/helm`) @@ -57,18 +57,18 @@ choco install kubernetes-helm ## From Script Helm now has an installer script that will automatically grab the latest version -of the Helm client and [install it locally](https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get). +of the Helm client and [install it locally](https://raw.githubusercontent.com/helm/helm/master/scripts/get). You can fetch that script, and then execute it locally. It's well documented so that you can read through it and understand what it is doing before you run it. ``` -$ curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh +$ curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh $ chmod 700 get_helm.sh $ ./get_helm.sh ``` -Yes, you can `curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash` that if you want to live on the edge. +Yes, you can `curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash` that if you want to live on the edge. ### From Canary Builds @@ -96,7 +96,7 @@ You must have a working Go environment with $ cd $GOPATH $ mkdir -p src/k8s.io $ cd src/k8s.io -$ git clone https://github.com/kubernetes/helm.git +$ git clone https://github.com/helm/helm.git $ cd helm $ make bootstrap build ``` diff --git a/docs/install_faq.md b/docs/install_faq.md index f2eae5b48..d4840417f 100644 --- a/docs/install_faq.md +++ b/docs/install_faq.md @@ -4,7 +4,7 @@ This section tracks some of the more frequently encountered issues with installi or getting started with Helm. **We'd love your help** making this document better. To add, correct, or remove -information, [file an issue](https://github.com/kubernetes/helm/issues) or +information, [file an issue](https://github.com/helm/helm/issues) or send us a pull request. ## Downloading @@ -94,8 +94,8 @@ recommends reading this: Here are a few resolved issues that may help you get started: -- https://github.com/kubernetes/helm/issues/1371 -- https://github.com/kubernetes/helm/issues/966 +- https://github.com/helm/helm/issues/1371 +- https://github.com/helm/helm/issues/966 **Q: Trying to use Helm, I get the error "lookup XXXXX on 8.8.8.8:53: no such host"** @@ -113,7 +113,7 @@ follows. On each of the control plane nodes: 3) Remove the k8s api server container (kubelet will recreate it) 4) Then `systemctl restart docker` (or reboot the node) for it to pick up the /etc/resolv.conf changes -See this issue for more information: https://github.com/kubernetes/helm/issues/1455 +See this issue for more information: https://github.com/helm/helm/issues/1455 **Q: On GKE (Google Container Engine) I get "No SSH tunnels currently open"** diff --git a/docs/man/man1/helm_serve.1 b/docs/man/man1/helm_serve.1 index a4a9c51da..f43f5ab05 100644 --- a/docs/man/man1/helm_serve.1 +++ b/docs/man/man1/helm_serve.1 @@ -29,7 +29,7 @@ Google Cloud Storage for production use. .PP See -\[la]https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories\[ra] +\[la]https://github.com/helm/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories\[ra] for more information on hosting chart repositories in a production setting. diff --git a/docs/quickstart.md b/docs/quickstart.md index 8622137b2..e7b70d4ca 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -43,7 +43,7 @@ to [configure a service account and rules](rbac.md) before proceeding. ## Install Helm Download a binary release of the Helm client. You can use tools like -`homebrew`, or look at [the official releases page](https://github.com/kubernetes/helm/releases). +`homebrew`, or look at [the official releases page](https://github.com/helm/helm/releases). For more details, or for other options, see [the installation guide](install.md). diff --git a/docs/related.md b/docs/related.md index 366cfb6a4..2ad1e9b20 100644 --- a/docs/related.md +++ b/docs/related.md @@ -2,8 +2,8 @@ The Helm community has produced many extra tools, plugins, and documentation about Helm. We love to hear about these projects. If you have anything you'd like to -add to this list, please open an [issue](https://github.com/kubernetes/helm/issues) -or [pull request](https://github.com/kubernetes/helm/pulls). +add to this list, please open an [issue](https://github.com/helm/helm/issues) +or [pull request](https://github.com/helm/helm/pulls). ## Article, Blogs, How-Tos, and Extra Documentation diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 96d7e5625..a84cad713 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -39,12 +39,12 @@ Just kidding! :trollface: All releases will be of the form vX.Y.Z where X is the major version number, Y is the minor version number and Z is the patch release number. This project strictly follows [semantic versioning](http://semver.org/) so following this step is critical. -It is important to note that this document assumes that the git remote in your repository that corresponds to "https://github.com/kubernetes/helm" is named "upstream". If yours is not (for example, if you've chosen to name it "origin" or something similar instead), be sure to adjust the listed snippets for your local environment accordingly. If you are not sure what your upstream remote is named, use a command like `git remote -v` to find out. +It is important to note that this document assumes that the git remote in your repository that corresponds to "https://github.com/helm/helm" is named "upstream". If yours is not (for example, if you've chosen to name it "origin" or something similar instead), be sure to adjust the listed snippets for your local environment accordingly. If you are not sure what your upstream remote is named, use a command like `git remote -v` to find out. If you don't have an upstream remote, you can add one easily using something like: ```shell -git remote add upstream git@github.com:kubernetes/helm.git +git remote add upstream git@github.com:helm/helm.git ``` In this doc, we are going to reference a few environment variables as well, which you may want to set for convenience. For major/minor releases, use the following: @@ -134,7 +134,7 @@ In order for others to start testing, we can now push the release branch upstrea git push upstream $RELEASE_BRANCH_NAME ``` -Make sure to check [helm on CircleCI](https://circleci.com/gh/kubernetes/helm) and make sure the release passed CI before proceeding. +Make sure to check [helm on CircleCI](https://circleci.com/gh/helm/helm) and make sure the release passed CI before proceeding. If anyone is available, let others peer-review the branch before continuing to ensure that all the proper changes have been made and all of the commits for the release are there. @@ -240,7 +240,7 @@ Download Helm X.Y. The common platform binaries are here: Once you have the client installed, upgrade Tiller with `helm init --upgrade`. -The [Quickstart Guide](https://docs.helm.sh/using_helm/#quickstart-guide) will get you going from there. For **upgrade instructions** or detailed installation notes, check the [install guide](https://docs.helm.sh/using_helm/#installing-helm). You can also use a [script to install](https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get) on any system with `bash`. +The [Quickstart Guide](https://docs.helm.sh/using_helm/#quickstart-guide) will get you going from there. For **upgrade instructions** or detailed installation notes, check the [install guide](https://docs.helm.sh/using_helm/#installing-helm). You can also use a [script to install](https://raw.githubusercontent.com/helm/helm/master/scripts/get) on any system with `bash`. ## What's Next diff --git a/pkg/downloader/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml index 28d272ae2..8af354615 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.1.0 description: Deploy a basic Alpine Linux pod keywords: [] @@ -20,7 +20,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.2.0 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/downloader/testdata/helmhome/repository/cache/malformed-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/malformed-index.yaml index 1956e9f83..f51257233 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/malformed-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/malformed-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 1.2.3 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml index 14cdffece..7543a59f5 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 1.2.3 description: Deploy a basic Alpine Linux pod keywords: [] @@ -21,7 +21,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.2.0 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-querystring-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-querystring-index.yaml index 1956e9f83..f51257233 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-querystring-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-querystring-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 1.2.3 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/downloader/testdata/signtest/alpine/Chart.yaml b/pkg/downloader/testdata/signtest/alpine/Chart.yaml index 6fbb27f18..fea865aa5 100644 --- a/pkg/downloader/testdata/signtest/alpine/Chart.yaml +++ b/pkg/downloader/testdata/signtest/alpine/Chart.yaml @@ -2,5 +2,5 @@ description: Deploy a basic Alpine Linux pod home: https://k8s.io/helm name: alpine sources: -- https://github.com/kubernetes/helm +- https://github.com/helm/helm version: 0.1.0 diff --git a/pkg/resolver/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml b/pkg/resolver/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml index e2d438701..bfade3dbc 100644 --- a/pkg/resolver/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml +++ b/pkg/resolver/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.2.0 description: Deploy a basic Alpine Linux pod keywords: [] @@ -20,7 +20,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.1.0 description: Deploy a basic Alpine Linux pod keywords: [] From ef913ff2b8bf53380e3b876b99fcec0d3311e09a Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Mon, 17 Sep 2018 10:46:57 -0600 Subject: [PATCH 361/449] chore: update Sprig to 2.16 (#4652) Signed-off-by: Matt Butcher --- glide.lock | 11 ++++++----- glide.yaml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/glide.lock b/glide.lock index 9a89616ef..298de2612 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 9d3eee153a34027ed93ccbcbfb4778baead73ed3f5bd4c665114e02aef747606 -updated: 2018-08-01T07:48:30.2009451Z +hash: a4a7df055da2413c8e42cb127833a77d6a2910396efdabf5a7dc5af956478fef +updated: 2018-09-13T18:30:19.732109-06:00 imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -39,7 +39,7 @@ imports: subpackages: - md2man - name: github.com/cyphar/filepath-securejoin - version: 06bda8370f45268db985f7af15732444d94ed51c + version: a261ee33d7a517f054effbf451841abaafe3e0fd - name: github.com/davecgh/go-spew version: 782f4967f2dc4564575ca782fe2d04090b5faca8 subpackages: @@ -196,7 +196,7 @@ imports: - name: github.com/Masterminds/semver version: 517734cc7d6470c0d07130e40fd40bdeb9bcd3fd - name: github.com/Masterminds/sprig - version: 6b2a58267f6a8b1dc8e2eb5519b984008fa85e8c + version: 15f9564e7e9cf0da02a48e0d25f12a7b83559aa6 - name: github.com/Masterminds/vcs version: 3084677c2c188840777bff30054f2b553729d329 - name: github.com/mattn/go-runewidth @@ -596,7 +596,7 @@ imports: - pkg/util/proto/testing - pkg/util/proto/validation - name: k8s.io/kubernetes - version: 8b3d76091fd500b7c59c83e113c9048ee612b205 + version: 2e809eed16445fff9dcbfc56e9936cf76ccbdadc subpackages: - pkg/api/events - pkg/api/legacyscheme @@ -786,3 +786,4 @@ testImports: version: e3a8ff8ce36581f87a15341206f205b1da467059 subpackages: - assert + - require diff --git a/glide.yaml b/glide.yaml index 68a5d91ad..716fc56ef 100644 --- a/glide.yaml +++ b/glide.yaml @@ -13,7 +13,7 @@ import: - package: github.com/imdario/mergo version: 6633656539c1639d9d78127b7d47c622b5d7b6dc - package: github.com/Masterminds/sprig - version: ^2.15.0 + version: ^2.16.0 - package: github.com/ghodss/yaml - package: github.com/Masterminds/semver version: ~1.3.1 From 3eb04646365e8bd79f506e24d5946671b1f15608 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 17 Sep 2018 09:48:51 -0700 Subject: [PATCH 362/449] fix merge conflicts/linter errors (#4653) Signed-off-by: Matthew Fisher --- cmd/helm/serve.go | 2 +- pkg/tiller/hooks.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/helm/serve.go b/cmd/helm/serve.go index 81f2785c3..7ddae6ca2 100644 --- a/cmd/helm/serve.go +++ b/cmd/helm/serve.go @@ -38,7 +38,7 @@ This command is intended to be used for educational and testing purposes only. It is best to rely on a dedicated web server or a cloud-hosted solution like Google Cloud Storage for production use. -See https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories +See https://github.com/helm/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories for more information on hosting chart repositories in a production setting. ` diff --git a/pkg/tiller/hooks.go b/pkg/tiller/hooks.go index 6c3543f61..0fb7c92f8 100644 --- a/pkg/tiller/hooks.go +++ b/pkg/tiller/hooks.go @@ -53,6 +53,7 @@ var deletePolices = map[string]release.Hook_DeletePolicy{ hooks.BeforeHookCreation: release.Hook_BEFORE_HOOK_CREATION, } +// Manifest represents a manifest file, which has a name and some content. type Manifest = manifest.Manifest type result struct { From 948226117dd6c65f622d9d38a705ecc3dad49429 Mon Sep 17 00:00:00 2001 From: Steve Wolter Date: Mon, 17 Sep 2018 21:41:27 +0200 Subject: [PATCH 363/449] Check for err before working with newRelease. (#4630) Should fix #4585. Signed-off-by: Steve Wolter --- pkg/tiller/release_update.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 5cd82dfc5..8f3cc4e8e 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -150,6 +150,8 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( return nil, err } + res := &services.UpdateReleaseResponse{} + newRelease, err := s.prepareRelease(&services.InstallReleaseRequest{ Chart: req.Chart, Values: req.Values, @@ -161,11 +163,6 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( Timeout: req.Timeout, Wait: req.Wait, }) - - // update new release with next revision number so as to append to the old release's history - newRelease.Version = oldRelease.Version + 1 - - res := &services.UpdateReleaseResponse{Release: newRelease} if err != nil { s.Log("failed update prepare step: %s", err) // On dry run, append the manifest contents to a failed release. This is @@ -176,6 +173,10 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( return res, err } + // update new release with next revision number so as to append to the old release's history + newRelease.Version = oldRelease.Version + 1 + res.Release = newRelease + if req.DryRun { s.Log("dry run for %s", newRelease.Name) res.Release.Info.Description = "Dry run complete" From dba8c4d32825eb416a409fdf83dd2810bce4bc80 Mon Sep 17 00:00:00 2001 From: Louis Munro Date: Mon, 17 Sep 2018 17:04:19 -0400 Subject: [PATCH 364/449] Make ping() request a specific image. Add a getTillerPodImage method. (#4622) Signed-off-by: Louis Munro --- cmd/helm/init.go | 14 +++++++------- cmd/helm/installer/install.go | 4 ++-- cmd/helm/installer/options.go | 3 ++- pkg/helm/portforwarder/portforwarder.go | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 425c10074..4be54e675 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -274,7 +274,7 @@ func (i *initCmd) run() error { if err := installer.Upgrade(i.kubeClient, &i.opts); err != nil { return fmt.Errorf("error when upgrading: %s", err) } - if err := i.ping(); err != nil { + if err := i.ping(i.opts.SelectImage()); err != nil { return err } fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been upgraded to the current version.") @@ -290,7 +290,7 @@ func (i *initCmd) run() error { "For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation") } } - if err := i.ping(); err != nil { + if err := i.ping(i.opts.SelectImage()); err != nil { return err } } else { @@ -301,13 +301,13 @@ func (i *initCmd) run() error { return nil } -func (i *initCmd) ping() error { +func (i *initCmd) ping(image string) error { if i.wait { _, kubeClient, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return err } - if !watchTillerUntilReady(settings.TillerNamespace, kubeClient, settings.TillerConnectionTimeout) { + if !watchTillerUntilReady(settings.TillerNamespace, kubeClient, settings.TillerConnectionTimeout, image) { return fmt.Errorf("tiller was not found. polling deadline exceeded") } @@ -439,7 +439,7 @@ func ensureRepoFileFormat(file string, out io.Writer) error { // want to wait before we call New(). // // Returns true if it exists. If the timeout was reached and it could not find the pod, it returns false. -func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeout int64) bool { +func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeout int64, newImage string) bool { deadlinePollingChan := time.NewTimer(time.Duration(timeout) * time.Second).C checkTillerPodTicker := time.NewTicker(500 * time.Millisecond) doneChan := make(chan bool) @@ -448,8 +448,8 @@ func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeou go func() { for range checkTillerPodTicker.C { - _, err := portforwarder.GetTillerPodName(client.CoreV1(), namespace) - if err == nil { + image, err := portforwarder.GetTillerPodImage(client.CoreV1(), namespace) + if err == nil && image == newImage { doneChan <- true break } diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index c9ba1b0ca..6027fdba8 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -68,7 +68,7 @@ func Upgrade(client kubernetes.Interface, opts *Options) error { if semverCompare(tillerImage) == -1 && !opts.ForceUpgrade { return errors.New("current Tiller version is newer, use --force-upgrade to downgrade") } - obj.Spec.Template.Spec.Containers[0].Image = opts.selectImage() + obj.Spec.Template.Spec.Containers[0].Image = opts.SelectImage() obj.Spec.Template.Spec.Containers[0].ImagePullPolicy = opts.pullPolicy() obj.Spec.Template.Spec.ServiceAccountName = opts.ServiceAccount if _, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Update(obj); err != nil { @@ -223,7 +223,7 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { Containers: []v1.Container{ { Name: "tiller", - Image: opts.selectImage(), + Image: opts.SelectImage(), ImagePullPolicy: opts.pullPolicy(), Ports: []v1.ContainerPort{ {ContainerPort: 44134, Name: "tiller"}, diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index 729bdf20b..196ad8de4 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -99,7 +99,8 @@ type Options struct { Values []string } -func (opts *Options) selectImage() string { +// SelectImage returns the image according to whether UseCanary is true or not +func (opts *Options) SelectImage() string { switch { case opts.UseCanary: return defaultImage + ":canary" diff --git a/pkg/helm/portforwarder/portforwarder.go b/pkg/helm/portforwarder/portforwarder.go index cc3261d1c..e962eef7f 100644 --- a/pkg/helm/portforwarder/portforwarder.go +++ b/pkg/helm/portforwarder/portforwarder.go @@ -54,6 +54,21 @@ func GetTillerPodName(client corev1.PodsGetter, namespace string) (string, error return pod.ObjectMeta.GetName(), nil } +// GetTillerPodImage fetches the image of tiller pod running in the given namespace. +func GetTillerPodImage(client corev1.PodsGetter, namespace string) (string, error) { + selector := tillerPodLabels.AsSelector() + pod, err := getFirstRunningPod(client, namespace, selector) + if err != nil { + return "", err + } + for _, c := range pod.Spec.Containers { + if c.Name == "tiller" { + return c.Image, nil + } + } + return "", fmt.Errorf("could not find a tiller pod") +} + func getFirstRunningPod(client corev1.PodsGetter, namespace string, selector labels.Selector) (*v1.Pod, error) { options := metav1.ListOptions{LabelSelector: selector.String()} pods, err := client.Pods(namespace).List(options) From 54272912bcb77c74dea61d130aa44fbf23036649 Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Tue, 18 Sep 2018 06:13:32 +0900 Subject: [PATCH 365/449] Add --no-sudo option (#4649) Signed-off-by: Yuya Takeyama --- scripts/get | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/get b/scripts/get index 29cd47e1a..326660a89 100755 --- a/scripts/get +++ b/scripts/get @@ -18,6 +18,7 @@ # the package manager for Go: https://github.com/Masterminds/glide.sh/blob/master/get PROJECT_NAME="helm" +USE_SUDO="true" : ${HELM_INSTALL_DIR:="/usr/local/bin"} @@ -50,7 +51,7 @@ initOS() { runAsRoot() { local CMD="$*" - if [ $EUID -ne 0 ]; then + if [ $EUID -ne 0 -a $USE_SUDO = "true" ]; then CMD="sudo $CMD" fi @@ -180,6 +181,7 @@ help () { echo -e "\t[--help|-h ] ->> prints this help" echo -e "\t[--version|-v ] . When not defined it defaults to latest" echo -e "\te.g. --version v2.4.0 or -v latest" + echo -e "\t[--no-sudo] ->> install without sudo" } # cleanup temporary files to avoid https://github.com/helm/helm/issues/2977 @@ -209,6 +211,9 @@ while [[ $# -gt 0 ]]; do exit 0 fi ;; + '--no-sudo') + USE_SUDO="false" + ;; '--help'|-h) help exit 0 From 06478e927eaf69edcbe5cf24e343fafcb15b0d23 Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Tue, 18 Sep 2018 06:52:21 +0900 Subject: [PATCH 366/449] Install tiller as well if it exists (#4648) * Install tiller as well if it exists Signed-off-by: Yuya Takeyama * Fix message ref: https://github.com/helm/helm/pull/4648#discussion_r218229227 Signed-off-by: Yuya Takeyama --- scripts/get | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/get b/scripts/get index 326660a89..40fb2f69f 100755 --- a/scripts/get +++ b/scripts/get @@ -18,6 +18,7 @@ # the package manager for Go: https://github.com/Masterminds/glide.sh/blob/master/get PROJECT_NAME="helm" +TILLER_NAME="tiller" USE_SUDO="true" : ${HELM_INSTALL_DIR:="/usr/local/bin"} @@ -142,8 +143,16 @@ installFile() { mkdir -p "$HELM_TMP" tar xf "$HELM_TMP_FILE" -C "$HELM_TMP" HELM_TMP_BIN="$HELM_TMP/$OS-$ARCH/$PROJECT_NAME" - echo "Preparing to install into ${HELM_INSTALL_DIR}" + TILLER_TMP_BIN="$HELM_TMP/$OS-$ARCH/$TILLER_NAME" + echo "Preparing to install $PROJECT_NAME and $TILLER_NAME into ${HELM_INSTALL_DIR}" runAsRoot cp "$HELM_TMP_BIN" "$HELM_INSTALL_DIR" + echo "$PROJECT_NAME installed into $HELM_INSTALL_DIR/$PROJECT_NAME" + if [ -x "$TILLER_TMP_BIN" ]; then + runAsRoot cp "$TILLER_TMP_BIN" "$HELM_INSTALL_DIR" + echo "$TILLER_NAME installed into $HELM_INSTALL_DIR/$TILLER_NAME" + else + echo "info: $TILLER_NAME binary was not found in this release; skipping $TILLER_NAME installation" + fi } # fail_trap is executed if an error occurs. @@ -165,7 +174,6 @@ fail_trap() { # testVersion tests the installed client to make sure it is working. testVersion() { set +e - echo "$PROJECT_NAME installed into $HELM_INSTALL_DIR/$PROJECT_NAME" HELM="$(which $PROJECT_NAME)" if [ "$?" = "1" ]; then echo "$PROJECT_NAME not found. Is $HELM_INSTALL_DIR on your "'$PATH?' From 36c68ad425158d7111ec725917e3e81b833a6024 Mon Sep 17 00:00:00 2001 From: Qiang Li Date: Tue, 18 Sep 2018 13:55:22 -0700 Subject: [PATCH 367/449] fix(helm): fix selector typo in service template for 'helm create' (#4663) changed instancelease to instance in service template closes #4661 Signed-off-by: Qiang Li --- pkg/chartutil/create.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index cff3b89eb..43fb5f7d3 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -232,7 +232,7 @@ spec: name: http selector: app.kubernetes.io/name: {{ include ".name" . }} - app.kubernetes.io/instancelease: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} ` const defaultNotes = `1. Get the application URL by running these commands: From 5faa4d3d21957b637addd78f8dd30df4bb1f46ab Mon Sep 17 00:00:00 2001 From: Caleb Delnay Date: Tue, 18 Sep 2018 17:00:30 -0400 Subject: [PATCH 368/449] Fix credentials not set for ResolveChartVersion default HTTP client (#4662) Fixes Issue #4299 and Issue #4445 Signed-off-by: Caleb Delnay --- pkg/downloader/chart_downloader.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 92c8f9165..5e6287299 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -170,8 +170,11 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, ge if err != nil { return u, nil, err } - getter, err := getterConstructor(ref, "", "", "") - return u, getter, err + g, err := getterConstructor(ref, "", "", "") + if t, ok := g.(*getter.HttpGetter); ok { + t.SetCredentials(c.Username, c.Password) + } + return u, g, err } return u, nil, err } From c5d2bbee6f6fb4d67fe10c0b5b5f70afbca43bf6 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 19 Sep 2018 11:20:32 -0700 Subject: [PATCH 369/449] fix(helm): fix regression with TLS flags/environment variables not being parsed (#4657) * fix(helm): fix regression with TLS flags/envvars This change fixes some of the assumptions made in an earlier commit. Helm's TLS flags and environment variables were not respected because they were parsed well before execution (during settings.AddFlagsTLS()), causing erroneous behaviour at runtime. By re-introducing environment.Init(), Helm can properly parse environment variables at the correct time. One change that had to occur in this PR is the fact that we need to call settings.Init() each time we call settings.AddFlagsTLS(). This is because each command owns its own FlagSet, so we need to parse each flagset to read and propagate the environment variables correctly. I also noticed that we were maintaining two separate variables for each TLS value. Refactoring out some of the older code to all use the settings object makes the code much cleaner to read and fixes an issue where setting a flag or environment variable would propagate to the settings object, but we'd be reading from tlsEnable. I've also added some unit tests to ensure this regression doesn't occur again. Signed-off-by: Matthew Fisher * fix bug where os.ExpandEnv() on the default value causes differing behaviour Signed-off-by: Matthew Fisher * add more context to the TODO/FIXME messages Signed-off-by: Matthew Fisher --- cmd/helm/delete.go | 3 + cmd/helm/get.go | 3 + cmd/helm/get_hooks.go | 4 + cmd/helm/get_manifest.go | 4 + cmd/helm/get_notes.go | 3 + cmd/helm/get_values.go | 4 + cmd/helm/helm.go | 49 ++-- cmd/helm/helm_test.go | 310 +++++++++++++++++++++++ cmd/helm/history.go | 3 + cmd/helm/init.go | 18 ++ cmd/helm/install.go | 3 + cmd/helm/list.go | 3 + cmd/helm/release_testing.go | 3 + cmd/helm/reset.go | 3 + cmd/helm/rollback.go | 3 + cmd/helm/status.go | 3 + cmd/helm/upgrade.go | 3 + cmd/helm/version.go | 3 + pkg/helm/environment/environment.go | 49 ++-- pkg/helm/environment/environment_test.go | 1 + 20 files changed, 429 insertions(+), 46 deletions(-) diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go index b78956ab6..4f52ffdd9 100755 --- a/cmd/helm/delete.go +++ b/cmd/helm/delete.go @@ -85,6 +85,9 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { f.Int64Var(&del.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.StringVar(&del.description, "description", "", "specify a description for the release") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/get.go b/cmd/helm/get.go index 719e0779d..20a4c042f 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -79,6 +79,9 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command { cmd.AddCommand(newGetHooksCmd(nil, out)) cmd.AddCommand(newGetNotesCmd(nil, out)) + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/get_hooks.go b/cmd/helm/get_hooks.go index 1f288245d..310b2ec73 100644 --- a/cmd/helm/get_hooks.go +++ b/cmd/helm/get_hooks.go @@ -60,6 +60,10 @@ func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command { f := cmd.Flags() settings.AddFlagsTLS(f) f.Int32Var(&ghc.version, "revision", 0, "get the named release with revision") + + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/get_manifest.go b/cmd/helm/get_manifest.go index 206c9d295..1cc7e3543 100644 --- a/cmd/helm/get_manifest.go +++ b/cmd/helm/get_manifest.go @@ -63,6 +63,10 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command { f := cmd.Flags() settings.AddFlagsTLS(f) f.Int32Var(&get.version, "revision", 0, "get the named release with revision") + + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/get_notes.go b/cmd/helm/get_notes.go index eaa3bc815..c7c3d7797 100644 --- a/cmd/helm/get_notes.go +++ b/cmd/helm/get_notes.go @@ -63,6 +63,9 @@ func newGetNotesCmd(client helm.Interface, out io.Writer) *cobra.Command { settings.AddFlagsTLS(f) f.Int32Var(&get.version, "revision", 0, "get the notes of the named release with revision") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/get_values.go b/cmd/helm/get_values.go index 38eb5f4bb..7cdfa636f 100644 --- a/cmd/helm/get_values.go +++ b/cmd/helm/get_values.go @@ -65,6 +65,10 @@ func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { f.Int32Var(&get.version, "revision", 0, "get the named release with revision") f.BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values") f.StringVar(&get.output, "output", "yaml", "output the specified format (json or yaml)") + + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 75fa2dc38..7f2bf369a 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -40,13 +40,6 @@ import ( ) var ( - tlsServerName string // overrides the server name used to verify the hostname on the returned certificates from the server. - tlsCaCertFile string // path to TLS CA certificate file - tlsCertFile string // path to TLS certificate file - tlsKeyFile string // path to TLS key file - tlsVerify bool // enable TLS and verify remote certificates - tlsEnable bool // enable TLS - tillerTunnel *kube.Tunnel settings helm_env.EnvSettings ) @@ -87,9 +80,21 @@ func newRootCmd(args []string) *cobra.Command { Long: globalUsage, SilenceUsage: true, PersistentPreRun: func(*cobra.Command, []string) { - tlsCaCertFile = os.ExpandEnv(tlsCaCertFile) - tlsCertFile = os.ExpandEnv(tlsCertFile) - tlsKeyFile = os.ExpandEnv(tlsKeyFile) + if settings.TLSCaCertFile == helm_env.DefaultTLSCaCert || settings.TLSCaCertFile == "" { + settings.TLSCaCertFile = settings.Home.TLSCaCert() + } else { + settings.TLSCaCertFile = os.ExpandEnv(settings.TLSCaCertFile) + } + if settings.TLSCertFile == helm_env.DefaultTLSCert || settings.TLSCertFile == "" { + settings.TLSCertFile = settings.Home.TLSCert() + } else { + settings.TLSCertFile = os.ExpandEnv(settings.TLSCertFile) + } + if settings.TLSKeyFile == helm_env.DefaultTLSKeyFile || settings.TLSKeyFile == "" { + settings.TLSKeyFile = settings.Home.TLSKey() + } else { + settings.TLSKeyFile = os.ExpandEnv(settings.TLSKeyFile) + } }, PersistentPostRun: func(*cobra.Command, []string) { teardown() @@ -143,6 +148,9 @@ func newRootCmd(args []string) *cobra.Command { flags.Parse(args) + // set defaults from environment + settings.Init(flags) + // Find and add plugins loadPlugins(cmd, out) @@ -275,24 +283,15 @@ func newClient() helm.Interface { options := []helm.Option{helm.Host(settings.TillerHost), helm.ConnectTimeout(settings.TillerConnectionTimeout)} if settings.TLSVerify || settings.TLSEnable { - if tlsCaCertFile == "" { - tlsCaCertFile = settings.Home.TLSCaCert() - } - if tlsCertFile == "" { - tlsCertFile = settings.Home.TLSCert() - } - if tlsKeyFile == "" { - tlsKeyFile = settings.Home.TLSKey() - } - debug("Host=%q, Key=%q, Cert=%q, CA=%q\n", tlsServerName, tlsKeyFile, tlsCertFile, tlsCaCertFile) + debug("Host=%q, Key=%q, Cert=%q, CA=%q\n", settings.TLSServerName, settings.TLSKeyFile, settings.TLSCertFile, settings.TLSCaCertFile) tlsopts := tlsutil.Options{ - ServerName: tlsServerName, - KeyFile: tlsKeyFile, - CertFile: tlsCertFile, + ServerName: settings.TLSServerName, + KeyFile: settings.TLSKeyFile, + CertFile: settings.TLSCertFile, InsecureSkipVerify: true, } - if tlsVerify { - tlsopts.CaCertFile = tlsCaCertFile + if settings.TLSVerify { + tlsopts.CaCertFile = settings.TLSCaCertFile tlsopts.InsecureSkipVerify = false } tlscfg, err := tlsutil.ClientConfig(tlsopts) diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index e79ad3c4b..24d1ab347 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -30,6 +30,7 @@ import ( "github.com/spf13/cobra" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/repo" @@ -229,6 +230,315 @@ func TestRootCmd(t *testing.T) { } } +func TestTLSFlags(t *testing.T) { + cleanup := resetEnv() + defer cleanup() + + homePath := os.Getenv("HELM_HOME") + if homePath == "" { + homePath = filepath.Join(os.Getenv("HOME"), ".helm") + } + + home := helmpath.Home(homePath) + + tests := []struct { + name string + args []string + envars map[string]string + settings environment.EnvSettings + }{ + { + name: "defaults", + args: []string{"version", "-c"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls enable", + args: []string{"version", "-c", "--tls"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: true, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls verify", + args: []string{"version", "-c", "--tls-verify"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: true, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls servername", + args: []string{"version", "-c", "--tls-hostname=foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "foo", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls cacert", + args: []string{"version", "-c", "--tls-ca-cert=/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: "/foo", + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls cert", + args: []string{"version", "-c", "--tls-cert=/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: "/foo", + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls key", + args: []string{"version", "-c", "--tls-key=/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: "/foo", + }, + }, + { + name: "tls enable envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_ENABLE": "true"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: true, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls verify envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_VERIFY": "true"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: true, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls servername envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_HOSTNAME": "foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "foo", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls cacert envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_CA_CERT": "/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: "/foo", + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls cert envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_CERT": "/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: "/foo", + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls key envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_KEY": "/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: "/foo", + }, + }, + } + + // ensure not set locally + tlsEnvvars := []string{ + "HELM_TLS_HOSTNAME", + "HELM_TLS_CA_CERT", + "HELM_TLS_CERT", + "HELM_TLS_KEY", + "HELM_TLS_VERIFY", + "HELM_TLS_ENABLE", + } + + for i := range tlsEnvvars { + os.Unsetenv(tlsEnvvars[i]) + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + + for k, v := range tt.envars { + os.Setenv(k, v) + defer os.Unsetenv(k) + } + + cmd := newRootCmd(tt.args) + cmd.SetOutput(ioutil.Discard) + cmd.SetArgs(tt.args) + cmd.Run = func(*cobra.Command, []string) {} + if err := cmd.Execute(); err != nil { + t.Errorf("unexpected error: %s", err) + } + + if settings != tt.settings { + t.Errorf("expected settings %v, got %v", tt.settings, settings) + } + }) + } +} + func resetEnv() func() { origSettings := settings origEnv := os.Environ() diff --git a/cmd/helm/history.go b/cmd/helm/history.go index 51bc34e75..365346e89 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -93,6 +93,9 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { f.UintVar(&his.colWidth, "col-width", 60, "specifies the max column width of output") f.StringVarP(&his.outputFormat, "output", "o", "table", "prints the output in the specified format (json|table|yaml)") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 4be54e675..b628dc008 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -70,6 +70,12 @@ var ( // This is the IPv4 loopback, not localhost, because we have to force IPv4 // for Dockerized Helm: https://github.com/kubernetes/helm/issues/1410 localRepositoryURL = "http://127.0.0.1:8879/charts" + tlsServerName string // overrides the server name used to verify the hostname on the returned certificates from the server. + tlsCaCertFile string // path to TLS CA certificate file + tlsCertFile string // path to TLS certificate file + tlsKeyFile string // path to TLS key file + tlsVerify bool // enable TLS and verify remote certificates + tlsEnable bool // enable TLS ) type initCmd struct { @@ -121,6 +127,10 @@ func newInitCmd(out io.Writer) *cobra.Command { f.BoolVar(&i.skipRefresh, "skip-refresh", false, "do not refresh (download) the local repository cache") f.BoolVar(&i.wait, "wait", false, "block until Tiller is running and ready to receive requests") + // TODO: replace TLS flags with pkg/helm/environment.AddFlagsTLS() in Helm 3 + // + // NOTE (bacongobbler): we can't do this in Helm 2 because the flag names differ, and `helm init --tls-ca-cert` + // doesn't conform with the rest of the TLS flag names (should be --tiller-tls-ca-cert in Helm 3) f.BoolVar(&tlsEnable, "tiller-tls", false, "install Tiller with TLS enabled") f.BoolVar(&tlsVerify, "tiller-tls-verify", false, "install Tiller with TLS enabled and to verify remote certificates") f.StringVar(&tlsKeyFile, "tiller-tls-key", "", "path to TLS key file to install with Tiller") @@ -166,6 +176,14 @@ func (i *initCmd) tlsOptions() error { return errors.New("missing required TLS CA file") } } + + // FIXME: remove once we use pkg/helm/environment.AddFlagsTLS() in Helm 3 + settings.TLSEnable = tlsEnable + settings.TLSVerify = tlsVerify + settings.TLSServerName = tlsServerName + settings.TLSCaCertFile = tlsCaCertFile + settings.TLSCertFile = tlsCertFile + settings.TLSKeyFile = tlsKeyFile } return nil } diff --git a/cmd/helm/install.go b/cmd/helm/install.go index a39e76434..9981a9879 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -220,6 +220,9 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&inst.depUp, "dep-up", false, "run helm dependency update before installing the chart") f.StringVar(&inst.description, "description", "", "specify a description for the release") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 384fca619..3ca3fbbfa 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -140,6 +140,9 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { // TODO: Do we want this as a feature of 'helm list'? //f.BoolVar(&list.superseded, "history", true, "show historical releases") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/release_testing.go b/cmd/helm/release_testing.go index c7231cf04..f39d9b81f 100644 --- a/cmd/helm/release_testing.go +++ b/cmd/helm/release_testing.go @@ -68,6 +68,9 @@ func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command { f.Int64Var(&rlsTest.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&rlsTest.cleanup, "cleanup", false, "delete test pods upon completion") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index ffae0a613..eb1dce7f1 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -81,6 +81,9 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVarP(&d.force, "force", "f", false, "forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.)") f.BoolVar(&d.removeHelmHome, "remove-helm-home", false, "if set deletes $HELM_HOME") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index 9798abf87..c35144eb4 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -87,6 +87,9 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&rollback.wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout") f.StringVar(&rollback.description, "description", "", "specify a description for the release") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/status.go b/cmd/helm/status.go index fe53081a4..b03453adc 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -81,6 +81,9 @@ func newStatusCmd(client helm.Interface, out io.Writer) *cobra.Command { f.Int32Var(&status.version, "revision", 0, "if set, display the status of the named release with revision") f.StringVarP(&status.outfmt, "output", "o", "", "output the status in the specified format (json or yaml)") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index b1bca898a..a539afaf1 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -177,6 +177,9 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.MarkDeprecated("disable-hooks", "use --no-hooks instead") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/version.go b/cmd/helm/version.go index 1c292e19d..a803a990b 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -83,6 +83,9 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&version.short, "short", false, "print the version number") f.StringVar(&version.template, "template", "", "template for version string format") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index 05d955d69..76348c3bd 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -87,17 +87,6 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&s.Debug, "debug", false, "enable verbose output") fs.StringVar(&s.TillerNamespace, "tiller-namespace", "kube-system", "namespace of Tiller") fs.Int64Var(&s.TillerConnectionTimeout, "tiller-connection-timeout", int64(300), "the duration (in seconds) Helm will wait to establish a connection to tiller") - - envMap := map[string]string{ - "debug": "HELM_DEBUG", - "home": "HELM_HOME", - "host": "HELM_HOST", - "tiller-namespace": "TILLER_NAMESPACE", - } - - for name, envar := range envMap { - setFlagFromEnv(name, envar, fs) - } } // AddFlagsTLS adds the flags for supporting client side TLS to the given flagset. @@ -108,23 +97,38 @@ func (s *EnvSettings) AddFlagsTLS(fs *pflag.FlagSet) { fs.StringVar(&s.TLSKeyFile, "tls-key", DefaultTLSKeyFile, "path to TLS key file") fs.BoolVar(&s.TLSVerify, "tls-verify", DefaultTLSVerify, "enable TLS for request and verify remote") fs.BoolVar(&s.TLSEnable, "tls", DefaultTLSEnable, "enable TLS for request") +} - envMap := map[string]string{ - "tls-hostname": "HELM_TLS_HOSTNAME", - "tls-ca-cert": "HELM_TLS_CA_CERT", - "tls-cert": "HELM_TLS_CERT", - "tls-key": "HELM_TLS_KEY", - "tls-verify": "HELM_TLS_VERIFY", - "tls": "HELM_TLS_ENABLE", +// Init sets values from the environment. +func (s *EnvSettings) Init(fs *pflag.FlagSet) { + for name, envar := range envMap { + setFlagFromEnv(name, envar, fs) } +} - for name, envar := range envMap { +// InitTLS sets TLS values from the environment. +func (s *EnvSettings) InitTLS(fs *pflag.FlagSet) { + for name, envar := range tlsEnvMap { setFlagFromEnv(name, envar, fs) } } -// Init is deprecated; calling `.AddFlags` or `.AddFlagsTLS` directly will set the flags to their default values from the environment, so this is a no-op. -func (s *EnvSettings) Init(fs *pflag.FlagSet) {} +// envMap maps flag names to envvars +var envMap = map[string]string{ + "debug": "HELM_DEBUG", + "home": "HELM_HOME", + "host": "HELM_HOST", + "tiller-namespace": "TILLER_NAMESPACE", +} + +var tlsEnvMap = map[string]string{ + "tls-hostname": "HELM_TLS_HOSTNAME", + "tls-ca-cert": "HELM_TLS_CA_CERT", + "tls-cert": "HELM_TLS_CERT", + "tls-key": "HELM_TLS_KEY", + "tls-verify": "HELM_TLS_VERIFY", + "tls": "HELM_TLS_ENABLE", +} // PluginDirs is the path to the plugin directories. func (s EnvSettings) PluginDirs() string { @@ -134,6 +138,9 @@ func (s EnvSettings) PluginDirs() string { return s.Home.Plugins() } +// setFlagFromEnv looks up and sets a flag if the corresponding environment variable changed. +// if the flag with the corresponding name was set during fs.Parse(), then the environment +// variable is ignored. func setFlagFromEnv(name, envar string, fs *pflag.FlagSet) { if fs.Changed(name) { return diff --git a/pkg/helm/environment/environment_test.go b/pkg/helm/environment/environment_test.go index fb05254ed..675582cf6 100644 --- a/pkg/helm/environment/environment_test.go +++ b/pkg/helm/environment/environment_test.go @@ -123,6 +123,7 @@ func TestEnvSettings(t *testing.T) { flags.Parse(tt.args) settings.Init(flags) + settings.InitTLS(flags) if settings.Home != helmpath.Home(tt.home) { t.Errorf("expected home %q, got %q", tt.home, settings.Home) From 83f044191f3e1d0ddb1684a88700a1b34fc07238 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 25 Sep 2018 17:18:21 -0400 Subject: [PATCH 370/449] fix(helm): fix paths in the ingress template and values file written by helm create Signed-off-by: Arash Deshmeh --- pkg/chartutil/create.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 43fb5f7d3..61dce9fa4 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -71,7 +71,7 @@ ingress: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - path: / + paths: [] hosts: - chart-example.local tls: [] @@ -123,7 +123,7 @@ const defaultIgnore = `# Patterns to ignore when building packages. const defaultIngress = `{{- if .Values.ingress.enabled -}} {{- $fullName := include ".fullname" . -}} -{{- $ingressPath := .Values.ingress.path -}} +{{- $ingressPaths := .Values.ingress.paths -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -153,10 +153,12 @@ spec: - host: {{ . | quote }} http: paths: - - path: {{ $ingressPath }} + {{- range $ingressPaths }} + - path: {{ . }} backend: serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }} ` @@ -237,8 +239,10 @@ spec: const defaultNotes = `1. Get the application URL by running these commands: {{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- range $host := .Values.ingress.hosts }} + {{- range $.Values.ingress.paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }} + {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include ".fullname" . }}) From 75a8359e4da97062746f2f99e0b9faded16d4c2b Mon Sep 17 00:00:00 2001 From: Colin Panisset Date: Thu, 27 Sep 2018 10:38:39 +1000 Subject: [PATCH 371/449] Don't assume that the returned error from the storage driver isn't nil (#3625) (#4627) Signed-off-by: Colin Panisset --- pkg/tiller/release_server.go | 21 +++++++++--- pkg/tiller/release_server_test.go | 57 +++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index e913579aa..e562be203 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -202,15 +202,28 @@ func (s *ReleaseServer) uniqName(start string, reuse bool) (string, error) { return "", fmt.Errorf("a release named %s already exists.\nRun: helm ls --all %s; to check the status of the release\nOr run: helm del --purge %s; to delete it", start, start, start) } + moniker := moniker.New() + newname, err := s.createUniqName(moniker) + if err != nil { + return "ERROR", err + } + + s.Log("info: Created new release name %s", newname) + return newname, nil + +} + +func (s *ReleaseServer) createUniqName(m moniker.Namer) (string, error) { maxTries := 5 for i := 0; i < maxTries; i++ { - namer := moniker.New() - name := namer.NameSep("-") + name := m.NameSep("-") if len(name) > releaseNameMaxLen { name = name[:releaseNameMaxLen] } - if _, err := s.env.Releases.Get(name, 1); strings.Contains(err.Error(), "not found") { - return name, nil + if _, err := s.env.Releases.Get(name, 1); err != nil { + if strings.Contains(err.Error(), "not found") { + return name, nil + } } s.Log("info: generated name %s is taken. Searching again.", name) } diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index f3fca7390..b8adb4bb2 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -28,6 +28,7 @@ import ( "github.com/ghodss/yaml" "github.com/golang/protobuf/ptypes/timestamp" + "github.com/technosophos/moniker" "golang.org/x/net/context" "google.golang.org/grpc/metadata" "k8s.io/kubernetes/pkg/apis/core" @@ -380,6 +381,62 @@ func TestUniqName(t *testing.T) { } } +type fakeNamer struct { + name string +} + +func NewFakeNamer(nam string) moniker.Namer { + return &fakeNamer{ + name: nam, + } +} + +func (f *fakeNamer) Name() string { + return f.NameSep(" ") +} + +func (f *fakeNamer) NameSep(sep string) string { + return f.name +} + +func TestCreateUniqueName(t *testing.T) { + rs := rsFixture() + + rel1 := releaseStub() + rel1.Name = "happy-panda" + + rs.env.Releases.Create(rel1) + + tests := []struct { + name string + expect string + err bool + }{ + {"happy-panda", "ERROR", true}, + {"wobbly-octopus", "[a-z]+-[a-z]+", false}, + } + + for _, tt := range tests { + m := NewFakeNamer(tt.name) + u, err := rs.createUniqName(m) + if err != nil { + if tt.err { + continue + } + t.Fatal(err) + } + if tt.err { + t.Errorf("Expected an error for %q", tt.name) + } + if match, err := regexp.MatchString(tt.expect, u); err != nil { + t.Fatal(err) + } else if !match { + t.Errorf("Expected %q to match %q", u, tt.expect) + } + } + +} + func releaseWithKeepStub(rlsName string) *release.Release { ch := &chart.Chart{ Metadata: &chart.Metadata{ From 79ebe1ae3ec08d9544a3a6b938ca0c9506c5346d Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Fri, 28 Sep 2018 08:22:52 -0600 Subject: [PATCH 372/449] docs(provenance): update explanation of new GnuPG format (#4710) Signed-off-by: Matt Butcher --- docs/provenance.md | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/docs/provenance.md b/docs/provenance.md index 331074e8c..d8f9e4089 100644 --- a/docs/provenance.md +++ b/docs/provenance.md @@ -22,12 +22,17 @@ Prerequisites: - A valid PGP keypair in a binary (not ASCII-armored) format - The `helm` command line tool -- GnuPG command line tools (optional) +- GnuPG >=2.1 command line tools (optional) - Keybase command line tools (optional) **NOTE:** If your PGP private key has a passphrase, you will be prompted to enter that passphrase for any commands that support the `--sign` option. +**NOTE:** The keyfile format for GnuPG changed in version 2.1. Prior to that release +it was unnecessary to export keys out of GnuPG, and you could instead point Helm +at your `*.gpg` files. With 2.1, the new `.kbx` format was introduced, and this +format is not supported by Helm. + Creating a new chart is the same as before: ``` @@ -42,10 +47,10 @@ the name under which the signing key is known and the keyring containing the cor $ helm package --sign --key 'helm signing key' --keyring path/to/keyring.secret mychart ``` -**TIP:** for GnuPG users, your secret keyring is in `~/.gnupg/secring.gpg`. You can +**TIP:** for GnuPG users, your secret keyring is in `~/.gnupg/secring.kbx`. You can use `gpg --list-secret-keys` to list the keys you have. -**Warning:** the GnuPG v2 store your secret keyring using a new format 'kbx' on the default location '~/.gnupg/pubring.kbx'. Please use the following command to convert your keyring to the legacy gpg format: +**Warning:** the GnuPG v2.1 store your secret keyring using a new format 'kbx' on the default location '~/.gnupg/pubring.kbx'. Please use the following command to convert your keyring to the legacy gpg format: ``` $ gpg --export-secret-keys >~/.gnupg/secring.gpg @@ -95,24 +100,16 @@ Prerequisites: The first step is to import your keybase keys into your local GnuPG keyring: ``` -$ keybase pgp export -s | gpg --import +$ keybase pgp export -s > secring.gpg ``` -This will convert your Keybase key into the OpenPGP format, and then import it -locally into your `~/.gnupg/secring.gpg` file. - -You can double check by running `gpg --list-secret-keys`. +This will convert your Keybase key into the OpenPGP format, and then place it +locally into your `secring.gpg` file. -``` -$ gpg --list-secret-keys 1 ↵ -/Users/mattbutcher/.gnupg/secring.gpg -------------------------------------- -sec 2048R/1FC18762 2016-07-25 -uid technosophos (keybase.io/technosophos) -ssb 2048R/D125E546 2016-07-25 -``` +> Tip: If you need to add a Keybase key to an existing keyring, you will need to +> do `keybase pgp export -s | gpg --import && gpg --export-secret-keys --outfile secring.gpg` -Note that your secret key will have an identifier string: +Your secret key will have an identifier string: ``` technosophos (keybase.io/technosophos) From 4e9bbcab5eb0cc6117720f79fdd93e9faeb4a99d Mon Sep 17 00:00:00 2001 From: adshmh <23505281+adshmh@users.noreply.github.com> Date: Mon, 1 Oct 2018 15:27:17 -0400 Subject: [PATCH 373/449] feat(helm): use apps/v1 as deployment apiVersion (#4725) Use 'apps/v1' as the apiVersion field for the deployment.yaml written by the 'helm create' command, rather than the deprecated 'apps/v1beta2'. Signed-off-by: Arash Deshmeh --- pkg/chartutil/create.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 61dce9fa4..beadf71cf 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -163,7 +163,7 @@ spec: {{- end }} ` -const defaultDeployment = `apiVersion: apps/v1beta2 +const defaultDeployment = `apiVersion: apps/v1 kind: Deployment metadata: name: {{ include ".fullname" . }} From e511bdcf7c07c97791dc3cd6da1289969cce2481 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Thu, 4 Oct 2018 10:28:34 -0700 Subject: [PATCH 374/449] ref(*): kubernetes v1.12 support Signed-off-by: Adam Reese --- cmd/helm/helm.go | 17 +-- cmd/helm/installer/uninstall.go | 12 +- cmd/helm/installer/uninstall_test.go | 16 +-- cmd/helm/reset.go | 7 +- cmd/helm/reset_test.go | 6 +- cmd/rudder/rudder.go | 8 +- cmd/tiller/tiller.go | 7 +- glide.lock | 97 +++++++-------- glide.yaml | 121 +++++++++---------- pkg/helm/portforwarder/portforwarder_test.go | 2 +- pkg/kube/client.go | 60 ++++----- pkg/kube/client_test.go | 30 ++--- pkg/kube/namespace.go | 16 +-- pkg/kube/namespace_test.go | 4 +- pkg/kube/result.go | 2 +- pkg/kube/result_test.go | 2 +- pkg/releasetesting/environment.go | 4 +- pkg/releasetesting/test_suite.go | 10 +- pkg/releasetesting/test_suite_test.go | 10 +- pkg/storage/driver/cfgmaps.go | 12 +- pkg/storage/driver/cfgmaps_test.go | 4 +- pkg/storage/driver/mock_test.go | 53 ++++---- pkg/storage/driver/secrets.go | 12 +- pkg/storage/driver/secrets_test.go | 4 +- pkg/tiller/environment/environment.go | 10 +- pkg/tiller/environment/environment_test.go | 10 +- pkg/tiller/release_modules.go | 4 +- pkg/tiller/release_server.go | 6 +- pkg/tiller/release_server_test.go | 10 +- 29 files changed, 267 insertions(+), 289 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 7f2bf369a..02a1e6edb 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -28,10 +28,10 @@ import ( "google.golang.org/grpc/status" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" // Import to initialize client auth plugins. _ "k8s.io/client-go/plugin/pkg/client/auth" + "k8s.io/helm/pkg/helm" helm_env "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/portforwarder" @@ -256,21 +256,6 @@ func getKubeClient(context string, kubeconfig string) (*rest.Config, kubernetes. return config, client, nil } -// getInternalKubeClient creates a Kubernetes config and an "internal" client for a given kubeconfig context. -// -// Prefer the similar getKubeClient if you don't need to use such an internal client. -func getInternalKubeClient(context string, kubeconfig string) (internalclientset.Interface, error) { - config, err := configForContext(context, kubeconfig) - if err != nil { - return nil, err - } - client, err := internalclientset.NewForConfig(config) - if err != nil { - return nil, fmt.Errorf("could not get Kubernetes client: %s", err) - } - return client, nil -} - // ensureHelmClient returns a new helm client impl. if h is not nil. func ensureHelmClient(h helm.Interface) helm.Interface { if h != nil { diff --git a/cmd/helm/installer/uninstall.go b/cmd/helm/installer/uninstall.go index 54e79bdf4..db824ca0b 100644 --- a/cmd/helm/installer/uninstall.go +++ b/cmd/helm/installer/uninstall.go @@ -19,8 +19,8 @@ package installer // import "k8s.io/helm/cmd/helm/installer" import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" - coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" + "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/kubernetes/typed/core/v1" ) const ( @@ -30,7 +30,7 @@ const ( ) // Uninstall uses Kubernetes client to uninstall Tiller. -func Uninstall(client internalclientset.Interface, opts *Options) error { +func Uninstall(client kubernetes.Interface, opts *Options) error { if err := deleteService(client.Core(), opts.Namespace); err != nil { return err } @@ -41,7 +41,7 @@ func Uninstall(client internalclientset.Interface, opts *Options) error { } // deleteService deletes the Tiller Service resource -func deleteService(client coreclient.ServicesGetter, namespace string) error { +func deleteService(client corev1.ServicesGetter, namespace string) error { err := client.Services(namespace).Delete(serviceName, &metav1.DeleteOptions{}) return ingoreNotFound(err) } @@ -49,13 +49,13 @@ func deleteService(client coreclient.ServicesGetter, namespace string) error { // deleteDeployment deletes the Tiller Deployment resource // We need to use the reaper instead of the kube API because GC for deployment dependents // is not yet supported at the k8s server level (<= 1.5) -func deleteDeployment(client internalclientset.Interface, namespace string) error { +func deleteDeployment(client kubernetes.Interface, namespace string) error { err := client.Extensions().Deployments(namespace).Delete(deploymentName, &metav1.DeleteOptions{}) return ingoreNotFound(err) } // deleteSecret deletes the Tiller Secret resource -func deleteSecret(client coreclient.SecretsGetter, namespace string) error { +func deleteSecret(client corev1.SecretsGetter, namespace string) error { err := client.Secrets(namespace).Delete(secretName, &metav1.DeleteOptions{}) return ingoreNotFound(err) } diff --git a/cmd/helm/installer/uninstall_test.go b/cmd/helm/installer/uninstall_test.go index 7e5be8aaa..68bbd7c72 100644 --- a/cmd/helm/installer/uninstall_test.go +++ b/cmd/helm/installer/uninstall_test.go @@ -19,17 +19,17 @@ package installer // import "k8s.io/helm/cmd/helm/installer" import ( "testing" + "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/kubernetes/fake" testcore "k8s.io/client-go/testing" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" ) func TestUninstall(t *testing.T) { fc := &fake.Clientset{} - opts := &Options{Namespace: core.NamespaceDefault} + opts := &Options{Namespace: v1.NamespaceDefault} if err := Uninstall(fc, opts); err != nil { t.Errorf("unexpected error: %#+v", err) } @@ -45,7 +45,7 @@ func TestUninstall_serviceNotFound(t *testing.T) { return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "services"}, "1") }) - opts := &Options{Namespace: core.NamespaceDefault} + opts := &Options{Namespace: v1.NamespaceDefault} if err := Uninstall(fc, opts); err != nil { t.Errorf("unexpected error: %#+v", err) } @@ -58,10 +58,10 @@ func TestUninstall_serviceNotFound(t *testing.T) { func TestUninstall_deploymentNotFound(t *testing.T) { fc := &fake.Clientset{} fc.AddReactor("delete", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { - return true, nil, apierrors.NewNotFound(core.Resource("deployments"), "1") + return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "deployments"}, "1") }) - opts := &Options{Namespace: core.NamespaceDefault} + opts := &Options{Namespace: v1.NamespaceDefault} if err := Uninstall(fc, opts); err != nil { t.Errorf("unexpected error: %#+v", err) } @@ -74,10 +74,10 @@ func TestUninstall_deploymentNotFound(t *testing.T) { func TestUninstall_secretNotFound(t *testing.T) { fc := &fake.Clientset{} fc.AddReactor("delete", "secrets", func(action testcore.Action) (bool, runtime.Object, error) { - return true, nil, apierrors.NewNotFound(core.Resource("secrets"), "1") + return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "secrets"}, "1") }) - opts := &Options{Namespace: core.NamespaceDefault} + opts := &Options{Namespace: v1.NamespaceDefault} if err := Uninstall(fc, opts); err != nil { t.Errorf("unexpected error: %#+v", err) } diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index eb1dce7f1..887ce34d0 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -23,7 +23,8 @@ import ( "os" "github.com/spf13/cobra" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + + "k8s.io/client-go/kubernetes" "k8s.io/helm/cmd/helm/installer" "k8s.io/helm/pkg/helm" @@ -44,7 +45,7 @@ type resetCmd struct { out io.Writer home helmpath.Home client helm.Interface - kubeClient internalclientset.Interface + kubeClient kubernetes.Interface } func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { @@ -90,7 +91,7 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { // runReset uninstalls tiller from Kubernetes Cluster and deletes local config func (d *resetCmd) run() error { if d.kubeClient == nil { - c, err := getInternalKubeClient(settings.KubeContext, settings.KubeConfig) + _, c, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return fmt.Errorf("could not get kubernetes client: %s", err) } diff --git a/cmd/helm/reset_test.go b/cmd/helm/reset_test.go index 8a74e8af5..78055d866 100644 --- a/cmd/helm/reset_test.go +++ b/cmd/helm/reset_test.go @@ -23,8 +23,8 @@ import ( "strings" "testing" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" + "k8s.io/api/core/v1" + "k8s.io/client-go/kubernetes/fake" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm/helmpath" @@ -101,7 +101,7 @@ func verifyResetCmd(t *testing.T, tc resetCase) { home: helmpath.Home(home), client: c, kubeClient: fc, - namespace: core.NamespaceDefault, + namespace: v1.NamespaceDefault, } err = cmd.run() diff --git a/cmd/rudder/rudder.go b/cmd/rudder/rudder.go index 8897e78be..051640542 100644 --- a/cmd/rudder/rudder.go +++ b/cmd/rudder/rudder.go @@ -21,12 +21,12 @@ import ( "fmt" "net" + "github.com/spf13/pflag" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/client-go/kubernetes" - "github.com/spf13/pflag" "k8s.io/helm/pkg/kube" rudderAPI "k8s.io/helm/pkg/proto/hapi/rudder" "k8s.io/helm/pkg/tiller" @@ -34,7 +34,7 @@ import ( ) var kubeClient *kube.Client -var clientset internalclientset.Interface +var clientset kubernetes.Interface type options struct { listen string @@ -59,7 +59,7 @@ func main() { opts.regAndParseFlags() var err error kubeClient = kube.New(nil) - clientset, err = kubeClient.ClientSet() + clientset, err = kubeClient.KubernetesClientSet() if err != nil { grpclog.Fatalf("Cannot initialize Kubernetes connection: %s", err) } diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index 4c3623e59..478ca92f4 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -39,6 +39,7 @@ import ( // Import to initialize client auth plugins. _ "k8s.io/client-go/plugin/pkg/client/auth" + "k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/storage" @@ -120,7 +121,7 @@ func start() { healthSrv := health.NewServer() healthSrv.SetServingStatus("Tiller", healthpb.HealthCheckResponse_NOT_SERVING) - clientset, err := kube.New(nil).ClientSet() + clientset, err := kube.New(nil).KubernetesClientSet() if err != nil { logger.Fatalf("Cannot initialize Kubernetes connection: %s", err) } @@ -129,13 +130,13 @@ func start() { case storageMemory: env.Releases = storage.Init(driver.NewMemory()) case storageConfigMap: - cfgmaps := driver.NewConfigMaps(clientset.Core().ConfigMaps(namespace())) + cfgmaps := driver.NewConfigMaps(clientset.CoreV1().ConfigMaps(namespace())) cfgmaps.Log = newLogger("storage/driver").Printf env.Releases = storage.Init(cfgmaps) env.Releases.Log = newLogger("storage").Printf case storageSecret: - secrets := driver.NewSecrets(clientset.Core().Secrets(namespace())) + secrets := driver.NewSecrets(clientset.CoreV1().Secrets(namespace())) secrets.Log = newLogger("storage/driver").Printf env.Releases = storage.Init(secrets) diff --git a/glide.lock b/glide.lock index 298de2612..c25f439bd 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: a4a7df055da2413c8e42cb127833a77d6a2910396efdabf5a7dc5af956478fef -updated: 2018-09-13T18:30:19.732109-06:00 +hash: 30b1d3f31b7bd310a9434e081bae3d5dc18c0a79b3674c0adffccc8d602e9227 +updated: 2018-10-04T17:11:58.043264Z imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -11,22 +11,23 @@ imports: - name: github.com/asaskevich/govalidator version: 7664702784775e51966f0885f5cd27435916517b - name: github.com/Azure/go-ansiterm - version: 19f72df4d05d31cbe1c56bfc8045c96babff6c7e + version: d6e3b3328b783f23731bc4d058875b0371ff8109 subpackages: - winterm - name: github.com/Azure/go-autorest - version: 1ff28809256a84bb6966640ff3d0371af82ccba4 + version: bca49d5b51a50dc5bb17bbf6204c711c6dbded06 subpackages: - autorest - autorest/adal - autorest/azure - autorest/date + - version - name: github.com/beorn7/perks version: 3ac7bf7a47d159a033b107610db8a1b6575507a4 subpackages: - quantile - name: github.com/BurntSushi/toml - version: b26d9c308763d68093482582cea63d69be07a0f0 + version: 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 - name: github.com/chai2010/gettext-go version: c6fed771bfd517099caf0f7a961671fa8ed08723 subpackages: @@ -52,7 +53,7 @@ imports: - digestset - reference - name: github.com/docker/docker - version: 4f3616fb1c112e206b88cb7a9922bf49067a7756 + version: a9fbbdc8dd8794b20af358382ab780559bca589d subpackages: - api - api/types @@ -71,19 +72,15 @@ imports: - api/types/versions - api/types/volume - client - - pkg/ioutils - - pkg/jsonlog + - daemon/logger/jsonfilelog/jsonlog - pkg/jsonmessage - - pkg/longpath - pkg/mount - pkg/parsers - pkg/parsers/operatingsystem - pkg/stdcopy - pkg/sysinfo - - pkg/system - pkg/term - pkg/term/windows - - pkg/tlsconfig - name: github.com/docker/go-connections version: 3ede32e2033de7505e6500d6c868c2b9ed9f169d subpackages: @@ -97,7 +94,7 @@ imports: subpackages: - spdy - name: github.com/evanphx/json-patch - version: 94e38aa1586e8a6c8a75770bddf5ff84c48a106b + version: 36442dbdb585210f8d5a1b45e67aa323c197d5c4 - name: github.com/exponent-io/jsonpath version: d6023ce2651d8eafb5c75bb0c7167536102ec9f5 - name: github.com/fatih/camelcase @@ -180,7 +177,7 @@ imports: - name: github.com/huandu/xstrings version: 3959339b333561bf62a38b424fd41517c2c90f40 - name: github.com/imdario/mergo - version: 6633656539c1639d9d78127b7d47c622b5d7b6dc + version: 9316a62528ac99aaecb4e47eadd6dc8aa6533d58 - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - name: github.com/json-iterator/go @@ -202,7 +199,7 @@ imports: - name: github.com/mattn/go-runewidth version: d6bea18f789704b5f83375793155289da36a3c7f - name: github.com/matttproud/golang_protobuf_extensions - version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a + version: c12348ce28de40eed0136aa2b644d0ee0650e56c subpackages: - pbutil - name: github.com/mitchellh/go-wordwrap @@ -256,11 +253,11 @@ imports: subpackages: - doc - name: github.com/spf13/pflag - version: 583c0c0531f06d5278b7d917446061adc344b5cd + version: 298182f68c66c05229eb03ac171abe6e309ee79a - name: github.com/technosophos/moniker version: a5dbd03a2245d554160e3ae6bfdcf969fe58b431 - name: golang.org/x/crypto - version: 49796115aa4b964c318aad4f3084fdb41e9aa067 + version: de0752318171da717af4ce24d0a2e8626afaeb11 subpackages: - cast5 - ed25519 @@ -294,7 +291,7 @@ imports: - jws - jwt - name: golang.org/x/sys - version: 43eea11bc92608addb41b8a406b0407495c106f6 + version: 95c6576299259db960f6c5b9b69ea52422860fce subpackages: - unix - windows @@ -361,7 +358,7 @@ imports: - name: gopkg.in/inf.v0 version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4 - name: gopkg.in/square/go-jose.v2 - version: f8f38de21b4dcd69d0413faf231983f5fd6634b1 + version: 89060dee6a84df9a4dae49f676f0c755037834f1 subpackages: - cipher - json @@ -369,7 +366,7 @@ imports: - name: gopkg.in/yaml.v2 version: 670d4cfef0544295bc27a114dbac37980d83185a - name: k8s.io/api - version: 2d6f90ab1293a1fb871cf149423ebb72aa7423aa + version: fd83cbc87e7632ccd8bbab63d2b673d4e0c631cc subpackages: - admission/v1beta1 - admissionregistration/v1alpha1 @@ -383,10 +380,12 @@ imports: - authorization/v1beta1 - autoscaling/v1 - autoscaling/v2beta1 + - autoscaling/v2beta2 - batch/v1 - batch/v1beta1 - batch/v2alpha1 - certificates/v1beta1 + - coordination/v1beta1 - core/v1 - events/v1beta1 - extensions/v1beta1 @@ -403,11 +402,11 @@ imports: - storage/v1alpha1 - storage/v1beta1 - name: k8s.io/apiextensions-apiserver - version: 898b0eda132e1aeac43a459785144ee4bf9b0a2e + version: 05e89e265cc594459a3d33a63e779d94e6614c63 subpackages: - pkg/features - name: k8s.io/apimachinery - version: 103fd098999dc9c0c88536f5c9ad2e5da39373ae + version: 6dd46049f39503a1fc8d65de4bd566829e95faff subpackages: - pkg/api/equality - pkg/api/errors @@ -447,6 +446,7 @@ imports: - pkg/util/intstr - pkg/util/json - pkg/util/mergepatch + - pkg/util/naming - pkg/util/net - pkg/util/rand - pkg/util/remotecommand @@ -463,7 +463,7 @@ imports: - third_party/forked/golang/netutil - third_party/forked/golang/reflect - name: k8s.io/apiserver - version: 8b122ec9e3bbab91a262d17a39325e69349dc44d + version: e85ad7b666fef0476185731329f4cff1536efff8 subpackages: - pkg/apis/audit - pkg/authentication/authenticator @@ -472,8 +472,14 @@ imports: - pkg/endpoints/request - pkg/features - pkg/util/feature +- name: k8s.io/cli-runtime + version: 79bf4e0b64544d8c490247abae089bea572ddae6 + subpackages: + - pkg/genericclioptions + - pkg/genericclioptions/printers + - pkg/genericclioptions/resource - name: k8s.io/client-go - version: 59698c7d9724b0f95f9dc9e7f7dfdcc3dfeceb82 + version: 1638f8970cefaa404ff3a62950f88b08292b2696 subpackages: - discovery - discovery/fake @@ -504,6 +510,8 @@ imports: - kubernetes/typed/autoscaling/v1/fake - kubernetes/typed/autoscaling/v2beta1 - kubernetes/typed/autoscaling/v2beta1/fake + - kubernetes/typed/autoscaling/v2beta2 + - kubernetes/typed/autoscaling/v2beta2/fake - kubernetes/typed/batch/v1 - kubernetes/typed/batch/v1/fake - kubernetes/typed/batch/v1beta1 @@ -512,6 +520,8 @@ imports: - kubernetes/typed/batch/v2alpha1/fake - kubernetes/typed/certificates/v1beta1 - kubernetes/typed/certificates/v1beta1/fake + - kubernetes/typed/coordination/v1beta1 + - kubernetes/typed/coordination/v1beta1/fake - kubernetes/typed/core/v1 - kubernetes/typed/core/v1/fake - kubernetes/typed/events/v1beta1 @@ -540,8 +550,6 @@ imports: - kubernetes/typed/storage/v1alpha1/fake - kubernetes/typed/storage/v1beta1 - kubernetes/typed/storage/v1beta1/fake - - listers/apps/v1 - - listers/core/v1 - pkg/apis/clientauthentication - pkg/apis/clientauthentication/v1alpha1 - pkg/apis/clientauthentication/v1beta1 @@ -578,6 +586,7 @@ imports: - tools/record - tools/reference - tools/remotecommand + - tools/watch - transport - transport/spdy - util/buffer @@ -590,13 +599,13 @@ imports: - util/jsonpath - util/retry - name: k8s.io/kube-openapi - version: 91cfa479c814065e420cee7ed227db0f63a5854e + version: 0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803 subpackages: - pkg/util/proto - pkg/util/proto/testing - pkg/util/proto/validation - name: k8s.io/kubernetes - version: 2e809eed16445fff9dcbfc56e9936cf76ccbdadc + version: 54a352dda957bce0f88e49b65a6ee8bba8c0ba74 subpackages: - pkg/api/events - pkg/api/legacyscheme @@ -630,6 +639,7 @@ imports: - pkg/apis/autoscaling/install - pkg/apis/autoscaling/v1 - pkg/apis/autoscaling/v2beta1 + - pkg/apis/autoscaling/v2beta2 - pkg/apis/batch - pkg/apis/batch/install - pkg/apis/batch/v1 @@ -638,9 +648,9 @@ imports: - pkg/apis/certificates - pkg/apis/certificates/install - pkg/apis/certificates/v1beta1 - - pkg/apis/componentconfig - - pkg/apis/componentconfig/install - - pkg/apis/componentconfig/v1alpha1 + - pkg/apis/coordination + - pkg/apis/coordination/install + - pkg/apis/coordination/v1beta1 - pkg/apis/core - pkg/apis/core/helper - pkg/apis/core/helper/qos @@ -684,40 +694,24 @@ imports: - pkg/apis/storage/v1beta1 - pkg/capabilities - pkg/client/clientset_generated/internalclientset - - pkg/client/clientset_generated/internalclientset/fake - pkg/client/clientset_generated/internalclientset/scheme - pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion - - pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/apps/internalversion - - pkg/client/clientset_generated/internalclientset/typed/apps/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion - - pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion - - pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion - - pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/batch/internalversion - - pkg/client/clientset_generated/internalclientset/typed/batch/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/certificates/internalversion - - pkg/client/clientset_generated/internalclientset/typed/certificates/internalversion/fake + - pkg/client/clientset_generated/internalclientset/typed/coordination/internalversion - pkg/client/clientset_generated/internalclientset/typed/core/internalversion - - pkg/client/clientset_generated/internalclientset/typed/core/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/events/internalversion - - pkg/client/clientset_generated/internalclientset/typed/events/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion - - pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/networking/internalversion - - pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/policy/internalversion - - pkg/client/clientset_generated/internalclientset/typed/policy/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/rbac/internalversion - - pkg/client/clientset_generated/internalclientset/typed/rbac/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/scheduling/internalversion - - pkg/client/clientset_generated/internalclientset/typed/scheduling/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/settings/internalversion - - pkg/client/clientset_generated/internalclientset/typed/settings/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion - - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion/fake - pkg/controller - pkg/controller/deployment/util - pkg/credentialprovider @@ -733,9 +727,6 @@ imports: - pkg/kubectl/cmd/util/openapi - pkg/kubectl/cmd/util/openapi/testing - pkg/kubectl/cmd/util/openapi/validation - - pkg/kubectl/genericclioptions - - pkg/kubectl/genericclioptions/printers - - pkg/kubectl/genericclioptions/resource - pkg/kubectl/scheme - pkg/kubectl/util - pkg/kubectl/util/hash @@ -763,16 +754,16 @@ imports: - pkg/util/net/sets - pkg/util/node - pkg/util/parsers - - pkg/util/pointer - pkg/util/slice - pkg/util/taints - pkg/version - name: k8s.io/utils - version: 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e + version: 66066c83e385e385ccc3c964b44fd7dcd413d0ed subpackages: - clock - exec - exec/testing + - pointer - name: vbom.ml/util version: db5cfe13f5cc80a4990d98e2e1b0707a4d1a5394 subpackages: @@ -783,7 +774,7 @@ testImports: subpackages: - difflib - name: github.com/stretchr/testify - version: e3a8ff8ce36581f87a15341206f205b1da467059 + version: c679ae2cc0cb27ec3293fea7e254e47386f05d69 subpackages: - assert - require diff --git a/glide.yaml b/glide.yaml index 716fc56ef..37c3f857e 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,69 +1,64 @@ package: k8s.io/helm import: -- package: golang.org/x/net - subpackages: - - context -- package: github.com/spf13/cobra - version: c439c4fa093711d42e1b01acb1235b52004753c1 -- package: github.com/spf13/pflag - version: 583c0c0531f06d5278b7d917446061adc344b5cd -- package: github.com/Masterminds/vcs - version: ~1.11.0 + - package: golang.org/x/net + subpackages: + - context + - package: github.com/spf13/cobra + version: c439c4fa093711d42e1b01acb1235b52004753c1 + - package: github.com/spf13/pflag + version: ~1.0.1 + - package: github.com/Masterminds/vcs # Pin version of mergo that is compatible with both sprig and Kubernetes -- package: github.com/imdario/mergo - version: 6633656539c1639d9d78127b7d47c622b5d7b6dc -- package: github.com/Masterminds/sprig - version: ^2.16.0 -- package: github.com/ghodss/yaml -- package: github.com/Masterminds/semver - version: ~1.3.1 -- package: github.com/technosophos/moniker - version: ~0.2 -- package: github.com/golang/protobuf - version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 - subpackages: - - proto - - ptypes/any - - ptypes/timestamp -- package: google.golang.org/grpc - version: 1.7.2 -- package: github.com/gosuri/uitable -- package: github.com/asaskevich/govalidator - version: ^4.0.0 -- package: golang.org/x/crypto - subpackages: - - openpgp - - ssh/terminal -# pin version of golang.org/x/sys that is compatible with golang.org/x/crypto -- package: golang.org/x/sys - version: 43eea11 - subpackages: - - unix - - windows -- package: github.com/gobwas/glob - version: ^0.2.1 -- package: github.com/evanphx/json-patch -- package: github.com/BurntSushi/toml - version: ~0.3.0 -- package: github.com/prometheus/client_golang - version: 0.8.0 -- package: github.com/grpc-ecosystem/go-grpc-prometheus + - package: github.com/imdario/mergo + version: v0.3.5 + - package: github.com/Masterminds/sprig + version: ^2.16.0 + - package: github.com/ghodss/yaml + - package: github.com/Masterminds/semver + version: ~1.3.1 + - package: github.com/technosophos/moniker + version: ~0.2 + - package: github.com/golang/protobuf + version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 + subpackages: + - proto + - ptypes/any + - ptypes/timestamp + - package: google.golang.org/grpc + version: 1.7.2 + - package: github.com/gosuri/uitable + - package: github.com/asaskevich/govalidator + version: ^4.0.0 + - package: golang.org/x/crypto + subpackages: + - openpgp + - ssh/terminal + - package: github.com/gobwas/glob + version: ^0.2.1 + - package: github.com/evanphx/json-patch + - package: github.com/BurntSushi/toml + version: ~0.3.0 + - package: github.com/prometheus/client_golang + version: 0.8.0 + - package: github.com/grpc-ecosystem/go-grpc-prometheus -- package: k8s.io/kubernetes - version: release-1.11 -- package: k8s.io/client-go - version: kubernetes-1.11.1 -- package: k8s.io/api - version: kubernetes-1.11.1 -- package: k8s.io/apimachinery - version: kubernetes-1.11.1 -- package: k8s.io/apiserver - version: kubernetes-1.11.1 -- package: github.com/cyphar/filepath-securejoin - version: ^0.2.1 + - package: k8s.io/kubernetes + version: release-1.12 + - package: k8s.io/client-go + version: kubernetes-1.12.0 + - package: k8s.io/api + version: kubernetes-1.12.0 + - package: k8s.io/apimachinery + version: kubernetes-1.12.0 + - package: k8s.io/apiserver + version: kubernetes-1.12.0 + - package: k8s.io/cli-runtime + version: kubernetes-1.12.0 + - package: github.com/cyphar/filepath-securejoin + version: ^0.2.1 testImports: -- package: github.com/stretchr/testify - version: ^1.1.4 - subpackages: - - assert + - package: github.com/stretchr/testify + version: ^1.1.4 + subpackages: + - assert diff --git a/pkg/helm/portforwarder/portforwarder_test.go b/pkg/helm/portforwarder/portforwarder_test.go index ad5a23bc8..f5efe3443 100644 --- a/pkg/helm/portforwarder/portforwarder_test.go +++ b/pkg/helm/portforwarder/portforwarder_test.go @@ -76,7 +76,7 @@ func TestGetFirstPod(t *testing.T) { for _, tt := range tests { client := fake.NewSimpleClientset(&v1.PodList{Items: tt.pods}) - name, err := GetTillerPodName(client.Core(), v1.NamespaceDefault) + name, err := GetTillerPodName(client.CoreV1(), v1.NamespaceDefault) if (err != nil) != tt.err { t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err) } diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 167da9eef..67960ac46 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -18,6 +18,7 @@ package kube // import "k8s.io/helm/pkg/kube" import ( "bytes" + "context" "encoding/json" goerrors "errors" "fmt" @@ -42,20 +43,19 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/watch" + "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" + watchtools "k8s.io/client-go/tools/watch" "k8s.io/kubernetes/pkg/api/legacyscheme" batchinternal "k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/kubectl/cmd/get" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" - "k8s.io/kubernetes/pkg/kubectl/genericclioptions" - "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" "k8s.io/kubernetes/pkg/kubectl/validation" ) -const ( - // MissingGetHeader is added to Get's output when a resource is not found. - MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n" -) +// MissingGetHeader is added to Get's output when a resource is not found. +const MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n" // ErrNoObjectsVisited indicates that during a visit operation, no matching objects were found. var ErrNoObjectsVisited = goerrors.New("no objects visited") @@ -86,7 +86,7 @@ type ResourceActorFunc func(*resource.Info) error // // Namespace will set the namespace. func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shouldWait bool) error { - client, err := c.ClientSet() + client, err := c.KubernetesClientSet() if err != nil { return err } @@ -163,7 +163,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { return "", err } - var objPods = make(map[string][]core.Pod) + var objPods = make(map[string][]v1.Pod) missing := []string{} err = perform(infos, func(info *resource.Info) error { @@ -368,7 +368,7 @@ func perform(infos Result, fn ResourceActorFunc) error { } func createResource(info *resource.Info) error { - obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object) + obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object, nil) if err != nil { return err } @@ -438,7 +438,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, // send patch to server helper := resource.NewHelper(target.Client, target.Mapping) - obj, err := helper.Patch(target.Namespace, target.Name, patchType, patch) + obj, err := helper.Patch(target.Namespace, target.Name, patchType, patch, nil) if err != nil { kind := target.Mapping.GroupVersionKind.Kind log.Printf("Cannot patch %s: %q (%v)", kind, target.Name, err) @@ -479,12 +479,12 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, return nil } - client, err := c.ClientSet() + client, err := c.KubernetesClientSet() if err != nil { return err } - pods, err := client.Core().Pods(target.Namespace).List(metav1.ListOptions{ + pods, err := client.CoreV1().Pods(target.Namespace).List(metav1.ListOptions{ FieldSelector: fields.Everything().String(), LabelSelector: labels.Set(selector).AsSelector().String(), }) @@ -497,7 +497,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, c.Log("Restarting pod: %v/%v", pod.Namespace, pod.Name) // Delete each pod for get them restarted with changed spec. - if err := client.Core().Pods(pod.Namespace).Delete(pod.Name, metav1.NewPreconditionDeleteOptions(string(pod.UID))); err != nil { + if err := client.CoreV1().Pods(pod.Namespace).Delete(pod.Name, metav1.NewPreconditionDeleteOptions(string(pod.UID))); err != nil { return err } } @@ -561,7 +561,9 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err // In the future, we might want to add some special logic for types // like Ingress, Volume, etc. - _, err = watch.Until(timeout, w, func(e watch.Event) (bool, error) { + ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout) + defer cancel() + _, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) { switch e.Type { case watch.Added, watch.Modified: // For things like a secret or a config map, this is the best indicator @@ -623,26 +625,26 @@ func scrubValidationError(err error) error { // WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase // and returns said phase (PodSucceeded or PodFailed qualify). -func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { +func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { infos, err := c.Build(namespace, reader) if err != nil { - return core.PodUnknown, err + return v1.PodUnknown, err } info := infos[0] kind := info.Mapping.GroupVersionKind.Kind if kind != "Pod" { - return core.PodUnknown, fmt.Errorf("%s is not a Pod", info.Name) + return v1.PodUnknown, fmt.Errorf("%s is not a Pod", info.Name) } if err := c.watchPodUntilComplete(timeout, info); err != nil { - return core.PodUnknown, err + return v1.PodUnknown, err } if err := info.Get(); err != nil { - return core.PodUnknown, err + return v1.PodUnknown, err } - status := info.Object.(*core.Pod).Status.Phase + status := info.Object.(*v1.Pod).Status.Phase return status, nil } @@ -654,7 +656,9 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf } c.Log("Watching pod %s for completion with timeout of %v", info.Name, timeout) - _, err = watch.Until(timeout, w, func(e watch.Event) (bool, error) { + ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout) + defer cancel() + _, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) { return isPodComplete(e) }) @@ -662,15 +666,15 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf } func isPodComplete(event watch.Event) (bool, error) { - o, ok := event.Object.(*core.Pod) + o, ok := event.Object.(*v1.Pod) if !ok { - return true, fmt.Errorf("expected a *core.Pod, got %T", event.Object) + return true, fmt.Errorf("expected a *v1.Pod, got %T", event.Object) } if event.Type == watch.Deleted { return false, fmt.Errorf("pod not found") } switch o.Status.Phase { - case core.PodFailed, core.PodSucceeded: + case v1.PodFailed, v1.PodSucceeded: return true, nil } return false, nil @@ -678,7 +682,7 @@ func isPodComplete(event watch.Event) (bool, error) { //get a kubernetes resources' relation pods // kubernetes resource used select labels to relate pods -func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]core.Pod) (map[string][]core.Pod, error) { +func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]v1.Pod) (map[string][]v1.Pod, error) { if info == nil { return objPods, nil } @@ -691,9 +695,9 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] return objPods, nil } - client, _ := c.ClientSet() + client, _ := c.KubernetesClientSet() - pods, err := client.Core().Pods(info.Namespace).List(metav1.ListOptions{ + pods, err := client.CoreV1().Pods(info.Namespace).List(metav1.ListOptions{ FieldSelector: fields.Everything().String(), LabelSelector: labels.Set(selector).AsSelector().String(), }) @@ -718,7 +722,7 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] return objPods, nil } -func isFoundPod(podItem []core.Pod, pod core.Pod) bool { +func isFoundPod(podItem []v1.Pod, pod v1.Pod) bool { for _, value := range podItem { if (value.Namespace == pod.Namespace) && (value.Name == pod.Name) { return true diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index 617fce352..e505e8f37 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -24,15 +24,15 @@ import ( "strings" "testing" + "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" "k8s.io/client-go/rest/fake" "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/apis/core" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" - "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" "k8s.io/kubernetes/pkg/kubectl/scheme" ) @@ -42,34 +42,34 @@ func objBody(codec runtime.Codec, obj runtime.Object) io.ReadCloser { return ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(codec, obj)))) } -func newPod(name string) core.Pod { - return newPodWithStatus(name, core.PodStatus{}, "") +func newPod(name string) v1.Pod { + return newPodWithStatus(name, v1.PodStatus{}, "") } -func newPodWithStatus(name string, status core.PodStatus, namespace string) core.Pod { - ns := core.NamespaceDefault +func newPodWithStatus(name string, status v1.PodStatus, namespace string) v1.Pod { + ns := v1.NamespaceDefault if namespace != "" { ns = namespace } - return core.Pod{ + return v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, SelfLink: "/api/v1/namespaces/default/pods/" + name, }, - Spec: core.PodSpec{ - Containers: []core.Container{{ + Spec: v1.PodSpec{ + Containers: []v1.Container{{ Name: "app:v4", Image: "abc/app:v4", - Ports: []core.ContainerPort{{Name: "http", ContainerPort: 80}}, + Ports: []v1.ContainerPort{{Name: "http", ContainerPort: 80}}, }}, }, Status: status, } } -func newPodList(names ...string) core.PodList { - var list core.PodList +func newPodList(names ...string) v1.PodList { + var list v1.PodList for _, name := range names { list.Items = append(list.Items, newPod(name)) } @@ -114,8 +114,8 @@ func TestUpdate(t *testing.T) { listA := newPodList("starfish", "otter", "squid") listB := newPodList("starfish", "otter", "dolphin") listC := newPodList("starfish", "otter", "dolphin") - listB.Items[0].Spec.Containers[0].Ports = []core.ContainerPort{{Name: "https", ContainerPort: 443}} - listC.Items[0].Spec.Containers[0].Ports = []core.ContainerPort{{Name: "https", ContainerPort: 443}} + listB.Items[0].Spec.Containers[0].Ports = []v1.ContainerPort{{Name: "https", ContainerPort: 443}} + listC.Items[0].Spec.Containers[0].Ports = []v1.ContainerPort{{Name: "https", ContainerPort: 443}} var actions []string @@ -163,7 +163,7 @@ func TestUpdate(t *testing.T) { } codec := legacyscheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) - if err := c.Update(core.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil { + if err := c.Update(v1.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil { t.Fatal(err) } // TODO: Find a way to test methods that use Client Set diff --git a/pkg/kube/namespace.go b/pkg/kube/namespace.go index 57e62bab7..064de3d17 100644 --- a/pkg/kube/namespace.go +++ b/pkg/kube/namespace.go @@ -17,14 +17,14 @@ limitations under the License. package kube // import "k8s.io/helm/pkg/kube" import ( + "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/client-go/kubernetes" ) -func createNamespace(client internalclientset.Interface, namespace string) error { - ns := &core.Namespace{ +func createNamespace(client kubernetes.Interface, namespace string) error { + ns := &v1.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: namespace, Labels: map[string]string{ @@ -32,15 +32,15 @@ func createNamespace(client internalclientset.Interface, namespace string) error }, }, } - _, err := client.Core().Namespaces().Create(ns) + _, err := client.CoreV1().Namespaces().Create(ns) return err } -func getNamespace(client internalclientset.Interface, namespace string) (*core.Namespace, error) { - return client.Core().Namespaces().Get(namespace, metav1.GetOptions{}) +func getNamespace(client kubernetes.Interface, namespace string) (*v1.Namespace, error) { + return client.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{}) } -func ensureNamespace(client internalclientset.Interface, namespace string) error { +func ensureNamespace(client kubernetes.Interface, namespace string) error { _, err := getNamespace(client, namespace) if err != nil && errors.IsNotFound(err) { err = createNamespace(client, namespace) diff --git a/pkg/kube/namespace_test.go b/pkg/kube/namespace_test.go index 79e8e880c..3b6141434 100644 --- a/pkg/kube/namespace_test.go +++ b/pkg/kube/namespace_test.go @@ -20,7 +20,7 @@ import ( "testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" + "k8s.io/client-go/kubernetes/fake" ) func TestEnsureNamespace(t *testing.T) { @@ -31,7 +31,7 @@ func TestEnsureNamespace(t *testing.T) { if err := ensureNamespace(client, "foo"); err != nil { t.Fatalf("unexpected error: %s", err) } - if _, err := client.Core().Namespaces().Get("foo", metav1.GetOptions{}); err != nil { + if _, err := client.CoreV1().Namespaces().Get("foo", metav1.GetOptions{}); err != nil { t.Fatalf("unexpected error: %s", err) } } diff --git a/pkg/kube/result.go b/pkg/kube/result.go index 0c6289e49..cc222a66f 100644 --- a/pkg/kube/result.go +++ b/pkg/kube/result.go @@ -16,7 +16,7 @@ limitations under the License. package kube // import "k8s.io/helm/pkg/kube" -import "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" +import "k8s.io/cli-runtime/pkg/genericclioptions/resource" // Result provides convenience methods for comparing collections of Infos. type Result []*resource.Info diff --git a/pkg/kube/result_test.go b/pkg/kube/result_test.go index 503473c05..c4cf989b8 100644 --- a/pkg/kube/result_test.go +++ b/pkg/kube/result_test.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" ) func TestResult(t *testing.T) { diff --git a/pkg/releasetesting/environment.go b/pkg/releasetesting/environment.go index 17a22c21d..ee078e182 100644 --- a/pkg/releasetesting/environment.go +++ b/pkg/releasetesting/environment.go @@ -22,7 +22,7 @@ import ( "log" "time" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" @@ -49,7 +49,7 @@ func (env *Environment) createTestPod(test *test) error { return nil } -func (env *Environment) getTestPodStatus(test *test) (core.PodPhase, error) { +func (env *Environment) getTestPodStatus(test *test) (v1.PodPhase, error) { b := bytes.NewBufferString(test.manifest) status, err := env.KubeClient.WaitAndGetCompletedPodPhase(env.Namespace, b, time.Duration(env.Timeout)*time.Second) if err != nil { diff --git a/pkg/releasetesting/test_suite.go b/pkg/releasetesting/test_suite.go index 79f00301e..8ba83fdb2 100644 --- a/pkg/releasetesting/test_suite.go +++ b/pkg/releasetesting/test_suite.go @@ -22,7 +22,7 @@ import ( "github.com/ghodss/yaml" "github.com/golang/protobuf/ptypes/timestamp" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" "k8s.io/helm/pkg/hooks" "k8s.io/helm/pkg/proto/hapi/release" @@ -90,7 +90,7 @@ func (ts *TestSuite) Run(env *Environment) error { } resourceCleanExit := true - status := core.PodUnknown + status := v1.PodUnknown if resourceCreated { status, err = env.getTestPodStatus(test) if err != nil { @@ -119,15 +119,15 @@ func (ts *TestSuite) Run(env *Environment) error { return nil } -func (t *test) assignTestResult(podStatus core.PodPhase) error { +func (t *test) assignTestResult(podStatus v1.PodPhase) error { switch podStatus { - case core.PodSucceeded: + case v1.PodSucceeded: if t.expectedSuccess { t.result.Status = release.TestRun_SUCCESS } else { t.result.Status = release.TestRun_FAILURE } - case core.PodFailed: + case v1.PodFailed: if !t.expectedSuccess { t.result.Status = release.TestRun_SUCCESS } else { diff --git a/pkg/releasetesting/test_suite_test.go b/pkg/releasetesting/test_suite_test.go index 828b14e99..bf85e4207 100644 --- a/pkg/releasetesting/test_suite_test.go +++ b/pkg/releasetesting/test_suite_test.go @@ -26,7 +26,7 @@ import ( "golang.org/x/net/context" grpc "google.golang.org/grpc" "google.golang.org/grpc/metadata" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/chart" @@ -324,8 +324,8 @@ func newPodSucceededKubeClient() *podSucceededKubeClient { } } -func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (core.PodPhase, error) { - return core.PodSucceeded, nil +func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (v1.PodPhase, error) { + return v1.PodSucceeded, nil } type podFailedKubeClient struct { @@ -338,6 +338,6 @@ func newPodFailedKubeClient() *podFailedKubeClient { } } -func (p *podFailedKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (core.PodPhase, error) { - return core.PodFailed, nil +func (p *podFailedKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (v1.PodPhase, error) { + return v1.PodFailed, nil } diff --git a/pkg/storage/driver/cfgmaps.go b/pkg/storage/driver/cfgmaps.go index a534b67ac..5b511d811 100644 --- a/pkg/storage/driver/cfgmaps.go +++ b/pkg/storage/driver/cfgmaps.go @@ -22,12 +22,12 @@ import ( "strings" "time" + "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kblabels "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/validation" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" + corev1 "k8s.io/client-go/kubernetes/typed/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" storageerrors "k8s.io/helm/pkg/storage/errors" @@ -41,13 +41,13 @@ const ConfigMapsDriverName = "ConfigMap" // ConfigMaps is a wrapper around an implementation of a kubernetes // ConfigMapsInterface. type ConfigMaps struct { - impl internalversion.ConfigMapInterface + impl corev1.ConfigMapInterface Log func(string, ...interface{}) } // NewConfigMaps initializes a new ConfigMaps wrapping an implementation of // the kubernetes ConfigMapsInterface. -func NewConfigMaps(impl internalversion.ConfigMapInterface) *ConfigMaps { +func NewConfigMaps(impl corev1.ConfigMapInterface) *ConfigMaps { return &ConfigMaps{ impl: impl, Log: func(_ string, _ ...interface{}) {}, @@ -229,7 +229,7 @@ func (cfgmaps *ConfigMaps) Delete(key string) (rls *rspb.Release, err error) { // "OWNER" - owner of the configmap, currently "TILLER". // "NAME" - name of the release. // -func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*core.ConfigMap, error) { +func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*v1.ConfigMap, error) { const owner = "TILLER" // encode the release @@ -249,7 +249,7 @@ func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*core.Confi lbs.set("VERSION", strconv.Itoa(int(rls.Version))) // create and return configmap object - return &core.ConfigMap{ + return &v1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: key, Labels: lbs.toMap(), diff --git a/pkg/storage/driver/cfgmaps_test.go b/pkg/storage/driver/cfgmaps_test.go index c028e9fdf..d2e5e942e 100644 --- a/pkg/storage/driver/cfgmaps_test.go +++ b/pkg/storage/driver/cfgmaps_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/gogo/protobuf/proto" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" ) @@ -69,7 +69,7 @@ func TestUNcompressedConfigMapGet(t *testing.T) { } cfgmap.Data["release"] = base64.StdEncoding.EncodeToString(b) var mock MockConfigMapsInterface - mock.objects = map[string]*core.ConfigMap{key: cfgmap} + mock.objects = map[string]*v1.ConfigMap{key: cfgmap} cfgmaps := NewConfigMaps(&mock) // get release with key diff --git a/pkg/storage/driver/mock_test.go b/pkg/storage/driver/mock_test.go index 1ebe7f650..363d9dd5d 100644 --- a/pkg/storage/driver/mock_test.go +++ b/pkg/storage/driver/mock_test.go @@ -20,10 +20,11 @@ import ( "fmt" "testing" + "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" + "k8s.io/apimachinery/pkg/runtime/schema" + corev1 "k8s.io/client-go/kubernetes/typed/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" ) @@ -76,14 +77,14 @@ func newTestFixtureCfgMaps(t *testing.T, releases ...*rspb.Release) *ConfigMaps // MockConfigMapsInterface mocks a kubernetes ConfigMapsInterface type MockConfigMapsInterface struct { - internalversion.ConfigMapInterface + corev1.ConfigMapInterface - objects map[string]*core.ConfigMap + objects map[string]*v1.ConfigMap } // Init initializes the MockConfigMapsInterface with the set of releases. func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Release) { - mock.objects = map[string]*core.ConfigMap{} + mock.objects = map[string]*v1.ConfigMap{} for _, rls := range releases { objkey := testKey(rls.Name, rls.Version) @@ -97,17 +98,17 @@ func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Releas } // Get returns the ConfigMap by name. -func (mock *MockConfigMapsInterface) Get(name string, options metav1.GetOptions) (*core.ConfigMap, error) { +func (mock *MockConfigMapsInterface) Get(name string, options metav1.GetOptions) (*v1.ConfigMap, error) { object, ok := mock.objects[name] if !ok { - return nil, apierrors.NewNotFound(core.Resource("tests"), name) + return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name) } return object, nil } // List returns the a of ConfigMaps. -func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*core.ConfigMapList, error) { - var list core.ConfigMapList +func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*v1.ConfigMapList, error) { + var list v1.ConfigMapList for _, cfgmap := range mock.objects { list.Items = append(list.Items, *cfgmap) } @@ -115,20 +116,20 @@ func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*core.Config } // Create creates a new ConfigMap. -func (mock *MockConfigMapsInterface) Create(cfgmap *core.ConfigMap) (*core.ConfigMap, error) { +func (mock *MockConfigMapsInterface) Create(cfgmap *v1.ConfigMap) (*v1.ConfigMap, error) { name := cfgmap.ObjectMeta.Name if object, ok := mock.objects[name]; ok { - return object, apierrors.NewAlreadyExists(core.Resource("tests"), name) + return object, apierrors.NewAlreadyExists(schema.GroupResource{Resource: "tests"}, name) } mock.objects[name] = cfgmap return cfgmap, nil } // Update updates a ConfigMap. -func (mock *MockConfigMapsInterface) Update(cfgmap *core.ConfigMap) (*core.ConfigMap, error) { +func (mock *MockConfigMapsInterface) Update(cfgmap *v1.ConfigMap) (*v1.ConfigMap, error) { name := cfgmap.ObjectMeta.Name if _, ok := mock.objects[name]; !ok { - return nil, apierrors.NewNotFound(core.Resource("tests"), name) + return nil, apierrors.NewNotFound(v1.Resource("tests"), name) } mock.objects[name] = cfgmap return cfgmap, nil @@ -137,7 +138,7 @@ func (mock *MockConfigMapsInterface) Update(cfgmap *core.ConfigMap) (*core.Confi // Delete deletes a ConfigMap by name. func (mock *MockConfigMapsInterface) Delete(name string, opts *metav1.DeleteOptions) error { if _, ok := mock.objects[name]; !ok { - return apierrors.NewNotFound(core.Resource("tests"), name) + return apierrors.NewNotFound(v1.Resource("tests"), name) } delete(mock.objects, name) return nil @@ -154,14 +155,14 @@ func newTestFixtureSecrets(t *testing.T, releases ...*rspb.Release) *Secrets { // MockSecretsInterface mocks a kubernetes SecretsInterface type MockSecretsInterface struct { - internalversion.SecretInterface + corev1.SecretInterface - objects map[string]*core.Secret + objects map[string]*v1.Secret } // Init initializes the MockSecretsInterface with the set of releases. func (mock *MockSecretsInterface) Init(t *testing.T, releases ...*rspb.Release) { - mock.objects = map[string]*core.Secret{} + mock.objects = map[string]*v1.Secret{} for _, rls := range releases { objkey := testKey(rls.Name, rls.Version) @@ -175,17 +176,17 @@ func (mock *MockSecretsInterface) Init(t *testing.T, releases ...*rspb.Release) } // Get returns the Secret by name. -func (mock *MockSecretsInterface) Get(name string, options metav1.GetOptions) (*core.Secret, error) { +func (mock *MockSecretsInterface) Get(name string, options metav1.GetOptions) (*v1.Secret, error) { object, ok := mock.objects[name] if !ok { - return nil, apierrors.NewNotFound(core.Resource("tests"), name) + return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name) } return object, nil } // List returns the a of Secret. -func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*core.SecretList, error) { - var list core.SecretList +func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*v1.SecretList, error) { + var list v1.SecretList for _, secret := range mock.objects { list.Items = append(list.Items, *secret) } @@ -193,20 +194,20 @@ func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*core.SecretLis } // Create creates a new Secret. -func (mock *MockSecretsInterface) Create(secret *core.Secret) (*core.Secret, error) { +func (mock *MockSecretsInterface) Create(secret *v1.Secret) (*v1.Secret, error) { name := secret.ObjectMeta.Name if object, ok := mock.objects[name]; ok { - return object, apierrors.NewAlreadyExists(core.Resource("tests"), name) + return object, apierrors.NewAlreadyExists(schema.GroupResource{Resource: "tests"}, name) } mock.objects[name] = secret return secret, nil } // Update updates a Secret. -func (mock *MockSecretsInterface) Update(secret *core.Secret) (*core.Secret, error) { +func (mock *MockSecretsInterface) Update(secret *v1.Secret) (*v1.Secret, error) { name := secret.ObjectMeta.Name if _, ok := mock.objects[name]; !ok { - return nil, apierrors.NewNotFound(core.Resource("tests"), name) + return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name) } mock.objects[name] = secret return secret, nil @@ -215,7 +216,7 @@ func (mock *MockSecretsInterface) Update(secret *core.Secret) (*core.Secret, err // Delete deletes a Secret by name. func (mock *MockSecretsInterface) Delete(name string, opts *metav1.DeleteOptions) error { if _, ok := mock.objects[name]; !ok { - return apierrors.NewNotFound(core.Resource("tests"), name) + return apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name) } delete(mock.objects, name) return nil diff --git a/pkg/storage/driver/secrets.go b/pkg/storage/driver/secrets.go index 328da20c4..b79a84272 100644 --- a/pkg/storage/driver/secrets.go +++ b/pkg/storage/driver/secrets.go @@ -22,12 +22,12 @@ import ( "strings" "time" + "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kblabels "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/validation" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" + corev1 "k8s.io/client-go/kubernetes/typed/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" storageerrors "k8s.io/helm/pkg/storage/errors" @@ -41,13 +41,13 @@ const SecretsDriverName = "Secret" // Secrets is a wrapper around an implementation of a kubernetes // SecretsInterface. type Secrets struct { - impl internalversion.SecretInterface + impl corev1.SecretInterface Log func(string, ...interface{}) } // NewSecrets initializes a new Secrets wrapping an implmenetation of // the kubernetes SecretsInterface. -func NewSecrets(impl internalversion.SecretInterface) *Secrets { +func NewSecrets(impl corev1.SecretInterface) *Secrets { return &Secrets{ impl: impl, Log: func(_ string, _ ...interface{}) {}, @@ -229,7 +229,7 @@ func (secrets *Secrets) Delete(key string) (rls *rspb.Release, err error) { // "OWNER" - owner of the secret, currently "TILLER". // "NAME" - name of the release. // -func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*core.Secret, error) { +func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*v1.Secret, error) { const owner = "TILLER" // encode the release @@ -249,7 +249,7 @@ func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*core.Secret, lbs.set("VERSION", strconv.Itoa(int(rls.Version))) // create and return secret object - return &core.Secret{ + return &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: key, Labels: lbs.toMap(), diff --git a/pkg/storage/driver/secrets_test.go b/pkg/storage/driver/secrets_test.go index 6c9c63ad4..0d7d1ad83 100644 --- a/pkg/storage/driver/secrets_test.go +++ b/pkg/storage/driver/secrets_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/gogo/protobuf/proto" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" ) @@ -69,7 +69,7 @@ func TestUNcompressedSecretGet(t *testing.T) { } secret.Data["release"] = []byte(base64.StdEncoding.EncodeToString(b)) var mock MockSecretsInterface - mock.objects = map[string]*core.Secret{key: secret} + mock.objects = map[string]*v1.Secret{key: secret} secrets := NewSecrets(&mock) // get release with key diff --git a/pkg/tiller/environment/environment.go b/pkg/tiller/environment/environment.go index c9ddab3ab..86d077b89 100644 --- a/pkg/tiller/environment/environment.go +++ b/pkg/tiller/environment/environment.go @@ -26,8 +26,8 @@ import ( "io" "time" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" + "k8s.io/api/core/v1" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/engine" @@ -140,7 +140,7 @@ type KubeClient interface { // WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase // and returns said phase (PodSucceeded or PodFailed qualify). - WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) + WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) } // PrintingKubeClient implements KubeClient, but simply prints the reader to @@ -192,9 +192,9 @@ func (p *PrintingKubeClient) BuildUnstructured(ns string, reader io.Reader) (kub } // WaitAndGetCompletedPodPhase implements KubeClient WaitAndGetCompletedPodPhase. -func (p *PrintingKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { +func (p *PrintingKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { _, err := io.Copy(p.Out, reader) - return core.PodUnknown, err + return v1.PodUnknown, err } // Environment provides the context for executing a client request. diff --git a/pkg/tiller/environment/environment_test.go b/pkg/tiller/environment/environment_test.go index b835a976d..5c19a9b21 100644 --- a/pkg/tiller/environment/environment_test.go +++ b/pkg/tiller/environment/environment_test.go @@ -22,8 +22,8 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" + "k8s.io/api/core/v1" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/kube" @@ -61,11 +61,11 @@ func (k *mockKubeClient) Build(ns string, reader io.Reader) (kube.Result, error) func (k *mockKubeClient) BuildUnstructured(ns string, reader io.Reader) (kube.Result, error) { return []*resource.Info{}, nil } -func (k *mockKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { - return core.PodUnknown, nil +func (k *mockKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { + return v1.PodUnknown, nil } -func (k *mockKubeClient) WaitAndGetCompletedPodStatus(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { +func (k *mockKubeClient) WaitAndGetCompletedPodStatus(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { return "", nil } diff --git a/pkg/tiller/release_modules.go b/pkg/tiller/release_modules.go index a587581ed..9a8c66e96 100644 --- a/pkg/tiller/release_modules.go +++ b/pkg/tiller/release_modules.go @@ -23,7 +23,7 @@ import ( "log" "strings" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/client-go/kubernetes" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/kube" @@ -46,7 +46,7 @@ type ReleaseModule interface { // LocalReleaseModule is a local implementation of ReleaseModule type LocalReleaseModule struct { - clientset internalclientset.Interface + clientset kubernetes.Interface } // Create creates a release via kubeclient from provided environment diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index e562be203..f5e96ed00 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -28,7 +28,7 @@ import ( "gopkg.in/yaml.v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/discovery" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/client-go/kubernetes" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/hooks" @@ -83,12 +83,12 @@ var ValidName = regexp.MustCompile("^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+ type ReleaseServer struct { ReleaseModule env *environment.Environment - clientset internalclientset.Interface + clientset kubernetes.Interface Log func(string, ...interface{}) } // NewReleaseServer creates a new release server. -func NewReleaseServer(env *environment.Environment, clientset internalclientset.Interface, useRemote bool) *ReleaseServer { +func NewReleaseServer(env *environment.Environment, clientset kubernetes.Interface, useRemote bool) *ReleaseServer { var releaseModule ReleaseModule if useRemote { releaseModule = &RemoteReleaseModule{} diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index b8adb4bb2..311f55b30 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -31,9 +31,9 @@ import ( "github.com/technosophos/moniker" "golang.org/x/net/context" "google.golang.org/grpc/metadata" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" - "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" + "k8s.io/api/core/v1" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" + "k8s.io/client-go/kubernetes/fake" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/hooks" @@ -605,8 +605,8 @@ func (kc *mockHooksKubeClient) Build(ns string, reader io.Reader) (kube.Result, func (kc *mockHooksKubeClient) BuildUnstructured(ns string, reader io.Reader) (kube.Result, error) { return []*resource.Info{}, nil } -func (kc *mockHooksKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { - return core.PodUnknown, nil +func (kc *mockHooksKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { + return v1.PodUnknown, nil } func deletePolicyStub(kubeClient *mockHooksKubeClient) *ReleaseServer { From 88a148221662c1b24c601a40b66dfc371cfd868e Mon Sep 17 00:00:00 2001 From: Florian Rusch Date: Sat, 6 Oct 2018 10:42:03 +0200 Subject: [PATCH 375/449] Add the .vscode folder to the .helmignore file Signed-off-by: Florian Rusch --- pkg/chartutil/create.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index beadf71cf..046155f71 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -119,6 +119,7 @@ const defaultIgnore = `# Patterns to ignore when building packages. .project .idea/ *.tmproj +.vscode/ ` const defaultIngress = `{{- if .Values.ingress.enabled -}} From b19bb15e7a7df8baa4e9944ca3d2049892920f61 Mon Sep 17 00:00:00 2001 From: Ryan Smith Date: Sat, 6 Oct 2018 02:24:25 -0700 Subject: [PATCH 376/449] Update circleCI badge to more consistent shield. The shield badge matches the go report and godoc badges. Signed-off-by: RPSeq --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fcb9e1636..8805ea458 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Helm -[![CircleCI](https://circleci.com/gh/helm/helm.svg?style=svg)](https://circleci.com/gh/helm/helm) +[![CircleCI](https://circleci.com/gh/helm/helm.svg?style=shield)](https://circleci.com/gh/helm/helm) [![Go Report Card](https://goreportcard.com/badge/github.com/helm/helm)](https://goreportcard.com/report/github.com/helm/helm) [![GoDoc](https://godoc.org/k8s.io/helm?status.svg)](https://godoc.org/k8s.io/helm) From 1d4119175ef97af8d9daa80d352377dc75960d0d Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Tue, 9 Oct 2018 16:30:29 +0100 Subject: [PATCH 377/449] Fix Slack channel references (#4752) Signed-off-by: Martin Hickey --- README.md | 2 +- docs/chart_template_guide/wrapping_up.md | 6 ++++-- docs/release_checklist.md | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8805ea458..90fe161ae 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ The [Helm roadmap uses Github milestones](https://github.com/helm/helm/milestone You can reach the Helm community and developers via the following channels: -- [Kubernetes Slack](http://slack.k8s.io): +- [Kubernetes Slack](https://kubernetes.slack.com): - [#helm-users](https://kubernetes.slack.com/messages/helm-users) - [#helm-dev](https://kubernetes.slack.com/messages/helm-dev) - [#charts](https://kubernetes.slack.com/messages/charts) diff --git a/docs/chart_template_guide/wrapping_up.md b/docs/chart_template_guide/wrapping_up.md index 1a8d6c552..6a96632bd 100755 --- a/docs/chart_template_guide/wrapping_up.md +++ b/docs/chart_template_guide/wrapping_up.md @@ -13,8 +13,10 @@ But there are many things this guide has not covered when it comes to the practi - The [Go template docs](https://godoc.org/text/template) explain the template syntax in detail. - The [Schelm tool](https://github.com/databus23/schelm) is a nice helper utility for debugging charts. -Sometimes it's easier to ask a few questions and get answers from experienced developers. The best place to do that is in the Kubernetes `#Helm` Slack channel: +Sometimes it's easier to ask a few questions and get answers from experienced developers. The best place to do this is in the [Kubernetes Slack](https://kubernetes.slack.com) Helm channels: -- [Kubernetes Slack](https://slack.k8s.io/): `#helm` +- [#helm-users](https://kubernetes.slack.com/messages/helm-users) +- [#helm-dev](https://kubernetes.slack.com/messages/helm-dev) +- [#charts](https://kubernetes.slack.com/messages/charts) Finally, if you find errors or omissions in this document, want to suggest some new content, or would like to contribute, visit [The Helm Project](https://github.com/helm/helm). diff --git a/docs/release_checklist.md b/docs/release_checklist.md index a84cad713..3d48e2a44 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -220,7 +220,7 @@ Helm vX.Y.Z is a feature release. This release, we focused on Date: Wed, 10 Oct 2018 15:38:04 -0400 Subject: [PATCH 378/449] The nil check before the range loop is redundant Signed-off-by: Rijnard van Tonder --- pkg/chartutil/files.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index c5496a8b0..36391c3e8 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -36,10 +36,8 @@ type Files map[string][]byte // Given an []*any.Any (the format for files in a chart.Chart), extract a map of files. func NewFiles(from []*any.Any) Files { files := map[string][]byte{} - if from != nil { - for _, f := range from { - files[f.TypeUrl] = f.Value - } + for _, f := range from { + files[f.TypeUrl] = f.Value } return files } From c12561f68ffa2a0c4a85d7ae0a6500c038a12457 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Fri, 12 Oct 2018 13:49:45 -0600 Subject: [PATCH 379/449] fix(tiller): correctly sort PodDisruptionBudget objects before pods that might use them (#4769) Signed-off-by: Matt Tucker --- pkg/tiller/kind_sorter.go | 2 ++ pkg/tiller/kind_sorter_test.go | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index 65e3f478d..8aff4e6c1 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -31,6 +31,7 @@ var InstallOrder SortOrder = []string{ "ResourceQuota", "LimitRange", "PodSecurityPolicy", + "PodDisruptionBudget", "Secret", "ConfigMap", "StorageClass", @@ -81,6 +82,7 @@ var UninstallOrder SortOrder = []string{ "StorageClass", "ConfigMap", "Secret", + "PodDisruptionBudget", "PodSecurityPolicy", "LimitRange", "ResourceQuota", diff --git a/pkg/tiller/kind_sorter_test.go b/pkg/tiller/kind_sorter_test.go index fb3e8ad57..1c187e90d 100644 --- a/pkg/tiller/kind_sorter_test.go +++ b/pkg/tiller/kind_sorter_test.go @@ -133,6 +133,10 @@ func TestKindSorter(t *testing.T) { Name: "w", Head: &util.SimpleHead{Kind: "APIService"}, }, + { + Name: "z", + Head: &util.SimpleHead{Kind: "PodDisruptionBudget"}, + }, } for _, test := range []struct { @@ -140,8 +144,8 @@ func TestKindSorter(t *testing.T) { order SortOrder expected string }{ - {"install", InstallOrder, "abc3de1fgh2ijklmnopqrstuvw!"}, - {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1ed3cba!"}, + {"install", InstallOrder, "abc3zde1fgh2ijklmnopqrstuvw!"}, + {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1edz3cba!"}, } { var buf bytes.Buffer t.Run(test.description, func(t *testing.T) { From 0c91980608665e446623d669bdc6c419fde9230e Mon Sep 17 00:00:00 2001 From: Thomas Yuan Date: Sat, 13 Oct 2018 00:24:33 -0400 Subject: [PATCH 380/449] update rbac.authorization.k8s.io from v1beta1 to v1 (#4771) Signed-off-by: Thomas Yuan --- docs/rbac.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/rbac.md b/docs/rbac.md index 4af36203c..7deac70fb 100644 --- a/docs/rbac.md +++ b/docs/rbac.md @@ -23,7 +23,7 @@ metadata: name: tiller namespace: kube-system --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: tiller @@ -61,7 +61,7 @@ Define a Role that allows Tiller to manage all resources in `tiller-world` like ```yaml kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-manager namespace: tiller-world @@ -80,7 +80,7 @@ In `rolebinding-tiller.yaml`, ```yaml kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-binding namespace: tiller-world @@ -137,7 +137,7 @@ Define a Role that allows Tiller to manage all resources in `myorg-users` like i ```yaml kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-manager namespace: myorg-users @@ -156,7 +156,7 @@ Bind the service account to that role. In `rolebinding-tiller.yaml`, ```yaml kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-binding namespace: myorg-users @@ -179,7 +179,7 @@ We'll also need to grant Tiller access to read configmaps in myorg-system so it ```yaml kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: namespace: myorg-system name: tiller-manager @@ -198,7 +198,7 @@ And the respective role binding. In `rolebinding-tiller-myorg-system.yaml`: ```yaml kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-binding namespace: myorg-system @@ -234,7 +234,7 @@ metadata: name: helm namespace: helm-world --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: tiller-user @@ -253,7 +253,7 @@ rules: verbs: - list --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: tiller-user-binding From 953a53c84da6df91e859a75b1e22b60cd40ce1df Mon Sep 17 00:00:00 2001 From: Etienne Date: Sat, 13 Oct 2018 17:11:31 +0200 Subject: [PATCH 381/449] Add Helm convert plugin (#4766) Signed-off-by: Etienne Tremel --- docs/related.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/related.md b/docs/related.md index 2ad1e9b20..b730ea992 100644 --- a/docs/related.md +++ b/docs/related.md @@ -32,6 +32,7 @@ or [pull request](https://github.com/helm/helm/pulls). - [Helm Diff](https://github.com/databus23/helm-diff) - Preview `helm upgrade` as a coloured diff - [Helm Value Store](https://github.com/skuid/helm-value-store) - Plugin for working with Helm deployment values - [Technosophos's Helm Plugins](https://github.com/technosophos/helm-plugins) - Plugins for GitHub, Keybase, and GPG +- [helm-convert](https://github.com/ContainerSolutions/helm-convert) - Plugin to convert charts into Kustomize compatible packages - [helm-cos](https://github.com/imroc/helm-cos) - Plugin to manage repositories on Tencent Cloud Object Storage - [helm-edit](https://github.com/mstrzele/helm-edit) - Plugin for editing release's values - [helm-env](https://github.com/adamreese/helm-env) - Plugin to show current environment @@ -68,7 +69,7 @@ Tools layered on top of Helm or Tiller. - [Helm Chart Publisher](https://github.com/luizbafilho/helm-chart-publisher) - HTTP API for publishing Helm Charts in an easy way - [Helm.NET](https://github.com/qmfrederik/helm) - A .NET client for Tiller's API - [Helmfile](https://github.com/roboll/helmfile) - Helmfile is a declarative spec for deploying helm charts -- [Helmsman](https://github.com/Praqma/helmsman) - Helmsman is a helm-charts-as-code tool which enables installing/upgrading/protecting/moving/deleting releases from version controlled desired state files (described in a simple TOML format). +- [Helmsman](https://github.com/Praqma/helmsman) - Helmsman is a helm-charts-as-code tool which enables installing/upgrading/protecting/moving/deleting releases from version controlled desired state files (described in a simple TOML format). - [Landscaper](https://github.com/Eneco/landscaper/) - "Landscaper takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster." - [Monocular](https://github.com/helm/monocular) - Web UI for Helm Chart repositories - [Quay App Registry](https://coreos.com/blog/quay-application-registry-for-kubernetes.html) - Open Kubernetes application registry, including a Helm access client From c5330ee989ad1d21257b3e9ab095b6a127fdf10c Mon Sep 17 00:00:00 2001 From: Anumita Shenoy Date: Tue, 16 Oct 2018 20:16:35 +0530 Subject: [PATCH 382/449] feat(helm): add $HELM_KEY_PASSPHRASE environment variable for signing helm charts (#4778) * feat(helm): add $HELM_KEY_PASSPHRASE environment variable for signing helm charts If $HELM_KEY_PASSPHRASE is set then helm package sign command will not prompt the user to enter the passphrase for the private key Signed-off-by: Anumita Shenoy * docs(helm): added documentation for HELM_KEY_PASSPHRASE Added description for HELM_KEY_PASSPHRASE Signed-off-by: Anumita Shenoy --- cmd/helm/helm.go | 23 +++++++++++++---------- cmd/helm/package.go | 11 ++++++++--- docs/helm/helm.md | 25 ++++++++++++++----------- docs/provenance.md | 4 +++- pkg/helm/environment/environment.go | 8 ++++++++ 5 files changed, 46 insertions(+), 25 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 02a1e6edb..ffc2c1ba2 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -61,16 +61,19 @@ Common actions from this point include: - helm list: list releases of charts Environment: - $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm - $HELM_HOST set an alternative Tiller host. The format is host:port - $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. - $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") - $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") - $HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem") - $HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem") - $HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem") - $HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false") - $HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default "false") + $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm + $HELM_HOST set an alternative Tiller host. The format is host:port + $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. + $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") + $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") + $HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem") + $HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem") + $HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem") + $HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false") + $HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default "false") + $HELM_KEY_PASSPHRASE set HELM_KEY_PASSPHRASE to the passphrase of your PGP private key. If set, you will not be prompted for + the passphrase while signing helm charts + ` func newRootCmd(args []string) *cobra.Command { diff --git a/cmd/helm/package.go b/cmd/helm/package.go index 51686dba7..05fdf02f8 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -215,7 +215,7 @@ func (p *packageCmd) clearsign(filename string) error { return err } - if err := signer.DecryptKey(promptUser); err != nil { + if err := signer.DecryptKey(passphraseFetcher); err != nil { return err } @@ -229,8 +229,13 @@ func (p *packageCmd) clearsign(filename string) error { return ioutil.WriteFile(filename+".prov", []byte(sig), 0755) } -// promptUser implements provenance.PassphraseFetcher -func promptUser(name string) ([]byte, error) { +// passphraseFetcher implements provenance.PassphraseFetcher +func passphraseFetcher(name string) ([]byte, error) { + var passphrase = settings.HelmKeyPassphrase() + if passphrase != "" { + return []byte(passphrase), nil + } + fmt.Printf("Password for key %q > ", name) pw, err := terminal.ReadPassword(int(syscall.Stdin)) fmt.Println() diff --git a/docs/helm/helm.md b/docs/helm/helm.md index 136721c36..177be7e88 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -21,16 +21,19 @@ Common actions from this point include: - helm list: list releases of charts Environment: - $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm - $HELM_HOST set an alternative Tiller host. The format is host:port - $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. - $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") - $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") - $HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem") - $HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem") - $HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem") - $HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false") - $HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default "false") + $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm + $HELM_HOST set an alternative Tiller host. The format is host:port + $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. + $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") + $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") + $HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem") + $HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem") + $HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem") + $HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false") + $HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default "false") + $HELM_KEY_PASSPHRASE set HELM_KEY_PASSPHRASE to the passphrase of your PGP private key. If set, you will not be prompted for + the passphrase while signing helm charts + ### Options @@ -75,4 +78,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 4-Sep-2018 +###### Auto generated by spf13/cobra on 16-Oct-2018 diff --git a/docs/provenance.md b/docs/provenance.md index d8f9e4089..3a19fcd07 100644 --- a/docs/provenance.md +++ b/docs/provenance.md @@ -26,7 +26,9 @@ Prerequisites: - Keybase command line tools (optional) **NOTE:** If your PGP private key has a passphrase, you will be prompted to enter -that passphrase for any commands that support the `--sign` option. +that passphrase for any commands that support the `--sign` option. You can set the +HELM_KEY_PASSPHRASE environment variable to that passphrase in case you don't want +to be prompted to enter the passphrase. **NOTE:** The keyfile format for GnuPG changed in version 2.1. Prior to that release it was unnecessary to export keys out of GnuPG, and you could instead point Helm diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index 76348c3bd..6d40fb846 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -138,6 +138,14 @@ func (s EnvSettings) PluginDirs() string { return s.Home.Plugins() } +// HelmKeyPassphrase is the passphrase used to sign a helm chart. +func (s EnvSettings) HelmKeyPassphrase() string { + if d, ok := os.LookupEnv("HELM_KEY_PASSPHRASE"); ok { + return d + } + return "" +} + // setFlagFromEnv looks up and sets a flag if the corresponding environment variable changed. // if the flag with the corresponding name was set during fs.Parse(), then the environment // variable is ignored. From e12cb0ffa7b37c0015035cd4434e27d5885b3874 Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Wed, 17 Oct 2018 22:10:46 +0100 Subject: [PATCH 383/449] Add test template example for helm create (#4524) * Add test template example for helm create As helm create ganerates an nginx chart, the example is based on https://github.com/helm/helm/blob/master/docs/examples/nginx/templates/ service-test.yaml Signed-off-by: Martin Hickey * Update after review - https://github.com/helm/helm/pull/4524#pullrequestreview-155183390 - https://github.com/helm/helm/pull/4524#pullrequestreview-155379922 - Fix where app.kubernetes.io/instance was incorrect in service selector Signed-off-by: Martin Hickey * Add doc update Signed-off-by: Martin Hickey * Update GO formatting Signed-off-by: Martin Hickey --- cmd/helm/create.go | 13 +++++++------ cmd/helm/create_test.go | 4 ++-- docs/helm/helm_create.md | 14 ++++++++------ pkg/chartutil/create.go | 33 +++++++++++++++++++++++++++++++-- pkg/chartutil/create_test.go | 8 ++++++++ pkg/chartutil/save.go | 2 +- 6 files changed, 57 insertions(+), 17 deletions(-) diff --git a/cmd/helm/create.go b/cmd/helm/create.go index eaea81e5b..7f0f99af8 100644 --- a/cmd/helm/create.go +++ b/cmd/helm/create.go @@ -38,15 +38,17 @@ something like this: foo/ | - |- .helmignore # Contains patterns to ignore when packaging Helm charts. + |- .helmignore # Contains patterns to ignore when packaging Helm charts. | - |- Chart.yaml # Information about your chart + |- Chart.yaml # Information about your chart | - |- values.yaml # The default values for your templates + |- values.yaml # The default values for your templates | - |- charts/ # Charts that this chart depends on + |- charts/ # Charts that this chart depends on | - |- templates/ # The template files + |- templates/ # The template files + | + |- templates/tests/ # The test files 'helm create' takes a path for an argument. If directories in the given path do not exist, Helm will attempt to create them as it goes. If the given @@ -84,7 +86,6 @@ func newCreateCmd(out io.Writer) *cobra.Command { func (c *createCmd) run() error { fmt.Fprintf(c.out, "Creating %s\n", c.name) - chartname := filepath.Base(c.name) cfile := &chart.Metadata{ Name: chartname, diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go index 214432b83..3cdf5ebf8 100644 --- a/cmd/helm/create_test.go +++ b/cmd/helm/create_test.go @@ -143,8 +143,8 @@ func TestCreateStarterCmd(t *testing.T) { t.Errorf("Wrong API version: %q", c.Metadata.ApiVersion) } - if l := len(c.Templates); l != 6 { - t.Errorf("Expected 5 templates, got %d", l) + if l := len(c.Templates); l != 7 { + t.Errorf("Expected 6 templates, got %d", l) } found := false diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index 0e20d9860..2dc45a77c 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -13,15 +13,17 @@ something like this: foo/ | - |- .helmignore # Contains patterns to ignore when packaging Helm charts. + |- .helmignore # Contains patterns to ignore when packaging Helm charts. | - |- Chart.yaml # Information about your chart + |- Chart.yaml # Information about your chart | - |- values.yaml # The default values for your templates + |- values.yaml # The default values for your templates | - |- charts/ # Charts that this chart depends on + |- charts/ # Charts that this chart depends on | - |- templates/ # The template files + |- templates/ # The template files + | + |- templates/tests/ # The test files 'helm create' takes a path for an argument. If directories in the given path do not exist, Helm will attempt to create them as it goes. If the given @@ -56,4 +58,4 @@ helm create NAME [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 1-Aug-2018 +###### Auto generated by spf13/cobra on 18-Sep-2018 diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 046155f71..875083f7e 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -44,8 +44,12 @@ const ( ServiceName = "service.yaml" // NotesName is the name of the example NOTES.txt file. NotesName = "NOTES.txt" - // HelpersName is the name of the example NOTES.txt file. + // HelpersName is the name of the example helpers file. HelpersName = "_helpers.tpl" + // TemplatesTestsDir is the relative directory name for templates tests. + TemplatesTestsDir = "templates/tests" + // TestConnectionName is the name of the example connection test file. + TestConnectionName = "test-connection.yaml" ) const defaultValues = `# Default values for %s. @@ -295,6 +299,26 @@ Create chart name and version as used by the chart label. {{- end -}} ` +const defaultTestConnection = `apiVersion: v1 +kind: Pod +metadata: + name: "{{ include ".fullname" . }}-test-connection" + labels: + app.kubernetes.io/name: {{ include ".name" . }} + helm.sh/chart: {{ include ".chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include ".fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never +` + // CreateFrom creates a new chart, but scaffolds it from the src chart. func CreateFrom(chartfile *chart.Metadata, dest string, src string) error { schart, err := Load(src) @@ -359,7 +383,7 @@ func Create(chartfile *chart.Metadata, dir string) (string, error) { } } - for _, d := range []string{TemplatesDir, ChartsDir} { + for _, d := range []string{TemplatesDir, TemplatesTestsDir, ChartsDir} { if err := os.MkdirAll(filepath.Join(cdir, d), 0755); err != nil { return cdir, err } @@ -404,6 +428,11 @@ func Create(chartfile *chart.Metadata, dir string) (string, error) { path: filepath.Join(cdir, TemplatesDir, HelpersName), content: Transform(defaultHelpers, "", chartfile.Name), }, + { + // test-connection.yaml + path: filepath.Join(cdir, TemplatesTestsDir, TestConnectionName), + content: Transform(defaultTestConnection, "", chartfile.Name), + }, } for _, file := range files { diff --git a/pkg/chartutil/create_test.go b/pkg/chartutil/create_test.go index 96c467e7e..a0ddf8fa2 100644 --- a/pkg/chartutil/create_test.go +++ b/pkg/chartutil/create_test.go @@ -75,6 +75,14 @@ func TestCreate(t *testing.T) { } } + for _, f := range []string{TestConnectionName} { + if fi, err := os.Stat(filepath.Join(dir, TemplatesTestsDir, f)); err != nil { + t.Errorf("Expected %s file: %s", f, err) + } else if fi.IsDir() { + t.Errorf("Expected %s to be a file.", f) + } + } + } func TestCreateFrom(t *testing.T) { diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index 9b85d0714..5d60485bf 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -54,7 +54,7 @@ func SaveDir(c *chart.Chart, dest string) error { } } - for _, d := range []string{TemplatesDir, ChartsDir} { + for _, d := range []string{TemplatesDir, ChartsDir, TemplatesTestsDir} { if err := os.MkdirAll(filepath.Join(outdir, d), 0755); err != nil { return err } From 0204e1e273e6cb5fd050445ae6f7414a5721616e Mon Sep 17 00:00:00 2001 From: mgresser Date: Thu, 18 Oct 2018 11:27:37 -0400 Subject: [PATCH 384/449] Grammar fix (#4801) Signed-off-by: Mischa Gresser --- docs/chart_best_practices/labels.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/chart_best_practices/labels.md b/docs/chart_best_practices/labels.md index a43ad9087..6b7d24c49 100644 --- a/docs/chart_best_practices/labels.md +++ b/docs/chart_best_practices/labels.md @@ -28,9 +28,9 @@ Name|Status|Description `app.kubernetes.io/name` | REC | This should be the app name, reflecting the entire app. Usually `{{ template "name" . }}` is used for this. This is used by many Kubernetes manifests, and is not Helm-specific. `helm.sh/chart` | REC | This should be the chart name and version: `{{ .Chart.Name }}-{{ .Chart.Version \| replace "+" "_" }}`. `app.kubernetes.io/managed-by` | REC | This should always be set to `{{ .Release.Service }}`. It is for finding all things managed by Tiller. -`app.kubernetes.io/instance` | REC | This should be the `{{ .Release.Name }}`. It aid in differentiating between different instances of the same application. +`app.kubernetes.io/instance` | REC | This should be the `{{ .Release.Name }}`. It aids in differentiating between different instances of the same application. `app.kubernetes.io/version` | OPT | The version of the app and can be set to `{{ .Chart.AppVersion }}`. `app.kubernetes.io/component` | OPT | This is a common label for marking the different roles that pieces may play in an application. For example, `app.kubernetes.io/component: frontend`. `app.kubernetes.io/part-of` | OPT | When multiple charts or pieces of software are used together to make one application. For example, application software and a database to produce a website. This can be set to the top level application being supported. -You can find more information on the Kubernetes labels, prefixed with `app.kubernetes.io`, in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/). \ No newline at end of file +You can find more information on the Kubernetes labels, prefixed with `app.kubernetes.io`, in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/). From ed21cf3fb3e8aa3ae72e0c04b42b3691ce6054c9 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Thu, 18 Oct 2018 15:44:39 -0400 Subject: [PATCH 385/449] Fix reference to wordpress (#4803) Signed-off-by: Marc Khouzam --- docs/chart_tests.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/chart_tests.md b/docs/chart_tests.md index 2d1852eb5..300eeaf73 100644 --- a/docs/chart_tests.md +++ b/docs/chart_tests.md @@ -22,10 +22,10 @@ In Helm, there are two test hooks: `test-success` and `test-failure` ## Example Test -Here is an example of a helm test pod definition in an example mariadb chart: +Here is an example of a helm test pod definition in an example wordpress chart. The test verifies the access and login to the mariadb database: ``` -mariadb/ +wordpress/ Chart.yaml README.md values.yaml @@ -64,7 +64,7 @@ spec: ``` ## Steps to Run a Test Suite on a Release -1. `$ helm install mariadb` +1. `$ helm install wordpress` ``` NAME: quirky-walrus LAST DEPLOYED: Mon Feb 13 13:50:43 2017 From 25a36f5079209da9192aa3f6191c312f619a2b90 Mon Sep 17 00:00:00 2001 From: JJ Asghar Date: Thu, 18 Oct 2018 14:26:17 -0500 Subject: [PATCH 386/449] Update quickstart.md Updated the MySQL release, and put more output that gets sent to STDOUT with `helm install stable/mysql` Signed-off-by: JJ Asghar --- docs/quickstart.md | 110 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 99 insertions(+), 11 deletions(-) diff --git a/docs/quickstart.md b/docs/quickstart.md index e7b70d4ca..ef3cb460e 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -12,7 +12,7 @@ The following prerequisites are required for a successful and properly secured u ### Install Kubernetes or have access to a cluster -- You must have Kubernetes installed. For the latest release of Helm, we recommend the latest stable release of Kubernetes, which in most cases is the second-latest minor release. +- You must have Kubernetes installed. For the latest release of Helm, we recommend the latest stable release of Kubernetes, which in most cases is the second-latest minor release. - You should also have a local configured copy of `kubectl`. NOTE: Kubernetes versions prior to 1.6 have limited or no support for role-based access controls (RBAC). @@ -78,11 +78,68 @@ of the official `stable` charts. ```console $ helm repo update # Make sure we get the latest list of charts $ helm install stable/mysql -Released smiling-penguin +NAME: wintering-rodent +LAST DEPLOYED: Thu Oct 18 14:21:18 2018 +NAMESPACE: default +STATUS: DEPLOYED + +RESOURCES: +==> v1/Secret +NAME AGE +wintering-rodent-mysql 0s + +==> v1/ConfigMap +wintering-rodent-mysql-test 0s + +==> v1/PersistentVolumeClaim +wintering-rodent-mysql 0s + +==> v1/Service +wintering-rodent-mysql 0s + +==> v1beta1/Deployment +wintering-rodent-mysql 0s + +==> v1/Pod(related) + +NAME READY STATUS RESTARTS AGE +wintering-rodent-mysql-6986fd6fb-988x7 0/1 Pending 0 0s + + +NOTES: +MySQL can be accessed via port 3306 on the following DNS name from within your cluster: +wintering-rodent-mysql.default.svc.cluster.local + +To get your root password run: + + MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default wintering-rodent-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo) + +To connect to your database: + +1. Run an Ubuntu pod that you can use as a client: + + kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il + +2. Install the mysql client: + + $ apt-get update && apt-get install mysql-client -y + +3. Connect using the mysql cli, then provide your password: + $ mysql -h wintering-rodent-mysql -p + +To connect to your database directly from outside the K8s cluster: + MYSQL_HOST=127.0.0.1 + MYSQL_PORT=3306 + + # Execute the following command to route the connection: + kubectl port-forward svc/wintering-rodent-mysql 3306 + + mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD} + ``` In the example above, the `stable/mysql` chart was released, and the name of -our new release is `smiling-penguin`. You get a simple idea of the +our new release is `wintering-rodent`. You get a simple idea of the features of this MySQL chart by running `helm inspect stable/mysql`. Whenever you install a chart, a new release is created. So one chart can @@ -99,8 +156,8 @@ It's easy to see what has been released using Helm: ```console $ helm ls -NAME VERSION UPDATED                   STATUS   CHART -smiling-penguin 1 Wed Sep 28 12:59:46 2016 DEPLOYED mysql-0.1.0 +NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE +wintering-rodent 1 Thu Oct 18 15:06:58 2018 DEPLOYED mysql-0.10.1 5.7.14 default ``` The `helm list` function will show you a list of all deployed releases. @@ -110,17 +167,48 @@ The `helm list` function will show you a list of all deployed releases. To uninstall a release, use the `helm delete` command: ```console -$ helm delete smiling-penguin -Removed smiling-penguin +$ helm delete wintering-rodent +release "wintering-rodent" deleted ``` -This will uninstall `smiling-penguin` from Kubernetes, but you will +This will uninstall `wintering-rodent` from Kubernetes, but you will still be able to request information about that release: ```console -$ helm status smiling-penguin -Status: DELETED -... +$ helm status wintering-rodent +LAST DEPLOYED: Thu Oct 18 14:21:18 2018 +NAMESPACE: default +STATUS: DELETED + +NOTES: +MySQL can be accessed via port 3306 on the following DNS name from within your cluster: +wintering-rodent-mysql.default.svc.cluster.local + +To get your root password run: + + MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default wintering-rodent-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo) + +To connect to your database: + +1. Run an Ubuntu pod that you can use as a client: + + kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il + +2. Install the mysql client: + + $ apt-get update && apt-get install mysql-client -y + +3. Connect using the mysql cli, then provide your password: + $ mysql -h wintering-rodent-mysql -p + +To connect to your database directly from outside the K8s cluster: + MYSQL_HOST=127.0.0.1 + MYSQL_PORT=3306 + + # Execute the following command to route the connection: + kubectl port-forward svc/wintering-rodent-mysql 3306 + + mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD} ``` Because Helm tracks your releases even after you've deleted them, you From 23fc00bf4f6ce7988d81be4edeb6c3347b126d8d Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Thu, 18 Oct 2018 15:17:09 -0700 Subject: [PATCH 387/449] fix(helm): Update status output to include resource details (#4791) Update of the client-go package changed the status output to only include the age of resources. The new printer in client-go only formats the output to include details of specific resources if the internal representation of resources are passed into the printer. This PR updates helm to convert resources to the internal type before printing. Closes #4712 Signed-off-by: Morten Torkildsen --- pkg/kube/client.go | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 67960ac46..6509a1583 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -163,7 +163,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { return "", err } - var objPods = make(map[string][]v1.Pod) + var objPods = make(map[string][]core.Pod) missing := []string{} err = perform(infos, func(info *resource.Info) error { @@ -178,7 +178,15 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // versions per cluster, but this certainly won't hurt anything, so let's be safe. gvk := info.ResourceMapping().GroupVersionKind vk := gvk.Version + "/" + gvk.Kind - objs[vk] = append(objs[vk], asVersioned(info)) + internalObj, err := asInternal(info) + if err != nil { + c.Log("Warning: conversion to internal type failed: %v", err) + // Add the unstructured object in this situation. It will still get listed, just + // with less information. + objs[vk] = append(objs[vk], info.Object) + } else { + objs[vk] = append(objs[vk], internalObj) + } //Get the relation pods objPods, err = c.getSelectRelationPod(info, objPods) @@ -682,7 +690,7 @@ func isPodComplete(event watch.Event) (bool, error) { //get a kubernetes resources' relation pods // kubernetes resource used select labels to relate pods -func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]v1.Pod) (map[string][]v1.Pod, error) { +func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]core.Pod) (map[string][]core.Pod, error) { if info == nil { return objPods, nil } @@ -705,7 +713,9 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] return objPods, err } - for _, pod := range pods.Items { + for _, externalPod := range pods.Items { + pod := core.Pod{} + legacyscheme.Scheme.Convert(&externalPod, &pod, nil) if pod.APIVersion == "" { pod.APIVersion = "v1" } @@ -722,7 +732,7 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] return objPods, nil } -func isFoundPod(podItem []v1.Pod, pod v1.Pod) bool { +func isFoundPod(podItem []core.Pod, pod core.Pod) bool { for _, value := range podItem { if (value.Namespace == pod.Namespace) && (value.Name == pod.Name) { return true @@ -734,3 +744,8 @@ func isFoundPod(podItem []v1.Pod, pod v1.Pod) bool { func asVersioned(info *resource.Info) runtime.Object { return cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping) } + +func asInternal(info *resource.Info) (runtime.Object, error) { + groupVersioner := info.Mapping.GroupVersionKind.GroupKind().WithVersion(runtime.APIVersionInternal).GroupVersion() + return legacyscheme.Scheme.ConvertToVersion(info.Object, groupVersioner) +} From e25ba6bac9b47055a803bd708a8f9c15319f0b34 Mon Sep 17 00:00:00 2001 From: Alpha Date: Fri, 19 Oct 2018 12:59:19 +0800 Subject: [PATCH 388/449] UPT: tutorial (#4808) Signed-off-by: Alpha --- docs/using_helm.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/using_helm.md b/docs/using_helm.md index b7fec60ed..4b18e2cf2 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -94,10 +94,10 @@ simplest, it takes only one argument: The name of the chart. ```console $ helm install stable/mariadb Fetched stable/mariadb-0.3.0 to /Users/mattbutcher/Code/Go/src/k8s.io/helm/mariadb-0.3.0.tgz -happy-panda -Last Deployed: Wed Sep 28 12:32:28 2016 -Namespace: default -Status: DEPLOYED +NAME: happy-panda +LAST DEPLOYED: Wed Sep 28 12:32:28 2016 +NAMESPACE: default +STATUS: DEPLOYED Resources: ==> extensions/Deployment From c794976ad0ba411887490c897bb684c38964ee7c Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Wed, 17 Oct 2018 12:40:01 -0700 Subject: [PATCH 389/449] fix(helm): Use line breaks consistently in status output The output from helm status does not have consistent use of line breaks. For some resources there is a line break after the kind header, for others there is not. This is caused by how the printer handles column headers. This removes a line break for all but the first resource listed. Signed-off-by: Morten Torkildsen --- pkg/kube/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 6509a1583..9e0aeb262 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -213,8 +213,13 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // track of tab widths. buf := new(bytes.Buffer) p, _ := get.NewHumanPrintFlags().ToPrinter("") + index := 0 for t, ot := range objs { - if _, err = buf.WriteString("==> " + t + "\n"); err != nil { + kindHeader := fmt.Sprintf("==> %s", t) + if index == 0 { + kindHeader = kindHeader + "\n" + } + if _, err = buf.WriteString(kindHeader); err != nil { return "", err } for _, o := range ot { @@ -226,6 +231,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { if _, err := buf.WriteString("\n"); err != nil { return "", err } + index += 1 } if len(missing) > 0 { buf.WriteString(MissingGetHeader) From 17ac2a45f9207f18e54c712235f405be4997d643 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Fri, 19 Oct 2018 13:22:48 -0400 Subject: [PATCH 390/449] Update Contributing.md to remove mention of CLA (#4804) * Update Contributing.md to remove mention of CLA Signed-off-by: Marc Khouzam * Add hyperlink to git page in CONTRIBUTING.md Signed-off-by: Marc Khouzam --- CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23dc297b0..7958a9adb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -172,9 +172,10 @@ contributing to Helm. All issue types follow the same general lifecycle. Differe ## How to Contribute a Patch -1. If you haven't already done so, sign a Contributor License Agreement (see details above). -2. Fork the desired repo, develop and test your code changes. -3. Submit a pull request. +1. Fork the repo, develop and test your code changes. +1. Use sign-off when making each of your commits (see [above](#sign-your-work)). + If you forgot to sign some commits that are part of the contribution, you can ask [git to rewrite your commit history](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History). +1. Submit a pull request. Coding conventions and standards are explained in the official developer docs: https://github.com/helm/helm/blob/master/docs/developers.md From a138a42fcbd5cf1c4baae02e47463f3df96d25c1 Mon Sep 17 00:00:00 2001 From: Louis-Etienne Date: Wed, 24 Oct 2018 02:00:53 -0400 Subject: [PATCH 391/449] Missing the batch permission in one of the example (#4829) Signed-off-by: Louis-Etienne Dorval --- docs/rbac.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rbac.md b/docs/rbac.md index 7deac70fb..4b39ecdc6 100644 --- a/docs/rbac.md +++ b/docs/rbac.md @@ -142,7 +142,7 @@ metadata: name: tiller-manager namespace: myorg-users rules: -- apiGroups: ["", "extensions", "apps"] +- apiGroups: ["", "batch", "extensions", "apps"] resources: ["*"] verbs: ["*"] ``` From d824d1eab63341732bda7f772c550058a2864a15 Mon Sep 17 00:00:00 2001 From: masahiro Date: Thu, 25 Oct 2018 22:11:23 +0900 Subject: [PATCH 392/449] Fix cmd/helm use tillerTunnel values (#4777) Signed-off-by: masahiro331 --- cmd/helm/helm.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index ffc2c1ba2..f7628e44c 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -189,13 +189,13 @@ func setupConnection() error { return err } - tunnel, err := portforwarder.New(settings.TillerNamespace, client, config) + tillerTunnel, err = portforwarder.New(settings.TillerNamespace, client, config) if err != nil { return err } - settings.TillerHost = fmt.Sprintf("127.0.0.1:%d", tunnel.Local) - debug("Created tunnel using local port: '%d'\n", tunnel.Local) + settings.TillerHost = fmt.Sprintf("127.0.0.1:%d", tillerTunnel.Local) + debug("Created tunnel using local port: '%d'\n", tillerTunnel.Local) } // Set up the gRPC config. From 5d0bb9b19b6a78e48951e51b3d7f10077fa582db Mon Sep 17 00:00:00 2001 From: Bartel Sielski Date: Tue, 30 Oct 2018 17:24:20 +0100 Subject: [PATCH 393/449] Remove newline at the start of zsh completion file (#4851) Signed-off-by: Bartel Sielski --- cmd/helm/completion.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index b6fbc82d1..2181e723c 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -81,8 +81,7 @@ func runCompletionBash(out io.Writer, cmd *cobra.Command) error { } func runCompletionZsh(out io.Writer, cmd *cobra.Command) error { - zshInitialization := ` -#compdef helm + zshInitialization := `#compdef helm __helm_bash_source() { alias shopt=':' From 87a2bed26be189bdf53f2593da0548137e430647 Mon Sep 17 00:00:00 2001 From: Maor Friedman Date: Wed, 31 Oct 2018 15:58:47 +0200 Subject: [PATCH 394/449] Add plugins and tools to docs (#4861) Signed-off-by: Maor --- docs/related.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/related.md b/docs/related.md index b730ea992..11ecbf672 100644 --- a/docs/related.md +++ b/docs/related.md @@ -36,14 +36,19 @@ or [pull request](https://github.com/helm/helm/pulls). - [helm-cos](https://github.com/imroc/helm-cos) - Plugin to manage repositories on Tencent Cloud Object Storage - [helm-edit](https://github.com/mstrzele/helm-edit) - Plugin for editing release's values - [helm-env](https://github.com/adamreese/helm-env) - Plugin to show current environment +- [helm-export](https://github.com/maorfr/helm-export) - Plugin to export releases from namespace to a file (disaster recovery) - [helm-gcs](https://github.com/nouney/helm-gcs) - Plugin to manage repositories on Google Cloud Storage - [helm-github](https://github.com/sagansystems/helm-github) - Plugin to install Helm Charts from Github repositories - [helm-hashtag](https://github.com/balboah/helm-hashtag) - Plugin for tracking docker tag hash digests as values +- [helm-import](https://github.com/maorfr/helm-import) - Plugin for importing releases from (exported) file to a namespace (disaster recovery) +- [helm-inject](https://github.com/maorfr/helm-inject) - Plugin for injecting additional configurations during release upgrade - [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp - [helm-last](https://github.com/adamreese/helm-last) - Plugin to show the latest release - [helm-local](https://github.com/adamreese/helm-local) - Plugin to run Tiller as a local daemon +- [helm-logs](https://github.com/maorfr/helm-logs) - Plugin to view changed releases over time - [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query - [helm-nuke](https://github.com/adamreese/helm-nuke) - Plugin to destroy all releases +- [helm-restore](https://github.com/maorfr/helm-restore) - Plugin to restore the last deployed release to its original state - [helm-secrets](https://github.com/futuresimple/helm-secrets) - Plugin to manage and store secrets safely - [helm-stop](https://github.com/IBM/helm-stop) - Plugin for stopping a release pods - [helm-template](https://github.com/technosophos/helm-template) - Debug/render templates client-side @@ -72,6 +77,7 @@ Tools layered on top of Helm or Tiller. - [Helmsman](https://github.com/Praqma/helmsman) - Helmsman is a helm-charts-as-code tool which enables installing/upgrading/protecting/moving/deleting releases from version controlled desired state files (described in a simple TOML format). - [Landscaper](https://github.com/Eneco/landscaper/) - "Landscaper takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster." - [Monocular](https://github.com/helm/monocular) - Web UI for Helm Chart repositories +- [Orca](https://github.com/maorfr/orca) - Advanced CI\CD tool for Kubernetes and Helm made simple. - [Quay App Registry](https://coreos.com/blog/quay-application-registry-for-kubernetes.html) - Open Kubernetes application registry, including a Helm access client - [Rudder](https://github.com/AcalephStorage/rudder) - RESTful (JSON) proxy for Tiller's API - [Schelm](https://github.com/databus23/schelm) - Render a Helm manifest to a directory From e3d9bc6a26cae0e53ac252fbfdfc02a220c52c19 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 31 Oct 2018 08:50:08 -0700 Subject: [PATCH 395/449] bump version to v2.11 (#4700) Signed-off-by: Matthew Fisher (cherry picked from commit 3a551d01d8e021679fd3d05ef9b97136e99b79e7) --- pkg/version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/version/version.go b/pkg/version/version.go index c4ce4b381..dae739500 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -26,7 +26,7 @@ var ( // Increment major number for new feature additions and behavioral changes. // Increment minor number for bug fixes and performance enhancements. // Increment patch number for critical fixes to existing releases. - Version = "v2.10" + Version = "v2.11" // BuildMetadata is extra build time data BuildMetadata = "unreleased" From 5dd5177d9f33a150c8d5669de5091125fd78e799 Mon Sep 17 00:00:00 2001 From: Matt Rasmus Date: Wed, 31 Oct 2018 08:51:29 -0700 Subject: [PATCH 396/449] test(tiller): cover crash fixed by #4630 (#4853) While investigating a tiller crash on v2.10.0 (see recent comments in #3125), I pulled down the code and wrote a test replicating the crash I was experiencing. I then realized that the crash had been fixed, and was able to locate the fix in #4630 after running a quck bisect. Since there don't appear to be any tests that cover this crash, and I had written one myself, I figured I might as well put up a PR for it. Here's what the test failure on v2.10.0 looks like: ``` -- FAIL: TestUpdateReleasePendingInstall_Force (0.00s) panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x1d128d8] goroutine 235 [running]: testing.tRunner.func1(0xc420493c20) /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:742 +0x29d panic(0x1eb8d80, 0x2a12db0) /usr/local/Cellar/go/1.10/libexec/src/runtime/panic.go:505 +0x229 k8s.io/helm/pkg/tiller.(*ReleaseServer).performUpdateForce(0xc4208210b0, 0xc4202c6dc0, 0x0, 0x0, 0x2174220) /Users/mattrasmus/go/src/k8s.io/helm/pkg/tiller/release_update.go:166 +0x188 k8s.io/helm/pkg/tiller.(*ReleaseServer).UpdateRelease(0xc4208210b0, 0x2191780, 0xc420820f30, 0xc4202c6dc0, 0x29aeb90, 0x38, 0x2d2) /Users/mattrasmus/go/src/k8s.io/helm/pkg/tiller/release_update.go:43 +0x245 k8s.io/helm/pkg/tiller.TestUpdateReleasePendingInstall_Force(0xc420493c20) /Users/mattrasmus/go/src/k8s.io/helm/pkg/tiller/release_update_test.go:549 +0x120 testing.tRunner(0xc420493c20, 0x20e5c70) /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:777 +0xd0 created by testing.(*T).Run /usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:824 +0x2e0 FAIL k8s.io/helm/pkg/tiller 0.118s ``` Signed-off-by: Matt Rasmus --- pkg/tiller/release_update_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 1f189a8b7..81fad0bc4 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -520,6 +520,30 @@ func TestUpdateReleaseCustomDescription_Force(t *testing.T) { compareStoredAndReturnedRelease(t, *rs, *res) } +func TestUpdateReleasePendingInstall_Force(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := namedReleaseStub("forceful-luke", release.Status_PENDING_INSTALL) + rs.env.Releases.Create(rel) + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: rel.GetChart(), + Force: true, + } + + _, err := rs.UpdateRelease(c, req) + if err == nil { + t.Error("Expected failed update") + } + + expectedError := "a released named forceful-luke is in use, cannot re-use a name that is still in use" + got := err.Error() + if err.Error() != expectedError { + t.Errorf("Expected error %q, got %q", expectedError, got) + } +} + func compareStoredAndReturnedRelease(t *testing.T, rs ReleaseServer, res services.UpdateReleaseResponse) *release.Release { storedRelease, err := rs.env.Releases.Get(res.Release.Name, res.Release.Version) if err != nil { From ce8164f66cc8cceec0cabac9725da8b9f2469f48 Mon Sep 17 00:00:00 2001 From: Zachary Seguin Date: Wed, 31 Oct 2018 14:13:56 -0400 Subject: [PATCH 397/449] Remove executable bits from chartutil generated files (#4839) Signed-off-by: Zachary Seguin --- pkg/chartutil/save.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index 5d60485bf..400b85e91 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -49,7 +49,7 @@ func SaveDir(c *chart.Chart, dest string) error { // Save values.yaml if c.Values != nil && len(c.Values.Raw) > 0 { vf := filepath.Join(outdir, ValuesfileName) - if err := ioutil.WriteFile(vf, []byte(c.Values.Raw), 0755); err != nil { + if err := ioutil.WriteFile(vf, []byte(c.Values.Raw), 0644); err != nil { return err } } @@ -63,7 +63,7 @@ func SaveDir(c *chart.Chart, dest string) error { // Save templates for _, f := range c.Templates { n := filepath.Join(outdir, f.Name) - if err := ioutil.WriteFile(n, f.Data, 0755); err != nil { + if err := ioutil.WriteFile(n, f.Data, 0644); err != nil { return err } } @@ -77,7 +77,7 @@ func SaveDir(c *chart.Chart, dest string) error { return err } - if err := ioutil.WriteFile(n, f.Value, 0755); err != nil { + if err := ioutil.WriteFile(n, f.Value, 0644); err != nil { return err } } From 4c0c3732bccb7afc30b63bc7af12f1fbe361f71e Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Wed, 31 Oct 2018 11:57:38 -0700 Subject: [PATCH 398/449] ref(kube): use external api types where possible Signed-off-by: Adam Reese --- pkg/kube/client.go | 46 +++++++++++++++++++---------------------- pkg/kube/client_test.go | 20 +++++++++--------- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 9e0aeb262..0cc68b71b 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -37,18 +37,17 @@ import ( apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/watch" "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/genericclioptions/resource" + "k8s.io/client-go/kubernetes/scheme" watchtools "k8s.io/client-go/tools/watch" "k8s.io/kubernetes/pkg/api/legacyscheme" - batchinternal "k8s.io/kubernetes/pkg/apis/batch" - "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/kubectl/cmd/get" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/validation" @@ -111,7 +110,7 @@ func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shoul func (c *Client) newBuilder(namespace string, reader io.Reader) *resource.Result { return c.NewBuilder(). ContinueOnError(). - WithScheme(legacyscheme.Scheme). + WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...). Schema(c.validator()). NamespaceParam(namespace). DefaultNamespace(). @@ -163,7 +162,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { return "", err } - var objPods = make(map[string][]core.Pod) + var objPods = make(map[string][]v1.Pod) missing := []string{} err = perform(infos, func(info *resource.Info) error { @@ -499,7 +498,6 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, } pods, err := client.CoreV1().Pods(target.Namespace).List(metav1.ListOptions{ - FieldSelector: fields.Everything().String(), LabelSelector: labels.Set(selector).AsSelector().String(), }) if err != nil { @@ -607,15 +605,15 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err // // This operates on an event returned from a watcher. func (c *Client) waitForJob(e watch.Event, name string) (bool, error) { - o, ok := e.Object.(*batchinternal.Job) + o, ok := e.Object.(*batch.Job) if !ok { return true, fmt.Errorf("Expected %s to be a *batch.Job, got %T", name, e.Object) } for _, c := range o.Status.Conditions { - if c.Type == batchinternal.JobComplete && c.Status == core.ConditionTrue { + if c.Type == batch.JobComplete && c.Status == v1.ConditionTrue { return true, nil - } else if c.Type == batchinternal.JobFailed && c.Status == core.ConditionTrue { + } else if c.Type == batch.JobFailed && c.Status == v1.ConditionTrue { return true, fmt.Errorf("Job failed: %s", c.Reason) } } @@ -696,7 +694,7 @@ func isPodComplete(event watch.Event) (bool, error) { //get a kubernetes resources' relation pods // kubernetes resource used select labels to relate pods -func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]core.Pod) (map[string][]core.Pod, error) { +func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]v1.Pod) (map[string][]v1.Pod, error) { if info == nil { return objPods, nil } @@ -712,25 +710,14 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] client, _ := c.KubernetesClientSet() pods, err := client.CoreV1().Pods(info.Namespace).List(metav1.ListOptions{ - FieldSelector: fields.Everything().String(), LabelSelector: labels.Set(selector).AsSelector().String(), }) if err != nil { return objPods, err } - for _, externalPod := range pods.Items { - pod := core.Pod{} - legacyscheme.Scheme.Convert(&externalPod, &pod, nil) - if pod.APIVersion == "" { - pod.APIVersion = "v1" - } - - if pod.Kind == "" { - pod.Kind = "Pod" - } - vk := pod.GroupVersionKind().Version + "/" + pod.GroupVersionKind().Kind - + for _, pod := range pods.Items { + vk := "v1/Pod" if !isFoundPod(objPods[vk], pod) { objPods[vk] = append(objPods[vk], pod) } @@ -738,7 +725,7 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] return objPods, nil } -func isFoundPod(podItem []core.Pod, pod core.Pod) bool { +func isFoundPod(podItem []v1.Pod, pod v1.Pod) bool { for _, value := range podItem { if (value.Namespace == pod.Namespace) && (value.Name == pod.Name) { return true @@ -748,7 +735,16 @@ func isFoundPod(podItem []core.Pod, pod core.Pod) bool { } func asVersioned(info *resource.Info) runtime.Object { - return cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping) + converter := runtime.ObjectConvertor(scheme.Scheme) + groupVersioner := runtime.GroupVersioner(schema.GroupVersions(scheme.Scheme.PrioritizedVersionsAllGroups())) + if info.Mapping != nil { + groupVersioner = info.Mapping.GroupVersionKind.GroupVersion() + } + + if obj, err := converter.ConvertToVersion(info.Object, groupVersioner); err == nil { + return obj + } + return info.Object } func asInternal(info *resource.Info) (runtime.Object, error) { diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index e505e8f37..de33881c8 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -29,16 +29,17 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/cli-runtime/pkg/genericclioptions/resource" + "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest/fake" - "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/api/testapi" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" - "k8s.io/kubernetes/pkg/kubectl/scheme" ) -var unstructuredSerializer = resource.UnstructuredPlusDefaultContentConfig().NegotiatedSerializer +var ( + codec = scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) + unstructuredSerializer = resource.UnstructuredPlusDefaultContentConfig().NegotiatedSerializer +) -func objBody(codec runtime.Codec, obj runtime.Object) io.ReadCloser { +func objBody(obj runtime.Object) io.ReadCloser { return ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(codec, obj)))) } @@ -89,7 +90,7 @@ func notFoundBody() *metav1.Status { func newResponse(code int, obj runtime.Object) (*http.Response, error) { header := http.Header{} header.Set("Content-Type", runtime.ContentTypeJSON) - body := ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), obj)))) + body := ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(codec, obj)))) return &http.Response{StatusCode: code, Header: header, Body: body}, nil } @@ -161,19 +162,18 @@ func TestUpdate(t *testing.T) { Factory: tf, Log: nopLogger, } - codec := legacyscheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) - if err := c.Update(v1.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil { + if err := c.Update(v1.NamespaceDefault, objBody(&listA), objBody(&listB), false, false, 0, false); err != nil { t.Fatal(err) } // TODO: Find a way to test methods that use Client Set // Test with a wait - // if err := c.Update("test", objBody(codec, &listB), objBody(codec, &listC), false, 300, true); err != nil { + // if err := c.Update("test", objBody(&listB), objBody(&listC), false, 300, true); err != nil { // t.Fatal(err) // } // Test with a wait should fail // TODO: A way to make this not based off of an extremely short timeout? - // if err := c.Update("test", objBody(codec, &listC), objBody(codec, &listA), false, 2, true); err != nil { + // if err := c.Update("test", objBody(&listC), objBody(&listA), false, 2, true); err != nil { // t.Fatal(err) // } expectedActions := []string{ From 6369dec087a2bee6a7c3c8fc9d11073c97ee759a Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 1 Nov 2018 08:35:20 -0700 Subject: [PATCH 399/449] add s390x architecture to the release notes (#4741) Signed-off-by: Matthew Fisher --- docs/release_checklist.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 3d48e2a44..58257a94a 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -236,6 +236,7 @@ Download Helm X.Y. The common platform binaries are here: - [Linux arm64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm64.tar.gz.sha256)) - [Linux i386](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-386.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-386.tar.gz.sha256)) - [Linux ppc64le](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-ppc64le.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-ppc64le.tar.gz.sha256)) +- [Linux s390x](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-s390x.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-s390x.tar.gz.sha256)) - [Windows amd64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.zip) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.zip.sha256)) Once you have the client installed, upgrade Tiller with `helm init --upgrade`. From e01b9863773fc85aa988978be04e9bd3cc41d84a Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 1 Nov 2018 08:36:03 -0700 Subject: [PATCH 400/449] docs(release_checklist): fix changelog generation command (#4694) Signed-off-by: Matthew Fisher --- docs/release_checklist.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 58257a94a..9213b4c1f 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -258,7 +258,7 @@ The changelog at the bottom of the release notes can be generated with this comm ```shell PREVIOUS_RELEASE=vX.Y.Z -git log --no-merges --pretty=format:'- %s %H (%aN)' $RELEASE_NAME $PREVIOUS_RELEASE +git log --no-merges --pretty=format:'- %s %H (%aN)' $PREVIOUS_RELEASE..$RELEASE_NAME ``` Once finished, go into GitHub and edit the release notes for the tagged release with the notes written here. From 96b90140064766379d665c95e2e7d88a9bfabd19 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 1 Nov 2018 10:17:46 -0700 Subject: [PATCH 401/449] add special note for RBAC users (#4597) Signed-off-by: Matthew Fisher --- docs/install.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/install.md b/docs/install.md index 96d9bc9f7..e0e3db56d 100755 --- a/docs/install.md +++ b/docs/install.md @@ -113,6 +113,12 @@ Tiller, the server portion of Helm, typically runs inside of your Kubernetes cluster. But for development, it can also be run locally, and configured to talk to a remote Kubernetes cluster. +### Special Note for RBAC Users + +Most cloud providers enable a feature called Role-Based Access Control - RBAC for short. If your cloud provider enables this feature, you will need to create a service account for Tiller with the right roles and permissions to access resources. + +Check the [Kubernetes Distribution Guide](kubernetes_distros.md) to see if there's any further points of interest on using Helm with your cloud provider. Also check out the guide on [Tiller and Role-Based Access Control](rbac.md) for more information on how to run Tiller in an RBAC-enabled Kubernetes cluster. + ### Easy In-Cluster Installation The easiest way to install `tiller` into the cluster is simply to run From 6b2e3251df09a581c97aa19f3ac98007849c81a6 Mon Sep 17 00:00:00 2001 From: Daniel M Barlow Date: Tue, 6 Nov 2018 17:51:14 +0100 Subject: [PATCH 402/449] Small typo fix (#4887) Signed-off-by: Daniel M Barlow --- docs/chart_template_guide/control_structures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/control_structures.md b/docs/chart_template_guide/control_structures.md index 9ecd55142..511318731 100644 --- a/docs/chart_template_guide/control_structures.md +++ b/docs/chart_template_guide/control_structures.md @@ -269,7 +269,7 @@ It will produce an error because `Release.Name` is not inside of the restricted release: {{ .Release.Name }} ``` -After looking a `range`, we will take a look at template variables, which offer one solution to the scoping issue above. +After looking at `range`, we will take a look at template variables, which offers one solution to the scoping issue above. ## Looping with the `range` action From bde11ee896120572d3b6616c9316f4da8c387b98 Mon Sep 17 00:00:00 2001 From: Sean Eagan Date: Tue, 6 Nov 2018 16:00:26 -0600 Subject: [PATCH 403/449] fix(engine): Fix template rendering thread safety issue (#4828) Remove the engine `currentTemplates` field which was shared state across threads and thus not thread safe, and instead just pass these reference templates as parameters down recursively. Closes #4819 Signed-off-by: Sean Eagan --- pkg/engine/engine.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index b6cffc56b..9f212ba09 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -38,8 +38,7 @@ type Engine struct { FuncMap template.FuncMap // If strict is enabled, template rendering will fail if a template references // a value that was not passed in. - Strict bool - CurrentTemplates map[string]renderable + Strict bool // In LintMode, some 'required' template values may be missing, so don't fail LintMode bool } @@ -122,7 +121,6 @@ func FuncMap() template.FuncMap { func (e *Engine) Render(chrt *chart.Chart, values chartutil.Values) (map[string]string, error) { // Render the charts tmap := allTemplates(chrt, values) - e.CurrentTemplates = tmap return e.render(tmap) } @@ -139,7 +137,7 @@ type renderable struct { // alterFuncMap takes the Engine's FuncMap and adds context-specific functions. // // The resulting FuncMap is only valid for the passed-in template. -func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap { +func (e *Engine) alterFuncMap(t *template.Template, referenceTpls map[string]renderable) template.FuncMap { // Clone the func map because we are adding context-specific functions. var funcMap template.FuncMap = map[string]interface{}{} for k, v := range e.FuncMap { @@ -198,7 +196,7 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap { templates[templateName.(string)] = r - result, err := e.render(templates) + result, err := e.renderWithReferences(templates, referenceTpls) if err != nil { return "", fmt.Errorf("Error during tpl function execution for %q: %s", tpl, err.Error()) } @@ -210,6 +208,12 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap { // render takes a map of templates/values and renders them. func (e *Engine) render(tpls map[string]renderable) (rendered map[string]string, err error) { + return e.renderWithReferences(tpls, tpls) +} + +// renderWithReferences takes a map of templates/values to render, and a map of +// templates which can be referenced within them. +func (e *Engine) renderWithReferences(tpls map[string]renderable, referenceTpls map[string]renderable) (rendered map[string]string, err error) { // Basically, what we do here is start with an empty parent template and then // build up a list of templates -- one for each file. Once all of the templates // have been parsed, we loop through again and execute every template. @@ -231,7 +235,7 @@ func (e *Engine) render(tpls map[string]renderable) (rendered map[string]string, t.Option("missingkey=zero") } - funcMap := e.alterFuncMap(t) + funcMap := e.alterFuncMap(t, referenceTpls) // We want to parse the templates in a predictable order. The order favors // higher-level (in file system) templates over deeply nested templates. @@ -248,9 +252,9 @@ func (e *Engine) render(tpls map[string]renderable) (rendered map[string]string, files = append(files, fname) } - // Adding the engine's currentTemplates to the template context + // Adding the reference templates to the template context // so they can be referenced in the tpl function - for fname, r := range e.CurrentTemplates { + for fname, r := range referenceTpls { if t.Lookup(fname) == nil { t = t.New(fname).Funcs(funcMap) if _, err := t.Parse(r.tpl); err != nil { From 1652b3292ddc833115deee9cae144068cd4cada0 Mon Sep 17 00:00:00 2001 From: Dr Nic Williams Date: Wed, 7 Nov 2018 09:31:23 +1000 Subject: [PATCH 404/449] Full path to mysubchart file (#4882) Signed-off-by: Dr Nic Williams --- docs/chart_template_guide/subcharts_and_globals.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/chart_template_guide/subcharts_and_globals.md b/docs/chart_template_guide/subcharts_and_globals.md index a288556d8..1954df39a 100644 --- a/docs/chart_template_guide/subcharts_and_globals.md +++ b/docs/chart_template_guide/subcharts_and_globals.md @@ -124,7 +124,7 @@ global: salad: caesar ``` -Because of the way globals work, both `mychart/templates/configmap.yaml` and `mysubchart/templates/configmap.yaml` should be able to access that value as `{{ .Values.global.salad}}`. +Because of the way globals work, both `mychart/templates/configmap.yaml` and `mychart/charts/mysubchart/templates/configmap.yaml` should be able to access that value as `{{ .Values.global.salad}}`. `mychart/templates/configmap.yaml`: @@ -137,7 +137,7 @@ data: salad: {{ .Values.global.salad }} ``` -`mysubchart/templates/configmap.yaml`: +`mychart/charts/mysubchart/templates/configmap.yaml`: ```yaml apiVersion: v1 From 944353ce401f4d8f408be6b8595c815fa8dce304 Mon Sep 17 00:00:00 2001 From: Mike Garuccio Date: Tue, 6 Nov 2018 18:32:38 -0500 Subject: [PATCH 405/449] fix snap install command (#4877) Added `--classic` to the snap install command. Signed-off-by: Mike Garuccio --- docs/install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install.md b/docs/install.md index e0e3db56d..b47aea6f1 100755 --- a/docs/install.md +++ b/docs/install.md @@ -30,7 +30,7 @@ The Snap package for Helm is maintained by [Snapcrafters](https://github.com/snapcrafters/helm). ``` -$ sudo snap install helm +$ sudo snap install helm --classic ``` ### From Homebrew (macOS) From b356e00870a89d06a6aed32f429101d6ca8e5119 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Wed, 7 Nov 2018 00:50:38 +0100 Subject: [PATCH 406/449] Document the _proto directory (#4756) Signed-off-by: Timothy Hobbs --- _proto/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 _proto/README.md diff --git a/_proto/README.md b/_proto/README.md new file mode 100644 index 000000000..fcc2c52f1 --- /dev/null +++ b/_proto/README.md @@ -0,0 +1,10 @@ +Protobuf3 type declarations for the Helm API +-------------------------------------------- + +Packages + + - `hapi.chart` Complete serialization of Heml charts + - `hapi.release` Information about installed charts (Releases) such as metadata about when they were installed, their status, and how they were configured. + - `hapi.services.rudder` Definition for the ReleaseModuleService used by Tiller to manipulate releases on a given node + - `hapi.services.tiller` Definition of the ReleaseService provoded by Tiller and used by Helm clients to manipulate releases cluster wide. + - `hapi.version` Version meta-data used by tiller to express it's version From d7d7ecb1c9dd950e0c553ee6df6b3fe3ca570803 Mon Sep 17 00:00:00 2001 From: Rimas Mocevicius Date: Wed, 7 Nov 2018 00:04:18 +0000 Subject: [PATCH 407/449] make get script sudo optional (#4677) Signed-off-by: rimas --- scripts/get | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get b/scripts/get index 40fb2f69f..bf13d25bc 100755 --- a/scripts/get +++ b/scripts/get @@ -19,8 +19,8 @@ PROJECT_NAME="helm" TILLER_NAME="tiller" -USE_SUDO="true" +: ${USE_SUDO:="true"} : ${HELM_INSTALL_DIR:="/usr/local/bin"} # initArch discovers the architecture for this system. From 2166a18ce0398362522cd555bbe9e4ee355cd8a0 Mon Sep 17 00:00:00 2001 From: adshmh <23505281+adshmh@users.noreply.github.com> Date: Tue, 6 Nov 2018 19:08:24 -0500 Subject: [PATCH 408/449] fix(helm): fix incorrect yaml output format of get hooks command (#4684) Signed-off-by: Arash Deshmeh --- cmd/helm/get_hooks.go | 2 +- cmd/helm/get_hooks_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/helm/get_hooks.go b/cmd/helm/get_hooks.go index 310b2ec73..2706f381c 100644 --- a/cmd/helm/get_hooks.go +++ b/cmd/helm/get_hooks.go @@ -75,7 +75,7 @@ func (g *getHooksCmd) run() error { } for _, hook := range res.Release.Hooks { - fmt.Fprintf(g.out, "---\n# %s\n%s", hook.Name, hook.Manifest) + fmt.Fprintf(g.out, "---\n# %s\n%s\n", hook.Name, hook.Manifest) } return nil } diff --git a/cmd/helm/get_hooks_test.go b/cmd/helm/get_hooks_test.go index fe9133feb..94aace4df 100644 --- a/cmd/helm/get_hooks_test.go +++ b/cmd/helm/get_hooks_test.go @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "fmt" "io" "testing" @@ -31,7 +32,7 @@ func TestGetHooks(t *testing.T) { { name: "get hooks with release", args: []string{"aeneas"}, - expected: helm.MockHookTemplate, + expected: fmt.Sprintf("---\n# %s\n%s\n", "pre-install-hook", helm.MockHookTemplate), resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}), rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}, }, From e8af3e034554da54ab666e2fa65ca45fe8babdc6 Mon Sep 17 00:00:00 2001 From: liaoj Date: Wed, 7 Nov 2018 12:50:05 +0800 Subject: [PATCH 409/449] fix:#4873, check release name (#4883) for command helm template and helm install when cusotmer input invalid release name, return a error Signed-off-by: jliao --- cmd/helm/install.go | 5 +++++ cmd/helm/install_test.go | 32 +++++++++++++++++++++++++++++--- cmd/helm/template.go | 7 ++++++- cmd/helm/template_test.go | 31 +++++++++++++++++++++++++++++-- docs/helm/helm_template.md | 2 +- 5 files changed, 70 insertions(+), 7 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 9981a9879..1fd41931f 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -32,6 +32,7 @@ import ( "github.com/ghodss/yaml" "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/util/validation" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/downloader" "k8s.io/helm/pkg/getter" @@ -248,6 +249,10 @@ func (i *installCmd) run() error { fmt.Printf("FINAL NAME: %s\n", i.name) } + if msgs := validation.IsDNS1123Label(i.name); i.name != "" && len(msgs) > 0 { + return fmt.Errorf("release name %s is not a valid DNS label: %s", i.name, strings.Join(msgs, ";")) + } + // Check chart requirements to make sure all dependencies are present in /charts chartRequested, err := chartutil.Load(i.chartPath) if err != nil { diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index 48d9fc8c1..168c53fed 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -111,9 +111,9 @@ func TestInstall(t *testing.T) { { name: "install with name-template", args: []string{"testdata/testcharts/alpine"}, - flags: []string{"--name-template", "{{upper \"foobar\"}}"}, - expected: "FOOBAR", - resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "FOOBAR"}), + flags: []string{"--name-template", "{{lower \"FOOBAR\"}}"}, + expected: "foobar", + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "foobar"}), }, { name: "install with custom description", @@ -152,6 +152,32 @@ func TestInstall(t *testing.T) { args: []string{"testdata/testcharts/chart-bad-requirements"}, err: true, }, + // Install, using a bad release name + { + name: "install chart with release name using capitals", + args: []string{"testdata/testcharts/alpine"}, + flags: []string{"--name", "FOO"}, + err: true, + }, + { + name: "install chart with release name using periods", + args: []string{"testdata/testcharts/alpine"}, + flags: []string{"--name", "foo.bar"}, + err: true, + }, + { + name: "install chart with release name using underscores", + args: []string{"testdata/testcharts/alpine"}, + flags: []string{"--name", "foo_bar"}, + err: true, + }, + // Install, using a bad name-template + { + name: "install with name-template", + args: []string{"testdata/testcharts/alpine"}, + flags: []string{"--name-template", "{{UPPER \"foobar\"}}"}, + err: true, + }, } runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 63609c18c..d776f2989 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -29,6 +29,7 @@ import ( "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/util/validation" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/manifest" "k8s.io/helm/pkg/proto/hapi/chart" @@ -92,7 +93,7 @@ func newTemplateCmd(out io.Writer) *cobra.Command { f := cmd.Flags() f.BoolVar(&t.showNotes, "notes", false, "show the computed NOTES.txt file as well") - f.StringVarP(&t.releaseName, "name", "n", "RELEASE-NAME", "release name") + f.StringVarP(&t.releaseName, "name", "n", "release-name", "release name") f.BoolVar(&t.releaseIsUpgrade, "is-upgrade", false, "set .Release.IsUpgrade instead of .Release.IsInstall") f.StringArrayVarP(&t.renderFiles, "execute", "x", []string{}, "only execute the given templates") f.VarP(&t.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)") @@ -146,6 +147,10 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { } } + if msgs := validation.IsDNS1123Label(t.releaseName); t.releaseName != "" && len(msgs) > 0 { + return fmt.Errorf("release name %s is not a valid DNS label: %s", t.releaseName, strings.Join(msgs, ";")) + } + // Check chart requirements to make sure all dependencies are present in /charts c, err := chartutil.Load(t.chartPath) if err != nil { diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index 64924c2f2..ec989ea67 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -107,6 +107,27 @@ func TestTemplateCmd(t *testing.T) { expectKey: "subchart1/templates/service.yaml", expectValue: "release-name: \"test\"", }, + { + name: "check_invalid_name_uppercase", + desc: "verify the release name using capitals is invalid", + args: []string{subchart1ChartPath, "--name", "FOO"}, + expectKey: "subchart1/templates/service.yaml", + expectError: "is not a valid DNS label", + }, + { + name: "check_invalid_name_uppercase", + desc: "verify the release name using periods is invalid", + args: []string{subchart1ChartPath, "--name", "foo.bar"}, + expectKey: "subchart1/templates/service.yaml", + expectError: "is not a valid DNS label", + }, + { + name: "check_invalid_name_uppercase", + desc: "verify the release name using underscores is invalid", + args: []string{subchart1ChartPath, "--name", "foo_bar"}, + expectKey: "subchart1/templates/service.yaml", + expectError: "is not a valid DNS label", + }, { name: "check_release_is_install", desc: "verify --is-upgrade toggles .Release.IsInstall", @@ -135,12 +156,18 @@ func TestTemplateCmd(t *testing.T) { expectKey: "subchart1/templates/service.yaml", expectValue: "name: apache", }, + { + name: "check_invalid_name_template", + desc: "verify the relase name generate by template is invalid", + args: []string{subchart1ChartPath, "--name-template", "foobar-{{ b64enc \"abc\" }}-baz"}, + expectError: "is not a valid DNS label", + }, { name: "check_name_template", desc: "verify --name-template result exists", - args: []string{subchart1ChartPath, "--name-template", "foobar-{{ b64enc \"abc\" }}-baz"}, + args: []string{subchart1ChartPath, "--name-template", "foobar-{{ lower \"ABC\" }}-baz"}, expectKey: "subchart1/templates/service.yaml", - expectValue: "release-name: \"foobar-YWJj-baz\"", + expectValue: "release-name: \"foobar-abc-baz\"", }, { name: "check_kube_version", diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index d7770fb7f..805556096 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -28,7 +28,7 @@ helm template [flags] CHART -h, --help help for template --is-upgrade set .Release.IsUpgrade instead of .Release.IsInstall --kube-version string kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9") - -n, --name string release name (default "RELEASE-NAME") + -n, --name string release name (default "release-name") --name-template string specify template used to name the release --namespace string namespace to install the release into --notes show the computed NOTES.txt file as well From 87c2cba7e513d8a52ef7a49510d4f849147cc878 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 7 Nov 2018 06:03:44 +0100 Subject: [PATCH 410/449] Reform indentation practices using nindent (#4562) The essence of this commit is to help people get started with a better indentation practice than this: ```yaml spec: labels: {{ toYaml .Values.labels | indent 4 }} ``` The previous indentation practice is harder to read. Instead this commit introduces an indentation practice using `nindent` like this: ```yaml spec: labels: {{- toYaml .Values.labels | nindent 4 }} ``` Signed-off-by: Erik Sundell --- docs/examples/nginx/templates/deployment.yaml | 34 ++++++++++--------- docs/examples/nginx/templates/service.yaml | 22 ++++++------ pkg/chartutil/create.go | 18 +++++----- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/docs/examples/nginx/templates/deployment.yaml b/docs/examples/nginx/templates/deployment.yaml index 08850935a..5bb30f9af 100644 --- a/docs/examples/nginx/templates/deployment.yaml +++ b/docs/examples/nginx/templates/deployment.yaml @@ -6,12 +6,13 @@ metadata: # multiple times into the same namespace. name: {{ template "nginx.fullname" . }} labels: - # The "app.kubernetes.io/managed-by" label is used to track which tool deployed a given chart. - # It is useful for admins who want to see what releases a particular tool - # is responsible for. + # The "app.kubernetes.io/managed-by" label is used to track which tool + # deployed a given chart. It is useful for admins who want to see what + # releases a particular tool is responsible for. app.kubernetes.io/managed-by: {{ .Release.Service }} - # The "app.kubernetes.io/instance" convention makes it easy to tie a release to all of the - # Kubernetes resources that were created as part of that release. + # The "app.kubernetes.io/instance" convention makes it easy to tie a release + # to all of the Kubernetes resources that were created as part of that + # release. app.kubernetes.io/instance: {{ .Release.Name }} # This makes it easy to audit chart usage. helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} @@ -20,11 +21,11 @@ spec: replicas: {{ .Values.replicaCount }} template: metadata: -{{- if .Values.podAnnotations }} + {{- if .Values.podAnnotations }} # Allows custom annotations to be specified annotations: -{{ toYaml .Values.podAnnotations | indent 8 }} -{{- end }} + {{- toYaml .Values.podAnnotations | nindent 8 }} + {{- end }} labels: app.kubernetes.io/name: {{ template "nginx.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} @@ -42,15 +43,16 @@ spec: - mountPath: /usr/share/nginx/html name: wwwdata-volume resources: -# Allow chart users to specify resources. Usually, no default should be set, so this is left to be a conscious -# choice to the chart users and avoids that charts don't run out of the box on, e. g., Minikube when high resource -# requests are specified by default. -{{ toYaml .Values.resources | indent 12 }} - {{- if .Values.nodeSelector }} + # Allow chart users to specify resources. Usually, no default should + # be set, so this is left to be a conscious choice to the chart + # users and avoids that charts don't run out of the box on, e. g., + # Minikube when high resource requests are specified by default. + {{- toYaml .Values.resources | nindent 12 }} + {{- if .Values.nodeSelector }} nodeSelector: - # Node selectors can be important on mixed Windows/Linux clusters. -{{ toYaml .Values.nodeSelector | indent 8 }} - {{- end }} + # Node selectors can be important on mixed Windows/Linux clusters. + {{- toYaml .Values.nodeSelector | nindent 8 }} + {{- end }} volumes: - name: wwwdata-volume configMap: diff --git a/docs/examples/nginx/templates/service.yaml b/docs/examples/nginx/templates/service.yaml index 03f7aa2c6..a12cb0982 100644 --- a/docs/examples/nginx/templates/service.yaml +++ b/docs/examples/nginx/templates/service.yaml @@ -1,10 +1,10 @@ apiVersion: v1 kind: Service metadata: -{{- if .Values.service.annotations }} + {{- if .Values.service.annotations }} annotations: -{{ toYaml .Values.service.annotations | indent 4 }} -{{- end }} + {{- toYaml .Values.service.annotations | nindent 4 }} + {{- end }} labels: app.kubernetes.io/name: {{ template "nginx.name" . }} helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} @@ -15,17 +15,17 @@ spec: # Provides options for the service so chart users have the full choice type: "{{ .Values.service.type }}" clusterIP: "{{ .Values.service.clusterIP }}" -{{- if .Values.service.externalIPs }} + {{- if .Values.service.externalIPs }} externalIPs: -{{ toYaml .Values.service.externalIPs | indent 4 }} -{{- end }} -{{- if .Values.service.loadBalancerIP }} + {{- toYaml .Values.service.externalIPs | nindent 4 }} + {{- end }} + {{- if .Values.service.loadBalancerIP }} loadBalancerIP: "{{ .Values.service.loadBalancerIP }}" -{{- end }} -{{- if .Values.service.loadBalancerSourceRanges }} + {{- end }} + {{- if .Values.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: -{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} -{{- end }} + {{- toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }} + {{- end }} ports: - name: http port: {{ .Values.service.port }} diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 875083f7e..9063ed12a 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -138,10 +138,10 @@ metadata: helm.sh/chart: {{ include ".chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- with .Values.ingress.annotations }} + {{- with .Values.ingress.annotations }} annotations: -{{ toYaml . | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: {{- if .Values.ingress.tls }} tls: @@ -206,18 +206,18 @@ spec: path: / port: http resources: -{{ toYaml .Values.resources | indent 12 }} - {{- with .Values.nodeSelector }} + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.affinity }} affinity: -{{ toYaml . | indent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: -{{ toYaml . | indent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} ` From f95da575edb76856b41de07ce56fe60c5df45172 Mon Sep 17 00:00:00 2001 From: adshmh <23505281+adshmh@users.noreply.github.com> Date: Wed, 7 Nov 2018 00:08:18 -0500 Subject: [PATCH 411/449] include the name of the missing object in release uninstall error (#4635) * fix(tiller) added mock kube client to return failure on delete Signed-off-by: Arash Deshmeh * fix(tiller) added object's name to delete release error message Signed-off-by: Arash Deshmeh --- pkg/tiller/release_modules.go | 7 +++++-- pkg/tiller/release_server_test.go | 14 ++++++++++++++ pkg/tiller/release_uninstall_test.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/pkg/tiller/release_modules.go b/pkg/tiller/release_modules.go index 9a8c66e96..85995480c 100644 --- a/pkg/tiller/release_modules.go +++ b/pkg/tiller/release_modules.go @@ -18,7 +18,6 @@ package tiller import ( "bytes" - "errors" "fmt" "log" "strings" @@ -174,7 +173,11 @@ func DeleteRelease(rel *release.Release, vs chartutil.VersionSet, kubeClient env log.Printf("uninstall: Failed deletion of %q: %s", rel.Name, err) if err == kube.ErrNoObjectsVisited { // Rewrite the message from "no objects visited" - err = errors.New("object not found, skipping delete") + obj := "" + if file.Head != nil && file.Head.Metadata != nil { + obj = "[" + file.Head.Kind + "] " + file.Head.Metadata.Name + } + err = fmt.Errorf("release %q: object %q not found, skipping delete", rel.Name, obj) } errs = append(errs, err) } diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index 311f55b30..d94ea2eeb 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -498,6 +498,20 @@ func (h *hookFailingKubeClient) WatchUntilReady(ns string, r io.Reader, timeout return errors.New("Failed watch") } +func newDeleteFailingKubeClient() *deleteFailingKubeClient { + return &deleteFailingKubeClient{ + PrintingKubeClient: environment.PrintingKubeClient{Out: ioutil.Discard}, + } +} + +type deleteFailingKubeClient struct { + environment.PrintingKubeClient +} + +func (d *deleteFailingKubeClient) Delete(ns string, r io.Reader) error { + return kube.ErrNoObjectsVisited +} + type mockListServer struct { val *services.ListReleasesResponse } diff --git a/pkg/tiller/release_uninstall_test.go b/pkg/tiller/release_uninstall_test.go index d33e9c2a6..cb59b6bf5 100644 --- a/pkg/tiller/release_uninstall_test.go +++ b/pkg/tiller/release_uninstall_test.go @@ -197,3 +197,31 @@ func TestUninstallReleaseCustomDescription(t *testing.T) { t.Errorf("Expected description to be %q, got %q", customDescription, res.Release.Info.Description) } } + +func TestUninstallReleaseObjectNotFoundError(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + manifest := `kind: ConfigMap +metadata: + name: configmap-foo +data: + name: value +` + + rel.Manifest = manifest + rs.env.Releases.Create(rel) + rs.env.KubeClient = newDeleteFailingKubeClient() + + req := &services.UninstallReleaseRequest{ + Name: "angry-panda", + } + + _, err := rs.UninstallRelease(c, req) + if err == nil { + t.Fatalf("Expected failure to delete") + } + if !strings.Contains(err.Error(), "configmap-foo") { + t.Errorf("Expected delete error message to contain object name, got:" + err.Error()) + } +} From b56a083866a404afdb07e3e091cdbad14fc1663d Mon Sep 17 00:00:00 2001 From: Maor Friedman Date: Wed, 7 Nov 2018 10:29:07 +0200 Subject: [PATCH 412/449] related docs - remove import, export, add backup and plugin-utils instead (#4867) * remove import, export, add backup instead Signed-off-by: Maor * add helm plugin utility functions Signed-off-by: Maor * move helm-plugin-utils into helm plugins section Signed-off-by: Maor --- docs/related.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/related.md b/docs/related.md index 11ecbf672..520616e55 100644 --- a/docs/related.md +++ b/docs/related.md @@ -29,6 +29,7 @@ or [pull request](https://github.com/helm/helm/pulls). ## Helm Plugins - [App Registry](https://github.com/app-registry/helm-plugin) - Plugin to manage charts via the [App Registry specification](https://github.com/app-registry/spec) +- [helm-backup](https://github.com/maorfr/helm-backup) - Plugin which performs backup/restore of releases in a namespace to/from a file - [Helm Diff](https://github.com/databus23/helm-diff) - Preview `helm upgrade` as a coloured diff - [Helm Value Store](https://github.com/skuid/helm-value-store) - Plugin for working with Helm deployment values - [Technosophos's Helm Plugins](https://github.com/technosophos/helm-plugins) - Plugins for GitHub, Keybase, and GPG @@ -36,11 +37,9 @@ or [pull request](https://github.com/helm/helm/pulls). - [helm-cos](https://github.com/imroc/helm-cos) - Plugin to manage repositories on Tencent Cloud Object Storage - [helm-edit](https://github.com/mstrzele/helm-edit) - Plugin for editing release's values - [helm-env](https://github.com/adamreese/helm-env) - Plugin to show current environment -- [helm-export](https://github.com/maorfr/helm-export) - Plugin to export releases from namespace to a file (disaster recovery) - [helm-gcs](https://github.com/nouney/helm-gcs) - Plugin to manage repositories on Google Cloud Storage - [helm-github](https://github.com/sagansystems/helm-github) - Plugin to install Helm Charts from Github repositories - [helm-hashtag](https://github.com/balboah/helm-hashtag) - Plugin for tracking docker tag hash digests as values -- [helm-import](https://github.com/maorfr/helm-import) - Plugin for importing releases from (exported) file to a namespace (disaster recovery) - [helm-inject](https://github.com/maorfr/helm-inject) - Plugin for injecting additional configurations during release upgrade - [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp - [helm-last](https://github.com/adamreese/helm-last) - Plugin to show the latest release @@ -48,7 +47,8 @@ or [pull request](https://github.com/helm/helm/pulls). - [helm-logs](https://github.com/maorfr/helm-logs) - Plugin to view changed releases over time - [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query - [helm-nuke](https://github.com/adamreese/helm-nuke) - Plugin to destroy all releases -- [helm-restore](https://github.com/maorfr/helm-restore) - Plugin to restore the last deployed release to its original state +- [helm-plugin-utils](https://github.com/maorfr/helm-plugin-utils) - Utility functions to be used within Helm plugins +- [helm-restore](https://github.com/maorfr/helm-restore) - Plugin to restore a deployed release to its original state - [helm-secrets](https://github.com/futuresimple/helm-secrets) - Plugin to manage and store secrets safely - [helm-stop](https://github.com/IBM/helm-stop) - Plugin for stopping a release pods - [helm-template](https://github.com/technosophos/helm-template) - Debug/render templates client-side From 785d918b88970484e863bcc1fabd33166d0daed7 Mon Sep 17 00:00:00 2001 From: Ryan Dawson Date: Wed, 7 Nov 2018 15:11:44 +0000 Subject: [PATCH 413/449] note on prefixing of resource names with release name (#4633) * note on naming of resources Signed-off-by: Ryan Dawson * put whitespace back in Signed-off-by: Ryan Dawson * put whitespace back Signed-off-by: Ryan Dawson * put whitespace back Signed-off-by: Ryan Dawson * clarify template fullname Signed-off-by: Ryan Dawson * fix formatting problem by escaping underscore Signed-off-by: ryandawsonuk * no need to change whitespace elsewhere in doc Signed-off-by: ryandawsonuk --- docs/chart_best_practices/templates.md | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/chart_best_practices/templates.md b/docs/chart_best_practices/templates.md index 7b21c5fea..a3689a7dc 100644 --- a/docs/chart_best_practices/templates.md +++ b/docs/chart_best_practices/templates.md @@ -132,6 +132,43 @@ metadata: ``` +## Resource Naming in Templates + +Hard-coding the `name:` into a resource is usually considered to be bad practice. +Names should be unique to a release. So we might want to generate a name field +by inserting the release name - for example: + +```yaml +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-myservice +``` + +Or if there is only one resource of this kind then we could use .Release.Name or the template fullname function defined in \_helpers.tpl (which uses release name): + +```yaml +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} +``` + +However, there may be cases where it is known that there won't be naming conflicts from a fixed name. +In these cases a fixed name might make it easier for an application to find a resource such as a Service. +If the option for fixed names is needed then one way to manage this might be to make the setting of the name explicit by using a service.name value from the values.yaml if provided: + +```yaml +apiVersion: v1 +kind: Service +metadata: + {{- if .Values.service.name }} + name: {{ .Values.service.name }} + {{- else }} + name: {{ template "fullname" . }} + {{- end }} +``` + ## Comments (YAML Comments vs. Template Comments) Both YAML and Helm Templates have comment markers. From d318431c6ed427f361e1ab63432500336a44d8fc Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 7 Nov 2018 07:26:19 -0800 Subject: [PATCH 414/449] s,kubernetes/charts,helm/charts,g (#4889) Signed-off-by: Matthew Fisher --- docs/chart_repository.md | 6 +- docs/chart_template_guide/builtin_objects.md | 2 +- docs/chart_template_guide/wrapping_up.md | 2 +- docs/charts.md | 58 +++++++------- docs/charts_tips_and_tricks.md | 8 +- docs/provenance.md | 6 +- docs/release_checklist.md | 2 +- docs/using_helm.md | 18 ++--- .../cache/testing-basicauth-index.yaml | 2 +- .../repository/cache/testing-https-index.yaml | 2 +- .../repository/cache/testing-index.yaml | 2 +- .../cache/testing-relative-index.yaml | 4 +- ...testing-relative-trailing-slash-index.yaml | 4 +- .../repository/cache/stable-index.yaml | 76 +++++++++---------- 14 files changed, 96 insertions(+), 96 deletions(-) diff --git a/docs/chart_repository.md b/docs/chart_repository.md index 91ae3a3c4..5291f65e4 100644 --- a/docs/chart_repository.md +++ b/docs/chart_repository.md @@ -5,7 +5,7 @@ high level, a chart repository is a location where packaged charts can be stored and shared. The official chart repository is maintained by the -[Kubernetes Charts](https://github.com/kubernetes/charts), and we welcome +[Helm Charts](https://github.com/helm/charts), and we welcome participation. But Helm also makes it easy to create and run your own chart repository. This guide explains how to do so. @@ -99,7 +99,7 @@ entries: home: https://k8s.io/helm name: nginx sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - https://technosophos.github.io/tscharts/nginx-1.1.0.tgz version: 1.1.0 @@ -143,7 +143,7 @@ Congratulations, now you have an empty GCS bucket ready to serve charts! You may upload your chart repository using the Google Cloud Storage command line tool, or using the GCS web UI. This is the technique the official Kubernetes Charts repository hosts its charts, so you may want to take a -[peek at that project](https://github.com/kubernetes/charts) if you get stuck. +[peek at that project](https://github.com/helm/charts) if you get stuck. **Note:** A public GCS bucket can be accessed via simple HTTPS at this address `https://bucket-name.storage.googleapis.com/`. diff --git a/docs/chart_template_guide/builtin_objects.md b/docs/chart_template_guide/builtin_objects.md index 2108940ec..f7b2857bc 100644 --- a/docs/chart_template_guide/builtin_objects.md +++ b/docs/chart_template_guide/builtin_objects.md @@ -31,5 +31,5 @@ In the previous section, we use `{{.Release.Name}}` to insert the name of a rele The values are available to any top-level template. As we will see later, this does not necessarily mean that they will be available _everywhere_. -The built-in values always begin with a capital letter. This is in keeping with Go's naming convention. When you create your own names, you are free to use a convention that suits your team. Some teams, like the [Kubernetes Charts](https://github.com/kubernetes/charts) team, choose to use only initial lower case letters in order to distinguish local names from those built-in. In this guide, we follow that convention. +The built-in values always begin with a capital letter. This is in keeping with Go's naming convention. When you create your own names, you are free to use a convention that suits your team. Some teams, like the [Helm Charts](https://github.com/helm/charts) team, choose to use only initial lower case letters in order to distinguish local names from those built-in. In this guide, we follow that convention. diff --git a/docs/chart_template_guide/wrapping_up.md b/docs/chart_template_guide/wrapping_up.md index 6a96632bd..ea5dc1183 100755 --- a/docs/chart_template_guide/wrapping_up.md +++ b/docs/chart_template_guide/wrapping_up.md @@ -4,7 +4,7 @@ This guide is intended to give you, the chart developer, a strong understanding But there are many things this guide has not covered when it comes to the practical day-to-day development of charts. Here are some useful pointers to other documentation that will help you as you create new charts: -- The [Kubernetes Charts project](https://github.com/kubernetes/charts) is an indispensable source of charts. That project is also sets the standard for best practices in chart development. +- The [Helm Charts project](https://github.com/helm/charts) is an indispensable source of charts. That project is also sets the standard for best practices in chart development. - The Kubernetes [User's Guide](http://kubernetes.io/docs/user-guide/) provides detailed examples of the various resource kinds that you can use, from ConfigMaps and Secrets to DaemonSets and Deployments. - The Helm [Charts Guide](../charts.md) explains the workflow of using charts. - The Helm [Chart Hooks Guide](../charts_hooks.md) explains how to create lifecycle hooks. diff --git a/docs/charts.md b/docs/charts.md index 669d90164..2f7605350 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -114,7 +114,7 @@ to mark a chart as deprecated. If the **latest** version of a chart in the repository is marked as deprecated, then the chart as a whole is considered to be deprecated. The chart name can later be reused by publishing a newer version that is not marked as deprecated. The workflow for deprecating charts, as -followed by the [kubernetes/charts](https://github.com/kubernetes/charts) +followed by the [helm/charts](https://github.com/helm/charts) project is: - Update chart's `Chart.yaml` to mark the chart as deprecated, bumping the version @@ -142,9 +142,9 @@ for greater detail. ## Chart Dependencies -In Helm, one chart may depend on any number of other charts. +In Helm, one chart may depend on any number of other charts. These dependencies can be dynamically linked through the `requirements.yaml` -file or brought in to the `charts/` directory and managed manually. +file or brought in to the `charts/` directory and managed manually. Although manually managing your dependencies has a few advantages some teams need, the preferred method of declaring dependencies is by using a @@ -291,11 +291,11 @@ tags: In the above example all charts with the tag `front-end` would be disabled but since the `subchart1.enabled` path evaluates to 'true' in the parent's values, the condition will override the -`front-end` tag and `subchart1` will be enabled. +`front-end` tag and `subchart1` will be enabled. Since `subchart2` is tagged with `back-end` and that tag evaluates to `true`, `subchart2` will be enabled. Also notes that although `subchart2` has a condition specified in `requirements.yaml`, there -is no corresponding path and value in the parent's values so that condition has no effect. +is no corresponding path and value in the parent's values so that condition has no effect. ##### Using the CLI with Tags and Conditions @@ -317,19 +317,19 @@ helm install --set tags.front-end=true --set subchart2.enabled=false #### Importing Child Values via requirements.yaml -In some cases it is desirable to allow a child chart's values to propagate to the parent chart and be -shared as common defaults. An additional benefit of using the `exports` format is that it will enable future +In some cases it is desirable to allow a child chart's values to propagate to the parent chart and be +shared as common defaults. An additional benefit of using the `exports` format is that it will enable future tooling to introspect user-settable values. -The keys containing the values to be imported can be specified in the parent chart's `requirements.yaml` file -using a YAML list. Each item in the list is a key which is imported from the child chart's `exports` field. +The keys containing the values to be imported can be specified in the parent chart's `requirements.yaml` file +using a YAML list. Each item in the list is a key which is imported from the child chart's `exports` field. To import values not contained in the `exports` key, use the [child-parent](#using-the-child-parent-format) format. Examples of both formats are described below. ##### Using the exports format -If a child chart's `values.yaml` file contains an `exports` field at the root, its contents may be imported +If a child chart's `values.yaml` file contains an `exports` field at the root, its contents may be imported directly into the parent's values by specifying the keys to import as in the example below: ```yaml @@ -346,8 +346,8 @@ exports: myint: 99 ``` -Since we are specifying the key `data` in our import list, Helm looks in the `exports` field of the child -chart for `data` key and imports its contents. +Since we are specifying the key `data` in our import list, Helm looks in the `exports` field of the child +chart for `data` key and imports its contents. The final parent values would contain our exported field: @@ -358,16 +358,16 @@ myint: 99 ``` -Please note the parent key `data` is not contained in the parent's final values. If you need to specify the -parent key, use the 'child-parent' format. +Please note the parent key `data` is not contained in the parent's final values. If you need to specify the +parent key, use the 'child-parent' format. ##### Using the child-parent format -To access values that are not contained in the `exports` key of the child chart's values, you will need to -specify the source key of the values to be imported (`child`) and the destination path in the parent chart's +To access values that are not contained in the `exports` key of the child chart's values, you will need to +specify the source key of the values to be imported (`child`) and the destination path in the parent chart's values (`parent`). -The `import-values` in the example below instructs Helm to take any values found at `child:` path and copy them +The `import-values` in the example below instructs Helm to take any values found at `child:` path and copy them to the parent's values at the path specified in `parent:` ```yaml @@ -382,7 +382,7 @@ dependencies: parent: myimports ``` In the above example, values found at `default.data` in the subchart1's values will be imported -to the `myimports` key in the parent chart's values as detailed below: +to the `myimports` key in the parent chart's values as detailed below: ```yaml # parent's values.yaml file @@ -391,7 +391,7 @@ myimports: myint: 0 mybool: false mystring: "helm rocks!" - + ``` ```yaml # subchart1's values.yaml file @@ -400,7 +400,7 @@ default: data: myint: 999 mybool: true - + ``` The parent chart's resulting values would be: @@ -468,7 +468,7 @@ Furthermore, A is dependent on chart B that creates objects - replicaset "B-ReplicaSet" - service "B-Service" -After installation/upgrade of chart A a single Helm release is created/modified. The release will +After installation/upgrade of chart A a single Helm release is created/modified. The release will create/update all of the above Kubernetes objects in the following order: - A-Namespace @@ -478,16 +478,16 @@ create/update all of the above Kubernetes objects in the following order: - A-Service - B-Service -This is because when Helm installs/upgrades charts, -the Kubernetes objects from the charts and all its dependencies are +This is because when Helm installs/upgrades charts, +the Kubernetes objects from the charts and all its dependencies are -- aggregrated into a single set; then -- sorted by type followed by name; and then -- created/updated in that order. +- aggregrated into a single set; then +- sorted by type followed by name; and then +- created/updated in that order. Hence a single release is created with all the objects for the chart and its dependencies. -The install order of Kubernetes types is given by the enumeration InstallOrder in kind_sorter.go +The install order of Kubernetes types is given by the enumeration InstallOrder in kind_sorter.go (see [the Helm source file](https://github.com/helm/helm/blob/master/pkg/tiller/kind_sorter.go#L26)). ## Templates and Values @@ -560,8 +560,8 @@ It can use the following four template values (usually defined in a All of these values are defined by the template author. Helm does not require or dictate parameters. -To see many working charts, check out the [Kubernetes Charts -project](https://github.com/kubernetes/charts) +To see many working charts, check out the [Helm Charts +project](https://github.com/helm/charts) ### Predefined Values diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index a83b44457..f1751b1b5 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -109,7 +109,7 @@ to render and exit when .Values.foo is undefined. ## Using the 'tpl' Function The `tpl` function allows developers to evaluate strings as templates inside a template. -This is useful to pass a template string as a value to a chart or render external configuration files. +This is useful to pass a template string as a value to a chart or render external configuration files. Syntax: `{{ tpl TEMPLATE_STRING VALUES }}` Examples: @@ -152,7 +152,7 @@ imageCredentials: registry: quay.io username: someone password: sillyness -``` +``` We then define our helper template as follows: ``` @@ -182,7 +182,7 @@ deployment spec itself didn't change the application keeps running with the old configuration resulting in an inconsistent deployment. The `sha256sum` function can be used to ensure a deployment's -annotation section is updated if another file changes: +annotation section is updated if another file changes: ```yaml kind: Deployment @@ -232,7 +232,7 @@ by convention, helper templates and partials are placed in a ## Complex Charts with Many Dependencies -Many of the charts in the [official charts repository](https://github.com/kubernetes/charts) +Many of the charts in the [official charts repository](https://github.com/helm/charts) are "building blocks" for creating more advanced applications. But charts may be used to create instances of large-scale applications. In such cases, a single umbrella chart may have multiple subcharts, each of which functions as a piece diff --git a/docs/provenance.md b/docs/provenance.md index 3a19fcd07..163e72842 100644 --- a/docs/provenance.md +++ b/docs/provenance.md @@ -27,7 +27,7 @@ Prerequisites: **NOTE:** If your PGP private key has a passphrase, you will be prompted to enter that passphrase for any commands that support the `--sign` option. You can set the -HELM_KEY_PASSPHRASE environment variable to that passphrase in case you don't want +HELM_KEY_PASSPHRASE environment variable to that passphrase in case you don't want to be prompted to enter the passphrase. **NOTE:** The keyfile format for GnuPG changed in version 2.1. Prior to that release @@ -261,9 +261,9 @@ in using the provenance system: - Keybase also has fabulous documentation available - While we haven't tested it, Keybase's "secure website" feature could be used to serve Helm charts. -- The [official Kubernetes Charts project](https://github.com/kubernetes/charts) +- The [official Helm Charts project](https://github.com/helm/charts) is trying to solve this problem for the official chart repository. - - There is a long issue there [detailing the current thoughts](https://github.com/kubernetes/charts/issues/23). + - There is a long issue there [detailing the current thoughts](https://github.com/helm/charts/issues/23). - The basic idea is that an official "chart reviewer" signs charts with her or his key, and the resulting provenance file is then uploaded to the chart repository. diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 9213b4c1f..c69db9d21 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -224,7 +224,7 @@ The community keeps growing, and we'd love to see you there! - `#helm-users` for questions and just to hang out - `#helm-dev` for discussing PRs, code, and bugs - Hang out at the Public Developer Call: Thursday, 9:30 Pacific via [Zoom](https://zoom.us/j/696660622) -- Test, debug, and contribute charts: [GitHub/kubernetes/charts](https://github.com/kubernetes/charts) +- Test, debug, and contribute charts: [GitHub/helm/charts](https://github.com/helm/charts) ## Installation and Upgrading diff --git a/docs/using_helm.md b/docs/using_helm.md index 4b18e2cf2..5716a1302 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -63,7 +63,7 @@ stable/mysql 0.1.0 Chart for MySQL stable/mariadb 0.5.1 Chart for MariaDB ``` -Now you will only see the results that match your filter. +Now you will only see the results that match your filter. Why is `mariadb` in the list? Because its package description relates it to @@ -231,7 +231,7 @@ There are two ways to pass configuration data during install: If both are used, `--set` values are merged into `--values` with higher precedence. Overrides specified with `--set` are persisted in a configmap. Values that have been -`--set` can be viewed for a given release with `helm get values `. +`--set` can be viewed for a given release with `helm get values `. Values that have been `--set` can be cleared by running `helm upgrade` with `--reset-values` specified. @@ -405,11 +405,11 @@ is not a full list of cli flags. To see a description of all flags, just run This defaults to 300 (5 minutes) - `--wait`: Waits until all Pods are in a ready state, PVCs are bound, Deployments have minimum (`Desired` minus `maxUnavailable`) Pods in ready state and - Services have an IP address (and Ingress if a `LoadBalancer`) before - marking the release as successful. It will wait for as long as the - `--timeout` value. If timeout is reached, the release will be marked as - `FAILED`. Note: In scenario where Deployment has `replicas` set to 1 and - `maxUnavailable` is not set to 0 as part of rolling update strategy, + Services have an IP address (and Ingress if a `LoadBalancer`) before + marking the release as successful. It will wait for as long as the + `--timeout` value. If timeout is reached, the release will be marked as + `FAILED`. Note: In scenario where Deployment has `replicas` set to 1 and + `maxUnavailable` is not set to 0 as part of rolling update strategy, `--wait` will return as ready as it has satisfied the minimum Pod in ready condition. - `--no-hooks`: This skips running hooks for the command - `--recreate-pods` (only available for `upgrade` and `rollback`): This flag @@ -518,8 +518,8 @@ $ helm install ./deis-workflow-0.1.0.tgz Charts that are archived can be loaded into chart repositories. See the documentation for your chart repository server to learn how to upload. -Note: The `stable` repository is managed on the [Kubernetes Charts -GitHub repository](https://github.com/kubernetes/charts). That project +Note: The `stable` repository is managed on the [Helm Charts +GitHub repository](https://github.com/helm/charts). That project accepts chart source code, and (after audit) packages those for you. ## Tiller, Namespaces and RBAC diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-basicauth-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-basicauth-index.yaml index 47bb1b77c..b90c4e232 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-basicauth-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-basicauth-index.yaml @@ -8,7 +8,7 @@ entries: keywords: [] maintainers: [] sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - http://username:password@example.com/foo-1.2.3.tgz version: 1.2.3 diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-https-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-https-index.yaml index 872478c3f..37a74c9c1 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-https-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-https-index.yaml @@ -8,7 +8,7 @@ entries: keywords: [] maintainers: [] sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - https://example.com/foo-1.2.3.tgz version: 1.2.3 diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml index 7543a59f5..75fcfdc69 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml @@ -36,7 +36,7 @@ entries: keywords: [] maintainers: [] sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - http://example.com/foo-1.2.3.tgz version: 1.2.3 diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-relative-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-relative-index.yaml index 210f92e45..987e2861a 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-relative-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-relative-index.yaml @@ -8,7 +8,7 @@ entries: keywords: [] maintainers: [] sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - charts/foo-1.2.3.tgz version: 1.2.3 @@ -21,7 +21,7 @@ entries: keywords: [] maintainers: [] sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - bar-1.2.3.tgz version: 1.2.3 diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-relative-trailing-slash-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-relative-trailing-slash-index.yaml index 210f92e45..987e2861a 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-relative-trailing-slash-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-relative-trailing-slash-index.yaml @@ -8,7 +8,7 @@ entries: keywords: [] maintainers: [] sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - charts/foo-1.2.3.tgz version: 1.2.3 @@ -21,7 +21,7 @@ entries: keywords: [] maintainers: [] sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - bar-1.2.3.tgz version: 1.2.3 diff --git a/pkg/getter/testdata/repository/cache/stable-index.yaml b/pkg/getter/testdata/repository/cache/stable-index.yaml index bf187e3df..d4f883a25 100644 --- a/pkg/getter/testdata/repository/cache/stable-index.yaml +++ b/pkg/getter/testdata/repository/cache/stable-index.yaml @@ -214,7 +214,7 @@ entries: name: concourse sources: - https://github.com/concourse/bin - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - https://kubernetes-charts.storage.googleapis.com/concourse-0.1.3.tgz version: 0.1.3 @@ -234,7 +234,7 @@ entries: name: concourse sources: - https://github.com/concourse/bin - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - https://kubernetes-charts.storage.googleapis.com/concourse-0.1.2.tgz version: 0.1.2 @@ -254,7 +254,7 @@ entries: name: concourse sources: - https://github.com/concourse/bin - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - https://kubernetes-charts.storage.googleapis.com/concourse-0.1.1.tgz version: 0.1.1 @@ -273,7 +273,7 @@ entries: name: concourse sources: - https://github.com/concourse/bin - - https://github.com/kubernetes/charts + - https://github.com/helm/charts urls: - https://kubernetes-charts.storage.googleapis.com/concourse-0.1.0.tgz version: 0.1.0 @@ -3985,7 +3985,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.2.6.tgz @@ -4006,7 +4006,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.2.5.tgz @@ -4025,7 +4025,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.2.4.tgz @@ -4044,7 +4044,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.2.3.tgz @@ -4063,7 +4063,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.2.2.tgz @@ -4082,7 +4082,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.2.1.tgz @@ -4101,7 +4101,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.2.0.tgz @@ -4120,7 +4120,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.1.2.tgz @@ -4139,7 +4139,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.1.1.tgz @@ -4158,7 +4158,7 @@ entries: name: Vic Iglesias name: mysql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/mysql urls: - https://kubernetes-charts.storage.googleapis.com/mysql-0.1.0.tgz @@ -5034,7 +5034,7 @@ entries: name: Patrick Galbraith name: percona sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/percona urls: - https://kubernetes-charts.storage.googleapis.com/percona-0.1.0.tgz @@ -5404,7 +5404,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.6.0.tgz @@ -5426,7 +5426,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.5.1.tgz @@ -5448,7 +5448,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.5.0.tgz @@ -5470,7 +5470,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.4.0.tgz @@ -5492,7 +5492,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.3.4.tgz @@ -5512,7 +5512,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.3.3.tgz @@ -5532,7 +5532,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.3.2.tgz @@ -5552,7 +5552,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.3.1.tgz @@ -5572,7 +5572,7 @@ entries: - name: databus23 name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.3.0.tgz @@ -5591,7 +5591,7 @@ entries: - name: swordbeta name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.2.2.tgz @@ -5610,7 +5610,7 @@ entries: - name: swordbeta name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.2.1.tgz @@ -5629,7 +5629,7 @@ entries: - name: swordbeta name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.2.0.tgz @@ -5648,7 +5648,7 @@ entries: - name: swordbeta name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.1.1.tgz @@ -5667,7 +5667,7 @@ entries: - name: swordbeta name: postgresql sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/docker-library/postgres urls: - https://kubernetes-charts.storage.googleapis.com/postgresql-0.1.0.tgz @@ -6720,7 +6720,7 @@ entries: sources: - https://bitbucket.org/sapho/ops-docker-tomcat/src - https://hub.docker.com/r/sapho/ops-docker-tomcat - - https://github.com/kubernetes/charts/tree/master/stable/mysql + - https://github.com/helm/charts/tree/master/stable/mysql urls: - https://kubernetes-charts.storage.googleapis.com/sapho-0.1.5.tgz version: 0.1.5 @@ -6738,7 +6738,7 @@ entries: sources: - https://bitbucket.org/sapho/ops-docker-tomcat/src - https://hub.docker.com/r/sapho/ops-docker-tomcat - - https://github.com/kubernetes/charts/tree/master/stable/mysql + - https://github.com/helm/charts/tree/master/stable/mysql urls: - https://kubernetes-charts.storage.googleapis.com/sapho-0.1.4.tgz version: 0.1.4 @@ -6756,7 +6756,7 @@ entries: sources: - https://bitbucket.org/sapho/ops-docker-tomcat/src - https://hub.docker.com/r/sapho/ops-docker-tomcat - - https://github.com/kubernetes/charts/tree/master/stable/mysql + - https://github.com/helm/charts/tree/master/stable/mysql urls: - https://kubernetes-charts.storage.googleapis.com/sapho-0.1.3.tgz version: 0.1.3 @@ -6794,7 +6794,7 @@ entries: name: Shane Starcher name: sensu sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/sstarcher/docker-sensu - https://github.com/sensu/sensu urls: @@ -6815,7 +6815,7 @@ entries: name: Shane Starcher name: sensu sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/sstarcher/docker-sensu - https://github.com/sensu/sensu urls: @@ -6836,7 +6836,7 @@ entries: name: Shane Starcher name: sensu sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/sstarcher/docker-sensu - https://github.com/sensu/sensu urls: @@ -7506,7 +7506,7 @@ entries: name: Shane Starcher name: uchiwa sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/sstarcher/docker-uchiwa - https://github.com/sensu/uchiwa urls: @@ -7528,7 +7528,7 @@ entries: name: Shane Starcher name: uchiwa sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/sstarcher/docker-uchiwa - https://github.com/sensu/uchiwa urls: @@ -7550,7 +7550,7 @@ entries: name: Shane Starcher name: uchiwa sources: - - https://github.com/kubernetes/charts + - https://github.com/helm/charts - https://github.com/sstarcher/docker-uchiwa - https://github.com/sensu/uchiwa urls: From bbf0e91bcb92443ac8c6705a01259f7a0c72ce33 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 8 Nov 2018 14:22:09 -0800 Subject: [PATCH 415/449] add appveyor for testing on Windows (#4136) Signed-off-by: Matthew Fisher --- .appveyor.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..d7ba1d9fd --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,17 @@ +version: "{build}" +clone_folder: c:\go\src\k8s.io\helm +environment: + GOPATH: c:\go + PATH: c:\ProgramData\bin;$(PATH) +install: + - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/fishworks/gofish/master/scripts/install.ps1')) + - gofish init + - gofish install dep + - dep ensure -v +cache: + - vendor -> Gopkg.lock +build: "off" +deploy: "off" +test_script: + - go build .\cmd\... + - go test .\... From b2e052d4e7899c79edc192d72d7c11807e66c8b0 Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Mon, 12 Nov 2018 03:32:21 -0800 Subject: [PATCH 416/449] fix(helm): Merge nested values correctly on upgrade (#4806) Upgrading a release and override existing values doesn't work as expected for nested values. Maps should be merged recursively, but currently maps are treated just like values and replaced at the top level. If the existing values are: ```yaml resources: requests: cpu: 400m something: else ``` and an update is done with ```--set=resources.requests.cpu=500m```, it currently ends up as ```yaml resources: requests: cpu: 500m ``` but it should have been ```yaml resources: requests: cpu: 500m something: else ``` This PR updates the way override values are merged into the existing set of values to merge rather than replace maps. Closes: #4792 Signed-off-by: Morten Torkildsen --- pkg/chartutil/values.go | 16 ++++++ pkg/chartutil/values_test.go | 82 +++++++++++++++++++++++++++++++ pkg/tiller/release_server.go | 27 +++++----- pkg/tiller/release_update_test.go | 67 +++++++++++++++++++++++++ 4 files changed, 178 insertions(+), 14 deletions(-) diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index 1ea7edd8c..a47073b67 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -94,6 +94,22 @@ func (v Values) Encode(w io.Writer) error { return err } +// MergeInto takes the properties in src and merges them into Values. Maps +// are merged while values and arrays are replaced. +func (v Values) MergeInto(src Values) { + for key, srcVal := range src { + destVal, found := v[key] + + if found && istable(srcVal) && istable(destVal) { + destMap := destVal.(map[string]interface{}) + srcMap := srcVal.(map[string]interface{}) + Values(destMap).MergeInto(Values(srcMap)) + } else { + v[key] = srcVal + } + } +} + func tableLookup(v Values, simple string) (Values, error) { v2, ok := v[simple] if !ok { diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index f54b25827..f38afaf95 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -20,6 +20,7 @@ import ( "bytes" "encoding/json" "fmt" + "reflect" "testing" "text/template" @@ -457,3 +458,84 @@ chapter: } } } + +func TestValuesMergeInto(t *testing.T) { + testCases := map[string]struct { + destination string + source string + result string + }{ + "maps are merged": { + ` +resources: + requests: + cpu: 400m + something: else +`, + ` +resources: + requests: + cpu: 500m +`, + ` +resources: + requests: + cpu: 500m + something: else +`, + }, + "values are replaced": { + ` +firstKey: firstValue +secondKey: secondValue +thirdKey: thirdValue +`, + ` +firstKey: newFirstValue +thirdKey: newThirdValue +`, + ` +firstKey: newFirstValue +secondKey: secondValue +thirdKey: newThirdValue +`, + }, + "new values are added": { + ` +existingKey: existingValue +`, + ` +newKey: newValue +anotherNewKey: + nestedNewKey: nestedNewValue +`, + ` +existingKey: existingValue +newKey: newValue +anotherNewKey: + nestedNewKey: nestedNewValue +`, + }, + } + + for name, tc := range testCases { + d, err := ReadValues([]byte(tc.destination)) + if err != nil { + t.Error(err) + } + s, err := ReadValues([]byte(tc.source)) + if err != nil { + t.Error(err) + } + expectedRes, err := ReadValues([]byte(tc.result)) + if err != nil { + t.Error(err) + } + + d.MergeInto(s) + + if !reflect.DeepEqual(expectedRes, d) { + t.Errorf("%s: Expected %v, but got %v", name, expectedRes, d) + } + } +} diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index f5e96ed00..cf7748f44 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -25,7 +25,6 @@ import ( "strings" "github.com/technosophos/moniker" - "gopkg.in/yaml.v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/discovery" "k8s.io/client-go/kubernetes" @@ -136,28 +135,28 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current if err != nil { return err } + req.Chart.Values = &chart.Config{Raw: nv} + + reqValues, err := chartutil.ReadValues([]byte(req.Values.Raw)) + if err != nil { + return err + } - // merge new values with current + currentConfig := chartutil.Values{} if current.Config != nil && current.Config.Raw != "" && current.Config.Raw != "{}\n" { - if req.Values.Raw != "{}\n" { - req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw - } else { - req.Values.Raw = current.Config.Raw + "\n" + currentConfig, err = chartutil.ReadValues([]byte(current.Config.Raw)) + if err != nil { + return err } } - req.Chart.Values = &chart.Config{Raw: nv} - // yaml unmarshal and marshal to remove duplicate keys - y := map[string]interface{}{} - if err := yaml.Unmarshal([]byte(req.Values.Raw), &y); err != nil { - return err - } - data, err := yaml.Marshal(y) + currentConfig.MergeInto(reqValues) + data, err := currentConfig.YAML() if err != nil { return err } - req.Values.Raw = string(data) + req.Values.Raw = data return nil } diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 81fad0bc4..ea1c88f62 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -23,10 +23,12 @@ import ( "github.com/golang/protobuf/proto" + "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" + "reflect" ) func TestUpdateRelease(t *testing.T) { @@ -168,6 +170,71 @@ func TestUpdateRelease_ReuseValuesWithNoValues(t *testing.T) { } } +func TestUpdateRelease_NestedReuseValues(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + + installReq := &services.InstallReleaseRequest{ + Namespace: "spaced", + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + }, + Values: &chart.Config{Raw: "defaultFoo: defaultBar"}, + }, + Values: &chart.Config{Raw: ` +foo: bar +root: + nested: nestedValue + anotherNested: anotherNestedValue +`}, + } + + installResp, err := rs.InstallRelease(c, installReq) + if err != nil { + t.Fatal(err) + } + + rel := installResp.Release + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + }, + Values: &chart.Config{Raw: "defaultFoo: defaultBar"}, + }, + Values: &chart.Config{Raw: ` +root: + nested: newNestedValue +`}, + ReuseValues: true, + } + + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + + expect, _ := chartutil.ReadValues([]byte(` +foo: bar +root: + nested: newNestedValue + anotherNested: anotherNestedValue +`)) + + requestConfig, err := chartutil.ReadValues([]byte(res.Release.Config.Raw)) + if err != nil { + t.Errorf("Request config could not be parsed: %v", err) + } + + if !reflect.DeepEqual(expect, requestConfig) { + t.Errorf("Expected request config to be %v, got %v", expect, requestConfig) + } +} + // This is a regression test for bug found in issue #3655 func TestUpdateRelease_ComplexReuseValues(t *testing.T) { c := helm.NewContext() From 248f58b95d80bb42d80fd172a5794c3edc6e7636 Mon Sep 17 00:00:00 2001 From: Brent Date: Mon, 12 Nov 2018 05:36:58 -0600 Subject: [PATCH 417/449] fix(tiller): rollback deleted release (#3722) (#4820) Solves #3722 by making the changes in #3539 more compatible with the previous behavior. This gives a recovery option for "oops I deleted my helm release" by allowing rollback, which is intended to be a working feature of helm. Note that purging releases removes the history required to rollback, so this doesn't work in that case. However, purging takes significantly more time, so it's harder to accidentally purge everything. Signed-off-by: Brent --- pkg/storage/storage.go | 8 ++-- pkg/tiller/release_rollback.go | 11 ++++- pkg/tiller/release_rollback_test.go | 68 ++++++++++++++++++++++++++++- 3 files changed, 81 insertions(+), 6 deletions(-) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 40fc558a1..6d5f589b9 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -25,6 +25,8 @@ import ( "k8s.io/helm/pkg/storage/driver" ) +const NoReleasesErr = "has no deployed releases" + // Storage represents a storage engine for a Release. type Storage struct { driver.Driver @@ -124,13 +126,13 @@ func (s *Storage) Deployed(name string) (*rspb.Release, error) { ls, err := s.DeployedAll(name) if err != nil { if strings.Contains(err.Error(), "not found") { - return nil, fmt.Errorf("%q has no deployed releases", name) + return nil, fmt.Errorf("%q %s", name, NoReleasesErr) } return nil, err } if len(ls) == 0 { - return nil, fmt.Errorf("%q has no deployed releases", name) + return nil, fmt.Errorf("%q %s", name, NoReleasesErr) } return ls[0], err @@ -150,7 +152,7 @@ func (s *Storage) DeployedAll(name string) ([]*rspb.Release, error) { return ls, nil } if strings.Contains(err.Error(), "not found") { - return nil, fmt.Errorf("%q has no deployed releases", name) + return nil, fmt.Errorf("%q %s", name, NoReleasesErr) } return nil, err } diff --git a/pkg/tiller/release_rollback.go b/pkg/tiller/release_rollback.go index 75e282fb8..1f72c3256 100644 --- a/pkg/tiller/release_rollback.go +++ b/pkg/tiller/release_rollback.go @@ -18,6 +18,8 @@ package tiller import ( "fmt" + "k8s.io/helm/pkg/storage" + "strings" ctx "golang.org/x/net/context" @@ -151,11 +153,16 @@ func (s *ReleaseServer) performRollback(currentRelease, targetRelease *release.R } } + // update the current release + s.Log("superseding previous deployment %d", currentRelease.Version) + currentRelease.Info.Status.Code = release.Status_SUPERSEDED + s.recordRelease(currentRelease, true) + + // Supersede all previous deployments, see issue #2941. deployed, err := s.env.Releases.DeployedAll(currentRelease.Name) - if err != nil { + if err != nil && !strings.Contains(err.Error(), storage.NoReleasesErr) { return nil, err } - // Supersede all previous deployments, see issue #2941. for _, r := range deployed { s.Log("superseding previous deployment %d", r.Version) r.Info.Status.Code = release.Status_SUPERSEDED diff --git a/pkg/tiller/release_rollback_test.go b/pkg/tiller/release_rollback_test.go index d7909ed8b..6aa895a63 100644 --- a/pkg/tiller/release_rollback_test.go +++ b/pkg/tiller/release_rollback_test.go @@ -169,7 +169,7 @@ func TestRollbackWithReleaseVersion(t *testing.T) { // check that v2 is now in a SUPERSEDED state oldRel, err := rs.env.Releases.Get(rel.Name, 2) if err != nil { - t.Fatalf("Failed to retrieve v1: %s", err) + t.Fatalf("Failed to retrieve v2: %s", err) } if oldRel.Info.Status.Code != release.Status_SUPERSEDED { t.Errorf("Expected v2 to be in a SUPERSEDED state, got %q", oldRel.Info.Status.Code) @@ -184,6 +184,72 @@ func TestRollbackWithReleaseVersion(t *testing.T) { } } +func TestRollbackDeleted(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.Log = t.Logf + rs.env.Releases.Log = t.Logf + rel2 := releaseStub() + rel2.Name = "other" + rs.env.Releases.Create(rel2) + rel := releaseStub() + rs.env.Releases.Create(rel) + v2 := upgradeReleaseVersion(rel) + rs.env.Releases.Update(rel) + rs.env.Releases.Create(v2) + v3 := upgradeReleaseVersion(v2) + // retain the original release as DEPLOYED while the update should fail + v2.Info.Status.Code = release.Status_DEPLOYED + v3.Info.Status.Code = release.Status_FAILED + rs.env.Releases.Update(v2) + rs.env.Releases.Create(v3) + + req1 := &services.UninstallReleaseRequest{ + Name: rel.Name, + DisableHooks: true, + } + + _, err := rs.UninstallRelease(c, req1) + if err != nil { + t.Fatalf("Failed uninstall: %s", err) + } + + oldRel, err := rs.env.Releases.Get(rel.Name, 3) + if err != nil { + t.Fatalf("Failed to retrieve v3: %s", err) + } + if oldRel.Info.Status.Code != release.Status_DELETED { + t.Errorf("Expected v3 to be in a DELETED state, got %q", oldRel.Info.Status.Code) + } + + req2 := &services.RollbackReleaseRequest{ + Name: rel.Name, + DisableHooks: true, + Version: 2, + } + + _, err = rs.RollbackRelease(c, req2) + if err != nil { + t.Fatalf("Failed rollback: %s", err) + } + // check that v3 is now in a SUPERSEDED state + oldRel, err = rs.env.Releases.Get(rel.Name, 3) + if err != nil { + t.Fatalf("Failed to retrieve v3: %s", err) + } + if oldRel.Info.Status.Code != release.Status_SUPERSEDED { + t.Errorf("Expected v3 to be in a SUPERSEDED state, got %q", oldRel.Info.Status.Code) + } + // make sure we didn't update some other deployments. + otherRel, err := rs.env.Releases.Get(rel2.Name, 1) + if err != nil { + t.Fatalf("Failed to retrieve other v1: %s", err) + } + if otherRel.Info.Status.Code != release.Status_DEPLOYED { + t.Errorf("Expected other deployed release to stay untouched, got %q", otherRel.Info.Status.Code) + } +} + func TestRollbackReleaseNoHooks(t *testing.T) { c := helm.NewContext() rs := rsFixture() From 1c6b97b1b163abee718133d684b069760c873a76 Mon Sep 17 00:00:00 2001 From: Lev Aminov Date: Mon, 12 Nov 2018 16:37:43 +0500 Subject: [PATCH 418/449] fix(helm): Non-zero exit code on failed chart repository update (#4348) * Fail on failed chart repository update * Fix failed test * Add repo update strict flag --- cmd/helm/repo_update.go | 25 +++++++++++++++++++------ cmd/helm/repo_update_test.go | 5 +++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/cmd/helm/repo_update.go b/cmd/helm/repo_update.go index 291b21b72..526300343 100644 --- a/cmd/helm/repo_update.go +++ b/cmd/helm/repo_update.go @@ -40,9 +40,10 @@ future releases. var errNoRepositories = errors.New("no repositories found. You must add one before updating") type repoUpdateCmd struct { - update func([]*repo.ChartRepository, io.Writer, helmpath.Home) + update func([]*repo.ChartRepository, io.Writer, helmpath.Home, bool) error home helmpath.Home out io.Writer + strict bool } func newRepoUpdateCmd(out io.Writer) *cobra.Command { @@ -60,6 +61,10 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command { return u.run() }, } + + f := cmd.Flags() + f.BoolVar(&u.strict, "strict", false, "fail on update warnings") + return cmd } @@ -80,14 +85,15 @@ func (u *repoUpdateCmd) run() error { } repos = append(repos, r) } - - u.update(repos, u.out, u.home) - return nil + return u.update(repos, u.out, u.home, u.strict) } -func updateCharts(repos []*repo.ChartRepository, out io.Writer, home helmpath.Home) { +func updateCharts(repos []*repo.ChartRepository, out io.Writer, home helmpath.Home, strict bool) error { fmt.Fprintln(out, "Hang tight while we grab the latest from your chart repositories...") - var wg sync.WaitGroup + var ( + errorCounter int + wg sync.WaitGroup + ) for _, re := range repos { wg.Add(1) go func(re *repo.ChartRepository) { @@ -98,6 +104,7 @@ func updateCharts(repos []*repo.ChartRepository, out io.Writer, home helmpath.Ho } err := re.DownloadIndexFile(home.Cache()) if err != nil { + errorCounter++ fmt.Fprintf(out, "...Unable to get an update from the %q chart repository (%s):\n\t%s\n", re.Config.Name, re.Config.URL, err) } else { fmt.Fprintf(out, "...Successfully got an update from the %q chart repository\n", re.Config.Name) @@ -105,5 +112,11 @@ func updateCharts(repos []*repo.ChartRepository, out io.Writer, home helmpath.Ho }(re) } wg.Wait() + + if errorCounter != 0 && strict { + return errors.New("Update Failed. Check log for details") + } + fmt.Fprintln(out, "Update Complete. ⎈ Happy Helming!⎈ ") + return nil } diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go index 71dc87966..86af437c5 100644 --- a/cmd/helm/repo_update_test.go +++ b/cmd/helm/repo_update_test.go @@ -46,10 +46,11 @@ func TestUpdateCmd(t *testing.T) { out := bytes.NewBuffer(nil) // Instead of using the HTTP updater, we provide our own for this test. // The TestUpdateCharts test verifies the HTTP behavior independently. - updater := func(repos []*repo.ChartRepository, out io.Writer, hh helmpath.Home) { + updater := func(repos []*repo.ChartRepository, out io.Writer, hh helmpath.Home, strict bool) error { for _, re := range repos { fmt.Fprintln(out, re.Config.Name) } + return nil } uc := &repoUpdateCmd{ update: updater, @@ -94,7 +95,7 @@ func TestUpdateCharts(t *testing.T) { } b := bytes.NewBuffer(nil) - updateCharts([]*repo.ChartRepository{r}, b, hh) + updateCharts([]*repo.ChartRepository{r}, b, hh, false) got := b.String() if strings.Contains(got, "Unable to get an update") { From 3b96a46881e02dd84c9ed05640899fb8736695bb Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Mon, 12 Nov 2018 12:15:43 -0500 Subject: [PATCH 419/449] Helm code of conduct (#4901) See https://github.com/helm/chart-testing/issues/48 Signed-by: Scott Rigby Signed-off-by: Scott Rigby --- code-of-conduct.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code-of-conduct.md b/code-of-conduct.md index 0d15c00cf..91ccaf035 100644 --- a/code-of-conduct.md +++ b/code-of-conduct.md @@ -1,3 +1,3 @@ -# Kubernetes Community Code of Conduct +# Community Code of Conduct -Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) +Helm follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). From b6d475c16b87f684d2e0c1bb0688a85cfe28e165 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 15 Nov 2018 17:20:08 +0100 Subject: [PATCH 420/449] fix(docs): run `make docs` (#4924) Signed-off-by: Matthew Fisher --- docs/helm/helm_repo_update.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/helm/helm_repo_update.md b/docs/helm/helm_repo_update.md index 0d14f63ed..381c12fb3 100644 --- a/docs/helm/helm_repo_update.md +++ b/docs/helm/helm_repo_update.md @@ -19,7 +19,8 @@ helm repo update [flags] ### Options ``` - -h, --help help for update + -h, --help help for update + --strict fail on update warnings ``` ### Options inherited from parent commands @@ -38,4 +39,4 @@ helm repo update [flags] * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 1-Aug-2018 +###### Auto generated by spf13/cobra on 15-Nov-2018 From 3aa1723f22f29b8b12cce06cbf0493cfd25e2a05 Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Thu, 15 Nov 2018 11:58:07 -0800 Subject: [PATCH 421/449] fix(helm): Fix linebreaks when printing custom resources The output from helm status is not correct for custom resources. The HumanReadablePrinter from Kubernetes only outputs the column names when the type differs from the previous one. This makes the output inconsistent and also creates problems for putting in the correct line breaks. This PR sets up a new printer for each type, thereby making sure that all types are printed with the correct use of line breaks and with column names. Signed-off-by: Morten Torkildsen --- pkg/kube/client.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 0cc68b71b..f86621b3f 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -211,18 +211,15 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // an object type changes, so we can just rely on that. Problem is it doesn't seem to keep // track of tab widths. buf := new(bytes.Buffer) - p, _ := get.NewHumanPrintFlags().ToPrinter("") - index := 0 + printFlags := get.NewHumanPrintFlags() for t, ot := range objs { - kindHeader := fmt.Sprintf("==> %s", t) - if index == 0 { - kindHeader = kindHeader + "\n" - } + kindHeader := fmt.Sprintf("==> %s\n", t) if _, err = buf.WriteString(kindHeader); err != nil { return "", err } + typePrinter, _ := printFlags.ToPrinter("") for _, o := range ot { - if err := p.PrintObj(o, buf); err != nil { + if err := typePrinter.PrintObj(o, buf); err != nil { c.Log("failed to print object type %s, object: %q :\n %v", t, o, err) return "", err } @@ -230,7 +227,6 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { if _, err := buf.WriteString("\n"); err != nil { return "", err } - index += 1 } if len(missing) > 0 { buf.WriteString(MissingGetHeader) From e8090bfc0d71049a71cb57aba0cb7420fa33e05d Mon Sep 17 00:00:00 2001 From: Dan Winter Date: Mon, 19 Nov 2018 09:58:25 -0700 Subject: [PATCH 422/449] fix(helm): --set for out of order list values (#4682) When a user specifies value overrides for list values out of order, strvals.listItem panics. Change strvals.listItem to handle this case by re-initializing nil values to a new map. Closes #4503 Co-authored-by: Cameron Childress Co-authored-by: Kevin Collette Co-authored-by: Connor McKelvey Co-authored-by: Dan Winter Signed-off-by: Dan Winter Signed-off-by: Cameron Childress Signed-off-by: Kevin Collette Signed-off-by: Connor McKelvey --- cmd/helm/install_test.go | 8 +++++++- pkg/strvals/parser.go | 8 +++++++- pkg/strvals/parser_test.go | 24 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index 168c53fed..4a2055640 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -61,7 +61,13 @@ func TestInstall(t *testing.T) { resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}), expected: "virgil", }, - // Install, values from yaml + { + name: "install with multiple unordered list values", + args: []string{"testdata/testcharts/alpine"}, + flags: strings.Split("--name virgil --set foo[1].bar=baz,foo[0].baz=bar", " "), + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}), + expected: "virgil", + }, { name: "install with values", args: []string{"testdata/testcharts/alpine"}, diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 532a8c4ac..9d52f34c0 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -288,7 +288,13 @@ func (t *parser) listItem(list []interface{}, i int) ([]interface{}, error) { // We have a nested object. Send to t.key inner := map[string]interface{}{} if len(list) > i { - inner = list[i].(map[string]interface{}) + var ok bool + inner, ok = list[i].(map[string]interface{}) + if !ok { + // We have indices out of order. Initialize empty value. + list[i] = map[string]interface{}{} + inner = list[i].(map[string]interface{}) + } } // Recurse diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index e5d878149..a096f16d2 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -294,6 +294,30 @@ func TestParseSet(t *testing.T) { str: "nested[1][1]=1", expect: map[string]interface{}{"nested": []interface{}{nil, []interface{}{nil, 1}}}, }, + { + str: "name1.name2[0].foo=bar,name1.name2[1].foo=bar", + expect: map[string]interface{}{ + "name1": map[string]interface{}{ + "name2": []map[string]interface{}{{"foo": "bar"}, {"foo": "bar"}}, + }, + }, + }, + { + str: "name1.name2[1].foo=bar,name1.name2[0].foo=bar", + expect: map[string]interface{}{ + "name1": map[string]interface{}{ + "name2": []map[string]interface{}{{"foo": "bar"}, {"foo": "bar"}}, + }, + }, + }, + { + str: "name1.name2[1].foo=bar", + expect: map[string]interface{}{ + "name1": map[string]interface{}{ + "name2": []map[string]interface{}{nil, {"foo": "bar"}}, + }, + }, + }, } for _, tt := range tests { From 25de331da55bf988292e7376c66646557e539782 Mon Sep 17 00:00:00 2001 From: Joshua Olson Date: Mon, 19 Nov 2018 12:01:39 -0600 Subject: [PATCH 423/449] Securing tiller via running it locally. (#4869) * Securing tiller via running it locally. Signed-off-by: Joshua Olson * Clarify that TLS is the recommended way to secure Helm. Signed-off-by: Joshua Olson --- docs/securing_installation.md | 58 +++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index 454e0cc12..d47a98bcc 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -1,6 +1,6 @@ # Securing your Helm Installation -Helm is a powerful and flexible package-management and operations tool for Kubernetes. Installing it using the default installation command -- `helm init` -- quickly and easily installs **Tiller**, the server-side component with which Helm corresponds. +Helm is a powerful and flexible package-management and operations tool for Kubernetes. Installing it using the default installation command -- `helm init` -- quickly and easily installs **Tiller**, the server-side component with which Helm corresponds. This default installation applies **_no security configurations_**, however. It's completely appropriate to use this type of installation when you are working against a cluster with no or very few security concerns, such as local development with Minikube or with a cluster that is well-secured in a private network with no data-sharing or no other users or teams. If this is the case, then the default installation is fine, but remember: With great power comes great responsibility. Always use due diligence when deciding to use the default installation. @@ -12,14 +12,14 @@ For the following types of clusters we strongly recommend that you apply the pro - Clusters that are for many people to use -- _multitenant_ clusters -- as a shared environment - Clusters that have access to or use high-value data or networks of any type -Often, environments like these are referred to as _production grade_ or _production quality_ because the damage done to any company by misuse of the cluster can be profound for either customers, the company itself, or both. Once the risk of damage becomes high enough, you need to ensure the integrity of your cluster no matter what the actual risk. +Often, environments like these are referred to as _production grade_ or _production quality_ because the damage done to any company by misuse of the cluster can be profound for either customers, the company itself, or both. Once the risk of damage becomes high enough, you need to ensure the integrity of your cluster no matter what the actual risk. To configure your installation properly for your environment, you must: - Understand the security context of your cluster - Choose the Best Practices you should apply to your helm installation -The following assumes you have a Kubernetes configuration file (a _kubeconfig_ file) or one was given to you to access a cluster. +The following assumes you have a Kubernetes configuration file (a _kubeconfig_ file) or one was given to you to access a cluster. ## Understanding the Security Context of your Cluster @@ -36,29 +36,43 @@ There are four main areas to consider when securing a tiller installation: Recent versions of Kubernetes employ a [role-based access control (or RBAC)](https://en.wikipedia.org/wiki/Role-based_access_control) system (as do modern operating systems) to help mitigate the damage that can be done if credentials are misused or bugs exist. Even where an identity is hijacked, the identity has only so many permissions to a controlled space. This effectively adds a layer of security to limit the scope of any attack with that identity. -Helm and Tiller are designed to install, remove, and modify logical applications that can contain many services interacting together. As a result, often its usefulness involves cluster-wide operations, which in a multitenant cluster means that great care must be taken with access to a cluster-wide Tiller installation to prevent improper activity. +Helm and Tiller are designed to install, remove, and modify logical applications that can contain many services interacting together. As a result, often its usefulness involves cluster-wide operations, which in a multitenant cluster means that great care must be taken with access to a cluster-wide Tiller installation to prevent improper activity. Specific users and teams -- developers, operators, system and network administrators -- will need their own portion of the cluster in which they can use Helm and Tiller without risking other portions of the cluster. This means using a Kubernetes cluster with RBAC enabled and Tiller configured to enforce them. For more information about using RBAC in Kubernetes, see [Using RBAC Authorization](rbac.md). #### Tiller and User Permissions -Tiller in its current form does not provide a way to map user credentials to specific permissions within Kubernetes. When Tiller is running inside of the cluster, it operates with the permissions of its service account. If no service account name is supplied to Tiller, it runs with the default service account for that namespace. This means that all Tiller operations on that server are executed using the Tiller pod's credentials and permissions. +Tiller in its current form does not provide a way to map user credentials to specific permissions within Kubernetes. When Tiller is running inside of the cluster, it operates with the permissions of its service account. If no service account name is supplied to Tiller, it runs with the default service account for that namespace. This means that all Tiller operations on that server are executed using the Tiller pod's credentials and permissions. -To properly limit what Tiller itself can do, the standard Kubernetes RBAC mechanisms must be attached to Tiller, including Roles and RoleBindings that place explicit limits on what things a Tiller instance can install, and where. +To properly limit what Tiller itself can do, the standard Kubernetes RBAC mechanisms must be attached to Tiller, including Roles and RoleBindings that place explicit limits on what things a Tiller instance can install, and where. -This situation may change in the future. While the community has several methods that might address this, at the moment performing actions using the rights of the client, instead of the rights of Tiller, is contingent upon the outcome of the Pod Identity Working Group, which has taken on the task of solving the problem in a general way. +This situation may change in the future. While the community has several methods that might address this, at the moment performing actions using the rights of the client, instead of the rights of Tiller, is contingent upon the outcome of the Pod Identity Working Group, which has taken on the task of solving the problem in a general way. - -### The Tiller gRPC Endpoint and TLS +### The Tiller gRPC Endpoint In the default installation the gRPC endpoint that Tiller offers is available inside the cluster (not external to the cluster) without authentication configuration applied. Without applying authentication, any process in the cluster can use the gRPC endpoint to perform operations inside the cluster. In a local or secured private cluster, this enables rapid usage and is normal. (When running outside the cluster, Helm authenticates through the Kubernetes API server to reach Tiller, leveraging existing Kubernetes authentication support.) -Shared and production clusters -- for the most part -- should use Helm 2.7.2 at a minimum and configure TLS for each Tiller gRPC endpoint to ensure that within the cluster usage of gRPC endpoints is only for the properly authenticated identity for that endpoint. Doing so enables any number of Tiller instances to be deployed in any number of namespaces and yet no unauthenticated usage of any gRPC endpoint is possible. Finally, use Helm `init` with the `--tiller-tls-verify` option to install Tiller with TLS enabled and to verify remote certificates, and all other Helm commands should use the `--tls` option. +The following two sub-sections describe options of how to setup Tiller so there isn't an unauthenticated endpoint (i.e. gRPC) in your cluster. + +#### Enabling TLS + +(Note that out of the two options, this is the recommended one for Helm 2.) + +Shared and production clusters -- for the most part -- should use Helm 2.7.2 at a minimum and configure TLS for each Tiller gRPC endpoint to ensure that within the cluster usage of gRPC endpoints is only for the properly authenticated identity for that endpoint (i.e. configure each endpoint to use a separate TLS certificate). Doing so enables any number of Tiller instances to be deployed in any number of namespaces and yet no unauthenticated usage of any gRPC endpoint is possible. Finally, use Helm `init` with the `--tiller-tls-verify` option to install Tiller with TLS enabled and to verify remote certificates, and all other Helm commands should use the `--tls` option. -For more information about the proper steps to configure Tiller and use Helm properly with TLS configured, see [Using SSL between Helm and Tiller](tiller_ssl.md). +For more information about the proper steps to configure Tiller and use Helm properly with TLS configured, see the [Best Practices](#best-practices-for-securing-helm-and-tiller) section below, and [Using SSL between Helm and Tiller](tiller_ssl.md). When Helm clients are connecting from outside of the cluster, the security between the Helm client and the API server is managed by Kubernetes itself. You may want to ensure that this link is secure. Note that if you are using the TLS configuration recommended above, not even the Kubernetes API server has access to the encrypted messages between the client and Tiller. +#### Running Tiller Locally + +Contrary to the previous [Enabling TLS](#enabling-tls) section, this section does not involve running a tiller server pod in your cluster (for what it's worth, that lines up with the current [helm v3 proposal](https://github.com/helm/community/blob/master/helm-v3/000-helm-v3.md)), thus there is no gRPC endpoint (and thus there's no need to create & manage TLS certificates to secure each gRPC endpoint). + +Steps: + * Fetch the latest helm release tarball from the [GitHub release page](https://github.com/helm/helm/releases), and extract and move `helm` and `tiller` somewhere on your `$PATH`. + * "Server": Run `tiller --storage=secret`. (Note that `tiller` has a default value of ":44134" for the `--listen` argument.) + * Client: In another terminal (and on the same host that the aforementioned `tiller` command was run for the previous bullet): Run `export HELM_HOST=:44134`, and then run `helm` commands as usual. + ### Tiller's Release Information For historical reasons, Tiller stores its release information in ConfigMaps. We suggest changing the default to Secrets. @@ -69,9 +83,9 @@ Enabling this feature currently requires setting the `--storage=secret` flag in ### Thinking about Charts -Because of the relative longevity of Helm, the Helm chart ecosystem evolved without the immediate concern for cluster-wide control, and especially in the developer space this makes complete sense. However, charts are a kind of package that not only installs containers you may or may not have validated yourself, but it may also install into more than one namespace. +Because of the relative longevity of Helm, the Helm chart ecosystem evolved without the immediate concern for cluster-wide control, and especially in the developer space this makes complete sense. However, charts are a kind of package that not only installs containers you may or may not have validated yourself, but it may also install into more than one namespace. -As with all shared software, in a controlled or shared environment you must validate all software you install yourself _before_ you install it. If you have secured Tiller with TLS and have installed it with permissions to only one or a subset of namespaces, some charts may fail to install -- but in these environments, that is exactly what you want. If you need to use the chart, you may have to work with the creator or modify it yourself in order to use it securely in a multitenant cluster with proper RBAC rules applied. The `helm template` command renders the chart locally and displays the output. +As with all shared software, in a controlled or shared environment you must validate all software you install yourself _before_ you install it. If you have secured Tiller with TLS and have installed it with permissions to only one or a subset of namespaces, some charts may fail to install -- but in these environments, that is exactly what you want. If you need to use the chart, you may have to work with the creator or modify it yourself in order to use it securely in a multitenant cluster with proper RBAC rules applied. The `helm template` command renders the chart locally and displays the output. Once vetted, you can use Helm's provenance tools to [ensure the provenance and integrity of charts](provenance.md) that you use. @@ -81,16 +95,15 @@ Many very useful tools use the gRPC interface directly, and having been built ag ## Best Practices for Securing Helm and Tiller -The following guidelines reiterate the Best Practices for securing Helm and Tiller and using them correctly. +The following guidelines reiterate the Best Practices for securing Helm and Tiller and using them correctly. 1. Create a cluster with RBAC enabled -2. Configure each Tiller gRPC endpoint to use a separate TLS certificate -3. Release information should be a Kubernetes Secret +2. Configure each Tiller gRPC endpoint to use a separate TLS certificate +3. Release information should be a Kubernetes Secret 4. Install one Tiller per user, team, or other organizational entity with the `--service-account` flag, Roles, and RoleBindings 5. Use the `--tiller-tls-verify` option with `helm init` and the `--tls` flag with other Helm commands to enforce verification -If these steps are followed, an example `helm init` command might look something like this: - +If these steps are followed, an example `helm init` command might look something like this: ```bash $ helm init \ --override 'spec.template.spec.containers[0].command'='{/tiller,--storage=secret}' \ @@ -102,11 +115,4 @@ $ helm init \ --service-account=accountname ``` -This command will start Tiller with strong authentication over gRPC, release information stored in a Kubernetes Secret, and a service account to which RBAC policies have been applied. - - - - - - - +This command will start Tiller with strong authentication over gRPC, release information stored in a Kubernetes Secret, and a service account to which RBAC policies have been applied. From b8ac3bfbd748f7c12bd428984e73a6654cc70ad6 Mon Sep 17 00:00:00 2001 From: Geoff Baskwill Date: Mon, 19 Nov 2018 15:24:20 -0500 Subject: [PATCH 424/449] docs: use nindent in documentation examples (#4905) * docs: markdown prettyprinting Signed-off-by: Geoff Baskwill * docs: use nindent in documentation examples Fixes #4890. Signed-off-by: Geoff Baskwill --- docs/chart_template_guide/accessing_files.md | 15 +++---- docs/chart_template_guide/named_templates.md | 14 +++--- docs/charts_tips_and_tricks.md | 45 ++++++++++++-------- 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/docs/chart_template_guide/accessing_files.md b/docs/chart_template_guide/accessing_files.md index c959002b7..206ad0cec 100644 --- a/docs/chart_template_guide/accessing_files.md +++ b/docs/chart_template_guide/accessing_files.md @@ -6,8 +6,8 @@ Helm provides access to files through the `.Files` object. Before we get going w - It is okay to add extra files to your Helm chart. These files will be bundled and sent to Tiller. Be careful, though. Charts must be smaller than 1M because of the storage limitations of Kubernetes objects. - Some files cannot be accessed through the `.Files` object, usually for security reasons. - - Files in `templates/` cannot be accessed. - - Files excluded using `.helmignore` cannot be accessed. + - Files in `templates/` cannot be accessed. + - Files excluded using `.helmignore` cannot be accessed. - Charts do not preserve UNIX mode information, so file-level permissions will have no impact on the availability of a file when it comes to the `.Files` object. @@ -90,6 +90,7 @@ use. They are all accessible with the same names as in the Go package, but with a lowercase first letter. For example, `Base` becomes `base`, etc. The imported functions are: + - Base - Dir - Ext @@ -107,8 +108,8 @@ the returned object. For example, imagine the directory structure: -``` -foo/: +```txt +foo/: foo.txt foo.yaml bar/: @@ -117,7 +118,6 @@ bar/: You have multiple options with Globs: - ```yaml {{ $root := . }} {{ range $path, $bytes := .Files.Glob "**.yaml" }} @@ -153,7 +153,7 @@ kind: ConfigMap metadata: name: conf data: -{{ (.Files.Glob "foo/*").AsConfig | indent 2 }} + {{- (.Files.Glob "foo/*").AsConfig | nindent 2 }} --- apiVersion: v1 kind: Secret @@ -161,7 +161,7 @@ metadata: name: very-secret type: Opaque data: -{{ (.Files.Glob "bar/*").AsSecrets | indent 2 }} + {{- (.Files.Glob "bar/*").AsSecrets | nindent 2 }} ``` ## Encoding @@ -207,4 +207,3 @@ data: Currently, there is no way to pass files external to the chart during `helm install`. So if you are asking users to supply data, it must be loaded using `helm install -f` or `helm install --set`. This discussion wraps up our dive into the tools and techniques for writing Helm templates. In the next section we will see how you can use one special file, `templates/NOTES.txt`, to send post-installation instructions to the users of your chart. - diff --git a/docs/chart_template_guide/named_templates.md b/docs/chart_template_guide/named_templates.md index 33425d102..08e41d58d 100644 --- a/docs/chart_template_guide/named_templates.md +++ b/docs/chart_template_guide/named_templates.md @@ -14,9 +14,9 @@ So far, we've used one file, and that one file has contained a single template. Before we get to the nuts-and-bolts of writing those templates, there is file naming convention that deserves mention: -* Most files in `templates/` are treated as if they contain Kubernetes manifests -* The `NOTES.txt` is one exception -* But files whose name begins with an underscore (`_`) are assumed to _not_ have a manifest inside. These files are not rendered to Kubernetes object definitions, but are available everywhere within other chart templates for use. +- Most files in `templates/` are treated as if they contain Kubernetes manifests +- The `NOTES.txt` is one exception +- But files whose name begins with an underscore (`_`) are assumed to _not_ have a manifest inside. These files are not rendered to Kubernetes object definitions, but are available everywhere within other chart templates for use. These files are used to store partials and helpers. In fact, when we first created `mychart`, we saw a file called `_helpers.tpl`. That file is the default location for template partials. @@ -139,7 +139,7 @@ metadata: What happened to the name and version? They weren't in the scope for our defined template. When a named template (created with `define`) is rendered, it will receive the scope passed in by the `template` call. In our example, we included the template like this: -```yaml +```gotpl {{- template "mychart.labels" }} ``` @@ -223,7 +223,7 @@ Note that the indentation on `app_version` is wrong in both places. Why? Because To work around this case, Helm provides an alternative to `template` that will import the contents of a template into the present pipeline where it can be passed along to other functions in the pipeline. -Here's the example above, corrected to use `indent` to indent the `mychart_app` template correctly: +Here's the example above, corrected to use `nindent` to indent the `mychart_app` template correctly: ```yaml apiVersion: v1 @@ -231,13 +231,13 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap labels: -{{ include "mychart.app" . | indent 4 }} + {{- include "mychart.app" . | nindent 4 }} data: myvalue: "Hello World" {{- range $key, $val := .Values.favorite }} {{ $key }}: {{ $val | quote }} {{- end }} -{{ include "mychart.app" . | indent 2 }} + {{- include "mychart.app" . | nindent 2 }} ``` Now the produced YAML is correctly indented for each section: diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index f1751b1b5..e948d3bcf 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -22,18 +22,18 @@ For example, this template snippet includes a template called `mytpl`, then lowercases the result, then wraps that in double quotes. ```yaml -value: {{include "mytpl" . | lower | quote}} +value: {{ include "mytpl" . | lower | quote }} ``` The `required` function allows you to declare a particular -values entry as required for template rendering. If the value is empty, the template +values entry as required for template rendering. If the value is empty, the template rendering will fail with a user submitted error message. The following example of the `required` function declares an entry for .Values.who is required, and will print an error message when that entry is missing: ```yaml -value: {{required "A valid .Values.who entry required!" .Values.who }} +value: {{ required "A valid .Values.who entry required!" .Values.who }} ``` ## Quote Strings, Don't Quote Integers @@ -41,20 +41,20 @@ value: {{required "A valid .Values.who entry required!" .Values.who }} When you are working with string data, you are always safer quoting the strings than leaving them as bare words: -``` -name: {{.Values.MyName | quote }} +```yaml +name: {{ .Values.MyName | quote }} ``` But when working with integers _do not quote the values._ That can, in many cases, cause parsing errors inside of Kubernetes. -``` +```yaml port: {{ .Values.Port }} ``` This remark does not apply to env variables values which are expected to be string, even if they represent integers: -``` +```yaml env: -name: HOST value: "http://host" @@ -71,12 +71,16 @@ Go template pipelines. To make it possible to include a template, and then perform an operation on that template's output, Helm has a special `include` function: -``` -{{ include "toYaml" $value | indent 2 }} +```gotpl +{{- include "toYaml" $value | nindent 2 }} ``` The above includes a template called `toYaml`, passes it `$value`, and -then passes the output of that template to the `indent` function. +then passes the output of that template to the `nindent` function. Using +the `{{- ... | nindent _n_ }}` pattern makes it easier to read the `include` +in context, because it chomps the whitespace to the left (including the +previous newline), then the `nindent` re-adds the newline and indents +the included content by the requested amount. Because YAML ascribes significance to indentation levels and whitespace, this is one great way to include snippets of code, but handle @@ -99,7 +103,7 @@ developer. For example: -``` +```gotpl {{ required "A valid foo is required!" .Values.foo }} ``` @@ -113,7 +117,8 @@ This is useful to pass a template string as a value to a chart or render externa Syntax: `{{ tpl TEMPLATE_STRING VALUES }}` Examples: -``` + +```yaml # values template: "{{ .Values.name }}" name: "Tom" @@ -126,7 +131,8 @@ Tom ``` Rendering a external configuration file: -``` + +```yaml # external configuration file conf/app.conf firstName={{ .Values.firstName }} lastName={{ .Values.lastName }} @@ -144,10 +150,12 @@ lastName=Parker ``` ## Creating Image Pull Secrets -Image pull secrets are essentially a combination of _registry_, _username_, and _password_. You may need them in an application you are deploying, but to create them requires running _base64_ a couple of times. We can write a helper template to compose the Docker configuration file for use as the Secret's payload. Here is an example: + +Image pull secrets are essentially a combination of _registry_, _username_, and _password_. You may need them in an application you are deploying, but to create them requires running _base64_ a couple of times. We can write a helper template to compose the Docker configuration file for use as the Secret's payload. Here is an example: First, assume that the credentials are defined in the `values.yaml` file like so: -``` + +```yaml imageCredentials: registry: quay.io username: someone @@ -155,14 +163,16 @@ imageCredentials: ``` We then define our helper template as follows: -``` + +```gotpl {{- define "imagePullSecret" }} {{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.imageCredentials.registry (printf "%s:%s" .Values.imageCredentials.username .Values.imageCredentials.password | b64enc) | b64enc }} {{- end }} ``` Finally, we use the helper template in a larger template to create the Secret manifest: -``` + +```yaml apiVersion: v1 kind: Secret metadata: @@ -282,6 +292,7 @@ update of that resource. ## Upgrade a release idempotently In order to use the same command when installing and upgrading a release, use the following command: + ```shell helm upgrade --install --values ``` From e9a86238e2d667f3b270c1c21b98ab8695004095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Filip?= Date: Tue, 20 Nov 2018 13:55:48 +0100 Subject: [PATCH 425/449] Update control_structures.md (#4948) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update position of `and` operator Signed-off-by: René Filip --- docs/chart_template_guide/control_structures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/control_structures.md b/docs/chart_template_guide/control_structures.md index 511318731..61d9ef9e2 100644 --- a/docs/chart_template_guide/control_structures.md +++ b/docs/chart_template_guide/control_structures.md @@ -53,7 +53,7 @@ data: myvalue: "Hello World" drink: {{ .Values.favorite.drink | default "tea" | quote }} food: {{ .Values.favorite.food | upper | quote }} - {{ if (.Values.favorite.drink) and eq .Values.favorite.drink "coffee" }}mug: true{{ end }} + {{ if and (.Values.favorite.drink) (eq .Values.favorite.drink "coffee") }}mug: true{{ end }} ``` Note that `.Values.favorite.drink` must be defined or else it will throw an error when comparing it to "coffee". Since we commented out `drink: coffee` in our last example, the output should not include a `mug: true` flag. But if we add that line back into our `values.yaml` file, the output should look like this: From 38b6c9b4b1dd9ce7e5a56b6a98879d2f030f997c Mon Sep 17 00:00:00 2001 From: Geoff Baskwill Date: Tue, 20 Nov 2018 11:54:32 -0500 Subject: [PATCH 426/449] chore(deps): update cobra to latest (#4913) Signed-off-by: Geoff Baskwill --- glide.lock | 6 +++--- glide.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glide.lock b/glide.lock index c25f439bd..16ea64ff5 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 30b1d3f31b7bd310a9434e081bae3d5dc18c0a79b3674c0adffccc8d602e9227 -updated: 2018-10-04T17:11:58.043264Z +hash: fcbba2207c6511df365dfe355dfe601a862d340bbf15db47938a404fd0ec58d0 +updated: 2018-11-11T19:26:29.631232-05:00 imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -249,7 +249,7 @@ imports: - name: github.com/sirupsen/logrus version: 89742aefa4b206dcf400792f3bd35b542998eb3b - name: github.com/spf13/cobra - version: c439c4fa093711d42e1b01acb1235b52004753c1 + version: fe5e611709b0c57fa4a89136deaa8e1d4004d053 subpackages: - doc - name: github.com/spf13/pflag diff --git a/glide.yaml b/glide.yaml index 37c3f857e..f0028b579 100644 --- a/glide.yaml +++ b/glide.yaml @@ -4,7 +4,7 @@ import: subpackages: - context - package: github.com/spf13/cobra - version: c439c4fa093711d42e1b01acb1235b52004753c1 + version: fe5e611709b0c57fa4a89136deaa8e1d4004d053 - package: github.com/spf13/pflag version: ~1.0.1 - package: github.com/Masterminds/vcs From ac1820d00493caa0baa89a2ce67a0d14f03d22ad Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 28 Nov 2018 09:59:32 -0800 Subject: [PATCH 427/449] fix(windows): fix unit tests on Windows (#4897) Signed-off-by: Matthew Fisher --- .appveyor.yml | 6 +++--- cmd/helm/helm_test.go | 5 +++-- cmd/helm/package_test.go | 11 ++++++++++- cmd/helm/template_test.go | 2 +- cmd/helm/verify_test.go | 2 +- pkg/chartutil/load.go | 1 + pkg/chartutil/requirements_test.go | 9 ++++++++- pkg/chartutil/testdata/joonix/charts/.gitkeep | 0 pkg/chartutil/testdata/joonix/charts/frobnitz | 1 - pkg/getter/plugingetter_test.go | 5 +++++ pkg/repo/index.go | 7 +++++-- pkg/repo/index_test.go | 2 +- 12 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 pkg/chartutil/testdata/joonix/charts/.gitkeep delete mode 120000 pkg/chartutil/testdata/joonix/charts/frobnitz diff --git a/.appveyor.yml b/.appveyor.yml index d7ba1d9fd..40d02927d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,10 +6,10 @@ environment: install: - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/fishworks/gofish/master/scripts/install.ps1')) - gofish init - - gofish install dep - - dep ensure -v + - gofish install glide + - glide install --strip-vendor cache: - - vendor -> Gopkg.lock + - vendor -> glide.lock build: "off" deploy: "off" test_script: diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index 24d1ab347..eb0c7dff2 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -29,6 +29,7 @@ import ( "github.com/spf13/cobra" + "k8s.io/client-go/util/homedir" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/helmpath" @@ -167,7 +168,7 @@ func TestRootCmd(t *testing.T) { { name: "defaults", args: []string{"home"}, - home: filepath.Join(os.Getenv("HOME"), "/.helm"), + home: filepath.Join(homedir.HomeDir(), ".helm"), }, { name: "with --home set", @@ -236,7 +237,7 @@ func TestTLSFlags(t *testing.T) { homePath := os.Getenv("HELM_HOME") if homePath == "" { - homePath = filepath.Join(os.Getenv("HOME"), ".helm") + homePath = filepath.Join(homedir.HomeDir(), ".helm") } home := helmpath.Home(homePath) diff --git a/cmd/helm/package_test.go b/cmd/helm/package_test.go index 7ed9829a5..d3bd25af7 100644 --- a/cmd/helm/package_test.go +++ b/cmd/helm/package_test.go @@ -17,10 +17,12 @@ package main import ( "bytes" + "fmt" "io/ioutil" "os" "path/filepath" "regexp" + "runtime" "testing" "github.com/spf13/cobra" @@ -53,6 +55,13 @@ func TestSetVersion(t *testing.T) { func TestPackage(t *testing.T) { + statExe := "stat" + statFileMsg := "no such file or directory" + if runtime.GOOS == "windows" { + statExe = "FindFirstFile" + statFileMsg = "The system cannot find the file specified." + } + tests := []struct { name string flags map[string]string @@ -106,7 +115,7 @@ func TestPackage(t *testing.T) { name: "package --destination does-not-exist", args: []string{"testdata/testcharts/alpine"}, flags: map[string]string{"destination": "does-not-exist"}, - expect: "stat does-not-exist: no such file or directory", + expect: fmt.Sprintf("Failed to save: %s does-not-exist: %s", statExe, statFileMsg), err: true, }, { diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index ec989ea67..98044eff0 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -75,7 +75,7 @@ func TestTemplateCmd(t *testing.T) { { name: "check_execute_absolute", desc: "verify --execute single template", - args: []string{subchart1ChartPath, "-x", subchart1AbsChartPath + "/" + "templates/service.yaml", "--set", "service.name=apache"}, + args: []string{subchart1ChartPath, "-x", filepath.Join(subchart1AbsChartPath, "templates", "service.yaml"), "--set", "service.name=apache"}, expectKey: "subchart1/templates/service.yaml", expectValue: "protocol: TCP\n name: apache", }, diff --git a/cmd/helm/verify_test.go b/cmd/helm/verify_test.go index 4d683df75..d4a580c23 100644 --- a/cmd/helm/verify_test.go +++ b/cmd/helm/verify_test.go @@ -28,7 +28,7 @@ func TestVerifyCmd(t *testing.T) { statPathMsg := "no such file or directory" statFileMsg := statPathMsg if runtime.GOOS == "windows" { - statExe = "GetFileAttributesEx" + statExe = "FindFirstFile" statPathMsg = "The system cannot find the path specified." statFileMsg = "The system cannot find the file specified." } diff --git a/pkg/chartutil/load.go b/pkg/chartutil/load.go index b3daefac7..9f1c80c85 100644 --- a/pkg/chartutil/load.go +++ b/pkg/chartutil/load.go @@ -43,6 +43,7 @@ import ( // If a .helmignore file is present, the directory loader will skip loading any files // matching it. But .helmignore is not evaluated when reading out of an archive. func Load(name string) (*chart.Chart, error) { + name = filepath.FromSlash(name) fi, err := os.Stat(name) if err != nil { return nil, err diff --git a/pkg/chartutil/requirements_test.go b/pkg/chartutil/requirements_test.go index 0afde17e1..e433f92ea 100644 --- a/pkg/chartutil/requirements_test.go +++ b/pkg/chartutil/requirements_test.go @@ -15,6 +15,8 @@ limitations under the License. package chartutil import ( + "os" + "path/filepath" "sort" "testing" @@ -426,7 +428,12 @@ func TestDependentChartWithSubChartsHelmignore(t *testing.T) { } func TestDependentChartsWithSubChartsSymlink(t *testing.T) { - c, err := Load("testdata/joonix") + joonix := "testdata/joonix" + if err := os.Symlink(filepath.Join("..", "..", "frobnitz"), filepath.Join(joonix, "charts", "frobnitz")); err != nil { + t.Fatal(err) + } + defer os.RemoveAll(filepath.Join(joonix, "charts", "frobnitz")) + c, err := Load(joonix) if err != nil { t.Fatalf("Failed to load testdata: %s", err) } diff --git a/pkg/chartutil/testdata/joonix/charts/.gitkeep b/pkg/chartutil/testdata/joonix/charts/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/chartutil/testdata/joonix/charts/frobnitz b/pkg/chartutil/testdata/joonix/charts/frobnitz deleted file mode 120000 index fde1b78ac..000000000 --- a/pkg/chartutil/testdata/joonix/charts/frobnitz +++ /dev/null @@ -1 +0,0 @@ -../../frobnitz \ No newline at end of file diff --git a/pkg/getter/plugingetter_test.go b/pkg/getter/plugingetter_test.go index 9bfe6144d..7c0bd6c1e 100644 --- a/pkg/getter/plugingetter_test.go +++ b/pkg/getter/plugingetter_test.go @@ -18,6 +18,7 @@ package getter import ( "os" "path/filepath" + "runtime" "strings" "testing" @@ -67,6 +68,10 @@ func TestCollectPlugins(t *testing.T) { } func TestPluginGetter(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("TODO: refactor this test to work on windows") + } + oldhh := os.Getenv("HELM_HOME") defer os.Setenv("HELM_HOME", oldhh) os.Setenv("HELM_HOME", "") diff --git a/pkg/repo/index.go b/pkg/repo/index.go index 01bf4a8ca..9031463f3 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -22,6 +22,7 @@ import ( "fmt" "io/ioutil" "os" + "path" "path/filepath" "sort" "strings" @@ -110,7 +111,7 @@ func (i IndexFile) Add(md *chart.Metadata, filename, baseURL, digest string) { _, file := filepath.Split(filename) u, err = urlutil.URLJoin(baseURL, file) if err != nil { - u = filepath.Join(baseURL, file) + u = path.Join(baseURL, file) } } cr := &ChartVersion{ @@ -246,9 +247,11 @@ func IndexDirectory(dir, baseURL string) (*IndexFile, error) { var parentDir string parentDir, fname = filepath.Split(fname) + // filepath.Split appends an extra slash to the end of parentDir. We want to strip that out. + parentDir = strings.TrimSuffix(parentDir, string(os.PathSeparator)) parentURL, err := urlutil.URLJoin(baseURL, parentDir) if err != nil { - parentURL = filepath.Join(baseURL, parentDir) + parentURL = path.Join(baseURL, parentDir) } c, err := chartutil.Load(arch) diff --git a/pkg/repo/index_test.go b/pkg/repo/index_test.go index 2ce817ce3..7c9239b7a 100644 --- a/pkg/repo/index_test.go +++ b/pkg/repo/index_test.go @@ -272,7 +272,7 @@ func verifyLocalIndex(t *testing.T, i *IndexFile) { } func TestIndexDirectory(t *testing.T) { - dir := "testdata/repository" + dir := filepath.Join("testdata", "repository") index, err := IndexDirectory(dir, "http://localhost:8080") if err != nil { t.Fatal(err) From 7afc59d9a0d7cfa4382d8ebb5a648e332be21020 Mon Sep 17 00:00:00 2001 From: Tariq Ibrahim Date: Wed, 28 Nov 2018 10:01:22 -0800 Subject: [PATCH 428/449] Adding link labels to doc links for more conspicuity (#4904) Signed-off-by: tariqibrahim --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7958a9adb..aba3388a6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -178,7 +178,7 @@ contributing to Helm. All issue types follow the same general lifecycle. Differe 1. Submit a pull request. Coding conventions and standards are explained in the official developer docs: -https://github.com/helm/helm/blob/master/docs/developers.md +[Developers Guide](docs/developers.md) The next section contains more information on the workflow followed for PRs From bab227e07a6e78dfb73ed0e066095657f8ad79fa Mon Sep 17 00:00:00 2001 From: Jintao Zhang Date: Thu, 29 Nov 2018 02:05:33 +0800 Subject: [PATCH 429/449] Fix doc charts indent (#4940) Signed-off-by: Jintao Zhang --- docs/charts.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/charts.md b/docs/charts.md index 2f7605350..64fc68934 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -259,27 +259,27 @@ Tags - The tags field is a YAML list of labels to associate with this chart. In the top parent's values, all charts with tags can be enabled or disabled by specifying the tag and a boolean value. -```` +```yaml # parentchart/requirements.yaml dependencies: - - name: subchart1 - repository: http://localhost:10191 - version: 0.1.0 - condition: subchart1.enabled,global.subchart1.enabled - tags: - - front-end - - subchart1 - - - name: subchart2 - repository: http://localhost:10191 - version: 0.1.0 - condition: subchart2.enabled,global.subchart2.enabled - tags: - - back-end + - name: subchart1 + repository: http://localhost:10191 + version: 0.1.0 + condition: subchart1.enabled,global.subchart1.enabled + tags: + - front-end + - subchart1 + + - name: subchart2 + repository: http://localhost:10191 + version: 0.1.0 + condition: subchart2.enabled,global.subchart2.enabled + tags: + - back-end - subchart2 -```` -```` +``` +```yaml # parentchart/values.yaml subchart1: From 0c0c3ac8a5121e363511ce33f70e7bdf358528c8 Mon Sep 17 00:00:00 2001 From: Abu Hanifa Date: Thu, 29 Nov 2018 00:06:04 +0600 Subject: [PATCH 430/449] Error message if anyone try to create multiple helm chart at a time (#4952) * error message for creating multiple helm chart at a time Signed-off-by: hanif * Update cmd/helm/create.go Co-Authored-By: a8uhnf Signed-off-by: hanif --- cmd/helm/create.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/helm/create.go b/cmd/helm/create.go index 7f0f99af8..0d278c8b5 100644 --- a/cmd/helm/create.go +++ b/cmd/helm/create.go @@ -75,6 +75,9 @@ func newCreateCmd(out io.Writer) *cobra.Command { if len(args) == 0 { return errors.New("the name of the new chart is required") } + if len(args) > 1 { + return errors.New("command 'create' doesn't support multiple arguments") + } cc.name = args[0] return cc.run() }, From 8a28d853e615ddedbcce71756e995649ec682bc1 Mon Sep 17 00:00:00 2001 From: Ishaan Malhi <12560808+OrthoDex@users.noreply.github.com> Date: Wed, 28 Nov 2018 23:42:41 +0530 Subject: [PATCH 431/449] docs: add documentation for the helmignore file (#4966) * docs: add documentation for the helmignore file Signed-off-by: Ishaan Malhi * docs: rearrange helmignore docs under chart template developer's guide Signed-off-by: Ishaan Malhi --- docs/README.md | 1 + docs/chart_template_guide/helm_ignore_file.md | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 docs/chart_template_guide/helm_ignore_file.md diff --git a/docs/README.md b/docs/README.md index 4ca93bd1f..ed13cc22a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -24,6 +24,7 @@ - [Variables](chart_template_guide/variables.md) - [Named Templates (Partials)](chart_template_guide/named_templates.md) - [Accessing Files Inside Templates](chart_template_guide/accessing_files.md) + - [Ignoring unwanted files and folders](chart_template_guide/helm_ignore_file.md) - [Creating a NOTES.txt File](chart_template_guide/notes_files.md) - [Subcharts and Global Values](chart_template_guide/subcharts_and_globals.md) - [Debugging Templates](chart_template_guide/debugging.md) diff --git a/docs/chart_template_guide/helm_ignore_file.md b/docs/chart_template_guide/helm_ignore_file.md new file mode 100644 index 000000000..6793bdfec --- /dev/null +++ b/docs/chart_template_guide/helm_ignore_file.md @@ -0,0 +1,23 @@ +# The .helmignore file + +The `.helmignore` file is used to specify files you don't want to include in your helm chart. + +If this file exists, the `helm package` command will ignore all the files that match the pattern specified in the `.helmignore` file while packaging your application. + +This can help in avoiding unncessary or sensitive files or directories from being added in your helm chart. + +The `.helmignore` file supports Unix shell glob matching, relative path matching, and negation (prefixed with !). Only one pattern per line is considered. + +Here is an example `.helmignore` file: + +``` +# comment +.git +*/temp* +*/*/temp* +temp? +``` + +**We'd love your help** making this document better. To add, correct, or remove +information, [file an issue](https://github.com/helm/helm/issues) or +send us a pull request. From 5a5a7485a71071e4ef90bb59beb4b2265cddf2f9 Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Wed, 28 Nov 2018 18:22:39 +0000 Subject: [PATCH 432/449] Update chart doc with details about the license file (#4977) Signed-off-by: Martin Hickey --- docs/charts.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/charts.md b/docs/charts.md index 64fc68934..5a895fd49 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -124,7 +124,14 @@ project is: ## Chart LICENSE, README and NOTES Charts can also contain files that describe the installation, configuration, usage and license of a -chart. A README for a chart should be formatted in Markdown (README.md), and should generally +chart. + +A LICENSE is a plain text file containing the [license](https://en.wikipedia.org/wiki/Software_license) +for the chart. The chart can contain a license as it may have programming logic in the templates and +would therefore not be configuration only. There can also be separate license(s) for the application +installed by the chart, if required. + +A README for a chart should be formatted in Markdown (README.md), and should generally contain: - A description of the application or service the chart provides From 79f092aae56bb645c3fcbc2cf86c1f9f0559061a Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Thu, 15 Nov 2018 13:41:25 -0800 Subject: [PATCH 433/449] fix(helm): Print details for pod resource Due to a regression from a previous change, details about pod resources does not show up in the status output. This makes sure that the pod type from core are passed in to the printer so the details are shown in the output. Signed-off-by: Morten Torkildsen --- pkg/kube/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index f86621b3f..3303f4bc2 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -48,6 +48,7 @@ import ( "k8s.io/client-go/kubernetes/scheme" watchtools "k8s.io/client-go/tools/watch" "k8s.io/kubernetes/pkg/api/legacyscheme" + "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/kubectl/cmd/get" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/validation" @@ -202,7 +203,9 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { //here, we will add the objPods to the objs for key, podItems := range objPods { for i := range podItems { - objs[key+"(related)"] = append(objs[key+"(related)"], &podItems[i]) + pod := &core.Pod{} + legacyscheme.Scheme.Convert(&podItems[i], pod, nil) + objs[key+"(related)"] = append(objs[key+"(related)"], pod) } } From ca371c3dff470af37cd9c24619ac8c5aa1082129 Mon Sep 17 00:00:00 2001 From: Luke Hoban Date: Wed, 28 Nov 2018 11:15:49 -0800 Subject: [PATCH 434/449] Allow missing trailing '/' in --repo url (#4956) Apply the same procedure to allow missing trailing slash in repo base URLs used in `repo/chart` inputs to `--repo` inputs. Fixes #4954. Signed-off-by: Luke Hoban --- pkg/repo/chartrepo.go | 4 +++- pkg/repo/chartrepo_test.go | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index cd9d6c547..c512c5b7e 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -270,10 +270,12 @@ func ResolveReferenceURL(baseURL, refURL string) (string, error) { return "", fmt.Errorf("failed to parse %s as URL: %v", refURL, err) } + // We need a trailing slash for ResolveReference to work, but make sure there isn't already one + parsedBaseURL.Path = strings.TrimSuffix(parsedBaseURL.Path, "/") + "/" + resolvedURL := parsedBaseURL.ResolveReference(parsedRefURL) // if the base URL contains query string parameters, // propagate them to the child URL but only if the // refURL is relative to baseURL - resolvedURL := parsedBaseURL.ResolveReference(parsedRefURL) if (resolvedURL.Hostname() == parsedBaseURL.Hostname()) && (resolvedURL.Port() == parsedBaseURL.Port()) { resolvedURL.RawQuery = parsedBaseURL.RawQuery } diff --git a/pkg/repo/chartrepo_test.go b/pkg/repo/chartrepo_test.go index 19071872d..a2f1daeb8 100644 --- a/pkg/repo/chartrepo_test.go +++ b/pkg/repo/chartrepo_test.go @@ -287,6 +287,14 @@ func TestResolveReferenceURL(t *testing.T) { t.Errorf("%s", chartURL) } + chartURL, err = ResolveReferenceURL("http://localhost:8123/charts", "nginx-0.2.0.tgz") + if err != nil { + t.Errorf("%s", err) + } + if chartURL != "http://localhost:8123/charts/nginx-0.2.0.tgz" { + t.Errorf("%s", chartURL) + } + chartURL, err = ResolveReferenceURL("http://localhost:8123/charts/?st=2018-08-06T22%3A59%3A04Z&se=2018-08-07T22%3A59%3A04Z&sp=rl&sv=2018-03-28&sr=c&sig=cyqM4%2F5G7HNk%2F3faaHSDMaWxFxefCglvZlYSnmQBwiY%3D", "nginx-0.2.0.tgz") if err != nil { t.Errorf("%s", err) From 3031641a52c9937873eed545cabd6f9ae8860204 Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Wed, 28 Nov 2018 11:30:35 -0700 Subject: [PATCH 435/449] fix(storage): when pruning release versions, never delete the last deployed revision Signed-off-by: Matt Tucker --- pkg/storage/storage.go | 40 ++++++++++++++++++++++++----- pkg/storage/storage_test.go | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 7 deletions(-) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 6d5f589b9..e0e39ac0c 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -181,21 +181,37 @@ func (s *Storage) removeLeastRecent(name string, max int) error { if len(h) <= max { return nil } - overage := len(h) - max // We want oldest to newest relutil.SortByRevision(h) + lastDeployed, err := s.Deployed(name) + if err != nil { + return err + } + + var toDelete []*rspb.Release + for _, rel := range h { + // once we have enough releases to delete to reach the max, stop + if len(h)-len(toDelete) == max { + break + } + if lastDeployed != nil { + if rel.GetVersion() != lastDeployed.GetVersion() { + toDelete = append(toDelete, rel) + } + } else { + toDelete = append(toDelete, rel) + } + } + // Delete as many as possible. In the case of API throughput limitations, // multiple invocations of this function will eventually delete them all. - toDelete := h[0:overage] errors := []error{} for _, rel := range toDelete { - key := makeKey(name, rel.Version) - _, innerErr := s.Delete(name, rel.Version) - if innerErr != nil { - s.Log("error pruning %s from release history: %s", key, innerErr) - errors = append(errors, innerErr) + err = s.deleteReleaseVersion(name, rel.GetVersion()) + if err != nil { + errors = append(errors, err) } } @@ -210,6 +226,16 @@ func (s *Storage) removeLeastRecent(name string, max int) error { } } +func (s *Storage) deleteReleaseVersion(name string, version int32) error { + key := makeKey(name, version) + _, err := s.Delete(name, version) + if err != nil { + s.Log("error pruning %s from release history: %s", key, err) + return err + } + return nil +} + // Last fetches the last revision of the named release. func (s *Storage) Last(name string) (*rspb.Release, error) { s.Log("getting last revision of %q", name) diff --git a/pkg/storage/storage_test.go b/pkg/storage/storage_test.go index 19d786ad9..f7f3a86c7 100644 --- a/pkg/storage/storage_test.go +++ b/pkg/storage/storage_test.go @@ -293,6 +293,57 @@ func TestStorageRemoveLeastRecent(t *testing.T) { } } +func TestStorageDontDeleteDeployed(t *testing.T) { + storage := Init(driver.NewMemory()) + storage.Log = t.Logf + storage.MaxHistory = 3 + + const name = "angry-bird" + + // setup storage with test releases + setup := func() { + // release records + rls0 := ReleaseTestData{Name: name, Version: 1, Status: rspb.Status_SUPERSEDED}.ToRelease() + rls1 := ReleaseTestData{Name: name, Version: 2, Status: rspb.Status_DEPLOYED}.ToRelease() + rls2 := ReleaseTestData{Name: name, Version: 3, Status: rspb.Status_FAILED}.ToRelease() + rls3 := ReleaseTestData{Name: name, Version: 4, Status: rspb.Status_FAILED}.ToRelease() + + // create the release records in the storage + assertErrNil(t.Fatal, storage.Create(rls0), "Storing release 'angry-bird' (v1)") + assertErrNil(t.Fatal, storage.Create(rls1), "Storing release 'angry-bird' (v2)") + assertErrNil(t.Fatal, storage.Create(rls2), "Storing release 'angry-bird' (v3)") + assertErrNil(t.Fatal, storage.Create(rls3), "Storing release 'angry-bird' (v4)") + } + setup() + + rls5 := ReleaseTestData{Name: name, Version: 5, Status: rspb.Status_FAILED}.ToRelease() + assertErrNil(t.Fatal, storage.Create(rls5), "Storing release 'angry-bird' (v5)") + + // On inserting the 5th record, we expect a total of 3 releases, but we expect version 2 + // (the only deployed release), to still exist + hist, err := storage.History(name) + if err != nil { + t.Fatal(err) + } else if len(hist) != storage.MaxHistory { + for _, item := range hist { + t.Logf("%s %v", item.Name, item.Version) + } + t.Fatalf("expected %d items in history, got %d", storage.MaxHistory, len(hist)) + } + + expectedVersions := map[int32]bool{ + 2: true, + 4: true, + 5: true, + } + + for _, item := range hist { + if !expectedVersions[item.GetVersion()] { + t.Errorf("Release version %d, found when not expected", item.GetVersion()) + } + } +} + func TestStorageLast(t *testing.T) { storage := Init(driver.NewMemory()) From 73bd4b6c9bca47072f0c929b37fd549cfe8af222 Mon Sep 17 00:00:00 2001 From: Tariq Ibrahim Date: Wed, 28 Nov 2018 15:19:26 -0800 Subject: [PATCH 436/449] avoid kubernetes import for slice contains logic (#4963) * avoid kubernetes import for slice contains logic Signed-off-by: tariqibrahim * fix review comments Signed-off-by: tariqibrahim --- cmd/helm/inspect.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/cmd/helm/inspect.go b/cmd/helm/inspect.go index c1861f7c5..844116bc5 100644 --- a/cmd/helm/inspect.go +++ b/cmd/helm/inspect.go @@ -18,15 +18,13 @@ package main import ( "fmt" - "io" - "strings" - "github.com/ghodss/yaml" "github.com/golang/protobuf/ptypes/any" "github.com/spf13/cobra" + "io" + "strings" "k8s.io/helm/pkg/chartutil" - "k8s.io/kubernetes/pkg/util/slice" ) const inspectDesc = ` @@ -256,9 +254,23 @@ func (i *inspectCmd) run() error { func findReadme(files []*any.Any) (file *any.Any) { for _, file := range files { - if slice.ContainsString(readmeFileNames, strings.ToLower(file.TypeUrl), nil) { + if containsString(readmeFileNames, strings.ToLower(file.TypeUrl), nil) { return file } } return nil } + +// containsString checks if a given slice of strings contains the provided string. +// If a modifier func is provided, it is called with the slice item before the comparison. +func containsString(slice []string, s string, modifier func(s string) string) bool { + for _, item := range slice { + if item == s { + return true + } + if modifier != nil && modifier(item) == s { + return true + } + } + return false +} From 5fec12a77ada96851b7594855f8bf89c58631055 Mon Sep 17 00:00:00 2001 From: Michael Merrill Date: Thu, 29 Nov 2018 13:09:10 -0500 Subject: [PATCH 437/449] Fix for existing CRDs are deleted when crd-install hook is introduced (#4709) Signed-off-by: mmerrill3 --- pkg/tiller/hooks.go | 7 +++++++ pkg/tiller/hooks_test.go | 33 ++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/pkg/tiller/hooks.go b/pkg/tiller/hooks.go index 0fb7c92f8..472301022 100644 --- a/pkg/tiller/hooks.go +++ b/pkg/tiller/hooks.go @@ -174,6 +174,13 @@ func (file *manifestFile) sort(result *result) error { isUnknownHook = true break } + if e == release.Hook_CRD_INSTALL { + result.generic = append(result.generic, Manifest{ + Name: file.path, + Content: m, + Head: &entry, + }) + } h.Events = append(h.Events, e) } diff --git a/pkg/tiller/hooks_test.go b/pkg/tiller/hooks_test.go index 8bd928500..86c89b8f3 100644 --- a/pkg/tiller/hooks_test.go +++ b/pkg/tiller/hooks_test.go @@ -131,6 +131,21 @@ metadata: name: example-test annotations: "helm.sh/hook": test-success +`, + }, + { + name: []string{"ninth"}, + path: "nine", + kind: []string{"CustomResourceDefinition"}, + hooks: map[string][]release.Hook_Event{"ninth": {release.Hook_CRD_INSTALL}}, + manifest: `apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: ninth + labels: + doesnot: matter + annotations: + "helm.sh/hook": crd-install `, }, } @@ -146,22 +161,22 @@ metadata: } // This test will fail if 'six' or 'seven' was added. - if len(generic) != 2 { - t.Errorf("Expected 2 generic manifests, got %d", len(generic)) + // changed to account for CustomResourceDefinition with crd-install hook being added to generic list of manifests + if len(generic) != 3 { + t.Errorf("Expected 3 generic manifests, got %d", len(generic)) } - if len(hs) != 4 { - t.Errorf("Expected 4 hooks, got %d", len(hs)) + // changed to account for 5 hooks now that there is a crd-install hook added as member 9 of the data list. It was 4 before. + if len(hs) != 5 { + t.Errorf("Expected 5 hooks, got %d", len(hs)) } for _, out := range hs { + t.Logf("Checking name %s path %s and kind %s", out.Name, out.Path, out.Kind) found := false for _, expect := range data { if out.Path == expect.path { found = true - if out.Path != expect.path { - t.Errorf("Expected path %s, got %s", expect.path, out.Path) - } nameFound := false for _, expectedName := range expect.name { if out.Name == expectedName { @@ -209,8 +224,8 @@ metadata: name := sh.Metadata.Name - //only keep track of non-hook manifests - if err == nil && s.hooks[name] == nil { + //only keep track of non-hook manifests, that are not CustomResourceDefinitions with crd-install + if err == nil && (s.hooks[name] == nil || s.hooks[name][0] == release.Hook_CRD_INSTALL) { another := Manifest{ Content: m, Name: name, From 57b39473dd87d5841c5a86a9b0f8fbd7bc24ce09 Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Thu, 29 Nov 2018 15:50:23 -0800 Subject: [PATCH 438/449] fix(helm): Allow custom resources in hooks (#4986) Currently the code that handles hooks uses a builder that creates the versioned types rather than unstructured. This results in an error whenever a custom resource is used in the hook as the type will not be registered in the scheme used in Helm. This changes this to use a builder that created unstructured resources and only converts to the versioned type when needed. Signed-off-by: Morten Torkildsen --- pkg/kube/client.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 3303f4bc2..b60b0cfc2 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -180,7 +180,11 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { vk := gvk.Version + "/" + gvk.Kind internalObj, err := asInternal(info) if err != nil { - c.Log("Warning: conversion to internal type failed: %v", err) + // If the problem is just that the resource is not registered, don't print any + // error. This is normal for custom resources. + if !runtime.IsNotRegisteredError(err) { + c.Log("Warning: conversion to internal type failed: %v", err) + } // Add the unstructured object in this situation. It will still get listed, just // with less information. objs[vk] = append(objs[vk], info.Object) @@ -357,7 +361,7 @@ func (c *Client) watchTimeout(t time.Duration) ResourceActorFunc { // // Handling for other kinds will be added as necessary. func (c *Client) WatchUntilReady(namespace string, reader io.Reader, timeout int64, shouldWait bool) error { - infos, err := c.Build(namespace, reader) + infos, err := c.BuildUnstructured(namespace, reader) if err != nil { return err } @@ -604,12 +608,13 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err // // This operates on an event returned from a watcher. func (c *Client) waitForJob(e watch.Event, name string) (bool, error) { - o, ok := e.Object.(*batch.Job) - if !ok { - return true, fmt.Errorf("Expected %s to be a *batch.Job, got %T", name, e.Object) + job := &batch.Job{} + err := legacyscheme.Scheme.Convert(e.Object, job, nil) + if err != nil { + return true, err } - for _, c := range o.Status.Conditions { + for _, c := range job.Status.Conditions { if c.Type == batch.JobComplete && c.Status == v1.ConditionTrue { return true, nil } else if c.Type == batch.JobFailed && c.Status == v1.ConditionTrue { @@ -617,7 +622,7 @@ func (c *Client) waitForJob(e watch.Event, name string) (bool, error) { } } - c.Log("%s: Jobs active: %d, jobs failed: %d, jobs succeeded: %d", name, o.Status.Active, o.Status.Failed, o.Status.Succeeded) + c.Log("%s: Jobs active: %d, jobs failed: %d, jobs succeeded: %d", name, job.Status.Active, job.Status.Failed, job.Status.Succeeded) return false, nil } From e2cef67a5e22a7add86e66e2b6153cdba842f0db Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Fri, 30 Nov 2018 18:04:37 +0000 Subject: [PATCH 439/449] Update messaging in value parsing to improve traceability (#4974) Closes #4736 Signed-off-by: Martin Hickey --- pkg/chartutil/requirements.go | 6 +++--- pkg/chartutil/values.go | 28 ++++++++++++++-------------- pkg/chartutil/values_test.go | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkg/chartutil/requirements.go b/pkg/chartutil/requirements.go index 566123122..0f1128305 100644 --- a/pkg/chartutil/requirements.go +++ b/pkg/chartutil/requirements.go @@ -428,7 +428,7 @@ func processImportValues(c *chart.Chart) error { } // create value map from child to be merged into parent vm := pathToMap(nm["parent"], vv.AsMap()) - b = coalesceTables(cvals, vm) + b = coalesceTables(cvals, vm, c.Metadata.Name) case string: nm := map[string]string{ "child": "exports." + iv, @@ -441,14 +441,14 @@ func processImportValues(c *chart.Chart) error { log.Printf("Warning: ImportValues missing table: %v", err) continue } - b = coalesceTables(b, vm.AsMap()) + b = coalesceTables(b, vm.AsMap(), c.Metadata.Name) } } // set our formatted import values r.ImportValues = outiv } } - b = coalesceTables(b, cvals) + b = coalesceTables(b, cvals, c.Metadata.Name) y, err := yaml.Marshal(b) if err != nil { return err diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index a47073b67..352524c13 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -203,7 +203,7 @@ func coalesceDeps(chrt *chart.Chart, dest map[string]interface{}) (map[string]in dvmap := dv.(map[string]interface{}) // Get globals out of dest and merge them into dvmap. - coalesceGlobals(dvmap, dest) + coalesceGlobals(dvmap, dest, chrt.Metadata.Name) var err error // Now coalesce the rest of the values. @@ -219,20 +219,20 @@ func coalesceDeps(chrt *chart.Chart, dest map[string]interface{}) (map[string]in // coalesceGlobals copies the globals out of src and merges them into dest. // // For convenience, returns dest. -func coalesceGlobals(dest, src map[string]interface{}) map[string]interface{} { +func coalesceGlobals(dest, src map[string]interface{}, chartName string) map[string]interface{} { var dg, sg map[string]interface{} if destglob, ok := dest[GlobalKey]; !ok { dg = map[string]interface{}{} } else if dg, ok = destglob.(map[string]interface{}); !ok { - log.Printf("warning: skipping globals because destination %s is not a table.", GlobalKey) + log.Printf("Warning: Skipping globals for chart '%s' because destination '%s' is not a table.", chartName, GlobalKey) return dg } if srcglob, ok := src[GlobalKey]; !ok { sg = map[string]interface{}{} } else if sg, ok = srcglob.(map[string]interface{}); !ok { - log.Printf("warning: skipping globals because source %s is not a table.", GlobalKey) + log.Printf("Warning: skipping globals for chart '%s' because source '%s' is not a table.", chartName, GlobalKey) return dg } @@ -247,11 +247,11 @@ func coalesceGlobals(dest, src map[string]interface{}) map[string]interface{} { if destvmap, ok := destv.(map[string]interface{}); ok { // Basically, we reverse order of coalesce here to merge // top-down. - coalesceTables(vv, destvmap) + coalesceTables(vv, destvmap, chartName) dg[key] = vv continue } else { - log.Printf("Conflict: cannot merge map onto non-map for %q. Skipping.", key) + log.Printf("Warning: For chart '%s', cannot merge map onto non-map for key '%q'. Skipping.", chartName, key) } } else { // Here there is no merge. We're just adding. @@ -259,7 +259,7 @@ func coalesceGlobals(dest, src map[string]interface{}) map[string]interface{} { } } else if dv, ok := dg[key]; ok && istable(dv) { // It's not clear if this condition can actually ever trigger. - log.Printf("key %s is table. Skipping", key) + log.Printf("Warning: For chart '%s', key '%s' is a table. Skipping.", chartName, key) continue } // TODO: Do we need to do any additional checking on the value? @@ -291,7 +291,7 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf // On error, we return just the overridden values. // FIXME: We should log this error. It indicates that the YAML data // did not parse. - return v, fmt.Errorf("error reading default values (%s): %s", c.Values.Raw, err) + return v, fmt.Errorf("Error: Reading chart '%s' default values (%s): %s", c.Metadata.Name, c.Values.Raw, err) } for key, val := range nv { @@ -305,12 +305,12 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf // if v[key] is a table, merge nv's val table into v[key]. src, ok := val.(map[string]interface{}) if !ok { - log.Printf("warning: skipped value for %s: Not a table.", key) + log.Printf("Warning: Building values map for chart '%s'. Skipped value (%+v) for '%s', as it is not a table.", c.Metadata.Name, src, key) continue } // Because v has higher precedence than nv, dest values override src // values. - coalesceTables(dest, src) + coalesceTables(dest, src, c.Metadata.Name) } } else { // If the key is not in v, copy it from nv. @@ -323,7 +323,7 @@ func coalesceValues(c *chart.Chart, v map[string]interface{}) (map[string]interf // coalesceTables merges a source map into a destination map. // // dest is considered authoritative. -func coalesceTables(dst, src map[string]interface{}) map[string]interface{} { +func coalesceTables(dst, src map[string]interface{}, chartName string) map[string]interface{} { // Because dest has higher precedence than src, dest values override src // values. for key, val := range src { @@ -331,13 +331,13 @@ func coalesceTables(dst, src map[string]interface{}) map[string]interface{} { if innerdst, ok := dst[key]; !ok { dst[key] = val } else if istable(innerdst) { - coalesceTables(innerdst.(map[string]interface{}), val.(map[string]interface{})) + coalesceTables(innerdst.(map[string]interface{}), val.(map[string]interface{}), chartName) } else { - log.Printf("warning: cannot overwrite table with non table for %s (%v)", key, val) + log.Printf("Warning: Merging destination map for chart '%s'. Cannot overwrite table item '%s', with non table value: %v", chartName, key, val) } continue } else if dv, ok := dst[key]; ok && istable(dv) { - log.Printf("warning: destination for %s is a table. Ignoring non-table value %v", key, val) + log.Printf("Warning: Merging destination map for chart '%s'. The destination item '%s' is a table and ignoring the source '%s' as it has a non-table value of: %v", chartName, key, key, val) continue } else if !ok { // <- ok is still in scope from preceding conditional. dst[key] = val diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index f38afaf95..3fea14c3a 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -386,7 +386,7 @@ func TestCoalesceTables(t *testing.T) { // What we expect is that anything in dst overrides anything in src, but that // otherwise the values are coalesced. - coalesceTables(dst, src) + coalesceTables(dst, src, "") if dst["name"] != "Ishmael" { t.Errorf("Unexpected name: %s", dst["name"]) From fa95df275ba02755a9ce40d399b0bf4ef66cd09a Mon Sep 17 00:00:00 2001 From: Tariq Ibrahim Date: Tue, 4 Dec 2018 08:25:38 -0800 Subject: [PATCH 440/449] add unit tests for portforwarder (#4979) Signed-off-by: tariqibrahim --- pkg/helm/portforwarder/portforwarder_test.go | 51 ++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/pkg/helm/portforwarder/portforwarder_test.go b/pkg/helm/portforwarder/portforwarder_test.go index f5efe3443..2809bcbff 100644 --- a/pkg/helm/portforwarder/portforwarder_test.go +++ b/pkg/helm/portforwarder/portforwarder_test.go @@ -85,3 +85,54 @@ func TestGetFirstPod(t *testing.T) { } } } + +func TestGetTillerPodImage(t *testing.T) { + tests := []struct { + name string + podSpec v1.PodSpec + expected string + err bool + }{ + { + name: "pod with tiller container image", + podSpec: v1.PodSpec{ + Containers: []v1.Container{ + { + Name: "tiller", + Image: "gcr.io/kubernetes-helm/tiller:v2.0.0", + }, + }, + }, + expected: "gcr.io/kubernetes-helm/tiller:v2.0.0", + err: false, + }, + { + name: "pod without tiller container image", + podSpec: v1.PodSpec{ + Containers: []v1.Container{ + { + Name: "not_tiller", + Image: "gcr.io/kubernetes-helm/not_tiller:v1.0.0", + }, + }, + }, + expected: "", + err: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + mockPod := mockTillerPod() + mockPod.Spec = tt.podSpec + client := fake.NewSimpleClientset(&v1.PodList{Items: []v1.Pod{mockPod}}) + imageName, err := GetTillerPodImage(client.CoreV1(), v1.NamespaceDefault) + if (err != nil) != tt.err { + t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err) + } + if imageName != tt.expected { + t.Errorf("%q. expected %q, got %q", tt.name, tt.expected, imageName) + } + }) + } +} From c9f6538428b4f3f0d3993f8af88cd114c808b2da Mon Sep 17 00:00:00 2001 From: Florent Monbillard Date: Tue, 4 Dec 2018 13:48:12 -0500 Subject: [PATCH 441/449] Charts docs clean-up - Address #4998, #5000, #5001 and #5002 - Fix Markdown syntax for code blocks Signed-off-by: Florent Monbillard --- docs/charts.md | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/charts.md b/docs/charts.md index 5a895fd49..7bc4f0020 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -116,10 +116,10 @@ be deprecated. The chart name can later be reused by publishing a newer version that is not marked as deprecated. The workflow for deprecating charts, as followed by the [helm/charts](https://github.com/helm/charts) project is: - - Update chart's `Chart.yaml` to mark the chart as deprecated, bumping the - version - - Release the new chart version in the Chart Repository - - Remove the chart from the source repository (e.g. git) + +- Update chart's `Chart.yaml` to mark the chart as deprecated, bumping the version +- Release the new chart version in the Chart Repository +- Remove the chart from the source repository (e.g. git) ## Chart LICENSE, README and NOTES @@ -160,7 +160,6 @@ the preferred method of declaring dependencies is by using a **Note:** The `dependencies:` section of the `Chart.yaml` from Helm Classic has been completely removed. - ### Managing Dependencies with `requirements.yaml` A `requirements.yaml` file is a simple file for listing your @@ -240,6 +239,7 @@ dependencies: ``` In the above example we will get 3 dependencies in all for `parentchart` + ``` subchart new-subchart-1 @@ -283,9 +283,10 @@ dependencies: condition: subchart2.enabled,global.subchart2.enabled tags: - back-end - - subchart2 + - subchart2 ``` + ```yaml # parentchart/values.yaml @@ -294,7 +295,7 @@ subchart1: tags: front-end: false back-end: true -```` +``` In the above example all charts with the tag `front-end` would be disabled but since the `subchart1.enabled` path evaluates to 'true' in the parent's values, the condition will override the @@ -314,12 +315,11 @@ helm install --set tags.front-end=true --set subchart2.enabled=false ##### Tags and Condition Resolution - - * **Conditions (when set in values) always override tags.** The first condition - path that exists wins and subsequent ones for that chart are ignored. - * Tags are evaluated as 'if any of the chart's tags are true then enable the chart'. - * Tags and conditions values must be set in the top parent's values. - * The `tags:` key in values must be a top level key. Globals and nested `tags:` tables +- **Conditions (when set in values) always override tags.** +- The first condition path that exists wins and subsequent ones for that chart are ignored. +- Tags are evaluated as 'if any of the chart's tags are true then enable the chart'. +- Tags and conditions values must be set in the top parent's values. +- The `tags:` key in values must be a top level key. Globals and nested `tags:` tables are not currently supported. #### Importing Child Values via requirements.yaml @@ -345,6 +345,7 @@ directly into the parent's values by specifying the keys to import as in the exa import-values: - data ``` + ```yaml # child's values.yaml file ... @@ -388,6 +389,7 @@ dependencies: - child: default.data parent: myimports ``` + In the above example, values found at `default.data` in the subchart1's values will be imported to the `myimports` key in the parent chart's values as detailed below: @@ -400,6 +402,7 @@ myimports: mystring: "helm rocks!" ``` + ```yaml # subchart1's values.yaml file @@ -409,6 +412,7 @@ default: mybool: true ``` + The parent chart's resulting values would be: ```yaml @@ -511,10 +515,10 @@ through the template engine. Values for the templates are supplied two ways: - - Chart developers may supply a file called `values.yaml` inside of a - chart. This file can contain default values. - - Chart users may supply a YAML file that contains values. This can be - provided on the command line with `helm install`. +- Chart developers may supply a file called `values.yaml` inside of a + chart. This file can contain default values. +- Chart users may supply a YAML file that contains values. This can be + provided on the command line with `helm install`. When a user supplies custom values, these values will override the values in the chart's `values.yaml` file. From fe55be3dc0a807fd448568c642c5e3563db3ca06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=AFo=D0=BD=D0=B8=D0=B8=CE=B3=20=C4=AFo=D0=BD=D0=B8?= =?UTF-8?q?=D0=B8=CE=B3?= Date: Wed, 5 Dec 2018 10:08:06 -0800 Subject: [PATCH 442/449] Added extra padding to resources template (#4981) This is probably a silly PR. However, each time I create a new chart via `helm create`, the instructions to uncomment the resource limits require adding a couple extra spaces back to the YAML. This PR simply brings the spacing in-line with the rest of the generated template. Signed-off-by: John Dewey --- pkg/chartutil/create.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 9063ed12a..82d307ded 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -89,11 +89,11 @@ resources: {} # resources, such as Minikube. If you do want to specify resources, uncomment the following # lines, adjust them as necessary, and remove the curly braces after 'resources:'. # limits: - # cpu: 100m - # memory: 128Mi + # cpu: 100m + # memory: 128Mi # requests: - # cpu: 100m - # memory: 128Mi + # cpu: 100m + # memory: 128Mi nodeSelector: {} From cc7a50f4acb0ccf336d2606d9ce7669a98e197e5 Mon Sep 17 00:00:00 2001 From: Taylor Thomas Date: Wed, 5 Dec 2018 10:45:49 -0800 Subject: [PATCH 443/449] ref(kube): Gets rid of superfluous Sprintf call Signed-off-by: Taylor Thomas --- pkg/kube/client.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index b60b0cfc2..4a387d524 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -220,8 +220,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { buf := new(bytes.Buffer) printFlags := get.NewHumanPrintFlags() for t, ot := range objs { - kindHeader := fmt.Sprintf("==> %s\n", t) - if _, err = buf.WriteString(kindHeader); err != nil { + if _, err = fmt.Fprintf(buf, "==> %s\n", t); err != nil { return "", err } typePrinter, _ := printFlags.ToPrinter("") From 57154a252cc14acc597ddca72ca9f8ade885f2cc Mon Sep 17 00:00:00 2001 From: Henry Nash Date: Wed, 5 Dec 2018 19:41:52 +0000 Subject: [PATCH 444/449] docs(helm): Mention commit signing in the Developer Guide (#5018) This change adds a mention to the reqruiement for commit signing to the Git Convention outline in the Developer Guide, while leaving the existing detail on signing in the Contributing doc. Closes #5016 Signed-off-by: Henry Nash --- docs/developers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developers.md b/docs/developers.md index 4f1da2d96..4edc4bea1 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -167,7 +167,7 @@ workflow for doing this is as follows: 3. Add your repository as a remote for `$GOPATH/src/k8s.io/helm` 4. Create a new working branch (`git checkout -b feat/my-feature`) and do your work on that branch. -5. When you are ready for us to review, push your branch to GitHub, and +5. When you are ready for us to review, sign your commit, push your branch to GitHub, and then open a new pull request with us. For Git commit messages, we follow the [Semantic Commit Messages](http://karma-runner.github.io/0.13/dev/git-commit-msg.html): From 60ef1af80a16ba66ae3c01b2b49c1a1ddaf4d6d9 Mon Sep 17 00:00:00 2001 From: Henry Nash Date: Wed, 5 Dec 2018 21:06:46 +0000 Subject: [PATCH 445/449] fix(helm): get rid of lint warning in pkg/storage (#5021) Provide comment for constant to avoid golint warning. Closes #5020 Signed-off-by: Henry Nash --- pkg/storage/storage.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index e0e39ac0c..9520db08b 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -25,6 +25,7 @@ import ( "k8s.io/helm/pkg/storage/driver" ) +// NoReleasesErr indicates that a given release cannot be found const NoReleasesErr = "has no deployed releases" // Storage represents a storage engine for a Release. From 72d25b0644aee14b574d66d1cf16ab892a1de684 Mon Sep 17 00:00:00 2001 From: Henry Nash Date: Wed, 5 Dec 2018 21:08:51 +0000 Subject: [PATCH 446/449] fix(helm): Correct and improve resilence of template check in unit test (#5010) Make the current check for the number of templates on create more resilient by using a varible to store the expected number of templates. In addition, fix the error message so that it displays the correct number expected of templates. Closes #5009 Signed-off-by: Henry Nash --- cmd/helm/create_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go index 3cdf5ebf8..c9459b477 100644 --- a/cmd/helm/create_test.go +++ b/cmd/helm/create_test.go @@ -143,8 +143,9 @@ func TestCreateStarterCmd(t *testing.T) { t.Errorf("Wrong API version: %q", c.Metadata.ApiVersion) } - if l := len(c.Templates); l != 7 { - t.Errorf("Expected 6 templates, got %d", l) + expectedTemplateCount := 7 + if l := len(c.Templates); l != expectedTemplateCount { + t.Errorf("Expected %d templates, got %d", expectedTemplateCount, l) } found := false From c77dd17839ec912807b83d6daefb647e7dfe75e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helgi=20=C3=9Eormar=20=C3=9Eorbj=C3=B6rnsson?= <70530+helgi@users.noreply.github.com> Date: Wed, 5 Dec 2018 13:30:42 -0800 Subject: [PATCH 447/449] Return empty string instead of nil when linting on required (#4748) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Return empty string instead of nil when linting on required This allows lint to work in scenarios when required is used in secrets or it's output is passed to another function. Due to lint mode no longer failing on missing value in required it is passing nil through which not all functions can accept. Fixes #4747 Signed-off-by: Helgi Þorbjörnsson * Apply suggestions from code review Co-Authored-By: helgi <70530+helgi@users.noreply.github.com> Signed-off-by: Helgi Þorbjörnsson * Add tests Signed-off-by: Helgi Þorbjörnsson --- pkg/engine/engine.go | 5 +++-- pkg/engine/engine_test.go | 27 ++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 9f212ba09..f3dd869c9 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -159,9 +159,10 @@ func (e *Engine) alterFuncMap(t *template.Template, referenceTpls map[string]ren if e.LintMode { // Don't fail on missing required values when linting log.Printf("[INFO] Missing required value: %s", warn) - return val, nil + return "", nil } - return val, fmt.Errorf(warn) + // Convert nil to "" in case required is piped into other functions + return "", fmt.Errorf(warn) } else if _, ok := val.(string); ok { if val == "" { if e.LintMode { diff --git a/pkg/engine/engine_test.go b/pkg/engine/engine_test.go index 91a3fd795..712b3b3df 100644 --- a/pkg/engine/engine_test.go +++ b/pkg/engine/engine_test.go @@ -466,7 +466,6 @@ func TestAlterFuncMap(t *testing.T) { if err != nil { t.Fatal(err) } - expectStr := "All your base are belong to us" if gotStr := outReq["conan/templates/quote"]; gotStr != expectStr { t.Errorf("Expected %q, got %q (%v)", expectStr, gotStr, outReq) @@ -476,6 +475,32 @@ func TestAlterFuncMap(t *testing.T) { t.Errorf("Expected %q, got %q (%v)", expectNum, gotNum, outReq) } + // test required without passing in needed values with lint mode on + // verifies lint replaces required with an empty string (should not fail) + lintValues := chartutil.Values{ + "Values": chartutil.Values{ + "who": "us", + }, + "Chart": reqChart.Metadata, + "Release": chartutil.Values{ + "Name": "That 90s meme", + }, + } + e := New() + e.LintMode = true + outReq, err = e.Render(reqChart, lintValues) + if err != nil { + t.Fatal(err) + } + expectStr = "All your base are belong to us" + if gotStr := outReq["conan/templates/quote"]; gotStr != expectStr { + t.Errorf("Expected %q, got %q (%v)", expectStr, gotStr, outReq) + } + expectNum = "All of them!" + if gotNum := outReq["conan/templates/bases"]; gotNum != expectNum { + t.Errorf("Expected %q, got %q (%v)", expectNum, gotNum, outReq) + } + tplChart := &chart.Chart{ Metadata: &chart.Metadata{Name: "TplFunction"}, Templates: []*chart.Template{ From 9caffc1e634ab7b0e35b978c40fd900fa56f5e8a Mon Sep 17 00:00:00 2001 From: Frank Hamand Date: Wed, 5 Dec 2018 22:04:48 +0000 Subject: [PATCH 448/449] Add --parallel flag to helm test (#4144) * Refactor test run to separate method This will allow us to parallelise it more easily Signed-off-by: Frank Hamand * Add --parallel flag to helm test (No functionality in this commit) Signed-off-by: Frank Hamand * Run helm tests in parallel with --parallel flag Signed-off-by: Frank Hamand * Add a mutex to helm test message streams This is to protect against data races when running tests in parallel. Signed-off-by: Frank Hamand * Add tests for --parallel flag Signed-off-by: Frank Hamand * Add concurrency limit for parallel helm tests Signed-off-by: Frank Hamand * Add test for concurrency limit Signed-off-by: Frank Hamand * Fix rebase introduced errors Signed-off-by: Frank Hamand --- _proto/hapi/services/tiller.proto | 2 + cmd/helm/release_testing.go | 13 +- docs/helm/helm_test.md | 3 +- glide.lock | 8 +- glide.yaml | 4 +- pkg/helm/option.go | 7 + pkg/proto/hapi/services/tiller.pb.go | 172 +++++++++++++------------ pkg/releasetesting/environment.go | 14 +- pkg/releasetesting/environment_test.go | 9 +- pkg/releasetesting/test_suite.go | 92 +++++++++---- pkg/releasetesting/test_suite_test.go | 121 +++++++++++++++++ pkg/tiller/release_testing.go | 12 +- 12 files changed, 329 insertions(+), 128 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 6c44ce6e0..8eba963e4 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -339,6 +339,8 @@ message TestReleaseRequest { int64 timeout = 2; // cleanup specifies whether or not to attempt pod deletion after test completes bool cleanup = 3; + // parallel specifies whether or not to run test pods in parallel + bool parallel = 4; } // TestReleaseResponse represents a message from executing a test diff --git a/cmd/helm/release_testing.go b/cmd/helm/release_testing.go index f39d9b81f..91c0d7189 100644 --- a/cmd/helm/release_testing.go +++ b/cmd/helm/release_testing.go @@ -34,11 +34,12 @@ The tests to be run are defined in the chart that was installed. ` type releaseTestCmd struct { - name string - out io.Writer - client helm.Interface - timeout int64 - cleanup bool + name string + out io.Writer + client helm.Interface + timeout int64 + cleanup bool + parallel bool } func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command { @@ -67,6 +68,7 @@ func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command { settings.AddFlagsTLS(f) f.Int64Var(&rlsTest.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&rlsTest.cleanup, "cleanup", false, "delete test pods upon completion") + f.BoolVar(&rlsTest.parallel, "parallel", false, "run test pods in parallel") // set defaults from environment settings.InitTLS(f) @@ -79,6 +81,7 @@ func (t *releaseTestCmd) run() (err error) { t.name, helm.ReleaseTestTimeout(t.timeout), helm.ReleaseTestCleanup(t.cleanup), + helm.ReleaseTestParallel(t.parallel), ) testErr := &testErr{} diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index e55c5df68..e8ddfbc9b 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -20,6 +20,7 @@ helm test [RELEASE] [flags] ``` --cleanup delete test pods upon completion -h, --help help for test + --parallel run test pods in parallel --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") @@ -45,4 +46,4 @@ helm test [RELEASE] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 10-Aug-2018 +###### Auto generated by spf13/cobra on 9-Nov-2018 diff --git a/glide.lock b/glide.lock index 16ea64ff5..c6bec006d 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: fcbba2207c6511df365dfe355dfe601a862d340bbf15db47938a404fd0ec58d0 -updated: 2018-11-11T19:26:29.631232-05:00 +hash: 813d803db5fc2cb46f8050190d2a307f247da5b7b3a4b00eb4d3e766882ad4f9 +updated: 2018-11-30T10:55:17.417707Z imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -290,6 +290,10 @@ imports: - internal - jws - jwt +- name: golang.org/x/sync + version: 1d60e4601c6fd243af51cc01ddf169918a5407ca + subpackages: + - semaphore - name: golang.org/x/sys version: 95c6576299259db960f6c5b9b69ea52422860fce subpackages: diff --git a/glide.yaml b/glide.yaml index f0028b579..52cee8142 100644 --- a/glide.yaml +++ b/glide.yaml @@ -3,6 +3,9 @@ import: - package: golang.org/x/net subpackages: - context + - package: golang.org/x/sync + subpackages: + - semaphore - package: github.com/spf13/cobra version: fe5e611709b0c57fa4a89136deaa8e1d4004d053 - package: github.com/spf13/pflag @@ -41,7 +44,6 @@ import: - package: github.com/prometheus/client_golang version: 0.8.0 - package: github.com/grpc-ecosystem/go-grpc-prometheus - - package: k8s.io/kubernetes version: release-1.12 - package: k8s.io/client-go diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 5579ae76d..f41d9c6ae 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -227,6 +227,13 @@ func ReleaseTestCleanup(cleanup bool) ReleaseTestOption { } } +// ReleaseTestParallel is a boolean value representing whether to run test pods in parallel +func ReleaseTestParallel(parallel bool) ReleaseTestOption { + return func(opts *options) { + opts.testReq.Parallel = parallel + } +} + // RollbackTimeout specifies the number of seconds before kubernetes calls timeout func RollbackTimeout(timeout int64) RollbackOption { return func(opts *options) { diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 044d54e91..f57ad8582 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -883,6 +883,8 @@ type TestReleaseRequest struct { Timeout int64 `protobuf:"varint,2,opt,name=timeout" json:"timeout,omitempty"` // cleanup specifies whether or not to attempt pod deletion after test completes Cleanup bool `protobuf:"varint,3,opt,name=cleanup" json:"cleanup,omitempty"` + // parallel specifies whether or not to run test pods in parallel + Parallel bool `protobuf:"varint,4,opt,name=parallel" json:"parallel,omitempty"` } func (m *TestReleaseRequest) Reset() { *m = TestReleaseRequest{} } @@ -911,6 +913,13 @@ func (m *TestReleaseRequest) GetCleanup() bool { return false } +func (m *TestReleaseRequest) GetParallel() bool { + if m != nil { + return m.Parallel + } + return false +} + // TestReleaseResponse represents a message from executing a test type TestReleaseResponse struct { Msg string `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` @@ -1415,85 +1424,86 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1276 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0x6e, 0xe2, 0xfc, 0x9e, 0x74, 0x43, 0x76, 0x36, 0xdb, 0x7a, 0xcd, 0x82, 0x82, 0x11, 0x6c, - 0x76, 0x61, 0x53, 0x08, 0xdc, 0x20, 0x21, 0xa4, 0x6e, 0x36, 0x6a, 0x0b, 0xa5, 0x2b, 0x39, 0xed, - 0x22, 0x21, 0x50, 0xe4, 0x26, 0x93, 0xd6, 0xac, 0x63, 0x07, 0xcf, 0xb8, 0x6c, 0x1f, 0x00, 0x24, - 0xde, 0x83, 0x07, 0xe1, 0x3d, 0x78, 0x0e, 0xee, 0x91, 0xe7, 0xc7, 0xf5, 0x38, 0x76, 0x6a, 0x7a, - 0xd3, 0x78, 0xe6, 0x9c, 0x39, 0x3f, 0xdf, 0x37, 0xe7, 0xcc, 0x29, 0x18, 0x97, 0xf6, 0xca, 0xd9, - 0x23, 0x38, 0xb8, 0x72, 0x66, 0x98, 0xec, 0x51, 0xc7, 0x75, 0x71, 0x30, 0x58, 0x05, 0x3e, 0xf5, - 0x51, 0x37, 0x92, 0x0d, 0xa4, 0x6c, 0xc0, 0x65, 0xc6, 0x0e, 0x3b, 0x31, 0xbb, 0xb4, 0x03, 0xca, - 0xff, 0x72, 0x6d, 0x63, 0x37, 0xb9, 0xef, 0x7b, 0x0b, 0xe7, 0x42, 0x08, 0xb8, 0x8b, 0x00, 0xbb, - 0xd8, 0x26, 0x58, 0xfe, 0x2a, 0x87, 0xa4, 0xcc, 0xf1, 0x16, 0xbe, 0x10, 0xbc, 0xab, 0x08, 0x28, - 0x26, 0x74, 0x1a, 0x84, 0x9e, 0x10, 0x3e, 0x52, 0x84, 0x84, 0xda, 0x34, 0x24, 0x8a, 0xb3, 0x2b, - 0x1c, 0x10, 0xc7, 0xf7, 0xe4, 0x2f, 0x97, 0x99, 0x7f, 0x97, 0xe1, 0xc1, 0xb1, 0x43, 0xa8, 0xc5, - 0x0f, 0x12, 0x0b, 0xff, 0x1a, 0x62, 0x42, 0x51, 0x17, 0xaa, 0xae, 0xb3, 0x74, 0xa8, 0x5e, 0xea, - 0x95, 0xfa, 0x9a, 0xc5, 0x17, 0x68, 0x07, 0x6a, 0xfe, 0x62, 0x41, 0x30, 0xd5, 0xcb, 0xbd, 0x52, - 0xbf, 0x69, 0x89, 0x15, 0xfa, 0x06, 0xea, 0xc4, 0x0f, 0xe8, 0xf4, 0xfc, 0x5a, 0xd7, 0x7a, 0xa5, - 0x7e, 0x7b, 0xf8, 0xd1, 0x20, 0x0b, 0xa7, 0x41, 0xe4, 0x69, 0xe2, 0x07, 0x74, 0x10, 0xfd, 0x79, - 0x71, 0x6d, 0xd5, 0x08, 0xfb, 0x8d, 0xec, 0x2e, 0x1c, 0x97, 0xe2, 0x40, 0xaf, 0x70, 0xbb, 0x7c, - 0x85, 0x0e, 0x00, 0x98, 0x5d, 0x3f, 0x98, 0xe3, 0x40, 0xaf, 0x32, 0xd3, 0xfd, 0x02, 0xa6, 0x5f, - 0x45, 0xfa, 0x56, 0x93, 0xc8, 0x4f, 0xf4, 0x35, 0x6c, 0x73, 0x48, 0xa6, 0x33, 0x7f, 0x8e, 0x89, - 0x5e, 0xeb, 0x69, 0xfd, 0xf6, 0xf0, 0x11, 0x37, 0x25, 0xe1, 0x9f, 0x70, 0xd0, 0x46, 0xfe, 0x1c, - 0x5b, 0x2d, 0xae, 0x1e, 0x7d, 0x13, 0xf4, 0x18, 0x9a, 0x9e, 0xbd, 0xc4, 0x64, 0x65, 0xcf, 0xb0, - 0x5e, 0x67, 0x11, 0xde, 0x6c, 0x98, 0x1e, 0x34, 0xa4, 0x73, 0xf3, 0x05, 0xd4, 0x78, 0x6a, 0xa8, - 0x05, 0xf5, 0xb3, 0x93, 0xef, 0x4e, 0x5e, 0xfd, 0x70, 0xd2, 0xd9, 0x42, 0x0d, 0xa8, 0x9c, 0xec, - 0x7f, 0x3f, 0xee, 0x94, 0xd0, 0x7d, 0xb8, 0x77, 0xbc, 0x3f, 0x39, 0x9d, 0x5a, 0xe3, 0xe3, 0xf1, - 0xfe, 0x64, 0xfc, 0xb2, 0x53, 0x46, 0x6d, 0x80, 0xd1, 0xe1, 0xbe, 0x75, 0x3a, 0x65, 0x2a, 0x9a, - 0xf9, 0x3e, 0x34, 0xe3, 0x1c, 0x50, 0x1d, 0xb4, 0xfd, 0xc9, 0x88, 0x9b, 0x78, 0x39, 0x9e, 0x8c, - 0x3a, 0x25, 0xf3, 0xcf, 0x12, 0x74, 0x55, 0xca, 0xc8, 0xca, 0xf7, 0x08, 0x8e, 0x38, 0x9b, 0xf9, - 0xa1, 0x17, 0x73, 0xc6, 0x16, 0x08, 0x41, 0xc5, 0xc3, 0x6f, 0x25, 0x63, 0xec, 0x3b, 0xd2, 0xa4, - 0x3e, 0xb5, 0x5d, 0xc6, 0x96, 0x66, 0xf1, 0x05, 0xfa, 0x1c, 0x1a, 0x02, 0x0a, 0xa2, 0x57, 0x7a, - 0x5a, 0xbf, 0x35, 0x7c, 0xa8, 0x02, 0x24, 0x3c, 0x5a, 0xb1, 0x9a, 0x79, 0x00, 0xbb, 0x07, 0x58, - 0x46, 0xc2, 0xf1, 0x93, 0x37, 0x28, 0xf2, 0x6b, 0x2f, 0x31, 0x0b, 0x26, 0xf2, 0x6b, 0x2f, 0x31, - 0xd2, 0xa1, 0x2e, 0xae, 0x1f, 0x0b, 0xa7, 0x6a, 0xc9, 0xa5, 0x49, 0x41, 0x5f, 0x37, 0x24, 0xf2, - 0xca, 0xb2, 0xf4, 0x31, 0x54, 0xa2, 0xca, 0x60, 0x66, 0x5a, 0x43, 0xa4, 0xc6, 0x79, 0xe4, 0x2d, - 0x7c, 0x8b, 0xc9, 0x55, 0xea, 0xb4, 0x34, 0x75, 0x87, 0x49, 0xaf, 0x23, 0xdf, 0xa3, 0xd8, 0xa3, - 0x77, 0x8b, 0xff, 0x18, 0x1e, 0x65, 0x58, 0x12, 0x09, 0xec, 0x41, 0x5d, 0x84, 0xc6, 0xac, 0xe5, - 0xe2, 0x2a, 0xb5, 0xcc, 0xdf, 0x35, 0xe8, 0x9e, 0xad, 0xe6, 0x36, 0xc5, 0x52, 0xb4, 0x21, 0xa8, - 0x27, 0x50, 0x65, 0x1d, 0x46, 0x60, 0x71, 0x9f, 0xdb, 0xe6, 0x6d, 0x68, 0x14, 0xfd, 0xb5, 0xb8, - 0x1c, 0x3d, 0x83, 0xda, 0x95, 0xed, 0x86, 0x98, 0x30, 0x20, 0x62, 0xd4, 0x84, 0x26, 0x6b, 0x4f, - 0x96, 0xd0, 0x40, 0xbb, 0x50, 0x9f, 0x07, 0xd7, 0x51, 0x7f, 0x61, 0x25, 0xd9, 0xb0, 0x6a, 0xf3, - 0xe0, 0xda, 0x0a, 0x3d, 0xf4, 0x21, 0xdc, 0x9b, 0x3b, 0xc4, 0x3e, 0x77, 0xf1, 0xf4, 0xd2, 0xf7, - 0xdf, 0x10, 0x56, 0x95, 0x0d, 0x6b, 0x5b, 0x6c, 0x1e, 0x46, 0x7b, 0xc8, 0x88, 0x6e, 0xd2, 0x2c, - 0xc0, 0x36, 0xc5, 0x7a, 0x8d, 0xc9, 0xe3, 0x75, 0x84, 0x21, 0x75, 0x96, 0xd8, 0x0f, 0x29, 0x2b, - 0x25, 0xcd, 0x92, 0x4b, 0xf4, 0x01, 0x6c, 0x07, 0x98, 0x60, 0x3a, 0x15, 0x51, 0x36, 0xd8, 0xc9, - 0x16, 0xdb, 0x7b, 0xcd, 0xc3, 0x42, 0x50, 0xf9, 0xcd, 0x76, 0xa8, 0xde, 0x64, 0x22, 0xf6, 0xcd, - 0x8f, 0x85, 0x04, 0xcb, 0x63, 0x20, 0x8f, 0x85, 0x04, 0x8b, 0x63, 0x5d, 0xa8, 0x2e, 0xfc, 0x60, - 0x86, 0xf5, 0x16, 0x93, 0xf1, 0x05, 0xea, 0x41, 0x6b, 0x8e, 0xc9, 0x2c, 0x70, 0x56, 0x34, 0x62, - 0x74, 0x9b, 0x61, 0x9a, 0xdc, 0x32, 0x0f, 0xe1, 0x61, 0x8a, 0x86, 0xbb, 0x32, 0xfa, 0x47, 0x19, - 0x76, 0x2c, 0xdf, 0x75, 0xcf, 0xed, 0xd9, 0x9b, 0x02, 0x9c, 0x26, 0xe0, 0x2f, 0x6f, 0x86, 0x5f, - 0xcb, 0x80, 0x3f, 0x71, 0x4d, 0x2b, 0xca, 0x35, 0x55, 0x88, 0xa9, 0xe6, 0x13, 0x53, 0x53, 0x89, - 0x91, 0xa8, 0xd7, 0x13, 0xa8, 0xc7, 0x90, 0x36, 0x36, 0x40, 0xda, 0x5c, 0x87, 0xf4, 0x5b, 0xd8, - 0x5d, 0xc3, 0xe1, 0xae, 0xa0, 0xfe, 0x5b, 0x86, 0x87, 0x47, 0x1e, 0xa1, 0xb6, 0xeb, 0xa6, 0x30, - 0x8d, 0x6b, 0xa2, 0x54, 0xb8, 0x26, 0xca, 0xff, 0xa7, 0x26, 0x34, 0x85, 0x14, 0xc9, 0x60, 0x25, - 0xc1, 0x60, 0xa1, 0x3a, 0x51, 0xba, 0x53, 0x2d, 0xd5, 0x9d, 0xd0, 0x7b, 0x00, 0xfc, 0x62, 0x33, - 0xe3, 0x1c, 0xfc, 0x26, 0xdb, 0x39, 0x11, 0xcd, 0x48, 0xf2, 0xd5, 0xc8, 0xe6, 0x2b, 0x59, 0x25, - 0x7d, 0xe8, 0xc8, 0x78, 0x66, 0xc1, 0x9c, 0xc5, 0x24, 0x2a, 0xa5, 0x2d, 0xf6, 0x47, 0xc1, 0x3c, - 0x8a, 0x2a, 0xcd, 0x61, 0x6b, 0x9d, 0xc3, 0x23, 0xd8, 0x49, 0xc3, 0x7e, 0x57, 0x0a, 0xff, 0x2a, - 0xc1, 0xee, 0x99, 0xe7, 0x64, 0x92, 0x98, 0x55, 0x18, 0x6b, 0xb0, 0x96, 0x33, 0x60, 0xed, 0x42, - 0x75, 0x15, 0x06, 0x17, 0x58, 0xd0, 0xc4, 0x17, 0x49, 0xbc, 0x2a, 0x2a, 0x5e, 0xa9, 0x8c, 0xab, - 0xeb, 0x19, 0x4f, 0x41, 0x5f, 0x8f, 0xf2, 0x8e, 0x39, 0x47, 0x79, 0xc5, 0x6f, 0x57, 0x93, 0xbf, - 0x53, 0xe6, 0x03, 0xb8, 0x7f, 0x80, 0xe9, 0x6b, 0x5e, 0xa6, 0x02, 0x00, 0x73, 0x0c, 0x28, 0xb9, - 0x79, 0xe3, 0x4f, 0x6c, 0xa9, 0xfe, 0xe4, 0x60, 0x27, 0xf5, 0xa5, 0x96, 0xf9, 0x15, 0xb3, 0x7d, - 0xe8, 0x10, 0xea, 0x07, 0xd7, 0x9b, 0xc0, 0xed, 0x80, 0xb6, 0xb4, 0xdf, 0x8a, 0xa7, 0x2d, 0xfa, - 0x34, 0x0f, 0x58, 0x04, 0xf1, 0x51, 0x11, 0x41, 0x72, 0x50, 0x28, 0x15, 0x1b, 0x14, 0x7e, 0x02, - 0x74, 0x8a, 0xe3, 0x99, 0xe5, 0x96, 0x37, 0x56, 0xd2, 0x54, 0x56, 0x69, 0xd2, 0xa1, 0x3e, 0x73, - 0xb1, 0xed, 0x85, 0x2b, 0x41, 0xac, 0x5c, 0x9a, 0x3f, 0xc3, 0x03, 0xc5, 0xba, 0x88, 0x33, 0xca, - 0x87, 0x5c, 0x08, 0xeb, 0xd1, 0x27, 0xfa, 0x12, 0x6a, 0x7c, 0xb0, 0x63, 0xb6, 0xdb, 0xc3, 0xc7, - 0x6a, 0xdc, 0xcc, 0x48, 0xe8, 0x89, 0x49, 0xd0, 0x12, 0xba, 0xc3, 0x7f, 0x1a, 0xd0, 0x96, 0xa3, - 0x09, 0x1f, 0x3b, 0x91, 0x03, 0xdb, 0xc9, 0x19, 0x0c, 0x3d, 0xcd, 0x9f, 0x4a, 0x53, 0xa3, 0xb5, - 0xf1, 0xac, 0x88, 0x2a, 0xcf, 0xc0, 0xdc, 0xfa, 0xac, 0x84, 0x08, 0x74, 0xd2, 0xa3, 0x11, 0x7a, - 0x9e, 0x6d, 0x23, 0x67, 0x16, 0x33, 0x06, 0x45, 0xd5, 0xa5, 0x5b, 0x74, 0xc5, 0xee, 0x8c, 0x3a, - 0xcf, 0xa0, 0x5b, 0xcd, 0xa8, 0x23, 0x94, 0xb1, 0x57, 0x58, 0x3f, 0xf6, 0xfb, 0x0b, 0xdc, 0x53, - 0x5e, 0x5c, 0x94, 0x83, 0x56, 0xd6, 0x74, 0x64, 0x7c, 0x52, 0x48, 0x37, 0xf6, 0xb5, 0x84, 0xb6, - 0xda, 0xc6, 0x50, 0x8e, 0x81, 0xcc, 0x37, 0xc6, 0xf8, 0xb4, 0x98, 0x72, 0xec, 0x8e, 0x40, 0x27, - 0xdd, 0x43, 0xf2, 0x78, 0xcc, 0xe9, 0x88, 0x79, 0x3c, 0xe6, 0xb5, 0x26, 0x73, 0x0b, 0xd9, 0x00, - 0x37, 0x2d, 0x04, 0x3d, 0xc9, 0x25, 0x44, 0xed, 0x3c, 0x46, 0xff, 0x76, 0xc5, 0xd8, 0xc5, 0x0a, - 0xde, 0x49, 0xbd, 0xe8, 0x28, 0x07, 0x9a, 0xec, 0x01, 0xc8, 0x78, 0x5e, 0x50, 0x3b, 0x95, 0x94, - 0xe8, 0x4a, 0x1b, 0x92, 0x52, 0x5b, 0xde, 0x86, 0xa4, 0x52, 0x0d, 0xce, 0xdc, 0x42, 0x0e, 0xb4, - 0xad, 0xd0, 0x13, 0xae, 0xa3, 0xb6, 0x80, 0x72, 0x4e, 0xaf, 0x77, 0x35, 0xe3, 0x69, 0x01, 0xcd, - 0x9b, 0xfa, 0x7e, 0x01, 0x3f, 0x36, 0xa4, 0xea, 0x79, 0x8d, 0xfd, 0x57, 0xfe, 0xc5, 0x7f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x38, 0x07, 0x4c, 0x12, 0x83, 0x10, 0x00, 0x00, + // 1289 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xed, 0x72, 0xdb, 0x44, + 0x17, 0x8e, 0x2d, 0x7f, 0x1e, 0xa7, 0x7e, 0xdd, 0x6d, 0x9a, 0xa8, 0x7a, 0x0b, 0x63, 0xc4, 0x40, + 0xdd, 0x42, 0x1d, 0x30, 0xfc, 0x61, 0x86, 0x61, 0x26, 0x75, 0x3d, 0x49, 0x21, 0xa4, 0x33, 0x72, + 0x5b, 0x66, 0x98, 0x61, 0x3c, 0x8a, 0xbd, 0x6e, 0x45, 0x65, 0xc9, 0x68, 0x57, 0xa1, 0xb9, 0x00, + 0x98, 0xe1, 0x3e, 0xb8, 0x10, 0xee, 0x83, 0xeb, 0xe0, 0x3f, 0xb3, 0x5f, 0x8a, 0x56, 0x96, 0x1c, + 0x91, 0x3f, 0xb1, 0x76, 0xcf, 0xd9, 0xf3, 0xf1, 0x3c, 0x7b, 0xce, 0x9e, 0x80, 0xf5, 0xc6, 0x5d, + 0x7b, 0x87, 0x04, 0x47, 0x17, 0xde, 0x1c, 0x93, 0x43, 0xea, 0xf9, 0x3e, 0x8e, 0x86, 0xeb, 0x28, + 0xa4, 0x21, 0xda, 0x63, 0xb2, 0xa1, 0x92, 0x0d, 0x85, 0xcc, 0xda, 0xe7, 0x27, 0xe6, 0x6f, 0xdc, + 0x88, 0x8a, 0xbf, 0x42, 0xdb, 0x3a, 0x48, 0xef, 0x87, 0xc1, 0xd2, 0x7b, 0x2d, 0x05, 0xc2, 0x45, + 0x84, 0x7d, 0xec, 0x12, 0xac, 0x7e, 0xb5, 0x43, 0x4a, 0xe6, 0x05, 0xcb, 0x50, 0x0a, 0xfe, 0xaf, + 0x09, 0x28, 0x26, 0x74, 0x16, 0xc5, 0x81, 0x14, 0xde, 0xd3, 0x84, 0x84, 0xba, 0x34, 0x26, 0x9a, + 0xb3, 0x0b, 0x1c, 0x11, 0x2f, 0x0c, 0xd4, 0xaf, 0x90, 0xd9, 0x7f, 0x55, 0xe1, 0xce, 0xa9, 0x47, + 0xa8, 0x23, 0x0e, 0x12, 0x07, 0xff, 0x12, 0x63, 0x42, 0xd1, 0x1e, 0xd4, 0x7d, 0x6f, 0xe5, 0x51, + 0xb3, 0xd2, 0xaf, 0x0c, 0x0c, 0x47, 0x2c, 0xd0, 0x3e, 0x34, 0xc2, 0xe5, 0x92, 0x60, 0x6a, 0x56, + 0xfb, 0x95, 0x41, 0xdb, 0x91, 0x2b, 0xf4, 0x0d, 0x34, 0x49, 0x18, 0xd1, 0xd9, 0xf9, 0xa5, 0x69, + 0xf4, 0x2b, 0x83, 0xee, 0xe8, 0xa3, 0x61, 0x1e, 0x4e, 0x43, 0xe6, 0x69, 0x1a, 0x46, 0x74, 0xc8, + 0xfe, 0x3c, 0xb9, 0x74, 0x1a, 0x84, 0xff, 0x32, 0xbb, 0x4b, 0xcf, 0xa7, 0x38, 0x32, 0x6b, 0xc2, + 0xae, 0x58, 0xa1, 0x63, 0x00, 0x6e, 0x37, 0x8c, 0x16, 0x38, 0x32, 0xeb, 0xdc, 0xf4, 0xa0, 0x84, + 0xe9, 0xe7, 0x4c, 0xdf, 0x69, 0x13, 0xf5, 0x89, 0xbe, 0x86, 0x5d, 0x01, 0xc9, 0x6c, 0x1e, 0x2e, + 0x30, 0x31, 0x1b, 0x7d, 0x63, 0xd0, 0x1d, 0xdd, 0x13, 0xa6, 0x14, 0xfc, 0x53, 0x01, 0xda, 0x38, + 0x5c, 0x60, 0xa7, 0x23, 0xd4, 0xd9, 0x37, 0x41, 0xf7, 0xa1, 0x1d, 0xb8, 0x2b, 0x4c, 0xd6, 0xee, + 0x1c, 0x9b, 0x4d, 0x1e, 0xe1, 0xd5, 0x86, 0x1d, 0x40, 0x4b, 0x39, 0xb7, 0x9f, 0x40, 0x43, 0xa4, + 0x86, 0x3a, 0xd0, 0x7c, 0x79, 0xf6, 0xdd, 0xd9, 0xf3, 0x1f, 0xce, 0x7a, 0x3b, 0xa8, 0x05, 0xb5, + 0xb3, 0xa3, 0xef, 0x27, 0xbd, 0x0a, 0xba, 0x0d, 0xb7, 0x4e, 0x8f, 0xa6, 0x2f, 0x66, 0xce, 0xe4, + 0x74, 0x72, 0x34, 0x9d, 0x3c, 0xed, 0x55, 0x51, 0x17, 0x60, 0x7c, 0x72, 0xe4, 0xbc, 0x98, 0x71, + 0x15, 0xc3, 0x7e, 0x1f, 0xda, 0x49, 0x0e, 0xa8, 0x09, 0xc6, 0xd1, 0x74, 0x2c, 0x4c, 0x3c, 0x9d, + 0x4c, 0xc7, 0xbd, 0x8a, 0xfd, 0x47, 0x05, 0xf6, 0x74, 0xca, 0xc8, 0x3a, 0x0c, 0x08, 0x66, 0x9c, + 0xcd, 0xc3, 0x38, 0x48, 0x38, 0xe3, 0x0b, 0x84, 0xa0, 0x16, 0xe0, 0x77, 0x8a, 0x31, 0xfe, 0xcd, + 0x34, 0x69, 0x48, 0x5d, 0x9f, 0xb3, 0x65, 0x38, 0x62, 0x81, 0x3e, 0x87, 0x96, 0x84, 0x82, 0x98, + 0xb5, 0xbe, 0x31, 0xe8, 0x8c, 0xee, 0xea, 0x00, 0x49, 0x8f, 0x4e, 0xa2, 0x66, 0x1f, 0xc3, 0xc1, + 0x31, 0x56, 0x91, 0x08, 0xfc, 0xd4, 0x0d, 0x62, 0x7e, 0xdd, 0x15, 0xe6, 0xc1, 0x30, 0xbf, 0xee, + 0x0a, 0x23, 0x13, 0x9a, 0xf2, 0xfa, 0xf1, 0x70, 0xea, 0x8e, 0x5a, 0xda, 0x14, 0xcc, 0x4d, 0x43, + 0x32, 0xaf, 0x3c, 0x4b, 0x1f, 0x43, 0x8d, 0x55, 0x06, 0x37, 0xd3, 0x19, 0x21, 0x3d, 0xce, 0x67, + 0xc1, 0x32, 0x74, 0xb8, 0x5c, 0xa7, 0xce, 0xc8, 0x52, 0x77, 0x92, 0xf6, 0x3a, 0x0e, 0x03, 0x8a, + 0x03, 0x7a, 0xb3, 0xf8, 0x4f, 0xe1, 0x5e, 0x8e, 0x25, 0x99, 0xc0, 0x21, 0x34, 0x65, 0x68, 0xdc, + 0x5a, 0x21, 0xae, 0x4a, 0xcb, 0xfe, 0xcd, 0x80, 0xbd, 0x97, 0xeb, 0x85, 0x4b, 0xb1, 0x12, 0x6d, + 0x09, 0xea, 0x01, 0xd4, 0x79, 0x87, 0x91, 0x58, 0xdc, 0x16, 0xb6, 0x45, 0x1b, 0x1a, 0xb3, 0xbf, + 0x8e, 0x90, 0xa3, 0x47, 0xd0, 0xb8, 0x70, 0xfd, 0x18, 0x13, 0x0e, 0x44, 0x82, 0x9a, 0xd4, 0xe4, + 0xed, 0xc9, 0x91, 0x1a, 0xe8, 0x00, 0x9a, 0x8b, 0xe8, 0x92, 0xf5, 0x17, 0x5e, 0x92, 0x2d, 0xa7, + 0xb1, 0x88, 0x2e, 0x9d, 0x38, 0x40, 0x1f, 0xc2, 0xad, 0x85, 0x47, 0xdc, 0x73, 0x1f, 0xcf, 0xde, + 0x84, 0xe1, 0x5b, 0xc2, 0xab, 0xb2, 0xe5, 0xec, 0xca, 0xcd, 0x13, 0xb6, 0x87, 0x2c, 0x76, 0x93, + 0xe6, 0x11, 0x76, 0x29, 0x36, 0x1b, 0x5c, 0x9e, 0xac, 0x19, 0x86, 0xd4, 0x5b, 0xe1, 0x30, 0xa6, + 0xbc, 0x94, 0x0c, 0x47, 0x2d, 0xd1, 0x07, 0xb0, 0x1b, 0x61, 0x82, 0xe9, 0x4c, 0x46, 0xd9, 0xe2, + 0x27, 0x3b, 0x7c, 0xef, 0x95, 0x08, 0x0b, 0x41, 0xed, 0x57, 0xd7, 0xa3, 0x66, 0x9b, 0x8b, 0xf8, + 0xb7, 0x38, 0x16, 0x13, 0xac, 0x8e, 0x81, 0x3a, 0x16, 0x13, 0x2c, 0x8f, 0xed, 0x41, 0x7d, 0x19, + 0x46, 0x73, 0x6c, 0x76, 0xb8, 0x4c, 0x2c, 0x50, 0x1f, 0x3a, 0x0b, 0x4c, 0xe6, 0x91, 0xb7, 0xa6, + 0x8c, 0xd1, 0x5d, 0x8e, 0x69, 0x7a, 0xcb, 0x3e, 0x81, 0xbb, 0x19, 0x1a, 0x6e, 0xca, 0xe8, 0xef, + 0x55, 0xd8, 0x77, 0x42, 0xdf, 0x3f, 0x77, 0xe7, 0x6f, 0x4b, 0x70, 0x9a, 0x82, 0xbf, 0xba, 0x1d, + 0x7e, 0x23, 0x07, 0xfe, 0xd4, 0x35, 0xad, 0x69, 0xd7, 0x54, 0x23, 0xa6, 0x5e, 0x4c, 0x4c, 0x43, + 0x27, 0x46, 0xa1, 0xde, 0x4c, 0xa1, 0x9e, 0x40, 0xda, 0xda, 0x02, 0x69, 0x7b, 0x13, 0xd2, 0x6f, + 0xe1, 0x60, 0x03, 0x87, 0x9b, 0x82, 0xfa, 0x4f, 0x15, 0xee, 0x3e, 0x0b, 0x08, 0x75, 0x7d, 0x3f, + 0x83, 0x69, 0x52, 0x13, 0x95, 0xd2, 0x35, 0x51, 0xfd, 0x2f, 0x35, 0x61, 0x68, 0xa4, 0x28, 0x06, + 0x6b, 0x29, 0x06, 0x4b, 0xd5, 0x89, 0xd6, 0x9d, 0x1a, 0x99, 0xee, 0x84, 0xde, 0x03, 0x10, 0x17, + 0x9b, 0x1b, 0x17, 0xe0, 0xb7, 0xf9, 0xce, 0x99, 0x6c, 0x46, 0x8a, 0xaf, 0x56, 0x3e, 0x5f, 0xe9, + 0x2a, 0x19, 0x40, 0x4f, 0xc5, 0x33, 0x8f, 0x16, 0x3c, 0x26, 0x59, 0x29, 0x5d, 0xb9, 0x3f, 0x8e, + 0x16, 0x2c, 0xaa, 0x2c, 0x87, 0x9d, 0x4d, 0x0e, 0x9f, 0xc1, 0x7e, 0x16, 0xf6, 0x9b, 0x52, 0xf8, + 0x67, 0x05, 0x0e, 0x5e, 0x06, 0x5e, 0x2e, 0x89, 0x79, 0x85, 0xb1, 0x01, 0x6b, 0x35, 0x07, 0xd6, + 0x3d, 0xa8, 0xaf, 0xe3, 0xe8, 0x35, 0x96, 0x34, 0x89, 0x45, 0x1a, 0xaf, 0x9a, 0x8e, 0x57, 0x26, + 0xe3, 0xfa, 0x66, 0xc6, 0x33, 0x30, 0x37, 0xa3, 0xbc, 0x61, 0xce, 0x2c, 0xaf, 0xe4, 0xed, 0x6a, + 0x8b, 0x77, 0xca, 0xbe, 0x03, 0xb7, 0x8f, 0x31, 0x7d, 0x25, 0xca, 0x54, 0x02, 0x60, 0x4f, 0x00, + 0xa5, 0x37, 0xaf, 0xfc, 0xc9, 0x2d, 0xdd, 0x9f, 0x1a, 0xec, 0x94, 0xbe, 0xd2, 0xb2, 0xbf, 0xe2, + 0xb6, 0x4f, 0x3c, 0x42, 0xc3, 0xe8, 0x72, 0x1b, 0xb8, 0x3d, 0x30, 0x56, 0xee, 0x3b, 0xf9, 0xb4, + 0xb1, 0x4f, 0xfb, 0x98, 0x47, 0x90, 0x1c, 0x95, 0x11, 0xa4, 0x07, 0x85, 0x4a, 0xb9, 0x41, 0xe1, + 0x1d, 0xa0, 0x17, 0x38, 0x99, 0x59, 0xae, 0x79, 0x63, 0x15, 0x4d, 0x55, 0x9d, 0x26, 0x13, 0x9a, + 0x73, 0x1f, 0xbb, 0x41, 0xbc, 0x96, 0xc4, 0xaa, 0x25, 0x6b, 0x6b, 0x6b, 0x37, 0x72, 0x7d, 0x1f, + 0xfb, 0xf2, 0xb9, 0x4a, 0xd6, 0xf6, 0x4f, 0x70, 0x47, 0xf3, 0x2c, 0x73, 0x60, 0xb9, 0x92, 0xd7, + 0xd2, 0x33, 0xfb, 0x44, 0x5f, 0x42, 0x43, 0x0c, 0x7d, 0xdc, 0x6f, 0x77, 0x74, 0x5f, 0xcf, 0x89, + 0x1b, 0x89, 0x03, 0x39, 0x25, 0x3a, 0x52, 0x77, 0xf4, 0x77, 0x0b, 0xba, 0x6a, 0x6c, 0x11, 0x23, + 0x29, 0xf2, 0x60, 0x37, 0x3d, 0x9f, 0xa1, 0x87, 0xc5, 0x13, 0x6b, 0x66, 0xec, 0xb6, 0x1e, 0x95, + 0x51, 0x15, 0x19, 0xd8, 0x3b, 0x9f, 0x55, 0x10, 0x81, 0x5e, 0x76, 0x6c, 0x42, 0x8f, 0xf3, 0x6d, + 0x14, 0xcc, 0x69, 0xd6, 0xb0, 0xac, 0xba, 0x72, 0x8b, 0x2e, 0xf8, 0x7d, 0xd2, 0x67, 0x1d, 0x74, + 0xad, 0x19, 0x7d, 0xbc, 0xb2, 0x0e, 0x4b, 0xeb, 0x27, 0x7e, 0x7f, 0x86, 0x5b, 0xda, 0x6b, 0x8c, + 0x0a, 0xd0, 0xca, 0x9b, 0x9c, 0xac, 0x4f, 0x4a, 0xe9, 0x26, 0xbe, 0x56, 0xd0, 0xd5, 0x5b, 0x1c, + 0x2a, 0x30, 0x90, 0xfb, 0xfe, 0x58, 0x9f, 0x96, 0x53, 0x4e, 0xdc, 0x11, 0xe8, 0x65, 0xfb, 0x4b, + 0x11, 0x8f, 0x05, 0xdd, 0xb2, 0x88, 0xc7, 0xa2, 0xb6, 0x65, 0xef, 0x20, 0x17, 0xe0, 0xaa, 0xbd, + 0xa0, 0x07, 0x85, 0x84, 0xe8, 0x5d, 0xc9, 0x1a, 0x5c, 0xaf, 0x98, 0xb8, 0x58, 0xc3, 0xff, 0x32, + 0xaf, 0x3d, 0x2a, 0x80, 0x26, 0x7f, 0x38, 0xb2, 0x1e, 0x97, 0xd4, 0xce, 0x24, 0x25, 0x3b, 0xd6, + 0x96, 0xa4, 0xf4, 0x76, 0xb8, 0x25, 0xa9, 0x4c, 0xf3, 0xb3, 0x77, 0x90, 0x07, 0x5d, 0x27, 0x0e, + 0xa4, 0x6b, 0xd6, 0x16, 0x50, 0xc1, 0xe9, 0xcd, 0x8e, 0x67, 0x3d, 0x2c, 0xa1, 0x79, 0x55, 0xdf, + 0x4f, 0xe0, 0xc7, 0x96, 0x52, 0x3d, 0x6f, 0xf0, 0xff, 0xd8, 0xbf, 0xf8, 0x37, 0x00, 0x00, 0xff, + 0xff, 0xb6, 0x48, 0x98, 0x76, 0x9f, 0x10, 0x00, 0x00, } diff --git a/pkg/releasetesting/environment.go b/pkg/releasetesting/environment.go index ee078e182..e4184b5f4 100644 --- a/pkg/releasetesting/environment.go +++ b/pkg/releasetesting/environment.go @@ -20,6 +20,7 @@ import ( "bytes" "fmt" "log" + "sync" "time" "k8s.io/api/core/v1" @@ -31,10 +32,13 @@ import ( // Environment encapsulates information about where test suite executes and returns results type Environment struct { - Namespace string - KubeClient environment.KubeClient - Stream services.ReleaseService_RunReleaseTestServer - Timeout int64 + Namespace string + KubeClient environment.KubeClient + Stream services.ReleaseService_RunReleaseTestServer + Timeout int64 + Parallel bool + Parallelism uint32 + streamLock sync.Mutex } func (env *Environment) createTestPod(test *test) error { @@ -108,6 +112,8 @@ func (env *Environment) streamUnknown(name, info string) error { func (env *Environment) streamMessage(msg string, status release.TestRun_Status) error { resp := &services.TestReleaseResponse{Msg: msg, Status: status} + env.streamLock.Lock() + defer env.streamLock.Unlock() return env.Stream.Send(resp) } diff --git a/pkg/releasetesting/environment_test.go b/pkg/releasetesting/environment_test.go index 4403ab6a9..d9377b0f3 100644 --- a/pkg/releasetesting/environment_test.go +++ b/pkg/releasetesting/environment_test.go @@ -121,10 +121,11 @@ func newMockTestingEnvironment() *MockTestingEnvironment { return &MockTestingEnvironment{ Environment: &Environment{ - Namespace: "default", - KubeClient: tEnv.KubeClient, - Timeout: 5, - Stream: &mockStream{}, + Namespace: "default", + KubeClient: tEnv.KubeClient, + Timeout: 5, + Stream: &mockStream{}, + Parallelism: 20, }, } } diff --git a/pkg/releasetesting/test_suite.go b/pkg/releasetesting/test_suite.go index 8ba83fdb2..4fa5de526 100644 --- a/pkg/releasetesting/test_suite.go +++ b/pkg/releasetesting/test_suite.go @@ -17,7 +17,9 @@ limitations under the License. package releasetesting import ( + "context" "fmt" + "golang.org/x/sync/semaphore" "strings" "github.com/ghodss/yaml" @@ -69,53 +71,91 @@ func (ts *TestSuite) Run(env *Environment) error { env.streamMessage("No Tests Found", release.TestRun_UNKNOWN) } + var tests []*test + for _, testManifest := range ts.TestManifests { test, err := newTest(testManifest) if err != nil { return err } - test.result.StartedAt = timeconv.Now() - if err := env.streamRunning(test.result.Name); err != nil { - return err + tests = append(tests, test) + } + + if env.Parallel { + c := make(chan error, len(tests)) + // Use a semaphore to restrict the number of tests running in parallel. + sem := semaphore.NewWeighted(int64(env.Parallelism)) + ctx := context.Background() + for _, t := range tests { + sem.Acquire(ctx, 1) + go func(t *test, sem *semaphore.Weighted) { + defer sem.Release(1) + c <- t.run(env) + }(t, sem) } - test.result.Status = release.TestRun_RUNNING - resourceCreated := true - if err := env.createTestPod(test); err != nil { - resourceCreated = false - if streamErr := env.streamError(test.result.Info); streamErr != nil { + for range tests { + if err := <-c; err != nil { return err } } - resourceCleanExit := true - status := v1.PodUnknown - if resourceCreated { - status, err = env.getTestPodStatus(test) - if err != nil { - resourceCleanExit = false - if streamErr := env.streamError(test.result.Info); streamErr != nil { - return streamErr - } + } else { + for _, t := range tests { + if err := t.run(env); err != nil { + return err } } + } - if resourceCreated && resourceCleanExit { - if err := test.assignTestResult(status); err != nil { - return err - } + for _, t := range tests { + ts.Results = append(ts.Results, t.result) + } - if err := env.streamResult(test.result); err != nil { - return err + ts.CompletedAt = timeconv.Now() + return nil +} + +func (t *test) run(env *Environment) error { + t.result.StartedAt = timeconv.Now() + if err := env.streamRunning(t.result.Name); err != nil { + return err + } + t.result.Status = release.TestRun_RUNNING + + resourceCreated := true + if err := env.createTestPod(t); err != nil { + resourceCreated = false + if streamErr := env.streamError(t.result.Info); streamErr != nil { + return err + } + } + + resourceCleanExit := true + status := v1.PodUnknown + if resourceCreated { + var err error + status, err = env.getTestPodStatus(t) + if err != nil { + resourceCleanExit = false + if streamErr := env.streamError(t.result.Info); streamErr != nil { + return streamErr } } + } + + if resourceCreated && resourceCleanExit { + if err := t.assignTestResult(status); err != nil { + return err + } - test.result.CompletedAt = timeconv.Now() - ts.Results = append(ts.Results, test.result) + if err := env.streamResult(t.result); err != nil { + return err + } } - ts.CompletedAt = timeconv.Now() + t.result.CompletedAt = timeconv.Now() return nil } diff --git a/pkg/releasetesting/test_suite_test.go b/pkg/releasetesting/test_suite_test.go index bf85e4207..59f122953 100644 --- a/pkg/releasetesting/test_suite_test.go +++ b/pkg/releasetesting/test_suite_test.go @@ -220,6 +220,107 @@ func TestExtractTestManifestsFromHooks(t *testing.T) { } } +func TestParallelTestRun(t *testing.T) { + ts := testSuiteFixture([]string{manifestWithTestSuccessHook, manifestWithTestSuccessHook}) + env := testEnvFixture() + env.Parallel = true + env.KubeClient = newSleepOnWaitKubeClient() + if err := ts.Run(env); err != nil { + t.Errorf("%s", err) + } + + if len(ts.Results) != 2 { + t.Errorf("Expected 2 test result. Got %v", len(ts.Results)) + } + + stream := env.Stream.(*mockStream) + if len(stream.messages) != 4 { + t.Errorf("Expected four messages, Got: %v", len(stream.messages)) + } + + if stream.messages[0].Status != release.TestRun_RUNNING { + t.Errorf("Expected first message status to be RUNNING, Got: %v", stream.messages[0].Status) + } + if stream.messages[1].Status != release.TestRun_RUNNING { + t.Errorf("Expected second message status to be RUNNING, Got: %v", stream.messages[1].Status) + } + if stream.messages[2].Status != release.TestRun_SUCCESS { + t.Errorf("Expected third message status to be SUCCESS, Got: %v", stream.messages[2].Status) + } + if stream.messages[3].Status != release.TestRun_SUCCESS { + t.Errorf("Expected fourth message status to be SUCCESS, Got: %v", stream.messages[3].Status) + } +} + +func TestParallelTestRunFailure(t *testing.T) { + ts := testSuiteFixture([]string{manifestWithTestSuccessHook, manifestWithTestFailureHook}) + env := testEnvFixture() + env.Parallel = true + env.KubeClient = newSleepOnWaitKubeClient() + if err := ts.Run(env); err != nil { + t.Errorf("%s", err) + } + + if len(ts.Results) != 2 { + t.Errorf("Expected 2 test result. Got %v", len(ts.Results)) + } + + stream := env.Stream.(*mockStream) + if len(stream.messages) != 4 { + t.Errorf("Expected four messages, Got: %v", len(stream.messages)) + } + + if stream.messages[0].Status != release.TestRun_RUNNING { + t.Errorf("Expected first message status to be RUNNING, Got: %v", stream.messages[0].Status) + } + if stream.messages[1].Status != release.TestRun_RUNNING { + t.Errorf("Expected second message status to be RUNNING, Got: %v", stream.messages[1].Status) + } + + if ts.Results[0].Status != release.TestRun_SUCCESS { + t.Errorf("Expected first test result to be successful, got: %v", ts.Results[0].Status) + } + + if ts.Results[1].Status != release.TestRun_FAILURE { + t.Errorf("Expected second test result to be failure, got: %v", ts.Results[1].Status) + } +} + +func TestParallelism(t *testing.T) { + ts := testSuiteFixture([]string{manifestWithTestSuccessHook, manifestWithTestSuccessHook, manifestWithTestFailureHook}) + env := testEnvFixture() + env.Parallel = true + env.Parallelism = 2 + env.KubeClient = newSleepOnWaitKubeClient() + if err := ts.Run(env); err != nil { + t.Errorf("%s", err) + } + + stream := env.Stream.(*mockStream) + + if stream.messages[0].Status != release.TestRun_RUNNING { + t.Errorf("Expected first message status to be RUNNING, Got: %v", stream.messages[0].Status) + } + if stream.messages[1].Status != release.TestRun_RUNNING { + t.Errorf("Expected second message status to be RUNNING, Got: %v", stream.messages[1].Status) + } + if stream.messages[2].Status == release.TestRun_RUNNING { + t.Errorf("Expected third message status to be not be RUNNING") + } + + if ts.Results[0].Status != release.TestRun_SUCCESS { + t.Errorf("Expected first test result to be successful, got: %v", ts.Results[0].Status) + } + + if ts.Results[1].Status != release.TestRun_SUCCESS { + t.Errorf("Expected second test result to be successful, got: %v", ts.Results[1].Status) + } + + if ts.Results[2].Status != release.TestRun_FAILURE { + t.Errorf("Expected third test result to be failure, got: %v", ts.Results[2].Status) + } +} + func chartStub() *chart.Chart { return &chart.Chart{ Metadata: &chart.Metadata{ @@ -328,6 +429,26 @@ func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Rea return v1.PodSucceeded, nil } +// For testing parallelism, this kube client +// will sleep for 1ms before returning completed pod +// phase. +type sleepOnWaitKubeClient struct { + tillerEnv.PrintingKubeClient + firstWait bool +} + +func newSleepOnWaitKubeClient() *sleepOnWaitKubeClient { + return &sleepOnWaitKubeClient{ + PrintingKubeClient: tillerEnv.PrintingKubeClient{Out: ioutil.Discard}, + } +} + +func (p *sleepOnWaitKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (v1.PodPhase, error) { + time.Sleep(1 * time.Millisecond) + + return v1.PodSucceeded, nil +} + type podFailedKubeClient struct { tillerEnv.PrintingKubeClient } diff --git a/pkg/tiller/release_testing.go b/pkg/tiller/release_testing.go index 06d41e323..e6b6a7f6f 100644 --- a/pkg/tiller/release_testing.go +++ b/pkg/tiller/release_testing.go @@ -22,6 +22,8 @@ import ( reltesting "k8s.io/helm/pkg/releasetesting" ) +const maxParallelism = 20 + // RunReleaseTest runs pre-defined tests stored as hooks on a given release func (s *ReleaseServer) RunReleaseTest(req *services.TestReleaseRequest, stream services.ReleaseService_RunReleaseTestServer) error { @@ -37,10 +39,12 @@ func (s *ReleaseServer) RunReleaseTest(req *services.TestReleaseRequest, stream } testEnv := &reltesting.Environment{ - Namespace: rel.Namespace, - KubeClient: s.env.KubeClient, - Timeout: req.Timeout, - Stream: stream, + Namespace: rel.Namespace, + KubeClient: s.env.KubeClient, + Timeout: req.Timeout, + Stream: stream, + Parallel: req.Parallel, + Parallelism: maxParallelism, } s.Log("running tests for release %s", rel.Name) tSuite, err := reltesting.NewTestSuite(rel) From 0ef9fc881608315b0f2387f08b8454280fbdbe01 Mon Sep 17 00:00:00 2001 From: Sebastien Plisson Date: Wed, 5 Dec 2018 18:42:15 -0800 Subject: [PATCH 449/449] fix comment --- cmd/helm/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 1fd41931f..117942346 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -304,7 +304,7 @@ func (i *installCmd) run() error { helm.InstallWait(i.wait), helm.InstallDescription(i.description)) - // If there is an error while waiting, make a call without waiting to get the release content + // If there is an error while waiting, display the release content if (resp == nil || resp.Release == nil) && i.wait { if res, e := i.client.ReleaseContent(i.name); e != nil { fmt.Fprintf(i.out, "Error reading release content: %v", prettyError(e))