From 04bc44acf95dfa1fa4f604b0370669ead4ab41d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Fri, 27 Jan 2017 20:03:37 +0200 Subject: [PATCH] Remove the patched golang from the kube-cross image and upgrade to go1.8rc1 for arm and ppc64le instead. Reenable the ppc64le builds --- build/build-image/Dockerfile | 2 +- build/build-image/VERSION | 2 +- build/build-image/cross/Dockerfile | 23 +- build/build-image/cross/VERSION | 2 +- .../CL28857-go1.7.1-luxas.patch | 390 ------------------ build/common.sh | 21 +- hack/lib/golang.sh | 39 +- 7 files changed, 31 insertions(+), 448 deletions(-) delete mode 100644 build/build-image/cross/golang-patches/CL28857-go1.7.1-luxas.patch diff --git a/build/build-image/Dockerfile b/build/build-image/Dockerfile index 57b4300508c..d7cb8323803 100644 --- a/build/build-image/Dockerfile +++ b/build/build-image/Dockerfile @@ -19,7 +19,7 @@ FROM gcr.io/google_containers/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG RUN touch /kube-build-image # To run as non-root we sometimes need to rebuild go stdlib packages. -RUN chmod -R a+rwx /usr/local/go/pkg ${K8S_PATCHED_GOROOT}/pkg +RUN chmod -R a+rwx /usr/local/go/pkg ${K8S_EDGE_GOROOT}/pkg # For running integration tests /var/run/kubernetes is required # and should be writable by user diff --git a/build/build-image/VERSION b/build/build-image/VERSION index b8626c4cff2..7ed6ff82de6 100644 --- a/build/build-image/VERSION +++ b/build/build-image/VERSION @@ -1 +1 @@ -4 +5 diff --git a/build/build-image/cross/Dockerfile b/build/build-image/cross/Dockerfile index a632754f35b..cdcd79f0270 100644 --- a/build/build-image/cross/Dockerfile +++ b/build/build-image/cross/Dockerfile @@ -17,9 +17,9 @@ FROM golang:1.7.4 -ENV GOARM 6 +ENV GOARM 7 ENV KUBE_DYNAMIC_CROSSPLATFORMS \ - armel \ + armhf \ arm64 \ s390x \ ppc64el @@ -78,16 +78,11 @@ RUN export ETCD_VERSION=v3.0.14; \ && curl -fsSL https://github.com/coreos/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz | tar -xz \ && ln -s ../src/etcd/etcd-${ETCD_VERSION}-linux-amd64/etcd /usr/local/bin/ -# TODO: Remove the patched GOROOT when we have an official golang that has a working arm and ppc64le linker -ENV K8S_PATCHED_GOLANG_VERSION=1.7.4 \ - K8S_PATCHED_GOROOT=/usr/local/go_k8s_patched -RUN mkdir -p ${K8S_PATCHED_GOROOT} \ - && curl -sSL https://github.com/golang/go/archive/go${K8S_PATCHED_GOLANG_VERSION}.tar.gz | tar -xz -C ${K8S_PATCHED_GOROOT} --strip-components=1 +# TODO: Remove the need for two golang versions; when we use go1.8 for all other builds we can remove this +ENV K8S_GOLANG_EDGE_VERSION=1.8rc1 \ + K8S_EDGE_GOROOT=/usr/local/go_k8s_edge +RUN mkdir -p ${K8S_EDGE_GOROOT} \ + && curl -sSL https://golang.org/dl/go${K8S_GOLANG_EDGE_VERSION}.linux-amd64.tar.gz | tar -xz -C ${K8S_EDGE_GOROOT} --strip-components=1 -# We need a patched go1.7.1 for linux/arm (https://github.com/kubernetes/kubernetes/issues/29904) -COPY golang-patches/CL28857-go1.7.1-luxas.patch ${K8S_PATCHED_GOROOT}/ -RUN cd ${K8S_PATCHED_GOROOT} \ - && patch -p1 < CL28857-go1.7.1-luxas.patch \ - && cd src \ - && GOROOT_FINAL=${K8S_PATCHED_GOROOT} GOROOT_BOOTSTRAP=/usr/local/go ./make.bash \ - && for platform in linux/arm; do GOOS=${platform%/*} GOARCH=${platform##*/} GOROOT=${K8S_PATCHED_GOROOT} go install std; done +# Prebuild the standard library for those platforms that need the edge GOROOT +RUN for platform in linux/arm linux/ppc64le; do GOOS=${platform%/*} GOARCH=${platform##*/} GOROOT=${K8S_EDGE_GOROOT} go install std; done diff --git a/build/build-image/cross/VERSION b/build/build-image/cross/VERSION index ddd62189cb0..4f6aca067e5 100644 --- a/build/build-image/cross/VERSION +++ b/build/build-image/cross/VERSION @@ -1 +1 @@ -v1.7.4-1 +v1.7.4-2 diff --git a/build/build-image/cross/golang-patches/CL28857-go1.7.1-luxas.patch b/build/build-image/cross/golang-patches/CL28857-go1.7.1-luxas.patch deleted file mode 100644 index c458d94332d..00000000000 --- a/build/build-image/cross/golang-patches/CL28857-go1.7.1-luxas.patch +++ /dev/null @@ -1,390 +0,0 @@ -From cc1015ff9bb020ea92c1854026e9ae395a8504b2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= - -Date: Mon, 12 Sep 2016 22:55:42 +0300 -Subject: [PATCH] Ported cherrymui's CL 28857 to the go1.7.1 branch - ---- - src/cmd/compile/internal/arm/ssa.go | 16 ++++++ - src/cmd/compile/internal/gc/cgen.go | 5 ++ - src/cmd/compile/internal/gc/main.go | 11 ++-- - src/cmd/compile/internal/gc/plive.go | 5 ++ - src/cmd/internal/obj/arm/asm5.go | 32 ++++++++++++ - src/cmd/internal/obj/arm/obj5.go | 3 ++ - src/cmd/internal/obj/link.go | 98 +++++++++++++++++++----------------- - src/cmd/link/internal/arm/asm.go | 18 ++++++- - src/cmd/link/internal/ld/lib.go | 4 +- - src/runtime/asm_arm.s | 2 +- - 10 files changed, 138 insertions(+), 56 deletions(-) - -diff --git a/src/cmd/compile/internal/arm/ssa.go b/src/cmd/compile/internal/arm/ssa.go -index 8f466e3..a066e02 100644 ---- a/src/cmd/compile/internal/arm/ssa.go -+++ b/src/cmd/compile/internal/arm/ssa.go -@@ -111,6 +111,22 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { - gc.AddAux(&p.To, v) - case ssa.OpARMCALLstatic: - // TODO: deferreturn -+ if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { -+ // Deferred calls will appear to be returning to -+ // the CALL deferreturn(SB) that we are about to emit. -+ // However, the stack trace code will show the line -+ // of the instruction byte before the return PC. -+ // To avoid that being an unrelated instruction, -+ // insert an actual hardware NOP that will have the right line number. -+ // This is different from obj.ANOP, which is a virtual no-op -+ // that doesn't make it into the instruction stream. -+ ginsnop() -+ if !gc.Ctxt.Flag_largemodel { -+ // We always back up two instructions. -+ // For non-large build, insert another NOP. -+ ginsnop() -+ } -+ } - p := gc.Prog(obj.ACALL) - p.To.Type = obj.TYPE_MEM - p.To.Name = obj.NAME_EXTERN -diff --git a/src/cmd/compile/internal/gc/cgen.go b/src/cmd/compile/internal/gc/cgen.go -index 74fe463..7507d5f 100644 ---- a/src/cmd/compile/internal/gc/cgen.go -+++ b/src/cmd/compile/internal/gc/cgen.go -@@ -2373,6 +2373,11 @@ func Ginscall(f *Node, proc int) { - Thearch.Ginsnop() - } - } -+ if Ctxt.Arch.Family == sys.ARM && !Ctxt.Flag_largemodel { -+ // On ARM we always back up two instructions. -+ // For non-large build, insert another NOP. -+ Thearch.Ginsnop() -+ } - } - - p := Thearch.Gins(obj.ACALL, nil, f) -diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go -index b4df7ed..c0a8aa1 100644 ---- a/src/cmd/compile/internal/gc/main.go -+++ b/src/cmd/compile/internal/gc/main.go -@@ -148,9 +148,9 @@ func Main() { - goos = obj.Getgoos() - - Nacl = goos == "nacl" -- if Nacl { -- flag_largemodel = true -- } -+ //if Nacl { -+ // flag_largemodel = true -+ //} - - flag.BoolVar(&compiling_runtime, "+", false, "compiling runtime") - obj.Flagcount("%", "debug non-static initializers", &Debug['%']) -@@ -204,9 +204,7 @@ func Main() { - flag.BoolVar(&flag_shared, "shared", false, "generate code that can be linked into a shared library") - flag.BoolVar(&flag_dynlink, "dynlink", false, "support references to Go symbols defined in other shared libraries") - } -- if Thearch.LinkArch.Family == sys.AMD64 { -- flag.BoolVar(&flag_largemodel, "largemodel", false, "generate code that assumes a large memory model") -- } -+ flag.BoolVar(&flag_largemodel, "largemodel", false, "generate code that assumes a large memory model") - flag.StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to `file`") - flag.StringVar(&memprofile, "memprofile", "", "write memory profile to `file`") - flag.Int64Var(&memprofilerate, "memprofilerate", 0, "set runtime.MemProfileRate to `rate`") -@@ -216,6 +214,7 @@ func Main() { - Ctxt.Flag_shared = flag_dynlink || flag_shared - Ctxt.Flag_dynlink = flag_dynlink - Ctxt.Flag_optimize = Debug['N'] == 0 -+ Ctxt.Flag_largemodel = flag_largemodel - - Ctxt.Debugasm = int32(Debug['S']) - Ctxt.Debugvlog = int32(Debug['v']) -diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go -index ca0421d..ad26d24 100644 ---- a/src/cmd/compile/internal/gc/plive.go -+++ b/src/cmd/compile/internal/gc/plive.go -@@ -1400,6 +1400,11 @@ func livenessepilogue(lv *Liveness) { - // the call. - prev = prev.Opt.(*obj.Prog) - } -+ if Ctxt.Arch.Family == sys.ARM && !Ctxt.Flag_largemodel { -+ // On ARM we always back up two instructions. -+ // For non-large build, there is another NOP. -+ prev = prev.Opt.(*obj.Prog) -+ } - splicebefore(lv, bb, newpcdataprog(prev, pos), prev) - } else { - splicebefore(lv, bb, newpcdataprog(p, pos), p) -diff --git a/src/cmd/internal/obj/arm/asm5.go b/src/cmd/internal/obj/arm/asm5.go -index d37091f..8136492 100644 ---- a/src/cmd/internal/obj/arm/asm5.go -+++ b/src/cmd/internal/obj/arm/asm5.go -@@ -585,6 +585,30 @@ func span5(ctxt *obj.Link, cursym *obj.LSym) { - break - } - -+ if ctxt.Flag_largemodel && (p.As == AB || p.As == ABL || p.As == obj.ADUFFZERO || p.As == obj.ADUFFCOPY) && p.To.Name == obj.NAME_EXTERN { -+ // in large mode, emit indirect call -+ // MOVW $target, Rtmp -+ // BL (Rtmp) -+ // use REGLINK as Rtmp, as soft div calls expects REGTMP to pass argument -+ tmp := int16(REGLINK) -+ q := obj.Appendp(ctxt, p) -+ q.As = ABL -+ if p.As == AB { -+ q.As = AB -+ tmp = REGTMP // should not clobber REGLINK in this case -+ } -+ q.To.Type = obj.TYPE_MEM -+ q.To.Reg = tmp -+ q.To.Sym = p.To.Sym // tell asmout to emits R_CALLARMLARGE reloc -+ -+ p.As = AMOVW -+ p.From = p.To // jump target -+ p.From.Type = obj.TYPE_ADDR -+ p.To = obj.Addr{} -+ p.To.Type = obj.TYPE_REG -+ p.To.Reg = tmp -+ } -+ - ctxt.Curp = p - p.Pc = int64(c) - o = oplook(ctxt, p) -@@ -1583,6 +1607,14 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) { - } - o1 = oprrr(ctxt, ABL, int(p.Scond)) - o1 |= (uint32(p.To.Reg) & 15) << 0 -+ if p.To.Sym != nil { -+ rel := obj.Addrel(ctxt.Cursym) -+ rel.Off = int32(ctxt.Pc) -+ rel.Siz = 4 -+ rel.Sym = p.To.Sym -+ rel.Type = obj.R_CALLARMLARGE -+ break -+ } - rel := obj.Addrel(ctxt.Cursym) - rel.Off = int32(ctxt.Pc) - rel.Siz = 0 -diff --git a/src/cmd/internal/obj/arm/obj5.go b/src/cmd/internal/obj/arm/obj5.go -index 9cf2f29..13bf952 100644 ---- a/src/cmd/internal/obj/arm/obj5.go -+++ b/src/cmd/internal/obj/arm/obj5.go -@@ -584,6 +584,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { - p.As = ABL - p.Lineno = q1.Lineno - p.To.Type = obj.TYPE_BRANCH -+ p.To.Name = obj.NAME_EXTERN - switch o { - case ADIV: - p.To.Sym = ctxt.Sym_div -@@ -687,6 +688,7 @@ func softfloat(ctxt *obj.Link, cursym *obj.LSym) { - p.Link = next - p.As = ABL - p.To.Type = obj.TYPE_BRANCH -+ p.To.Name = obj.NAME_EXTERN - p.To.Sym = symsfloat - p.Lineno = next.Lineno - -@@ -820,6 +822,7 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32) *obj.Prog { - call := obj.Appendp(ctxt, movw) - call.As = obj.ACALL - call.To.Type = obj.TYPE_BRANCH -+ call.To.Name = obj.NAME_EXTERN - morestack := "runtime.morestack" - switch { - case ctxt.Cursym.Cfunc: -diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go -index b6861f4..51e9fd3 100644 ---- a/src/cmd/internal/obj/link.go -+++ b/src/cmd/internal/obj/link.go -@@ -588,6 +588,11 @@ const ( - // R_ADDRMIPSTLS (only used on mips64) resolves to the low 16 bits of a TLS - // address (offset from thread pointer), by encoding it into the instruction. - R_ADDRMIPSTLS -+ -+ // R_CALLARMLARGE applies on an indirect CALL with known target used on large mode. -+ // Currently it does nothing but tell the linker the target for stack split check. -+ // In the future linker may optimize this to a NOP and a direct CALL if it is safe. -+ R_CALLARMLARGE - ) - - type Auto struct { -@@ -617,52 +622,53 @@ const ( - // Link holds the context for writing object code from a compiler - // to be linker input or for reading that input into the linker. - type Link struct { -- Goarm int32 -- Headtype int -- Arch *LinkArch -- Debugasm int32 -- Debugvlog int32 -- Debugdivmod int32 -- Debugpcln int32 -- Flag_shared bool -- Flag_dynlink bool -- Flag_optimize bool -- Bso *bufio.Writer -- Pathname string -- Goroot string -- Goroot_final string -- Hash map[SymVer]*LSym -- LineHist LineHist -- Imports []string -- Plist *Plist -- Plast *Plist -- Sym_div *LSym -- Sym_divu *LSym -- Sym_mod *LSym -- Sym_modu *LSym -- Plan9privates *LSym -- Curp *Prog -- Printp *Prog -- Blitrl *Prog -- Elitrl *Prog -- Rexflag int -- Vexflag int -- Rep int -- Repn int -- Lock int -- Asmode int -- AsmBuf AsmBuf // instruction buffer for x86 -- Instoffset int64 -- Autosize int32 -- Armsize int32 -- Pc int64 -- DiagFunc func(string, ...interface{}) -- Mode int -- Cursym *LSym -- Version int -- Textp *LSym -- Etextp *LSym -- Errors int -+ Goarm int32 -+ Headtype int -+ Arch *LinkArch -+ Debugasm int32 -+ Debugvlog int32 -+ Debugdivmod int32 -+ Debugpcln int32 -+ Flag_shared bool -+ Flag_dynlink bool -+ Flag_optimize bool -+ Flag_largemodel bool // generate code that assumes a large memory model -+ Bso *bufio.Writer -+ Pathname string -+ Goroot string -+ Goroot_final string -+ Hash map[SymVer]*LSym -+ LineHist LineHist -+ Imports []string -+ Plist *Plist -+ Plast *Plist -+ Sym_div *LSym -+ Sym_divu *LSym -+ Sym_mod *LSym -+ Sym_modu *LSym -+ Plan9privates *LSym -+ Curp *Prog -+ Printp *Prog -+ Blitrl *Prog -+ Elitrl *Prog -+ Rexflag int -+ Vexflag int -+ Rep int -+ Repn int -+ Lock int -+ Asmode int -+ AsmBuf AsmBuf // instruction buffer for x86 -+ Instoffset int64 -+ Autosize int32 -+ Armsize int32 -+ Pc int64 -+ DiagFunc func(string, ...interface{}) -+ Mode int -+ Cursym *LSym -+ Version int -+ Textp *LSym -+ Etextp *LSym -+ Errors int - - Framepointer_enabled bool - -diff --git a/src/cmd/link/internal/arm/asm.go b/src/cmd/link/internal/arm/asm.go -index 0c3e957..0cf61bb 100644 ---- a/src/cmd/link/internal/arm/asm.go -+++ b/src/cmd/link/internal/arm/asm.go -@@ -410,6 +410,11 @@ func machoreloc1(r *ld.Reloc, sectoff int64) int { - return 0 - } - -+// sign extend a 24-bit integer -+func signext24(x int64) int32 { -+ return (int32(x) << 8) >> 8 -+} -+ - func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { - if ld.Linkmode == ld.LinkExternal { - switch r.Type { -@@ -445,6 +450,9 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { - - *val = int64(braddoff(int32(0xff000000&uint32(r.Add)), int32(0xffffff&uint32(r.Xadd/4)))) - return 0 -+ -+ case obj.R_CALLARMLARGE: -+ return 0 - } - - return -1 -@@ -479,8 +487,16 @@ func archreloc(r *ld.Reloc, s *ld.LSym, val *int64) int { - return 0 - - case obj.R_CALLARM: // bl XXXXXX or b YYYYYY -- *val = int64(braddoff(int32(0xff000000&uint32(r.Add)), int32(0xffffff&uint32((ld.Symaddr(r.Sym)+int64((uint32(r.Add))*4)-(s.Value+int64(r.Off)))/4)))) -+ // low 24-bit encodes the target address -+ t := (ld.Symaddr(r.Sym) + int64(signext24(r.Add&0xffffff)*4) - (s.Value + int64(r.Off))) / 4 -+ if t > 0x7fffff || t < -0x800000 { -+ ld.Diag("direct call too far %d, should build with -gcflags -largemodel", t) -+ } -+ *val = int64(braddoff(int32(0xff000000&uint32(r.Add)), int32(0xffffff&t))) -+ -+ return 0 - -+ case obj.R_CALLARMLARGE: - return 0 - } - -diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go -index 14f4fa9..cc3b50e 100644 ---- a/src/cmd/link/internal/ld/lib.go -+++ b/src/cmd/link/internal/ld/lib.go -@@ -1826,7 +1826,7 @@ func stkcheck(up *Chain, depth int) int { - r = &s.R[ri] - switch r.Type { - // Direct call. -- case obj.R_CALL, obj.R_CALLARM, obj.R_CALLARM64, obj.R_CALLPOWER, obj.R_CALLMIPS: -+ case obj.R_CALL, obj.R_CALLARM, obj.R_CALLARM64, obj.R_CALLPOWER, obj.R_CALLMIPS, obj.R_CALLARMLARGE: - ch.limit = int(int32(limit) - pcsp.value - int32(callsize())) - ch.sym = r.Sym - if stkcheck(&ch, depth+1) < 0 { -@@ -2164,7 +2164,7 @@ func callgraph() { - if r.Sym == nil { - continue - } -- if (r.Type == obj.R_CALL || r.Type == obj.R_CALLARM || r.Type == obj.R_CALLPOWER || r.Type == obj.R_CALLMIPS) && r.Sym.Type == obj.STEXT { -+ if (r.Type == obj.R_CALL || r.Type == obj.R_CALLARM || r.Type == obj.R_CALLPOWER || r.Type == obj.R_CALLMIPS || r.Type == obj.R_CALLARMLARGE) && r.Sym.Type == obj.STEXT { - fmt.Fprintf(Bso, "%s calls %s\n", s.Name, r.Sym.Name) - } - } -diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s -index f02297e..0930585 100644 ---- a/src/runtime/asm_arm.s -+++ b/src/runtime/asm_arm.s -@@ -465,7 +465,7 @@ CALLFN(·call1073741824, 1073741824) - // (And double-check that pop is atomic in that way.) - TEXT runtime·jmpdefer(SB),NOSPLIT,$0-8 - MOVW 0(R13), LR -- MOVW $-4(LR), LR // BL deferreturn -+ MOVW $-8(LR), LR // BL deferreturn - MOVW fv+0(FP), R7 - MOVW argp+4(FP), R13 - MOVW $-4(R13), R13 // SP is 4 below argp, due to saved LR --- -2.5.0 - diff --git a/build/common.sh b/build/common.sh index 3fac6f36060..b27a7801bff 100755 --- a/build/common.sh +++ b/build/common.sh @@ -33,15 +33,6 @@ KUBE_ROOT=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd -P) source "${KUBE_ROOT}/hack/lib/init.sh" -# Set KUBE_BUILD_PPC64LE to y to build for ppc64le in addition to other -# platforms. -# TODO(IBM): remove KUBE_BUILD_PPC64LE and reenable ppc64le compilation by -# default when -# https://github.com/kubernetes/kubernetes/issues/30384 and -# https://github.com/kubernetes/kubernetes/issues/25886 are fixed. -# The majority of the logic is in hack/lib/golang.sh. -readonly KUBE_BUILD_PPC64LE="${KUBE_BUILD_PPC64LE:-n}" - # Constants readonly KUBE_BUILD_IMAGE_REPO=kube-build readonly KUBE_BUILD_IMAGE_CROSS_TAG="$(cat ${KUBE_ROOT}/build/build-image/cross/VERSION)" @@ -94,6 +85,7 @@ readonly KUBE_CONTAINER_RSYNC_PORT=8730 # # $1 - server architecture kube::build::get_docker_wrapped_binaries() { + debian_iptables_version=v6 case $1 in "amd64") local targets=( @@ -101,7 +93,7 @@ kube::build::get_docker_wrapped_binaries() { kube-controller-manager,busybox kube-scheduler,busybox kube-aggregator,busybox - kube-proxy,gcr.io/google_containers/debian-iptables-amd64:v5 + kube-proxy,gcr.io/google_containers/debian-iptables-amd64:${debian_iptables_version} );; "arm") local targets=( @@ -109,7 +101,7 @@ kube::build::get_docker_wrapped_binaries() { kube-controller-manager,armel/busybox kube-scheduler,armel/busybox kube-aggregator,armel/busybox - kube-proxy,gcr.io/google_containers/debian-iptables-arm:v5 + kube-proxy,gcr.io/google_containers/debian-iptables-arm:${debian_iptables_version} );; "arm64") local targets=( @@ -117,7 +109,7 @@ kube::build::get_docker_wrapped_binaries() { kube-controller-manager,aarch64/busybox kube-scheduler,aarch64/busybox kube-aggregator,aarch64/busybox - kube-proxy,gcr.io/google_containers/debian-iptables-arm64:v5 + kube-proxy,gcr.io/google_containers/debian-iptables-arm64:${debian_iptables_version} );; "ppc64le") local targets=( @@ -125,7 +117,7 @@ kube::build::get_docker_wrapped_binaries() { kube-controller-manager,ppc64le/busybox kube-scheduler,ppc64le/busybox kube-aggregator,ppc64le/busybox - kube-proxy,gcr.io/google_containers/debian-iptables-ppc64le:v5 + kube-proxy,gcr.io/google_containers/debian-iptables-ppc64le:${debian_iptables_version} );; "s390x") local targets=( @@ -133,7 +125,7 @@ kube::build::get_docker_wrapped_binaries() { kube-controller-manager,s390x/busybox kube-scheduler,s390x/busybox kube-aggregator,s390x/busybox - kube-proxy,gcr.io/google_containers/debian-iptables-s390x:v5 + kube-proxy,gcr.io/google_containers/debian-iptables-s390x:${debian_iptables_version} );; esac @@ -558,7 +550,6 @@ function kube::build::run_build_command_ex() { docker_run_opts+=( --env "KUBE_FASTBUILD=${KUBE_FASTBUILD:-false}" --env "KUBE_BUILDER_OS=${OSTYPE:-notdetected}" - --env "KUBE_BUILD_PPC64LE=${KUBE_BUILD_PPC64LE}" # TODO(IBM): remove --env "KUBE_VERBOSE=${KUBE_VERBOSE}" ) diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 4cf842d1f2c..08a64553cff 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -74,47 +74,37 @@ if [[ "${KUBE_FASTBUILD:-}" == "true" ]]; then else # The server platform we are building on. - KUBE_SERVER_PLATFORMS=( + readonly KUBE_SERVER_PLATFORMS=( linux/amd64 linux/arm linux/arm64 linux/s390x + linux/ppc64le ) - if [[ "${KUBE_BUILD_PPC64LE:-}" =~ ^[yY]$ ]]; then - KUBE_SERVER_PLATFORMS+=(linux/ppc64le) - fi - readonly KUBE_SERVER_PLATFORMS # The node platforms we build for - KUBE_NODE_PLATFORMS=( + readonly KUBE_NODE_PLATFORMS=( linux/amd64 linux/arm linux/arm64 linux/s390x + linux/ppc64le windows/amd64 ) - if [[ "${KUBE_BUILD_PPC64LE:-}" =~ ^[yY]$ ]]; then - KUBE_NODE_PLATFORMS+=(linux/ppc64le) - fi - readonly KUBE_NODE_PLATFORMS - # If we update this we should also update the set of golang compilers we build - # in 'build/build-image/cross/Dockerfile'. However, it's only a bit faster since go 1.5, not mandatory - KUBE_CLIENT_PLATFORMS=( + # If we update this we should also update the set of platforms whose standard library is precompiled for in build/build-image/cross/Dockerfile + readonly KUBE_CLIENT_PLATFORMS=( linux/amd64 linux/386 linux/arm linux/arm64 + linux/s390x + linux/ppc64le darwin/amd64 darwin/386 windows/amd64 windows/386 - linux/s390x ) - if [[ "${KUBE_BUILD_PPC64LE:-}" =~ ^[yY]$ ]]; then - KUBE_CLIENT_PLATFORMS+=(linux/ppc64le) - fi - readonly KUBE_CLIENT_PLATFORMS # Which platforms we should compile test targets for. Not all client platforms need these tests readonly KUBE_TEST_PLATFORMS=( @@ -274,9 +264,9 @@ kube::golang::set_platform_envs() { case "${platform}" in "linux/arm") export CGO_ENABLED=1 - export CC=arm-linux-gnueabi-gcc - # See https://github.com/kubernetes/kubernetes/issues/29904 - export GOROOT=${K8S_PATCHED_GOROOT} + export CC=arm-linux-gnueabihf-gcc + # Use a special edge version of golang since the stable golang version used for everything else doesn't work + export GOROOT=${K8S_EDGE_GOROOT} ;; "linux/arm64") export CGO_ENABLED=1 @@ -285,6 +275,8 @@ kube::golang::set_platform_envs() { "linux/ppc64le") export CGO_ENABLED=1 export CC=powerpc64le-linux-gnu-gcc + # Use a special edge version of golang since the stable golang version used for everything else doesn't work + export GOROOT=${K8S_EDGE_GOROOT} ;; "linux/s390x") export CGO_ENABLED=1 @@ -530,11 +522,6 @@ kube::golang::build_binaries_for_platform() { kube::golang::fallback_if_stdlib_not_installable; fi - # TODO: Remove this temporary workaround when we have the official golang linker working - if [[ ${platform} == "linux/arm" ]]; then - gogcflags="${gogcflags} -largemodel" - fi - if [[ -n ${use_go_build:-} ]]; then kube::log::progress " " for binary in "${statics[@]:+${statics[@]}}"; do