From 9d738cedc3bbadca6386ef59b4732fa6aa00b82e Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Fri, 21 Feb 2020 12:54:05 +0100 Subject: [PATCH] k8s.io/apimachinery: bypass https://github.com/kubernetes/kubernetes/issues/87675 For us this manifests when doing kubecfg update cluster/kube/cluster.libsonnet To be precise: when hitting the Ceph/Rook CRD definition. This is a weird bug. I've seen it manifest earlier on NixOS, but I am now also seeing it on Gentoo. I've thought that it was because of Go API breakage, but I've quickly tried to specify older toolchain versions, but that didn't seem to help? :/ Regardless, I've applied a patch by rnb [1] that seems to fix this. I also have a suspicion that updating to a newer k8s version might just fix this, that's why I'm not not too concerned about this for now. [1] - https://github.com/nrb/unstructured-conversion-bug/commit/a32521024f2093b7d16b64d96c40a8f9dff89880 Change-Id: Id66e3c0bd56e84d785e1baeca86373aa2d0eb6f9 --- WORKSPACE | 4 +++- third_party/go/k8s-apimachinery/BUILD | 0 .../fix-kubernetes-bug-87675.patch | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 third_party/go/k8s-apimachinery/BUILD create mode 100644 third_party/go/k8s-apimachinery/fix-kubernetes-bug-87675.patch diff --git a/WORKSPACE b/WORKSPACE index caa380b6..e1c4c56e 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -496,8 +496,10 @@ go_repository( go_repository( name = "io_k8s_apimachinery", build_file_proto_mode = "disable", - commit = "08e4eafd6d11", + commit = "731dcecc205498f52a21b12e311af095efb4b188", importpath = "k8s.io/apimachinery", + patches = ["//third_party/go/k8s-apimachinery:fix-kubernetes-bug-87675.patch"], + patch_args = ["-p1"], ) go_repository( diff --git a/third_party/go/k8s-apimachinery/BUILD b/third_party/go/k8s-apimachinery/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/go/k8s-apimachinery/fix-kubernetes-bug-87675.patch b/third_party/go/k8s-apimachinery/fix-kubernetes-bug-87675.patch new file mode 100644 index 00000000..a4017543 --- /dev/null +++ b/third_party/go/k8s-apimachinery/fix-kubernetes-bug-87675.patch @@ -0,0 +1,14 @@ +diff --git a/pkg/runtime/converter.go b/pkg/runtime/converter.go +index b3e8a53..2489822 100644 +--- a/pkg/runtime/converter.go ++++ b/pkg/runtime/converter.go +@@ -191,6 +191,9 @@ func fromUnstructured(sv, dv reflect.Value) error { + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + dv.Set(sv.Convert(dt)) + return nil ++ case reflect.Float32, reflect.Float64: ++ dv.Set(sv.Convert(dt)) ++ return nil + } + case reflect.Float32, reflect.Float64: + switch dt.Kind() {