From 733d26816a202baf426e4a6030efd6ed76844c8c Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Wed, 2 Sep 2020 10:17:04 -0700 Subject: [PATCH] Update helm-controller Related to https://github.com/rancher/rke2/issues/271 Signed-off-by: Brad Davidson --- go.mod | 2 +- go.sum | 4 ++-- .../pkg/apis/helm.cattle.io/v1/types.go | 1 + .../helm-controller/pkg/helm/controller.go | 20 ++++++++++++------- vendor/modules.txt | 2 +- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 011504782b..818cf2a9ab 100644 --- a/go.mod +++ b/go.mod @@ -97,7 +97,7 @@ require ( github.com/pierrec/lz4 v2.5.2+incompatible github.com/pkg/errors v0.9.1 github.com/rancher/dynamiclistener v0.2.1 - github.com/rancher/helm-controller v0.7.2 + github.com/rancher/helm-controller v0.7.3 github.com/rancher/kine v0.4.0 github.com/rancher/remotedialer v0.2.0 github.com/rancher/spur v0.0.0-20200617165101-8702c8e4ce7a diff --git a/go.sum b/go.sum index a6ffc21b49..d2099608da 100644 --- a/go.sum +++ b/go.sum @@ -648,8 +648,8 @@ github.com/rancher/go-powershell v0.0.0-20200701182037-6845e6fcfa79 h1:UeC0rjrIe github.com/rancher/go-powershell v0.0.0-20200701182037-6845e6fcfa79/go.mod h1:xi4WpK6Op4m1Lknq61/e+VSjYlTs9bulVOaDNyBdzvk= github.com/rancher/go-powershell v0.0.0-20200701184732-233247d45373 h1:BePi97poJ4hXnkP9yX96EmNQgMg+dGScvB1sqIheJ7w= github.com/rancher/go-powershell v0.0.0-20200701184732-233247d45373/go.mod h1:Vz8oLnHgttpo/aZrTpjbcpZEDzzElqNau2zmorToY0E= -github.com/rancher/helm-controller v0.7.2 h1:noDPX08rnEoYhTGfgyLdEqG7DvihYbWJagbdS9OiA7s= -github.com/rancher/helm-controller v0.7.2/go.mod h1:ZylsxIMGNADRPRNW+NiBWhrwwks9vnKLQiCHYWb6Bi0= +github.com/rancher/helm-controller v0.7.3 h1:WTQHcNF2vl9w6Xd1eBtXDe0JUsYMFFstqX9ghGhI5Ac= +github.com/rancher/helm-controller v0.7.3/go.mod h1:ZylsxIMGNADRPRNW+NiBWhrwwks9vnKLQiCHYWb6Bi0= github.com/rancher/kine v0.4.0 h1:1IhWy3TzjExG8xnj46eyUEWdzqNAD1WrgL4eEBKm6Uc= github.com/rancher/kine v0.4.0/go.mod h1:IImtCJ68AIkE+VY/kUI0NkyJL5q5WzO8QvMsSXqbrpA= github.com/rancher/kubernetes v1.18.8-k3s1 h1:dqukpA38pR5V7opoTDDslVYIxlM3sP5535u3Zd23W2I= diff --git a/vendor/github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1/types.go b/vendor/github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1/types.go index cb8f4d6aa0..89e3568aff 100644 --- a/vendor/github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1/types.go +++ b/vendor/github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1/types.go @@ -26,6 +26,7 @@ type HelmChartSpec struct { HelmVersion string `json:"helmVersion,omitempty"` Bootstrap bool `json:"bootstrap,omitempty"` ChartContent string `json:"chartContent,omitempty"` + JobImage string `json:"jobImage,omitempty"` } type HelmChartStatus struct { diff --git a/vendor/github.com/rancher/helm-controller/pkg/helm/controller.go b/vendor/github.com/rancher/helm-controller/pkg/helm/controller.go index ec94214e82..dd72aa93b2 100644 --- a/vendor/github.com/rancher/helm-controller/pkg/helm/controller.go +++ b/vendor/github.com/rancher/helm-controller/pkg/helm/controller.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "sort" + "strings" helmv1 "github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1" helmcontroller "github.com/rancher/helm-controller/pkg/generated/controllers/helm.cattle.io/v1" @@ -38,12 +39,12 @@ type Controller struct { } const ( - image = "rancher/klipper-helm:v0.3.0" - Label = "helmcharts.helm.cattle.io/chart" - Annotation = "helmcharts.helm.cattle.io/configHash" - CRDName = "helmcharts.helm.cattle.io" - ConfigCRDName = "helmchartconfigs.helm.cattle.io" - Name = "helm-controller" + DefaultJobImage = "rancher/klipper-helm:v0.3.0" + Label = "helmcharts.helm.cattle.io/chart" + Annotation = "helmcharts.helm.cattle.io/configHash" + CRDName = "helmcharts.helm.cattle.io" + ConfigCRDName = "helmchartconfigs.helm.cattle.io" + Name = "helm-controller" ) func Register(ctx context.Context, apply apply.Apply, @@ -183,6 +184,11 @@ func (c *Controller) OnConfChange(key string, conf *helmv1.HelmChartConfig) (*he func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap) { oneThousand := int32(1000) + jobImage := strings.TrimSpace(chart.Spec.JobImage) + if jobImage == "" { + jobImage = DefaultJobImage + } + action := "install" if chart.DeletionTimestamp != nil { action = "delete" @@ -214,7 +220,7 @@ func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap) Containers: []core.Container{ { Name: "helm", - Image: image, + Image: jobImage, ImagePullPolicy: core.PullIfNotPresent, Args: args(chart), Env: []core.EnvVar{ diff --git a/vendor/modules.txt b/vendor/modules.txt index e87eb850da..fffbd4253a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -739,7 +739,7 @@ github.com/rancher/dynamiclistener/storage/memory # github.com/rancher/go-powershell v0.0.0-20200701182037-6845e6fcfa79 github.com/rancher/go-powershell/backend github.com/rancher/go-powershell/utils -# github.com/rancher/helm-controller v0.7.2 +# github.com/rancher/helm-controller v0.7.3 github.com/rancher/helm-controller/pkg/apis/helm.cattle.io github.com/rancher/helm-controller/pkg/apis/helm.cattle.io/v1 github.com/rancher/helm-controller/pkg/generated/clientset/versioned