From 02152c9da7ab6056fa5fcaebc2936308327681ff Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Tue, 10 Oct 2023 13:28:10 +0200 Subject: [PATCH] Remove kubepkg and rapture Signed-off-by: Sascha Grunert --- Dockerfile-kubepkg | 56 -- Dockerfile-kubepkg-rpm | 47 -- Makefile | 10 - README.md | 23 - cloudbuild-kubepkg.yaml | 40 -- cmd/kubepkg/.dockerignore | 3 - cmd/kubepkg/.gitignore | 3 - cmd/kubepkg/OWNERS | 10 - cmd/kubepkg/README.md | 65 -- cmd/kubepkg/cmd/debs.go | 42 -- cmd/kubepkg/cmd/root.go | 163 ----- cmd/kubepkg/cmd/rpms.go | 42 -- cmd/kubepkg/main.go | 23 - .../latest/deb/cri-tools/debian/changelog | 5 - .../latest/deb/cri-tools/debian/compat | 1 - .../latest/deb/cri-tools/debian/control | 15 - .../latest/deb/cri-tools/debian/copyright | 18 - .../deb/cri-tools/debian/cri-tools.install | 1 - .../latest/deb/cri-tools/debian/rules | 22 - .../latest/deb/kubeadm/10-kubeadm.conf | 11 - .../latest/deb/kubeadm/debian/changelog | 6 - .../latest/deb/kubeadm/debian/compat | 1 - .../latest/deb/kubeadm/debian/control | 15 - .../latest/deb/kubeadm/debian/copyright | 18 - .../latest/deb/kubeadm/debian/kubeadm.install | 2 - .../latest/deb/kubeadm/debian/postinst | 43 -- .../templates/latest/deb/kubeadm/debian/rules | 31 - .../latest/deb/kubeadm/debian/source/format | 1 - .../latest/deb/kubectl/debian/changelog | 6 - .../latest/deb/kubectl/debian/compat | 1 - .../latest/deb/kubectl/debian/control | 15 - .../latest/deb/kubectl/debian/copyright | 18 - .../latest/deb/kubectl/debian/kubectl.install | 1 - .../latest/deb/kubectl/debian/postinst | 38 -- .../templates/latest/deb/kubectl/debian/rules | 30 - .../latest/deb/kubectl/debian/source/format | 1 - .../latest/deb/kubelet/debian/changelog | 6 - .../latest/deb/kubelet/debian/compat | 1 - .../latest/deb/kubelet/debian/control | 15 - .../latest/deb/kubelet/debian/copyright | 18 - .../latest/deb/kubelet/debian/kubelet.install | 2 - .../latest/deb/kubelet/debian/postinst | 42 -- .../templates/latest/deb/kubelet/debian/rules | 33 - .../latest/deb/kubelet/debian/source/format | 1 - .../lib/systemd/system/kubelet.service | 14 - .../latest/deb/kubernetes-cni/.gitignore | 1 - .../deb/kubernetes-cni/debian/changelog | 6 - .../latest/deb/kubernetes-cni/debian/compat | 1 - .../latest/deb/kubernetes-cni/debian/control | 15 - .../deb/kubernetes-cni/debian/copyright | 18 - .../debian/kubernetes-cni.install | 1 - .../latest/deb/kubernetes-cni/debian/rules | 24 - .../latest/rpm/cri-tools/cri-tools.spec | 34 - .../latest/rpm/kubeadm/10-kubeadm.conf | 11 - .../templates/latest/rpm/kubeadm/kubeadm.spec | 47 -- .../templates/latest/rpm/kubectl/kubectl.spec | 35 - .../templates/latest/rpm/kubelet/kubelet.env | 1 - .../latest/rpm/kubelet/kubelet.service | 14 - .../templates/latest/rpm/kubelet/kubelet.spec | 69 -- .../rpm/kubernetes-cni/kubernetes-cni.spec | 38 -- compile-release-tools | 1 - dependencies.yaml | 40 -- hack/packages/verify-published.sh | 122 ---- hack/rapture/OWNERS | 6 - hack/rapture/README.md | 197 ------ hack/rapture/build-packages.sh | 94 --- hack/rapture/check_rapture.sh | 40 -- hack/rapture/k8s-rapture.sh | 103 --- hack/rapture/publish-packages.sh | 184 ----- packages/deb/.gitignore | 1 - packages/deb/Dockerfile | 33 - packages/deb/OWNERS | 10 - .../deb/bionic/cri-tools/debian/changelog | 5 - packages/deb/bionic/cri-tools/debian/compat | 1 - packages/deb/bionic/cri-tools/debian/control | 15 - .../deb/bionic/cri-tools/debian/copyright | 18 - .../bionic/cri-tools/debian/cri-tools.install | 1 - packages/deb/bionic/cri-tools/debian/rules | 24 - .../post-1.10/10-kubeadm.conf | 1 - .../post-1.8/10-kubeadm.conf | 1 - .../kubelet.service.d/pre-1.8/10-kubeadm.conf | 1 - .../post-1.10/10-kubeadm.conf | 11 - .../post-1.8/10-kubeadm.conf | 10 - .../kubelet.service.d/pre-1.8/10-kubeadm.conf | 9 - .../post-1.10/10-kubeadm.conf | 1 - .../post-1.8/10-kubeadm.conf | 1 - .../kubelet.service.d/pre-1.8/10-kubeadm.conf | 1 - packages/deb/bionic/kubeadm/debian/changelog | 6 - packages/deb/bionic/kubeadm/debian/compat | 1 - packages/deb/bionic/kubeadm/debian/control | 15 - packages/deb/bionic/kubeadm/debian/copyright | 18 - .../deb/bionic/kubeadm/debian/kubeadm.install | 2 - packages/deb/bionic/kubeadm/debian/postinst | 43 -- packages/deb/bionic/kubeadm/debian/rules | 26 - .../deb/bionic/kubeadm/debian/source/format | 1 - packages/deb/bionic/kubectl/debian/changelog | 6 - packages/deb/bionic/kubectl/debian/compat | 1 - packages/deb/bionic/kubectl/debian/control | 15 - packages/deb/bionic/kubectl/debian/copyright | 18 - .../deb/bionic/kubectl/debian/kubectl.install | 1 - packages/deb/bionic/kubectl/debian/postinst | 38 -- packages/deb/bionic/kubectl/debian/rules | 25 - .../deb/bionic/kubectl/debian/source/format | 1 - packages/deb/bionic/kubelet/debian/changelog | 6 - packages/deb/bionic/kubelet/debian/compat | 1 - packages/deb/bionic/kubelet/debian/control | 15 - packages/deb/bionic/kubelet/debian/copyright | 18 - .../deb/bionic/kubelet/debian/kubelet.install | 2 - packages/deb/bionic/kubelet/debian/postinst | 42 -- packages/deb/bionic/kubelet/debian/rules | 28 - .../deb/bionic/kubelet/debian/source/format | 1 - .../lib/systemd/system/kubelet.service | 14 - packages/deb/bionic/kubernetes-cni/.gitignore | 1 - .../bionic/kubernetes-cni/debian/changelog | 6 - .../deb/bionic/kubernetes-cni/debian/compat | 1 - .../deb/bionic/kubernetes-cni/debian/control | 15 - .../bionic/kubernetes-cni/debian/copyright | 18 - .../debian/kubernetes-cni.install | 1 - .../deb/bionic/kubernetes-cni/debian/rules | 24 - packages/deb/build.go | 615 ----------------- packages/deb/build_test.go | 108 --- packages/deb/go.mod | 5 - packages/deb/go.sum | 2 - packages/deb/jenkins.sh | 26 - packages/deb/jessie | 1 - packages/deb/sid | 1 - packages/deb/stretch | 1 - packages/deb/trusty | 1 - packages/deb/xenial | 1 - packages/rpm/.dockerignore | 3 - packages/rpm/.gitignore | 7 - packages/rpm/10-kubeadm-post-1.11.conf | 11 - packages/rpm/Dockerfile | 25 - packages/rpm/OWNERS | 10 - packages/rpm/docker-build.sh | 39 -- packages/rpm/entry.sh | 56 -- packages/rpm/kubelet.env | 1 - packages/rpm/kubelet.service | 14 - packages/rpm/kubelet.spec | 305 --------- pkg/anago/anago.go | 10 - pkg/anago/anagofakes/fake_release_client.go | 65 -- pkg/anago/anagofakes/fake_release_impl.go | 74 -- pkg/anago/anagofakes/fake_stage_client.go | 65 -- pkg/anago/anagofakes/fake_stage_impl.go | 74 -- pkg/anago/release.go | 28 - pkg/anago/release_test.go | 34 - pkg/anago/stage.go | 19 - pkg/anago/stage_test.go | 36 - pkg/kubepkg/kubepkg.go | 631 ------------------ pkg/kubepkg/kubepkg_test.go | 541 --------------- pkg/kubepkg/kubepkgfakes/fake_impl.go | 458 ------------- pkg/kubepkg/options/options.go | 230 ------- pkg/kubepkg/options/options_test.go | 122 ---- pkg/kubepkg/template.go | 84 --- pkg/packages/impl.go | 64 -- pkg/packages/packages.go | 130 ---- pkg/packages/packages_test.go | 120 ---- pkg/packages/packagesfakes/fake_impl.go | 510 -------------- 158 files changed, 7142 deletions(-) delete mode 100644 Dockerfile-kubepkg delete mode 100644 Dockerfile-kubepkg-rpm delete mode 100644 cloudbuild-kubepkg.yaml delete mode 100644 cmd/kubepkg/.dockerignore delete mode 100644 cmd/kubepkg/.gitignore delete mode 100644 cmd/kubepkg/OWNERS delete mode 100644 cmd/kubepkg/README.md delete mode 100644 cmd/kubepkg/cmd/debs.go delete mode 100644 cmd/kubepkg/cmd/root.go delete mode 100644 cmd/kubepkg/cmd/rpms.go delete mode 100644 cmd/kubepkg/main.go delete mode 100644 cmd/kubepkg/templates/latest/deb/cri-tools/debian/changelog delete mode 100644 cmd/kubepkg/templates/latest/deb/cri-tools/debian/compat delete mode 100644 cmd/kubepkg/templates/latest/deb/cri-tools/debian/control delete mode 100644 cmd/kubepkg/templates/latest/deb/cri-tools/debian/copyright delete mode 100644 cmd/kubepkg/templates/latest/deb/cri-tools/debian/cri-tools.install delete mode 100755 cmd/kubepkg/templates/latest/deb/cri-tools/debian/rules delete mode 100644 cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf delete mode 100644 cmd/kubepkg/templates/latest/deb/kubeadm/debian/changelog delete mode 100644 cmd/kubepkg/templates/latest/deb/kubeadm/debian/compat delete mode 100644 cmd/kubepkg/templates/latest/deb/kubeadm/debian/control delete mode 100644 cmd/kubepkg/templates/latest/deb/kubeadm/debian/copyright delete mode 100644 cmd/kubepkg/templates/latest/deb/kubeadm/debian/kubeadm.install delete mode 100755 cmd/kubepkg/templates/latest/deb/kubeadm/debian/postinst delete mode 100755 cmd/kubepkg/templates/latest/deb/kubeadm/debian/rules delete mode 100644 cmd/kubepkg/templates/latest/deb/kubeadm/debian/source/format delete mode 100644 cmd/kubepkg/templates/latest/deb/kubectl/debian/changelog delete mode 100644 cmd/kubepkg/templates/latest/deb/kubectl/debian/compat delete mode 100644 cmd/kubepkg/templates/latest/deb/kubectl/debian/control delete mode 100644 cmd/kubepkg/templates/latest/deb/kubectl/debian/copyright delete mode 100644 cmd/kubepkg/templates/latest/deb/kubectl/debian/kubectl.install delete mode 100755 cmd/kubepkg/templates/latest/deb/kubectl/debian/postinst delete mode 100755 cmd/kubepkg/templates/latest/deb/kubectl/debian/rules delete mode 100644 cmd/kubepkg/templates/latest/deb/kubectl/debian/source/format delete mode 100644 cmd/kubepkg/templates/latest/deb/kubelet/debian/changelog delete mode 100644 cmd/kubepkg/templates/latest/deb/kubelet/debian/compat delete mode 100644 cmd/kubepkg/templates/latest/deb/kubelet/debian/control delete mode 100644 cmd/kubepkg/templates/latest/deb/kubelet/debian/copyright delete mode 100644 cmd/kubepkg/templates/latest/deb/kubelet/debian/kubelet.install delete mode 100755 cmd/kubepkg/templates/latest/deb/kubelet/debian/postinst delete mode 100755 cmd/kubepkg/templates/latest/deb/kubelet/debian/rules delete mode 100644 cmd/kubepkg/templates/latest/deb/kubelet/debian/source/format delete mode 100644 cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service delete mode 100644 cmd/kubepkg/templates/latest/deb/kubernetes-cni/.gitignore delete mode 100644 cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/changelog delete mode 100644 cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/compat delete mode 100644 cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/control delete mode 100644 cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/copyright delete mode 100644 cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/kubernetes-cni.install delete mode 100755 cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/rules delete mode 100644 cmd/kubepkg/templates/latest/rpm/cri-tools/cri-tools.spec delete mode 100644 cmd/kubepkg/templates/latest/rpm/kubeadm/10-kubeadm.conf delete mode 100644 cmd/kubepkg/templates/latest/rpm/kubeadm/kubeadm.spec delete mode 100644 cmd/kubepkg/templates/latest/rpm/kubectl/kubectl.spec delete mode 100644 cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.env delete mode 100644 cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.service delete mode 100644 cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.spec delete mode 100644 cmd/kubepkg/templates/latest/rpm/kubernetes-cni/kubernetes-cni.spec delete mode 100755 hack/packages/verify-published.sh delete mode 100644 hack/rapture/OWNERS delete mode 100644 hack/rapture/README.md delete mode 100755 hack/rapture/build-packages.sh delete mode 100755 hack/rapture/check_rapture.sh delete mode 100755 hack/rapture/k8s-rapture.sh delete mode 100755 hack/rapture/publish-packages.sh delete mode 100644 packages/deb/.gitignore delete mode 100644 packages/deb/Dockerfile delete mode 100644 packages/deb/OWNERS delete mode 100644 packages/deb/bionic/cri-tools/debian/changelog delete mode 100644 packages/deb/bionic/cri-tools/debian/compat delete mode 100644 packages/deb/bionic/cri-tools/debian/control delete mode 100644 packages/deb/bionic/cri-tools/debian/copyright delete mode 100644 packages/deb/bionic/cri-tools/debian/cri-tools.install delete mode 100644 packages/deb/bionic/cri-tools/debian/rules delete mode 120000 packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf delete mode 120000 packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf delete mode 120000 packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf delete mode 100644 packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf delete mode 100644 packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf delete mode 100644 packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf delete mode 120000 packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf delete mode 120000 packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf delete mode 120000 packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf delete mode 100644 packages/deb/bionic/kubeadm/debian/changelog delete mode 100644 packages/deb/bionic/kubeadm/debian/compat delete mode 100644 packages/deb/bionic/kubeadm/debian/control delete mode 100644 packages/deb/bionic/kubeadm/debian/copyright delete mode 100644 packages/deb/bionic/kubeadm/debian/kubeadm.install delete mode 100755 packages/deb/bionic/kubeadm/debian/postinst delete mode 100755 packages/deb/bionic/kubeadm/debian/rules delete mode 100644 packages/deb/bionic/kubeadm/debian/source/format delete mode 100644 packages/deb/bionic/kubectl/debian/changelog delete mode 100644 packages/deb/bionic/kubectl/debian/compat delete mode 100644 packages/deb/bionic/kubectl/debian/control delete mode 100644 packages/deb/bionic/kubectl/debian/copyright delete mode 100644 packages/deb/bionic/kubectl/debian/kubectl.install delete mode 100755 packages/deb/bionic/kubectl/debian/postinst delete mode 100755 packages/deb/bionic/kubectl/debian/rules delete mode 100644 packages/deb/bionic/kubectl/debian/source/format delete mode 100644 packages/deb/bionic/kubelet/debian/changelog delete mode 100644 packages/deb/bionic/kubelet/debian/compat delete mode 100644 packages/deb/bionic/kubelet/debian/control delete mode 100644 packages/deb/bionic/kubelet/debian/copyright delete mode 100644 packages/deb/bionic/kubelet/debian/kubelet.install delete mode 100755 packages/deb/bionic/kubelet/debian/postinst delete mode 100755 packages/deb/bionic/kubelet/debian/rules delete mode 100644 packages/deb/bionic/kubelet/debian/source/format delete mode 100644 packages/deb/bionic/kubelet/lib/systemd/system/kubelet.service delete mode 100644 packages/deb/bionic/kubernetes-cni/.gitignore delete mode 100644 packages/deb/bionic/kubernetes-cni/debian/changelog delete mode 100644 packages/deb/bionic/kubernetes-cni/debian/compat delete mode 100644 packages/deb/bionic/kubernetes-cni/debian/control delete mode 100644 packages/deb/bionic/kubernetes-cni/debian/copyright delete mode 100644 packages/deb/bionic/kubernetes-cni/debian/kubernetes-cni.install delete mode 100755 packages/deb/bionic/kubernetes-cni/debian/rules delete mode 100644 packages/deb/build.go delete mode 100644 packages/deb/build_test.go delete mode 100644 packages/deb/go.mod delete mode 100644 packages/deb/go.sum delete mode 100755 packages/deb/jenkins.sh delete mode 120000 packages/deb/jessie delete mode 120000 packages/deb/sid delete mode 120000 packages/deb/stretch delete mode 120000 packages/deb/trusty delete mode 120000 packages/deb/xenial delete mode 100644 packages/rpm/.dockerignore delete mode 100644 packages/rpm/.gitignore delete mode 100644 packages/rpm/10-kubeadm-post-1.11.conf delete mode 100644 packages/rpm/Dockerfile delete mode 100644 packages/rpm/OWNERS delete mode 100755 packages/rpm/docker-build.sh delete mode 100755 packages/rpm/entry.sh delete mode 100644 packages/rpm/kubelet.env delete mode 100644 packages/rpm/kubelet.service delete mode 100644 packages/rpm/kubelet.spec delete mode 100644 pkg/kubepkg/kubepkg.go delete mode 100644 pkg/kubepkg/kubepkg_test.go delete mode 100644 pkg/kubepkg/kubepkgfakes/fake_impl.go delete mode 100644 pkg/kubepkg/options/options.go delete mode 100644 pkg/kubepkg/options/options_test.go delete mode 100644 pkg/kubepkg/template.go delete mode 100644 pkg/packages/impl.go delete mode 100644 pkg/packages/packages.go delete mode 100644 pkg/packages/packages_test.go delete mode 100644 pkg/packages/packagesfakes/fake_impl.go diff --git a/Dockerfile-kubepkg b/Dockerfile-kubepkg deleted file mode 100644 index 50ce0f711e1..00000000000 --- a/Dockerfile-kubepkg +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM golang:1.21.2-bookworm AS builder - -ENV GO111MODULE=on - -WORKDIR /workspace - -COPY . . - -RUN go build -o . ./cmd/kubepkg/... - - -FROM debian:bookworm - -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update -y \ - && apt-get -yy -q install --no-install-recommends --no-install-suggests --fix-missing \ - dpkg-dev \ - build-essential \ - ca-certificates \ - curl \ - debhelper \ - fakeroot \ - && apt-get upgrade -y \ - && apt-get autoremove -y \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -RUN useradd builder -u 9000 -m -s /bin/false - -USER builder - -RUN mkdir /home/builder/workspace - -WORKDIR /home/builder/workspace - -RUN mkdir ./bin - -COPY --chown=builder:builder ./cmd/kubepkg/templates ./templates -COPY --from=builder --chown=builder:builder /workspace/kubepkg . - -ENTRYPOINT ["./kubepkg"] diff --git a/Dockerfile-kubepkg-rpm b/Dockerfile-kubepkg-rpm deleted file mode 100644 index 2d59221521b..00000000000 --- a/Dockerfile-kubepkg-rpm +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM golang:1.21.2-bookworm AS builder - -ENV GO111MODULE=on - -WORKDIR /workspace - -COPY . . - -RUN go build -o . ./cmd/kubepkg/... - - -FROM fedora:39 - -RUN dnf install -y \ - rpm-build \ - rpmdevtools \ - createrepo \ - && dnf clean all - -RUN useradd builder -u 9000 -m -s /bin/false - -USER builder - -RUN mkdir /home/builder/workspace - -WORKDIR /home/builder/workspace - -RUN rpmdev-setuptree - -COPY --chown=builder:builder ./cmd/kubepkg/templates ./templates -COPY --from=builder --chown=builder:builder /workspace/kubepkg . - -ENTRYPOINT ["./kubepkg", "rpms"] diff --git a/Makefile b/Makefile index d5572f3886f..8d66b1b691d 100644 --- a/Makefile +++ b/Makefile @@ -21,16 +21,6 @@ SHELL:=/usr/bin/env bash COLOR:=\\033[36m NOCOLOR:=\\033[0m -##@ Package - -.PHONY: verify-published-debs verify-published-rpms - -verify-published-debs: ## Ensure debs have been published - ./hack/packages/verify-published.sh debs - -verify-published-rpms: ## Ensure rpms have been published - ./hack/packages/verify-published.sh rpms - ##@ Verify .PHONY: verify verify-boilerplate verify-build verify-dependencies verify-go-mod diff --git a/README.md b/README.md index 2d676df398f..c73c13f05af 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Individual tools can be installed via `go install k8s.io/release/cmd/$TOOL@lates - [`schedule-builder`](#schedule-builder) - [Artifact Management](#artifact-management) - [`kpromo`](#kpromo) - - [`kubepkg`](#kubepkg) - [End User](#end-user) - [`bom`](#bom) - [`release-notes`](#release-notes) @@ -28,8 +27,6 @@ Individual tools can be installed via `go install k8s.io/release/cmd/$TOOL@lates - [`publish-release`](#publish-release) - [Legacy](#legacy) - [`push-build.sh`](#push-buildsh) -- [Experimental](#experimental) - - [`rapture`](#rapture) - [Contributing](#contributing) **Each of the headings below links to a tool's location.** @@ -100,16 +97,6 @@ responsible for promoting file or container artifacts Details: [Documentation](https://sigs.k8s.io/promo-tools/README.md#kpromo) -### [`kubepkg`](/cmd/kubepkg) - -Create Kubernetes deb/rpm packages. - -Status: In Progress - -Audience: [Release Managers][release-managers] - -Details: [Documentation](/cmd/kubepkg/README.md) - ## End User ### [`bom`](https://sigs.k8s.io/bom) @@ -153,16 +140,6 @@ Status: Deprecated (but still in use) Audience: [Release Managers][release-managers], Prowjobs -## Experimental - -### [`rapture`](hack/rapture/) - -Build operating system packages (`.deb` and RPM) - -Status: Experimental (but already in use) - -Audience: [Release Managers][release-managers], Googlers participating in releases - ## Contributing Please see [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on how to contribute. diff --git a/cloudbuild-kubepkg.yaml b/cloudbuild-kubepkg.yaml deleted file mode 100644 index 89e28c2be2f..00000000000 --- a/cloudbuild-kubepkg.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# See https://cloud.google.com/cloud-build/docs/build-config -timeout: 1200s -options: - substitution_option: ALLOW_LOOSE - -steps: - - name: gcr.io/cloud-builders/docker - args: - - build - - -f - - ./Dockerfile-kubepkg - - --tag=$_REGISTRY/kubepkg:$_GIT_TAG - - --tag=$_REGISTRY/kubepkg:latest - - . - - name: gcr.io/cloud-builders/docker - args: - - build - - -f - - ./Dockerfile-kubepkg-rpm - - --tag=$_REGISTRY/kubepkg-rpm:$_GIT_TAG - - --tag=$_REGISTRY/kubepkg-rpm:latest - - . - -substitutions: - # _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and - # can be used as a substitution - _GIT_TAG: '12345' - _PULL_BASE_REF: 'dev' - _REGISTRY: 'fake.repository/registry-name' - -tags: -- 'kubepkg' -- ${_GIT_TAG} -- ${_PULL_BASE_REF} - -images: - - 'gcr.io/$PROJECT_ID/kubepkg:$_GIT_TAG' - - 'gcr.io/$PROJECT_ID/kubepkg:latest' - - 'gcr.io/$PROJECT_ID/kubepkg-rpm:$_GIT_TAG' - - 'gcr.io/$PROJECT_ID/kubepkg-rpm:latest' diff --git a/cmd/kubepkg/.dockerignore b/cmd/kubepkg/.dockerignore deleted file mode 100644 index 10e3951a6c4..00000000000 --- a/cmd/kubepkg/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -docker-build.sh -Dockerfile -output/* diff --git a/cmd/kubepkg/.gitignore b/cmd/kubepkg/.gitignore deleted file mode 100644 index 9d229b10a2e..00000000000 --- a/cmd/kubepkg/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin/ -output/ -*.swp diff --git a/cmd/kubepkg/OWNERS b/cmd/kubepkg/OWNERS deleted file mode 100644 index 63e56e2a4c9..00000000000 --- a/cmd/kubepkg/OWNERS +++ /dev/null @@ -1,10 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -approvers: - - release-engineering-approvers -reviewers: - - build-admins - - release-engineering-approvers - - release-engineering-reviewers -labels: - - area/release-eng diff --git a/cmd/kubepkg/README.md b/cmd/kubepkg/README.md deleted file mode 100644 index 4ab6ff4c1b2..00000000000 --- a/cmd/kubepkg/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# kubepkg - -`kubepkg` is a tool for building deb and rpm packages for Kubernetes components. - -**NOTE: `kubepkg` is currently in development and its' design is expected to rapidly change. If you encounter errors, please file an issue in this repo.** - -- [Installation](#installation) -- [Usage](#usage) - - [Example: Building nightly kubeadm debs for amd64 architecture](#example-building-nightly-kubeadm-debs-for-amd64-architecture) - - [Example: Building deb specs for all packages, all channels, and all architectures](#example-building-deb-specs-for-all-packages-all-channels-and-all-architectures) -- [Known Issues](#known-issues) - - [Building rpms is not _currently_ supported](#building-rpms-is-not-currently-supported) - -## Installation - -From this directory: - -```shell -go install ./... -``` - -## Usage - -`kubepkg [command]` - -```shell -Available Commands: - debs debs creates Debian-based packages for Kubernetes components - help Help about any command - rpms rpms creates RPMs for Kubernetes components - -Flags: - --arch strings architectures to build for (default [amd64,arm,arm64,ppc64le,s390x]) - --channels strings channels to build for (default [release,testing,nightly]) - --cni-version string CNI version to build - --cri-tools-version string CRI tools version to build - -h, --help help for kubepkg - --kube-version string Kubernetes version to build - --log-level string the logging verbosity, either 'panic', 'fatal', 'error', 'warn', 'warning', 'info', 'debug' or 'trace' (default "info") - --packages strings packages to build (default [kubelet,kubectl,kubeadm,kubernetes-cni,cri-tools]) - --release-download-link-base string release download link base (default "https://dl.k8s.io") - --revision string deb package revision. (default "0") - --spec-only only create specs instead of building packages - --template-dir string template directory (default "templates/latest") -``` - -### Example: Building nightly kubeadm debs for amd64 architecture - -```shell -kubepkg debs --packages kubeadm --channels nightly --arch amd64 -``` - -### Example: Building deb specs for all packages, all channels, and all architectures - -```shell -kubepkg debs --spec-only -``` - -## Known Issues - -### Building rpms is not _currently_ supported - -We haven't written the logic for building rpms yet. - -Right now, you can build rpm specs using the `--spec-only` flag and then use a tool of your choice to build the rpms using the specs produced. diff --git a/cmd/kubepkg/cmd/debs.go b/cmd/kubepkg/cmd/debs.go deleted file mode 100644 index 67838dab12a..00000000000 --- a/cmd/kubepkg/cmd/debs.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package cmd - -import ( - "github.com/spf13/cobra" - - "k8s.io/release/pkg/kubepkg/options" -) - -// debsCmd represents the base command when called without any subcommands -var debsCmd = &cobra.Command{ - Use: "debs [--arch ] [--channels ]", - Short: "debs creates Debian-based packages for Kubernetes components", - Example: "kubepkg debs --arch amd64 --channels nightly", - SilenceUsage: true, - SilenceErrors: true, - PreRunE: func(*cobra.Command, []string) error { - return opts.Validate() - }, - RunE: func(*cobra.Command, []string) error { - return run(options.BuildDeb) - }, -} - -func init() { - rootCmd.AddCommand(debsCmd) -} diff --git a/cmd/kubepkg/cmd/root.go b/cmd/kubepkg/cmd/root.go deleted file mode 100644 index 3ac7ed2cc62..00000000000 --- a/cmd/kubepkg/cmd/root.go +++ /dev/null @@ -1,163 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package cmd - -import ( - "fmt" - - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - - "k8s.io/release/pkg/kubepkg" - "k8s.io/release/pkg/kubepkg/options" - "sigs.k8s.io/release-utils/log" -) - -// rootCmd represents the base command when called without any subcommands -var rootCmd = &cobra.Command{ - Use: "kubepkg", - Short: "kubepkg", - PersistentPreRunE: initLogging, -} - -var ( - opts *options.Options = options.New() - logLevel string - kubeVersion string - packages []string - channels []string - architectures []string - revision string - cniVersion string - criToolsVersion string - releaseDownloadLinkBase string - templateDir string - specOnly bool -) - -// Execute adds all child commands to the root command and sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. -func Execute() { - if err := rootCmd.Execute(); err != nil { - logrus.Fatal(err) - } -} - -func init() { - rootCmd.PersistentFlags().StringSliceVar( - &packages, - "packages", - opts.Packages(), - "packages to build", - ) - - rootCmd.PersistentFlags().StringSliceVar( - &channels, - "channels", - opts.Channels(), - "channels to build for", - ) - - rootCmd.PersistentFlags().StringSliceVar( - &architectures, - "arch", - opts.Architectures(), - "architectures to build for", - ) - - rootCmd.PersistentFlags().StringVar( - &kubeVersion, - "kube-version", - "", - "Kubernetes version to build", - ) - - rootCmd.PersistentFlags().StringVar( - &revision, - "revision", - opts.Revision(), - "deb package revision.", - ) - - rootCmd.PersistentFlags().StringVar( - &cniVersion, - "cni-version", - opts.CNIVersion(), - "CNI version to build", - ) - - rootCmd.PersistentFlags().StringVar( - &criToolsVersion, - "cri-tools-version", - opts.CRIToolsVersion(), - "CRI tools version to build", - ) - - rootCmd.PersistentFlags().StringVar( - &releaseDownloadLinkBase, - "release-download-link-base", - opts.ReleaseDownloadLinkBase(), - "release download link base", - ) - - rootCmd.PersistentFlags().StringVar( - &templateDir, - "template-dir", - opts.TemplateDir(), - "template directory", - ) - - rootCmd.PersistentFlags().BoolVar( - &specOnly, - "spec-only", - opts.SpecOnly(), - "only create specs instead of building packages", - ) - - rootCmd.PersistentFlags().StringVar( - &logLevel, - "log-level", - "info", - fmt.Sprintf("the logging verbosity, either %s", log.LevelNames()), - ) -} - -func initLogging(*cobra.Command, []string) error { - return log.SetupGlobalLogger(logLevel) -} - -func run(buildType options.BuildType) error { - opts := opts.WithPackages(packages...). - WithChannels(channels...). - WithArchitectures(architectures...). - WithKubeVersion(kubeVersion). - WithRevision(revision). - WithCNIVersion(cniVersion). - WithCRIToolsVersion(criToolsVersion). - WithReleaseDownloadLinkBase(releaseDownloadLinkBase). - WithTemplateDir(templateDir). - WithSpecOnly(specOnly). - WithBuildType(buildType) - logrus.Debugf("Using options: %+v", opts) - - client := kubepkg.New(opts) - builds, err := client.ConstructBuilds() - if err != nil { - return fmt.Errorf("running kubepkg: %w", err) - } - return client.WalkBuilds(builds) -} diff --git a/cmd/kubepkg/cmd/rpms.go b/cmd/kubepkg/cmd/rpms.go deleted file mode 100644 index 4f05daa64c7..00000000000 --- a/cmd/kubepkg/cmd/rpms.go +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package cmd - -import ( - "github.com/spf13/cobra" - - "k8s.io/release/pkg/kubepkg/options" -) - -// rpmsCmd represents the base command when called without any subcommands -var rpmsCmd = &cobra.Command{ - Use: "rpms [--arch ] [--channels ]", - Short: "rpms creates RPMs for Kubernetes components", - Example: "kubepkg rpms --arch amd64 --channels nightly", - SilenceUsage: true, - SilenceErrors: true, - PreRunE: func(*cobra.Command, []string) error { - return opts.Validate() - }, - RunE: func(*cobra.Command, []string) error { - return run(options.BuildRpm) - }, -} - -func init() { - rootCmd.AddCommand(rpmsCmd) -} diff --git a/cmd/kubepkg/main.go b/cmd/kubepkg/main.go deleted file mode 100644 index 1f84c3fd694..00000000000 --- a/cmd/kubepkg/main.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import "k8s.io/release/cmd/kubepkg/cmd" - -func main() { - cmd.Execute() -} diff --git a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/changelog b/cmd/kubepkg/templates/latest/deb/cri-tools/debian/changelog deleted file mode 100644 index b2785dd214b..00000000000 --- a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -cri-tools ({{ .Version }}-{{ .Revision }}) {{ .Channel }}; urgency=medium - - * https://github.com/kubernetes-sigs/cri-tools/releases/tag/v{{ .Version }} - - -- Kubernetes Authors {{ date }} diff --git a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/compat b/cmd/kubepkg/templates/latest/deb/cri-tools/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/control b/cmd/kubepkg/templates/latest/deb/cri-tools/debian/control deleted file mode 100644 index b2a1d4d08af..00000000000 --- a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: cri-tools -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes-sigs/cri-tools.git -Vcs-Browser: https://github.com/kubernetes-sigs/cri-tools/ - -Package: cri-tools -Architecture: {{ .BuildArch }} -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Container Runtime Interface Tools - Binaries that interact with the container runtime through the container runtime interface diff --git a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/copyright b/cmd/kubepkg/templates/latest/deb/cri-tools/debian/copyright deleted file mode 100644 index 48da061318a..00000000000 --- a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: cri-tools -Source: https://github.com/kubernetes-sigs/cri-tools/ - -Files: * -Copyright: 2018 The Kubernetes Authors. -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/cri-tools.install b/cmd/kubepkg/templates/latest/deb/cri-tools/debian/cri-tools.install deleted file mode 100644 index d38c9f9c504..00000000000 --- a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/cri-tools.install +++ /dev/null @@ -1 +0,0 @@ -bin/crictl usr/bin/ diff --git a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/rules b/cmd/kubepkg/templates/latest/deb/cri-tools/debian/rules deleted file mode 100755 index 485a5e6b03a..00000000000 --- a/cmd/kubepkg/templates/latest/deb/cri-tools/debian/rules +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -build: - echo noop - -binary: - mkdir -p ./bin - curl -sSL --fail --retry 5 \ - "https://storage.googleapis.com/k8s-artifacts-cri-tools/release/v{{ .Version }}/crictl-v{{ .Version }}-linux-{{ .GoArch }}.tar.gz" \ - | tar -C ./bin -xz - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf b/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf deleted file mode 100644 index bd1b077f399..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf +++ /dev/null @@ -1,11 +0,0 @@ -# Note: This dropin only works with kubeadm and kubelet v1.11+ -[Service] -Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" -Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" -# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically -EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env -# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use -# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file. -EnvironmentFile=-/etc/default/kubelet -ExecStart= -ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/changelog b/cmd/kubepkg/templates/latest/deb/kubeadm/debian/changelog deleted file mode 100644 index de032734f7a..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubeadm ({{ .Version }}-{{ .Revision }}) {{ .Channel }}; urgency=medium - - * https://git.k8s.io/kubernetes/CHANGELOG/README.md - - -- Kubernetes Authors {{ date }} - diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/compat b/cmd/kubepkg/templates/latest/deb/kubeadm/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/control b/cmd/kubepkg/templates/latest/deb/kubeadm/debian/control deleted file mode 100644 index 50a226adae4..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubeadm -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubeadm -Architecture: {{ .BuildArch }} -Depends: kubelet (>= {{ index .Dependencies "kubelet" }}), kubectl (>= {{ index .Dependencies "kubectl" }}), kubernetes-cni (>= {{ index .Dependencies "kubernetes-cni" }}), cri-tools (>= {{ index .Dependencies "cri-tools" }}), ${misc:Depends} -Description: Kubernetes Cluster Bootstrapping Tool - The Kubernetes command line tool for bootstrapping a Kubernetes cluster. diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/copyright b/cmd/kubepkg/templates/latest/deb/kubeadm/debian/copyright deleted file mode 100644 index 82f8ab2c23c..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubeadm -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Kubernetes Authors. -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/kubeadm.install b/cmd/kubepkg/templates/latest/deb/kubeadm/debian/kubeadm.install deleted file mode 100644 index fcf2ffe70fc..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/kubeadm.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/kubeadm usr/bin/ -{{ .KubeadmKubeletConfigFile }} etc/systemd/system/kubelet.service.d/ diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/postinst b/cmd/kubepkg/templates/latest/deb/kubeadm/debian/postinst deleted file mode 100755 index 47abed17005..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/postinst +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# see: dh_installdeb(1) - -set -o errexit -set -o nounset - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - # because kubeadm package adds kubelet drop-ins, we must daemon-reload - # and restart kubelet now. restarting kubelet is ok because kubelet - # postinst configure step auto-starts it. - systemctl daemon-reload 2>/dev/null || true - systemctl restart kubelet 2>/dev/null || true - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/rules b/cmd/kubepkg/templates/latest/deb/kubeadm/debian/rules deleted file mode 100755 index 00c9af431ce..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/rules +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 -KUBE_LOCAL_ARTIFACTS?= - -build: - echo noop - -binary: - mkdir -p usr/bin -ifneq ($(KUBE_LOCAL_ARTIFACTS),) - cp $(KUBE_LOCAL_ARTIFACTS)/bin/linux/{{ .GoArch }}/kubeadm usr/bin/kubeadm -else - curl --fail -sSL --retry 5 \ - -o usr/bin/kubeadm \ - "{{ .DownloadLinkBase }}/bin/linux/{{ .GoArch }}/kubeadm" -endif - - chmod +x usr/bin/kubeadm - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/source/format b/cmd/kubepkg/templates/latest/deb/kubeadm/debian/source/format deleted file mode 100644 index 89ae9db8f88..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubeadm/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/cmd/kubepkg/templates/latest/deb/kubectl/debian/changelog b/cmd/kubepkg/templates/latest/deb/kubectl/debian/changelog deleted file mode 100644 index bd9f30d65c0..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubectl/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubectl ({{ .Version }}-{{ .Revision }}) {{ .Channel }}; urgency=medium - - * https://git.k8s.io/kubernetes/CHANGELOG/README.md - - -- Kubernetes Authors {{ date }} - diff --git a/cmd/kubepkg/templates/latest/deb/kubectl/debian/compat b/cmd/kubepkg/templates/latest/deb/kubectl/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubectl/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/cmd/kubepkg/templates/latest/deb/kubectl/debian/control b/cmd/kubepkg/templates/latest/deb/kubectl/debian/control deleted file mode 100644 index 4055ef6ed3c..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubectl/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubectl -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubectl -Architecture: {{ .BuildArch }} -Depends: ${misc:Depends} -Description: Kubernetes Command Line Tool - The Kubernetes command line tool for interacting with the Kubernetes API. diff --git a/cmd/kubepkg/templates/latest/deb/kubectl/debian/copyright b/cmd/kubepkg/templates/latest/deb/kubectl/debian/copyright deleted file mode 100644 index 6bc6e4e66ed..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubectl/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubectl -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Kubernetes Authors. -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/cmd/kubepkg/templates/latest/deb/kubectl/debian/kubectl.install b/cmd/kubepkg/templates/latest/deb/kubectl/debian/kubectl.install deleted file mode 100644 index 3b8f206c20b..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubectl/debian/kubectl.install +++ /dev/null @@ -1 +0,0 @@ -usr/bin/kubectl usr/bin/ diff --git a/cmd/kubepkg/templates/latest/deb/kubectl/debian/postinst b/cmd/kubepkg/templates/latest/deb/kubectl/debian/postinst deleted file mode 100755 index 750b3f1c086..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubectl/debian/postinst +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# see: dh_installdeb(1) - -set -o errexit -set -o nounset - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/cmd/kubepkg/templates/latest/deb/kubectl/debian/rules b/cmd/kubepkg/templates/latest/deb/kubectl/debian/rules deleted file mode 100755 index 213a6d1bfc0..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubectl/debian/rules +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 -KUBE_LOCAL_ARTIFACTS?= - -build: - echo noop - -binary: - mkdir -p usr/bin -ifneq ($(KUBE_LOCAL_ARTIFACTS),) - cp $(KUBE_LOCAL_ARTIFACTS)/bin/linux/{{ .GoArch }}/kubectl usr/bin/kubectl -else - curl --fail -sSL --retry 5 \ - -o usr/bin/kubectl \ - "{{ .DownloadLinkBase }}/bin/linux/{{ .GoArch }}/kubectl" -endif - chmod +x usr/bin/kubectl - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/cmd/kubepkg/templates/latest/deb/kubectl/debian/source/format b/cmd/kubepkg/templates/latest/deb/kubectl/debian/source/format deleted file mode 100644 index 89ae9db8f88..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubectl/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/debian/changelog b/cmd/kubepkg/templates/latest/deb/kubelet/debian/changelog deleted file mode 100644 index 82854f336dc..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubelet ({{ .Version }}-{{ .Revision }}) {{ .Channel }}; urgency=medium - - * https://git.k8s.io/kubernetes/CHANGELOG/README.md - - -- Kubernetes Authors {{ date }} - diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/debian/compat b/cmd/kubepkg/templates/latest/deb/kubelet/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/debian/control b/cmd/kubepkg/templates/latest/deb/kubelet/debian/control deleted file mode 100644 index cdb86b2873c..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubelet -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 9.20160709) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubelet -Architecture: {{ .BuildArch }} -Depends: iptables (>= 1.4.21), kubernetes-cni (>= {{ index .Dependencies "kubernetes-cni" }}), iproute2, socat, util-linux, mount, ebtables, ethtool, conntrack, ${misc:Depends} -Description: Kubernetes Node Agent - The node agent of Kubernetes, the container cluster manager diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/debian/copyright b/cmd/kubepkg/templates/latest/deb/kubelet/debian/copyright deleted file mode 100644 index da29f95bf37..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubelet -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Kubernetes Authors. -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/debian/kubelet.install b/cmd/kubepkg/templates/latest/deb/kubelet/debian/kubelet.install deleted file mode 100644 index b88ef340d95..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/debian/kubelet.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/kubelet usr/bin/ -lib/systemd/system/kubelet.service lib/systemd/system/ diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/debian/postinst b/cmd/kubepkg/templates/latest/deb/kubelet/debian/postinst deleted file mode 100755 index f9e69e31a81..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/debian/postinst +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# postinst script for kubelet -# -# see: dh_installdeb(1) - -set -o errexit -set -o nounset - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -mkdir -p /etc/kubernetes/manifests - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/debian/rules b/cmd/kubepkg/templates/latest/deb/kubelet/debian/rules deleted file mode 100755 index 5c7271def77..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/debian/rules +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 -KUBE_LOCAL_ARTIFACTS?= - -build: - echo noop - -binary: - mkdir -p usr/bin -ifneq ($(KUBE_LOCAL_ARTIFACTS),) - cp $(KUBE_LOCAL_ARTIFACTS)/bin/linux/{{ .GoArch }}/kubelet usr/bin/kubelet -else - curl --fail -sSL --retry 5 \ - -o usr/bin/kubelet \ - "{{ .DownloadLinkBase }}/bin/linux/{{ .GoArch }}/kubelet" -endif - chmod +x usr/bin/kubelet - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_systemd_enable - dh_installinit - dh_systemd_start - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ --with systemd diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/debian/source/format b/cmd/kubepkg/templates/latest/deb/kubelet/debian/source/format deleted file mode 100644 index 89ae9db8f88..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service b/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service deleted file mode 100644 index 15d3e9186dc..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=kubelet: The Kubernetes Node Agent -Documentation=https://kubernetes.io/docs/home/ -Wants=network-online.target -After=network-online.target - -[Service] -ExecStart=/usr/bin/kubelet -Restart=always -StartLimitInterval=0 -RestartSec=10 - -[Install] -WantedBy=multi-user.target diff --git a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/.gitignore b/cmd/kubepkg/templates/latest/deb/kubernetes-cni/.gitignore deleted file mode 100644 index e660fd93d31..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin/ diff --git a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/changelog b/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/changelog deleted file mode 100644 index 952fa8b5509..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubernetes-cni ({{ .Version }}-{{ .Revision }}) {{ .Channel }}; urgency=medium - - * https://git.k8s.io/kubernetes/CHANGELOG/README.md - - -- Kubernetes Authors {{ date }} - diff --git a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/compat b/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/control b/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/control deleted file mode 100644 index 3129168ab32..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubernetes-cni -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubernetes-cni -Architecture: {{ .BuildArch }} -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Kubernetes CNI - The binaries required to provision container networking diff --git a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/copyright b/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/copyright deleted file mode 100644 index 382d7e8faaf..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubernetes-cni -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Linux Foundation and its contributors -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/kubernetes-cni.install b/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/kubernetes-cni.install deleted file mode 100644 index 001a3b4c7b1..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/kubernetes-cni.install +++ /dev/null @@ -1 +0,0 @@ -bin/ opt/cni diff --git a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/rules b/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/rules deleted file mode 100755 index 26d9c78064d..00000000000 --- a/cmd/kubepkg/templates/latest/deb/kubernetes-cni/debian/rules +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 - -build: - echo noop - -binary: - mkdir -p ./bin - curl -sSL --fail --retry 5 \ - "{{ .CNIDownloadLink }}" \ - | tar -C ./bin -xz - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/cmd/kubepkg/templates/latest/rpm/cri-tools/cri-tools.spec b/cmd/kubepkg/templates/latest/rpm/cri-tools/cri-tools.spec deleted file mode 100644 index de6f4f22ab2..00000000000 --- a/cmd/kubepkg/templates/latest/rpm/cri-tools/cri-tools.spec +++ /dev/null @@ -1,34 +0,0 @@ -Name: cri-tools -Version: {{ .Version }} -Release: {{ .Revision }} -Summary: Command-line utility for interacting with a container runtime. - -License: ASL 2.0 -URL: https://kubernetes.io -Source0: https://storage.googleapis.com/k8s-artifacts-cri-tools/release/v{{ .Version }}/crictl-v{{ .Version }}-linux-{{ .GoArch }}.tar.gz - -BuildRequires: systemd -BuildRequires: curl - -%description -Command-line utility for interacting with a container runtime. - -%prep -%setup -c -a 0 -T -n cri-tools - -%install -cd %{_builddir} -mkdir -p %{buildroot}%{_bindir} -install -p -m 755 -t %{buildroot}%{_bindir}/ cri-tools/crictl - -%files -%{_bindir}/crictl - -# TODO: Do we need these? -#%license add-license-file-here -#%doc add-docs-here - - -%changelog -* Sat Jan 4 2020 Stephen Augustus - 1.18.0 -- Create separate spec file for cri-tools diff --git a/cmd/kubepkg/templates/latest/rpm/kubeadm/10-kubeadm.conf b/cmd/kubepkg/templates/latest/rpm/kubeadm/10-kubeadm.conf deleted file mode 100644 index 19475e59ac9..00000000000 --- a/cmd/kubepkg/templates/latest/rpm/kubeadm/10-kubeadm.conf +++ /dev/null @@ -1,11 +0,0 @@ -# Note: This dropin only works with kubeadm and kubelet v1.11+ -[Service] -Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" -Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" -# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically -EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env -# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use -# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file. -EnvironmentFile=-/etc/sysconfig/kubelet -ExecStart= -ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS diff --git a/cmd/kubepkg/templates/latest/rpm/kubeadm/kubeadm.spec b/cmd/kubepkg/templates/latest/rpm/kubeadm/kubeadm.spec deleted file mode 100644 index 446b1bb4d8c..00000000000 --- a/cmd/kubepkg/templates/latest/rpm/kubeadm/kubeadm.spec +++ /dev/null @@ -1,47 +0,0 @@ -Name: kubeadm -Version: {{ .Version }} -Release: {{ .Revision }} -Summary: Command-line utility for administering a Kubernetes cluster. - -License: ASL 2.0 -URL: https://kubernetes.io -Source0: {{ .DownloadLinkBase }}/bin/linux/{{ .GoArch }}/kubeadm -Source1: 10-kubeadm.conf - -# TODO: Need to templatize dependencies -BuildRequires: systemd -BuildRequires: curl -Requires: kubelet >= {{ index .Dependencies "kubelet" }} -Requires: kubectl >= {{ index .Dependencies "kubectl" }} -Requires: kubernetes-cni >= {{ index .Dependencies "kubernetes-cni" }} -Requires: cri-tools >= {{ index .Dependencies "cri-tools" }} - -%description -Command-line utility for administering a Kubernetes cluster. - -%prep -cp -p %SOURCE0 %{_builddir}/ -cp -p %SOURCE1 %{_builddir}/ - -%install -cd %{_builddir} -mkdir -p %{buildroot}%{_sysconfdir}/kubernetes/manifests/ -mkdir -p %{buildroot}%{_bindir} -mkdir -p %{buildroot}%{_unitdir}/kubelet.service.d - -install -m 755 -d %{buildroot}%{_sysconfdir}/kubernetes/manifests/ -install -p -m 755 -t %{buildroot}%{_bindir}/ kubeadm -install -p -m 644 -t %{buildroot}%{_unitdir}/kubelet.service.d/ 10-kubeadm.conf - -%files -%{_bindir}/kubeadm -%{_unitdir}/kubelet.service.d/10-kubeadm.conf - -# TODO: Do we need these? -#%license add-license-file-here -#%doc add-docs-here - - -%changelog -* Sat Jan 4 2020 Stephen Augustus - 1.18.0 -- Create separate spec file for kubeadm diff --git a/cmd/kubepkg/templates/latest/rpm/kubectl/kubectl.spec b/cmd/kubepkg/templates/latest/rpm/kubectl/kubectl.spec deleted file mode 100644 index aa29b6ee398..00000000000 --- a/cmd/kubepkg/templates/latest/rpm/kubectl/kubectl.spec +++ /dev/null @@ -1,35 +0,0 @@ -Name: kubectl -Version: {{ .Version }} -Release: {{ .Revision }} -Summary: Command-line utility for interacting with a Kubernetes cluster. - -License: ASL 2.0 -URL: https://kubernetes.io -Source0: {{ .DownloadLinkBase }}/bin/linux/{{ .GoArch }}/kubectl - -BuildRequires: systemd -BuildRequires: curl - -%description -Command-line utility for interacting with a Kubernetes cluster. - -%prep -cp -p %SOURCE0 %{_builddir}/ - -%install - -cd %{_builddir} -mkdir -p %{buildroot}/%{_bindir} -install -p -m 755 -t %{buildroot}%{_bindir}/ kubectl - -%files -%{_bindir}/kubectl - -# TODO: Do we need these? -#%license add-license-file-here -#%doc add-docs-here - - -%changelog -* Sat Jan 4 2020 Stephen Augustus - 1.18.0 -- Create separate spec file for kubectl diff --git a/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.env b/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.env deleted file mode 100644 index b6c7084e3a1..00000000000 --- a/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.env +++ /dev/null @@ -1 +0,0 @@ -KUBELET_EXTRA_ARGS= diff --git a/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.service b/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.service deleted file mode 100644 index f25b70985cb..00000000000 --- a/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=kubelet: The Kubernetes Node Agent -Documentation=https://kubernetes.io/docs/ -Wants=network-online.target -After=network-online.target - -[Service] -ExecStart=/usr/bin/kubelet -Restart=always -StartLimitInterval=0 -RestartSec=10 - -[Install] -WantedBy=multi-user.target diff --git a/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.spec b/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.spec deleted file mode 100644 index b75080a4aeb..00000000000 --- a/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.spec +++ /dev/null @@ -1,69 +0,0 @@ -Name: kubelet -Version: {{ .Version }} -Release: {{ .Revision }} -Summary: Container cluster management - -License: ASL 2.0 -URL: https://kubernetes.io -Source0: {{ .DownloadLinkBase }}/bin/linux/{{ .GoArch }}/kubelet -Source1: kubelet.env -Source2: kubelet.service - -BuildRequires: systemd -BuildRequires: curl -Requires: iptables >= 1.4.21 -Requires: kubernetes-cni >= {{ index .Dependencies "kubernetes-cni" }} -Requires: socat -Requires: util-linux -Requires: ethtool -Requires: iproute -Requires: ebtables -Requires: conntrack - -%description -The node agent of Kubernetes, the container cluster manager. - -%prep -cp -p %SOURCE0 %{_builddir}/ -cp -p %SOURCE1 %{_builddir}/ -cp -p %SOURCE2 %{_builddir}/ - -%install -cd %{_builddir} -mkdir -p %{buildroot}%{_unitdir}/kubelet.service.d/ -mkdir -p %{buildroot}%{_bindir} -mkdir -p %{buildroot}/var/lib/kubelet/ -mkdir -p %{buildroot}%{_sysconfdir}/sysconfig/ - -install -m 755 -d %{buildroot}%{_unitdir} -install -m 755 -d %{buildroot}%{_unitdir}/kubelet.service.d/ -install -m 755 -d %{buildroot}%{_bindir} -install -m 755 -d %{buildroot}/var/lib/kubelet/ -install -p -m 755 -t %{buildroot}%{_bindir}/ kubelet -install -p -m 644 -t %{buildroot}%{_unitdir}/ kubelet.service -install -m 755 -d %{buildroot}%{_sysconfdir}/sysconfig/ -install -p -m 644 -T kubelet.env %{buildroot}%{_sysconfdir}/sysconfig/kubelet - -%files -%{_bindir}/kubelet -%{_unitdir}/kubelet.service - -%config(noreplace) %{_sysconfdir}/sysconfig/kubelet - -# TODO: Do we need these? -#%license add-license-file-here -#%doc add-docs-here - - -%changelog -* Mon Jun 22 2020 Stephen Augustus - 1.18.4 -- Unbundle CNI plugins (v0.8.6) from kubelet package and release as kubernetes-cni - -* Fri May 22 2020 Stephen Augustus - 1.18.4 -- Bundle CNI plugins (v0.8.6) in kubelet package - -* Sat Jan 4 2020 Stephen Augustus - 1.18.0 -- Move kubeadm into separate spec file -- Move kubectl into separate spec file -- Move kubernetes-cni into separate spec file -- Move cri-tools into separate spec file diff --git a/cmd/kubepkg/templates/latest/rpm/kubernetes-cni/kubernetes-cni.spec b/cmd/kubepkg/templates/latest/rpm/kubernetes-cni/kubernetes-cni.spec deleted file mode 100644 index 636aca9b604..00000000000 --- a/cmd/kubepkg/templates/latest/rpm/kubernetes-cni/kubernetes-cni.spec +++ /dev/null @@ -1,38 +0,0 @@ -Name: kubernetes-cni -Version: {{ .Version }} -Release: {{ .Revision }} -Summary: Binaries required to provision kubernetes container networking - -License: ASL 2.0 -URL: https://kubernetes.io -Source0: {{ .CNIDownloadLink }} - -BuildRequires: systemd -BuildRequires: curl -Requires: kubelet - -%description -Binaries required to provision container networking. - -%prep -%setup -c -D -T -a 0 -n cni-plugins - -%install -cd %{_builddir} -mkdir -p %{buildroot}%{_sysconfdir}/cni/net.d/ -mkdir -p %{buildroot}/opt/cni/bin -install -m 755 -d %{buildroot}%{_sysconfdir}/cni/net.d/ -install -m 755 -d %{buildroot}/opt/cni/bin -mv cni-plugins/* %{buildroot}/opt/cni/bin/ - -%files -/opt/cni - -# TODO: Do we need these? -#%license add-license-file-here -#%doc add-docs-here - - -%changelog -* Sat Jan 4 2020 Stephen Augustus - 1.18.0 -- Create separate spec file for kubernetes-cni diff --git a/compile-release-tools b/compile-release-tools index 2b62df69940..01146b9c518 100755 --- a/compile-release-tools +++ b/compile-release-tools @@ -20,7 +20,6 @@ set -o pipefail RELEASE_TOOLS=( krel - kubepkg schedule-builder publish-release release-notes diff --git a/dependencies.yaml b/dependencies.yaml index 704b6a49d36..c82a5e6e3f1 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -13,36 +13,6 @@ dependencies: - path: hack/verify-dependencies.sh match: VERSION=(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))? - # CNI plugins - - name: "CNI plugins" - version: 1.1.1 - refPaths: - - path: packages/deb/build.go - match: currentCNIVersion\s+= "\d+\.\d+.\d+" - - path: packages/rpm/kubelet.spec - match: \%global CNI_VERSION \d+\.\d+.\d+ - - path: pkg/kubepkg/kubepkg.go - match: CurrentCNIVersion\s+= "\d+\.\d+.\d+" - - - name: "CNI plugins: minimum version" - version: 0.8.6 - refPaths: - - path: packages/rpm/kubelet.spec - match: kubernetes-cni >= \d+\.\d+.\d+ - - path: pkg/kubepkg/kubepkg.go - match: MinimumCNIVersion\s+= "\d+\.\d+.\d+" - - # CRI Tools - - name: "crictl" - version: 1.25.0 - refPaths: - - path: packages/deb/build.go - match: criToolsVersion\s+= "\d+\.\d+.\d+" - - path: packages/deb/build_test.go - match: cri-tools \(>= \d+.\d+.\d+\) - - path: packages/rpm/kubelet.spec - match: CRI_TOOLS_VERSION \d+.\d+.\d+ - # cosign - name: "ghcr.io/sigstore/cosign/cosign" version: v2.2.0@sha256:280b47054876d415f66a279e666e35157cae6881f3538599710290c70bb75369 @@ -59,10 +29,6 @@ dependencies: - name: "golang" version: 1.21.2 refPaths: - - path: Dockerfile-kubepkg - match: FROM golang:\d+.\d+(alpha|beta|rc)?\.?(\d+)-(bookworm|bullseye) AS builder - - path: Dockerfile-kubepkg-rpm - match: FROM golang:\d+.\d+(alpha|beta|rc)?\.?(\d+)-(bookworm|bullseye) AS builder - path: images/build/cross/Makefile match: GO_VERSION\ \?=\ \d+.\d+(alpha|beta|rc)?\.?(\d+)? - path: images/build/cross/variants.yaml @@ -73,8 +39,6 @@ dependencies: match: "GO_VERSION: '\\d+.\\d+(alpha|beta|rc)?\\.?(\\d+)?'" - path: images/releng/ci/variants.yaml match: "GO_VERSION: '\\d+.\\d+(alpha|beta|rc)?\\.?(\\d+)?'" - - path: packages/deb/Dockerfile - match: FROM golang:\d+.\d+(alpha|beta|rc)?\.?(\d+)-(bookworm|bullseye) # Golang pre-releases are denoted as `1.y.z` # Example: go1.17rc1 @@ -102,8 +66,6 @@ dependencies: match: go \d+.\d+ - path: images/build/go-runner/go.mod match: go \d+.\d+ - - path: packages/deb/go.mod - match: go \d+.\d+ - name: "golang: after kubernetes/kubernetes update" version: 1.21.2 @@ -445,8 +407,6 @@ dependencies: refPaths: - path: images/build/cross/Makefile match: OS_CODENAME\ \?=\ bullseye - - path: packages/deb/Dockerfile - match: FROM golang:\d+.\d+(alpha|beta|rc)?\.?(\d+)-bullseye - name: "Debian: codename (default)" version: bullseye diff --git a/hack/packages/verify-published.sh b/hack/packages/verify-published.sh deleted file mode 100755 index 78dba9bd9f7..00000000000 --- a/hack/packages/verify-published.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o errexit -set -o nounset -set -o pipefail - -# TODO: Add logic to support checking all the existence of all packages, not just kubeadm -# The full list is: kubeadm, kubelet, kubectl, cri-tools, kubernetes-cni - -PACKAGE_TYPE="$1" - -num_supported_versions=3 -# supported_versions will be dynamically populated -supported_versions="" -latest_minor_version=$(curl -sSL dl.k8s.io/release/stable.txt | cut -f2 -d'.') -unstable_versions="alpha|beta|rc" -skipped="" -missing="" -available="" - -for (( i = 0; i < num_supported_versions; i++ )); do - supported_versions="1.$((latest_minor_version-i)) ${supported_versions}" -done - -for release in $(curl -s https://api.github.com/repos/kubernetes/kubernetes/releases | jq -r '.[].name'); do - minor=$(echo "${release}" | cut -f1,2 -d'.') - if [[ "${release}" =~ $unstable_versions ]]; then - # alpha, beta, rc releases should be ignored - echo "Unstable version ${release} ignored" - elif [[ "${release}" == "v1.20.3" ]]; then - # v1.20.3 was interrupted due to a conformance metadata - # problem. We ignore this release as no packages were - # published - # - # ref: https://groups.google.com/g/kubernetes-dev/c/oUpY9vWgzJo - echo "Ignoring v1.20.3: no packages were created" - elif [[ $supported_versions != *"${minor#v}"* ]]; then - # release we don't care about (e.g. older releases) - skipped="${skipped} ${release}" - else - case "${PACKAGE_TYPE}" in - "debs") - # Install dependencies - apt-get update && apt-get install -y apt-transport-https curl jq gnupg2 - - # Set up Kubernetes packages via apt - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - - cat </etc/apt/sources.list.d/kubernetes.list -deb http://apt.kubernetes.io/ kubernetes-xenial main -EOF - apt-get update - - deb_policy=$(apt-cache policy kubeadm) - - if [[ "${deb_policy}" != *"${release#v}"* ]]; then - # release we care about but has missing debs - missing="${missing} ${release}" - else - # All good, the expected deb package is available - available="${available} ${release}" - fi - ;; - "rpms") - # Set up Kubernetes packages via yum - mkdir -p /etc/yum.repos.d - cat < /etc/yum.repos.d/kubernetes.repo -[kubernetes] -name=Kubernetes -baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 -enabled=1 -gpgcheck=0 -repo_gpgcheck=0 -EOF - yum update -y - - rpm_policy=$(yum --showduplicates list kubeadm) - - if [[ "${rpm_policy}" != *"${release#v}"* ]]; then - # release we care about but has missing rpms - missing="${missing} ${release}" - else - # All good, the expected deb package is available - available="${available} ${release}" - fi - ;; - esac - fi -done - -if [[ -n "${skipped}" ]]; then - echo "Skipped these versions because they aren't supported:" - echo "${skipped}" -fi - -if [[ -n "${available}" ]]; then - echo "These expected packages were found:" - echo "${available}" -fi - -if [[ -n "${missing}" ]]; then - echo "ERROR: These versions do not have matching packages:" - echo "${missing}" - exit 1 -else - echo "" - echo "TESTS PASSED!! All necessary packages are pushed!" - echo "" -fi diff --git a/hack/rapture/OWNERS b/hack/rapture/OWNERS deleted file mode 100644 index e93b8a86748..00000000000 --- a/hack/rapture/OWNERS +++ /dev/null @@ -1,6 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -approvers: - - build-admins -reviewers: - - build-admins diff --git a/hack/rapture/README.md b/hack/rapture/README.md deleted file mode 100644 index 478bf55e831..00000000000 --- a/hack/rapture/README.md +++ /dev/null @@ -1,197 +0,0 @@ -# Packaging Kubernetes - -_Author(s): Sumitran Raghunathan ([@sumitranr](https://github.com/sumitranr))_ - -_Editor(s): Stephen Augustus ([@justaugustus](https://github.com/justaugustus)), Sascha Grunert ([@saschagrunert](https://github.com/saschagrunert))_ - -_Original document: [Building debs/rpms for Kubernetes -](https://docs.google.com/document/d/1PAN5tVJO_NMfHZmnk8mDQTwAbFHPky7JBgWJgckNjro/edit?usp=sharing)_ - -- [Introduction](#introduction) -- [Communication](#communication) -- [Release Steps](#release-steps) - - [Dependency Pre-checks](#dependency-pre-checks) - - [Permissions](#permissions) - - [Clone Release Repository](#clone-release-repository) - - [Authenticate](#authenticate) - - [Build the Debs & RPMs](#build-the-debs--rpms) - - [Notes](#notes) - - [Validating packages](#validating-packages) - - [Package verification tests](#package-verification-tests) - -## Introduction - -This guide outlines the process of building debs/rpms for Kubernetes minor and patch releases. - -**DISCLAIMER: This document was initially drafted for Google internal release managers and has been published here (with edits) for the sake of visibility into the Kubernetes build/packaging process. With that in mind, there are several links and processes referenced here that can only be accessed/performed by a Google employee with the requisite access to Google build systems/tooling. We will refer to these Googlers as ["Kubernetes Build Admins"][kubernetes-build-admins] across this guide.** - -## Communication - -[Release Managers][release-managers] will reach out to the [Kubernetes Build Admins][kubernetes-build-admins] via the [Release Managers Google Group][release-managers-group] or [`#release-management`][release-management-slack] (for more synchronous communication) requesting help to publish the debs and rpms. - -Release Managers requesting debs/rpms should be sure to provide explicit details on the package name(s), version(s), and revision(s) they need built. - -**n.b. As much as possible, communications with the Kubernetes Build Admins should happen on public forums (email, Slack public channels), not direct messaging, except in instances where doing so would run contrary to our [security policies][security-release-process] e.g., building packages for a release which addresses an embargoed CVE.** - -## Release Steps - -In this process, we are pulling the artifacts published by a Release Manager to the GCS bucket and building debs/rpms to be published to the rapture repository. - -Refer to the [Branch Manager handbook][branch-manager-handbook] for details on the artifacts that are built by Release Managers. - -See also the [rapture documentation][rapture-readme], which contains details on running `rapture` (Google internal packaging tool). - -### Dependency Pre-checks - -Before starting the release process, check for following items in your system. - -- Docker should be installed (`docker -v`) -- You should be able to run docker commands without sudo (`docker image ls` ) -- rpm should be installed (`rpm --version`) -- rapture should be installed (`rapture --version`) -- gsutil should be installed (`gsutil -v`) - -### Permissions - -Must be a member of mdb group - [mdb/cloud-kubernetes-release-owners](mdb/cloud-kubernetes-release-owners) to be able to perform the debs/rpms releases. - -### Clone Release Repository - -Before proceeding with the release, ensure the [kubernetes/release][kubernetes/release] repository is checked out. - -**NOTE**: It is a good idea to start in a clean directory, when possible. - -`VERSION` should be the Kubernetes version we are building the debs/rpms for e.g., `1.20.0` - -_The directory name can be anything. We'll use `$HOME/k8s-1.20.0` as the example here._ - -```shell -export VERSION=1.20.0 # this is an example, use the appropriate version here -mkdir -p $HOME/k8s-$VERSION -cd $HOME/k8s-$VERSION -git clone https://github.com/kubernetes/release.git -cd release -``` - -You must checkout `kubernetes/release` -> [`master`](https://github.com/kubernetes/release.git) - -```shell -git checkout master -``` - -### Authenticate - -Run the following commands to ensure that we are logged in and also the proper project context is setup. - -```shell -gcert -gcloud auth login -gcloud config set project kubernetes-release-test -``` - -### Build the Debs & RPMs - -The debs and RPMs are build by using `krel release --nomock --type=official` in -Google Cloud Build, which is executed by a [Release Manager][release-managers]. -This step places the debs and rpms in the production bucket, for example: - -- https://console.cloud.google.com/storage/browser/kubernetes-release/release/v1.26.0/deb -- https://console.cloud.google.com/storage/browser/kubernetes-release/release/v1.26.0/rpm - -[Kubernetes Build Admins][kubernetes-build-admins] have to publish those -packages manually to ensure they are available on -[apt.k8s.io](http://apt.k8s.io) as well as [yum.k8s.io](http://yum.k8s.io) by -running: - -```shell -./hack/rapture/publish-packages.sh $VERSION -``` - -#### Notes - -- There are several points during the process where you will be prompted to answer “y/N” or your password. -- There will be a warning about trusty. This can be ignored. -- The RPM signing process can not be done in parallel, but all other steps maybe be. - -### Validating packages - -Now that `rapture` has successfully complete, we need to verify the packages that were just created. This validation can be done on any instance where Kubernetes is not already installed. (Ideally, you would want to spin up a new VM to test.) - -To check for publish success, see the [Debian package list][deb-package-list] and [RPM package list][rpm-package-list] for the versions that were just uploaded. Or curl via shell for Debian and RPM respectively via the [check_rapture script](./check_rapture.sh): -```shell -./hack/rapture/check_rapture.sh $VERSION -``` - -**If you are on a system with any of these packages are already installed, you must uninstall them first.** - -Follow the [kubeadm instructions][kubeadm-install] to install kubeadm, kubelet, and kubectl. - -To confirm Debian packages - -```shell -# should be the Kubernetes version we are building the debs/rpms for e.g., `1.20.0` -version= -[[ -n "${version}" ]] \ - && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg \ - | sudo apt-key add - \ - && echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" \ - | sudo tee /etc/apt/sources.list.d/kubernetes.list \ - && sudo apt-get update -q \ - && sudo apt-get install -qy kubelet="${version}-00" kubectl="${version}-00" kubeadm="${version}-00" -``` - -To confirm Rhel packages - -```shell -# should be the Kubernetes version we are building the debs/rpms for e.g., `1.20.0` -version= -if [[ -n "${version}" ]]; then -cat <&2 -} - -fatal() { - log "FATAL: $*" - exit 1 -} - -version=${1:-""} -architectures=${2:-""} - -if [[ "$version" == "" ]]; then - fatal "no version specified" -fi - -USER=${USER:-$(id -u)} - -build_debs() { - local distro=xenial - - log "Clearing output dir" - DEBDIR="${RELEASE_ROOT:?}"/packages/deb - rm -rf "${DEBDIR:?}"/bin - cd "${DEBDIR:?}" - - log "Setting all Revisions to \"00\" in build.go" - sed -i -r -e 's/\b(Revision:\s*)"[0-9]{2}"/\1"00"/' build.go - - log "Building debs for Kubernetes v${version} for ${architectures}" - ./jenkins.sh --kube-version "$version" --distros $distro --arch "$architectures" - - if [[ $USER != 0 ]]; then - log "Changing file owner from root to ${USER}" - sudo chown -R "${USER}" bin - fi - - cd "${RELEASE_ROOT:?}" -} - -build_rpms() { - local distro=el7 - local RPMDIR - - log "Clearing output dir" - RPMDIR="${RELEASE_ROOT:?}"/packages/rpm - rm -rf "${RPMDIR:?}"/output - cd "${RPMDIR:?}" - - log "Setting version in kubelet.spec" - local vparts=(${version//./ }) - sed -i -r \ - -e "s/(%global\\s+KUBE_MAJOR\\s+)[0-9]+/\\1${vparts[0]}/" \ - -e "s/(%global\\s+KUBE_MINOR\\s+)[0-9]+/\\1${vparts[1]}/" \ - -e "s/(%global\\s+KUBE_PATCH\\s+)[0-9]+/\\1${vparts[2]}/" \ - -e "s/(%global\\s+RPM_RELEASE\\s+)[0-9]+/\\10/" \ - kubelet.spec - - log "Building RPMs for Kubernetes v${version} for ${architectures}" - ./docker-build.sh "$architectures" - cd "${RELEASE_ROOT:?}" -} - -build_debs -build_rpms diff --git a/hack/rapture/check_rapture.sh b/hack/rapture/check_rapture.sh deleted file mode 100755 index f75c3f2e535..00000000000 --- a/hack/rapture/check_rapture.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -bold="$(tput bold)" -normal="$(tput sgr0)" -red="$(tput setaf 1)" -green="$(tput setaf 2)" - -if [ $# -eq 0 ] - then - echo "No argument supplied for version. Ex: 1.19.1" - exit 1 -fi - -curl https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages | grep -F $1 2>&1 -if [ $? != 0 ]; then - echo "${bold}${red}Unable to find version $1 published in debs${normal}" -else - echo "${bold}${green}Debs for $1 look good!${normal}" -fi -curl https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/primary.xml | grep -F $1 2>&1 -if [ $? != 0 ]; then - echo "${bold}${red}Unable to find version $1 published in rpms${normal}" -else - echo "${bold}${green}RPMs for $1 look good!${normal}" -fi diff --git a/hack/rapture/k8s-rapture.sh b/hack/rapture/k8s-rapture.sh deleted file mode 100755 index cc62177e33d..00000000000 --- a/hack/rapture/k8s-rapture.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2020 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This is a temporary stopgap to add some automation to the Googler-only process. -# In the long term, we want to develop a different process that non-Googlers -# can perform. -# -# It builds and pushes both Debian and Red Hat packages, pausing for -# confirmation before promoting each repo to stable. It always sets the -# package revision to 0, so you should only use it for a new minor or patch -# release for which packages have never been pushed. -# -# This is based on a copy of the existing script from ex-Googler -# mehdy@google.com, with some modifications to reduce the number of manual -# prompts, which can potentially derail a release if the wrong option is chosen -# by the user accidentally. -# -# Example usage: -# git clone https://github.com/kubernetes/release.git -# cd release -# k8s-rapture.sh 1.6.12 - -set -o errexit -set -o nounset -set -o pipefail - -RELEASE_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) - -log() { - echo "$*" >&2 -} - -fatal() { - log "FATAL: $*" - exit 1 -} - -# TODO(mehdy) checks: -# 1. Check if on release repo -# 2. Check for prod access -# 3. Check if release repo up to date -# 4. Check if rpm and any other required command exists - -# TODO(mehdy): Restructure the script into three phases: -# P1 - Building RPMs and DEBs -# P2 - Signing all packages -# P3 - Publish them. - -# TODO(mehdy): Make the script rerunnable at any phase - -############################################################################# -# Simple yes/no prompt -# -# @optparam default -n(default)/-y/-e (default to n, y or make (e)xplicit) -# @param message -askyorn () { - local yorn=z - local def=n - local msg="y/N" - - case $1 in - -y) # yes default - def="y" msg="Y/n" - shift - ;; - -e) # Explicit - def="" msg="y/n" - shift - ;; - -n) shift - ;; - esac - - while [[ $yorn != [yYnN] ]]; do - echo -n "$*? ($msg): " - read yorn - : ${yorn:=$def} - done - - # Final test to set return code - [[ $yorn == [yY] ]] -} - -[[ -n "$1" ]] || fatal "no version specified" - -askyorn "Continue RPMs and DEBs release for $1" || exit 1 - -version="$1" -"${RELEASE_ROOT}"/hack/rapture/build-packages.sh "$version" -"${RELEASE_ROOT}"/hack/rapture/publish-packages.sh "$version" diff --git a/hack/rapture/publish-packages.sh b/hack/rapture/publish-packages.sh deleted file mode 100755 index 14bffb1f4b3..00000000000 --- a/hack/rapture/publish-packages.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2022 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This is a temporary stopgap to add some automation to the Googler-only process. -# In the long term, we want to develop a different process that non-Googlers -# can perform. -# -# It signs and pushes both Debian and Red Hat packages, pausing for -# confirmation before promoting each repo to stable. It always sets the -# package revision to 0, so you should only use it for a new minor or patch -# release for which packages have never been pushed. -# -# This is based on a copy of the existing script from ex-Googler -# mehdy@google.com, with some modifications to reduce the number of manual -# prompts, which can potentially derail a release if the wrong option is chosen -# by the user accidentally. -# -# Example usage: -# git clone https://github.com/kubernetes/release.git -# cd release -# publish-packages.sh 1.6.12 -# -# NOTE: this currently requires build-packages.sh to be run locally first. - -set -o errexit -set -o nounset -set -o pipefail - -RELEASE_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) -DEBDIR="${RELEASE_ROOT:?}"/packages/deb -RPMDIR="${RELEASE_ROOT:?}"/packages/rpm - -log() { - echo "$*" >&2 -} - -fatal() { - log "FATAL: $*" - exit 1 -} - - -[[ -n "$1" ]] || fatal "no version specified" -version="$1" - -download_packages() { - local bucket="gs://kubernetes-release/release" - log "Downloading packages from bucket $bucket" - - declare -A locations=( - ["deb"]="$DEBDIR/bin" - ["rpm"]="$RPMDIR/output" - ) - - for package in "${!locations[@]}"; do - rm -rf "${locations[$package]}" || true - mkdir -p "${locations[$package]}" - gsutil -m cp -r "$bucket/v$version/$package/*" "${locations[$package]}" - done - - log "Got all packages" -} - -publish_debs() { - local distro=xenial - cd "${DEBDIR:?}" - - log "Removing local debs that already exist on the server" - local debpath - for debfile in $(rapture --universe=cloud-apt listrepo "kubernetes-${distro}" | sed -r -e 's/^(\S+) (\S+) \[(\S+)\] .*$/\1_\2_\3.deb/'); do - debpath="bin/stable/${distro}/${debfile}" - if [[ -f "${debpath}" ]]; then - log "Removing ${debpath}" - rm "${debpath}" - fi - done - if ls bin/stable/${distro}/*.deb 1> /dev/null 2>&1; - then - log "Pushing debs to kubernetes-${distro}-unstable" - rapture --universe=cloud-apt addpkg -keepold "kubernetes-${distro}" bin/stable/${distro}/*.deb - else - log "No debs found in bin/stable/${distro}/*.deb, skipping rapture addpkg" - fi - - log "Packages in kubernetes-${distro}-unstable:" - rapture --universe=cloud-apt listrepo "kubernetes-${distro}-unstable" - local target - target=$(rapture --universe=cloud-apt showrepo "kubernetes-${distro}-unstable" | awk '/ Current indirection:/ {print $3}') - log - log "Promoting ${target} to stable" - rapture --universe=cloud-apt settag "${target}" cloud-kubernetes-release.stable:true - - cd "${RELEASE_ROOT:?}" -} - -publish_rpms() { - local distro=el7 - local keyfile - - cd "${RPMDIR:?}" - - log "Signing RPMs" - pushd /google/src/head/depot/google3/cloud/cluster/guest/cloud_rapture/rpmsign - for rpmfile in $(find "${RPMDIR}" -name '*.rpm'); do - ./sign.sh "${rpmfile}" - done - popd - - log "Importing key to check RPM signatures" - pushd /tmp - keyfile="$(mktemp)" - curl -sL https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg > ${keyfile} - rpm --import "${keyfile}" - rm "${keyfile}" - popd - - log "Checking RPM signatures" - local check - for rpmfile in $(find "${RPMDIR}" -name '*.rpm'); do - check="$(rpm -Kv "${rpmfile}")" - echo "${check}" - echo "${check}" | egrep -q '\bOK\b' || fatal "RPM signing failed; check output doesn't contain OK: ${check}" - echo "${check}" | egrep -q '\bV4 RSA/SHA512 Signature\b' || fatal "RPM signing failed; check output doesn't contain pgp: ${check}" - echo "${check}" | egrep -vq 'NOT OK' || fatal "RPM signing failed; check output contains NOT OK: ${check}" - echo "${check}" | egrep -vq 'MISSING KEYS' || fatal "RPM signing failed; check output contains MISSING KEYS: ${check}" - done - - log "Removing local RPMs that already exist on the server" - local archlist=() - local arch - local rpmfile - local rpmpath - mapfile -t archlist < <(find output/* -maxdepth 0 -type d -printf "%f\n") - for arch in "${archlist[@]}"; do - for rpmfile in $(rapture --universe=cloud-yum listrepo "kubernetes-${distro}-${arch}" | sed -r -e 's/^(\S+) [0-9]+:(\S+) \[(\S+)\] .*$/\1-\2.\3.rpm/'); do - rpmpath="output/${arch}/${rpmfile}" - if [[ -f "${rpmpath}" ]]; then - log "Removing ${rpmpath}" - rm "${rpmpath}" - fi - done - done - - local repo - for arch in "${archlist[@]}"; do - repo="kubernetes-${distro}-${arch}" - if ls output/${arch}/*.rpm 1> /dev/null 2>&1; - then - log "Pushing RPMs to ${repo}-unstable" - rapture --universe=cloud-yum addpkg -keepold "${repo}" output/${arch}/*.rpm - else - log "No RPMs found in output/${arch}/ skipping rapture addpkg" - fi - done - - local target - for arch in "${archlist[@]}"; do - repo="kubernetes-${distro}-${arch}" - log "Packages in ${repo}-unstable:" - rapture --universe=cloud-yum listrepo "${repo}-unstable" - target=$(rapture --universe=cloud-yum showrepo "${repo}-unstable" | awk '/ Current indirection:/ {print $3}') - log - log "Promoting ${target} to stable ${repo}" - rapture --universe=cloud-yum settag "${target}" cloud-kubernetes-release.stable:true - done - cd "${RELEASE_ROOT:?}" -} - -download_packages -publish_debs -publish_rpms diff --git a/packages/deb/.gitignore b/packages/deb/.gitignore deleted file mode 100644 index 5e56e040ec0..00000000000 --- a/packages/deb/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin diff --git a/packages/deb/Dockerfile b/packages/deb/Dockerfile deleted file mode 100644 index e3e176d5cf7..00000000000 --- a/packages/deb/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM golang:1.21.2-bullseye - -RUN export DEBIAN_FRONTEND=noninteractive \ - && apt-get update -y \ - && apt-get -yy -q install --no-install-recommends --no-install-suggests --fix-missing \ - dpkg-dev \ - build-essential \ - debhelper \ - && apt-get upgrade -y \ - && apt-get autoremove -y \ - && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -ADD . /src - -WORKDIR /src - -RUN go mod download - -ENTRYPOINT ["go", "run", "/src/build.go"] diff --git a/packages/deb/OWNERS b/packages/deb/OWNERS deleted file mode 100644 index 63e56e2a4c9..00000000000 --- a/packages/deb/OWNERS +++ /dev/null @@ -1,10 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -approvers: - - release-engineering-approvers -reviewers: - - build-admins - - release-engineering-approvers - - release-engineering-reviewers -labels: - - area/release-eng diff --git a/packages/deb/bionic/cri-tools/debian/changelog b/packages/deb/bionic/cri-tools/debian/changelog deleted file mode 100644 index 583e96c9a97..00000000000 --- a/packages/deb/bionic/cri-tools/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -cri-tools ({{ .Version }}-{{ .Revision }}) {{ .DistroName }} {{ .Arch }}; urgency=optional - - * https://github.com/kubernetes-sigs/cri-tools/releases/tag/v{{ .Version }} - - -- Kubernetes Authors {{ date }} diff --git a/packages/deb/bionic/cri-tools/debian/compat b/packages/deb/bionic/cri-tools/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/packages/deb/bionic/cri-tools/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/packages/deb/bionic/cri-tools/debian/control b/packages/deb/bionic/cri-tools/debian/control deleted file mode 100644 index 5bb7fee9cf8..00000000000 --- a/packages/deb/bionic/cri-tools/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: cri-tools -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes-sigs/cri-tools.git -Vcs-Browser: https://github.com/kubernetes-sigs/cri-tools/ - -Package: cri-tools -Architecture: {{ .DebArch }} -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Container Runtime Interface Tools - Binaries that interact with the container runtime through the container runtime interface diff --git a/packages/deb/bionic/cri-tools/debian/copyright b/packages/deb/bionic/cri-tools/debian/copyright deleted file mode 100644 index 48da061318a..00000000000 --- a/packages/deb/bionic/cri-tools/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: cri-tools -Source: https://github.com/kubernetes-sigs/cri-tools/ - -Files: * -Copyright: 2018 The Kubernetes Authors. -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/deb/bionic/cri-tools/debian/cri-tools.install b/packages/deb/bionic/cri-tools/debian/cri-tools.install deleted file mode 100644 index d38c9f9c504..00000000000 --- a/packages/deb/bionic/cri-tools/debian/cri-tools.install +++ /dev/null @@ -1 +0,0 @@ -bin/crictl usr/bin/ diff --git a/packages/deb/bionic/cri-tools/debian/rules b/packages/deb/bionic/cri-tools/debian/rules deleted file mode 100644 index 18115f502ee..00000000000 --- a/packages/deb/bionic/cri-tools/debian/rules +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -CRI_TOOLS_VERSION = {{ .Version }} - -build: - echo noop - -binary: - mkdir -p ./bin - curl -sSL --fail --retry 5 \ - "https://storage.googleapis.com/k8s-artifacts-cri-tools/release/v$(CRI_TOOLS_VERSION)/crictl-v$(CRI_TOOLS_VERSION)-linux-{{ .Arch }}.tar.gz" \ - | tar -C ./bin -xz - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf deleted file mode 120000 index 63ab75bfcda..00000000000 --- a/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf +++ /dev/null @@ -1 +0,0 @@ -../../../../../../stable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf \ No newline at end of file diff --git a/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf deleted file mode 120000 index 21aa672ba29..00000000000 --- a/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf +++ /dev/null @@ -1 +0,0 @@ -../../../../../../stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf \ No newline at end of file diff --git a/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf deleted file mode 120000 index 8bf2c840060..00000000000 --- a/packages/deb/bionic/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf +++ /dev/null @@ -1 +0,0 @@ -../../../../../../stable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf \ No newline at end of file diff --git a/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf deleted file mode 100644 index bd1b077f399..00000000000 --- a/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf +++ /dev/null @@ -1,11 +0,0 @@ -# Note: This dropin only works with kubeadm and kubelet v1.11+ -[Service] -Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" -Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" -# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically -EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env -# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use -# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file. -EnvironmentFile=-/etc/default/kubelet -ExecStart= -ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS diff --git a/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf deleted file mode 100644 index 24b24c4c441..00000000000 --- a/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf +++ /dev/null @@ -1,10 +0,0 @@ -[Service] -Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" -Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true" -Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin" -Environment="KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 --cluster-domain=cluster.local" -Environment="KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt" -Environment="KUBELET_CADVISOR_ARGS=--cadvisor-port=0" -Environment="KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true --cert-dir=/var/lib/kubelet/pki" -ExecStart= -ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS diff --git a/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf deleted file mode 100644 index 674a7425628..00000000000 --- a/packages/deb/bionic/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf +++ /dev/null @@ -1,9 +0,0 @@ -[Service] -Environment="KUBELET_KUBECONFIG_ARGS=--kubeconfig=/etc/kubernetes/kubelet.conf --require-kubeconfig=true" -Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true" -Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin" -Environment="KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 --cluster-domain=cluster.local" -Environment="KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt" -Environment="KUBELET_CADVISOR_ARGS=--cadvisor-port=0" -ExecStart= -ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_EXTRA_ARGS diff --git a/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf deleted file mode 120000 index 63ab75bfcda..00000000000 --- a/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf +++ /dev/null @@ -1 +0,0 @@ -../../../../../../stable/etc/systemd/system/kubelet.service.d/post-1.10/10-kubeadm.conf \ No newline at end of file diff --git a/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf deleted file mode 120000 index 21aa672ba29..00000000000 --- a/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf +++ /dev/null @@ -1 +0,0 @@ -../../../../../../stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf \ No newline at end of file diff --git a/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf b/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf deleted file mode 120000 index 8bf2c840060..00000000000 --- a/packages/deb/bionic/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf +++ /dev/null @@ -1 +0,0 @@ -../../../../../../stable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf \ No newline at end of file diff --git a/packages/deb/bionic/kubeadm/debian/changelog b/packages/deb/bionic/kubeadm/debian/changelog deleted file mode 100644 index 512a293ead1..00000000000 --- a/packages/deb/bionic/kubeadm/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubeadm ({{ .Version }}-{{ .Revision }}) {{ .DistroName }} {{ .Arch }}; urgency=optional - - * https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md - - -- Kubernetes Authors {{ date }} - diff --git a/packages/deb/bionic/kubeadm/debian/compat b/packages/deb/bionic/kubeadm/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/packages/deb/bionic/kubeadm/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/packages/deb/bionic/kubeadm/debian/control b/packages/deb/bionic/kubeadm/debian/control deleted file mode 100644 index 0ffa1eff196..00000000000 --- a/packages/deb/bionic/kubeadm/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubeadm -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubeadm -Architecture: {{ .DebArch }} -Depends: {{.Dependencies}} -Description: Kubernetes Cluster Bootstrapping Tool - The Kubernetes command line tool for bootstrapping a Kubernetes cluster. diff --git a/packages/deb/bionic/kubeadm/debian/copyright b/packages/deb/bionic/kubeadm/debian/copyright deleted file mode 100644 index 82f8ab2c23c..00000000000 --- a/packages/deb/bionic/kubeadm/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubeadm -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Kubernetes Authors. -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/deb/bionic/kubeadm/debian/kubeadm.install b/packages/deb/bionic/kubeadm/debian/kubeadm.install deleted file mode 100644 index 3356ff6ef6e..00000000000 --- a/packages/deb/bionic/kubeadm/debian/kubeadm.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/kubeadm usr/bin/ -channel/{{ .Channel }}/etc/systemd/system/kubelet.service.d/{{ .KubeadmKubeletConfigFile }} etc/systemd/system/kubelet.service.d/ diff --git a/packages/deb/bionic/kubeadm/debian/postinst b/packages/deb/bionic/kubeadm/debian/postinst deleted file mode 100755 index 47abed17005..00000000000 --- a/packages/deb/bionic/kubeadm/debian/postinst +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# see: dh_installdeb(1) - -set -o errexit -set -o nounset - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - # because kubeadm package adds kubelet drop-ins, we must daemon-reload - # and restart kubelet now. restarting kubelet is ok because kubelet - # postinst configure step auto-starts it. - systemctl daemon-reload 2>/dev/null || true - systemctl restart kubelet 2>/dev/null || true - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/packages/deb/bionic/kubeadm/debian/rules b/packages/deb/bionic/kubeadm/debian/rules deleted file mode 100755 index ae6c8095158..00000000000 --- a/packages/deb/bionic/kubeadm/debian/rules +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 - -build: - echo noop - -binary: - mkdir -p usr/bin - curl --fail -sSL --retry 5 \ - -o usr/bin/kubeadm \ - "{{ .DownloadLinkBase }}/bin/linux/{{ .Arch }}/kubeadm" - - chmod +x usr/bin/kubeadm - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/packages/deb/bionic/kubeadm/debian/source/format b/packages/deb/bionic/kubeadm/debian/source/format deleted file mode 100644 index 89ae9db8f88..00000000000 --- a/packages/deb/bionic/kubeadm/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/packages/deb/bionic/kubectl/debian/changelog b/packages/deb/bionic/kubectl/debian/changelog deleted file mode 100644 index 24089c97f4a..00000000000 --- a/packages/deb/bionic/kubectl/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubectl ({{ .Version }}-{{ .Revision }}) {{ .DistroName }} {{ .Arch }}; urgency=optional - - * https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md - - -- Kubernetes Authors {{ date }} - diff --git a/packages/deb/bionic/kubectl/debian/compat b/packages/deb/bionic/kubectl/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/packages/deb/bionic/kubectl/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/packages/deb/bionic/kubectl/debian/control b/packages/deb/bionic/kubectl/debian/control deleted file mode 100644 index bd568f12dd5..00000000000 --- a/packages/deb/bionic/kubectl/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubectl -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubectl -Architecture: {{ .DebArch }} -Depends: ${misc:Depends} -Description: Kubernetes Command Line Tool - The Kubernetes command line tool for interacting with the Kubernetes API. diff --git a/packages/deb/bionic/kubectl/debian/copyright b/packages/deb/bionic/kubectl/debian/copyright deleted file mode 100644 index 6bc6e4e66ed..00000000000 --- a/packages/deb/bionic/kubectl/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubectl -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Kubernetes Authors. -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/deb/bionic/kubectl/debian/kubectl.install b/packages/deb/bionic/kubectl/debian/kubectl.install deleted file mode 100644 index 3b8f206c20b..00000000000 --- a/packages/deb/bionic/kubectl/debian/kubectl.install +++ /dev/null @@ -1 +0,0 @@ -usr/bin/kubectl usr/bin/ diff --git a/packages/deb/bionic/kubectl/debian/postinst b/packages/deb/bionic/kubectl/debian/postinst deleted file mode 100755 index 750b3f1c086..00000000000 --- a/packages/deb/bionic/kubectl/debian/postinst +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# see: dh_installdeb(1) - -set -o errexit -set -o nounset - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/packages/deb/bionic/kubectl/debian/rules b/packages/deb/bionic/kubectl/debian/rules deleted file mode 100755 index 4a0474466d6..00000000000 --- a/packages/deb/bionic/kubectl/debian/rules +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 - -build: - echo noop - -binary: - mkdir -p usr/bin - curl --fail -sS -L --retry 5 \ - -o usr/bin/kubectl \ - "{{ .DownloadLinkBase }}/bin/linux/{{ .Arch }}/kubectl" - chmod +x usr/bin/kubectl - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/packages/deb/bionic/kubectl/debian/source/format b/packages/deb/bionic/kubectl/debian/source/format deleted file mode 100644 index 89ae9db8f88..00000000000 --- a/packages/deb/bionic/kubectl/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/packages/deb/bionic/kubelet/debian/changelog b/packages/deb/bionic/kubelet/debian/changelog deleted file mode 100644 index 9fb2813f441..00000000000 --- a/packages/deb/bionic/kubelet/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubelet ({{ .Version }}-{{ .Revision }}) {{ .DistroName }} {{ .Arch }}; urgency=optional - - * https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md - - -- Kubernetes Authors {{ date }} - diff --git a/packages/deb/bionic/kubelet/debian/compat b/packages/deb/bionic/kubelet/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/packages/deb/bionic/kubelet/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/packages/deb/bionic/kubelet/debian/control b/packages/deb/bionic/kubelet/debian/control deleted file mode 100644 index d3cc57157ff..00000000000 --- a/packages/deb/bionic/kubelet/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubelet -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 9.20160709) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubelet -Architecture: {{ .DebArch }} -Depends: iptables (>= 1.4.21), kubernetes-cni (>= {{ .CNIVersion }}), iproute2, socat, util-linux, mount, ebtables, ethtool, conntrack, ${misc:Depends} -Description: Kubernetes Node Agent - The node agent of Kubernetes, the container cluster manager diff --git a/packages/deb/bionic/kubelet/debian/copyright b/packages/deb/bionic/kubelet/debian/copyright deleted file mode 100644 index da29f95bf37..00000000000 --- a/packages/deb/bionic/kubelet/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubelet -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Kubernetes Authors. -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/deb/bionic/kubelet/debian/kubelet.install b/packages/deb/bionic/kubelet/debian/kubelet.install deleted file mode 100644 index b88ef340d95..00000000000 --- a/packages/deb/bionic/kubelet/debian/kubelet.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/kubelet usr/bin/ -lib/systemd/system/kubelet.service lib/systemd/system/ diff --git a/packages/deb/bionic/kubelet/debian/postinst b/packages/deb/bionic/kubelet/debian/postinst deleted file mode 100755 index f9e69e31a81..00000000000 --- a/packages/deb/bionic/kubelet/debian/postinst +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# postinst script for kubelet -# -# see: dh_installdeb(1) - -set -o errexit -set -o nounset - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -mkdir -p /etc/kubernetes/manifests - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/packages/deb/bionic/kubelet/debian/rules b/packages/deb/bionic/kubelet/debian/rules deleted file mode 100755 index db2587dbd92..00000000000 --- a/packages/deb/bionic/kubelet/debian/rules +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 - -build: - echo noop - -binary: - mkdir -p usr/bin - curl --fail -sS -L --retry 5 \ - -o usr/bin/kubelet \ - "{{ .DownloadLinkBase }}/bin/linux/{{ .Arch }}/kubelet" - chmod +x usr/bin/kubelet - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_systemd_enable - dh_installinit - dh_systemd_start - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ --with systemd diff --git a/packages/deb/bionic/kubelet/debian/source/format b/packages/deb/bionic/kubelet/debian/source/format deleted file mode 100644 index 89ae9db8f88..00000000000 --- a/packages/deb/bionic/kubelet/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/packages/deb/bionic/kubelet/lib/systemd/system/kubelet.service b/packages/deb/bionic/kubelet/lib/systemd/system/kubelet.service deleted file mode 100644 index 15d3e9186dc..00000000000 --- a/packages/deb/bionic/kubelet/lib/systemd/system/kubelet.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=kubelet: The Kubernetes Node Agent -Documentation=https://kubernetes.io/docs/home/ -Wants=network-online.target -After=network-online.target - -[Service] -ExecStart=/usr/bin/kubelet -Restart=always -StartLimitInterval=0 -RestartSec=10 - -[Install] -WantedBy=multi-user.target diff --git a/packages/deb/bionic/kubernetes-cni/.gitignore b/packages/deb/bionic/kubernetes-cni/.gitignore deleted file mode 100644 index e660fd93d31..00000000000 --- a/packages/deb/bionic/kubernetes-cni/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin/ diff --git a/packages/deb/bionic/kubernetes-cni/debian/changelog b/packages/deb/bionic/kubernetes-cni/debian/changelog deleted file mode 100644 index 58f7eab85a7..00000000000 --- a/packages/deb/bionic/kubernetes-cni/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubernetes-cni ({{ .Version }}-{{ .Revision }}) {{ .DistroName }} {{ .Arch }}; urgency=optional - - * https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md - - -- Kubernetes Authors {{ date }} - diff --git a/packages/deb/bionic/kubernetes-cni/debian/compat b/packages/deb/bionic/kubernetes-cni/debian/compat deleted file mode 100644 index ec635144f60..00000000000 --- a/packages/deb/bionic/kubernetes-cni/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/packages/deb/bionic/kubernetes-cni/debian/control b/packages/deb/bionic/kubernetes-cni/debian/control deleted file mode 100644 index 4cd30f46b24..00000000000 --- a/packages/deb/bionic/kubernetes-cni/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubernetes-cni -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubernetes-cni -Architecture: {{ .DebArch }} -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Kubernetes CNI - The binaries required to provision container networking diff --git a/packages/deb/bionic/kubernetes-cni/debian/copyright b/packages/deb/bionic/kubernetes-cni/debian/copyright deleted file mode 100644 index 382d7e8faaf..00000000000 --- a/packages/deb/bionic/kubernetes-cni/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubernetes-cni -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Linux Foundation and its contributors -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/deb/bionic/kubernetes-cni/debian/kubernetes-cni.install b/packages/deb/bionic/kubernetes-cni/debian/kubernetes-cni.install deleted file mode 100644 index 001a3b4c7b1..00000000000 --- a/packages/deb/bionic/kubernetes-cni/debian/kubernetes-cni.install +++ /dev/null @@ -1 +0,0 @@ -bin/ opt/cni diff --git a/packages/deb/bionic/kubernetes-cni/debian/rules b/packages/deb/bionic/kubernetes-cni/debian/rules deleted file mode 100755 index 15915ea2cad..00000000000 --- a/packages/deb/bionic/kubernetes-cni/debian/rules +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 - -build: - echo noop - -binary: - mkdir -p ./bin - curl -sSL --fail --retry 5 \ - "https://storage.googleapis.com/k8s-artifacts-cni/release/v{{ .CNIVersion }}/cni-plugins-linux-{{ .Arch }}-v{{ .CNIVersion }}.tgz" \ - | tar -C ./bin -xz - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/packages/deb/build.go b/packages/deb/build.go deleted file mode 100644 index e8d36622d38..00000000000 --- a/packages/deb/build.go +++ /dev/null @@ -1,615 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// nolint -// This file is intended for legacy support and should not be linted -package main - -import ( - "flag" - "fmt" - "io" - "log" - "net/http" - "os" - "os/exec" - "path/filepath" - "strings" - "text/template" - "time" - - "github.com/blang/semver/v4" -) - -type ChannelType string - -const ( - ChannelStable ChannelType = "stable" - ChannelUnstable ChannelType = "unstable" - ChannelNightly ChannelType = "nightly" - - currentCNIVersion = "1.1.1" - criToolsVersion = "1.25.0" - pre180kubeadmconf = "pre-1.8/10-kubeadm.conf" - pre1110kubeadmconf = "post-1.8/10-kubeadm.conf" - latestkubeadmconf = "post-1.10/10-kubeadm.conf" -) - -type work struct { - src, dst string - t *template.Template - info os.FileInfo -} - -type build struct { - Package string - Distros []string - Versions []version -} - -type version struct { - Version, Revision, DownloadLinkBase string - Channel ChannelType - GetVersion func() (string, error) - GetDownloadLinkBase func(v version) (string, error) - CNIVersion string - KubeadmKubeletConfigFile string -} - -type cfg struct { - version - DistroName, Arch, DebArch, Package, Dependencies string -} - -type stringList []string - -func (ss *stringList) String() string { - return strings.Join(*ss, ",") -} - -func (ss *stringList) Set(v string) error { - *ss = strings.Split(v, ",") - return nil -} - -var ( - architectures = stringList{"amd64", "arm", "arm64", "ppc64le", "s390x"} - // distros describes the Debian and Ubuntu versions that binaries will be built for. - // Each distro build definition is currently symlinked to the most recent ubuntu build definition in the repo. - // Build definitions should be kept up to date across release cycles, removing Debian/Ubuntu versions - // that are no longer supported from the perspective of the OS distribution maintainers. - distros = stringList{"bionic", "xenial", "trusty", "stretch", "jessie", "sid"} - kubeVersion = "" - revision = "00" - releaseDownloadLinkBase = "https://dl.k8s.io" - - builtins = map[string]interface{}{ - "date": func() string { - return time.Now().Format(time.RFC1123Z) - }, - } - - keepTmp = flag.Bool("keep-tmp", false, "keep tmp dir after build") -) - -func init() { - flag.Var(&architectures, "arch", "Architectures to build for.") - flag.Var(&distros, "distros", "Distros to build for.") - flag.StringVar(&kubeVersion, "kube-version", "", "Distros to build for.") - flag.StringVar(&revision, "revision", "00", "Deb package revision.") - flag.StringVar(&releaseDownloadLinkBase, "release-download-link-base", "https://dl.k8s.io", "Release download link base.") -} - -func runCommand(pwd string, command string, cmdArgs ...string) error { - cmd := exec.Command(command, cmdArgs...) - if len(pwd) != 0 { - cmd.Dir = pwd - } - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - return err - } - return nil -} - -func (c cfg) run() error { - log.Printf("!!!!!!!!! doing: %#v", c) - var w []work - - srcdir := filepath.Join(c.DistroName, c.Package) - dstdir, err := os.MkdirTemp("", "debs") - if err != nil { - return err - } - if !*keepTmp { - defer os.RemoveAll(dstdir) - } - - // allow base package dir to by a symlink so we can reuse packages - // that don't change between distros - realSrcdir, err := filepath.EvalSymlinks(srcdir) - if err != nil { - return err - } - - if err := filepath.Walk(realSrcdir, func(srcfile string, f os.FileInfo, err error) error { - if err != nil { - return err - } - dstfile := filepath.Join(dstdir, srcfile[len(realSrcdir):]) - if dstfile == dstdir { - return nil - } - if f.IsDir() { - log.Printf(dstfile) - return os.Mkdir(dstfile, f.Mode()) - } - t, err := template. - New(""). - Funcs(builtins). - Option("missingkey=error"). - ParseFiles(srcfile) - if err != nil { - return err - } - w = append(w, work{ - src: srcfile, - dst: dstfile, - t: t.Templates()[0], - info: f, - }) - - return nil - }); err != nil { - return err - } - - for _, w := range w { - log.Printf("w: %#v", w) - if err := func() error { - f, err := os.OpenFile(w.dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0) - if err != nil { - return err - } - defer f.Close() - - if err := w.t.Execute(f, c); err != nil { - return err - } - if err := os.Chmod(w.dst, w.info.Mode()); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - - err = runCommand(dstdir, "dpkg-buildpackage", "-us", "-uc", "-b", "-a"+c.DebArch) - if err != nil { - return err - } - - dstParts := []string{"bin", string(c.Channel), c.DistroName} - - dstPath := filepath.Join(dstParts...) - os.MkdirAll(dstPath, 0o777) - - fileName := fmt.Sprintf("%s_%s-%s_%s.deb", c.Package, c.Version, c.Revision, c.DebArch) - err = runCommand("", "mv", filepath.Join("/tmp", fileName), dstPath) - if err != nil { - return err - } - - return nil -} - -func walkBuilds(builds []build, f func(pkg, distro, arch string, v version) error) error { - for _, a := range architectures { - for _, b := range builds { - for _, d := range b.Distros { - for _, v := range b.Versions { - // Populate the version if it doesn't exist - if len(v.Version) == 0 && v.GetVersion != nil { - var err error - v.Version, err = v.GetVersion() - if err != nil { - return err - } - } - - // Populate the version if it doesn't exist - if len(v.DownloadLinkBase) == 0 && v.GetDownloadLinkBase != nil { - var err error - v.DownloadLinkBase, err = v.GetDownloadLinkBase(v) - if err != nil { - return err - } - } - - if err := f(b.Package, d, a, v); err != nil { - return err - } - } - } - } - } - return nil -} - -func fetchVersion(url string) (string, error) { - res, err := http.Get(url) - if err != nil { - return "", err - } - - versionBytes, err := io.ReadAll(res.Body) - res.Body.Close() - if err != nil { - return "", err - } - // Remove a newline and the v prefix from the string - return strings.Replace(strings.Replace(string(versionBytes), "v", "", 1), "\n", "", 1), nil -} - -func getStableKubeVersion() (string, error) { - return fetchVersion("https://dl.k8s.io/release/stable.txt") -} - -func getLatestKubeVersion() (string, error) { - return fetchVersion("https://dl.k8s.io/release/latest.txt") -} - -func getLatestCIVersion() (string, error) { - latestVersion, err := getLatestKubeCIBuild() - if err != nil { - return "", err - } - - // Replace the "+" with a "-" to make it semver-compliant - return strings.Replace(latestVersion, "+", "-", 1), nil -} - -func getCRIToolsLatestVersion() (string, error) { - return criToolsVersion, nil -} - -func getLatestKubeCIBuild() (string, error) { - return fetchVersion("https://dl.k8s.io/ci/latest.txt") -} - -func getCIBuildsDownloadLinkBase(_ version) (string, error) { - latestCiVersion, err := getLatestKubeCIBuild() - if err != nil { - return "", err - } - - return fmt.Sprintf("https://dl.k8s.io/ci/v%s", latestCiVersion), nil -} - -func getReleaseDownloadLinkBase(v version) (string, error) { - return fmt.Sprintf("%s/v%s", releaseDownloadLinkBase, v.Version), nil -} - -func getKubeadmDependencies(v version) (string, error) { - cniVersion, err := getCNIVersion() - if err != nil { - return "", err - } - - deps := []string{ - "kubelet (>= 1.19.0)", - "kubectl (>= 1.19.0)", - fmt.Sprintf("kubernetes-cni (>= %s)", cniVersion), - "${misc:Depends}", - } - sv, err := semver.Make(v.Version) - if err != nil { - return "", err - } - - v1110, err := semver.Make("1.11.0-alpha.0") - if err != nil { - return "", err - } - - if sv.GTE(v1110) { - criToolsVersion, err := getCRIToolsVersion(v) - if err != nil { - return "", err - } - - deps = append(deps, fmt.Sprintf("cri-tools (>= %s)", criToolsVersion)) - return strings.Join(deps, ", "), nil - } - return strings.Join(deps, ", "), nil -} - -// The version of this file to use changed in 1.8 and 1.11 so use the target build -// version to figure out which copy of it to include in the deb. -func getKubeadmKubeletConfigFile(v version) (string, error) { - sv, err := semver.Make(v.Version) - if err != nil { - return "", err - } - - v180, err := semver.Make("1.8.0-alpha.0") - if err != nil { - return "", err - } - v1110, err := semver.Make("1.11.0-alpha.0") - if err != nil { - return "", err - } - - if sv.LT(v1110) { - if sv.LT(v180) { - return pre180kubeadmconf, nil - } - return pre1110kubeadmconf, nil - } - return latestkubeadmconf, nil -} - -func getCNIVersion() (string, error) { - return currentCNIVersion, nil -} - -// getCRIToolsVersion assumes v coming in is >= 1.11.0-alpha.0 -func getCRIToolsVersion(v version) (string, error) { - sv, err := semver.Make(v.Version) - if err != nil { - return "", err - } - - v1110, err := semver.Make("1.11.0-alpha.0") - if err != nil { - return "", err - } - v1121, err := semver.Make("1.12.1-alpha.0") - if err != nil { - return "", err - } - - if sv.GTE(v1110) && sv.LT(v1121) { - return "1.11.1", nil - } - return criToolsVersion, nil -} - -func main() { - flag.Parse() - - builds := []build{ - { - Package: "kubectl", - Distros: distros, - Versions: []version{ - { - GetVersion: getStableKubeVersion, - Revision: revision, - Channel: ChannelStable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - { - GetVersion: getLatestKubeVersion, - Revision: revision, - Channel: ChannelUnstable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - { - GetVersion: getLatestCIVersion, - Revision: revision, - Channel: ChannelNightly, - GetDownloadLinkBase: getCIBuildsDownloadLinkBase, - }, - }, - }, - { - Package: "kubelet", - Distros: distros, - Versions: []version{ - { - GetVersion: getStableKubeVersion, - Revision: revision, - Channel: ChannelStable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - { - GetVersion: getLatestKubeVersion, - Revision: revision, - Channel: ChannelUnstable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - { - GetVersion: getLatestCIVersion, - Revision: revision, - Channel: ChannelNightly, - GetDownloadLinkBase: getCIBuildsDownloadLinkBase, - }, - }, - }, - { - Package: "kubernetes-cni", - Distros: distros, - Versions: []version{ - { - GetVersion: getCNIVersion, - Revision: revision, - Channel: ChannelStable, - }, - { - GetVersion: getCNIVersion, - Revision: revision, - Channel: ChannelUnstable, - }, - { - GetVersion: getCNIVersion, - Revision: revision, - Channel: ChannelNightly, - }, - }, - }, - { - Package: "kubeadm", - Distros: distros, - Versions: []version{ - { - GetVersion: getStableKubeVersion, - Revision: revision, - Channel: ChannelStable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - { - GetVersion: getLatestKubeVersion, - Revision: revision, - Channel: ChannelUnstable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - { - GetVersion: getLatestCIVersion, - Revision: revision, - Channel: ChannelNightly, - GetDownloadLinkBase: getCIBuildsDownloadLinkBase, - }, - }, - }, - { - Package: "cri-tools", - Distros: distros, - Versions: []version{ - { - GetVersion: getCRIToolsLatestVersion, - Revision: revision, - Channel: ChannelStable, - }, - { - GetVersion: getCRIToolsLatestVersion, - Revision: revision, - Channel: ChannelUnstable, - }, - { - GetVersion: getCRIToolsLatestVersion, - Revision: revision, - Channel: ChannelNightly, - }, - }, - }, - } - - if kubeVersion != "" { - getSpecifiedVersion := func() (string, error) { - return kubeVersion, nil - } - builds = []build{ - { - Package: "kubectl", - Distros: distros, - Versions: []version{ - { - GetVersion: getSpecifiedVersion, - Revision: revision, - Channel: ChannelStable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - }, - }, - { - Package: "kubelet", - Distros: distros, - Versions: []version{ - { - GetVersion: getSpecifiedVersion, - Revision: revision, - Channel: ChannelStable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - }, - }, - { - Package: "kubernetes-cni", - Distros: distros, - Versions: []version{ - { - Version: currentCNIVersion, - Revision: revision, - Channel: ChannelStable, - }, - }, - }, - { - Package: "kubeadm", - Distros: distros, - Versions: []version{ - { - GetVersion: getSpecifiedVersion, - Revision: revision, - Channel: ChannelStable, - GetDownloadLinkBase: getReleaseDownloadLinkBase, - }, - }, - }, - { - Package: "cri-tools", - Distros: distros, - Versions: []version{ - { - GetVersion: getCRIToolsLatestVersion, - Revision: revision, - Channel: ChannelStable, - }, - }, - }, - } - } - - if err := walkBuilds(builds, func(pkg, distro, arch string, v version) error { - c := cfg{ - Package: pkg, - version: v, - DistroName: distro, - Arch: arch, - } - if c.Arch == "arm" { - c.DebArch = "armhf" - } else if c.Arch == "ppc64le" { - c.DebArch = "ppc64el" - } else { - c.DebArch = c.Arch - } - - var err error - c.KubeadmKubeletConfigFile, err = getKubeadmKubeletConfigFile(v) - if err != nil { - log.Fatalf("error getting kubeadm config: %v", err) - } - - c.Dependencies, err = getKubeadmDependencies(v) - if err != nil { - log.Fatalf("error getting kubeadm dependencies: %v", err) - } - - c.CNIVersion, err = getCNIVersion() - if err != nil { - log.Fatalf("error getting kubelet CNI Version: %v", err) - } - - return c.run() - }); err != nil { - log.Fatalf("err: %v", err) - } -} diff --git a/packages/deb/build_test.go b/packages/deb/build_test.go deleted file mode 100644 index 919121670c6..00000000000 --- a/packages/deb/build_test.go +++ /dev/null @@ -1,108 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// nolint -// This file is intended for legacy support and should not be linted -package main - -import ( - "reflect" - "strings" - "testing" -) - -func TestGetKubeadmConfig(t *testing.T) { - testcases := []struct { - version string - expectConfig string - expectErr bool - }{ - { - "not-a-real-version", - "", - true, - }, - { - "1.22.0", - "post-1.10/10-kubeadm.conf", - false, - }, - } - - for _, tc := range testcases { - v := version{ - Version: tc.version, - } - kubeadmConfig, err := getKubeadmKubeletConfigFile(v) - - if err != nil { - if !tc.expectErr { - t.Errorf("getKubeadmConfig(%s) returned unwanted error: %v", tc.version, err) - } - } else { - if kubeadmConfig != tc.expectConfig { - t.Errorf("getKubeadmConfig(%s) got %q, wanted %q", tc.version, kubeadmConfig, tc.expectConfig) - } - } - } -} - -func TestGetKubeadmDependencies(t *testing.T) { - testcases := []struct { - name string - version string - deps []string - }{ - { - name: "minimum supported kubernetes", - version: "1.19.0", - deps: []string{ - "kubelet (>= 1.19.0)", - "kubectl (>= 1.19.0)", - "kubernetes-cni (>= 0.8.7)", - "${misc:Depends}", - "cri-tools (>= 1.25.0)", - }, - }, - { - name: "latest stable minor kubernetes", - version: "1.22.0", - deps: []string{ - "kubelet (>= 1.19.0)", - "kubectl (>= 1.19.0)", - "kubernetes-cni (>= 0.8.7)", - "${misc:Depends}", - "cri-tools (>= 1.25.0)", - }, - }, - } - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - v := version{Version: tc.version} - deps, err := getKubeadmDependencies(v) - if err != nil { - t.Fatalf("did not expect an error: %v", err) - } - actual := strings.Split(deps, ", ") - if len(actual) != len(tc.deps) { - t.Fatalf("Expected %d deps but found %d", len(tc.deps), len(actual)) - } - if !reflect.DeepEqual(actual, tc.deps) { - t.Fatalf("expected %q but got %q", tc.deps, actual) - } - }) - } -} diff --git a/packages/deb/go.mod b/packages/deb/go.mod deleted file mode 100644 index 330c1f48be1..00000000000 --- a/packages/deb/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module k8s.io/release/packages/deb - -go 1.20 - -require github.com/blang/semver/v4 v4.0.0 diff --git a/packages/deb/go.sum b/packages/deb/go.sum deleted file mode 100644 index eae081784ac..00000000000 --- a/packages/deb/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= -github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= diff --git a/packages/deb/jenkins.sh b/packages/deb/jenkins.sh deleted file mode 100755 index f1086cd6e38..00000000000 --- a/packages/deb/jenkins.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o nounset -set -o errexit -set -o nounset -set -o xtrace - - -declare -r BUILD_TAG="$(date '+%y%m%d%H%M%S')" -declare -r IMG_NAME="debian-builder:${BUILD_TAG}" - -docker build -t "${IMG_NAME}" "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -docker run -i --rm -v "${PWD}/bin:/src/bin" "${IMG_NAME}" $@ diff --git a/packages/deb/jessie b/packages/deb/jessie deleted file mode 120000 index 01285abbd6f..00000000000 --- a/packages/deb/jessie +++ /dev/null @@ -1 +0,0 @@ -bionic \ No newline at end of file diff --git a/packages/deb/sid b/packages/deb/sid deleted file mode 120000 index 01285abbd6f..00000000000 --- a/packages/deb/sid +++ /dev/null @@ -1 +0,0 @@ -bionic \ No newline at end of file diff --git a/packages/deb/stretch b/packages/deb/stretch deleted file mode 120000 index 01285abbd6f..00000000000 --- a/packages/deb/stretch +++ /dev/null @@ -1 +0,0 @@ -bionic \ No newline at end of file diff --git a/packages/deb/trusty b/packages/deb/trusty deleted file mode 120000 index 01285abbd6f..00000000000 --- a/packages/deb/trusty +++ /dev/null @@ -1 +0,0 @@ -bionic \ No newline at end of file diff --git a/packages/deb/xenial b/packages/deb/xenial deleted file mode 120000 index 01285abbd6f..00000000000 --- a/packages/deb/xenial +++ /dev/null @@ -1 +0,0 @@ -bionic \ No newline at end of file diff --git a/packages/rpm/.dockerignore b/packages/rpm/.dockerignore deleted file mode 100644 index 10e3951a6c4..00000000000 --- a/packages/rpm/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -docker-build.sh -Dockerfile -output/* diff --git a/packages/rpm/.gitignore b/packages/rpm/.gitignore deleted file mode 100644 index af63c9ac1e6..00000000000 --- a/packages/rpm/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -kubelet -kubeadm -kubectl -cni-*.tar.gz -bin/ -output/ -*.swp diff --git a/packages/rpm/10-kubeadm-post-1.11.conf b/packages/rpm/10-kubeadm-post-1.11.conf deleted file mode 100644 index 19475e59ac9..00000000000 --- a/packages/rpm/10-kubeadm-post-1.11.conf +++ /dev/null @@ -1,11 +0,0 @@ -# Note: This dropin only works with kubeadm and kubelet v1.11+ -[Service] -Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" -Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" -# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically -EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env -# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use -# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file. -EnvironmentFile=-/etc/sysconfig/kubelet -ExecStart= -ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS diff --git a/packages/rpm/Dockerfile b/packages/rpm/Dockerfile deleted file mode 100644 index b0158a60212..00000000000 --- a/packages/rpm/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM fedora:24 -MAINTAINER Devan Goodwin - -RUN dnf install -y rpm-build rpmdevtools createrepo && dnf clean all - -RUN rpmdev-setuptree - -USER root -ADD entry.sh /root/ -COPY ./ /root/rpmbuild/SPECS -ENTRYPOINT ["/root/entry.sh"] diff --git a/packages/rpm/OWNERS b/packages/rpm/OWNERS deleted file mode 100644 index 63e56e2a4c9..00000000000 --- a/packages/rpm/OWNERS +++ /dev/null @@ -1,10 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -approvers: - - release-engineering-approvers -reviewers: - - build-admins - - release-engineering-approvers - - release-engineering-reviewers -labels: - - area/release-eng diff --git a/packages/rpm/docker-build.sh b/packages/rpm/docker-build.sh deleted file mode 100755 index 8ece7549852..00000000000 --- a/packages/rpm/docker-build.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -docker build -t kubelet-rpm-builder . -echo "Cleaning output directory..." -rm -rf output/* -mkdir -p output - -architectures=${1:-""} - -docker run -i --rm -v $PWD/output/:/root/rpmbuild/RPMS/ kubelet-rpm-builder "$architectures" - -USER=${USER:-$(id -u)} -if [[ $USER != 0 ]]; then - sudo chown -R "$USER" "$PWD/output" -fi - -echo -echo "----------------------------------------" -echo -echo "RPMs written to: " -ls $PWD/output/*/ -echo -echo "Yum repodata written to: " -ls $PWD/output/*/repodata/ diff --git a/packages/rpm/entry.sh b/packages/rpm/entry.sh deleted file mode 100755 index 06712a5e7f5..00000000000 --- a/packages/rpm/entry.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2019 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Entrypoint for the build container to create the rpms and yum repodata: -# Usage: ./entry.sh GOARCH/RPMARCH,GOARCH/RPMARCH,.... - -set -e - -declare -a ARCHS - -if [ $# -gt 0 ]; then - IFS=','; ARCHS=($1); unset IFS; -else - #GOARCH/RPMARCH - ARCHS=( - amd64 - arm - arm64 - ppc64le - s390x - ) -fi - -declare -A GOTORPMARCH=( - [amd64]=x86_64 - [arm]=armhfp - [arm64]=aarch64 - [ppc64le]=ppc64le - [s390x]=s390x -) - -for GOARCH in "${ARCHS[@]}"; do - RPMARCH=${GOTORPMARCH[$GOARCH]} - SRC_PATH="/root/rpmbuild/SOURCES/${RPMARCH}" - mkdir -p ${SRC_PATH} - cp -r /root/rpmbuild/SPECS/* ${SRC_PATH} - echo "Building RPM's for ${GOARCH}....." - sed -i "s/\%global ARCH.*/\%global ARCH ${GOARCH}/" ${SRC_PATH}/kubelet.spec - # Download sources if not already available - cd ${SRC_PATH} && spectool -gf kubelet.spec - /usr/bin/rpmbuild --target ${RPMARCH} --define "_sourcedir ${SRC_PATH}" -bb ${SRC_PATH}/kubelet.spec - mkdir -p /root/rpmbuild/RPMS/${RPMARCH} - createrepo -o /root/rpmbuild/RPMS/${RPMARCH}/ /root/rpmbuild/RPMS/${RPMARCH} -done diff --git a/packages/rpm/kubelet.env b/packages/rpm/kubelet.env deleted file mode 100644 index b6c7084e3a1..00000000000 --- a/packages/rpm/kubelet.env +++ /dev/null @@ -1 +0,0 @@ -KUBELET_EXTRA_ARGS= diff --git a/packages/rpm/kubelet.service b/packages/rpm/kubelet.service deleted file mode 100644 index f25b70985cb..00000000000 --- a/packages/rpm/kubelet.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=kubelet: The Kubernetes Node Agent -Documentation=https://kubernetes.io/docs/ -Wants=network-online.target -After=network-online.target - -[Service] -ExecStart=/usr/bin/kubelet -Restart=always -StartLimitInterval=0 -RestartSec=10 - -[Install] -WantedBy=multi-user.target diff --git a/packages/rpm/kubelet.spec b/packages/rpm/kubelet.spec deleted file mode 100644 index 796cdc36a42..00000000000 --- a/packages/rpm/kubelet.spec +++ /dev/null @@ -1,305 +0,0 @@ -%global KUBE_MAJOR 1 -%global KUBE_MINOR 19 -%global KUBE_PATCH 0 -%global KUBE_VERSION %{KUBE_MAJOR}.%{KUBE_MINOR}.%{KUBE_PATCH} -%global RPM_RELEASE 0 -%global ARCH amd64 - -# This expands a (major, minor, patch) tuple into a single number so that it -# can be compared against other versions. It has the current implementation -# assumption that none of these numbers will exceed 255. -%define semver() (%1 * 256 * 256 + %2 * 256 + %3) -%global KUBE_SEMVER %{semver %{KUBE_MAJOR} %{KUBE_MINOR} %{KUBE_PATCH}} - -%global CNI_VERSION 1.1.1 -%global CRI_TOOLS_VERSION 1.25.0 - -Name: kubelet -Version: %{KUBE_VERSION} -Release: %{RPM_RELEASE} -Summary: Container cluster management -License: ASL 2.0 - -URL: https://kubernetes.io -Source0: https://dl.k8s.io/v%{KUBE_VERSION}/bin/linux/%{ARCH}/kubelet -Source1: kubelet.service -Source2: https://dl.k8s.io/v%{KUBE_VERSION}/bin/linux/%{ARCH}/kubectl -Source3: https://dl.k8s.io/v%{KUBE_VERSION}/bin/linux/%{ARCH}/kubeadm -Source4: 10-kubeadm.conf -Source5: https://storage.googleapis.com/k8s-artifacts-cni/release/v%{CNI_VERSION}/cni-plugins-linux-%{ARCH}-v%{CNI_VERSION}.tgz -Source6: kubelet.env -Source7: https://storage.googleapis.com/k8s-artifacts-cri-tools/release/v%{CRI_TOOLS_VERSION}/crictl-v%{CRI_TOOLS_VERSION}-linux-%{ARCH}.tar.gz - -BuildRequires: systemd -BuildRequires: curl -Requires: iptables >= 1.4.21 -Requires: kubernetes-cni >= %{CNI_VERSION} -Requires: socat -Requires: util-linux -Requires: ethtool -Requires: iproute -Requires: ebtables -Requires: conntrack - - -%description -The node agent of Kubernetes, the container cluster manager. - -%package -n kubernetes-cni - -Version: %{CNI_VERSION} -Release: %{RPM_RELEASE} -Summary: Binaries required to provision kubernetes container networking -Requires: kubelet - -%description -n kubernetes-cni -Binaries required to provision container networking. - -%package -n kubectl - -Version: %{KUBE_VERSION} -Release: %{RPM_RELEASE} -Summary: Command-line utility for interacting with a Kubernetes cluster. - -%description -n kubectl -Command-line utility for interacting with a Kubernetes cluster. - -%package -n kubeadm - -Version: %{KUBE_VERSION} -Release: %{RPM_RELEASE} -Summary: Command-line utility for administering a Kubernetes cluster. -Requires: kubelet >= 1.19.0 -Requires: kubectl >= 1.19.0 -Requires: kubernetes-cni >= 0.8.6 -Requires: cri-tools >= 1.19.0 - -%description -n kubeadm -Command-line utility for administering a Kubernetes cluster. - -%package -n cri-tools - -Version: %{CRI_TOOLS_VERSION} -Release: %{RPM_RELEASE} -Summary: Command-line utility for interacting with a container runtime. - -%description -n cri-tools -Command-line utility for interacting with a container runtime. - -%prep -# Assumes the builder has overridden sourcedir to point to directory -# with this spec file. (where these files are stored) Copy them into -# the builddir so they can be installed. -# This is a useful hack for faster Docker builds when working on the spec or -# with locally obtained sources. -# -# Example: -# spectool -gf kubelet.spec -# rpmbuild --define "_sourcedir $PWD" -bb kubelet.spec -# - -ln -s 10-kubeadm-post-1.11.conf %SOURCE4 - -cp -p %SOURCE0 %{_builddir}/ -cp -p %SOURCE1 %{_builddir}/ -cp -p %SOURCE2 %{_builddir}/ -cp -p %SOURCE3 %{_builddir}/ -cp -p %SOURCE4 %{_builddir}/ -cp -p %SOURCE6 %{_builddir}/ -%setup -c -D -T -a 5 -n cni-plugins -%setup -c -a 7 -T -n cri-tools - -%install - -# The setup macro from prep will make install start in the cni-plugins directory, so cd back to the root. -cd %{_builddir} -install -m 755 -d %{buildroot}%{_unitdir} -install -m 755 -d %{buildroot}%{_unitdir}/kubelet.service.d/ -install -m 755 -d %{buildroot}%{_bindir} -install -m 755 -d %{buildroot}%{_sysconfdir}/cni/net.d/ -install -m 755 -d %{buildroot}%{_sysconfdir}/kubernetes/manifests/ -install -m 755 -d %{buildroot}/var/lib/kubelet/ -install -p -m 755 -t %{buildroot}%{_bindir}/ kubelet -install -p -m 755 -t %{buildroot}%{_bindir}/ kubectl -install -p -m 755 -t %{buildroot}%{_bindir}/ kubeadm -install -p -m 644 -t %{buildroot}%{_unitdir}/ kubelet.service -install -p -m 644 -t %{buildroot}%{_unitdir}/kubelet.service.d/ 10-kubeadm.conf -install -p -m 755 -t %{buildroot}%{_bindir}/ cri-tools/crictl - -install -m 755 -d %{buildroot}%{_sysconfdir}/sysconfig/ -install -p -m 644 -T kubelet.env %{buildroot}%{_sysconfdir}/sysconfig/kubelet - -install -m 755 -d %{buildroot}/opt/cni/bin -# bin directory from cni-plugins-linux-%{ARCH}-%{CNI_VERSION}.tgz with a list of cni plugins (among other things) -mv cni-plugins/* %{buildroot}/opt/cni/bin/ - -%files -%{_bindir}/kubelet -%{_unitdir}/kubelet.service -%{_sysconfdir}/kubernetes/manifests/ - -%config(noreplace) %{_sysconfdir}/sysconfig/kubelet - -%files -n kubernetes-cni -/opt/cni - -%files -n kubectl -%{_bindir}/kubectl - -%files -n kubeadm -%{_bindir}/kubeadm -%{_unitdir}/kubelet.service.d/10-kubeadm.conf - -%files -n cri-tools -%{_bindir}/crictl - -%doc - - -%changelog -* Wed Jan 25 2023 Marko Mudrinić - 1.26.2 -- Revert updating CNI plugins to v1.2.0 and cri-tools to v1.26.0 - -* Tue Jan 17 2023 Sascha Grunert - 1.26.0 -- Update CNI plugins to v1.2.0 - -* Thu Dec 14 2022 Sascha Grunert - 1.26.0 -- Update cri-tools to v1.26.0 - -* Thu Aug 30 2022 Sascha Grunert - 1.25.0 -- Update CNI plugins to v1.1.1 - -* Thu Aug 29 2022 Sascha Grunert - 1.25.0 -- Update cri-tools to v1.25.0 - -* Thu May 30 2022 Sascha Grunert - 1.24.0 -- Update cri-tools to v1.24.2 - -* Thu May 5 2022 Sascha Grunert - 1.24.0 -- Update cri-tools to v1.24.0 - -* Mon Mar 7 2022 Sascha Grunert - 1.23.4 -- Update cri-tools to v1.23.0 - -* Fri Oct 22 2021 Stephen Augustus - 1.22.3 -- Update minimum Kubernetes version to v1.19.0 - -* Wed Sep 2 2020 Stephen Augustus - 1.19.1 -- Update CNI plugins to v0.8.7 - -* Mon Jun 22 2020 Stephen Augustus - 1.18.4 -- Unbundle CNI plugins (v0.8.6) from kubelet package and release as kubernetes-cni - -* Fri May 29 2020 Stephen Augustus - 1.18.4 -- Source cri-tools from https://storage.googleapis.com/k8s-artifacts-cri-tools/release - instead of https://github.com/kubernetes-sigs/cri-tools - -* Fri May 22 2020 Stephen Augustus - 1.18.4 -- Bundle CNI plugins (v0.8.6) in kubelet package - -* Fri May 22 2020 Stephen Augustus - 1.18.4 -- Source CNI plugins from https://storage.googleapis.com/k8s-artifacts-cni/release - instead of https://dl.k8s.io/network-plugins - -* Mon Jun 24 2019 Stephen Augustus - 1.15.1 -- Bump minimum versions of all kubernetes dependencies -- Remove conditional logic for unsupported versions of Kubernetes - -* Sun Jun 23 2019 Stephen Augustus - 1.15.1 -- Source cri-tools from https://github.com/kubernetes-sigs/cri-tools - instead of https://github.com/kubernetes-incubator/cri-tools - -* Thu May 30 2019 Tim Pepper -- Change CNI version check to ">=" - -* Wed Mar 20 2019 Lubomir I. Ivanov -- Bump CNI version to v0.7.5. - -* Tue Sep 25 2018 Chuck Ha - 1.12.1 -- Bump cri-tools to 1.12.0. - -* Fri Jul 13 2018 Lantao Liu - 1.11.0 -- Bump cri-tools to 1.11.1. - -* Tue Jun 19 2018 Chuck Ha - 1.11.0 -- Bump cri-tools to GA version. - -* Thu Jun 14 2018 Chuck Ha - 1.11.0 -- Add a crictl sub-package. - -* Fri Jun 8 2018 Chuck Ha - 1.11.0 -- Bump version and update rpm manifest for kubeadm. - -* Fri Dec 15 2017 Anthony Yeh - 1.9.0 -- Release of Kubernetes 1.9.0. - -* Thu Oct 19 2017 Di Xu -- Bump CNI version to v0.6.0. - -* Fri Sep 29 2017 Jacob Beacham - 1.8.0 -- Bump version of kubelet and kubectl to v1.8.0. - -* Thu Aug 3 2017 Jacob Beacham - 1.7.3 -- Bump version of kubelet and kubectl to v1.7.3. - -* Wed Jul 26 2017 Jacob Beacham - 1.7.2 -- Bump version of kubelet and kubectl to v1.7.2. - -* Fri Jul 14 2017 Jacob Beacham - 1.7.1 -- Bump version of kubelet and kubectl to v1.7.1. - -* Mon Jun 30 2017 Mike Danese - 1.7.0 -- Bump version of kubelet and kubectl to v1.7.0. - -* Fri May 19 2017 Jacob Beacham - 1.6.4 -- Bump version of kubelet and kubectl to v1.6.4. - -* Wed May 10 2017 Jacob Beacham - 1.6.3 -- Bump version of kubelet and kubectl to v1.6.3. - -* Wed Apr 26 2017 Jacob Beacham - 1.6.2 -- Bump version of kubelet and kubectl to v1.6.2. - -* Mon Apr 3 2017 Mike Danese - 1.6.1 -- Bump version of kubelet and kubectl to v1.6.1. - -* Tue Mar 28 2017 Lucas Käldström -- Bump CNI version to v0.5.1. - -* Wed Mar 15 2017 Lucas Käldström - 1.6.0 -- Bump version of kubelet, kubectl and kubeadm to v1.6.0. - -* Tue Dec 13 2016 Mike Danese - 1.5.4 -- Bump version of kubelet and kubectl to v1.5.4. - -* Tue Dec 13 2016 Lucas Käldström - 1.5.1 -- Bump version of kubelet and kubectl to v1.5.1, plus kubeadm to the third stable version - -* Tue Dec 6 2016 Lucas Käldström - 1.5.0-beta.2 -- Bump version of kubelet and kubectl - -* Wed Nov 16 2016 Alexander Kanevskiy -- fix iproute and mount dependencies (#204) - -* Sun Nov 6 2016 Lucas Käldström -- Sync the debs and rpm files; add some kubelet dependencies to the rpm manifest - -* Wed Nov 2 2016 Lucas Käldström -- Bump version of kubeadm to v1.5.0-alpha.2.380+85fe0f1aadf91e - -* Fri Oct 21 2016 Ilya Dmitrichenko - 1.4.4-0 -- Bump version of kubelet and kubectl - -* Mon Oct 17 2016 Lucas Käldström - 1.4.3-0 -- Bump version of kubeadm - -* Fri Oct 14 2016 Matthew Mosesohn - 1.4.0-1 -- Allow locally built/previously downloaded binaries - -* Tue Sep 20 2016 dgoodwin - 1.4.0-0 -- Add kubectl and kubeadm sub-packages. -- Rename to kubernetes-cni. -- Update versions of CNI. - -* Wed Jul 20 2016 dgoodwin - 1.3.4-1 -- Initial packaging. diff --git a/pkg/anago/anago.go b/pkg/anago/anago.go index ec95ba8fe3c..2fc850c215d 100644 --- a/pkg/anago/anago.go +++ b/pkg/anago/anago.go @@ -298,11 +298,6 @@ func (s *Stage) Run() error { return fmt.Errorf("build release: %w", err) } - logger.WithStep().Info("Building packages") - if err := s.client.BuildPackages(); err != nil { - return fmt.Errorf("build packages: %w", err) - } - logger.WithStep().Info("Generating changelog") if err := s.client.GenerateChangelog(); err != nil { return fmt.Errorf("generate changelog: %w", err) @@ -445,11 +440,6 @@ func (r *Release) Run() error { return fmt.Errorf("push git objects: %w", err) } - logger.WithStep().Info("Releasing packages") - if err := r.client.ReleasePackages(); err != nil { - return fmt.Errorf("release packages: %w", err) - } - logger.WithStep().Info("Creating announcement") if err := r.client.CreateAnnouncement(); err != nil { return fmt.Errorf("create announcement: %w", err) diff --git a/pkg/anago/anagofakes/fake_release_client.go b/pkg/anago/anagofakes/fake_release_client.go index 91c413cf862..baa82db44b2 100644 --- a/pkg/anago/anagofakes/fake_release_client.go +++ b/pkg/anago/anagofakes/fake_release_client.go @@ -126,16 +126,6 @@ type FakeReleaseClient struct { pushGitObjectsReturnsOnCall map[int]struct { result1 error } - ReleasePackagesStub func() error - releasePackagesMutex sync.RWMutex - releasePackagesArgsForCall []struct { - } - releasePackagesReturns struct { - result1 error - } - releasePackagesReturnsOnCall map[int]struct { - result1 error - } SubmitStub func(bool) error submitMutex sync.RWMutex submitArgsForCall []struct { @@ -725,59 +715,6 @@ func (fake *FakeReleaseClient) PushGitObjectsReturnsOnCall(i int, result1 error) }{result1} } -func (fake *FakeReleaseClient) ReleasePackages() error { - fake.releasePackagesMutex.Lock() - ret, specificReturn := fake.releasePackagesReturnsOnCall[len(fake.releasePackagesArgsForCall)] - fake.releasePackagesArgsForCall = append(fake.releasePackagesArgsForCall, struct { - }{}) - stub := fake.ReleasePackagesStub - fakeReturns := fake.releasePackagesReturns - fake.recordInvocation("ReleasePackages", []interface{}{}) - fake.releasePackagesMutex.Unlock() - if stub != nil { - return stub() - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeReleaseClient) ReleasePackagesCallCount() int { - fake.releasePackagesMutex.RLock() - defer fake.releasePackagesMutex.RUnlock() - return len(fake.releasePackagesArgsForCall) -} - -func (fake *FakeReleaseClient) ReleasePackagesCalls(stub func() error) { - fake.releasePackagesMutex.Lock() - defer fake.releasePackagesMutex.Unlock() - fake.ReleasePackagesStub = stub -} - -func (fake *FakeReleaseClient) ReleasePackagesReturns(result1 error) { - fake.releasePackagesMutex.Lock() - defer fake.releasePackagesMutex.Unlock() - fake.ReleasePackagesStub = nil - fake.releasePackagesReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeReleaseClient) ReleasePackagesReturnsOnCall(i int, result1 error) { - fake.releasePackagesMutex.Lock() - defer fake.releasePackagesMutex.Unlock() - fake.ReleasePackagesStub = nil - if fake.releasePackagesReturnsOnCall == nil { - fake.releasePackagesReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.releasePackagesReturnsOnCall[i] = struct { - result1 error - }{result1} -} - func (fake *FakeReleaseClient) Submit(arg1 bool) error { fake.submitMutex.Lock() ret, specificReturn := fake.submitReturnsOnCall[len(fake.submitArgsForCall)] @@ -970,8 +907,6 @@ func (fake *FakeReleaseClient) Invocations() map[string][][]interface{} { defer fake.pushArtifactsMutex.RUnlock() fake.pushGitObjectsMutex.RLock() defer fake.pushGitObjectsMutex.RUnlock() - fake.releasePackagesMutex.RLock() - defer fake.releasePackagesMutex.RUnlock() fake.submitMutex.RLock() defer fake.submitMutex.RUnlock() fake.updateGitHubPageMutex.RLock() diff --git a/pkg/anago/anagofakes/fake_release_impl.go b/pkg/anago/anagofakes/fake_release_impl.go index 61e89241c5c..efc3d7391b5 100644 --- a/pkg/anago/anagofakes/fake_release_impl.go +++ b/pkg/anago/anagofakes/fake_release_impl.go @@ -258,17 +258,6 @@ type FakeReleaseImpl struct { pushTagsReturnsOnCall map[int]struct { result1 error } - ReleasePackagesStub func(string) error - releasePackagesMutex sync.RWMutex - releasePackagesArgsForCall []struct { - arg1 string - } - releasePackagesReturns struct { - result1 error - } - releasePackagesReturnsOnCall map[int]struct { - result1 error - } SubmitStub func(*gcb.Options) error submitMutex sync.RWMutex submitArgsForCall []struct { @@ -1460,67 +1449,6 @@ func (fake *FakeReleaseImpl) PushTagsReturnsOnCall(i int, result1 error) { }{result1} } -func (fake *FakeReleaseImpl) ReleasePackages(arg1 string) error { - fake.releasePackagesMutex.Lock() - ret, specificReturn := fake.releasePackagesReturnsOnCall[len(fake.releasePackagesArgsForCall)] - fake.releasePackagesArgsForCall = append(fake.releasePackagesArgsForCall, struct { - arg1 string - }{arg1}) - stub := fake.ReleasePackagesStub - fakeReturns := fake.releasePackagesReturns - fake.recordInvocation("ReleasePackages", []interface{}{arg1}) - fake.releasePackagesMutex.Unlock() - if stub != nil { - return stub(arg1) - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeReleaseImpl) ReleasePackagesCallCount() int { - fake.releasePackagesMutex.RLock() - defer fake.releasePackagesMutex.RUnlock() - return len(fake.releasePackagesArgsForCall) -} - -func (fake *FakeReleaseImpl) ReleasePackagesCalls(stub func(string) error) { - fake.releasePackagesMutex.Lock() - defer fake.releasePackagesMutex.Unlock() - fake.ReleasePackagesStub = stub -} - -func (fake *FakeReleaseImpl) ReleasePackagesArgsForCall(i int) string { - fake.releasePackagesMutex.RLock() - defer fake.releasePackagesMutex.RUnlock() - argsForCall := fake.releasePackagesArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *FakeReleaseImpl) ReleasePackagesReturns(result1 error) { - fake.releasePackagesMutex.Lock() - defer fake.releasePackagesMutex.Unlock() - fake.ReleasePackagesStub = nil - fake.releasePackagesReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeReleaseImpl) ReleasePackagesReturnsOnCall(i int, result1 error) { - fake.releasePackagesMutex.Lock() - defer fake.releasePackagesMutex.Unlock() - fake.ReleasePackagesStub = nil - if fake.releasePackagesReturnsOnCall == nil { - fake.releasePackagesReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.releasePackagesReturnsOnCall[i] = struct { - result1 error - }{result1} -} - func (fake *FakeReleaseImpl) Submit(arg1 *gcb.Options) error { fake.submitMutex.Lock() ret, specificReturn := fake.submitReturnsOnCall[len(fake.submitArgsForCall)] @@ -1806,8 +1734,6 @@ func (fake *FakeReleaseImpl) Invocations() map[string][][]interface{} { defer fake.pushMainBranchMutex.RUnlock() fake.pushTagsMutex.RLock() defer fake.pushTagsMutex.RUnlock() - fake.releasePackagesMutex.RLock() - defer fake.releasePackagesMutex.RUnlock() fake.submitMutex.RLock() defer fake.submitMutex.RUnlock() fake.toFileMutex.RLock() diff --git a/pkg/anago/anagofakes/fake_stage_client.go b/pkg/anago/anagofakes/fake_stage_client.go index 1a7c6cb8731..f7b8952e40a 100644 --- a/pkg/anago/anagofakes/fake_stage_client.go +++ b/pkg/anago/anagofakes/fake_stage_client.go @@ -32,16 +32,6 @@ type FakeStageClient struct { buildReturnsOnCall map[int]struct { result1 error } - BuildPackagesStub func() error - buildPackagesMutex sync.RWMutex - buildPackagesArgsForCall []struct { - } - buildPackagesReturns struct { - result1 error - } - buildPackagesReturnsOnCall map[int]struct { - result1 error - } CheckPrerequisitesStub func() error checkPrerequisitesMutex sync.RWMutex checkPrerequisitesArgsForCall []struct { @@ -224,59 +214,6 @@ func (fake *FakeStageClient) BuildReturnsOnCall(i int, result1 error) { }{result1} } -func (fake *FakeStageClient) BuildPackages() error { - fake.buildPackagesMutex.Lock() - ret, specificReturn := fake.buildPackagesReturnsOnCall[len(fake.buildPackagesArgsForCall)] - fake.buildPackagesArgsForCall = append(fake.buildPackagesArgsForCall, struct { - }{}) - stub := fake.BuildPackagesStub - fakeReturns := fake.buildPackagesReturns - fake.recordInvocation("BuildPackages", []interface{}{}) - fake.buildPackagesMutex.Unlock() - if stub != nil { - return stub() - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeStageClient) BuildPackagesCallCount() int { - fake.buildPackagesMutex.RLock() - defer fake.buildPackagesMutex.RUnlock() - return len(fake.buildPackagesArgsForCall) -} - -func (fake *FakeStageClient) BuildPackagesCalls(stub func() error) { - fake.buildPackagesMutex.Lock() - defer fake.buildPackagesMutex.Unlock() - fake.BuildPackagesStub = stub -} - -func (fake *FakeStageClient) BuildPackagesReturns(result1 error) { - fake.buildPackagesMutex.Lock() - defer fake.buildPackagesMutex.Unlock() - fake.BuildPackagesStub = nil - fake.buildPackagesReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeStageClient) BuildPackagesReturnsOnCall(i int, result1 error) { - fake.buildPackagesMutex.Lock() - defer fake.buildPackagesMutex.Unlock() - fake.BuildPackagesStub = nil - if fake.buildPackagesReturnsOnCall == nil { - fake.buildPackagesReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.buildPackagesReturnsOnCall[i] = struct { - result1 error - }{result1} -} - func (fake *FakeStageClient) CheckPrerequisites() error { fake.checkPrerequisitesMutex.Lock() ret, specificReturn := fake.checkPrerequisitesReturnsOnCall[len(fake.checkPrerequisitesArgsForCall)] @@ -950,8 +887,6 @@ func (fake *FakeStageClient) Invocations() map[string][][]interface{} { defer fake.invocationsMutex.RUnlock() fake.buildMutex.RLock() defer fake.buildMutex.RUnlock() - fake.buildPackagesMutex.RLock() - defer fake.buildPackagesMutex.RUnlock() fake.checkPrerequisitesMutex.RLock() defer fake.checkPrerequisitesMutex.RUnlock() fake.checkReleaseBranchStateMutex.RLock() diff --git a/pkg/anago/anagofakes/fake_stage_impl.go b/pkg/anago/anagofakes/fake_stage_impl.go index 0d2014d1190..a93fad4945b 100644 --- a/pkg/anago/anagofakes/fake_stage_impl.go +++ b/pkg/anago/anagofakes/fake_stage_impl.go @@ -85,17 +85,6 @@ type FakeStageImpl struct { result1 *spdx.Document result2 error } - BuildPackagesStub func(string) error - buildPackagesMutex sync.RWMutex - buildPackagesArgsForCall []struct { - arg1 string - } - buildPackagesReturns struct { - result1 error - } - buildPackagesReturnsOnCall map[int]struct { - result1 error - } CheckPrerequisitesStub func() error checkPrerequisitesMutex sync.RWMutex checkPrerequisitesArgsForCall []struct { @@ -773,67 +762,6 @@ func (fake *FakeStageImpl) BuildBaseArtifactsSBOMReturnsOnCall(i int, result1 *s }{result1, result2} } -func (fake *FakeStageImpl) BuildPackages(arg1 string) error { - fake.buildPackagesMutex.Lock() - ret, specificReturn := fake.buildPackagesReturnsOnCall[len(fake.buildPackagesArgsForCall)] - fake.buildPackagesArgsForCall = append(fake.buildPackagesArgsForCall, struct { - arg1 string - }{arg1}) - stub := fake.BuildPackagesStub - fakeReturns := fake.buildPackagesReturns - fake.recordInvocation("BuildPackages", []interface{}{arg1}) - fake.buildPackagesMutex.Unlock() - if stub != nil { - return stub(arg1) - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeStageImpl) BuildPackagesCallCount() int { - fake.buildPackagesMutex.RLock() - defer fake.buildPackagesMutex.RUnlock() - return len(fake.buildPackagesArgsForCall) -} - -func (fake *FakeStageImpl) BuildPackagesCalls(stub func(string) error) { - fake.buildPackagesMutex.Lock() - defer fake.buildPackagesMutex.Unlock() - fake.BuildPackagesStub = stub -} - -func (fake *FakeStageImpl) BuildPackagesArgsForCall(i int) string { - fake.buildPackagesMutex.RLock() - defer fake.buildPackagesMutex.RUnlock() - argsForCall := fake.buildPackagesArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *FakeStageImpl) BuildPackagesReturns(result1 error) { - fake.buildPackagesMutex.Lock() - defer fake.buildPackagesMutex.Unlock() - fake.BuildPackagesStub = nil - fake.buildPackagesReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeStageImpl) BuildPackagesReturnsOnCall(i int, result1 error) { - fake.buildPackagesMutex.Lock() - defer fake.buildPackagesMutex.Unlock() - fake.BuildPackagesStub = nil - if fake.buildPackagesReturnsOnCall == nil { - fake.buildPackagesReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.buildPackagesReturnsOnCall[i] = struct { - result1 error - }{result1} -} - func (fake *FakeStageImpl) CheckPrerequisites() error { fake.checkPrerequisitesMutex.Lock() ret, specificReturn := fake.checkPrerequisitesReturnsOnCall[len(fake.checkPrerequisitesArgsForCall)] @@ -2933,8 +2861,6 @@ func (fake *FakeStageImpl) Invocations() map[string][][]interface{} { defer fake.branchNeedsCreationMutex.RUnlock() fake.buildBaseArtifactsSBOMMutex.RLock() defer fake.buildBaseArtifactsSBOMMutex.RUnlock() - fake.buildPackagesMutex.RLock() - defer fake.buildPackagesMutex.RUnlock() fake.checkPrerequisitesMutex.RLock() defer fake.checkPrerequisitesMutex.RUnlock() fake.checkReleaseBucketMutex.RLock() diff --git a/pkg/anago/release.go b/pkg/anago/release.go index a55f789de1a..6c4693ca8f7 100644 --- a/pkg/anago/release.go +++ b/pkg/anago/release.go @@ -27,7 +27,6 @@ import ( "k8s.io/release/pkg/announce" "k8s.io/release/pkg/build" "k8s.io/release/pkg/gcp/gcb" - "k8s.io/release/pkg/packages" "k8s.io/release/pkg/release" "sigs.k8s.io/release-sdk/git" "sigs.k8s.io/release-sdk/object" @@ -82,9 +81,6 @@ type releaseClient interface { // on GitHub. PushGitObjects() error - // ReleasePackages pushes the deb and rpm packages to their final destination. - ReleasePackages() error - // CreateAnnouncement creates the release announcement mail and update the // GitHub release page to contain the artifacts and their checksums. CreateAnnouncement() error @@ -148,7 +144,6 @@ type releaseImpl interface { versionMarkers []string, privateBucket, fast bool, ) error - ReleasePackages(string) error CreateAnnouncement( options *announce.Options, ) error @@ -263,10 +258,6 @@ func (d *DefaultRelease) InitLogFile() error { return nil } -func (d *defaultReleaseImpl) ReleasePackages(version string) error { - return packages.New(version).Release() -} - func (d *defaultReleaseImpl) CreateAnnouncement(options *announce.Options) error { // Create the announcement return announce.CreateForRelease(options) @@ -525,25 +516,6 @@ func (d *DefaultRelease) PushGitObjects() error { return nil } -// ReleasePackages pushes the deb and rpm packages to their final destination. -func (d *DefaultRelease) ReleasePackages() error { - if !d.options.NoMock { - logrus.Info("Will not create any packages because we're running in mock mode") - return nil - } - version := d.state.versions.Official() - if version == "" { - logrus.Info("Will not create any packages for non-official releases") - return nil - } - - if err := d.impl.ReleasePackages(version); err != nil { - return fmt.Errorf("release version %s: %w", version, err) - } - - return nil -} - // CreateAnnouncement creates the announcement.html file func (d *DefaultRelease) CreateAnnouncement() error { // Build the announcement options set diff --git a/pkg/anago/release_test.go b/pkg/anago/release_test.go index b212d768410..7e825cf949a 100644 --- a/pkg/anago/release_test.go +++ b/pkg/anago/release_test.go @@ -324,40 +324,6 @@ func TestSubmitReleaseImpl(t *testing.T) { } } -func TestReleasePackages(t *testing.T) { - for _, tc := range []struct { - prepare func(*anagofakes.FakeReleaseImpl) - shouldError bool - }{ - { // success - prepare: func(*anagofakes.FakeReleaseImpl) {}, - shouldError: false, - }, - { // ReleasePackages failed - prepare: func(mock *anagofakes.FakeReleaseImpl) { - mock.ReleasePackagesReturns(err) - }, - shouldError: true, - }, - } { - opts := anago.DefaultReleaseOptions() - opts.NoMock = true - sut := anago.NewDefaultRelease(opts) - sut.SetState( - generateTestingReleaseState(&testStateParameters{versionsTag: &testVersionTag}), - ) - mock := &anagofakes.FakeReleaseImpl{} - tc.prepare(mock) - sut.SetImpl(mock) - err := sut.ReleasePackages() - if tc.shouldError { - require.NotNil(t, err) - } else { - require.Nil(t, err) - } - } -} - func TestCreateAnnouncement(t *testing.T) { for _, tc := range []struct { prepare func(*anagofakes.FakeReleaseImpl) diff --git a/pkg/anago/stage.go b/pkg/anago/stage.go index c2ef01bee28..e7bfd4625b0 100644 --- a/pkg/anago/stage.go +++ b/pkg/anago/stage.go @@ -31,7 +31,6 @@ import ( "k8s.io/release/pkg/build" "k8s.io/release/pkg/changelog" "k8s.io/release/pkg/gcp/gcb" - "k8s.io/release/pkg/packages" "k8s.io/release/pkg/release" "sigs.k8s.io/bom/pkg/provenance" "sigs.k8s.io/bom/pkg/spdx" @@ -83,9 +82,6 @@ type stageClient interface { // container image. This step also build all necessary release tarballs. Build() error - // BuildPackages builds deb and rmp packages. - BuildPackages() error - // GenerateChangelog builds the CHANGELOG-x.y.md file and commits it // into the local repository. GenerateChangelog() error @@ -157,7 +153,6 @@ type stageImpl interface { CheckReleaseBucket(options *build.Options) error DockerHubLogin() error MakeCross(version string) error - BuildPackages(version string) error GenerateChangelog(options *changelog.Options) error StageLocalSourceTree( options *build.Options, workDir, buildVersion string, @@ -255,10 +250,6 @@ func (d *defaultStageImpl) MakeCross(version string) error { return build.NewMake().MakeCross(version) } -func (d *defaultStageImpl) BuildPackages(version string) error { - return packages.New(version).Build() -} - func (d *defaultStageImpl) DockerHubLogin() error { return release.DockerHubLogin() } @@ -573,16 +564,6 @@ func (d *DefaultStage) Build() error { return nil } -// BuildPackages builds deb and rmp packages. -func (d *DefaultStage) BuildPackages() error { - for _, version := range d.state.versions.Ordered() { - if err := d.impl.BuildPackages(version); err != nil { - return fmt.Errorf("build version %s: %w", version, err) - } - } - return nil -} - // VerifyArtifacts checks the artifacts to ensure they are correct func (d *DefaultStage) VerifyArtifacts() error { return d.impl.VerifyArtifacts(d.state.versions.Ordered()) diff --git a/pkg/anago/stage_test.go b/pkg/anago/stage_test.go index 7ccc3707584..cd5df356f64 100644 --- a/pkg/anago/stage_test.go +++ b/pkg/anago/stage_test.go @@ -433,42 +433,6 @@ func TestBuild(t *testing.T) { } } -func TestBuildPackages(t *testing.T) { - for _, tc := range []struct { - prepare func(*anagofakes.FakeStageImpl) - shouldError bool - }{ - { // success - prepare: func(*anagofakes.FakeStageImpl) {}, - shouldError: false, - }, - { // BuildPackages fails - prepare: func(mock *anagofakes.FakeStageImpl) { - mock.BuildPackagesReturns(err) - }, - shouldError: true, - }, - } { - opts := anago.DefaultStageOptions() - sut := anago.NewDefaultStage(opts) - - sut.SetState( - generateTestingStageState(&testStateParameters{versionsTag: &testVersionTag}), - ) - - mock := &anagofakes.FakeStageImpl{} - tc.prepare(mock) - sut.SetImpl(mock) - - err := sut.BuildPackages() - if tc.shouldError { - require.NotNil(t, err) - } else { - require.Nil(t, err) - } - } -} - func TestGenerateChangelog(t *testing.T) { for _, tc := range []struct { prepare func(*anagofakes.FakeStageImpl) diff --git a/pkg/kubepkg/kubepkg.go b/pkg/kubepkg/kubepkg.go deleted file mode 100644 index 37d19b4e7d0..00000000000 --- a/pkg/kubepkg/kubepkg.go +++ /dev/null @@ -1,631 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kubepkg - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "strconv" - "strings" - "time" - - "github.com/blang/semver/v4" - gogithub "github.com/google/go-github/v53/github" - "github.com/sirupsen/logrus" - - "k8s.io/release/pkg/kubepkg/options" - "k8s.io/release/pkg/release" - "sigs.k8s.io/release-sdk/github" - "sigs.k8s.io/release-utils/command" - "sigs.k8s.io/release-utils/util" -) - -type ChannelType string - -const ( - ChannelRelease ChannelType = "release" - ChannelTesting ChannelType = "testing" - ChannelNightly ChannelType = "nightly" - - minimumKubernetesVersion = "1.13.0" - CurrentCNIVersion = "1.1.1" - MinimumCNIVersion = "0.8.6" - - kubeadmConf = "10-kubeadm.conf" -) - -var ( - minimumCRIToolsVersion = minimumKubernetesVersion - - buildArchMap = map[string]map[options.BuildType]string{ - "amd64": { - "deb": "amd64", - "rpm": "x86_64", - }, - "arm": { - "deb": "armhf", - "rpm": "armhfp", - }, - "arm64": { - "deb": "arm64", - "rpm": "aarch64", - }, - "ppc64le": { - "deb": "ppc64el", - "rpm": "ppc64le", - }, - "s390x": { - "deb": "s390x", - "rpm": "s390x", - }, - } - - builtins = map[string]interface{}{ - "date": func() string { - return time.Now().Format(time.RFC1123Z) - }, - } -) - -type Client struct { - options *options.Options - impl Impl -} - -func New(o *options.Options) *Client { - return &Client{ - options: o, - impl: &impl{}, - } -} - -func (c *Client) SetImpl(impl Impl) { - c.impl = impl -} - -type impl struct{} - -//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate -//counterfeiter:generate . Impl -//go:generate /usr/bin/env bash -c "cat ../../hack/boilerplate/boilerplate.generatego.txt kubepkgfakes/fake_impl.go > kubepkgfakes/_fake_impl.go && mv kubepkgfakes/_fake_impl.go kubepkgfakes/fake_impl.go" -type Impl interface { - RunSuccessWithWorkDir(workDir, cmd string, args ...string) error - Releases(owner, repo string, includePrereleases bool) ([]*gogithub.RepositoryRelease, error) - GetKubeVersion(versionType release.VersionType) (string, error) - ReadFile(string) ([]byte, error) - WriteFile(string, []byte, os.FileMode) error -} - -func (i *impl) RunSuccessWithWorkDir(workDir, cmd string, args ...string) error { - return command.NewWithWorkDir(workDir, cmd, args...).RunSuccess() -} - -func (i *impl) Releases(owner, repo string, includePrereleases bool) ([]*gogithub.RepositoryRelease, error) { - return github.New().Releases(owner, repo, includePrereleases) -} - -func (i *impl) GetKubeVersion(versionType release.VersionType) (string, error) { - return release.NewVersion().GetKubeVersion(versionType) -} - -func (i *impl) ReadFile(filename string) ([]byte, error) { - return os.ReadFile(filename) -} - -func (i *impl) WriteFile(filename string, data []byte, perm os.FileMode) error { - return os.WriteFile(filename, data, perm) -} - -type Build struct { - Type options.BuildType - Package string - Definitions []*PackageDefinition - TemplateDir string -} - -type PackageDefinition struct { - Name string - Version string - Revision string - - Channel ChannelType - - KubernetesVersion string - Dependencies map[string]string - - DownloadLinkBase string - KubeadmKubeletConfigFile string - - CNIVersion string - CNIDownloadLink string -} - -type buildConfig struct { - *PackageDefinition - Type options.BuildType - GoArch string - BuildArch string - Package string - - TemplateDir string - workspace string - specOnly bool -} - -func (c *Client) ConstructBuilds() ([]Build, error) { - logrus.Infof("Constructing builds...") - - builds := []Build{} - - for _, pkg := range c.options.Packages() { - // TODO: Get package directory for any version once package definitions are broken out - packageTemplateDir := filepath.Join(c.options.TemplateDir(), string(c.options.BuildType()), pkg) - if _, err := os.Stat(packageTemplateDir); err != nil { - return nil, fmt.Errorf("finding package template dir: %w", err) - } - - b := &Build{ - Type: c.options.BuildType(), - Package: pkg, - TemplateDir: packageTemplateDir, - } - - for _, channel := range c.options.Channels() { - packageDef := &PackageDefinition{ - Revision: c.options.Revision(), - Channel: ChannelType(channel), - } - - packageDef.KubernetesVersion = c.options.KubeVersion() - - switch b.Package { - case "kubelet": - packageDef.CNIVersion = c.options.CNIVersion() - case "kubernetes-cni": - packageDef.Version = c.options.CNIVersion() - case "cri-tools": - packageDef.Version = c.options.CRIToolsVersion() - } - - b.Definitions = append(b.Definitions, packageDef) - } - - builds = append(builds, *b) - } - - logrus.Infof("Successfully constructed builds") - return builds, nil -} - -func (c *Client) WalkBuilds(builds []Build) (err error) { - logrus.Infof("Walking builds...") - - workingDir := os.Getenv("KUBEPKG_WORKING_DIR") - if workingDir == "" { - workingDir, err = os.MkdirTemp("", "kubepkg") - if err != nil { - return err - } - } - - for _, arch := range c.options.Architectures() { - for _, build := range builds { - for _, packageDef := range build.Definitions { - if err := c.buildPackage(build, packageDef, arch, workingDir); err != nil { - return err - } - } - } - } - if c.options.SpecOnly() { - logrus.Infof("Package specs have been saved in %s", workingDir) - } - logrus.Infof("Successfully walked builds") - return nil -} - -func (c *Client) buildPackage(build Build, packageDef *PackageDefinition, arch, tmpDir string) error { - if packageDef == nil { - return errors.New("package definition cannot be nil") - } - - pd := &PackageDefinition{} - *pd = *packageDef - - bc := &buildConfig{ - PackageDefinition: pd, - Type: build.Type, - Package: build.Package, - GoArch: arch, - TemplateDir: build.TemplateDir, - workspace: tmpDir, - specOnly: c.options.SpecOnly(), - } - - bc.Name = build.Package - - var err error - - if bc.KubernetesVersion != "" { - logrus.Infof("Checking if user-supplied Kubernetes version (%s) is valid semver...", bc.KubernetesVersion) - kubeSemver, err := util.TagStringToSemver(bc.KubernetesVersion) - if err != nil { - return fmt.Errorf("user-supplied Kubernetes version is not valid semver: %w", err) - } - - kubeVersionString := kubeSemver.String() - kubeVersionParts := strings.Split(kubeVersionString, ".") - - switch { - case len(kubeVersionParts) > 4: - logrus.Info("User-supplied Kubernetes version is a CI version") - logrus.Info("Setting channel to nightly") - bc.Channel = ChannelNightly - case len(kubeVersionParts) == 4: - logrus.Info("User-supplied Kubernetes version is a pre-release version") - logrus.Info("Setting channel to testing") - bc.Channel = ChannelTesting - default: - logrus.Info("User-supplied Kubernetes version is a release version") - logrus.Info("Setting channel to release") - bc.Channel = ChannelRelease - } - } - - bc.KubernetesVersion, err = c.GetKubernetesVersion(pd) - if err != nil { - return fmt.Errorf("getting Kubernetes version: %w", err) - } - - bc.DownloadLinkBase, err = c.GetDownloadLinkBase(pd) - if err != nil { - return fmt.Errorf("getting Kubernetes download link base: %w", err) - } - - logrus.Infof("Kubernetes download link base: %s", bc.DownloadLinkBase) - - // For cases where a CI build version of Kubernetes is retrieved, replace instances - // of "+" with "-", so that we build with a valid Debian package version. - bc.KubernetesVersion = strings.Replace(bc.KubernetesVersion, "+", "-", 1) - - bc.Version, err = c.GetPackageVersion(pd) - if err != nil { - return fmt.Errorf("getting package version: %w", err) - } - - logrus.Infof("%s package version: %s", bc.Name, bc.Version) - - bc.Dependencies, err = GetDependencies(pd) - if err != nil { - return fmt.Errorf("getting dependencies: %w", err) - } - - bc.KubeadmKubeletConfigFile = kubeadmConf - - bc.BuildArch = getBuildArch(bc.GoArch, bc.Type) - - bc.CNIVersion, err = GetCNIVersion(pd) - if err != nil { - return fmt.Errorf("getting CNI version: %w", err) - } - - bc.CNIDownloadLink, err = GetCNIDownloadLink(pd.Version, bc.GoArch) - if err != nil { - return fmt.Errorf("getting CNI download link: %w", err) - } - - logrus.Infof("Building %s package for %s/%s architecture...", bc.Package, bc.GoArch, bc.BuildArch) - return c.run(bc) -} - -func (c *Client) run(bc *buildConfig) error { - workspaceInfo, err := os.Stat(bc.workspace) - if err != nil { - return err - } - - specDir := filepath.Join(bc.workspace, string(bc.Channel), bc.Package) - specDirWithArch := filepath.Join(specDir, bc.GoArch) - - if err := os.MkdirAll(specDirWithArch, workspaceInfo.Mode()); err != nil { - return err - } - - // TODO: keepTmp/cleanup needs to defined in kubepkg root - if !bc.specOnly { - defer os.RemoveAll(specDirWithArch) - } - - if _, err := buildSpecs(bc, specDirWithArch); err != nil { - return err - } - - if bc.specOnly { - logrus.Info("Spec-only mode was selected; kubepkg will now exit without building packages") - return nil - } - - // TODO: Move OS-specific logic into their own files - switch bc.Type { - case options.BuildDeb: - logrus.Infof("Running dpkg-buildpackage for %s (%s/%s)", bc.Package, bc.GoArch, bc.BuildArch) - - if err := c.impl.RunSuccessWithWorkDir( - specDirWithArch, - "dpkg-buildpackage", - "--unsigned-source", - "--unsigned-changes", - "--build=binary", - "--host-arch", - bc.BuildArch, - ); err != nil { - return fmt.Errorf("running debian package build: %w", err) - } - - fileName := fmt.Sprintf( - "%s_%s-%s_%s.deb", - bc.Package, - bc.Version, - bc.Revision, - bc.BuildArch, - ) - - dstPath := filepath.Join("bin", string(bc.Channel), fileName) - logrus.Infof("Using package destination path %s", dstPath) - - if err := os.MkdirAll(filepath.Dir(dstPath), os.FileMode(0o777)); err != nil { - return fmt.Errorf("creating %s: %w", filepath.Dir(dstPath), err) - } - - srcPath := filepath.Join(specDir, fileName) - input, err := c.impl.ReadFile(srcPath) - if err != nil { - return fmt.Errorf("reading %s: %w", srcPath, err) - } - - err = c.impl.WriteFile(dstPath, input, os.FileMode(0o644)) - if err != nil { - return fmt.Errorf("writing file to %s: %w", dstPath, err) - } - - logrus.Infof("Successfully built %s", dstPath) - case options.BuildRpm: - logrus.Info("Building rpms via kubepkg is not currently supported") - } - - return nil -} - -func (c *Client) GetPackageVersion(packageDef *PackageDefinition) (string, error) { - if packageDef == nil { - return "", errors.New("package definition cannot be nil") - } - - logrus.Infof("Setting version for %s package...", packageDef.Name) - switch packageDef.Name { - case "kubernetes-cni": - return GetCNIVersion(packageDef) - case "cri-tools": - return c.GetCRIToolsVersion(packageDef) - } - - logrus.Infof( - "Using Kubernetes version %s for %s package", - packageDef.KubernetesVersion, packageDef.Name, - ) - return util.TrimTagPrefix(packageDef.KubernetesVersion), nil -} - -func (c *Client) GetKubernetesVersion(packageDef *PackageDefinition) (string, error) { - if packageDef == nil { - return "", errors.New("package definition cannot be nil") - } - - if packageDef.KubernetesVersion != "" { - logrus.Infof("Using Kubernetes version (%s) for %s package", packageDef.KubernetesVersion, packageDef.Name) - return packageDef.KubernetesVersion, nil - } - switch packageDef.Channel { - case ChannelTesting: - return c.impl.GetKubeVersion(release.VersionTypeStablePreRelease) - case ChannelNightly: - return c.impl.GetKubeVersion(release.VersionTypeCILatestCross) - } - - return c.impl.GetKubeVersion(release.VersionTypeStable) -} - -func GetCNIVersion(packageDef *PackageDefinition) (string, error) { - if packageDef == nil { - return "", errors.New("package definition cannot be nil") - } - - // TODO: Ensure version is not less than MinimumCNIVersion - logrus.Infof("Getting CNI version...") - if packageDef.CNIVersion != "" { - cniSemVer, err := util.TagStringToSemver(packageDef.CNIVersion) - if err != nil { - return "", fmt.Errorf("parsing CNI version: %w", err) - } - minCNISemVer, err := util.TagStringToSemver(MinimumCNIVersion) - if err != nil { - return "", fmt.Errorf("parsing CNI version: %w", err) - } - - if cniSemVer.LT(minCNISemVer) { - return "", fmt.Errorf("specified CNI version (%s) cannot be lower than %s", packageDef.CNIVersion, MinimumCNIVersion) - } - - logrus.Infof("Setting CNI version to %s", packageDef.CNIVersion) - return packageDef.CNIVersion, nil - } - - logrus.Infof("Setting CNI version to %s", MinimumCNIVersion) - return MinimumCNIVersion, nil -} - -func (c *Client) GetCRIToolsVersion(packageDef *PackageDefinition) (string, error) { - if packageDef == nil { - return "", errors.New("package definition cannot be nil") - } - - if packageDef.Version != "" { - return packageDef.Version, nil - } - - kubeSemver, err := util.TagStringToSemver(packageDef.KubernetesVersion) - if err != nil { - return "", err - } - - logrus.Infof("Getting CRI version...") - - kubeVersionString := kubeSemver.String() - kubeVersionParts := strings.Split(kubeVersionString, ".") - - criToolsMajor := kubeVersionParts[0] - criToolsMinor := kubeVersionParts[1] - - // CRI tools releases are not published until after the corresponding Kubernetes release. - // In instances where the Kubernetes version selected is a pre-release or CI build version, // we need to build from the previous minor version of CRI tools instead. - // - // Example: - // Kubernetes version: 1.18.0-alpha.1 - // Initial CRI tools version: 1.18.0-alpha.1 - // Modified CRI tools version: 1.17.0 - if len(kubeVersionParts) >= 4 { - criToolsMinorInt, err := strconv.Atoi(criToolsMinor) - if err != nil { - return "", err - } - - criToolsMinorInt-- - criToolsMinor = strconv.Itoa(criToolsMinorInt) - } - - criToolsVersion := fmt.Sprintf("%s.%s.0", criToolsMajor, criToolsMinor) - - releases, err := c.impl.Releases("kubernetes-sigs", "cri-tools", false) - if err != nil { - return "", err - } - - var tags []string - for _, release := range releases { - criToolsReleaseTag := util.TrimTagPrefix(*release.TagName) - criToolsReleaseVersionParts := strings.Split(criToolsReleaseTag, ".") - criToolsReleaseMinor := criToolsReleaseVersionParts[1] - - if criToolsReleaseMinor == criToolsMinor { - tags = append(tags, criToolsReleaseTag) - } - } - - for _, tag := range tags { - tagSemver, err := semver.Parse(tag) - if err != nil { - return "", fmt.Errorf("could not parse tag semver: %w", err) - } - - criToolsSemver, err := semver.Parse(criToolsVersion) - if err != nil { - return "", fmt.Errorf("could not parse CRI tools semver: %w", err) - } - - if tagSemver.GTE(criToolsSemver) { - criToolsVersion = tag - } - } - - logrus.Infof("Setting CRI tools version to %s", criToolsVersion) - return criToolsVersion, nil -} - -func (c *Client) GetDownloadLinkBase(packageDef *PackageDefinition) (string, error) { - if packageDef == nil { - return "", errors.New("package definition cannot be nil") - } - - if packageDef.Channel == ChannelNightly { - return c.GetCIBuildsDownloadLinkBase(packageDef) - } - - return GetDefaultReleaseDownloadLinkBase(packageDef) -} - -func (c *Client) GetCIBuildsDownloadLinkBase(packageDef *PackageDefinition) (string, error) { - if packageDef == nil { - return "", errors.New("package definition cannot be nil") - } - - ciVersion := packageDef.KubernetesVersion - if ciVersion == "" { - var err error - ciVersion, err = c.impl.GetKubeVersion(release.VersionTypeCILatestCross) - if err != nil { - return "", err - } - } - - return fmt.Sprintf("https://dl.k8s.io/ci/%s", util.AddTagPrefix(ciVersion)), nil -} - -func GetDefaultReleaseDownloadLinkBase(packageDef *PackageDefinition) (string, error) { - if packageDef == nil { - return "", errors.New("package definition cannot be nil") - } - - return fmt.Sprintf( - "%s/%s", - options.DefaultReleaseDownloadLinkBase, - util.AddTagPrefix(packageDef.KubernetesVersion), - ), nil -} - -func GetDependencies(packageDef *PackageDefinition) (map[string]string, error) { - if packageDef == nil { - return nil, errors.New("package definition cannot be nil") - } - - deps := make(map[string]string) - - switch packageDef.Name { - case "kubelet": - deps["kubernetes-cni"] = MinimumCNIVersion - case "kubeadm": - deps["kubelet"] = minimumKubernetesVersion - deps["kubectl"] = minimumKubernetesVersion - deps["kubernetes-cni"] = MinimumCNIVersion // deb based kubeadm still requires kubernetes-cni - deps["cri-tools"] = minimumCRIToolsVersion - } - - return deps, nil -} - -func getBuildArch(goArch string, buildType options.BuildType) string { - return buildArchMap[goArch][buildType] -} - -func GetCNIDownloadLink(version, arch string) (string, error) { - if _, err := util.TagStringToSemver(version); err != nil { - return "", fmt.Errorf("parsing CNI version: %w", err) - } - - return fmt.Sprintf("https://storage.googleapis.com/k8s-artifacts-cni/release/v%s/cni-plugins-linux-%s-v%s.tgz", version, arch, version), nil -} diff --git a/pkg/kubepkg/kubepkg_test.go b/pkg/kubepkg/kubepkg_test.go deleted file mode 100644 index a14c8322a36..00000000000 --- a/pkg/kubepkg/kubepkg_test.go +++ /dev/null @@ -1,541 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kubepkg_test - -import ( - "errors" - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/require" - - "k8s.io/release/pkg/kubepkg" - "k8s.io/release/pkg/kubepkg/kubepkgfakes" - "k8s.io/release/pkg/kubepkg/options" -) - -var err = errors.New("") - -func newSUT(opts *options.Options) (*kubepkg.Client, *kubepkgfakes.FakeImpl) { - if opts == nil { - opts = options.New() - } - - sut := kubepkg.New(opts) - - implMock := &kubepkgfakes.FakeImpl{} - sut.SetImpl(implMock) - - return sut, implMock -} - -func sutWithTemplateDir( - t *testing.T, opts *options.Options, buildType options.BuildType, -) (sut *kubepkg.Client, cleanup func(), mock *kubepkgfakes.FakeImpl) { - tempDir, err := os.MkdirTemp("", "kubepkg-test-") - require.Nil(t, err) - cleanup = func() { require.Nil(t, os.RemoveAll(tempDir)) } - - if opts == nil { - opts = options.New() - } - opts = opts. - WithTemplateDir(tempDir). - WithBuildType(buildType). - WithKubeVersion("v1.18.0") - sut, mock = newSUT(opts) - - for _, dir := range opts.Packages() { - pkgPath := filepath.Join(tempDir, string(buildType), dir) - require.Nil(t, os.MkdirAll(pkgPath, 0o755)) - } - return sut, cleanup, mock -} - -func TestConstructBuilds(t *testing.T) { - sut, cleanup, _ := sutWithTemplateDir(t, nil, options.BuildRpm) - defer cleanup() - - builds, err := sut.ConstructBuilds() - require.Nil(t, err) - require.NotEmpty(t, builds) - require.Len(t, builds, 5) - require.Len(t, builds[0].Definitions, 3) - require.Equal(t, "kubelet", builds[0].Package) - require.Equal(t, options.BuildRpm, builds[0].Type) -} - -func TestWalkBuildsSuccessWithoutArchitectures(t *testing.T) { - opts := options.New().WithArchitectures().WithSpecOnly(true) - sut, cleanup, _ := sutWithTemplateDir(t, opts, options.BuildRpm) - defer cleanup() - - builds, err := sut.ConstructBuilds() - require.Nil(t, err) - - err = sut.WalkBuilds(builds) - require.Nil(t, err) -} - -func TestWalkBuildsSuccessRPM(t *testing.T) { - sut, cleanup, _ := sutWithTemplateDir(t, nil, options.BuildRpm) - defer cleanup() - - builds, err := sut.ConstructBuilds() - require.Nil(t, err) - - err = sut.WalkBuilds(builds) - require.Nil(t, err) -} - -func TestWalkBuildsSuccessRPMSpecOnly(t *testing.T) { - opts := options.New().WithSpecOnly(true) - sut, cleanup, _ := sutWithTemplateDir(t, opts, options.BuildRpm) - defer cleanup() - - builds, err := sut.ConstructBuilds() - require.Nil(t, err) - - err = sut.WalkBuilds(builds) - require.Nil(t, err) -} - -func TestWalkBuildsSuccessDeb(t *testing.T) { - sut, cleanup, _ := sutWithTemplateDir(t, nil, options.BuildDeb) - defer cleanup() - - builds, err := sut.ConstructBuilds() - require.Nil(t, err) - - err = sut.WalkBuilds(builds) - require.Nil(t, err) -} - -func TestWalkBuildsFailureReadFileFailed(t *testing.T) { - sut, cleanup, mock := sutWithTemplateDir(t, nil, options.BuildDeb) - mock.ReadFileReturns(nil, err) - defer cleanup() - - builds, err := sut.ConstructBuilds() - require.Nil(t, err) - - err = sut.WalkBuilds(builds) - require.NotNil(t, err) -} - -func TestWalkBuildsFailureWriteFileFailed(t *testing.T) { - sut, cleanup, mock := sutWithTemplateDir(t, nil, options.BuildDeb) - mock.WriteFileReturns(err) - defer cleanup() - - builds, err := sut.ConstructBuilds() - require.Nil(t, err) - - err = sut.WalkBuilds(builds) - require.NotNil(t, err) -} - -func TestWalkBuildsFailureDebDPKGFailed(t *testing.T) { - sut, cleanup, mock := sutWithTemplateDir(t, nil, options.BuildDeb) - mock.RunSuccessWithWorkDirReturns(err) - defer cleanup() - - builds, err := sut.ConstructBuilds() - require.Nil(t, err) - - err = sut.WalkBuilds(builds) - require.NotNil(t, err) -} - -func TestConstructBuildsFailedInvalidTemplateDir(t *testing.T) { - sut, _ := newSUT(nil) - builds, err := sut.ConstructBuilds() - require.NotNil(t, err) - require.Nil(t, builds) -} - -func TestGetPackageVersionSuccess(t *testing.T) { - testcases := []struct { - name string - packageName string - version string - kubeVersion string - expected string - }{ - { - name: "Kubernetes version supplied", - kubeVersion: "1.17.0", - expected: "1.17.0", - }, - { - name: "Kubernetes version prefixed", - kubeVersion: "v1.17.0", - expected: "1.17.0", - }, - { - name: "Kubernetes version not supplied", - expected: "", - }, - { - name: "CNI version", - packageName: "kubernetes-cni", - version: "0.8.6", - kubeVersion: "1.17.0", - expected: "0.8.6", - }, - { - name: "CRI tools version", - packageName: "cri-tools", - kubeVersion: "1.17.0", - expected: "1.17.0", - }, - } - - sut, _ := newSUT(nil) - for _, tc := range testcases { - actual, err := sut.GetPackageVersion( - &kubepkg.PackageDefinition{ - Name: tc.packageName, - Version: tc.version, - KubernetesVersion: tc.kubeVersion, - }, - ) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetPackageVersionFailure(t *testing.T) { - sut, _ := newSUT(nil) - _, err := sut.GetPackageVersion(nil) - require.NotNil(t, err) -} - -// TODO: Figure out how we want to test success of this function. -// -// When channel type is provided, we return a func() (string, error), instead of (string, error). -// Additionally, those functions have variable output depending on when we run the test cases. -func TestGetKubernetesVersionSuccess(t *testing.T) { - testcases := []struct { - name string - version string - kubeVersion string - channel kubepkg.ChannelType - expected string - }{ - { - name: "Kubernetes version supplied", - kubeVersion: "1.17.0", - expected: "1.17.0", - }, - } - - sut, _ := newSUT(nil) - for _, tc := range testcases { - actual, err := sut.GetKubernetesVersion( - &kubepkg.PackageDefinition{ - Version: tc.version, - KubernetesVersion: tc.kubeVersion, - }, - ) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetKubernetesVersionFailure(t *testing.T) { - sut, _ := newSUT(nil) - _, err := sut.GetKubernetesVersion(nil) - require.NotNil(t, err) -} - -func TestGetCNIVersionSuccess(t *testing.T) { - testcases := []struct { - name string - cniVersion string - kubeVersion string - expected string - }{ - { - name: "CNI version supplied", - cniVersion: "0.8.7", - kubeVersion: "1.17.0", - expected: "0.8.7", - }, - { - name: "CNI version not supplied", - kubeVersion: "1.17.0", - expected: kubepkg.MinimumCNIVersion, - }, - } - - for _, tc := range testcases { - actual, err := kubepkg.GetCNIVersion( - &kubepkg.PackageDefinition{ - CNIVersion: tc.cniVersion, - KubernetesVersion: tc.kubeVersion, - }, - ) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetCNIVersionFailure(t *testing.T) { - testcases := []struct { - name string - packageDef *kubepkg.PackageDefinition - }{ - { - name: "package definition is nil", - packageDef: nil, - }, - { - name: "CNI version supplied less than minimum allowed CNI version", - packageDef: &kubepkg.PackageDefinition{ - CNIVersion: "0.8.3", - KubernetesVersion: "1.17.0", - }, - }, - } - - for _, tc := range testcases { - _, err := kubepkg.GetCNIVersion(tc.packageDef) - - require.NotNil(t, err) - } -} - -func TestGetCRIToolsVersionSuccess(t *testing.T) { - testcases := []struct { - name string - version string - kubeVersion string - expected string - }{ - { - name: "User-supplied CRI tools version", - version: "1.17.0", - expected: "1.17.0", - }, - { - name: "Pre-release or CI Kubernetes version", - kubeVersion: "1.18.0-alpha.1", - expected: "1.17.0", - }, - } - - sut, _ := newSUT(nil) - for _, tc := range testcases { - actual, err := sut.GetCRIToolsVersion( - &kubepkg.PackageDefinition{ - Version: tc.version, - KubernetesVersion: tc.kubeVersion, - }, - ) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetCRIToolsVersionFailure(t *testing.T) { - sut, _ := newSUT(nil) - _, err := sut.GetCRIToolsVersion(nil) - require.NotNil(t, err) -} - -func TestGetDownloadLinkBaseSuccess(t *testing.T) { - testcases := []struct { - name string - kubeVersion string - channel kubepkg.ChannelType - expected string - }{ - { - name: "CI version", - kubeVersion: "1.18.0-alpha.1.277+2099c00290d262", - channel: kubepkg.ChannelNightly, - expected: "https://dl.k8s.io/ci/v1.18.0-alpha.1.277+2099c00290d262", - }, - { - name: "non-CI version", - kubeVersion: "1.18.0-alpha.1", - expected: "https://dl.k8s.io/v1.18.0-alpha.1", - }, - } - - sut, _ := newSUT(nil) - for _, tc := range testcases { - actual, err := sut.GetDownloadLinkBase( - &kubepkg.PackageDefinition{ - KubernetesVersion: tc.kubeVersion, - Channel: tc.channel, - }, - ) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetDownloadLinkBaseFailure(t *testing.T) { - sut, _ := newSUT(nil) - _, err := sut.GetDownloadLinkBase(nil) - require.NotNil(t, err) -} - -func TestGetCIBuildsDownloadLinkBaseSuccess(t *testing.T) { - testcases := []struct { - name string - kubeVersion string - expected string - }{ - { - name: "CI version", - kubeVersion: "1.18.0-alpha.1.277+2099c00290d262", - expected: "https://dl.k8s.io/ci/v1.18.0-alpha.1.277+2099c00290d262", - }, - } - - sut, _ := newSUT(nil) - for _, tc := range testcases { - actual, err := sut.GetCIBuildsDownloadLinkBase( - &kubepkg.PackageDefinition{ - KubernetesVersion: tc.kubeVersion, - }, - ) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetCIBuildsDownloadLinkBaseFailure(t *testing.T) { - sut, _ := newSUT(nil) - _, err := sut.GetCIBuildsDownloadLinkBase(nil) - require.NotNil(t, err) -} - -func TestGetDefaultReleaseDownloadLinkBaseSuccess(t *testing.T) { - testcases := []struct { - name string - kubeVersion string - expected string - }{ - { - name: "Release version", - kubeVersion: "1.17.0", - expected: "https://dl.k8s.io/v1.17.0", - }, - { - name: "Pre-release version", - kubeVersion: "1.18.0-alpha.1", - expected: "https://dl.k8s.io/v1.18.0-alpha.1", - }, - } - - for _, tc := range testcases { - actual, err := kubepkg.GetDefaultReleaseDownloadLinkBase( - &kubepkg.PackageDefinition{ - KubernetesVersion: tc.kubeVersion, - }, - ) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetDefaultReleaseDownloadLinkBaseFailure(t *testing.T) { - _, err := kubepkg.GetDefaultReleaseDownloadLinkBase(nil) - require.NotNil(t, err) -} - -func TestGetDependenciesSuccess(t *testing.T) { - testcases := []struct { - name string - packageName string - expected map[string]string - }{ - { - name: "get kubelet deps", - packageName: "kubelet", - expected: map[string]string{ - "kubernetes-cni": "0.8.6", - }, - }, - { - name: "get kubeadm deps", - packageName: "kubeadm", - expected: map[string]string{ - "kubelet": "1.13.0", - "kubectl": "1.13.0", - "kubernetes-cni": "0.8.6", - "cri-tools": "1.13.0", - }, - }, - } - - for _, tc := range testcases { - actual, err := kubepkg.GetDependencies( - &kubepkg.PackageDefinition{ - Name: tc.packageName, - }, - ) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetDependenciesFailure(t *testing.T) { - _, err := kubepkg.GetDependencies(nil) - require.NotNil(t, err) -} - -func TestGetCNIDownloadLinkSuccess(t *testing.T) { - testcases := []struct { - name string - version string - arch string - expected string - }{ - { - name: "minimum CNI version", - version: "0.8.6", - arch: "amd64", - expected: "https://storage.googleapis.com/k8s-artifacts-cni/release/v0.8.6/cni-plugins-linux-amd64-v0.8.6.tgz", - }, - } - - for _, tc := range testcases { - actual, err := kubepkg.GetCNIDownloadLink(tc.version, tc.arch) - - require.Nil(t, err) - require.Equal(t, tc.expected, actual) - } -} - -func TestGetCNIDownloadLinkFailure(t *testing.T) { - _, err := kubepkg.GetCNIDownloadLink("badversion", "amd64") - require.NotNil(t, err) -} diff --git a/pkg/kubepkg/kubepkgfakes/fake_impl.go b/pkg/kubepkg/kubepkgfakes/fake_impl.go deleted file mode 100644 index 07f7f446af8..00000000000 --- a/pkg/kubepkg/kubepkgfakes/fake_impl.go +++ /dev/null @@ -1,458 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by counterfeiter. DO NOT EDIT. -package kubepkgfakes - -import ( - "io/fs" - "sync" - - "github.com/google/go-github/v53/github" - "k8s.io/release/pkg/kubepkg" - "k8s.io/release/pkg/release" -) - -type FakeImpl struct { - GetKubeVersionStub func(release.VersionType) (string, error) - getKubeVersionMutex sync.RWMutex - getKubeVersionArgsForCall []struct { - arg1 release.VersionType - } - getKubeVersionReturns struct { - result1 string - result2 error - } - getKubeVersionReturnsOnCall map[int]struct { - result1 string - result2 error - } - ReadFileStub func(string) ([]byte, error) - readFileMutex sync.RWMutex - readFileArgsForCall []struct { - arg1 string - } - readFileReturns struct { - result1 []byte - result2 error - } - readFileReturnsOnCall map[int]struct { - result1 []byte - result2 error - } - ReleasesStub func(string, string, bool) ([]*github.RepositoryRelease, error) - releasesMutex sync.RWMutex - releasesArgsForCall []struct { - arg1 string - arg2 string - arg3 bool - } - releasesReturns struct { - result1 []*github.RepositoryRelease - result2 error - } - releasesReturnsOnCall map[int]struct { - result1 []*github.RepositoryRelease - result2 error - } - RunSuccessWithWorkDirStub func(string, string, ...string) error - runSuccessWithWorkDirMutex sync.RWMutex - runSuccessWithWorkDirArgsForCall []struct { - arg1 string - arg2 string - arg3 []string - } - runSuccessWithWorkDirReturns struct { - result1 error - } - runSuccessWithWorkDirReturnsOnCall map[int]struct { - result1 error - } - WriteFileStub func(string, []byte, fs.FileMode) error - writeFileMutex sync.RWMutex - writeFileArgsForCall []struct { - arg1 string - arg2 []byte - arg3 fs.FileMode - } - writeFileReturns struct { - result1 error - } - writeFileReturnsOnCall map[int]struct { - result1 error - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *FakeImpl) GetKubeVersion(arg1 release.VersionType) (string, error) { - fake.getKubeVersionMutex.Lock() - ret, specificReturn := fake.getKubeVersionReturnsOnCall[len(fake.getKubeVersionArgsForCall)] - fake.getKubeVersionArgsForCall = append(fake.getKubeVersionArgsForCall, struct { - arg1 release.VersionType - }{arg1}) - stub := fake.GetKubeVersionStub - fakeReturns := fake.getKubeVersionReturns - fake.recordInvocation("GetKubeVersion", []interface{}{arg1}) - fake.getKubeVersionMutex.Unlock() - if stub != nil { - return stub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *FakeImpl) GetKubeVersionCallCount() int { - fake.getKubeVersionMutex.RLock() - defer fake.getKubeVersionMutex.RUnlock() - return len(fake.getKubeVersionArgsForCall) -} - -func (fake *FakeImpl) GetKubeVersionCalls(stub func(release.VersionType) (string, error)) { - fake.getKubeVersionMutex.Lock() - defer fake.getKubeVersionMutex.Unlock() - fake.GetKubeVersionStub = stub -} - -func (fake *FakeImpl) GetKubeVersionArgsForCall(i int) release.VersionType { - fake.getKubeVersionMutex.RLock() - defer fake.getKubeVersionMutex.RUnlock() - argsForCall := fake.getKubeVersionArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *FakeImpl) GetKubeVersionReturns(result1 string, result2 error) { - fake.getKubeVersionMutex.Lock() - defer fake.getKubeVersionMutex.Unlock() - fake.GetKubeVersionStub = nil - fake.getKubeVersionReturns = struct { - result1 string - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) GetKubeVersionReturnsOnCall(i int, result1 string, result2 error) { - fake.getKubeVersionMutex.Lock() - defer fake.getKubeVersionMutex.Unlock() - fake.GetKubeVersionStub = nil - if fake.getKubeVersionReturnsOnCall == nil { - fake.getKubeVersionReturnsOnCall = make(map[int]struct { - result1 string - result2 error - }) - } - fake.getKubeVersionReturnsOnCall[i] = struct { - result1 string - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) ReadFile(arg1 string) ([]byte, error) { - fake.readFileMutex.Lock() - ret, specificReturn := fake.readFileReturnsOnCall[len(fake.readFileArgsForCall)] - fake.readFileArgsForCall = append(fake.readFileArgsForCall, struct { - arg1 string - }{arg1}) - stub := fake.ReadFileStub - fakeReturns := fake.readFileReturns - fake.recordInvocation("ReadFile", []interface{}{arg1}) - fake.readFileMutex.Unlock() - if stub != nil { - return stub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *FakeImpl) ReadFileCallCount() int { - fake.readFileMutex.RLock() - defer fake.readFileMutex.RUnlock() - return len(fake.readFileArgsForCall) -} - -func (fake *FakeImpl) ReadFileCalls(stub func(string) ([]byte, error)) { - fake.readFileMutex.Lock() - defer fake.readFileMutex.Unlock() - fake.ReadFileStub = stub -} - -func (fake *FakeImpl) ReadFileArgsForCall(i int) string { - fake.readFileMutex.RLock() - defer fake.readFileMutex.RUnlock() - argsForCall := fake.readFileArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *FakeImpl) ReadFileReturns(result1 []byte, result2 error) { - fake.readFileMutex.Lock() - defer fake.readFileMutex.Unlock() - fake.ReadFileStub = nil - fake.readFileReturns = struct { - result1 []byte - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) ReadFileReturnsOnCall(i int, result1 []byte, result2 error) { - fake.readFileMutex.Lock() - defer fake.readFileMutex.Unlock() - fake.ReadFileStub = nil - if fake.readFileReturnsOnCall == nil { - fake.readFileReturnsOnCall = make(map[int]struct { - result1 []byte - result2 error - }) - } - fake.readFileReturnsOnCall[i] = struct { - result1 []byte - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) Releases(arg1 string, arg2 string, arg3 bool) ([]*github.RepositoryRelease, error) { - fake.releasesMutex.Lock() - ret, specificReturn := fake.releasesReturnsOnCall[len(fake.releasesArgsForCall)] - fake.releasesArgsForCall = append(fake.releasesArgsForCall, struct { - arg1 string - arg2 string - arg3 bool - }{arg1, arg2, arg3}) - stub := fake.ReleasesStub - fakeReturns := fake.releasesReturns - fake.recordInvocation("Releases", []interface{}{arg1, arg2, arg3}) - fake.releasesMutex.Unlock() - if stub != nil { - return stub(arg1, arg2, arg3) - } - if specificReturn { - return ret.result1, ret.result2 - } - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *FakeImpl) ReleasesCallCount() int { - fake.releasesMutex.RLock() - defer fake.releasesMutex.RUnlock() - return len(fake.releasesArgsForCall) -} - -func (fake *FakeImpl) ReleasesCalls(stub func(string, string, bool) ([]*github.RepositoryRelease, error)) { - fake.releasesMutex.Lock() - defer fake.releasesMutex.Unlock() - fake.ReleasesStub = stub -} - -func (fake *FakeImpl) ReleasesArgsForCall(i int) (string, string, bool) { - fake.releasesMutex.RLock() - defer fake.releasesMutex.RUnlock() - argsForCall := fake.releasesArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *FakeImpl) ReleasesReturns(result1 []*github.RepositoryRelease, result2 error) { - fake.releasesMutex.Lock() - defer fake.releasesMutex.Unlock() - fake.ReleasesStub = nil - fake.releasesReturns = struct { - result1 []*github.RepositoryRelease - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) ReleasesReturnsOnCall(i int, result1 []*github.RepositoryRelease, result2 error) { - fake.releasesMutex.Lock() - defer fake.releasesMutex.Unlock() - fake.ReleasesStub = nil - if fake.releasesReturnsOnCall == nil { - fake.releasesReturnsOnCall = make(map[int]struct { - result1 []*github.RepositoryRelease - result2 error - }) - } - fake.releasesReturnsOnCall[i] = struct { - result1 []*github.RepositoryRelease - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) RunSuccessWithWorkDir(arg1 string, arg2 string, arg3 ...string) error { - fake.runSuccessWithWorkDirMutex.Lock() - ret, specificReturn := fake.runSuccessWithWorkDirReturnsOnCall[len(fake.runSuccessWithWorkDirArgsForCall)] - fake.runSuccessWithWorkDirArgsForCall = append(fake.runSuccessWithWorkDirArgsForCall, struct { - arg1 string - arg2 string - arg3 []string - }{arg1, arg2, arg3}) - stub := fake.RunSuccessWithWorkDirStub - fakeReturns := fake.runSuccessWithWorkDirReturns - fake.recordInvocation("RunSuccessWithWorkDir", []interface{}{arg1, arg2, arg3}) - fake.runSuccessWithWorkDirMutex.Unlock() - if stub != nil { - return stub(arg1, arg2, arg3...) - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeImpl) RunSuccessWithWorkDirCallCount() int { - fake.runSuccessWithWorkDirMutex.RLock() - defer fake.runSuccessWithWorkDirMutex.RUnlock() - return len(fake.runSuccessWithWorkDirArgsForCall) -} - -func (fake *FakeImpl) RunSuccessWithWorkDirCalls(stub func(string, string, ...string) error) { - fake.runSuccessWithWorkDirMutex.Lock() - defer fake.runSuccessWithWorkDirMutex.Unlock() - fake.RunSuccessWithWorkDirStub = stub -} - -func (fake *FakeImpl) RunSuccessWithWorkDirArgsForCall(i int) (string, string, []string) { - fake.runSuccessWithWorkDirMutex.RLock() - defer fake.runSuccessWithWorkDirMutex.RUnlock() - argsForCall := fake.runSuccessWithWorkDirArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *FakeImpl) RunSuccessWithWorkDirReturns(result1 error) { - fake.runSuccessWithWorkDirMutex.Lock() - defer fake.runSuccessWithWorkDirMutex.Unlock() - fake.RunSuccessWithWorkDirStub = nil - fake.runSuccessWithWorkDirReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) RunSuccessWithWorkDirReturnsOnCall(i int, result1 error) { - fake.runSuccessWithWorkDirMutex.Lock() - defer fake.runSuccessWithWorkDirMutex.Unlock() - fake.RunSuccessWithWorkDirStub = nil - if fake.runSuccessWithWorkDirReturnsOnCall == nil { - fake.runSuccessWithWorkDirReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.runSuccessWithWorkDirReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) WriteFile(arg1 string, arg2 []byte, arg3 fs.FileMode) error { - var arg2Copy []byte - if arg2 != nil { - arg2Copy = make([]byte, len(arg2)) - copy(arg2Copy, arg2) - } - fake.writeFileMutex.Lock() - ret, specificReturn := fake.writeFileReturnsOnCall[len(fake.writeFileArgsForCall)] - fake.writeFileArgsForCall = append(fake.writeFileArgsForCall, struct { - arg1 string - arg2 []byte - arg3 fs.FileMode - }{arg1, arg2Copy, arg3}) - stub := fake.WriteFileStub - fakeReturns := fake.writeFileReturns - fake.recordInvocation("WriteFile", []interface{}{arg1, arg2Copy, arg3}) - fake.writeFileMutex.Unlock() - if stub != nil { - return stub(arg1, arg2, arg3) - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeImpl) WriteFileCallCount() int { - fake.writeFileMutex.RLock() - defer fake.writeFileMutex.RUnlock() - return len(fake.writeFileArgsForCall) -} - -func (fake *FakeImpl) WriteFileCalls(stub func(string, []byte, fs.FileMode) error) { - fake.writeFileMutex.Lock() - defer fake.writeFileMutex.Unlock() - fake.WriteFileStub = stub -} - -func (fake *FakeImpl) WriteFileArgsForCall(i int) (string, []byte, fs.FileMode) { - fake.writeFileMutex.RLock() - defer fake.writeFileMutex.RUnlock() - argsForCall := fake.writeFileArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *FakeImpl) WriteFileReturns(result1 error) { - fake.writeFileMutex.Lock() - defer fake.writeFileMutex.Unlock() - fake.WriteFileStub = nil - fake.writeFileReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) WriteFileReturnsOnCall(i int, result1 error) { - fake.writeFileMutex.Lock() - defer fake.writeFileMutex.Unlock() - fake.WriteFileStub = nil - if fake.writeFileReturnsOnCall == nil { - fake.writeFileReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.writeFileReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.getKubeVersionMutex.RLock() - defer fake.getKubeVersionMutex.RUnlock() - fake.readFileMutex.RLock() - defer fake.readFileMutex.RUnlock() - fake.releasesMutex.RLock() - defer fake.releasesMutex.RUnlock() - fake.runSuccessWithWorkDirMutex.RLock() - defer fake.runSuccessWithWorkDirMutex.RUnlock() - fake.writeFileMutex.RLock() - defer fake.writeFileMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *FakeImpl) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ kubepkg.Impl = new(FakeImpl) diff --git a/pkg/kubepkg/options/options.go b/pkg/kubepkg/options/options.go deleted file mode 100644 index e0e515a13cb..00000000000 --- a/pkg/kubepkg/options/options.go +++ /dev/null @@ -1,230 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package options - -import ( - "errors" - "path/filepath" - "reflect" - - "github.com/sirupsen/logrus" - - "sigs.k8s.io/release-utils/util" -) - -type Options struct { - buildType BuildType - - revision string - kubeVersion string - cniVersion string - criToolsVersion string - - packages []string - channels []string - architectures []string - - releaseDownloadLinkBase string - - templateDir string - specOnly bool -} - -type BuildType string - -const ( - BuildDeb BuildType = "deb" - BuildRpm BuildType = "rpm" - BuildAll BuildType = "all" - - DefaultReleaseDownloadLinkBase = "https://dl.k8s.io" - - defaultRevision = "0" - templateRootDir = "templates" -) - -var ( - supportedPackages = []string{ - "kubelet", "kubectl", "kubeadm", "kubernetes-cni", "cri-tools", - } - supportedChannels = []string{ - "release", "testing", "nightly", - } - supportedArchitectures = []string{ - "amd64", "arm64", "ppc64le", "s390x", - } - latestTemplateDir = filepath.Join(templateRootDir, "latest") -) - -func New() *Options { - return &Options{ - revision: defaultRevision, - packages: supportedPackages, - channels: supportedChannels, - architectures: supportedArchitectures, - releaseDownloadLinkBase: DefaultReleaseDownloadLinkBase, - templateDir: latestTemplateDir, - } -} - -func (o *Options) WithBuildType(buildType BuildType) *Options { - o.buildType = buildType - return o -} - -func (o *Options) WithRevision(revision string) *Options { - o.revision = revision - return o -} - -func (o *Options) WithKubeVersion(kubeVersion string) *Options { - o.kubeVersion = kubeVersion - return o -} - -func (o *Options) WithCNIVersion(cniVersion string) *Options { - o.cniVersion = cniVersion - return o -} - -func (o *Options) WithCRIToolsVersion(criToolsVersion string) *Options { - o.criToolsVersion = criToolsVersion - return o -} - -func (o *Options) WithPackages(packages ...string) *Options { - o.packages = packages - return o -} - -func (o *Options) WithChannels(channels ...string) *Options { - o.channels = channels - return o -} - -func (o *Options) WithArchitectures(architectures ...string) *Options { - o.architectures = architectures - return o -} - -func (o *Options) WithReleaseDownloadLinkBase(releaseDownloadLinkBase string) *Options { - o.releaseDownloadLinkBase = releaseDownloadLinkBase - return o -} - -func (o *Options) WithTemplateDir(templateDir string) *Options { - o.templateDir = templateDir - return o -} - -func (o *Options) WithSpecOnly(specOnly bool) *Options { - o.specOnly = specOnly - return o -} - -func (o *Options) BuildType() BuildType { - return o.buildType -} - -func (o *Options) Revision() string { - return o.revision -} - -func (o *Options) KubeVersion() string { - return o.kubeVersion -} - -func (o *Options) CNIVersion() string { - return o.cniVersion -} - -func (o *Options) CRIToolsVersion() string { - return o.criToolsVersion -} - -func (o *Options) Packages() []string { - return o.packages -} - -func (o *Options) Channels() []string { - return o.channels -} - -func (o *Options) Architectures() []string { - return o.architectures -} - -func (o *Options) ReleaseDownloadLinkBase() string { - return o.releaseDownloadLinkBase -} - -func (o *Options) TemplateDir() string { - return o.templateDir -} - -func (o *Options) SpecOnly() bool { - return o.specOnly -} - -// Validate verifies if all set options are valid -func (o *Options) Validate() error { - if ok := isSupported(o.packages, supportedPackages); !ok { - return errors.New("package selections are not supported") - } - if ok := isSupported(o.channels, supportedChannels); !ok { - return errors.New("channel selections are not supported") - } - if ok := isSupported(o.architectures, supportedArchitectures); !ok { - return errors.New("architectures selections are not supported") - } - - // Replace the "+" with a "-" to make it semver-compliant - o.kubeVersion = util.TrimTagPrefix(o.kubeVersion) - - return nil -} - -func isSupported(input, expected []string) bool { - notSupported := []string{} - - supported := false - for _, i := range input { - supported = false - for _, j := range expected { - if i == j { - supported = true - break - } - } - - if !supported { - logrus.Infof( - "Adding %q (type: %v) to not supported", i, reflect.TypeOf(i), - ) - notSupported = append(notSupported, i) - } - } - - if len(notSupported) > 0 { - logrus.Infof( - "The following options are not supported: %v", notSupported, - ) - return false - } - - return true -} diff --git a/pkg/kubepkg/options/options_test.go b/pkg/kubepkg/options/options_test.go deleted file mode 100644 index 6efd4867fc1..00000000000 --- a/pkg/kubepkg/options/options_test.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package options - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestOptions(t *testing.T) { - str := "test-string" - slice := []string{str, str, str} - - sut := New() - - require.Equal(t, BuildDeb, sut.WithBuildType(BuildDeb).BuildType()) - require.Equal(t, str, sut.WithRevision(str).Revision()) - require.Equal(t, str, sut.WithKubeVersion(str).KubeVersion()) - require.Equal(t, str, sut.WithCNIVersion(str).CNIVersion()) - require.Equal(t, str, sut.WithCRIToolsVersion(str).CRIToolsVersion()) - require.Equal(t, slice, sut.WithPackages(slice...).Packages()) - require.Equal(t, slice, sut.WithChannels(slice...).Channels()) - require.Equal(t, slice, sut.WithArchitectures(slice...).Architectures()) - require.Equal(t, str, sut.WithReleaseDownloadLinkBase(str).ReleaseDownloadLinkBase()) - require.Equal(t, str, sut.WithTemplateDir(str).TemplateDir()) - require.Equal(t, true, sut.WithSpecOnly(true).SpecOnly()) -} - -func TestValidateSuccess(t *testing.T) { - require.Nil(t, New().Validate()) -} - -func TestValidateFailureWrongPackage(t *testing.T) { - require.NotNil(t, New().WithPackages("wrong").Validate()) -} - -func TestValidateFailureWrongChannel(t *testing.T) { - require.NotNil(t, New().WithChannels("wrong").Validate()) -} - -func TestValidateFailureWrongArchitecture(t *testing.T) { - require.NotNil(t, New().WithArchitectures("wrong").Validate()) -} - -func TestIsSupportedSuccess(t *testing.T) { - testcases := []struct { - name string - input []string - check []string - expected bool - }{ - { - name: "single input", - input: []string{ - "kubelet", - }, - check: supportedPackages, - expected: true, - }, - { - name: "multiple inputs", - input: []string{ - "release", - "testing", - }, - check: supportedChannels, - expected: true, - }, - { - name: "no inputs", - input: []string{}, - check: supportedArchitectures, - expected: true, - }, - } - - for _, tc := range testcases { - actual := isSupported(tc.input, tc.check) - - require.Equal(t, tc.expected, actual) - } -} - -func TestIsSupportedFailure(t *testing.T) { - testcases := []struct { - name string - input []string - check []string - expected bool - }{ - { - name: "some supported, some unsupported", - input: []string{ - "fakearch", - "amd64", - }, - check: supportedArchitectures, - expected: true, - }, - } - - for _, tc := range testcases { - actual := isSupported(tc.input, tc.check) - - require.NotEqual(t, tc.expected, actual) - } -} diff --git a/pkg/kubepkg/template.go b/pkg/kubepkg/template.go deleted file mode 100644 index dd252e47f5e..00000000000 --- a/pkg/kubepkg/template.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kubepkg - -import ( - "bytes" - "fmt" - "os" - "path/filepath" - "text/template" - - "github.com/sirupsen/logrus" -) - -type work struct { - src string - dst string - t *template.Template - info os.FileInfo -} - -func buildSpecs(bc *buildConfig, specDir string) (workItems []work, err error) { - if err := filepath.Walk(bc.TemplateDir, func(templateFile string, f os.FileInfo, err error) error { - if err != nil { - return err - } - specFile := filepath.Join(specDir, templateFile[len(bc.TemplateDir):]) - if specFile == specDir { - return nil - } - if f.IsDir() { - return os.Mkdir(specFile, f.Mode()) - } - t, err := template. - New(""). - Funcs(builtins). - Option("missingkey=error"). - ParseFiles(templateFile) - if err != nil { - return err - } - workItems = append(workItems, work{ - src: templateFile, - dst: specFile, - t: t.Templates()[0], - info: f, - }) - - return nil - }); err != nil { - return nil, err - } - - for _, item := range workItems { - buf := bytes.Buffer{} - if err := item.t.Execute(&buf, bc); err != nil { - return nil, fmt.Errorf("executing template for %s: %w", item.src, err) - } - - if err := os.WriteFile( - item.dst, buf.Bytes(), item.info.Mode(), - ); err != nil { - return nil, fmt.Errorf("writing file %s: %w", item.dst, err) - } - } - - logrus.Info("Package specs have successfully been built") - - return workItems, nil -} diff --git a/pkg/packages/impl.go b/pkg/packages/impl.go deleted file mode 100644 index 44cf3c7aaf8..00000000000 --- a/pkg/packages/impl.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package packages - -import ( - "os" - - "github.com/blang/semver/v4" - "sigs.k8s.io/release-sdk/object" - "sigs.k8s.io/release-utils/command" - "sigs.k8s.io/release-utils/util" -) - -type defaultImpl struct{} - -//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate -//counterfeiter:generate . impl -//go:generate /usr/bin/env bash -c "cat ../../hack/boilerplate/boilerplate.generatego.txt packagesfakes/fake_impl.go > packagesfakes/_fake_impl.go && mv packagesfakes/_fake_impl.go packagesfakes/fake_impl.go" -type impl interface { - Getwd() (string, error) - Chdir(string) error - TagStringToSemver(string) (semver.Version, error) - RunCommand(string, ...string) error - NormalizePath(*object.GCS, ...string) (string, error) - CopyToRemote(*object.GCS, string, string) error -} - -func (*defaultImpl) Getwd() (dir string, err error) { - return os.Getwd() -} - -func (*defaultImpl) Chdir(dir string) error { - return os.Chdir(dir) -} - -func (*defaultImpl) TagStringToSemver(version string) (semver.Version, error) { - return util.TagStringToSemver(version) -} - -func (*defaultImpl) RunCommand(cmd string, args ...string) error { - return command.New(cmd, args...).RunSuccess() -} - -func (*defaultImpl) NormalizePath(store *object.GCS, parts ...string) (string, error) { - return store.NormalizePath(parts...) -} - -func (*defaultImpl) CopyToRemote(store *object.GCS, src, dst string) error { - return store.CopyToRemote(src, dst) -} diff --git a/pkg/packages/packages.go b/pkg/packages/packages.go deleted file mode 100644 index f1ecf778199..00000000000 --- a/pkg/packages/packages.go +++ /dev/null @@ -1,130 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package packages - -import ( - "fmt" - "sort" - "strings" - - "github.com/sirupsen/logrus" - "sigs.k8s.io/release-sdk/object" - - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/release/pkg/release" -) - -type Packages struct { - impl impl - version string -} - -func New(version string) *Packages { - return &Packages{ - impl: &defaultImpl{}, - version: version, - } -} - -// SetImpl can be used to set the internal implementation, which is mainly used -// for testing. -func (p *Packages) SetImpl(impl impl) { - p.impl = impl -} - -const ( - // gitRoot is the root directory of the k/release repository. - // We only require this for the script Invocation and should be removed - // together with rapture. - gitRootPath = "/workspace/go/src/k8s.io/release" - - // scriptPath is the relative path from the gitRoo to the rapture script. - scriptPath = "./hack/rapture/build-packages.sh" - - // debPath is the path for the deb package results. - debPath = gitRootPath + "/packages/deb/bin" - - // rpmPath is the path for the rpm package results. - rpmPath = gitRootPath + "/packages/rpm/output" -) - -// Build creates the packages. -func (p *Packages) Build() error { - logrus.Infof("Building packages will be done in `Release`, " + - "because rapture relies on available remote resources ") - return nil -} - -// Release pushes the packages to their final destination. -func (p *Packages) Release() error { - logrus.Infof("Building and releasing packages for %s", p.version) - wd, err := p.impl.Getwd() - if err != nil { - return fmt.Errorf("get current working dir: %w", err) - } - defer func() { - if err := p.impl.Chdir(wd); err != nil { - logrus.Errorf("Unable to restore current working directory: %v", err) - } - }() - if err := p.impl.Chdir(gitRootPath); err != nil { - return fmt.Errorf("switch to k/release git root: %w", err) - } - - semverVersion, err := p.impl.TagStringToSemver(p.version) - if err != nil { - return fmt.Errorf(" parse semver version %s: %w", p.version, err) - } - - // We dropped support for the arm architecture in Kubernetes v1.27: - // https://github.com/kubernetes/kubernetes/pull/115742 - // - // Means we have to add this workaround for currently supported release branches. - // TODO(saschagrunert): Remove when v1.26 goes end of life (planned 2024-02-28) - architectures := sets.New("amd64", "arm", "arm64", "ppc64le", "s390x") - const droppedArmInMinor = 27 - if semverVersion.Minor >= droppedArmInMinor { - logrus.Info("Removing arm architecture from default set") - architectures.Delete("arm") - } - archList := architectures.UnsortedList() - sort.Strings(archList) - - if err := p.impl.RunCommand( - scriptPath, semverVersion.String(), strings.Join(archList, ","), - ); err != nil { - return fmt.Errorf("run rapture: %w", err) - } - - store := object.NewGCS() - store.SetOptions(store.WithNoClobber(false)) - gcsRootPath, err := p.impl.NormalizePath( - store, release.ProductionBucket, "release", p.version, - ) - if err != nil { - return fmt.Errorf("normalize GCS path: %w", err) - } - if err := p.impl.CopyToRemote(store, debPath, gcsRootPath+"/deb"); err != nil { - return fmt.Errorf("copy deb packages to GCS: %w", err) - } - if err := p.impl.CopyToRemote(store, rpmPath, gcsRootPath+"/rpm"); err != nil { - return fmt.Errorf("copy rpm packages to GCS: %w", err) - } - - logrus.Infof("Done building and releasing packages to %q and %q", debPath, rpmPath) - return nil -} diff --git a/pkg/packages/packages_test.go b/pkg/packages/packages_test.go deleted file mode 100644 index 373ed95bb9e..00000000000 --- a/pkg/packages/packages_test.go +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright 2022 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package packages_test - -import ( - "errors" - "io" - "testing" - - "github.com/blang/semver/v4" - "github.com/sirupsen/logrus" - "github.com/stretchr/testify/require" - "k8s.io/release/pkg/packages" - "k8s.io/release/pkg/packages/packagesfakes" -) - -var errTest = errors.New("") - -func TestRelease(t *testing.T) { - t.Parallel() - logrus.SetOutput(io.Discard) - - for _, tc := range []struct { - name string - prepare func(*packagesfakes.FakeImpl) - assert func(error) - }{ - { - name: "success", - prepare: func(mock *packagesfakes.FakeImpl) {}, - assert: func(err error) { require.Nil(t, err) }, - }, - { - name: "success, but failure on Chdir restore", - prepare: func(mock *packagesfakes.FakeImpl) { - mock.ChdirReturnsOnCall(1, errTest) - }, - assert: func(err error) { require.Nil(t, err) }, - }, - { - name: "failure on Getwd", - prepare: func(mock *packagesfakes.FakeImpl) { - mock.GetwdReturns("", errTest) - }, - assert: func(err error) { require.NotNil(t, err) }, - }, - { - name: "failure on Chdir", - prepare: func(mock *packagesfakes.FakeImpl) { - mock.ChdirReturns(errTest) - }, - assert: func(err error) { require.NotNil(t, err) }, - }, - { - name: "failure on TagStringToSemver", - prepare: func(mock *packagesfakes.FakeImpl) { - mock.TagStringToSemverReturns(semver.Version{}, errTest) - }, - assert: func(err error) { require.NotNil(t, err) }, - }, - - { - name: "failure on RunCommand", - prepare: func(mock *packagesfakes.FakeImpl) { - mock.RunCommandReturns(errTest) - }, - assert: func(err error) { require.NotNil(t, err) }, - }, - { - name: "failure on NormalizePath", - prepare: func(mock *packagesfakes.FakeImpl) { - mock.NormalizePathReturns("", errTest) - }, - assert: func(err error) { require.NotNil(t, err) }, - }, - { - name: "failure on CopyToRemote 0", - prepare: func(mock *packagesfakes.FakeImpl) { - mock.CopyToRemoteReturnsOnCall(0, errTest) - }, - assert: func(err error) { require.NotNil(t, err) }, - }, - { - name: "failure on CopyToRemote 1", - prepare: func(mock *packagesfakes.FakeImpl) { - mock.CopyToRemoteReturnsOnCall(1, errTest) - }, - assert: func(err error) { require.NotNil(t, err) }, - }, - } { - t.Run(tc.name, func(t *testing.T) { - tc := tc - - t.Parallel() - - mock := &packagesfakes.FakeImpl{} - tc.prepare(mock) - - sut := packages.New("v0.0.0") - sut.SetImpl(mock) - - err := sut.Release() - tc.assert(err) - }) - } -} diff --git a/pkg/packages/packagesfakes/fake_impl.go b/pkg/packages/packagesfakes/fake_impl.go deleted file mode 100644 index d229e195491..00000000000 --- a/pkg/packages/packagesfakes/fake_impl.go +++ /dev/null @@ -1,510 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by counterfeiter. DO NOT EDIT. -package packagesfakes - -import ( - "sync" - - semver "github.com/blang/semver/v4" - "sigs.k8s.io/release-sdk/object" -) - -type FakeImpl struct { - ChdirStub func(string) error - chdirMutex sync.RWMutex - chdirArgsForCall []struct { - arg1 string - } - chdirReturns struct { - result1 error - } - chdirReturnsOnCall map[int]struct { - result1 error - } - CopyToRemoteStub func(*object.GCS, string, string) error - copyToRemoteMutex sync.RWMutex - copyToRemoteArgsForCall []struct { - arg1 *object.GCS - arg2 string - arg3 string - } - copyToRemoteReturns struct { - result1 error - } - copyToRemoteReturnsOnCall map[int]struct { - result1 error - } - GetwdStub func() (string, error) - getwdMutex sync.RWMutex - getwdArgsForCall []struct { - } - getwdReturns struct { - result1 string - result2 error - } - getwdReturnsOnCall map[int]struct { - result1 string - result2 error - } - NormalizePathStub func(*object.GCS, ...string) (string, error) - normalizePathMutex sync.RWMutex - normalizePathArgsForCall []struct { - arg1 *object.GCS - arg2 []string - } - normalizePathReturns struct { - result1 string - result2 error - } - normalizePathReturnsOnCall map[int]struct { - result1 string - result2 error - } - RunCommandStub func(string, ...string) error - runCommandMutex sync.RWMutex - runCommandArgsForCall []struct { - arg1 string - arg2 []string - } - runCommandReturns struct { - result1 error - } - runCommandReturnsOnCall map[int]struct { - result1 error - } - TagStringToSemverStub func(string) (semver.Version, error) - tagStringToSemverMutex sync.RWMutex - tagStringToSemverArgsForCall []struct { - arg1 string - } - tagStringToSemverReturns struct { - result1 semver.Version - result2 error - } - tagStringToSemverReturnsOnCall map[int]struct { - result1 semver.Version - result2 error - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *FakeImpl) Chdir(arg1 string) error { - fake.chdirMutex.Lock() - ret, specificReturn := fake.chdirReturnsOnCall[len(fake.chdirArgsForCall)] - fake.chdirArgsForCall = append(fake.chdirArgsForCall, struct { - arg1 string - }{arg1}) - stub := fake.ChdirStub - fakeReturns := fake.chdirReturns - fake.recordInvocation("Chdir", []interface{}{arg1}) - fake.chdirMutex.Unlock() - if stub != nil { - return stub(arg1) - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeImpl) ChdirCallCount() int { - fake.chdirMutex.RLock() - defer fake.chdirMutex.RUnlock() - return len(fake.chdirArgsForCall) -} - -func (fake *FakeImpl) ChdirCalls(stub func(string) error) { - fake.chdirMutex.Lock() - defer fake.chdirMutex.Unlock() - fake.ChdirStub = stub -} - -func (fake *FakeImpl) ChdirArgsForCall(i int) string { - fake.chdirMutex.RLock() - defer fake.chdirMutex.RUnlock() - argsForCall := fake.chdirArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *FakeImpl) ChdirReturns(result1 error) { - fake.chdirMutex.Lock() - defer fake.chdirMutex.Unlock() - fake.ChdirStub = nil - fake.chdirReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) ChdirReturnsOnCall(i int, result1 error) { - fake.chdirMutex.Lock() - defer fake.chdirMutex.Unlock() - fake.ChdirStub = nil - if fake.chdirReturnsOnCall == nil { - fake.chdirReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.chdirReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) CopyToRemote(arg1 *object.GCS, arg2 string, arg3 string) error { - fake.copyToRemoteMutex.Lock() - ret, specificReturn := fake.copyToRemoteReturnsOnCall[len(fake.copyToRemoteArgsForCall)] - fake.copyToRemoteArgsForCall = append(fake.copyToRemoteArgsForCall, struct { - arg1 *object.GCS - arg2 string - arg3 string - }{arg1, arg2, arg3}) - stub := fake.CopyToRemoteStub - fakeReturns := fake.copyToRemoteReturns - fake.recordInvocation("CopyToRemote", []interface{}{arg1, arg2, arg3}) - fake.copyToRemoteMutex.Unlock() - if stub != nil { - return stub(arg1, arg2, arg3) - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeImpl) CopyToRemoteCallCount() int { - fake.copyToRemoteMutex.RLock() - defer fake.copyToRemoteMutex.RUnlock() - return len(fake.copyToRemoteArgsForCall) -} - -func (fake *FakeImpl) CopyToRemoteCalls(stub func(*object.GCS, string, string) error) { - fake.copyToRemoteMutex.Lock() - defer fake.copyToRemoteMutex.Unlock() - fake.CopyToRemoteStub = stub -} - -func (fake *FakeImpl) CopyToRemoteArgsForCall(i int) (*object.GCS, string, string) { - fake.copyToRemoteMutex.RLock() - defer fake.copyToRemoteMutex.RUnlock() - argsForCall := fake.copyToRemoteArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 -} - -func (fake *FakeImpl) CopyToRemoteReturns(result1 error) { - fake.copyToRemoteMutex.Lock() - defer fake.copyToRemoteMutex.Unlock() - fake.CopyToRemoteStub = nil - fake.copyToRemoteReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) CopyToRemoteReturnsOnCall(i int, result1 error) { - fake.copyToRemoteMutex.Lock() - defer fake.copyToRemoteMutex.Unlock() - fake.CopyToRemoteStub = nil - if fake.copyToRemoteReturnsOnCall == nil { - fake.copyToRemoteReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.copyToRemoteReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) Getwd() (string, error) { - fake.getwdMutex.Lock() - ret, specificReturn := fake.getwdReturnsOnCall[len(fake.getwdArgsForCall)] - fake.getwdArgsForCall = append(fake.getwdArgsForCall, struct { - }{}) - stub := fake.GetwdStub - fakeReturns := fake.getwdReturns - fake.recordInvocation("Getwd", []interface{}{}) - fake.getwdMutex.Unlock() - if stub != nil { - return stub() - } - if specificReturn { - return ret.result1, ret.result2 - } - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *FakeImpl) GetwdCallCount() int { - fake.getwdMutex.RLock() - defer fake.getwdMutex.RUnlock() - return len(fake.getwdArgsForCall) -} - -func (fake *FakeImpl) GetwdCalls(stub func() (string, error)) { - fake.getwdMutex.Lock() - defer fake.getwdMutex.Unlock() - fake.GetwdStub = stub -} - -func (fake *FakeImpl) GetwdReturns(result1 string, result2 error) { - fake.getwdMutex.Lock() - defer fake.getwdMutex.Unlock() - fake.GetwdStub = nil - fake.getwdReturns = struct { - result1 string - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) GetwdReturnsOnCall(i int, result1 string, result2 error) { - fake.getwdMutex.Lock() - defer fake.getwdMutex.Unlock() - fake.GetwdStub = nil - if fake.getwdReturnsOnCall == nil { - fake.getwdReturnsOnCall = make(map[int]struct { - result1 string - result2 error - }) - } - fake.getwdReturnsOnCall[i] = struct { - result1 string - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) NormalizePath(arg1 *object.GCS, arg2 ...string) (string, error) { - fake.normalizePathMutex.Lock() - ret, specificReturn := fake.normalizePathReturnsOnCall[len(fake.normalizePathArgsForCall)] - fake.normalizePathArgsForCall = append(fake.normalizePathArgsForCall, struct { - arg1 *object.GCS - arg2 []string - }{arg1, arg2}) - stub := fake.NormalizePathStub - fakeReturns := fake.normalizePathReturns - fake.recordInvocation("NormalizePath", []interface{}{arg1, arg2}) - fake.normalizePathMutex.Unlock() - if stub != nil { - return stub(arg1, arg2...) - } - if specificReturn { - return ret.result1, ret.result2 - } - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *FakeImpl) NormalizePathCallCount() int { - fake.normalizePathMutex.RLock() - defer fake.normalizePathMutex.RUnlock() - return len(fake.normalizePathArgsForCall) -} - -func (fake *FakeImpl) NormalizePathCalls(stub func(*object.GCS, ...string) (string, error)) { - fake.normalizePathMutex.Lock() - defer fake.normalizePathMutex.Unlock() - fake.NormalizePathStub = stub -} - -func (fake *FakeImpl) NormalizePathArgsForCall(i int) (*object.GCS, []string) { - fake.normalizePathMutex.RLock() - defer fake.normalizePathMutex.RUnlock() - argsForCall := fake.normalizePathArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *FakeImpl) NormalizePathReturns(result1 string, result2 error) { - fake.normalizePathMutex.Lock() - defer fake.normalizePathMutex.Unlock() - fake.NormalizePathStub = nil - fake.normalizePathReturns = struct { - result1 string - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) NormalizePathReturnsOnCall(i int, result1 string, result2 error) { - fake.normalizePathMutex.Lock() - defer fake.normalizePathMutex.Unlock() - fake.NormalizePathStub = nil - if fake.normalizePathReturnsOnCall == nil { - fake.normalizePathReturnsOnCall = make(map[int]struct { - result1 string - result2 error - }) - } - fake.normalizePathReturnsOnCall[i] = struct { - result1 string - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) RunCommand(arg1 string, arg2 ...string) error { - fake.runCommandMutex.Lock() - ret, specificReturn := fake.runCommandReturnsOnCall[len(fake.runCommandArgsForCall)] - fake.runCommandArgsForCall = append(fake.runCommandArgsForCall, struct { - arg1 string - arg2 []string - }{arg1, arg2}) - stub := fake.RunCommandStub - fakeReturns := fake.runCommandReturns - fake.recordInvocation("RunCommand", []interface{}{arg1, arg2}) - fake.runCommandMutex.Unlock() - if stub != nil { - return stub(arg1, arg2...) - } - if specificReturn { - return ret.result1 - } - return fakeReturns.result1 -} - -func (fake *FakeImpl) RunCommandCallCount() int { - fake.runCommandMutex.RLock() - defer fake.runCommandMutex.RUnlock() - return len(fake.runCommandArgsForCall) -} - -func (fake *FakeImpl) RunCommandCalls(stub func(string, ...string) error) { - fake.runCommandMutex.Lock() - defer fake.runCommandMutex.Unlock() - fake.RunCommandStub = stub -} - -func (fake *FakeImpl) RunCommandArgsForCall(i int) (string, []string) { - fake.runCommandMutex.RLock() - defer fake.runCommandMutex.RUnlock() - argsForCall := fake.runCommandArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 -} - -func (fake *FakeImpl) RunCommandReturns(result1 error) { - fake.runCommandMutex.Lock() - defer fake.runCommandMutex.Unlock() - fake.RunCommandStub = nil - fake.runCommandReturns = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) RunCommandReturnsOnCall(i int, result1 error) { - fake.runCommandMutex.Lock() - defer fake.runCommandMutex.Unlock() - fake.RunCommandStub = nil - if fake.runCommandReturnsOnCall == nil { - fake.runCommandReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.runCommandReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakeImpl) TagStringToSemver(arg1 string) (semver.Version, error) { - fake.tagStringToSemverMutex.Lock() - ret, specificReturn := fake.tagStringToSemverReturnsOnCall[len(fake.tagStringToSemverArgsForCall)] - fake.tagStringToSemverArgsForCall = append(fake.tagStringToSemverArgsForCall, struct { - arg1 string - }{arg1}) - stub := fake.TagStringToSemverStub - fakeReturns := fake.tagStringToSemverReturns - fake.recordInvocation("TagStringToSemver", []interface{}{arg1}) - fake.tagStringToSemverMutex.Unlock() - if stub != nil { - return stub(arg1) - } - if specificReturn { - return ret.result1, ret.result2 - } - return fakeReturns.result1, fakeReturns.result2 -} - -func (fake *FakeImpl) TagStringToSemverCallCount() int { - fake.tagStringToSemverMutex.RLock() - defer fake.tagStringToSemverMutex.RUnlock() - return len(fake.tagStringToSemverArgsForCall) -} - -func (fake *FakeImpl) TagStringToSemverCalls(stub func(string) (semver.Version, error)) { - fake.tagStringToSemverMutex.Lock() - defer fake.tagStringToSemverMutex.Unlock() - fake.TagStringToSemverStub = stub -} - -func (fake *FakeImpl) TagStringToSemverArgsForCall(i int) string { - fake.tagStringToSemverMutex.RLock() - defer fake.tagStringToSemverMutex.RUnlock() - argsForCall := fake.tagStringToSemverArgsForCall[i] - return argsForCall.arg1 -} - -func (fake *FakeImpl) TagStringToSemverReturns(result1 semver.Version, result2 error) { - fake.tagStringToSemverMutex.Lock() - defer fake.tagStringToSemverMutex.Unlock() - fake.TagStringToSemverStub = nil - fake.tagStringToSemverReturns = struct { - result1 semver.Version - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) TagStringToSemverReturnsOnCall(i int, result1 semver.Version, result2 error) { - fake.tagStringToSemverMutex.Lock() - defer fake.tagStringToSemverMutex.Unlock() - fake.TagStringToSemverStub = nil - if fake.tagStringToSemverReturnsOnCall == nil { - fake.tagStringToSemverReturnsOnCall = make(map[int]struct { - result1 semver.Version - result2 error - }) - } - fake.tagStringToSemverReturnsOnCall[i] = struct { - result1 semver.Version - result2 error - }{result1, result2} -} - -func (fake *FakeImpl) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.chdirMutex.RLock() - defer fake.chdirMutex.RUnlock() - fake.copyToRemoteMutex.RLock() - defer fake.copyToRemoteMutex.RUnlock() - fake.getwdMutex.RLock() - defer fake.getwdMutex.RUnlock() - fake.normalizePathMutex.RLock() - defer fake.normalizePathMutex.RUnlock() - fake.runCommandMutex.RLock() - defer fake.runCommandMutex.RUnlock() - fake.tagStringToSemverMutex.RLock() - defer fake.tagStringToSemverMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *FakeImpl) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -}