Bump helm-controller to v0.10.1 (#3644)

Signed-off-by: Chris Kim <oats87g@gmail.com>
This commit is contained in:
Chris Kim 2021-07-15 11:31:44 -07:00 committed by GitHub
parent d597511a1c
commit ad28d18b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 15 deletions

2
go.mod
View File

@ -84,7 +84,7 @@ require (
github.com/google/uuid v1.2.0
github.com/gorilla/mux v1.8.0
github.com/gorilla/websocket v1.4.2
github.com/k3s-io/helm-controller v0.9.1
github.com/k3s-io/helm-controller v0.10.1
github.com/k3s-io/kine v0.6.2
github.com/klauspost/compress v1.12.2
github.com/kubernetes-sigs/cri-tools v0.0.0-00010101000000-000000000000

8
go.sum
View File

@ -499,8 +499,6 @@ github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ=
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
inet.af/tcpproxy v0.0.0-20200125044825-b6bb9b5b8252 h1:gmJCKidOfjKDUHF1jjke+I+2iQIyE3HNNxu2OKO/FUI=
inet.af/tcpproxy v0.0.0-20200125044825-b6bb9b5b8252/go.mod h1:zq+R+tLcdHugi7Jt+FtIQY6m6wtX34lr2CdQVH2fhW0=
github.com/insomniacslk/dhcp v0.0.0-20210120172423-cc9239ac6294/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
github.com/ishidawataru/sctp v0.0.0-20190723014705-7c296d48a2b5/go.mod h1:DM4VvS+hD/kDi1U1QsX2fnZowwBhqD0Dk3bRPKF/Oc8=
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
@ -541,8 +539,8 @@ github.com/k3s-io/cri-tools v1.21.0-k3s1 h1:MWQtAsx4HCNXenqU/B4V9eU6HMyafkd1PnW6
github.com/k3s-io/cri-tools v1.21.0-k3s1/go.mod h1:Qsz54zxINPR+WVWX9Kc3CTmuDFB1dNLCNV8jE8lUbtU=
github.com/k3s-io/etcd v0.5.0-alpha.5.0.20201208200253-50621aee4aea h1:7cwby0GoNAi8IsVrT0q+JfQpB6V76ZaEGhj6qts/mvU=
github.com/k3s-io/etcd v0.5.0-alpha.5.0.20201208200253-50621aee4aea/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg=
github.com/k3s-io/helm-controller v0.9.1 h1:qtHWTNHiuCPRbA2YZ7z7jTgSHo7Yc5He52oMga72yUk=
github.com/k3s-io/helm-controller v0.9.1/go.mod h1:nZP8FH3KZrNNUf5r+SwwiMR63HS6lxdHdpHijgPfF74=
github.com/k3s-io/helm-controller v0.10.1 h1:w98iQsKfA5RnvzdVzU4LTDuLzA3SyoN31ebDUKQUDpM=
github.com/k3s-io/helm-controller v0.10.1/go.mod h1:nZP8FH3KZrNNUf5r+SwwiMR63HS6lxdHdpHijgPfF74=
github.com/k3s-io/kine v0.6.2 h1:1aJTPfB8HG4exqMKFVE5H0z4bepF05tJHtYNXotWXa4=
github.com/k3s-io/kine v0.6.2/go.mod h1:rzCs93+rQHZGOiewMd84PDrER92QeZ6eeHbWkfEy4+w=
github.com/k3s-io/kubernetes v1.21.2-k3s1 h1:e5R77BWsEEiZqoZ68t9iKF08KwSVBqASwy4N9Uq4FHw=
@ -1221,6 +1219,8 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
inet.af/tcpproxy v0.0.0-20200125044825-b6bb9b5b8252 h1:gmJCKidOfjKDUHF1jjke+I+2iQIyE3HNNxu2OKO/FUI=
inet.af/tcpproxy v0.0.0-20200125044825-b6bb9b5b8252/go.mod h1:zq+R+tLcdHugi7Jt+FtIQY6m6wtX34lr2CdQVH2fhW0=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20191120174120-e74f70b9b27e/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=

View File

@ -1,5 +1,5 @@
docker.io/rancher/coredns-coredns:1.8.3
docker.io/rancher/klipper-helm:v0.5.0-build20210505
docker.io/rancher/klipper-helm:v0.6.1-build20210616
docker.io/rancher/klipper-lb:v0.2.0
docker.io/rancher/library-busybox:1.32.1
docker.io/rancher/library-traefik:2.4.8

View File

@ -27,6 +27,7 @@ type HelmChartSpec struct {
Bootstrap bool `json:"bootstrap,omitempty"`
ChartContent string `json:"chartContent,omitempty"`
JobImage string `json:"jobImage,omitempty"`
Timeout *metav1.Duration `json:"timeout,omitempty"`
}
type HelmChartStatus struct {

View File

@ -21,6 +21,7 @@ limitations under the License.
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
)
@ -172,6 +173,11 @@ func (in *HelmChartSpec) DeepCopyInto(out *HelmChartSpec) {
(*out)[key] = val
}
}
if in.Timeout != nil {
in, out := &in.Timeout, &out.Timeout
*out = new(metav1.Duration)
**out = **in
}
return
}

