Update helm-controller

Related to https://github.com/rancher/rke2/issues/271

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2020-09-02 10:17:04 -07:00
parent 866dc94cea
commit 733d26816a
5 changed files with 18 additions and 11 deletions

2
go.mod
View File

@ -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

4
go.sum
View File

@ -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=

View File

@ -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 {

View File

@ -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{

2
vendor/modules.txt vendored
View File

@ -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