Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm v2.17.0 for werf #61

Open
wants to merge 25 commits into
base: release-2.17
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
906f868
Customizable resources waiting behaviour for `kube.Client` struct
distorhead Apr 14, 2019
ad6c629
Added go.mod
distorhead Aug 12, 2019
f1cc356
3-way-merge: annotations mode
distorhead Aug 15, 2019
c89ace8
Control Chart.yaml validation of chart and sub charts
alexey-igrychev Aug 27, 2019
23b8653
[engine] Adding runtime chart templates functions
alexey-igrychev Sep 10, 2019
a10b754
[3-way-merge] Ignore resource *.resources and *.replicas fields optio…
alexey-igrychev Sep 18, 2019
dbe809c
[3-way-merge] Create two pass 3wm repair patch: fix false-positive re…
distorhead Sep 25, 2019
db2b5c6
[3-way-merge] Cut excess repair-patch fields, validate chart templates
distorhead Oct 16, 2019
c029f7f
[3-way-merge] Update option to use 3 way merge patch, adopt existing …
distorhead Oct 23, 2019
7d39799
[3-way-merge] No additional patches filtering when creating final 3wm…
distorhead Dec 11, 2019
370b5ee
Fix Printf format string
distorhead Dec 16, 2019
639b288
Use helm.sh/hook-delete-policy=before-hook-creation by default for al…
distorhead Feb 12, 2020
f323fd1
Update kubernetes lib dependencies 0.16.0->0.16.7
distorhead Feb 12, 2020
a6c68f9
Update gopkg/yaml to v3, github.com/ghodss/yaml to v1.0, use Unmarsha…
distorhead Feb 17, 2020
b203bf4
Fix "resource already exists" error on redeploy when new resource wit…
distorhead Feb 18, 2020
0c42502
Fix "resource already exists" error message when creating a helm.sh/h…
distorhead Feb 19, 2020
b973574
Do not allow resource adoption during initial release installation, f…
distorhead Feb 19, 2020
2384768
logboek@v0.3
alexey-igrychev Feb 18, 2020
61eed85
Revise helm debug log for werf v1.1
distorhead Mar 2, 2020
4d0c47a
Fix panic during sub chart validation
alexey-igrychev May 6, 2020
9aa4661
Update k8s dependencies, use golang 1.14
distorhead Jul 29, 2020
eeaecf2
[helm for werf] Remove errPending on upgrade
distorhead Nov 9, 2020
bd3efc6
Merge pull request #63 from werf/disableErrPending
distorhead Nov 9, 2020
295e772
[v2.17.0][helm for werf] Do not parse values with strict yaml parser …
distorhead Feb 2, 2021
81e74d4
Merge pull request #81 from werf/fixStrictValuesParsing
distorhead Feb 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions _proto/hapi/release/release.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ message Release {

// Namespace is the kubernetes namespace of the release.
string namespace = 8;

bool three_way_merge_enabled = 9;
bool resources_has_owner_release_name = 10;
}
9 changes: 9 additions & 0 deletions _proto/hapi/services/tiller.proto
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ message ListReleasesRequest {
string namespace = 7;
}

enum ThreeWayMergeMode {
enabled = 0;
disabled = 1;
onlyNewReleases = 2;
}