View File

@ -30,7 +30,7 @@ import (
var (
trueVal = true
commaRE = regexp.MustCompile(`\\*,`)
DefaultJobImage = "rancher/klipper-helm:v0.5.0-build20210505"
DefaultJobImage = "rancher/klipper-helm:v0.6.1-build20210616"
)
type Controller struct {
@ -272,23 +272,40 @@ func job(chart *helmv1.HelmChart) (*batch.Job, *core.ConfigMap, *core.ConfigMap)
},
}
if chart.Spec.Timeout != nil {
job.Spec.Template.Spec.Containers[0].Env = append(job.Spec.Template.Spec.Containers[0].Env, core.EnvVar{
Name: "TIMEOUT",
Value: chart.Spec.Timeout.String(),
})
}
if chart.Spec.Bootstrap {
job.Spec.Template.Spec.HostNetwork = true
job.Spec.Template.Spec.Tolerations = []core.Toleration{
{
Key: "node.kubernetes.io/not-ready",
Effect: "NoSchedule",
Effect: core.TaintEffectNoSchedule,
},
{
Key: "node.cloudprovider.kubernetes.io/uninitialized",
Operator: core.TolerationOpEqual,
Value: "true",
Effect: "NoSchedule",
Effect: core.TaintEffectNoSchedule,
},
{
Key: "CriticalAddonsOnly",
Operator: core.TolerationOpExists,
},
{
Key: "node-role.kubernetes.io/etcd",
Operator: core.TolerationOpExists,
Effect: core.TaintEffectNoExecute,
},
{
Key: "node-role.kubernetes.io/control-plane",
Operator: core.TolerationOpExists,
Effect: core.TaintEffectNoSchedule,
},
}
job.Spec.Template.Spec.Containers[0].Env = append(job.Spec.Template.Spec.Containers[0].Env, []core.EnvVar{
{
@ -399,12 +416,10 @@ func args(chart *helmv1.HelmChart) []string {
for _, k := range keys(spec.Set) {
val := spec.Set[k]
if val.StrVal == "false" || val.StrVal == "true" {
args = append(args, "--set", fmt.Sprintf("%s=%s", k, val.StrVal))
} else if val.StrVal != "" {
args = append(args, "--set-string", fmt.Sprintf("%s=%s", k, commaRE.ReplaceAllStringFunc(val.StrVal, escapeComma)))
if typedVal(val) {
args = append(args, "--set", fmt.Sprintf("%s=%s", k, val.String()))
} else {
args = append(args, "--set", fmt.Sprintf("%s=%d", k, val.IntVal))
args = append(args, "--set-string", fmt.Sprintf("%s=%s", k, commaRE.ReplaceAllStringFunc(val.String(), escapeComma)))
}
}
@ -420,6 +435,21 @@ func keys(val map[string]intstr.IntOrString) []string {
return keys
}
// typedVal is a modified version of helm's typedVal function that operates on kubernetes IntOrString types.
// Things that look like an integer, boolean, or null should use --set; everything else should use --set-string.
// Ref: https://github.com/helm/helm/blob/v3.5.4/pkg/strvals/parser.go#L415
func typedVal(val intstr.IntOrString) bool {
if intstr.Int == val.Type {
return true
}
switch strings.ToLower(val.StrVal) {
case "true", "false", "null":
return true
default:
return false
}
}
// escapeComma should be passed a string consisting of zero or more backslashes, followed by a comma.
// If there are an even number of characters (such as `\,` or `\\\,`) then the comma is escaped.
// If there are an uneven number of characters (such as `,` or `\\,` then the comma is not escaped,

2
vendor/modules.txt vendored
View File

@ -691,7 +691,7 @@ github.com/jmespath/go-jmespath
github.com/jonboulle/clockwork
# github.com/json-iterator/go v1.1.10
github.com/json-iterator/go
# github.com/k3s-io/helm-controller v0.9.1
# github.com/k3s-io/helm-controller v0.10.1
## explicit
github.com/k3s-io/helm-controller/pkg/apis/helm.cattle.io
github.com/k3s-io/helm-controller/pkg/apis/helm.cattle.io/v1