From 627283ac7441c7fc1890be843d15e580705f45b8 Mon Sep 17 00:00:00 2001 From: Sakura Date: Fri, 23 Aug 2019 12:02:21 +0800 Subject: [PATCH 1/5] fix typo Signed-off-by: Sakura --- _proto/hapi/release/status.proto | 2 +- docs/charts.md | 2 +- pkg/kube/client.go | 2 +- pkg/proto/hapi/release/status.pb.go | 2 +- pkg/storage/storage.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_proto/hapi/release/status.proto b/_proto/hapi/release/status.proto index e6ccd3d6e..6cc16b351 100644 --- a/_proto/hapi/release/status.proto +++ b/_proto/hapi/release/status.proto @@ -41,7 +41,7 @@ message Status { PENDING_INSTALL = 6; // Status_PENDING_UPGRADE indicates that an upgrade operation is underway. PENDING_UPGRADE = 7; - // Status_PENDING_ROLLBACK indicates that an rollback operation is underway. + // Status_PENDING_ROLLBACK indicates that a rollback operation is underway. PENDING_ROLLBACK = 8; } diff --git a/docs/charts.md b/docs/charts.md index 62b77647d..9affe50cb 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -479,7 +479,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 diff --git a/pkg/kube/client.go b/pkg/kube/client.go index e61d526a7..aa6f54ae0 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -658,7 +658,7 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P // Get a versioned object versionedObject, err := asVersioned(target) - // Unstructured objects, such as CRDs, may not have an not registered error + // Unstructured objects, such as CRDs, may not have a 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. diff --git a/pkg/proto/hapi/release/status.pb.go b/pkg/proto/hapi/release/status.pb.go index c5ed59202..99bcbc585 100644 --- a/pkg/proto/hapi/release/status.pb.go +++ b/pkg/proto/hapi/release/status.pb.go @@ -38,7 +38,7 @@ const ( Status_PENDING_INSTALL Status_Code = 6 // Status_PENDING_UPGRADE indicates that an upgrade operation is underway. Status_PENDING_UPGRADE Status_Code = 7 - // Status_PENDING_ROLLBACK indicates that an rollback operation is underway. + // Status_PENDING_ROLLBACK indicates that a rollback operation is underway. Status_PENDING_ROLLBACK Status_Code = 8 ) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 9520db08b..e79cacc8d 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -50,7 +50,7 @@ func (s *Storage) Get(name string, version int32) (*rspb.Release, error) { // Create creates a new storage entry holding the release. An // error is returned if the storage driver failed to store the -// release, or a release with identical an key already exists. +// release, or a release with identical key already exists. func (s *Storage) Create(rls *rspb.Release) error { s.Log("creating release %q", makeKey(rls.Name, rls.Version)) if s.MaxHistory > 0 { From aaf24e065851e96632997b4849c98721745a7a12 Mon Sep 17 00:00:00 2001 From: kamal namdeo Date: Fri, 23 Aug 2019 16:15:05 +0200 Subject: [PATCH 2/5] Fix the developer.md typo (#6203) Signed-off-by: kamal namdeo --- docs/developers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developers.md b/docs/developers.md index 70203b2d0..32adbf823 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -103,7 +103,7 @@ helm init --canary-image For developing on Tiller, it is sometimes more expedient to run Tiller locally instead of packaging it into an image and running it in-cluster. You can do -this by telling the Helm client to us a local instance. +this by telling the Helm client to use a local instance. ```console $ make build From f8f8b5d076483291adc6713923a8409baee40f8c Mon Sep 17 00:00:00 2001 From: Adam Eijdenberg Date: Sat, 24 Aug 2019 02:22:54 +1000 Subject: [PATCH 3/5] Add test for subchart with null value (#6146) Signed-off-by: Adam Eijdenberg --- pkg/chartutil/values_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index dfb38387e..04b507fbc 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -643,3 +643,35 @@ func TestOverriteTableItemWithNonTableValue(t *testing.T) { t.Errorf("Expected %v, but got %v", expected, result) } } + +func TestSubchartCoaleseWithNullValue(t *testing.T) { + v, err := CoalesceValues(&chart.Chart{ + Metadata: &chart.Metadata{Name: "demo"}, + Dependencies: []*chart.Chart{ + { + Metadata: &chart.Metadata{Name: "logstash"}, + Values: &chart.Config{ + Raw: `livenessProbe: {httpGet: {path: "/", port: monitor}}`, + }, + }, + }, + Values: &chart.Config{ + Raw: `logstash: {livenessProbe: {httpGet: null, exec: "/bin/true"}}`, + }, + }, &chart.Config{}) + if err != nil { + t.Errorf("Failed with %s", err) + } + result := v.AsMap() + expected := map[string]interface{}{ + "logstash": map[string]interface{}{ + "global": map[string]interface{}{}, + "livenessProbe": map[string]interface{}{ + "exec": "/bin/true", + }, + }, + } + if !reflect.DeepEqual(result, expected) { + t.Errorf("got %+v, expected %+v", result, expected) + } +} From 256765aa741d0b6559b4c449baeb56ebb9c285f3 Mon Sep 17 00:00:00 2001 From: Gasmi Christophe Date: Mon, 26 Aug 2019 11:43:07 +0200 Subject: [PATCH 4/5] Networkpolicy kind sort (#6266) * Add NetworkPolicy in kind sorter Signed-off-by: Christophe GASMI * Added NetworkPolicy to sort order test Signed-off-by: Christophe GASMI --- 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 5c7193dee..90678cce5 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -28,6 +28,7 @@ type SortOrder []string // Those occurring earlier in the list get installed before those occurring later in the list. var InstallOrder SortOrder = []string{ "Namespace", + "NetworkPolicy", "ResourceQuota", "LimitRange", "PodSecurityPolicy", @@ -96,6 +97,7 @@ var UninstallOrder SortOrder = []string{ "PodSecurityPolicy", "LimitRange", "ResourceQuota", + "NetworkPolicy", "Namespace", } diff --git a/pkg/tiller/kind_sorter_test.go b/pkg/tiller/kind_sorter_test.go index 3b37256ed..f4106f62e 100644 --- a/pkg/tiller/kind_sorter_test.go +++ b/pkg/tiller/kind_sorter_test.go @@ -157,6 +157,10 @@ func TestKindSorter(t *testing.T) { Name: "x", Head: &util.SimpleHead{Kind: "HorizontalPodAutoscaler"}, }, + { + Name: "B", + Head: &util.SimpleHead{Kind: "NetworkPolicy"}, + }, } for _, test := range []struct { @@ -164,8 +168,8 @@ func TestKindSorter(t *testing.T) { order SortOrder expected string }{ - {"install", InstallOrder, "abc3zde1fgh2iIjJkKlLmnopqrxstuvw!"}, - {"uninstall", UninstallOrder, "wvmutsxrqponLlKkJjIi2hgf1edz3cba!"}, + {"install", InstallOrder, "aBbc3zde1fgh2iIjJkKlLmnopqrxstuvw!"}, + {"uninstall", UninstallOrder, "wvmutsxrqponLlKkJjIi2hgf1edz3cbBa!"}, } { var buf bytes.Buffer t.Run(test.description, func(t *testing.T) { From 55ccdd040d8a6f244f1ebd93323c17a46aa890f7 Mon Sep 17 00:00:00 2001 From: Richard Connon Date: Fri, 12 Jul 2019 13:58:12 +0100 Subject: [PATCH 5/5] Use watcher with retries to wait for resources When waiting for resources use the `ListWatchUntil` instead of `UntilWithoutRetry` so that if the connection drops between tiller and the API while waiting the operation can still succeed. Signed-off-by: Richard Connon --- pkg/kube/client.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index aa6f54ae0..e78c10f2d 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -41,6 +41,7 @@ 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" @@ -51,6 +52,7 @@ import ( "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" + cachetools "k8s.io/client-go/tools/cache" watchtools "k8s.io/client-go/tools/watch" "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/apis/core" @@ -810,10 +812,7 @@ func getSelectorFromObject(obj runtime.Object) (map[string]string, bool) { } func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) error { - w, err := resource.NewHelper(info.Client, info.Mapping).WatchSingle(info.Namespace, info.Name, info.ResourceVersion) - if err != nil { - return err - } + lw := cachetools.NewListWatchFromClient(info.Client, info.Mapping.Resource.Resource, info.Namespace, fields.Everything()) kind := info.Mapping.GroupVersionKind.Kind c.Log("Watching for changes to %s %s with timeout of %v", kind, info.Name, timeout) @@ -826,7 +825,7 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout) defer cancel() - _, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) { + _, err := watchtools.ListWatchUntil(ctx, lw, 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 @@ -914,15 +913,12 @@ func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, } func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Info) error { - w, err := resource.NewHelper(info.Client, info.Mapping).WatchSingle(info.Namespace, info.Name, info.ResourceVersion) - if err != nil { - return err - } + lw := cachetools.NewListWatchFromClient(info.Client, info.Mapping.Resource.Resource, info.Namespace, fields.Everything()) c.Log("Watching pod %s for completion with timeout of %v", info.Name, timeout) ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout) defer cancel() - _, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) { + _, err := watchtools.ListWatchUntil(ctx, lw, func(e watch.Event) (bool, error) { return isPodComplete(e) })