// ListSort defines sorting fields on a release list.
message ListSort{
// SortBy defines sort operations.
Expand Down Expand Up @@ -216,6 +222,7 @@ message UpdateReleaseRequest {
bool subNotes = 13;
// Allow deletion of new resources created in this update when update failed
bool cleanup_on_fail = 14;
ThreeWayMergeMode three_way_merge_mode = 15;
}

// UpdateReleaseResponse is the response to an update request.
Expand Down Expand Up @@ -245,6 +252,7 @@ message RollbackReleaseRequest {
string description = 9;
// Allow deletion of new resources created in this rollback when rollback failed
bool cleanup_on_fail = 10;
ThreeWayMergeMode three_way_merge_mode = 11;
}

// RollbackReleaseResponse is the response to an update request.
Expand Down Expand Up @@ -290,6 +298,7 @@ message InstallReleaseRequest {

bool subNotes = 12;

ThreeWayMergeMode three_way_merge_mode = 13;
}

// InstallReleaseResponse is the response from a release installation.
Expand Down
2 changes: 1 addition & 1 deletion cmd/helm/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func TestInitCmd_dryRun(t *testing.T) {
}
for _, doc := range docs {
var y map[string]interface{}
if err := yaml.Unmarshal(doc, &y); err != nil {
if err := yaml.UnmarshalStrict(doc, &y); err != nil {
t.Errorf("Expected parseable YAML, got %q\n\t%s", doc, err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/helm/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func vals(valueFiles valueFiles, values []string, stringValues []string, fileVal
return []byte{}, err
}

if err := yaml.Unmarshal(bytes, &currentMap); err != nil {
if err := yaml.UnmarshalStrict(bytes, &currentMap); err != nil {
return []byte{}, fmt.Errorf("failed to parse %s: %s", filePath, err)
}
// Merge with the previous map
Expand Down
23 changes: 12 additions & 11 deletions cmd/helm/installer/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ limitations under the License.
package installer // import "k8s.io/helm/cmd/helm/installer"

import (
"context"
"fmt"
"io/ioutil"
"strings"

"github.com/Masterminds/semver"
"github.com/ghodss/yaml"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -60,7 +61,7 @@ func Install(client kubernetes.Interface, opts *Options) error {
//
// Returns an error if the command failed.
func Upgrade(client kubernetes.Interface, opts *Options) error {
appsobj, err := client.AppsV1().Deployments(opts.Namespace).Get(deploymentName, metav1.GetOptions{})
appsobj, err := client.AppsV1().Deployments(opts.Namespace).Get(context.Background(), deploymentName, metav1.GetOptions{})
if err == nil {
// Can happen in two cases:
// 1. helm init inserted an apps/v1 Deployment up front in Kubernetes
Expand All @@ -70,7 +71,7 @@ func Upgrade(client kubernetes.Interface, opts *Options) error {
return upgradeAppsTillerDeployment(client, opts, appsobj)
}

extensionsobj, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Get(deploymentName, metav1.GetOptions{})
extensionsobj, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Get(context.Background(), deploymentName, metav1.GetOptions{})
if err == nil {
// User performed helm init against older version of kubernetes (Previous to 1.9)
return upgradeExtensionsTillerDeployment(client, opts, extensionsobj)
Expand All @@ -85,13 +86,13 @@ func upgradeAppsTillerDeployment(client kubernetes.Interface, opts *Options, obj
return err
}

if _, err := client.AppsV1().Deployments(opts.Namespace).Update(obj); err != nil {
if _, err := client.AppsV1().Deployments(opts.Namespace).Update(context.Background(), obj, metav1.UpdateOptions{}); err != nil {
return err
}

// 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{})
_, err := client.CoreV1().Services(opts.Namespace).Get(context.Background(), serviceName, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return createService(client.CoreV1(), opts.Namespace)
}
Expand All @@ -105,13 +106,13 @@ func upgradeExtensionsTillerDeployment(client kubernetes.Interface, opts *Option
return err
}

if _, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Update(obj); err != nil {
if _, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Update(context.Background(), obj, metav1.UpdateOptions{}); err != nil {
return err
}

// 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{})
_, err := client.CoreV1().Services(opts.Namespace).Get(context.Background(), serviceName, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return createService(client.CoreV1(), opts.Namespace)
}
Expand Down Expand Up @@ -166,7 +167,7 @@ func createDeployment(client appsv1client.DeploymentsGetter, opts *Options) erro
if err != nil {
return err
}
_, err = client.Deployments(obj.Namespace).Create(obj)
_, err = client.Deployments(obj.Namespace).Create(context.Background(), obj, metav1.CreateOptions{})
return err

}
Expand All @@ -189,7 +190,7 @@ func Deployment(opts *Options) (*appsv1.Deployment, error) {
// createService creates the Tiller service resource
func createService(client corev1.ServicesGetter, namespace string) error {
obj := generateService(namespace)
_, err := client.Services(obj.Namespace).Create(obj)
_, err := client.Services(obj.Namespace).Create(context.Background(), obj, metav1.CreateOptions{})
return err
}

Expand Down Expand Up @@ -378,7 +379,7 @@ func generateDeployment(opts *Options) (*appsv1.Deployment, error) {
return nil, fmt.Errorf("Error marshalling merged map to YAML: %s ", err)
}
// convert merged values back into deployment
err = yaml.Unmarshal(finalY, &dd)
err = yaml.UnmarshalStrict(finalY, &dd)
if err != nil {
return nil, fmt.Errorf("Error unmarshalling Values to Deployment manifest: %s ", err)
}
Expand Down Expand Up @@ -433,7 +434,7 @@ func createSecret(client corev1.SecretsGetter, opts *Options) error {
if err != nil {
return err
}
_, err = client.Secrets(o.Namespace).Create(o)
_, err = client.Secrets(o.Namespace).Create(context.Background(), o, metav1.CreateOptions{})
return err
}

Expand Down
8 changes: 5 additions & 3 deletions cmd/helm/installer/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package installer // import "k8s.io/helm/cmd/helm/installer"

import (
"context"

apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand All @@ -42,22 +44,22 @@ func Uninstall(client kubernetes.Interface, opts *Options) error {

// deleteService deletes the Tiller Service resource
func deleteService(client corev1.ServicesGetter, namespace string) error {
err := client.Services(namespace).Delete(serviceName, &metav1.DeleteOptions{})
err := client.Services(namespace).Delete(context.Background(), serviceName, metav1.DeleteOptions{})
return ingoreNotFound(err)
}

// deleteDeployment deletes the Tiller Deployment resource
func deleteDeployment(client kubernetes.Interface, namespace string) error {
policy := metav1.DeletePropagationBackground
err := client.AppsV1().Deployments(namespace).Delete(deploymentName, &metav1.DeleteOptions{
err := client.AppsV1().Deployments(namespace).Delete(context.Background(), deploymentName, metav1.DeleteOptions{
PropagationPolicy: &policy,
})
return ingoreNotFound(err)
}

// deleteSecret deletes the Tiller Secret resource
func deleteSecret(client corev1.SecretsGetter, namespace string) error {
err := client.Secrets(namespace).Delete(secretName, &metav1.DeleteOptions{})
err := client.Secrets(namespace).Delete(context.Background(), secretName, metav1.DeleteOptions{})
return ingoreNotFound(err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/helm/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (l *lintCmd) vals() ([]byte, error) {
return []byte{}, err
}

if err := yaml.Unmarshal(bytes, &currentMap); err != nil {
if err := yaml.UnmarshalStrict(bytes, &currentMap); err != nil {
return []byte{}, fmt.Errorf("failed to parse %s: %s", filePath, err)
}
// Merge with the previous map
Expand Down
115 changes: 115 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
module k8s.io/helm

require (
cloud.google.com/go v0.38.0
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78
github.com/Azure/go-autorest v13.0.1+incompatible
github.com/BurntSushi/toml v0.3.1
github.com/DATA-DOG/go-sqlmock v1.4.1
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd
github.com/Masterminds/goutils v1.1.0
github.com/Masterminds/semver v1.4.2
github.com/Masterminds/sprig v2.20.0+incompatible
github.com/Masterminds/vcs v1.11.1
github.com/Microsoft/hcsshim v0.8.6 // indirect
github.com/PuerkitoBio/purell v1.1.1
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5
github.com/containerd/containerd v1.2.3 // indirect
github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 // indirect
github.com/containerd/cri v1.11.1 // indirect
github.com/containerd/fifo v0.0.0-20190816180239-bda0ff6ed73c // indirect
github.com/cpuguy83/go-md2man v1.0.10
github.com/cyphar/filepath-securejoin v0.2.2
github.com/davecgh/go-spew v1.1.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96
github.com/emicklei/go-restful v2.9.5+incompatible
github.com/evanphx/json-patch v4.2.0+incompatible
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d
github.com/fatih/camelcase v1.0.0
github.com/flant/logboek v0.3.1
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/go-openapi/jsonpointer v0.19.3
github.com/go-openapi/jsonreference v0.19.2
github.com/go-openapi/spec v0.19.2
github.com/go-openapi/swag v0.19.5
github.com/gobwas/glob v0.2.3
github.com/gofrs/flock v0.7.1
github.com/gogo/googleapis v1.3.0 // indirect
github.com/gogo/protobuf v1.3.0
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903
github.com/golang/protobuf v1.3.1
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
github.com/google/go-cmp v0.3.0
github.com/google/gofuzz v1.0.0
github.com/google/uuid v1.1.1
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d
github.com/gophercloud/gophercloud v0.1.0
github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/hashicorp/golang-lru v0.5.1
github.com/heketi/rest v0.0.0-20180404230133-aa6a65207413 // indirect
github.com/heketi/utils v0.0.0-20170317161834-435bc5bdfa64 // indirect
github.com/huandu/xstrings v1.2.0
github.com/imdario/mergo v0.3.5
github.com/inconshreveable/mousetrap v1.0.0
github.com/jmoiron/sqlx v1.2.0
github.com/json-iterator/go v1.1.7
github.com/konsorten/go-windows-terminal-sequences v1.0.1
github.com/lib/pq v1.0.0
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e
github.com/mattn/go-runewidth v0.0.1
github.com/matttproud/golang_protobuf_extensions v1.0.1
github.com/mitchellh/go-wordwrap v1.0.0
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
github.com/modern-go/reflect2 v1.0.1
github.com/opencontainers/go-digest v1.0.0-rc1
github.com/peterbourgon/diskv v2.0.1+incompatible
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a
github.com/rubenv/sql-migrate v0.0.0-20190212093014-1007f53448d7
github.com/russross/blackfriday v1.5.2
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.3.0
github.com/technosophos/moniker v0.0.0-20180509230615-a5dbd03a2245
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037
golang.org/x/text v0.3.2
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
google.golang.org/appengine v1.5.0
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873
google.golang.org/grpc v1.23.0
gopkg.in/gorp.v1 v1.7.2
gopkg.in/inf.v0 v0.9.1
gopkg.in/square/go-jose.v2 v2.2.2
gopkg.in/yaml.v2 v2.2.8
gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71 // indirect

k8s.io/api v0.18.6
k8s.io/apiextensions-apiserver v0.18.6
k8s.io/apimachinery v0.18.6
k8s.io/cli-runtime v0.18.6
k8s.io/client-go v0.18.6
k8s.io/klog v1.0.0
k8s.io/kubectl v0.18.6
sigs.k8s.io/yaml v1.2.0
)

go 1.14