From bfd62cbd58ace6e182dea8ff726759229d66740a Mon Sep 17 00:00:00 2001 From: Kubermatic Bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Fri, 29 Nov 2024 17:52:43 +0100 Subject: [PATCH 1/7] [release/v1.60] Synchronize OWNERS_ALIASES file with Github teams (#1882) --- OWNERS_ALIASES | 1 + 1 file changed, 1 insertion(+) diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES index d604ea1c1..14142c01a 100644 --- a/OWNERS_ALIASES +++ b/OWNERS_ALIASES @@ -6,6 +6,7 @@ aliases: - ahmedwaleedmalik - cnvergence - embik + - julioc-p - kron4eg - moadqassem - moelsayed From ec0f7642d67ebac17a131517290d999da7988e91 Mon Sep 17 00:00:00 2001 From: Kubermatic Bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:43:59 +0100 Subject: [PATCH 2/7] [release/v1.60] Fix bug with handling server types and add new Hetzner server types (#1884) * test hetzner e2e test Signed-off-by: Adonis Murati * fix bug with serverType and add new Hetzner server types Signed-off-by: Adonis Murati * separate error handling with nil checking for clarity Signed-off-by: Adonis Murati --------- Signed-off-by: Adonis Murati Co-authored-by: Adonis Murati --- docs/cloud-provider.md | 2 +- .../clusterv1alpha1machineWithProviderConfig/hetzner.yaml | 2 +- .../conversions/testdata/machinesv1alpha1machine/hetzner.yaml | 2 +- .../testdata/migrated_clusterv1alpha1machine/hetzner.yaml | 2 +- .../hetzner.yaml | 2 +- pkg/cloudprovider/provider/hetzner/provider.go | 4 ++++ test/e2e/provisioning/testdata/machine-invalid.yaml | 2 +- test/e2e/provisioning/testdata/machinedeployment-hetzner.yaml | 2 +- 8 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/cloud-provider.md b/docs/cloud-provider.md index 24979afd7..18478c133 100644 --- a/docs/cloud-provider.md +++ b/docs/cloud-provider.md @@ -224,7 +224,7 @@ labels: ### machine.spec.providerConfig.cloudProviderSpec ```yaml token: "<< HETZNER_API_TOKEN >>" -serverType: "cx11" +serverType: "cx22" datacenter: "" location: "fsn1" # Optional: network IDs or names diff --git a/pkg/apis/cluster/v1alpha1/conversions/testdata/clusterv1alpha1machineWithProviderConfig/hetzner.yaml b/pkg/apis/cluster/v1alpha1/conversions/testdata/clusterv1alpha1machineWithProviderConfig/hetzner.yaml index 78e599569..fbf9753ab 100644 --- a/pkg/apis/cluster/v1alpha1/conversions/testdata/clusterv1alpha1machineWithProviderConfig/hetzner.yaml +++ b/pkg/apis/cluster/v1alpha1/conversions/testdata/clusterv1alpha1machineWithProviderConfig/hetzner.yaml @@ -10,7 +10,7 @@ spec: cloudProviderSpec: datacenter: '' location: fsn1 - serverType: cx11 + serverType: cx22 token: << HETZNER_TOKEN >> operatingSystem: << OS_NAME >> operatingSystemSpec: diff --git a/pkg/apis/cluster/v1alpha1/conversions/testdata/machinesv1alpha1machine/hetzner.yaml b/pkg/apis/cluster/v1alpha1/conversions/testdata/machinesv1alpha1machine/hetzner.yaml index 62fa47ccc..68b92438b 100644 --- a/pkg/apis/cluster/v1alpha1/conversions/testdata/machinesv1alpha1machine/hetzner.yaml +++ b/pkg/apis/cluster/v1alpha1/conversions/testdata/machinesv1alpha1machine/hetzner.yaml @@ -13,7 +13,7 @@ spec: namespace: kube-system name: machine-controller-hetzner key: token - serverType: "cx11" + serverType: "cx22" datacenter: "" location: "fsn1" operatingSystem: "ubuntu" diff --git a/pkg/apis/cluster/v1alpha1/conversions/testdata/migrated_clusterv1alpha1machine/hetzner.yaml b/pkg/apis/cluster/v1alpha1/conversions/testdata/migrated_clusterv1alpha1machine/hetzner.yaml index e5a817e69..a60736114 100644 --- a/pkg/apis/cluster/v1alpha1/conversions/testdata/migrated_clusterv1alpha1machine/hetzner.yaml +++ b/pkg/apis/cluster/v1alpha1/conversions/testdata/migrated_clusterv1alpha1machine/hetzner.yaml @@ -11,7 +11,7 @@ spec: cloudProviderSpec: datacenter: "" location: fsn1 - serverType: cx11 + serverType: cx22 token: secretKeyRef: key: token diff --git a/pkg/apis/cluster/v1alpha1/conversions/testdata/migrated_clusterv1alpha1machineWithProviderConfig/hetzner.yaml b/pkg/apis/cluster/v1alpha1/conversions/testdata/migrated_clusterv1alpha1machineWithProviderConfig/hetzner.yaml index e25b81872..767c358df 100644 --- a/pkg/apis/cluster/v1alpha1/conversions/testdata/migrated_clusterv1alpha1machineWithProviderConfig/hetzner.yaml +++ b/pkg/apis/cluster/v1alpha1/conversions/testdata/migrated_clusterv1alpha1machineWithProviderConfig/hetzner.yaml @@ -13,7 +13,7 @@ spec: cloudProviderSpec: datacenter: "" location: fsn1 - serverType: cx11 + serverType: cx22 token: << HETZNER_TOKEN >> operatingSystem: << OS_NAME >> operatingSystemSpec: diff --git a/pkg/cloudprovider/provider/hetzner/provider.go b/pkg/cloudprovider/provider/hetzner/provider.go index 3f353f87b..39db5e726 100644 --- a/pkg/cloudprovider/provider/hetzner/provider.go +++ b/pkg/cloudprovider/provider/hetzner/provider.go @@ -223,6 +223,10 @@ func (p *provider) Validate(ctx context.Context, _ *zap.SugaredLogger, spec clus return fmt.Errorf("failed to get server type: %w", err) } + if serverType == nil { + return fmt.Errorf("server type %q not found", c.ServerType) + } + image := c.Image if image == "" { image, err = getNameForOS(pc.OperatingSystem) diff --git a/test/e2e/provisioning/testdata/machine-invalid.yaml b/test/e2e/provisioning/testdata/machine-invalid.yaml index 17a100569..1fc9b1d9b 100644 --- a/test/e2e/provisioning/testdata/machine-invalid.yaml +++ b/test/e2e/provisioning/testdata/machine-invalid.yaml @@ -12,7 +12,7 @@ spec: cloudProvider: "hetzner" cloudProviderSpec: token: << HETZNER_TOKEN >> - serverType: "cx11" + serverType: "cx22" datacenter: "" location: "fsn1" operatingSystem: "<< OS_NAME >>" diff --git a/test/e2e/provisioning/testdata/machinedeployment-hetzner.yaml b/test/e2e/provisioning/testdata/machinedeployment-hetzner.yaml index 66a5cc2ee..85e7f36b3 100644 --- a/test/e2e/provisioning/testdata/machinedeployment-hetzner.yaml +++ b/test/e2e/provisioning/testdata/machinedeployment-hetzner.yaml @@ -27,7 +27,7 @@ spec: cloudProvider: "hetzner" cloudProviderSpec: token: << HETZNER_TOKEN >> - serverType: "cx11" + serverType: "cx22" datacenter: "" location: "nbg1" networks: From d1575a50af7a091f852edc425c2fbc201a509ae1 Mon Sep 17 00:00:00 2001 From: Kubermatic Bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:05:49 +0100 Subject: [PATCH 3/7] remove centos support from machine controller (#1883) Signed-off-by: Adonis Murati Co-authored-by: Adonis Murati --- Makefile | 2 +- README.md | 2 +- docs/howto-provider.md | 2 +- docs/openstack-images.md | 2 +- docs/operating-system.md | 28 ++++----- docs/vsphere.md | 8 +-- examples/digitalocean-machinedeployment.yaml | 1 - examples/kubevirt-machinedeployment.yaml | 2 +- examples/openstack-machinedeployment.yaml | 1 - examples/operating-system-manager.yaml | 2 - examples/scaleway-machinedeployment.yaml | 1 - hack/build-kubevirt-images.sh | 2 +- hack/e2e-setup-openstack-images.sh | 1 - hack/kubevirt_dockerfiles/dockerfile.centos | 3 - hack/setup-openstack-images.sh | 12 ---- image-builder/README.md | 6 +- image-builder/build.sh | 35 +---------- .../machinesv1alpha1machine/openstack.yaml | 1 - .../provider/alibaba/provider.go | 3 - pkg/cloudprovider/provider/aws/provider.go | 15 ----- pkg/cloudprovider/provider/azure/provider.go | 6 -- .../provider/digitalocean/provider.go | 2 - .../provider/equinixmetal/provider.go | 2 - .../provider/hetzner/provider.go | 2 - .../provider/kubevirt/types/types.go | 1 - pkg/cloudprovider/provider/linode/provider.go | 6 -- .../provider/scaleway/provider.go | 2 - pkg/cloudprovider/provider/vultr/provider.go | 3 - pkg/providerconfig/types.go | 3 - pkg/providerconfig/types/types.go | 2 - pkg/userdata/centos/centos.go | 59 ------------------- 31 files changed, 25 insertions(+), 192 deletions(-) delete mode 100644 hack/kubevirt_dockerfiles/dockerfile.centos delete mode 100644 pkg/userdata/centos/centos.go diff --git a/Makefile b/Makefile index 098c867be..e338ed2ec 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ IMAGE_TAG = \ $(shell echo $$(git rev-parse HEAD && if [[ -n $$(git status --porcelain) ]]; then echo '-dirty'; fi)|tr -d ' ') IMAGE_NAME ?= $(REGISTRY)/$(REGISTRY_NAMESPACE)/machine-controller:$(IMAGE_TAG) -OS = amzn2 centos ubuntu rhel flatcar rockylinux +OS = amzn2 ubuntu rhel flatcar rockylinux BASE64_ENC = \ $(shell if base64 -w0 <(echo "") &> /dev/null; then echo "base64 -w0"; else echo "base64 -b0"; fi) diff --git a/README.md b/README.md index b835c768d..f2e2ac778 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ ### What Works - Creation of worker nodes on AWS, Digitalocean, Openstack, Azure, Google Cloud Platform, Nutanix, VMWare Cloud Director, VMWare vSphere, Hetzner Cloud and Kubevirt -- Using Ubuntu, Flatcar, CentOS 7 or Rocky Linux 8 distributions ([not all distributions work on all providers](/docs/operating-system.md)) +- Using Ubuntu, Flatcar, or Rocky Linux 8 distributions ([not all distributions work on all providers](/docs/operating-system.md)) ### Supported Kubernetes Versions diff --git a/docs/howto-provider.md b/docs/howto-provider.md index b6bc583d1..3f72a5a84 100644 --- a/docs/howto-provider.md +++ b/docs/howto-provider.md @@ -65,7 +65,7 @@ Provider implementations are located in individual packages in `k8c.io/machine-c When retrieving the individual configuration from the provider specification a type for unmarshalling is needed. Here first the provider configuration is read and based on it the individual values of the configuration are retrieved. Typically the access data (token, ID/key combination, document with all information) alternatively can be passed via an environment variable. According methods of the used `providerconfig.ConfigVarResolver` do support this. -For creation of new machines the support of the possible information has to be checked. The machine controller supports _CentOS_, _Flatcar_ and _Ubuntu_. In case one or more aren't supported by the cloud infrastructure the error `providerconfig.ErrOSNotSupported` has to be returned. +For creation of new machines the support of the possible information has to be checked. The machine controller supports _Flatcar_ and _Ubuntu_. In case one or more aren't supported by the cloud infrastructure the error `providerconfig.ErrOSNotSupported` has to be returned. ## Integrate provider into the Machine Controller diff --git a/docs/openstack-images.md b/docs/openstack-images.md index a1979885c..8a89250e9 100644 --- a/docs/openstack-images.md +++ b/docs/openstack-images.md @@ -10,5 +10,5 @@ There is a script to upload all supported image to OpenStack. By default all images will be named `machine-controller-${OS_NAME}`. The image names can be overwritten using environment variables: ```bash -UBUNTU_IMAGE_NAME="ubuntu" CENTOS_IMAGE_NAME="centos" ./hack/setup-openstack-images.sh +UBUNTU_IMAGE_NAME="ubuntu" ./hack/setup-openstack-images.sh ``` diff --git a/docs/operating-system.md b/docs/operating-system.md index fd6994ece..c4b7692f6 100644 --- a/docs/operating-system.md +++ b/docs/operating-system.md @@ -4,19 +4,19 @@ ### Cloud provider -| | Ubuntu | CentOS | Flatcar | RHEL | Amazon Linux 2 | Rocky Linux | -|---|---|---|---|---|---|---| -| AWS | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Azure | ✓ | ✓ | ✓ | ✓ | x | ✓ | -| Digitalocean | ✓ | ✓ | x | x | x | ✓ | -| Equinix Metal | ✓ | ✓ | ✓ | x | x | ✓ | -| Google Cloud Platform | ✓ | x | ✓ | x | x | x | -| Hetzner | ✓ | x | x | x | x | ✓ | -| KubeVirt | ✓ | ✓ | ✓ | ✓ | x | ✓ | -| Nutanix | ✓ | ✓ | x | x | x | x | -| Openstack | ✓ | ✓ | ✓ | ✓ | x | ✓ | -| VMware Cloud Director | ✓ | x | x | x | x | x | -| VSphere | ✓ | ✓ | ✓ | ✓ | x | ✓ | +| | Ubuntu | Flatcar | RHEL | Amazon Linux 2 | Rocky Linux | +|---|---|---|---|---|---| +| AWS | ✓ | ✓ | ✓ | ✓ | ✓ | +| Azure | ✓ | ✓ | ✓ | x | ✓ | +| Digitalocean | ✓ | x | x | x | ✓ | +| Equinix Metal | ✓ | ✓ | x | x | ✓ | +| Google Cloud Platform | ✓ | ✓ | x | x | x | +| Hetzner | ✓ | x | x | x | ✓ | +| KubeVirt | ✓ | ✓ | ✓ | x | ✓ | +| Nutanix | ✓ | x | x | x | x | +| Openstack | ✓ | ✓ | ✓ | x | ✓ | +| VMware Cloud Director | ✓ | x | x | x | x | +| VSphere | ✓ | ✓ | ✓ | x | ✓ | ## Configuring a operating system @@ -24,7 +24,6 @@ The operating system to use can be set via `machine.spec.providerConfig.operatin Allowed values: - `amzn2` -- `centos` - `flatcar` - `rhel` - `rockylinux` @@ -40,7 +39,6 @@ Machine controller may work with other OS versions that are not listed in the ta | | Versions | |---|---| | AmazonLinux2 | 2.x | -| CentOS | 7.4.x, 7.6.x, 7.7.x | | RHEL | 8.x | | Rocky Linux | 8.5 | | Ubuntu | 20.04 LTS, 22.04 LTS | diff --git a/docs/vsphere.md b/docs/vsphere.md index ab6962c94..0a299cb2a 100644 --- a/docs/vsphere.md +++ b/docs/vsphere.md @@ -154,7 +154,7 @@ Procedure: ``` # The URL below is just an example - image_url="https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2" + image_url="https://cloud-images.ubuntu.com/releases/20.04/release/ubuntu-20.04-server-cloudimg-amd64.img" image_name="$(basename -- "${image_url}" | sed 's/.qcow2$//g')" curl -sL "${image_url}" -O . ``` @@ -203,12 +203,6 @@ Red Hat Enterprise Linux 8.x KVM Guest Image can be found at [Red Hat Customer P Follow [qcow2](#create-template-vm-from-qcow2) template VM creation guide. -#### CentOS - -CentOS 7 image can be found at the following link: . - -Follow [qcow2](#create-template-vm-from-qcow2) template VM creation guide. - ## Provider configuration VSphere provider accepts the following configuration parameters: diff --git a/examples/digitalocean-machinedeployment.yaml b/examples/digitalocean-machinedeployment.yaml index 043787ebd..50793d6c5 100644 --- a/examples/digitalocean-machinedeployment.yaml +++ b/examples/digitalocean-machinedeployment.yaml @@ -52,7 +52,6 @@ spec: monitoring: false tags: - "machine-controller" - # Can be 'ubuntu' or 'centos' operatingSystem: "ubuntu" operatingSystemSpec: disableAutoUpdate: true diff --git a/examples/kubevirt-machinedeployment.yaml b/examples/kubevirt-machinedeployment.yaml index 96bddfe6a..567c29f2c 100644 --- a/examples/kubevirt-machinedeployment.yaml +++ b/examples/kubevirt-machinedeployment.yaml @@ -56,7 +56,7 @@ spec: - maxSkew: "1" topologyKey: "kubernetes.io/hostname" whenUnsatisfiable: "" # Allowed values: "DoNotSchedule", "ScheduleAnyway" - # Can also be `centos`, must align with he configured registryImage above + # Must align with the configured registryImage above operatingSystem: "ubuntu" operatingSystemSpec: distUpgradeOnBoot: false diff --git a/examples/openstack-machinedeployment.yaml b/examples/openstack-machinedeployment.yaml index ffc93c2f8..5b9dec66e 100644 --- a/examples/openstack-machinedeployment.yaml +++ b/examples/openstack-machinedeployment.yaml @@ -153,7 +153,6 @@ spec: # the list of metadata you would like to attach to the instance tags: tagKey: tagValue - # Can be 'ubuntu' or 'centos' operatingSystem: "ubuntu" operatingSystemSpec: distUpgradeOnBoot: true diff --git a/examples/operating-system-manager.yaml b/examples/operating-system-manager.yaml index ce1648bb6..da5a8b5e2 100644 --- a/examples/operating-system-manager.yaml +++ b/examples/operating-system-manager.yaml @@ -233,7 +233,6 @@ spec: enum: - flatcar - rhel - - centos - ubuntu - amzn2 - rockylinux @@ -683,7 +682,6 @@ spec: enum: - flatcar - rhel - - centos - ubuntu - amzn2 - rockylinux diff --git a/examples/scaleway-machinedeployment.yaml b/examples/scaleway-machinedeployment.yaml index 9b7f7ca7c..1f5b8d163 100644 --- a/examples/scaleway-machinedeployment.yaml +++ b/examples/scaleway-machinedeployment.yaml @@ -56,7 +56,6 @@ spec: ipv6: false tags: - "machine-controller" - # Can be 'ubuntu' or 'centos' operatingSystem: "ubuntu" operatingSystemSpec: disableAutoUpdate: true diff --git a/hack/build-kubevirt-images.sh b/hack/build-kubevirt-images.sh index 440a44217..2028e2151 100755 --- a/hack/build-kubevirt-images.sh +++ b/hack/build-kubevirt-images.sh @@ -20,7 +20,7 @@ BUILD_NUM=2 cd $(dirname $0)/kubevirt_dockerfiles -for flavor in ubuntu centos; do +for flavor in ubuntu; do docker build \ -t quay.io/kubermatic/machine-controller-kubevirt:$flavor-$BUILD_NUM \ -f dockerfile.$flavor . diff --git a/hack/e2e-setup-openstack-images.sh b/hack/e2e-setup-openstack-images.sh index d67c3825f..309b9bf04 100755 --- a/hack/e2e-setup-openstack-images.sh +++ b/hack/e2e-setup-openstack-images.sh @@ -20,6 +20,5 @@ set -o pipefail cd $(dirname $0)/ export UBUNTU_IMAGE_NAME="machine-controller-e2e-ubuntu" -export CENTOS_IMAGE_NAME="machine-controller-e2e-centos" ./setup-openstack-images.sh diff --git a/hack/kubevirt_dockerfiles/dockerfile.centos b/hack/kubevirt_dockerfiles/dockerfile.centos deleted file mode 100644 index c26389521..000000000 --- a/hack/kubevirt_dockerfiles/dockerfile.centos +++ /dev/null @@ -1,3 +0,0 @@ -FROM kubevirt/registry-disk-v1alpha:v0.10.0 - -RUN curl -L -o /disk/centos7.img https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 diff --git a/hack/setup-openstack-images.sh b/hack/setup-openstack-images.sh index 52ab771ae..28d51b005 100755 --- a/hack/setup-openstack-images.sh +++ b/hack/setup-openstack-images.sh @@ -18,7 +18,6 @@ set -o nounset set -o pipefail UBUNTU_IMAGE_NAME=${UBUNTU_IMAGE_NAME:-"machine-controller-ubuntu"} -CENTOS_IMAGE_NAME=${CENTOS_IMAGE_NAME:-"machine-controller-centos"} echo "Downloading Ubuntu 18.04 image from upstream..." curl -L -o ubuntu.img http://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img @@ -30,14 +29,3 @@ openstack image create \ ${UBUNTU_IMAGE_NAME} rm ubuntu.img echo "Successfully uploaded ${UBUNTU_IMAGE_NAME} to OpenStack..." - -echo "Downloading CentOS 7 image from upstream..." -curl -L -o centos.qcow2 http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 -echo "Uploading CentOS 7 image to OpenStack..." -openstack image create \ - --disk-format qcow2 \ - --container-format bare \ - --file centos.qcow2 \ - ${CENTOS_IMAGE_NAME} -rm centos.qcow2 -echo "Successfully uploaded ${CENTOS_IMAGE_NAME} to OpenStack..." diff --git a/image-builder/README.md b/image-builder/README.md index 613132bac..743cc7adc 100644 --- a/image-builder/README.md +++ b/image-builder/README.md @@ -4,19 +4,17 @@ Currently supported operating systems: * RedHat CoreOS - * CentOS 7 * Debian 9 ### Usage -`./build.sh --target-os centos7|debian9 [--release K8S-RELEASE]` +`./build.sh --target-os debian9 [--release K8S-RELEASE]` Parameters: * `--target-os` is mandatory and specifies the Linux distribution image to be built. Possible values: - * `centos7` * `debian9` * `--release` specifies the Kubernetes release to be added to the image, e.g. `v1.10.2`. If not provided, the script will look up the latest stable release and use that. ### Output -The script will generate a VMDK disk image with the filename `TARGET_OS-output.vmdk`, e.g. `centos7-output.vmdk`. +The script will generate a VMDK disk image with the filename `TARGET_OS-output.vmdk`. diff --git a/image-builder/build.sh b/image-builder/build.sh index c8784a55c..97bff8688 100755 --- a/image-builder/build.sh +++ b/image-builder/build.sh @@ -23,7 +23,7 @@ TARGET_OS="" usage() { echo -e "usage:" - echo -e "\t$0 --target-os centos7|debian9|ubuntu-xenial|ubuntu-bionic [--release K8S-RELEASE]" + echo -e "\t$0 --target-os debian9|ubuntu-xenial|ubuntu-bionic [--release K8S-RELEASE]" } while [ $# -gt 0 ]; do @@ -34,7 +34,7 @@ while [ $# -gt 0 ]; do ;; --target-os) if [[ -z $2 ]]; then - echo "You must specify target OS. Currently 'centos7' is supported." + echo "You must specify target OS." exit 1 fi TARGET_OS="$2" @@ -80,29 +80,6 @@ mkdir -p "$TARGETFS" "$SCRIPT_DIR/downloads" # on failure unmount target filesystem (if mounted) and delete the temporary directory trap "sudo mountpoint --quiet $TARGETFS && sudo umount --recursive $TARGETFS; rm -rf $TEMPDIR" EXIT SIGINT -get_centos7_image() { - CENTOS7_BUILD="1802" - echo " * Downloading vanilla CentOS image." - wget "https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-$CENTOS7_BUILD.qcow2.xz" -P "$TEMPDIR" - - echo " * Verifying GPG signature" - wget --quiet "https://cloud.centos.org/centos/7/images/sha256sum.txt.asc" -O "$TEMPDIR/centos7-sha256sum.txt.asc" - gpg2 --quiet --import "$SCRIPT_DIR/RPM-GPG-KEY-CentOS-7" - gpg2 "$TEMPDIR/centos7-sha256sum.txt.asc" - - echo " * Verifying SHA256 digest" - EXPECTED_SHA256="$(grep "CentOS-7-x86_64-GenericCloud-$CENTOS7_BUILD.qcow2.xz$" <"$TEMPDIR/centos7-sha256sum.txt" | cut -f1 -d ' ')" - CALCULATED_SHA256="$(sha256sum "$TEMPDIR/CentOS-7-x86_64-GenericCloud-$CENTOS7_BUILD.qcow2.xz" | cut -f1 -d ' ')" - if [[ $CALCULATED_SHA256 != "$EXPECTED_SHA256" ]]; then - echo " * SHA256 digest verification failed. '$CALCULATED_SHA256' != '$EXPECTED_SHA256'" - exit 1 - fi - - echo " * Decompressing" - unxz --keep "$TEMPDIR/CentOS-7-x86_64-GenericCloud-$CENTOS7_BUILD.qcow2.xz" - mv "$TEMPDIR/CentOS-7-x86_64-GenericCloud-$CENTOS7_BUILD.qcow2" "$SCRIPT_DIR/downloads/CentOS-7-x86_64-GenericCloud.qcow2" -} - get_debian9_image() { DEBIAN_CD_SIGNING_KEY_FINGERPRINT="DF9B9C49EAA9298432589D76DA87E80D6294BE9B" @@ -167,7 +144,7 @@ mount_rootfs() { local IMAGE="$1" local FOLDER="$2" case $TARGET_OS in - debian9 | centos7 | ubuntu-*) + debian9 | ubuntu-*) echo " * /" sudo guestmount -a "$IMAGE" -m "/dev/sda1" "$TARGETFS" ;; @@ -180,12 +157,6 @@ mount_rootfs() { } case $TARGET_OS in -centos7) - CLEAN_IMAGE="$SCRIPT_DIR/downloads/CentOS-7-x86_64-GenericCloud.qcow2" - if [[ ! -f $CLEAN_IMAGE ]]; then - get_centos7_image - fi - ;; debian9) CLEAN_IMAGE="$SCRIPT_DIR/downloads/debian-9-openstack-amd64.qcow2" if [[ ! -f $CLEAN_IMAGE ]]; then diff --git a/pkg/apis/cluster/v1alpha1/conversions/testdata/machinesv1alpha1machine/openstack.yaml b/pkg/apis/cluster/v1alpha1/conversions/testdata/machinesv1alpha1machine/openstack.yaml index 157d535d4..9c0b49dda 100644 --- a/pkg/apis/cluster/v1alpha1/conversions/testdata/machinesv1alpha1machine/openstack.yaml +++ b/pkg/apis/cluster/v1alpha1/conversions/testdata/machinesv1alpha1machine/openstack.yaml @@ -65,7 +65,6 @@ spec: # the list of tags you would like to attach to the instance tags: tagKey: tagValue - # Can be 'ubuntu' or 'centos' operatingSystem: "ubuntu" operatingSystemSpec: distUpgradeOnBoot: true diff --git a/pkg/cloudprovider/provider/alibaba/provider.go b/pkg/cloudprovider/provider/alibaba/provider.go index 9f7f6a5bc..e46ce5d1f 100644 --- a/pkg/cloudprovider/provider/alibaba/provider.go +++ b/pkg/cloudprovider/provider/alibaba/provider.go @@ -44,7 +44,6 @@ import ( const ( machineUIDTag = "machine_uid" - centosImageName = "CentOS 7.9 64 bit" ubuntuImageName = "Ubuntu 22.04 64 bit" finalizerInstance = "kubermatic.io/cleanup-alibaba-instance" @@ -456,8 +455,6 @@ func (p *provider) getImageIDForOS(machineSpec clusterv1alpha1.MachineSpec, os p switch image.OSNameEn { case ubuntuImageName: availableImage[providerconfigtypes.OperatingSystemUbuntu] = image.ImageId - case centosImageName: - availableImage[providerconfigtypes.OperatingSystemCentOS] = image.ImageId } } diff --git a/pkg/cloudprovider/provider/aws/provider.go b/pkg/cloudprovider/provider/aws/provider.go index 2527e301a..4dba90c62 100644 --- a/pkg/cloudprovider/provider/aws/provider.go +++ b/pkg/cloudprovider/provider/aws/provider.go @@ -105,19 +105,6 @@ var ( } amiFilters = map[providerconfigtypes.OperatingSystem]map[awstypes.CPUArchitecture]amiFilter{ - // Source: https://wiki.centos.org/Cloud/AWS - providerconfigtypes.OperatingSystemCentOS: { - awstypes.CPUArchitectureX86_64: { - description: "CentOS Linux 7* x86_64*", - // The AWS marketplace ID from CentOS Community Platform Engineering (CPE) - owner: "125523088429", - }, - awstypes.CPUArchitectureARM64: { - description: "CentOS Linux 7* aarch64*", - // The AWS marketplace ID from CentOS Community Platform Engineering (CPE) - owner: "125523088429", - }, - }, providerconfigtypes.OperatingSystemRockyLinux: { awstypes.CPUArchitectureX86_64: { description: "*Rocky-8-EC2-*.x86_64", @@ -337,8 +324,6 @@ func getDefaultRootDevicePath(os providerconfigtypes.OperatingSystem) (string, e switch os { case providerconfigtypes.OperatingSystemUbuntu: return rootDevicePathSDA, nil - case providerconfigtypes.OperatingSystemCentOS: - return rootDevicePathSDA, nil case providerconfigtypes.OperatingSystemRockyLinux: return rootDevicePathSDA, nil case providerconfigtypes.OperatingSystemRHEL: diff --git a/pkg/cloudprovider/provider/azure/provider.go b/pkg/cloudprovider/provider/azure/provider.go index dc6200a4b..96532d88e 100644 --- a/pkg/cloudprovider/provider/azure/provider.go +++ b/pkg/cloudprovider/provider/azure/provider.go @@ -141,12 +141,6 @@ func (vm *azureVM) Status() instance.Status { } var imageReferences = map[providerconfigtypes.OperatingSystem]compute.ImageReference{ - providerconfigtypes.OperatingSystemCentOS: { - Publisher: to.StringPtr("OpenLogic"), - Offer: to.StringPtr("CentOS"), - Sku: to.StringPtr("7_9"), // https://docs.microsoft.com/en-us/azure/virtual-machines/linux/using-cloud-init - Version: to.StringPtr("latest"), - }, providerconfigtypes.OperatingSystemUbuntu: { Publisher: to.StringPtr("Canonical"), Offer: to.StringPtr("ubuntu-24_04-lts"), diff --git a/pkg/cloudprovider/provider/digitalocean/provider.go b/pkg/cloudprovider/provider/digitalocean/provider.go index 6cb24fc70..e8d03129e 100644 --- a/pkg/cloudprovider/provider/digitalocean/provider.go +++ b/pkg/cloudprovider/provider/digitalocean/provider.go @@ -86,8 +86,6 @@ func getSlugForOS(os providerconfigtypes.OperatingSystem) (string, error) { switch os { case providerconfigtypes.OperatingSystemUbuntu: return "ubuntu-24-04-x64", nil - case providerconfigtypes.OperatingSystemCentOS: - return "centos-7-x64", nil case providerconfigtypes.OperatingSystemRockyLinux: return "rockylinux-8-x64", nil } diff --git a/pkg/cloudprovider/provider/equinixmetal/provider.go b/pkg/cloudprovider/provider/equinixmetal/provider.go index 5e4946c30..e14473986 100644 --- a/pkg/cloudprovider/provider/equinixmetal/provider.go +++ b/pkg/cloudprovider/provider/equinixmetal/provider.go @@ -467,8 +467,6 @@ func getNameForOS(os providerconfigtypes.OperatingSystem) (string, error) { switch os { case providerconfigtypes.OperatingSystemUbuntu: return "ubuntu_24_04", nil - case providerconfigtypes.OperatingSystemCentOS: - return "centos_7", nil case providerconfigtypes.OperatingSystemFlatcar: return "flatcar_stable", nil case providerconfigtypes.OperatingSystemRockyLinux: diff --git a/pkg/cloudprovider/provider/hetzner/provider.go b/pkg/cloudprovider/provider/hetzner/provider.go index 39db5e726..93dc87383 100644 --- a/pkg/cloudprovider/provider/hetzner/provider.go +++ b/pkg/cloudprovider/provider/hetzner/provider.go @@ -73,8 +73,6 @@ func getNameForOS(os providerconfigtypes.OperatingSystem) (string, error) { switch os { case providerconfigtypes.OperatingSystemUbuntu: return "ubuntu-24.04", nil - case providerconfigtypes.OperatingSystemCentOS: - return "centos-7", nil case providerconfigtypes.OperatingSystemRockyLinux: return "rocky-8", nil } diff --git a/pkg/cloudprovider/provider/kubevirt/types/types.go b/pkg/cloudprovider/provider/kubevirt/types/types.go index 27641b130..ceecb93a5 100644 --- a/pkg/cloudprovider/provider/kubevirt/types/types.go +++ b/pkg/cloudprovider/provider/kubevirt/types/types.go @@ -26,7 +26,6 @@ import ( ) var SupportedOS = map[providerconfigtypes.OperatingSystem]*struct{}{ - providerconfigtypes.OperatingSystemCentOS: nil, providerconfigtypes.OperatingSystemUbuntu: nil, providerconfigtypes.OperatingSystemRHEL: nil, providerconfigtypes.OperatingSystemFlatcar: nil, diff --git a/pkg/cloudprovider/provider/linode/provider.go b/pkg/cloudprovider/provider/linode/provider.go index f38e77948..2a8c98acf 100644 --- a/pkg/cloudprovider/provider/linode/provider.go +++ b/pkg/cloudprovider/provider/linode/provider.go @@ -85,12 +85,6 @@ func getSlugForOS(os providerconfigtypes.OperatingSystem) (string, error) { switch os { case providerconfigtypes.OperatingSystemUbuntu: return "linode/ubuntu18.04", nil - - /** - // StackScript for CloudInit is not centos7 ready - case providerconfigtypes.OperatingSystemCentOS: - return "linode/centos7", nil - **/ } return "", providerconfigtypes.ErrOSNotSupported } diff --git a/pkg/cloudprovider/provider/scaleway/provider.go b/pkg/cloudprovider/provider/scaleway/provider.go index 632a6464f..c31dbc874 100644 --- a/pkg/cloudprovider/provider/scaleway/provider.go +++ b/pkg/cloudprovider/provider/scaleway/provider.go @@ -81,8 +81,6 @@ func getImageNameForOS(os providerconfigtypes.OperatingSystem) (string, error) { // ubuntu_focal doesn't work (see https://bugs.launchpad.net/ubuntu/+source/linux-kvm/+bug/1880522) // modprobe ip_vs will fail return "ubuntu_bionic", nil - case providerconfigtypes.OperatingSystemCentOS: - return "centos_7.6", nil } return "", providerconfigtypes.ErrOSNotSupported } diff --git a/pkg/cloudprovider/provider/vultr/provider.go b/pkg/cloudprovider/provider/vultr/provider.go index f2b3c9698..d51bac3d2 100644 --- a/pkg/cloudprovider/provider/vultr/provider.go +++ b/pkg/cloudprovider/provider/vultr/provider.go @@ -82,9 +82,6 @@ func getIDForOS(os providerconfigtypes.OperatingSystem) (int, error) { switch os { case providerconfigtypes.OperatingSystemUbuntu: return 1743, nil - // name: CentOS 7 x64 - case providerconfigtypes.OperatingSystemCentOS: - return 167, nil // name: Rocky Linux 9 x64 case providerconfigtypes.OperatingSystemRockyLinux: return 1869, nil diff --git a/pkg/providerconfig/types.go b/pkg/providerconfig/types.go index 13d21b0a3..c88f6df06 100644 --- a/pkg/providerconfig/types.go +++ b/pkg/providerconfig/types.go @@ -26,7 +26,6 @@ import ( providerconfigtypes "k8c.io/machine-controller/pkg/providerconfig/types" "k8c.io/machine-controller/pkg/userdata/amzn2" - "k8c.io/machine-controller/pkg/userdata/centos" "k8c.io/machine-controller/pkg/userdata/flatcar" "k8c.io/machine-controller/pkg/userdata/rhel" "k8c.io/machine-controller/pkg/userdata/rockylinux" @@ -186,8 +185,6 @@ func DefaultOperatingSystemSpec( switch osys { case providerconfigtypes.OperatingSystemAmazonLinux2: return amzn2.DefaultConfig(operatingSystemSpec), nil - case providerconfigtypes.OperatingSystemCentOS: - return centos.DefaultConfig(operatingSystemSpec), nil case providerconfigtypes.OperatingSystemFlatcar: return flatcar.DefaultConfig(operatingSystemSpec), nil case providerconfigtypes.OperatingSystemRHEL: diff --git a/pkg/providerconfig/types/types.go b/pkg/providerconfig/types/types.go index 5ca2a3169..5fe41f0d5 100644 --- a/pkg/providerconfig/types/types.go +++ b/pkg/providerconfig/types/types.go @@ -36,7 +36,6 @@ type OperatingSystem string const ( OperatingSystemUbuntu OperatingSystem = "ubuntu" - OperatingSystemCentOS OperatingSystem = "centos" OperatingSystemAmazonLinux2 OperatingSystem = "amzn2" OperatingSystemRHEL OperatingSystem = "rhel" OperatingSystemFlatcar OperatingSystem = "flatcar" @@ -85,7 +84,6 @@ var ( // AllOperatingSystems is a slice containing all supported operating system identifiers. AllOperatingSystems = []OperatingSystem{ OperatingSystemUbuntu, - OperatingSystemCentOS, OperatingSystemAmazonLinux2, OperatingSystemRHEL, OperatingSystemFlatcar, diff --git a/pkg/userdata/centos/centos.go b/pkg/userdata/centos/centos.go deleted file mode 100644 index 0350c43b5..000000000 --- a/pkg/userdata/centos/centos.go +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright 2019 The Machine Controller 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 centos - -import ( - "encoding/json" - - "k8s.io/apimachinery/pkg/runtime" -) - -// Config contains specific configuration for CentOS. -type Config struct { - DistUpgradeOnBoot bool `json:"distUpgradeOnBoot"` -} - -func DefaultConfig(operatingSystemSpec runtime.RawExtension) runtime.RawExtension { - if operatingSystemSpec.Raw == nil { - operatingSystemSpec.Raw, _ = json.Marshal(Config{}) - } - - return operatingSystemSpec -} - -// LoadConfig retrieves the CentOS configuration from raw data. -func LoadConfig(r runtime.RawExtension) (*Config, error) { - r = DefaultConfig(r) - cfg := Config{} - - if err := json.Unmarshal(r.Raw, &cfg); err != nil { - return nil, err - } - return &cfg, nil -} - -// Spec return the configuration as raw data. -func (cfg *Config) Spec() (*runtime.RawExtension, error) { - ext := &runtime.RawExtension{} - b, err := json.Marshal(cfg) - if err != nil { - return nil, err - } - - ext.Raw = b - return ext, nil -} From b39c63b41bc498422e7b0f67842721779deac80e Mon Sep 17 00:00:00 2001 From: Kubermatic Bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Mon, 6 Jan 2025 13:10:41 +0100 Subject: [PATCH 4/7] [release/v1.60] Add partition number annotation (#1892) * add partition number annotation * fix lint --------- Co-authored-by: Mohamed Rafraf --- .../plugins/tinkerbell/client/template.go | 11 ++++++----- .../plugins/tinkerbell/client/workflow.go | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go index c5baf8ad1..aa82435d9 100644 --- a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go +++ b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go @@ -60,6 +60,7 @@ const ( hardwareDisk1 = "{{ index .Hardware.Disks 0 }}" hardwareName = "{{.hardware_name}}" ProvisionWorkerNodeTemplate = "provision-worker-node" + PartitionNumber = "{{.partition_number}}" ) // TemplateClient handles interactions with the Tinkerbell Templates in the Tinkerbell cluster. @@ -195,11 +196,11 @@ func createGrowPartitionAction(destDisk string) Action { Image: "quay.io/tinkerbell/actions/cexec:c5bde803d9f6c90f1a9d5e06930d856d1481854c", Timeout: 90, Environment: map[string]string{ - "BLOCK_DEVICE": "{{ index .Hardware.Disks 0 }}3", + "BLOCK_DEVICE": fmt.Sprintf("{{ index .Hardware.Disks 0 }}%s", PartitionNumber), "FS_TYPE": fsType, "CHROOT": "y", "DEFAULT_INTERPRETER": defaultInterpreter, - "CMD_LINE": fmt.Sprintf("growpart %s 3 && resize2fs %s3", destDisk, destDisk), + "CMD_LINE": fmt.Sprintf("growpart %s %s && resize2fs %s%s", destDisk, PartitionNumber, destDisk, PartitionNumber), }, } } @@ -225,7 +226,7 @@ network: Image: "quay.io/tinkerbell-actions/writefile:v1.0.0", Timeout: 90, Environment: map[string]string{ - "DEST_DISK": "{{ index .Hardware.Disks 0 }}3", + "DEST_DISK": fmt.Sprintf("{{ index .Hardware.Disks 0 }}%s", PartitionNumber), "FS_TYPE": fsType, "DEST_PATH": "/etc/netplan/config.yaml", "CONTENTS": netplaneConfig, @@ -250,7 +251,7 @@ echo 'local-hostname: {{.hardware_name}}' >> /var/lib/cloud/seed/nocloud/meta-da Image: "quay.io/tinkerbell-actions/cexec:v1.0.0", Timeout: 90, Environment: map[string]string{ - "BLOCK_DEVICE": "{{ index .Hardware.Disks 0 }}3", + "BLOCK_DEVICE": fmt.Sprintf("{{ index .Hardware.Disks 0 }}%s", PartitionNumber), "FS_TYPE": fsType, "CHROOT": "y", "DEFAULT_INTERPRETER": defaultInterpreter, @@ -265,7 +266,7 @@ func decodeCloudInitFile(hardwareName string) Action { Image: "quay.io/tinkerbell/actions/cexec:latest", Timeout: 90, Environment: map[string]string{ - "BLOCK_DEVICE": "{{ index .Hardware.Disks 0 }}3", + "BLOCK_DEVICE": fmt.Sprintf("{{ index .Hardware.Disks 0 }}%s", PartitionNumber), "FS_TYPE": fsType, "CHROOT": "y", "DEFAULT_INTERPRETER": "/bin/sh -c", diff --git a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/workflow.go b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/workflow.go index da3d4bd3c..ec76933c0 100644 --- a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/workflow.go +++ b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/workflow.go @@ -31,6 +31,12 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) +// DefaultPartitionNumber defines the default value for the "partition_number" field. +const DefaultPartitionNumber = "3" + +// PartitionNumberAnnotation is used to specify the main partition number of the disk device. +const PartitionNumberAnnotation = "hardware.kubermatic.io/partition-number" + // WorkflowClient handles interactions with the Tinkerbell Workflows. type WorkflowClient struct { tinkclient client.Client @@ -73,6 +79,7 @@ func (w *WorkflowClient) CreateWorkflow(ctx context.Context, userData, templateR "cidr": convertNetmaskToCIDR(ifaceConfig.IP), "ns": dnsNameservers, "default_route": ifaceConfig.IP.Gateway, + "partition_number": w.getPartitionNumber(hardware), }, }, } @@ -124,3 +131,11 @@ func (w *WorkflowClient) CleanupWorkflows(ctx context.Context, hardwareName, nam return nil } + +func (w *WorkflowClient) getPartitionNumber(hardware tink.Hardware) string { + partitionNumber, exists := hardware.Annotations[PartitionNumberAnnotation] + if !exists { + partitionNumber = DefaultPartitionNumber // Use the default value + } + return partitionNumber +} From 40d9da5247fdedab51af7b34d4f5536b6f70f8df Mon Sep 17 00:00:00 2001 From: Kubermatic Bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Mon, 6 Jan 2025 14:00:40 +0100 Subject: [PATCH 5/7] fix decode with tink-kubeconfig envar (#1893) Co-authored-by: Mohamed Rafraf --- .../provider/baremetal/plugins/tinkerbell/driver.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/driver.go b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/driver.go index 3461497b2..575063852 100644 --- a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/driver.go +++ b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/driver.go @@ -185,7 +185,14 @@ func GetConfig(driverConfig tinktypes.TinkerbellPluginSpec, valueFromStringOrEnv if err != nil { return nil, fmt.Errorf(`failed to get value of "kubeconfig" field: %w`, err) } + val, err := base64.StdEncoding.DecodeString(config.Kubeconfig) + // We intentionally ignore errors here with an assumption that an unencoded YAML or JSON must have been passed on + // in this case. + if err == nil { + config.Kubeconfig = string(val) + } } + config.ClusterName, err = valueFromStringOrEnvVar(driverConfig.ClusterName, "CLUSTER_NAME") if err != nil { return nil, fmt.Errorf(`failed to get value of "clusterName" field: %w`, err) From feea49400c6695c88f2f30f19bac25288bb33f61 Mon Sep 17 00:00:00 2001 From: Kubermatic Bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Mon, 13 Jan 2025 12:16:52 +0100 Subject: [PATCH 6/7] [release/v1.60] baremetal: Templating OSImage links through Tinkerbell workflow objects (#1895) * templating the OSImageURL * update --------- Co-authored-by: Mohamed Rafraf --- .../provider/baremetal/plugins/tinkerbell/client/template.go | 5 +++-- .../provider/baremetal/plugins/tinkerbell/client/workflow.go | 3 ++- .../provider/baremetal/plugins/tinkerbell/driver.go | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go index aa82435d9..7ea237ea6 100644 --- a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go +++ b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/template.go @@ -61,6 +61,7 @@ const ( hardwareName = "{{.hardware_name}}" ProvisionWorkerNodeTemplate = "provision-worker-node" PartitionNumber = "{{.partition_number}}" + OSImageURL = "{{.os_image}}" ) // TemplateClient handles interactions with the Tinkerbell Templates in the Tinkerbell cluster. @@ -91,14 +92,14 @@ func (t *TemplateClient) Delete(ctx context.Context, namespacedName types.Namesp } // CreateTemplate creates a Tinkerbell Template in the Kubernetes cluster. -func (t *TemplateClient) CreateTemplate(ctx context.Context, namespace, osImageURL string) error { +func (t *TemplateClient) CreateTemplate(ctx context.Context, namespace string) error { template := &tinkv1alpha1.Template{} if err := t.tinkclient.Get(ctx, types.NamespacedName{ Name: ProvisionWorkerNodeTemplate, Namespace: namespace, }, template); err != nil { if kerrors.IsNotFound(err) { - data, err := getTemplate(osImageURL) + data, err := getTemplate(OSImageURL) if err != nil { return err } diff --git a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/workflow.go b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/workflow.go index ec76933c0..53f8b9d9a 100644 --- a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/workflow.go +++ b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/client/workflow.go @@ -50,7 +50,7 @@ func NewWorkflowClient(k8sClient client.Client) *WorkflowClient { } // CreateWorkflow creates a new Tinkerbell Workflow resource in the cluster. -func (w *WorkflowClient) CreateWorkflow(ctx context.Context, userData, templateRef string, hardware tink.Hardware) error { +func (w *WorkflowClient) CreateWorkflow(ctx context.Context, userData, templateRef, osImageURL string, hardware tink.Hardware) error { // Construct the Workflow object ifaceConfig := hardware.Spec.Interfaces[0].DHCP dnsNameservers := "1.1.1.1" @@ -80,6 +80,7 @@ func (w *WorkflowClient) CreateWorkflow(ctx context.Context, userData, templateR "ns": dnsNameservers, "default_route": ifaceConfig.IP.Gateway, "partition_number": w.getPartitionNumber(hardware), + "os_image": osImageURL, }, }, } diff --git a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/driver.go b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/driver.go index 575063852..4b1e162a4 100644 --- a/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/driver.go +++ b/pkg/cloudprovider/provider/baremetal/plugins/tinkerbell/driver.go @@ -123,14 +123,14 @@ func (d *driver) ProvisionServer(ctx context.Context, _ *zap.SugaredLogger, meta } // Create template if it doesn't exist - err = d.TemplateClient.CreateTemplate(ctx, d.HardwareRef.Namespace, d.OSImageURL) + err = d.TemplateClient.CreateTemplate(ctx, d.HardwareRef.Namespace) if err != nil { return nil, err } // Create Workflow to match the template and server server := tinktypes.Hardware{Hardware: hardware} - if err = d.WorkflowClient.CreateWorkflow(ctx, userdata, client.ProvisionWorkerNodeTemplate, server); err != nil { + if err = d.WorkflowClient.CreateWorkflow(ctx, userdata, client.ProvisionWorkerNodeTemplate, d.OSImageURL, server); err != nil { return nil, err } From c7a24ffe63c7d1d8904fcea1d3eb32ca05f49571 Mon Sep 17 00:00:00 2001 From: Kubermatic Bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Wed, 11 Jun 2025 09:31:22 +0200 Subject: [PATCH 7/7] fix AMI query for Ubuntu images (#1929) Co-authored-by: Christoph Mewes --- pkg/cloudprovider/provider/aws/provider.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cloudprovider/provider/aws/provider.go b/pkg/cloudprovider/provider/aws/provider.go index 4dba90c62..374f6e9c2 100644 --- a/pkg/cloudprovider/provider/aws/provider.go +++ b/pkg/cloudprovider/provider/aws/provider.go @@ -132,7 +132,7 @@ var ( providerconfigtypes.OperatingSystemUbuntu: { awstypes.CPUArchitectureX86_64: { // Be as precise as possible - otherwise we might get a nightly dev build - description: "Canonical, Ubuntu, 24.04 LTS, amd64 noble image build on ????-??-??", + description: "Canonical, Ubuntu, 24.04, amd64 noble image", // The AWS marketplace ID from Canonical owner: "099720109477", },