diff --git a/.gitignore b/.gitignore index 4e3c8b291..7ad6f2bfe 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ _artifacts # macOS Desktop Service Store files .DS_Store + +# bundles +byoh-ingredients-download \ No newline at end of file diff --git a/README.md b/README.md index 70a1bf2c5..a7b55843a 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ management. __BYOH__ is a Cluster API Infrastructure Provider for already-provisioned hosts running Linux. This provider allows operators to adopt Cluster API for deploying and managing kubernetes nodes without also having to adopt a specific infrastructure service. This enables users to decouple kubernetes node provisioning from host and infrastructure provisioning. ## BYOH Glossary + **Host** - A host is a running computer system. It could be physical or virtual. It has a kernel and some base operating system **BYO Host** - A Linux host provisioned and managed outside of Cluster API @@ -47,7 +48,8 @@ __BYOH__ is a Cluster API Infrastructure Provider for already-provisioned hosts - Support already provisioned Linux VMs with Ubuntu 20.04 or 22.04 ## Getting Started -Check out the [getting_started](https://github.com/thegnoucommunity/cluster-api-provider-bringyourownhost/blob/main/docs/getting_started.md) guide for launching a BYOH workload cluster + +Check out the [getting started](https://github.com/thegnoucommunity/cluster-api-provider-bringyourownhost/blob/main/docs/getting_started.md) guide for launching a BYOH workload cluster. ## Community, discussion, contribution, and support @@ -57,7 +59,7 @@ If you have questions or want to get the latest project news, you can connect wi - Chat with us on the Kubernetes [Slack](http://slack.k8s.io/) in the [#cluster-api](https://kubernetes.slack.com/archives/C8TSNPY4T) channel - Subscribe to the [SIG Cluster Lifecycle](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle) Google Group for access to documents and calendars - Join our Cluster API Provider for BringYourOwnHost working group sessions where we share the latest project news, demos, answer questions, and triage issues - - Weekly on Wednesdays @ 1:30PM Indian Standard Time on [Zoom](https://VMware.zoom.us/j/94476574480?pwd=WGYzOXBoL1VsVnBXK3c5TWd1bG5SZz09) - [convert to your timezone](https://dateful.com/time-zone-converter?t=13:30&tz=IST) + - Weekly on Wednesdays @ 1:30PM Indian Standard Time on [Zoom](https://VMware.zoom.us/j/94476574480?pwd=WGYzOXBoL1VsVnBXK3c5TWd1bG5SZz09) - [Convert to your timezone](https://dateful.com/time-zone-converter?t=13:30&tz=IST) - Previous meetings: \[ [notes](https://docs.google.com/document/d/1T-3_eskC_HCtXLh3PA8y--mgO-AIajZfevcnYuno6JM/edit#heading=h.y186zgz0eh6e) | [recordings](https://www.youtube.com/playlist?list=PLHbHoGHbooH41L5P-tIK6QqhILdEI9yBK) \] Pull Requests and feedback on issues are very welcome! @@ -81,6 +83,7 @@ Check out the [developer guide](./docs/local_dev.md) for launching a BYOH cluste More about development and contributing practices can be found in [`CONTRIBUTING.md`](./CONTRIBUTING.md). ## Implement Custom Installer controller + An installer controller is responsible to provide the installation and uninstallation scripts for k8s dependencies, prerequisites and components on each `BYOHost`. If someone wants to implement their own installer controller then they need to follow the contract defined in [installer](./docs/installer.md) doc. @@ -91,10 +94,11 @@ If someone wants to implement their own installer controller then they need to f - BYOH is currently compatible wth Cluster API v1beta1 (v1.0) ## Supported OS and Kubernetes versions -| Operating System | Architecture | Kubernetes v1.24.* | Kubernetes v1.25.* | Kubernetes v1.26.* | -| ------------------|---------------|:------------------:|:------------------:|:------------------:| -| Ubuntu 20.04.* | amd64 | ✓ | ✓ | ✓ | -| Ubuntu 22.04.* | amd64 | ✓ | ✓ | ✓ | + +| Operating System | Architecture | Kubernetes v1.24.* | Kubernetes v1.25.* | Kubernetes v1.26.* | Kubernetes v1.29.* | +| ------------------|---------------|:------------------:|:------------------:|:------------------:|:------------------:| +| Ubuntu 20.04.* | amd64 | ✓ | ✓ | ✓ | | +| Ubuntu 22.04.* | amd64 | | | | ✓ | **NOTE:** The '*' in OS means that all Ubuntu 20.04 patches are supported. diff --git a/docs/local_dev.md b/docs/local_dev.md index 83f12af01..cb71fabfa 100644 --- a/docs/local_dev.md +++ b/docs/local_dev.md @@ -267,17 +267,39 @@ sudo apt-get install socat ebtables ethtool conntrack ``` ## Creating a BYOH Bundle -### Kubernetes Ingredients -Optional. This step describes downloading kubernetes host components for Debian. + +This step describes downloading kubernetes host components for various distribution (Debian/Ubuntu). +The specified below BYOH Bundle name must match one of the [Supported OS and kubernetes BYOH bundle names](##supported-OS-and-kubernetes) + +### Ubuntu 20.04 + +#### Kubernetes Ingredients + +Build docker image + ```shell -# Build docker image -(cd installer/bundle_builder/ingredients/deb/ && docker build -t byoh-ingredients-deb .) +(cd installer/bundle_builder/ubuntu && \ + docker build --build-arg BASE_IMAGE=ubuntu:20.04 \ + -t byoh-ingredients-ubuntu:20.04 \ + -f Dockerfile.downloader \ + -t byoh-ingredients-ubuntu-20.04 \ + 20.04/x86-64/k8s/ingredients) +``` -# Create a directory for the ingredients and download to it -(mkdir -p byoh-ingredients-download && docker run --rm -v `pwd`/byoh-ingredients-download:/ingredients byoh-ingredients-deb) +Create a directory for the ingredients and download to it + +```shell +(rm -rf byoh-ingredients-download/ && \ + mkdir byoh-ingredients-download && \ + docker run --rm \ + -v `pwd`/byoh-ingredients-download:/ingredients \ + byoh-ingredients-ubuntu-20.04) ``` -### Custom Ingredients + +#### Custom Ingredients + This step describes providing custom kubernetes host components. They can be copied to `byoh-ingredients-download`. Files must match the following globs: + ```shell *containerd*.tar *kubeadm*.deb @@ -287,25 +309,106 @@ This step describes providing custom kubernetes host components. They can be cop *kubernetes-cni*.deb ``` -## Building a BYOH Bundle +#### Building a BYOH Bundle + +Build docker image + +```shell +(cd installer/bundle_builder/ubuntu && \ + docker build --build-arg BASE_IMAGE=ubuntu:20.04 \ + -t byoh-build-push-bundle-ubuntu-20.04 \ + -f Dockerfile.builder \ + 20.04/x86-64/k8s) +``` + +Build a BYOH bundle and publish it to an OCI-compliant repo + +```shell +docker run --rm \ + -v `pwd`/byoh-ingredients-download:/ingredients \ + -e BUILD_ONLY=0 \ + byoh-build-push-bundle-ubuntu-20.04 docker.io/thegnoucommunity/cluster-api-byoh-bundle:ubuntu_20.04.1_x86-64_k8s-vx.y.z +``` + +### Ubuntu 22.04 + +#### Kubernetes Ingredients + +Build docker image + +```shell +(cd installer/bundle_builder/ubuntu && \ + docker build --build-arg BASE_IMAGE=ubuntu:22.04 \ + -t byoh-ingredients-ubuntu-22.04 \ + -f Dockerfile.downloader \ + 22.04/x86-64/k8s/ingredients) + +# Create a directory for the ingredients and download to it +(rm -rf byoh-ingredients-download/ && \ + mkdir byoh-ingredients-download && \ + docker run --rm \ + -v `pwd`/byoh-ingredients-download:/ingredients \ + -e KUBERNETES_MAJOR_VERSION=1.29 \ + -e KUBERNETES_VERSION=1.29.4-2.1 \ + -e KUBERNETES_CNI_VERSION=1.3.0-1.1 \ + -e CRI_TOOLS_VERSION=1.29.0-1.1 \ + -e CONTAINERD_VERSION=1.6.31-1 \ + byoh-ingredients-ubuntu-22.04) +``` + +#### Custom Ingredients + +This step describes providing custom kubernetes host components. They can be copied to `byoh-ingredients-download`. Files must match the following globs: +```shell +*containerd.io*.deb +*kubeadm*.deb +*kubelet*.deb +*kubectl*.deb +*cri-tools*.deb +*kubernetes-cni*.deb +``` + +#### Building a BYOH Bundle + +Build docker image + ```shell -#Build docker image -(cd installer/bundle_builder/ && docker build -t byoh-build-push-bundle .) +(cd installer/bundle_builder/ubuntu && \ + docker build --build-arg BASE_IMAGE=ubuntu:22.04 \ + -t byoh-build-push-bundle-ubuntu-22.04 \ + -f Dockerfile.builder \ + 22.04/x86-64/k8s) ``` +Build a BYOH bundle and publish it to an OCI-compliant repo + ```shell -# Build a BYOH bundle and publish it to an OCI-compliant repo -docker run --rm -v `pwd`/byoh-ingredients-download:/ingredients --env BUILD_ONLY=0 byoh-build-push-bundle / +docker run --rm \ + -v `pwd`/byoh-ingredients-download:/ingredients \ + -e BUILD_ONLY=0 \ + byoh-build-push-bundle-ubuntu-22.04 ubuntu_22.04_x86-64_k8s-vx.y.z docker.io/thegnoucommunity/cluster-api-byoh-bundle ``` -The specified above BYOH Bundle name must match one of the [Supported OS and kubernetes BYOH bundle names](##supported-OS-and-kubernetes) +### Other options + +You can also build a tarball of the bundle without publishing. This will create a bundler.tar in the current directory and can be used for custom pushing ```shell -# You can also build a tarball of the bundle without publishing. This will create a bundler.tar in the current directory and can be used for custom pushing -docker run --rm -v `pwd`/byoh-ingredients-download:/ingredients -v`pwd`:/bundle --env BUILD_ONLY=1 byoh-build-push-bundle +docker run --rm \ + -v `pwd`/byoh-ingredients-download:/ingredients \ + -v`pwd`:/bundle \ + -e BUILD_ONLY=1 \ + byoh-build-push-bundle ``` +Optionally, additional configuration can be included in the bundle by mounting a local path under /config of the container. +It will be placed on top of any drop-in configuration created by the packages and tars in the bundle + ```shell -# Optionally, additional configuration can be included in the bundle by mounting a local path under /config of the container. It will be placed on top of any drop-in configuration created by the packages and tars in the bundle -docker run --rm -v `pwd`/byoh-ingredients-download:/ingredients -v`pwd`:/bundle -v`pwd`/installer/bundle_builder/config/ubuntu/20_04/k8s/1_22 --env BUILD_ONLY=1 build-push-bundle +docker run --rm \ + -v `pwd`/byoh-ingredients-download:/ingredients \ + -v`pwd`:/bundle \ + -v`pwd`/installer/bundle_builder/config/ubuntu/20_04/k8s/extra:/config \ + -e BUILD_ONLY=1 \ + byoh-build-push-bundle ``` diff --git a/installer/bundle_builder/ingredients/deb/download.sh b/installer/bundle_builder/ingredients/deb/download.sh deleted file mode 100644 index efe0909dd..000000000 --- a/installer/bundle_builder/ingredients/deb/download.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Copyright 2021 VMware, Inc. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -set -e - -echo Update the apt package index and install packages needed to use the Kubernetes apt repository -sudo apt-get update -sudo apt-get install -y apt-transport-https ca-certificates curl - -echo Download containerd -curl -LOJR https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/cri-containerd-cni-${CONTAINERD_VERSION}-linux-amd64.tar.gz - -echo Download the Google Cloud public signing key -sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://dl.k8s.io/apt/doc/apt-key.gpg - -echo Add the Kubernetes apt repository -echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list - -echo Update apt package index, install kubelet, kubeadm and kubectl -sudo apt-get update -sudo apt-get download {kubelet,kubeadm,kubectl}:$ARCH=$KUBERNETES_VERSION -sudo apt-get download kubernetes-cni:$ARCH=1.1.1-00 -sudo apt-get download cri-tools:$ARCH=1.25.0-00 diff --git a/installer/bundle_builder/Dockerfile b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/Dockerfile.builder similarity index 96% rename from installer/bundle_builder/Dockerfile rename to installer/bundle_builder/ubuntu/20.04/x86-64/k8s/Dockerfile.builder index 0934aeb0c..37bfc67b1 100644 --- a/installer/bundle_builder/Dockerfile +++ b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/Dockerfile.builder @@ -26,7 +26,7 @@ WORKDIR /bundle-builder COPY *.sh ./ RUN chmod a+x *.sh #Default config -COPY config/ubuntu/20_04/k8s/1_22 /config/ +COPY ubuntu/20.04/x86-64/k8s/1_22 /config/ RUN mkdir /ingredients && mkdir /bundle ENV PATH="/bundle-builder:${PATH}" diff --git a/installer/bundle_builder/config/ubuntu/20_04/k8s/1_22/etc/modules-load.d/containerd.conf b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/conf/etc/modules-load.d/containerd.conf similarity index 100% rename from installer/bundle_builder/config/ubuntu/20_04/k8s/1_22/etc/modules-load.d/containerd.conf rename to installer/bundle_builder/ubuntu/20.04/x86-64/k8s/conf/etc/modules-load.d/containerd.conf diff --git a/bundles/ubuntu/22.04/x86-64/k8s/conf/etc/sysctl.d/99-kubernetes-cri.conf b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/conf/etc/sysctl.d/99-kubernetes-cri.conf similarity index 100% rename from bundles/ubuntu/22.04/x86-64/k8s/conf/etc/sysctl.d/99-kubernetes-cri.conf rename to installer/bundle_builder/ubuntu/20.04/x86-64/k8s/conf/etc/sysctl.d/99-kubernetes-cri.conf diff --git a/installer/bundle_builder/build-bundle.sh b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/build-bundle.sh similarity index 91% rename from installer/bundle_builder/build-bundle.sh rename to installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/build-bundle.sh index 32d024b7f..0cf3bba4b 100755 --- a/installer/bundle_builder/build-bundle.sh +++ b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/build-bundle.sh @@ -9,6 +9,8 @@ CONFIG_PATH=$2 set -e +rm -rf $INGREDIENTS_PATH/$3.tar + echo Building bundle... echo Ingredients $INGREDIENTS_PATH @@ -33,5 +35,6 @@ cp $CONFIG_PATH/conf.tar . echo Creating bundle tar tar -cvf /bundle/bundle.tar * +cp /bundle/bundle.tar $INGREDIENTS_PATH/$3.tar echo Done diff --git a/installer/bundle_builder/build-push-bundle.sh b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/build-push-bundle.sh similarity index 75% rename from installer/bundle_builder/build-push-bundle.sh rename to installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/build-push-bundle.sh index f597548f9..217c8f351 100755 --- a/installer/bundle_builder/build-push-bundle.sh +++ b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/build-push-bundle.sh @@ -5,9 +5,9 @@ set -e -build-bundle.sh $1 $2 +build-bundle.sh $1 $2 $3 if [ $BUILD_ONLY -eq 0 ] then -push-bundle.sh ${@:3} +push-bundle.sh $4:$3 fi diff --git a/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/download.sh b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/download.sh new file mode 100644 index 000000000..85a6f96db --- /dev/null +++ b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/download.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright 2021 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +set -e + +echo Update the apt package index and install packages needed to use the Kubernetes apt repository +apt-get update +DEBIAN_FRONTEND=noninteractive \ +apt-get install -y \ + --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg + +echo Download containerd +curl -LOJR https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/cri-containerd-cni-${CONTAINERD_VERSION}-linux-amd64.tar.gz + +echo Configure apt repository for Kubernetes +mkdir -p /etc/apt/keyrings/ +curl -fsSL https://pkgs.k8s.io/core:/stable:/v$KUBERNETES_MAJOR_VERSION/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg +echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$KUBERNETES_MAJOR_VERSION/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list > /dev/null + +echo Update apt package index, install kubelet, kubeadm and kubectl +apt-get update +apt-get download {kubelet,kubeadm,kubectl}:$ARCH=$KUBERNETES_VERSION +apt-get download kubernetes-cni:$ARCH=1.1.1-2.1 +apt-get download cri-tools:$ARCH=1.25.0-1.1 diff --git a/installer/bundle_builder/push-bundle.sh b/installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/push-bundle.sh similarity index 100% rename from installer/bundle_builder/push-bundle.sh rename to installer/bundle_builder/ubuntu/20.04/x86-64/k8s/ingredients/push-bundle.sh diff --git a/bundles/ubuntu/22.04/x86-64/k8s/conf/etc/modules-load.d/cri.conf b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/conf/etc/modules-load.d/cri.conf similarity index 100% rename from bundles/ubuntu/22.04/x86-64/k8s/conf/etc/modules-load.d/cri.conf rename to installer/bundle_builder/ubuntu/22.04/x86-64/k8s/conf/etc/modules-load.d/cri.conf diff --git a/installer/bundle_builder/config/ubuntu/20_04/k8s/1_22/etc/sysctl.d/99-kubernetes-cri.conf b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/conf/etc/sysctl.d/99-kubernetes-cri.conf similarity index 100% rename from installer/bundle_builder/config/ubuntu/20_04/k8s/1_22/etc/sysctl.d/99-kubernetes-cri.conf rename to installer/bundle_builder/ubuntu/22.04/x86-64/k8s/conf/etc/sysctl.d/99-kubernetes-cri.conf diff --git a/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/build-bundle.sh b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/build-bundle.sh new file mode 100755 index 000000000..98a212595 --- /dev/null +++ b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/build-bundle.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Copyright 2021 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + + +INGREDIENTS_PATH=$1 +CONFIG_PATH=$2 + +set -e + +rm -rf $INGREDIENTS_PATH/$3.tar + +echo Building bundle... + +echo Ingredients $INGREDIENTS_PATH +ls -l $INGREDIENTS_PATH + +echo Strip version to well-known names +# Mandatory +cp $INGREDIENTS_PATH/*containerd.io*.deb containerd.io.deb +cp $INGREDIENTS_PATH/*kubeadm*.deb ./kubeadm.deb +cp $INGREDIENTS_PATH/*kubelet*.deb ./kubelet.deb +cp $INGREDIENTS_PATH/*kubectl*.deb ./kubectl.deb +# Optional +cp $INGREDIENTS_PATH/*cri-tools*.deb cri-tools.deb > /dev/null | true +cp $INGREDIENTS_PATH/*kubernetes-cni*.deb kubernetes-cni.deb > /dev/null | true + +echo Configuration $CONFIG_PATH +ls -l $CONFIG_PATH + +echo Add configuration under well-known name +(cd $CONFIG_PATH && tar -cvf conf.tar *) +cp $CONFIG_PATH/conf.tar . + +echo Creating bundle tar +tar -cvf /bundle/bundle.tar * +cp /bundle/bundle.tar $INGREDIENTS_PATH/$3.tar + +echo Done diff --git a/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/build-push-bundle.sh b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/build-push-bundle.sh new file mode 100755 index 000000000..217c8f351 --- /dev/null +++ b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/build-push-bundle.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Copyright 2021 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +set -e + +build-bundle.sh $1 $2 $3 +if [ $BUILD_ONLY -eq 0 ] +then +push-bundle.sh $4:$3 +fi + diff --git a/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/download.sh b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/download.sh new file mode 100644 index 000000000..e115f84a9 --- /dev/null +++ b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/download.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright 2021 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +set -e + +echo Update the apt package index and install packages needed to use the Kubernetes apt repository +apt-get update +DEBIAN_FRONTEND=noninteractive \ +apt-get install -y \ + --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg + +echo Configure apt repository for containerd +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null + +echo Configure apt repository for Kubernetes +curl -fsSL https://pkgs.k8s.io/core:/stable:/v$KUBERNETES_MAJOR_VERSION/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg +echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$KUBERNETES_MAJOR_VERSION/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list > /dev/null + +echo Update apt package index, install kubelet, kubeadm and kubectl, and other dependencies +apt-get update +apt-get download {kubelet,kubeadm,kubectl}:$ARCH=$KUBERNETES_VERSION +apt-get download kubernetes-cni:$ARCH=$KUBERNETES_CNI_VERSION +apt-get download cri-tools:$ARCH=$CRI_TOOLS_VERSION +apt-get download containerd.io:$ARCH=$CONTAINERD_VERSION diff --git a/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/push-bundle.sh b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/push-bundle.sh new file mode 100644 index 000000000..6bc1c0b22 --- /dev/null +++ b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/ingredients/push-bundle.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Copyright 2021 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +set -e + +echo Pushing bundle "$*" + +imgpkg push -f . -i $@ + +echo Done diff --git a/bundles/ubuntu/22.04/x86-64/k8s/install.sh b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/install.sh similarity index 100% rename from bundles/ubuntu/22.04/x86-64/k8s/install.sh rename to installer/bundle_builder/ubuntu/22.04/x86-64/k8s/install.sh diff --git a/bundles/ubuntu/22.04/x86-64/k8s/uninstall.sh b/installer/bundle_builder/ubuntu/22.04/x86-64/k8s/uninstall.sh similarity index 100% rename from bundles/ubuntu/22.04/x86-64/k8s/uninstall.sh rename to installer/bundle_builder/ubuntu/22.04/x86-64/k8s/uninstall.sh diff --git a/installer/bundle_builder/ubuntu/Dockerfile.builder b/installer/bundle_builder/ubuntu/Dockerfile.builder new file mode 100644 index 000000000..27a8ed1c4 --- /dev/null +++ b/installer/bundle_builder/ubuntu/Dockerfile.builder @@ -0,0 +1,48 @@ +# Copyright 2021 VMware, Inc. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Build and push (opt-in) a BYOH bundle to repository +# +# 1. Download bundle ingredients. See ingredients/deb/download.sh +# 2. Mount the bundle ingredients under /ingredients +# 3. Optional. Mount output bundle directory under /bundle +# 3. Optional. Mount additional configuration under /config +# -v config/ubuntu/20_04/k8s/1_22:/config +# Defaults to config/ubuntu/20_04/k8s/1_22 +# Example +# // Build and push a BYOH bundle to repository +# docker run --rm -v :/ingredients --env BUILD_ONLY=0 / +# +# // Build and store a BYOH bundle +# docker run --rm -v :/ingredients -v :/bundle --env + +ARG BASE_IMAGE=ubuntu:20.04 +FROM $BASE_IMAGE as build + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive \ + apt-get install -y \ + --no-install-recommends \ + ca-certificates \ + curl + +ARG ARCH=amd64 +ARG IMGPKG_VERSION=0.42.1 +RUN curl -LOJR https://github.com/carvel-dev/imgpkg/releases/download/v$IMGPKG_VERSION/imgpkg-linux-$ARCH \ + && mv imgpkg-linux-$ARCH /usr/local/bin/imgpkg \ + && chmod +x /usr/local/bin/imgpkg +# If set to 1 bundle is built and available as bundle/bundle.tar +# If set to 0 bundle is build and pushed to repo +ENV BUILD_ONLY=1 + +WORKDIR /bundle-builder +COPY ingredients/*.sh ./ +RUN chmod a+x *.sh +#Default config +COPY ./conf/ /config/ + +RUN mkdir /ingredients && mkdir /bundle +ENV PATH="/bundle-builder:${PATH}" + +WORKDIR /tmp/bundle +ENTRYPOINT ["build-push-bundle.sh", "/ingredients", "/config"] diff --git a/installer/bundle_builder/ingredients/deb/Dockerfile b/installer/bundle_builder/ubuntu/Dockerfile.downloader similarity index 79% rename from installer/bundle_builder/ingredients/deb/Dockerfile rename to installer/bundle_builder/ubuntu/Dockerfile.downloader index 4b58c5686..5ee4fd372 100644 --- a/installer/bundle_builder/ingredients/deb/Dockerfile +++ b/installer/bundle_builder/ubuntu/Dockerfile.downloader @@ -12,13 +12,12 @@ ARG BASE_IMAGE=ubuntu:20.04 FROM $BASE_IMAGE as build # Override to download other version +ENV KUBERNETES_MAJOR_VERSION=1.26 +ENV KUBERNETES_VERSION=1.26.6-1.1 +ENV CRI_TOOLS_VERSION= ENV CONTAINERD_VERSION=1.6.26 -ENV KUBERNETES_VERSION=1.26.6-00 ENV ARCH=amd64 -RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends sudo - WORKDIR /bundle-builder COPY download.sh . RUN chmod a+x download.sh diff --git a/installer/internal/algo/ubuntu20_04_k8s.go b/installer/internal/algo/ubuntu20_04_k8s.go index 89594d3ef..d7aaab2ce 100644 --- a/installer/internal/algo/ubuntu20_04_k8s.go +++ b/installer/internal/algo/ubuntu20_04_k8s.go @@ -85,7 +85,7 @@ if ! command -v imgpkg >>/dev/null; then dl_bin="curl -s -L" fi - $dl_bin github.com/carvel-dev/imgpkg/releases/download/$IMGPKG_VERSION/imgpkg-linux-$ARCH > /tmp/imgpkg + $dl_bin https://github.com/carvel-dev/imgpkg/releases/download/v$IMGPKG_VERSION/imgpkg-linux-$ARCH > /tmp/imgpkg mv /tmp/imgpkg /usr/local/bin/imgpkg chmod +x /usr/local/bin/imgpkg fi diff --git a/installer/internal/algo/ubuntu22_04_k8s.go b/installer/internal/algo/ubuntu22_04_k8s.go index ae3804d46..7b9fd176a 100644 --- a/installer/internal/algo/ubuntu22_04_k8s.go +++ b/installer/internal/algo/ubuntu22_04_k8s.go @@ -84,7 +84,7 @@ if ! command -v imgpkg >>/dev/null; then dl_bin="curl -s -L" fi - $dl_bin github.com/carvel-dev/imgpkg/releases/download/$IMGPKG_VERSION/imgpkg-linux-$ARCH > /tmp/imgpkg + $dl_bin https://github.com/carvel-dev/imgpkg/releases/download/v$IMGPKG_VERSION/imgpkg-linux-$ARCH > /tmp/imgpkg mv /tmp/imgpkg /usr/local/bin/imgpkg chmod +x /usr/local/bin/imgpkg fi