Browse Source

Bump to kubeyaml 0.5.1 to fix (F)HR updating

kubeyaml 0.5.1 has a fix for updating images that include ports in
(Flux)HelmRelease manifests. So: bump that in the Dockerfile and shim
(`/bin/kubeyaml`), and add a test that it does account for such images
when updating.

Side issue in update_test.go: calling `t.Parallel()` _before_ invoking
the test case meant that the closed-over loop variable could be
reassigned before the test case was run.
Michael Bridgen 11 months ago
parent
commit
e1e62b785e
3 changed files with 60 additions and 10 deletions
  1. 1
    1
      bin/kubeyaml
  2. 58
    8
      cluster/kubernetes/update_test.go
  3. 1
    1
      docker/Dockerfile.flux

+ 1
- 1
bin/kubeyaml View File

@@ -1,2 +1,2 @@
1 1
 #!/bin/sh
2
-docker run --rm -i quay.io/squaremo/kubeyaml:0.5.0 "$@"
2
+docker run --rm -i quay.io/squaremo/kubeyaml:0.5.1 "$@"

+ 58
- 8
cluster/kubernetes/update_test.go View File

@@ -49,13 +49,14 @@ func TestUpdates(t *testing.T) {
49 49
 		{"single quotes", case8resource, case8containers, case8image, case8, case8out},
50 50
 		{"in multidoc", case9resource, case9containers, case9image, case9, case9out},
51 51
 		{"in kubernetes List resource", case10resource, case10containers, case10image, case10, case10out},
52
-		{"FluxHelmRelease (simple image encoding)", case11resource, case11containers, case11image, case11, case11out},
53
-		{"FluxHelmRelease (multi image encoding)", case12resource, case12containers, case12image, case12, case12out},
54
-		{"initContainer", case13resource, case13containers, case13image, case13, case13out},
52
+		{"FluxHelmRelease (v1alpha2; simple image encoding)", case11resource, case11containers, case11image, case11, case11out},
53
+		{"FluxHelmRelease (v1alpha2; multi image encoding)", case12resource, case12containers, case12image, case12, case12out},
54
+		{"HelmRelease (v1beta1; image with port number)", case13resource, case13containers, case13image, case13, case13out},
55
+		{"initContainer", case14resource, case14containers, case14image, case14, case14out},
55 56
 	} {
56 57
 		t.Run(c.name, func(t *testing.T) {
57
-			t.Parallel()
58 58
 			testUpdate(t, c)
59
+			t.Parallel()
59 60
 		})
60 61
 	}
61 62
 }
@@ -872,6 +873,55 @@ spec:
872 873
 `
873 874
 
874 875
 const case13 = `---
876
+apiVersion: flux.weave.works/v1beta1
877
+kind: HelmRelease
878
+metadata:
879
+  name: mariadb
880
+  namespace: maria
881
+spec:
882
+  chart:
883
+    repository: https://example.com/charts
884
+    name: mariadb
885
+    version: 1.1.2
886
+  values:
887
+    mariadb:
888
+      image: localhost:5000/mariadb
889
+      tag: 10.1.30-r1
890
+      persistence:
891
+        enabled: false
892
+    workProperly: true
893
+    sidecar:
894
+      image: sidecar:v1
895
+`
896
+
897
+const case13resource = "maria:helmrelease/mariadb"
898
+const case13image = "localhost:5000/mariadb:10.1.33"
899
+
900
+var case13containers = []string{"mariadb"}
901
+
902
+const case13out = `---
903
+apiVersion: flux.weave.works/v1beta1
904
+kind: HelmRelease
905
+metadata:
906
+  name: mariadb
907
+  namespace: maria
908
+spec:
909
+  chart:
910
+    repository: https://example.com/charts
911
+    name: mariadb
912
+    version: 1.1.2
913
+  values:
914
+    mariadb:
915
+      image: localhost:5000/mariadb
916
+      tag: 10.1.33
917
+      persistence:
918
+        enabled: false
919
+    workProperly: true
920
+    sidecar:
921
+      image: sidecar:v1
922
+`
923
+
924
+const case14 = `---
875 925
 apiVersion: extensions/v1beta1
876 926
 kind: Deployment
877 927
 metadata:
@@ -888,12 +938,12 @@ spec:
888 938
         image: 'weaveworks/weave-kube:2.2.0'
889 939
 `
890 940
 
891
-const case13resource = "default:deployment/weave"
892
-const case13image = "weaveworks/weave-kube:2.2.1"
941
+const case14resource = "default:deployment/weave"
942
+const case14image = "weaveworks/weave-kube:2.2.1"
893 943
 
894
-var case13containers = []string{"weave"}
944
+var case14containers = []string{"weave"}
895 945
 
896
-const case13out = `---
946
+const case14out = `---
897 947
 apiVersion: extensions/v1beta1
898 948
 kind: Deployment
899 949
 metadata:

+ 1
- 1
docker/Dockerfile.flux View File

@@ -34,7 +34,7 @@ LABEL maintainer="Weaveworks <help@weave.works>" \
34 34
 ENTRYPOINT [ "/sbin/tini", "--", "fluxd" ]
35 35
 
36 36
 # Get the kubeyaml binary (files) and put them on the path
37
-COPY --from=quay.io/squaremo/kubeyaml:0.5.0 /usr/lib/kubeyaml /usr/lib/kubeyaml/
37
+COPY --from=quay.io/squaremo/kubeyaml:0.5.1 /usr/lib/kubeyaml /usr/lib/kubeyaml/
38 38
 ENV PATH=/bin:/usr/bin:/usr/local/bin:/usr/lib/kubeyaml
39 39
 
40 40
 COPY ./kubeconfig /root/.kube/config

Loading…
Cancel
Save