Bump helm-controller to v0.10.2

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/3777/head
Brad Davidson 2021-08-04 11:29:26 -07:00 committed by Brad Davidson
parent 99eadcc10b
commit f72e2cb3ea
10 changed files with 75 additions and 24 deletions

2
go.mod
View File

@ -85,7 +85,7 @@ require (
github.com/google/uuid v1.2.0 github.com/google/uuid v1.2.0
github.com/gorilla/mux v1.7.4 github.com/gorilla/mux v1.7.4
github.com/gorilla/websocket v1.4.1 github.com/gorilla/websocket v1.4.1
github.com/k3s-io/helm-controller v0.8.3 github.com/k3s-io/helm-controller v0.10.3
github.com/k3s-io/kine v0.6.2 github.com/k3s-io/kine v0.6.2
github.com/kubernetes-sigs/cri-tools v0.0.0-00010101000000-000000000000 github.com/kubernetes-sigs/cri-tools v0.0.0-00010101000000-000000000000
github.com/lib/pq v1.8.0 github.com/lib/pq v1.8.0

4
go.sum
View File

@ -468,8 +468,8 @@ github.com/k3s-io/cri v1.4.0-k3s.7 h1:1ycdF3dMDJMW/k/UxDC6eMsyGSMZ/p0AoUBVdJvNGQ
github.com/k3s-io/cri v1.4.0-k3s.7/go.mod h1:fGPUUHMKQik/vIegSe05DtX/m4miovdtvVLqRUFAkK0= github.com/k3s-io/cri v1.4.0-k3s.7/go.mod h1:fGPUUHMKQik/vIegSe05DtX/m4miovdtvVLqRUFAkK0=
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 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/etcd v0.5.0-alpha.5.0.20201208200253-50621aee4aea/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg=
github.com/k3s-io/helm-controller v0.8.3 h1:GWxavyMz7Bw2ClxH5okkeOL8o5U6IBK7uauc44SDCjU= github.com/k3s-io/helm-controller v0.10.3 h1:P4VK98VzTSjReQfmjOk0se437dWbdqIRVfuXFNoR6/8=
github.com/k3s-io/helm-controller v0.8.3/go.mod h1:nZP8FH3KZrNNUf5r+SwwiMR63HS6lxdHdpHijgPfF74= github.com/k3s-io/helm-controller v0.10.3/go.mod h1:nZP8FH3KZrNNUf5r+SwwiMR63HS6lxdHdpHijgPfF74=
github.com/k3s-io/kine v0.6.2 h1:1aJTPfB8HG4exqMKFVE5H0z4bepF05tJHtYNXotWXa4= 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/kine v0.6.2/go.mod h1:rzCs93+rQHZGOiewMd84PDrER92QeZ6eeHbWkfEy4+w=
github.com/k3s-io/kubernetes v1.19.13-k3s1 h1:Kl++d1Z1z21THbkAgMrnnPH5xqKNEg5jyNxn+YR1QHw= github.com/k3s-io/kubernetes v1.19.13-k3s1 h1:Kl++d1Z1z21THbkAgMrnnPH5xqKNEg5jyNxn+YR1QHw=

View File

@ -75,7 +75,7 @@ spec:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: HELPER_IMAGE - name: HELPER_IMAGE
value: rancher/library-busybox:1.31.1 value: rancher/library-busybox:1.32.1
volumes: volumes:
- name: config-volume - name: config-volume
configMap: configMap:

View File

@ -130,7 +130,7 @@ func corednsYaml() (*asset, error) {
return a, nil return a, nil
} }
var _localStorageYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\x4b\x6f\xe3\x36\x10\xbe\xeb\x57\x10\x02\xf6\x52\x2c\xe5\x35\xda\x43\xc1\x9b\xeb\xc7\x6e\x00\xbf\x60\xa7\xed\x21\x58\x18\x14\x35\xb6\xb9\xa1\x48\x81\x1c\xa9\xeb\x6e\xf3\xdf\x0b\xea\xe1\x48\x96\x93\x38\x28\xca\x8b\xec\xe1\xbc\xf8\xcd\x37\x43\xf2\x4c\xfe\x01\xd6\x49\xa3\x19\x29\x86\xc1\xa3\xd4\x09\x23\x5b\xb0\x85\x14\x30\x12\xc2\xe4\x1a\x83\x14\x90\x27\x1c\x39\x0b\x08\xd1\x3c\x05\x46\x94\x11\x5c\xd1\x8c\xe3\x91\x66\xd6\x14\xd2\xdb\x83\xa5\xae\xb2\xa3\xbc\x36\xac\xd4\x5d\xc6\x05\x30\xf2\x98\xc7\x40\xdd\xc9\x21\xa4\x01\xa5\x34\x68\x47\xb6\x31\x17\x11\xcf\xf1\x68\xac\xfc\x9b\xa3\x34\x3a\x7a\xfc\xd5\x45\xd2\x0c\x8a\x61\x0c\xc8\x9b\xc4\xc6\x2a\x77\x08\x76\x63\x14\xdc\x9e\x95\xf5\xda\x36\x57\xe0\x58\x40\x09\xcf\xe4\x67\x6b\xf2\xcc\x31\xf2\x10\x86\x5f\x03\x42\x2c\x38\x93\x5b\x01\xa5\x44\x9b\x04\x5c\xf8\x91\x84\x99\xcf\xcd\x21\x68\x2c\x8c\xca\x53\x10\x8a\xcb\xd4\x95\x06\x05\xd8\xb8\x54\x3e\x00\x7a\x55\x25\x5d\xf9\xfd\x8b\xa3\x38\x86\x5f\xdf\x0e\x02\x3a\xc9\x8c\xd4\x78\x35\x50\x25\x34\xc9\x45\xac\x9f\x6e\x72\x5c\x80\xf7\xda\x31\x14\x16\x38\x42\xe9\xf4\x7a\x7e\x0e\x8d\xe5\x07\xa8\x11\xef\x3b\xad\xf7\x85\xe2\xce\xc1\x8d\x08\xfc\xf7\xfa\xfe\x26\x75\x22\xf5\xe1\xf6\x32\xc7\x52\x27\x81\xaf\xf5\x06\xf6\x5e\xb9\x39\xe3\x2b\xd1\x03\x42\xfa\xbc\xba\x85\x4d\x2e\x8f\xbf\x81\xc0\x92\x50\x57\x5b\xe6\xff\x6a\x14\x9e\x65\x6e\x70\xee\xd3\x09\x64\xca\x9c\x52\x78\x47\x8f\xbe\x1c\xca\x65\x20\x58\x59\xfb\x4c\x49\xc1\x1d\x23\xc3\x80\x10\x07\x0a\x04\x1a\xeb\x77\x08\x49\x7d\x7d\xe7\x3c\x06\xe5\x2a\x81\x87\x39\x7b\x25\x16\x42\x9a\x29\x8e\x50\x9b\xb7\x92\xf4\x4b\x75\x3c\xbd\xe5\x8b\x90\x26\xc5\xf2\x77\x07\xf0\xe5\xfb\xd0\xf6\x0b\x8d\x02\x5b\xb2\xa1\x95\x01\x21\x94\x3c\xc2\x89\x91\x70\x6c\x25\x4a\xc1\xd5\x28\x49\x8c\x76\x2b\xad\x4e\x61\x4b\x8b\x10\x93\x79\x6b\x63\x19\x09\xa7\xdf\xa5\x43\x17\x5e\x71\xe2\xa7\x49\xc9\x98\xc8\x23\x6d\x35\x20\x94\xac\x4f\xb9\xa7\xdb\x3b\x1c\x12\x02\xfb\x3d\x08\x64\x24\x5c\x9a\xad\x38\x42\x92\x2b\x68\x14\x84\xd1\xc8\xa5\x06\x7b\x3e\x08\x7d\x8b\x03\xd5\x92\x29\x3f\x00\x23\x96\x6b\x71\x04\x3b\xb8\xae\xcd\x8a\x4f\xd1\xa7\x68\xf8\x4b\xd7\x6a\x9d\x2b\xb5\x36\x4a\x8a\x13\x23\x77\xfb\xa5\xc1\xb5\x05\x07\x67\x70\x7d\x52\x69\xca\x75\xf2\x0c\x2d\x7d\x2b\x1b\x4a\x1c\x72\x8b\xad\xff\x94\x0a\xa3\xf7\xf2\xd0\x12\x0d\x00\xc5\xa0\x92\xd6\x9f\xe8\x9b\x33\xfa\xac\x51\xcd\xd0\x85\xaf\xb3\x6b\xc7\xae\xf0\xa8\x2c\x68\xa5\xd4\x82\x37\xf5\xfa\x6b\x8e\x47\xd6\x09\x70\xd6\x00\x5d\xf4\x9d\xad\x57\x93\xdd\x72\xb4\x98\x6e\xd7\xa3\xf1\xb4\xe5\xac\xe0\x2a\x87\x99\x35\x29\xeb\x14\x70\x2f\x41\x25\xf5\x6c\xea\xc9\xab\xd8\x4d\x7f\x44\xe7\x16\xed\x05\xfd\x32\x9d\xaf\xa7\x9b\xdd\xdd\x62\xf4\xb9\x17\xb3\x55\x49\x19\x5b\x6e\x4f\x34\xce\xdd\x29\x36\xdf\xd9\x30\xfa\x79\x18\x0d\x83\x36\x44\xef\x40\xa7\x92\x2f\x78\xd6\x4d\xbd\x47\xb1\xba\x58\x97\x33\xab\x7b\xbf\x3c\x4f\xaf\x6d\x25\x1f\xfb\x7b\xe5\xd5\xf9\xe5\x87\xb9\xd6\x06\xdb\xcd\xda\xbe\x94\x2e\x9a\x4b\x3a\x9a\xc0\x9e\xe7\x0a\x69\xb9\xcd\x48\x88\x36\x87\x30\x68\x93\xba\x81\xca\x1b\xb4\x22\x55\x67\xaf\xef\x9e\x85\x49\x80\x91\x3f\xb9\xc4\x99\xb1\x33\x69\x1d\x8e\x8d\x76\x79\x0a\x36\xb0\xd5\x7b\xa0\xe9\x80\x09\x28\x40\x28\x4f\x5e\x5f\x28\x0d\x64\xc1\xc5\x03\xeb\xd5\x39\x7d\x66\xfb\x0b\x23\xba\x31\x6c\x11\x9f\x91\x7f\xe8\xb9\x2a\x3f\x2e\xa8\x45\xaa\x09\xe4\xc9\xb5\xe0\x59\xc8\x1e\x7a\xfb\x7d\x8b\x8e\x65\xc8\xc2\xc9\x74\x36\xfa\x7d\x7e\xbf\x5b\x8f\xee\xbf\xec\x66\xab\xcd\x6e\xb9\x5a\xee\xe6\x77\xdb\xfb\xe9\x64\xb7\x5c\x4d\xa6\xdb\xf0\xe3\xcb\x3e\xfc\xa9\x5c\xc8\x1e\xc2\x0f\x3f\x1a\x3f\xf3\xd5\x78\x34\xdf\x6d\xef\x57\x9b\xd1\xe7\x69\xe9\xf5\xe9\x43\xf9\xa6\xe8\xae\xa7\x9e\xe4\x59\xe7\x29\xf8\x37\x00\x00\xff\xff\xb5\xc6\x5c\xc0\xb6\x0a\x00\x00") var _localStorageYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\x4b\x6f\xe3\x36\x10\xbe\xeb\x57\x10\x02\xf6\x52\x2c\x95\x75\xdb\x43\xc1\x9b\xeb\x47\x36\x80\x5f\xb0\xd3\xf6\x10\x2c\x0c\x8a\x1a\xdb\xdc\x50\xa4\x40\x8e\xd4\x75\xb7\xf9\xef\x05\xf5\x70\x24\xcb\x49\x1c\x14\xcb\x8b\xec\xe1\xbc\xf8\xcd\x37\x43\xf2\x4c\xfe\x09\xd6\x49\xa3\x19\x29\x06\xc1\xa3\xd4\x09\x23\x1b\xb0\x85\x14\x30\x14\xc2\xe4\x1a\x83\x14\x90\x27\x1c\x39\x0b\x08\xd1\x3c\x05\x46\x94\x11\x5c\xd1\x8c\xe3\x81\x66\xd6\x14\xd2\xdb\x83\xa5\xae\xb2\xa3\xbc\x36\xac\xd4\x5d\xc6\x05\x30\xf2\x98\xc7\x40\xdd\xd1\x21\xa4\x01\xa5\x34\x68\x47\xb6\x31\x17\x11\xcf\xf1\x60\xac\xfc\x87\xa3\x34\x3a\x7a\xfc\xcd\x45\xd2\xdc\x14\x83\x18\x90\x37\x89\x8d\x54\xee\x10\xec\xda\x28\xb8\x3e\x2b\xeb\xb5\x6d\xae\xc0\xb1\x80\x12\x9e\xc9\x5b\x6b\xf2\xcc\x31\xf2\x10\x86\x5f\x02\x42\x2c\x38\x93\x5b\x01\xa5\x44\x9b\x04\x5c\xf8\x91\x84\x99\xcf\xcd\x21\x68\x2c\x8c\xca\x53\x10\x8a\xcb\xd4\x95\x06\x05\xd8\xb8\x54\xde\x03\x7a\x55\x25\x5d\xf9\xfd\x9b\xa3\x38\x84\x5f\xde\x0e\x02\x3a\xc9\x8c\xd4\x78\x31\x50\x25\x34\xc9\x59\xac\x9f\xae\x72\x5c\x80\xf7\xda\x31\x14\x16\x38\x42\xe9\xf4\x72\x7e\x0e\x8d\xe5\x7b\xa8\x11\xef\x3b\xad\xf7\x85\xe2\xce\xc1\x95\x08\xfc\xff\xfa\xfe\x2e\x75\x22\xf5\xfe\xfa\x32\xc7\x52\x27\x81\xaf\xf5\x1a\x76\x5e\xb9\x39\xe3\x2b\xd1\x03\x42\xfa\xbc\xba\x86\x4d\x2e\x8f\xbf\x82\xc0\x92\x50\x17\x5b\xe6\x47\x35\x0a\xcf\x32\x77\x73\xea\xd3\x31\x64\xca\x1c\x53\x78\x47\x8f\xbe\x1c\xca\x65\x20\x58\x59\xfb\x4c\x49\xc1\x1d\x23\x83\x80\x10\x07\x0a\x04\x1a\xeb\x77\x08\x49\x7d\x7d\x67\x3c\x06\xe5\x2a\x81\x87\x39\x7b\x25\x16\x42\x9a\x29\x8e\x50\x9b\xb7\x92\xf4\x4b\x75\x3c\xbd\xe5\x8b\x90\x26\xc5\xf2\x77\x07\xf0\xc5\xfb\xd0\xf6\x0b\x8d\x02\x5b\xb2\xa1\x95\x01\x21\x94\x3c\xc2\x91\x91\x70\x64\x25\x4a\xc1\xd5\x30\x49\x8c\x76\x4b\xad\x8e\x61\x4b\x8b\x10\x93\x79\x6b\x63\x19\x09\x27\xdf\xa4\x43\x17\x5e\x70\xe2\xa7\x49\xc9\x98\xc8\x23\x6d\x35\x20\x94\xac\x4f\xb9\xa7\xdb\x3b\x1c\x12\x02\xbb\x1d\x08\x64\x24\x5c\x98\x8d\x38\x40\x92\x2b\x68\x14\x84\xd1\xc8\xa5\x06\x7b\x3a\x08\x7d\x8b\x03\xd5\x92\x29\xdf\x03\x23\x96\x6b\x71\x00\x7b\x73\x59\x9b\x15\x9f\xa2\x4f\xd1\xe0\xd7\xae\xd5\x2a\x57\x6a\x65\x94\x14\x47\x46\xee\x76\x0b\x83\x2b\x0b\x0e\x4e\xe0\xfa\xa4\xd2\x94\xeb\xe4\x19\x5a\xfa\x56\x36\x94\x38\xe4\x16\x5b\xff\x29\x15\x46\xef\xe4\xbe\x25\xba\x01\x14\x37\x95\xb4\xfe\x44\x5f\x9d\xd1\x27\x8d\x6a\x86\xce\x7d\x9d\x5d\x3b\x76\x85\x47\x65\x41\x2b\xa5\x16\xbc\xa9\xd7\x5f\x71\x3c\xb0\x4e\x80\x93\x06\xe8\xa2\xef\x6c\xb5\x1c\x6f\x17\xc3\xf9\x64\xb3\x1a\x8e\x26\x2d\x67\x05\x57\x39\x4c\xad\x49\x59\xa7\x80\x3b\x09\x2a\xa9\x67\x53\x4f\x5e\xc5\x6e\xfa\x23\x3a\xb5\x68\x2f\xe8\xe7\xc9\x6c\x35\x59\x6f\xef\xe6\xc3\xdb\x5e\xcc\x56\x25\x65\x6c\xb9\x3d\xd2\x38\x77\xc7\xd8\x7c\x63\x83\xe8\x97\x9f\xa3\x41\xd0\x86\xe8\x1d\xe8\x54\xf2\x39\xcf\xba\xa9\xf7\x28\x56\x17\xeb\x7c\x66\x75\xef\x97\xe7\xe9\xb5\xa9\xe4\x23\x7f\xaf\xbc\x3a\xbf\xfc\x30\xd7\xda\x60\xbb\x59\xdb\x97\xd2\x59\x73\x49\x47\x13\xd8\xf1\x5c\x21\x2d\xb7\x19\x09\xd1\xe6\x10\x06\x6d\x52\x37\x50\x79\x83\x56\xa4\xea\xec\xf5\xdd\x33\x37\x09\x30\xf2\x17\x97\x38\x35\x76\x2a\xad\xc3\x91\xd1\x2e\x4f\xc1\x06\xb6\x7a\x0f\x34\x1d\x30\x06\x05\x08\xe5\xc9\xeb\x0b\xa5\x81\x2c\x38\x7b\x60\xbd\x3a\xa7\x4f\x6c\x7f\x61\x44\x37\x86\x2d\xe2\x33\xf2\x2f\x3d\x55\xe5\xfb\x19\xb5\x48\x35\x81\x3c\xb9\xe6\x3c\x0b\xd9\x43\x6f\xbf\x6f\xd1\xb1\x0c\x59\x38\x9e\x4c\x87\x7f\xcc\xee\xb7\xab\xe1\xfd\xe7\xed\x74\xb9\xde\x2e\x96\x8b\xed\xec\x6e\x73\x3f\x19\x6f\x17\xcb\xf1\x64\x13\x7e\x7c\xd9\x87\x3f\x95\x0b\xd9\x43\xf8\xe1\x7b\xe3\x67\xb6\x1c\x0d\x67\xdb\xcd\xfd\x72\x3d\xbc\x9d\x94\x5e\x9f\x3e\x94\x6f\x8a\xee\x7a\xea\x49\x9e\x75\x9e\x82\xff\x02\x00\x00\xff\xff\xdd\x9c\x33\xc3\xb6\x0a\x00\x00")
func localStorageYamlBytes() ([]byte, error) { func localStorageYamlBytes() ([]byte, error) {
return bindataRead( return bindataRead(

View File

@ -34,7 +34,7 @@ var (
) )
const ( const (
image = "rancher/klipper-lb:v0.1.2" image = "rancher/klipper-lb:v0.2.0"
Ready = condition.Cond("Ready") Ready = condition.Cond("Ready")
) )

View File

@ -1,7 +1,7 @@
docker.io/rancher/coredns-coredns:1.8.3 docker.io/rancher/coredns-coredns:1.8.3
docker.io/rancher/klipper-helm:v0.4.3 docker.io/rancher/klipper-helm:v0.6.3-build20210804
docker.io/rancher/klipper-lb:v0.1.2 docker.io/rancher/klipper-lb:v0.2.0
docker.io/rancher/library-busybox:1.31.1 docker.io/rancher/library-busybox:1.32.1
docker.io/rancher/library-traefik:1.7.19 docker.io/rancher/library-traefik:1.7.19
docker.io/rancher/local-path-provisioner:v0.0.14 docker.io/rancher/local-path-provisioner:v0.0.14
docker.io/rancher/metrics-server:v0.3.6 docker.io/rancher/metrics-server:v0.3.6

View File

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

View File

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

View File

@ -5,6 +5,7 @@ import (
"crypto/sha256" "crypto/sha256"
"fmt" "fmt"
"os" "os"
"regexp"
"sort" "sort"
"strings" "strings"
@ -27,7 +28,9 @@ import (
) )
var ( var (
trueVal = true trueVal = true
commaRE = regexp.MustCompile(`\\*,`)
DefaultJobImage = "rancher/klipper-helm:v0.6.3-build20210804"
) )
type Controller struct { type Controller struct {
@ -39,12 +42,11 @@ type Controller struct {
} }
const ( const (
DefaultJobImage = "rancher/klipper-helm:v0.4.3" Label = "helmcharts.helm.cattle.io/chart"
Label = "helmcharts.helm.cattle.io/chart" Annotation = "helmcharts.helm.cattle.io/configHash"
Annotation = "helmcharts.helm.cattle.io/configHash" CRDName = "helmcharts.helm.cattle.io"
CRDName = "helmcharts.helm.cattle.io" ConfigCRDName = "helmchartconfigs.helm.cattle.io"
ConfigCRDName = "helmchartconfigs.helm.cattle.io" Name = "helm-controller"
Name = "helm-controller"
) )
func Register(ctx context.Context, apply apply.Apply, func Register(ctx context.Context, apply apply.Apply,
@ -270,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 { if chart.Spec.Bootstrap {
job.Spec.Template.Spec.HostNetwork = true job.Spec.Template.Spec.HostNetwork = true
job.Spec.Template.Spec.Tolerations = []core.Toleration{ job.Spec.Template.Spec.Tolerations = []core.Toleration{
{ {
Key: "node.kubernetes.io/not-ready", Key: "node.kubernetes.io/not-ready",
Effect: "NoSchedule", Effect: core.TaintEffectNoSchedule,
}, },
{ {
Key: "node.cloudprovider.kubernetes.io/uninitialized", Key: "node.cloudprovider.kubernetes.io/uninitialized",
Operator: core.TolerationOpEqual, Operator: core.TolerationOpEqual,
Value: "true", Value: "true",
Effect: "NoSchedule", Effect: core.TaintEffectNoSchedule,
}, },
{ {
Key: "CriticalAddonsOnly", Key: "CriticalAddonsOnly",
Operator: core.TolerationOpExists, 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{ job.Spec.Template.Spec.Containers[0].Env = append(job.Spec.Template.Spec.Containers[0].Env, []core.EnvVar{
{ {
@ -397,12 +416,10 @@ func args(chart *helmv1.HelmChart) []string {
for _, k := range keys(spec.Set) { for _, k := range keys(spec.Set) {
val := spec.Set[k] val := spec.Set[k]
if val.StrVal == "false" || val.StrVal == "true" { if typedVal(val) {
args = append(args, "--set", fmt.Sprintf("%s=%s", k, val.StrVal)) args = append(args, "--set", fmt.Sprintf("%s=%s", k, val.String()))
} else if val.StrVal != "" {
args = append(args, "--set-string", fmt.Sprintf("%s=%s", k, val.StrVal))
} else { } 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)))
} }
} }
@ -418,6 +435,33 @@ func keys(val map[string]intstr.IntOrString) []string {
return keys 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,
// and we need to escape it by adding an additional backslash.
// This logic is difficult if not impossible to accomplish with a simple regex submatch replace.
func escapeComma(match string) string {
if len(match)%2 == 1 {
match = `\` + match
}
return match
}
func setProxyEnv(job *batch.Job) { func setProxyEnv(job *batch.Job) {
proxySysEnv := []string{ proxySysEnv := []string{
"all_proxy", "all_proxy",

2
vendor/modules.txt vendored
View File

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