diff --git a/kubernetes/chartmuseum/centos/chartmuseum.spec b/kubernetes/chartmuseum/centos/chartmuseum.spec index 7877f1e8b..f740c86ae 100644 --- a/kubernetes/chartmuseum/centos/chartmuseum.spec +++ b/kubernetes/chartmuseum/centos/chartmuseum.spec @@ -25,7 +25,11 @@ URL: https://github.com/helm/chartmuseum BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(libseccomp) BuildRequires: pkgconfig(libsystemd-journal) -BuildRequires: golang >= 1.10.0 + +# Build with our own prefered golang, not 1.11 from CentOS +# BuildRequires: golang >= 1.10.0 +BuildRequires: golang >= 1.13.0 + BuildRequires: rsync BuildRequires: go-md2man BuildRequires: go-bindata diff --git a/kubernetes/containerd/centos/containerd.spec b/kubernetes/containerd/centos/containerd.spec index d567e3fc3..67f8cfe3b 100644 --- a/kubernetes/containerd/centos/containerd.spec +++ b/kubernetes/containerd/centos/containerd.spec @@ -20,7 +20,11 @@ Packager: StarlingX BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(libseccomp) BuildRequires: pkgconfig(libsystemd-journal) -BuildRequires: golang >= 1.12.16 + +# Build with our own prefered golang +# BuildRequires: golang >= 1.12.16 +BuildRequires: golang >= 1.13 + BuildRequires: systemd BuildRequires: rsync BuildRequires: go-md2man @@ -60,6 +64,7 @@ rm -rf %{CONTAINERD_DIR} mkdir -p %{CONTAINERD_DIR} cp -a %{_builddir}/src/containerd/* %{CONTAINERD_DIR}/ pushd %{CONTAINERD_DIR} +go env -w GO111MODULE=auto make popd diff --git a/kubernetes/docker-distribution/centos/docker-distribution.spec b/kubernetes/docker-distribution/centos/docker-distribution.spec index 1dd95f3d6..aadbc3470 100644 --- a/kubernetes/docker-distribution/centos/docker-distribution.spec +++ b/kubernetes/docker-distribution/centos/docker-distribution.spec @@ -52,8 +52,11 @@ Obsoletes: docker-registry <= 0.9.1-5 # e.g. el6 has ppc64 arch without gcc-go, so EA tag is required ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}} + # If go_compiler is not set to 1, there is no virtual provide. Use golang instead. -BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +# Build with our own prefered golang, not 1.11 from CentOS +# BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang >= 1.13} %description %{summary} @@ -223,6 +226,7 @@ sed -i 's/elliptic.P224(), //' vendor/golang.org/x/crypto/ocsp/ocsp.go mkdir -p src/github.com/%{project} ln -s ../../../ src/%{import_path} export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath} +go env -w GO111MODULE=auto %gobuild -o bin/registry %{import_path}/cmd/registry %install diff --git a/kubernetes/etcd/centos/etcd.spec b/kubernetes/etcd/centos/etcd.spec index 14908d85a..f284e4339 100644 --- a/kubernetes/etcd/centos/etcd.spec +++ b/kubernetes/etcd/centos/etcd.spec @@ -34,8 +34,11 @@ Source2: %{system_name}.conf # e.g. el6 has ppc64 arch without gcc-go, so EA tag is required ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:x86_64 aarch64 ppc64le s390x} + # If go_compiler is not set to 1, there is no virtual provide. Use golang instead. -BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +# Build with our own prefered golang, not 1.11 from CentOS +# BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang >= 1.13} Obsoletes: etcd3 < 3.0.15 Provides: etcd3 = %{version}-%{release} @@ -64,6 +67,7 @@ mkdir -p src/github.com/coreos ln -s ../../../ src/github.com/coreos/etcd export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath} +go env -w GO111MODULE=auto export LDFLAGS="-X %{import_path}/version.GitSHA=%{shortcommit} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" diff --git a/kubernetes/kubernetes/centos/kubernetes.spec b/kubernetes/kubernetes/centos/kubernetes.spec index 96a95faa8..fb45903cc 100644 --- a/kubernetes/kubernetes/centos/kubernetes.spec +++ b/kubernetes/kubernetes/centos/kubernetes.spec @@ -28,6 +28,9 @@ %global kube_version 1.18.1 %global kube_git_version v%{kube_version} +%global go_version 1.13.9 +%global go_path /usr/lib/golang-%{go_version}-%{go_version}/bin + # Needed otherwise "version_ldflags=$(kube::version_ldflags)" doesn't work %global _buildshell /bin/bash %global _checkshell /bin/bash @@ -765,7 +768,7 @@ building other packages which use %{project}/%{repo}. Summary: %{summary} - for running unit tests # below Rs used for testing -Requires: golang >= 1.13.4 +Requires: golang-%{go_version} Requires: etcd >= 2.0.9 Requires: hostname Requires: rsync @@ -778,7 +781,8 @@ Requires: NetworkManager %package master Summary: Kubernetes services for master host -BuildRequires: golang >= 1.13.4 +# Build with the recommended golang for this Kubernetes version +BuildRequires: golang-%{go_version} BuildRequires: systemd BuildRequires: rsync BuildRequires: go-md2man @@ -802,7 +806,7 @@ Requires: docker-ce %endif Requires: conntrack-tools -BuildRequires: golang >= 1.13.4 +BuildRequires: golang-%{go_version} BuildRequires: systemd BuildRequires: rsync BuildRequires: go-md2man @@ -828,7 +832,7 @@ Kubernetes tool for standing up clusters %package client Summary: Kubernetes client tools -BuildRequires: golang >= 1.13.4 +BuildRequires: golang-%{go_version} BuildRequires: go-bindata %description client @@ -873,6 +877,7 @@ mv $(ls | grep -v "^src$") src/k8s.io/kubernetes/. ############### %build +export PATH=%{go_path}:$PATH export PBR_VERSION=%{version} pushd src/k8s.io/kubernetes/ export KUBE_GIT_TREE_STATE="clean" @@ -880,6 +885,9 @@ export KUBE_GIT_COMMIT=%{commit} export KUBE_GIT_VERSION=%{kube_git_version} export KUBE_EXTRA_GOPATH=$(pwd)/Godeps/_workspace +# Verify the go version we will build against +go version + # https://bugzilla.redhat.com/show_bug.cgi?id=1392922#c1 %ifarch ppc64le export GOLDFLAGS='-linkmode=external' diff --git a/kubernetes/plugins/isolcpus-device-plugin/centos/isolcpus-device-plugin.spec b/kubernetes/plugins/isolcpus-device-plugin/centos/isolcpus-device-plugin.spec index c10020e00..18eabe739 100644 --- a/kubernetes/plugins/isolcpus-device-plugin/centos/isolcpus-device-plugin.spec +++ b/kubernetes/plugins/isolcpus-device-plugin/centos/isolcpus-device-plugin.spec @@ -14,7 +14,10 @@ URL: unknown BuildArch: x86_64 Source: %name-%version.tar.gz -BuildRequires: golang +# Build with our own prefered golang, not 1.11 from CentOS +# BuildRequires: golang +BuildRequires: golang >= 1.13 + BuildRequires: systemd Requires: kubernetes-node Summary: Kubernetes device plugin for isolcpus