diff --git a/packaging/flavorgen/flavors/generators.go b/packaging/flavorgen/flavors/generators.go index c8dfbdf730..7880cfd453 100644 --- a/packaging/flavorgen/flavors/generators.go +++ b/packaging/flavorgen/flavors/generators.go @@ -96,7 +96,10 @@ systemd: After=containerd.service [Service] # Make metadata environment variables available for pre-kubeadm commands. - EnvironmentFile=/run/metadata/*` + EnvironmentFile=/run/metadata/* + # Log to file + StandardOutput=append:/var/log/kubeadm-service.log + StandardError=inherit` ) func newClusterTopologyCluster(supervisorMode bool) (clusterv1.Cluster, error) { diff --git a/templates/cluster-template-ignition.yaml b/templates/cluster-template-ignition.yaml index 80ae91cab6..ba0c4062f7 100644 --- a/templates/cluster-template-ignition.yaml +++ b/templates/cluster-template-ignition.yaml @@ -261,6 +261,9 @@ spec: [Service] # Make metadata environment variables available for pre-kubeadm commands. EnvironmentFile=/run/metadata/* + # Log to file + StandardOutput=append:/var/log/kubeadm-service.log + StandardError=inherit initConfiguration: nodeRegistration: criSocket: /var/run/containerd/containerd.sock @@ -361,6 +364,9 @@ spec: [Service] # Make metadata environment variables available for pre-kubeadm commands. EnvironmentFile=/run/metadata/* + # Log to file + StandardOutput=append:/var/log/kubeadm-service.log + StandardError=inherit joinConfiguration: nodeRegistration: criSocket: /var/run/containerd/containerd.sock diff --git a/test/e2e/data/infrastructure-vsphere-govmomi/main/base/patch-k8s-install-script-kcp.yaml b/test/e2e/data/infrastructure-vsphere-govmomi/main/base/patch-k8s-install-script-kcp.yaml index 12c33d21a9..942726508c 100644 --- a/test/e2e/data/infrastructure-vsphere-govmomi/main/base/patch-k8s-install-script-kcp.yaml +++ b/test/e2e/data/infrastructure-vsphere-govmomi/main/base/patch-k8s-install-script-kcp.yaml @@ -10,6 +10,16 @@ set -o nounset set -o pipefail set -o errexit + + DISTRO="ubuntu" + KUBE_BINARY_DIR="/usr/bin" + + source /etc/lsb-release + if [[ "$${DISTRIB_ID}" == *Flatcar* ]]; then + # Overrides for flatcar + DISTRO="flatcar" + KUBE_BINARY_DIR="/opt/bin" + fi function retry { attempt=0 @@ -55,7 +65,7 @@ CONTAINER_EXT="tar" echo "* testing CI version $${KUBERNETES_VERSION}" # Check for semver - if [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$${DISTRO}" == "ubuntu" ]] && [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then CI_URL="https://dl.k8s.io/release/$${KUBERNETES_VERSION}/bin/linux/amd64" VERSION_WITHOUT_PREFIX="$${KUBERNETES_VERSION#v}" export DEBIAN_FRONTEND=noninteractive @@ -87,7 +97,7 @@ echo "* downloading binary: $${CI_URL}/$${CI_PACKAGE}" wget "$${CI_URL}/$${CI_PACKAGE}" -O "$${CI_DIR}/$${CI_PACKAGE}" chmod +x "$${CI_DIR}/$${CI_PACKAGE}" - mv "$${CI_DIR}/$${CI_PACKAGE}" "/usr/bin/$${CI_PACKAGE}" + mv "$${CI_DIR}/$${CI_PACKAGE}" "$${KUBE_BINARY_DIR}/$${CI_PACKAGE}" done systemctl restart kubelet fi diff --git a/test/e2e/data/infrastructure-vsphere-govmomi/main/base/patch-k8s-install-script-kct.yaml b/test/e2e/data/infrastructure-vsphere-govmomi/main/base/patch-k8s-install-script-kct.yaml index 75f62edc3e..ab0fed842a 100644 --- a/test/e2e/data/infrastructure-vsphere-govmomi/main/base/patch-k8s-install-script-kct.yaml +++ b/test/e2e/data/infrastructure-vsphere-govmomi/main/base/patch-k8s-install-script-kct.yaml @@ -13,6 +13,16 @@ set -o nounset set -o pipefail set -o errexit + + DISTRO="ubuntu" + KUBE_BINARY_DIR="/usr/bin" + + source /etc/lsb-release + if [[ "$${DISTRIB_ID}" == *Flatcar* ]]; then + # Overrides for flatcar + DISTRO="flatcar" + KUBE_BINARY_DIR="/opt/bin" + fi function retry { attempt=0 @@ -58,7 +68,7 @@ CONTAINER_EXT="tar" echo "* testing CI version $${KUBERNETES_VERSION}" # Check for semver - if [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$${DISTRO}" == "ubuntu" ]] && [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then CI_URL="https://dl.k8s.io/release/$${KUBERNETES_VERSION}/bin/linux/amd64" VERSION_WITHOUT_PREFIX="$${KUBERNETES_VERSION#v}" export DEBIAN_FRONTEND=noninteractive @@ -90,7 +100,7 @@ echo "* downloading binary: $${CI_URL}/$${CI_PACKAGE}" wget "$${CI_URL}/$${CI_PACKAGE}" -O "$${CI_DIR}/$${CI_PACKAGE}" chmod +x "$${CI_DIR}/$${CI_PACKAGE}" - mv "$${CI_DIR}/$${CI_PACKAGE}" "/usr/bin/$${CI_PACKAGE}" + mv "$${CI_DIR}/$${CI_PACKAGE}" "$${KUBE_BINARY_DIR}/$${CI_PACKAGE}" done systemctl restart kubelet fi diff --git a/test/e2e/data/infrastructure-vsphere-govmomi/main/clusterclass/patch-k8s-install-script.yaml b/test/e2e/data/infrastructure-vsphere-govmomi/main/clusterclass/patch-k8s-install-script.yaml index 83d4461dda..ffb860483a 100644 --- a/test/e2e/data/infrastructure-vsphere-govmomi/main/clusterclass/patch-k8s-install-script.yaml +++ b/test/e2e/data/infrastructure-vsphere-govmomi/main/clusterclass/patch-k8s-install-script.yaml @@ -16,6 +16,16 @@ set -o nounset set -o pipefail set -o errexit + + DISTRO="ubuntu" + KUBE_BINARY_DIR="/usr/bin" + + source /etc/lsb-release + if [[ "$${DISTRIB_ID}" == *Flatcar* ]]; then + # Overrides for flatcar + DISTRO="flatcar" + KUBE_BINARY_DIR="/opt/bin" + fi function retry { attempt=0 @@ -61,7 +71,7 @@ CONTAINER_EXT="tar" echo "* testing CI version $${KUBERNETES_VERSION}" # Check for semver - if [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$${DISTRO}" == "ubuntu" ]] && [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then CI_URL="https://dl.k8s.io/release/$${KUBERNETES_VERSION}/bin/linux/amd64" VERSION_WITHOUT_PREFIX="$${KUBERNETES_VERSION#v}" export DEBIAN_FRONTEND=noninteractive @@ -93,7 +103,7 @@ echo "* downloading binary: $${CI_URL}/$${CI_PACKAGE}" wget "$${CI_URL}/$${CI_PACKAGE}" -O "$${CI_DIR}/$${CI_PACKAGE}" chmod +x "$${CI_DIR}/$${CI_PACKAGE}" - mv "$${CI_DIR}/$${CI_PACKAGE}" "/usr/bin/$${CI_PACKAGE}" + mv "$${CI_DIR}/$${CI_PACKAGE}" "$${KUBE_BINARY_DIR}/$${CI_PACKAGE}" done systemctl restart kubelet fi @@ -136,6 +146,16 @@ set -o nounset set -o pipefail set -o errexit + + DISTRO="ubuntu" + KUBE_BINARY_DIR="/usr/bin" + + source /etc/lsb-release + if [[ "$${DISTRIB_ID}" == *Flatcar* ]]; then + # Overrides for flatcar + DISTRO="flatcar" + KUBE_BINARY_DIR="/opt/bin" + fi function retry { attempt=0 @@ -181,7 +201,7 @@ CONTAINER_EXT="tar" echo "* testing CI version $${KUBERNETES_VERSION}" # Check for semver - if [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$${DISTRO}" == "ubuntu" ]] && [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then CI_URL="https://dl.k8s.io/release/$${KUBERNETES_VERSION}/bin/linux/amd64" VERSION_WITHOUT_PREFIX="$${KUBERNETES_VERSION#v}" export DEBIAN_FRONTEND=noninteractive @@ -213,7 +233,7 @@ echo "* downloading binary: $${CI_URL}/$${CI_PACKAGE}" wget "$${CI_URL}/$${CI_PACKAGE}" -O "$${CI_DIR}/$${CI_PACKAGE}" chmod +x "$${CI_DIR}/$${CI_PACKAGE}" - mv "$${CI_DIR}/$${CI_PACKAGE}" "/usr/bin/$${CI_PACKAGE}" + mv "$${CI_DIR}/$${CI_PACKAGE}" "$${KUBE_BINARY_DIR}/$${CI_PACKAGE}" done systemctl restart kubelet fi diff --git a/test/e2e/data/infrastructure-vsphere-supervisor/main/base/patch-k8s-install-script-kcp.yaml b/test/e2e/data/infrastructure-vsphere-supervisor/main/base/patch-k8s-install-script-kcp.yaml index 12c33d21a9..942726508c 100644 --- a/test/e2e/data/infrastructure-vsphere-supervisor/main/base/patch-k8s-install-script-kcp.yaml +++ b/test/e2e/data/infrastructure-vsphere-supervisor/main/base/patch-k8s-install-script-kcp.yaml @@ -10,6 +10,16 @@ set -o nounset set -o pipefail set -o errexit + + DISTRO="ubuntu" + KUBE_BINARY_DIR="/usr/bin" + + source /etc/lsb-release + if [[ "$${DISTRIB_ID}" == *Flatcar* ]]; then + # Overrides for flatcar + DISTRO="flatcar" + KUBE_BINARY_DIR="/opt/bin" + fi function retry { attempt=0 @@ -55,7 +65,7 @@ CONTAINER_EXT="tar" echo "* testing CI version $${KUBERNETES_VERSION}" # Check for semver - if [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$${DISTRO}" == "ubuntu" ]] && [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then CI_URL="https://dl.k8s.io/release/$${KUBERNETES_VERSION}/bin/linux/amd64" VERSION_WITHOUT_PREFIX="$${KUBERNETES_VERSION#v}" export DEBIAN_FRONTEND=noninteractive @@ -87,7 +97,7 @@ echo "* downloading binary: $${CI_URL}/$${CI_PACKAGE}" wget "$${CI_URL}/$${CI_PACKAGE}" -O "$${CI_DIR}/$${CI_PACKAGE}" chmod +x "$${CI_DIR}/$${CI_PACKAGE}" - mv "$${CI_DIR}/$${CI_PACKAGE}" "/usr/bin/$${CI_PACKAGE}" + mv "$${CI_DIR}/$${CI_PACKAGE}" "$${KUBE_BINARY_DIR}/$${CI_PACKAGE}" done systemctl restart kubelet fi diff --git a/test/e2e/data/infrastructure-vsphere-supervisor/main/base/patch-k8s-install-script-kct.yaml b/test/e2e/data/infrastructure-vsphere-supervisor/main/base/patch-k8s-install-script-kct.yaml index 75f62edc3e..ab0fed842a 100644 --- a/test/e2e/data/infrastructure-vsphere-supervisor/main/base/patch-k8s-install-script-kct.yaml +++ b/test/e2e/data/infrastructure-vsphere-supervisor/main/base/patch-k8s-install-script-kct.yaml @@ -13,6 +13,16 @@ set -o nounset set -o pipefail set -o errexit + + DISTRO="ubuntu" + KUBE_BINARY_DIR="/usr/bin" + + source /etc/lsb-release + if [[ "$${DISTRIB_ID}" == *Flatcar* ]]; then + # Overrides for flatcar + DISTRO="flatcar" + KUBE_BINARY_DIR="/opt/bin" + fi function retry { attempt=0 @@ -58,7 +68,7 @@ CONTAINER_EXT="tar" echo "* testing CI version $${KUBERNETES_VERSION}" # Check for semver - if [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$${DISTRO}" == "ubuntu" ]] && [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then CI_URL="https://dl.k8s.io/release/$${KUBERNETES_VERSION}/bin/linux/amd64" VERSION_WITHOUT_PREFIX="$${KUBERNETES_VERSION#v}" export DEBIAN_FRONTEND=noninteractive @@ -90,7 +100,7 @@ echo "* downloading binary: $${CI_URL}/$${CI_PACKAGE}" wget "$${CI_URL}/$${CI_PACKAGE}" -O "$${CI_DIR}/$${CI_PACKAGE}" chmod +x "$${CI_DIR}/$${CI_PACKAGE}" - mv "$${CI_DIR}/$${CI_PACKAGE}" "/usr/bin/$${CI_PACKAGE}" + mv "$${CI_DIR}/$${CI_PACKAGE}" "$${KUBE_BINARY_DIR}/$${CI_PACKAGE}" done systemctl restart kubelet fi diff --git a/test/e2e/data/infrastructure-vsphere-supervisor/main/clusterclass/patch-k8s-install-script.yaml b/test/e2e/data/infrastructure-vsphere-supervisor/main/clusterclass/patch-k8s-install-script.yaml index 83d4461dda..ffb860483a 100644 --- a/test/e2e/data/infrastructure-vsphere-supervisor/main/clusterclass/patch-k8s-install-script.yaml +++ b/test/e2e/data/infrastructure-vsphere-supervisor/main/clusterclass/patch-k8s-install-script.yaml @@ -16,6 +16,16 @@ set -o nounset set -o pipefail set -o errexit + + DISTRO="ubuntu" + KUBE_BINARY_DIR="/usr/bin" + + source /etc/lsb-release + if [[ "$${DISTRIB_ID}" == *Flatcar* ]]; then + # Overrides for flatcar + DISTRO="flatcar" + KUBE_BINARY_DIR="/opt/bin" + fi function retry { attempt=0 @@ -61,7 +71,7 @@ CONTAINER_EXT="tar" echo "* testing CI version $${KUBERNETES_VERSION}" # Check for semver - if [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$${DISTRO}" == "ubuntu" ]] && [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then CI_URL="https://dl.k8s.io/release/$${KUBERNETES_VERSION}/bin/linux/amd64" VERSION_WITHOUT_PREFIX="$${KUBERNETES_VERSION#v}" export DEBIAN_FRONTEND=noninteractive @@ -93,7 +103,7 @@ echo "* downloading binary: $${CI_URL}/$${CI_PACKAGE}" wget "$${CI_URL}/$${CI_PACKAGE}" -O "$${CI_DIR}/$${CI_PACKAGE}" chmod +x "$${CI_DIR}/$${CI_PACKAGE}" - mv "$${CI_DIR}/$${CI_PACKAGE}" "/usr/bin/$${CI_PACKAGE}" + mv "$${CI_DIR}/$${CI_PACKAGE}" "$${KUBE_BINARY_DIR}/$${CI_PACKAGE}" done systemctl restart kubelet fi @@ -136,6 +146,16 @@ set -o nounset set -o pipefail set -o errexit + + DISTRO="ubuntu" + KUBE_BINARY_DIR="/usr/bin" + + source /etc/lsb-release + if [[ "$${DISTRIB_ID}" == *Flatcar* ]]; then + # Overrides for flatcar + DISTRO="flatcar" + KUBE_BINARY_DIR="/opt/bin" + fi function retry { attempt=0 @@ -181,7 +201,7 @@ CONTAINER_EXT="tar" echo "* testing CI version $${KUBERNETES_VERSION}" # Check for semver - if [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$${DISTRO}" == "ubuntu" ]] && [[ "$${KUBERNETES_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then CI_URL="https://dl.k8s.io/release/$${KUBERNETES_VERSION}/bin/linux/amd64" VERSION_WITHOUT_PREFIX="$${KUBERNETES_VERSION#v}" export DEBIAN_FRONTEND=noninteractive @@ -213,7 +233,7 @@ echo "* downloading binary: $${CI_URL}/$${CI_PACKAGE}" wget "$${CI_URL}/$${CI_PACKAGE}" -O "$${CI_DIR}/$${CI_PACKAGE}" chmod +x "$${CI_DIR}/$${CI_PACKAGE}" - mv "$${CI_DIR}/$${CI_PACKAGE}" "/usr/bin/$${CI_PACKAGE}" + mv "$${CI_DIR}/$${CI_PACKAGE}" "$${KUBE_BINARY_DIR}/$${CI_PACKAGE}" done systemctl restart kubelet fi diff --git a/test/framework/log/collector.go b/test/framework/log/collector.go index fcb540ff23..f31e248e7d 100644 --- a/test/framework/log/collector.go +++ b/test/framework/log/collector.go @@ -93,6 +93,8 @@ func (c *MachineLogCollector) CollectMachineLog(ctx context.Context, _ client.Cl "sudo", "cat", "/var/log/cloud-init.log"), captureLogs("cloud-init-output.log", "sudo", "cat", "/var/log/cloud-init-output.log"), + captureLogs("kubeadm-service.log", + "sudo", "cat", "/var/log/kubeadm-service.log"), ) }