Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CentOS support from machine controller #1876

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/howto-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/openstack-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
28 changes: 13 additions & 15 deletions docs/operating-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@

### 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

The operating system to use can be set via `machine.spec.providerConfig.operatingSystem`.
Allowed values:

- `amzn2`
- `centos`
- `flatcar`
- `rhel`
- `rockylinux`
Expand All @@ -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 |
8 changes: 1 addition & 7 deletions docs/vsphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
```
Expand Down Expand Up @@ -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: <https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2r>.

Follow [qcow2](#create-template-vm-from-qcow2) template VM creation guide.

## Provider configuration

VSphere provider accepts the following configuration parameters:
Expand Down
1 change: 0 additions & 1 deletion examples/digitalocean-machinedeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ spec:
monitoring: false
tags:
- "machine-controller"
# Can be 'ubuntu' or 'centos'
operatingSystem: "ubuntu"
operatingSystemSpec:
disableAutoUpdate: true
Expand Down
2 changes: 1 addition & 1 deletion examples/kubevirt-machinedeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion examples/openstack-machinedeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions examples/operating-system-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ spec:
enum:
- flatcar
- rhel
- centos
- ubuntu
- amzn2
- rockylinux
Expand Down Expand Up @@ -683,7 +682,6 @@ spec:
enum:
- flatcar
- rhel
- centos
- ubuntu
- amzn2
- rockylinux
Expand Down
1 change: 0 additions & 1 deletion examples/scaleway-machinedeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ spec:
ipv6: false
tags:
- "machine-controller"
# Can be 'ubuntu' or 'centos'
operatingSystem: "ubuntu"
operatingSystemSpec:
disableAutoUpdate: true
Expand Down
2 changes: 1 addition & 1 deletion hack/build-kubevirt-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
1 change: 0 additions & 1 deletion hack/e2e-setup-openstack-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions hack/kubevirt_dockerfiles/dockerfile.centos

This file was deleted.

12 changes: 0 additions & 12 deletions hack/setup-openstack-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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..."
6 changes: 2 additions & 4 deletions image-builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
35 changes: 3 additions & 32 deletions image-builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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"
;;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions pkg/cloudprovider/provider/alibaba/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
}

Expand Down
15 changes: 0 additions & 15 deletions pkg/cloudprovider/provider/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions pkg/cloudprovider/provider/azure/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 0 additions & 2 deletions pkg/cloudprovider/provider/digitalocean/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/cloudprovider/provider/equinixmetal/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,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:
Expand Down
2 changes: 0 additions & 2 deletions pkg/cloudprovider/provider/hetzner/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion pkg/cloudprovider/provider/kubevirt/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
)

var SupportedOS = map[providerconfigtypes.OperatingSystem]*struct{}{
providerconfigtypes.OperatingSystemCentOS: nil,
providerconfigtypes.OperatingSystemUbuntu: nil,
providerconfigtypes.OperatingSystemRHEL: nil,
providerconfigtypes.OperatingSystemFlatcar: nil,
Expand Down
Loading