diff --git a/kola/tests/kubeadm/checksums.sh b/kola/tests/kubeadm/checksums.sh deleted file mode 100755 index 72484e969..000000000 --- a/kola/tests/kubeadm/checksums.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -fail() { - IFS=' ' echo "$*" >&2 - exit 1 -} - -# no limit by default -limit='' -for arg; do - case "${arg}" in - -h|--help) - echo 'Prints various checksums of binaries used in kubeadm tests. - -Parameters: - -h --help Print this help. - -N, where N is a number Print checksums only for the first N entries - in the testConfig map in kubeadm.go. - -Workflow when updating a version of Kubernetes or other binaries: -- update versions in a chosen entry in the testConfig map in kubeadm.go -- run the script -- paste the checksums into appriopriate places in the modified entry in kubeadm.go - -Workflow when adding a new Kubernetes version to test: -- copy the first entry in testConfig in kubeadm.go -- update the versions in the new entry -- leave the checksums as they are -- run the script -- paste the checksums into appriopriate places in the new entry in kubeadm.go -' - exit 0 - ;; - -*) - if [[ ! "${1}" =~ ^-[0-9]+$ ]]; then - fail 'Invalid flag to limit k8s versions, must be in form of -.' - fi - limit="${1//-/}" - ;; - *) - fail "Unknown argument '${arg}', call the script with -h to see the synopsis." - ;; - esac -done - -tuples=( - "KubeadmSum^https://storage.googleapis.com/kubernetes-release/release/%K8S_VER%/bin/linux/%ARCH%/kubeadm" - "KubeletSum^https://storage.googleapis.com/kubernetes-release/release/%K8S_VER%/bin/linux/%ARCH%/kubelet" - "CRIctlSum^https://github.com/kubernetes-sigs/cri-tools/releases/download/%CRICTL_VER%/crictl-%CRICTL_VER%-linux-%ARCH%.tar.gz" - "CNISum^https://github.com/containernetworking/plugins/releases/download/%CNI_VER%/cni-plugins-linux-%ARCH%-%CNI_VER%.tgz" - "KubectlSum^https://storage.googleapis.com/kubernetes-release/release/%K8S_VER%/bin/linux/%ARCH%/kubectl" -) - -this_dir=$(dirname "${0}") -kubeadm_go="${this_dir}/kubeadm.go" -version_pattern='v[0-9]\+\.[0-9]\+\.[0-9]\+' - -get_full_pattern() { - string_type="\[string\]" - if [[ "${1}" = '-F' ]]; then - string_type="[string]" - shift - fi - local version_part="${1}"; shift - echo "\"${version_part}\": map${string_type}interface{}{" -} - -full_pattern=$(get_full_pattern "${version_pattern}") - -k8s_releases=( $(grep -e "${full_pattern}" "${kubeadm_go}" | grep -oe "${version_pattern}") ) - -do_subs() { - local template="${1}"; shift - local key - local value - local -a kva - local result="${template}" - - for kv; do - kva=( ${kv//:/ } ) - key="%${kva[0]}%" - value="${kva[1]}" - result="${result//${key}/${value}}" - done - - echo "${result}" -} - -counter=0 -for k8s_release in "${k8s_releases[@]}"; do - if [[ -n "${limit}" ]] && [[ ! ${counter} -lt ${limit} ]]; then - break - fi - ((++counter)) - fixed_pattern=$(get_full_pattern -F "${k8s_release}") - output=$(grep -F -A 14 -e "${fixed_pattern}" "${kubeadm_go}") - cni_version=$(grep -F CNIVersion <<<"${output}" | sed -e 's/.*":\s\+"\([^"]\+\)".*/\1/') - crictl_version=$(grep -F CRIctlVersion <<<"${output}" | sed -e 's/.*":\s\+"\([^"]\+\)".*/\1/') - for arch in arm64 amd64; do - echo "K8s ${k8s_release}, arch ${arch}" - for tuple in "${tuples[@]}"; do - tuple=( ${tuple//^/ } ) - key="${tuple[0]}" - url_template="${tuple[1]}" - url=$(do_subs "${url_template}" "K8S_VER:${k8s_release}" "ARCH:${arch}" "CNI_VER:${cni_version}" "CRICTL_VER:${crictl_version}") - sum=$(curl -s -S -f -L "${url}" | sha512sum | cut -f1 -d' ') - echo "\"${key}\": \"${sum}\"," - done - echo - done -done diff --git a/kola/tests/kubeadm/kubeadm.go b/kola/tests/kubeadm/kubeadm.go index ec1128442..4bd75cc7b 100644 --- a/kola/tests/kubeadm/kubeadm.go +++ b/kola/tests/kubeadm/kubeadm.go @@ -57,7 +57,7 @@ var ( cidr := params["PodSubnet"].(string) cmd := fmt.Sprintf("/opt/bin/cilium install --config enable-endpoint-routes=true --config cluster-pool-ipv4-cidr=%s --version=%s --encryption=ipsec --wait=false --restart-unmanaged-pods=false --rollback=false", cidr, version) _, _ = c.SSH(controller, cmd) - patch := `{ grep -q svirt_lxc_file_t /etc/selinux/mcs/contexts/lxc_contexts && /opt/bin/kubectl --namespace kube-system patch daemonset/cilium -p '{"spec":{"template":{"spec":{"containers":[{"name":"cilium-agent","securityContext":{"seLinuxOptions":{"level":"s0","type":"unconfined_t"}}}],"initContainers":[{"name":"mount-cgroup","securityContext":{"seLinuxOptions":{"level":"s0","type":"unconfined_t"}}},{"name":"apply-sysctl-overwrites","securityContext":{"seLinuxOptions":{"level":"s0","type":"unconfined_t"}}},{"name":"clean-cilium-state","securityContext":{"seLinuxOptions":{"level":"s0","type":"unconfined_t"}}}]}}}}'; } || true` + patch := `{ grep -q svirt_lxc_file_t /etc/selinux/mcs/contexts/lxc_contexts && kubectl --namespace kube-system patch daemonset/cilium -p '{"spec":{"template":{"spec":{"containers":[{"name":"cilium-agent","securityContext":{"seLinuxOptions":{"level":"s0","type":"unconfined_t"}}}],"initContainers":[{"name":"mount-cgroup","securityContext":{"seLinuxOptions":{"level":"s0","type":"unconfined_t"}}},{"name":"apply-sysctl-overwrites","securityContext":{"seLinuxOptions":{"level":"s0","type":"unconfined_t"}}},{"name":"clean-cilium-state","securityContext":{"seLinuxOptions":{"level":"s0","type":"unconfined_t"}}}]}}}}'; } || true` _ = c.MustSSH(controller, patch) status := "/opt/bin/cilium status --wait --wait-duration 1m" _ = c.MustSSH(controller, status) @@ -85,33 +85,11 @@ var ( "CiliumVersion": "1.12.5", // from https://github.com/cilium/cilium-cli/releases "CiliumCLIVersion": "v0.12.12", - // from https://github.com/containernetworking/plugins/releases - "CNIVersion": "v1.3.0", - // from https://github.com/kubernetes-sigs/cri-tools/releases - "CRIctlVersion": "v1.27.0", - // from https://github.com/kubernetes/release/releases - "ReleaseVersion": "v0.15.1", - "DownloadDir": "/opt/bin", - "PodSubnet": "192.168.0.0/17", - "arm64": map[string]string{ - "KubeadmSum": "3e6beeb7794aa002604f0be43af0255e707846760508ebe98006ec72ae8d7a7cf2c14fd52bbcc5084f0e9366b992dc64341b1da646f1ce6e937fb762f880dc15", - "KubeletSum": "ded47d757fac0279b1b784756fb54b3a5cb0180ce45833838b00d6d7c87578a985e4627503dd7ff734e5f577cf4752ae7daaa2b68e5934fd4617ea15e995f91b", - - "CRIctlSum": "db062e43351a63347871e7094115be2ae3853afcd346d47f7b51141da8c3202c2df58d2e17359322f632abcb37474fd7fdb3b7aadbc5cfd5cf6d3bad040b6251", - - "CNISum": "b2b7fb74f1b3cb8928f49e5bf9d4bc686e057e837fac3caf1b366d54757921dba80d70cc010399b274d136e8dee9a25b1ad87cdfdc4ffcf42cf88f3e8f99587a", - "KubectlSum": "b303598f3a65bbc366a7bfb4632d3b5cdd2d41b8a7973de80a99f8b1bb058299b57dc39b17a53eb7a54f1a0479ae4e2093fec675f1baff4613e14e0ed9d65c21", - }, - "amd64": map[string]string{ - "KubeadmSum": "4261cb0319688a0557b3052cce8df9d754abc38d5fc8e0eeeb63a85a2194895fdca5bad464f8516459ed7b1764d7bbb2304f5f434d42bb35f38764b4b00ce663", - "KubeletSum": "d3fef1d4b99415179ecb94d4de953bddb74c0fb0f798265829b899bb031e2ab8c2b60037b79a66405a9b102d3db0d90e9257595f4b11660356de0e2e63744cd7", - "CRIctlSum": "aa622325bf05520939f9e020d7a28ab48ac23e2fae6f47d5a4e52174c88c1ebc31b464853e4fd65bd8f5331f330a6ca96fd370d247d3eeaed042da4ee2d1219a", - "CNISum": "5d0324ca8a3c90c680b6e1fddb245a2255582fa15949ba1f3c6bb7323df9d3af754dae98d6e40ac9ccafb2999c932df2c4288d418949a4915d928eb23c090540", - "KubectlSum": "a2de71807eb4c41f4d70e5c47fac72ecf3c74984be6c08be0597fc58621baeeddc1b5cc6431ab007eee9bd0a98f8628dd21512b06daaeccfac5837e9792a98a7", - }, - "cgroupv1": false, + "DownloadDir": "/opt/bin", + "PodSubnet": "192.168.0.0/17", + "cgroupv1": false, }, - "v1.28.1": map[string]interface{}{ + "v1.28.7": map[string]interface{}{ "HelmVersion": "v3.13.2", "MinMajorVersion": 3374, // from https://github.com/flannel-io/flannel/releases @@ -120,31 +98,11 @@ var ( "CiliumVersion": "1.12.5", // from https://github.com/cilium/cilium-cli/releases "CiliumCLIVersion": "v0.12.12", - // from https://github.com/containernetworking/plugins/releases - "CNIVersion": "v1.3.0", - // from https://github.com/kubernetes-sigs/cri-tools/releases - "CRIctlVersion": "v1.27.0", - // from https://github.com/kubernetes/release/releases - "ReleaseVersion": "v0.15.1", - "DownloadDir": "/opt/bin", - "PodSubnet": "192.168.0.0/17", - "arm64": map[string]string{ - "KubeadmSum": "5a08b81f9cc82d3cce21130856ca63b8dafca9149d9775dd25b376eb0f18209aa0e4a47c0a6d7e6fb1316aacd5d59dec770f26c09120c866949d70bc415518b3", - "KubeletSum": "5a898ef543a6482895101ea58e33602e3c0a7682d322aaf08ac3dc8a5a3c8da8f09600d577024549288f8cebb1a86f9c79927796b69a3d8fe989ca8f12b147d6", - "CRIctlSum": "db062e43351a63347871e7094115be2ae3853afcd346d47f7b51141da8c3202c2df58d2e17359322f632abcb37474fd7fdb3b7aadbc5cfd5cf6d3bad040b6251", - "CNISum": "b2b7fb74f1b3cb8928f49e5bf9d4bc686e057e837fac3caf1b366d54757921dba80d70cc010399b274d136e8dee9a25b1ad87cdfdc4ffcf42cf88f3e8f99587a", - "KubectlSum": "6a5c9c02a29126949f096415bb1761a0c0ad44168e2ab3d0409982701da58f96223bec354828ddf958e945ef1ce63c0ad41e77cbcbcce0756163e71b4fbae432", - }, - "amd64": map[string]string{ - "KubeadmSum": "f4daad200c8378dfdc6cb69af28eaca4215f2b4a2dbdf75f29f9210171cb5683bc873fc000319022e6b3ad61175475d77190734713ba9136644394e8a8faafa1", - "KubeletSum": "ce6ba764274162d38ac1c44e1fb1f0f835346f3afc5b508bb755b1b7d7170910f5812b0a1941b32e29d950e905bbd08ae761c87befad921db4d44969c8562e75", - "CRIctlSum": "aa622325bf05520939f9e020d7a28ab48ac23e2fae6f47d5a4e52174c88c1ebc31b464853e4fd65bd8f5331f330a6ca96fd370d247d3eeaed042da4ee2d1219a", - "CNISum": "5d0324ca8a3c90c680b6e1fddb245a2255582fa15949ba1f3c6bb7323df9d3af754dae98d6e40ac9ccafb2999c932df2c4288d418949a4915d928eb23c090540", - "KubectlSum": "33cf3f6e37bcee4dff7ce14ab933c605d07353d4e31446dd2b52c3f05e0b150b60e531f6069f112d8a76331322a72b593537531e62104cfc7c70cb03d46f76b3", - }, - "cgroupv1": false, + "DownloadDir": "/opt/bin", + "PodSubnet": "192.168.0.0/17", + "cgroupv1": false, }, - "v1.27.2": map[string]interface{}{ + "v1.27.6": map[string]interface{}{ "HelmVersion": "v3.13.2", "MinMajorVersion": 3374, // from https://github.com/flannel-io/flannel/releases @@ -153,29 +111,9 @@ var ( "CiliumVersion": "1.12.5", // from https://github.com/cilium/cilium-cli/releases "CiliumCLIVersion": "v0.12.12", - // from https://github.com/containernetworking/plugins/releases - "CNIVersion": "v1.3.0", - // from https://github.com/kubernetes-sigs/cri-tools/releases - "CRIctlVersion": "v1.27.0", - // from https://github.com/kubernetes/release/releases - "ReleaseVersion": "v0.15.1", - "DownloadDir": "/opt/bin", - "PodSubnet": "192.168.0.0/17", - "arm64": map[string]string{ - "KubeadmSum": "45b3100984c979ba0f1c0df8f4211474c2d75ebe916e677dff5fc8e3b3697cf7a953da94e356f39684cc860dff6878b772b7514c55651c2f866d9efeef23f970", - "KubeletSum": "71857ff499ae135fa478e1827a0ed8865e578a8d2b1e25876e914fd0beba03733801c0654bcd4c0567bafeb16887dafb2dbbe8d1116e6ea28dcd8366c142d348", - "CRIctlSum": "db062e43351a63347871e7094115be2ae3853afcd346d47f7b51141da8c3202c2df58d2e17359322f632abcb37474fd7fdb3b7aadbc5cfd5cf6d3bad040b6251", - "CNISum": "b2b7fb74f1b3cb8928f49e5bf9d4bc686e057e837fac3caf1b366d54757921dba80d70cc010399b274d136e8dee9a25b1ad87cdfdc4ffcf42cf88f3e8f99587a", - "KubectlSum": "14be61ec35669a27acf2df0380afb85b9b42311d50ca1165718421c5f605df1119ec9ae314696a674051712e80deeaa65e62d2d62ed4d107fe99d0aaf419dafc", - }, - "amd64": map[string]string{ - "KubeadmSum": "f40216b7d14046931c58072d10c7122934eac5a23c08821371f8b08ac1779443ad11d3458a4c5dcde7cf80fc600a9fefb14b1942aa46a52330248d497ca88836", - "KubeletSum": "a283da2224d456958b2cb99b4f6faf4457c4ed89e9e95f37d970c637f6a7f64ff4dd4d2bfce538759b2d2090933bece599a285ef8fd132eb383fece9a3941560", - "CRIctlSum": "aa622325bf05520939f9e020d7a28ab48ac23e2fae6f47d5a4e52174c88c1ebc31b464853e4fd65bd8f5331f330a6ca96fd370d247d3eeaed042da4ee2d1219a", - "CNISum": "5d0324ca8a3c90c680b6e1fddb245a2255582fa15949ba1f3c6bb7323df9d3af754dae98d6e40ac9ccafb2999c932df2c4288d418949a4915d928eb23c090540", - "KubectlSum": "857e67001e74840518413593d90c6e64ad3f00d55fa44ad9a8e2ed6135392c908caff7ec19af18cbe10784b8f83afe687a0bc3bacbc9eee984cdeb9c0749cb83", - }, - "cgroupv1": false, + "DownloadDir": "/opt/bin", + "PodSubnet": "192.168.0.0/17", + "cgroupv1": false, }, } plog = capnslog.NewPackageLogger("github.com/flatcar/mantle", "kola/tests/kubeadm") @@ -187,11 +125,11 @@ etcd: func init() { testConfigCgroupV1 := map[string]map[string]interface{}{} - testConfigCgroupV1["v1.27.2"] = map[string]interface{}{} - for k, v := range testConfig["v1.27.2"] { - testConfigCgroupV1["v1.27.2"][k] = v + testConfigCgroupV1["v1.27.6"] = map[string]interface{}{} + for k, v := range testConfig["v1.27.6"] { + testConfigCgroupV1["v1.27.6"][k] = v } - testConfigCgroupV1["v1.27.2"]["cgroupv1"] = true + testConfigCgroupV1["v1.27.6"]["cgroupv1"] = true registerTests := func(config map[string]map[string]interface{}) { for version, params := range config { @@ -244,8 +182,8 @@ func init() { // https://github.com/flatcar/coreos-overlay/pull/1848/commits/9e04bc12c3c7eb38da05173dc0ff7beaefa13446 // Let's skip this test for < 3034 on ESX // * For Cilium Calico/CNI on Brightbox: - // unprocessable_entity: User data is too long (maximum is 16384 characters) - // Should be reenabled once we switch to Butane provisioning because of internal compression. + // unprocessable_entity: User data is too long (maximum is 16384 characters) + // Should be reenabled once we switch to Butane provisioning because of internal compression. return (version.LessThan(semver.Version{Major: 3034}) && platform == "esx") || (platform == "brightbox" && (cni == "cilium" || cni == "calico")) }, @@ -271,7 +209,7 @@ func kubeadmBaseTest(c cluster.TestCluster, params map[string]interface{}) { if err := util.Retry(36, 5*time.Second, func() error { // notice the extra space before "Ready", it's to not catch // "NotReady" nodes - out := c.MustSSH(kubectl, "/opt/bin/kubectl get nodes | grep \" Ready\"| wc -l") + out := c.MustSSH(kubectl, "kubectl get nodes | grep \" Ready\"| wc -l") readyNodesCnt := string(out) if readyNodesCnt != "2" { return fmt.Errorf("ready nodes should be equal to 2: %s", readyNodesCnt) @@ -284,13 +222,13 @@ func kubeadmBaseTest(c cluster.TestCluster, params map[string]interface{}) { }) c.Run("nginx deployment", func(c cluster.TestCluster) { // nginx manifest has been deployed through ignition - if _, err := c.SSH(kubectl, "/opt/bin/kubectl apply -f nginx.yaml"); err != nil { + if _, err := c.SSH(kubectl, "kubectl apply -f nginx.yaml"); err != nil { c.Fatalf("unable to deploy nginx: %v", err) } // Wait up to 3 min (36*5 = 180s) for nginx. The test can be flaky on overcommitted platforms. if err := util.Retry(36, 5*time.Second, func() error { - out := c.MustSSH(kubectl, "/opt/bin/kubectl get deployments -o json | jq '.items | .[] | .status.readyReplicas'") + out := c.MustSSH(kubectl, "kubectl get deployments -o json | jq '.items | .[] | .status.readyReplicas'") readyCnt := string(out) if readyCnt != "1" { return fmt.Errorf("ready replicas should be equal to 1: %s", readyCnt) @@ -312,13 +250,13 @@ func kubeadmBaseTest(c cluster.TestCluster, params map[string]interface{}) { } // Manifests have been deployed through Ignition - if _, err := c.SSH(kubectl, "/opt/bin/kubectl apply -f nfs-pod.yaml -f nfs-pvc.yaml"); err != nil { + if _, err := c.SSH(kubectl, "kubectl apply -f nfs-pod.yaml -f nfs-pvc.yaml"); err != nil { c.Fatalf("unable to create NFS pod and pvc: %v", err) } // Wait up to 3 min (36*5 = 180s). The test can be flaky on overcommitted platforms. if err := util.Retry(36, 5*time.Second, func() error { - out, err := c.SSH(kubectl, `/opt/bin/kubectl get pod/test-pod-1 -o json | jq '.status.containerStatuses[] | select (.name == "test") | .ready'`) + out, err := c.SSH(kubectl, `kubectl get pod/test-pod-1 -o json | jq '.status.containerStatuses[] | select (.name == "test") | .ready'`) if err != nil { return fmt.Errorf("getting container status: %v", err) } @@ -436,12 +374,12 @@ func setup(c cluster.TestCluster, params map[string]interface{}) (platform.Machi p := c.Platform() isQemu := p == "qemu" || p == "qemu-unpriv" if isQemu { - master, err = tutil.NewMachineWithLargeDisk(c, "5G", conf.ContainerLinuxConfig(masterCfg.String())) + master, err = tutil.NewMachineWithLargeDisk(c, "5G", conf.Butane(masterCfg.String())) if err != nil { return nil, fmt.Errorf("unable to create master node with large disk: %w", err) } } else { - master, err = c.NewMachine(conf.ContainerLinuxConfig(masterCfg.String())) + master, err = c.NewMachine(conf.Butane(masterCfg.String())) if err != nil { return nil, fmt.Errorf("unable to create master node: %w", err) } @@ -470,12 +408,12 @@ func setup(c cluster.TestCluster, params map[string]interface{}) (platform.Machi } if isQemu { - worker, err = tutil.NewMachineWithLargeDisk(c, "5G", conf.ContainerLinuxConfig(workerCfg.String())) + worker, err = tutil.NewMachineWithLargeDisk(c, "5G", conf.Butane(workerCfg.String())) if err != nil { return nil, fmt.Errorf("unable to create worker node with large disk: %w", err) } } else { - worker, err = c.NewMachine(conf.ContainerLinuxConfig(workerCfg.String())) + worker, err = c.NewMachine(conf.Butane(workerCfg.String())) if err != nil { return nil, fmt.Errorf("unable to create worker node: %w", err) } diff --git a/kola/tests/kubeadm/kubeadm_test.go b/kola/tests/kubeadm/kubeadm_test.go index d333ac2d6..c95924f92 100644 --- a/kola/tests/kubeadm/kubeadm_test.go +++ b/kola/tests/kubeadm/kubeadm_test.go @@ -60,17 +60,8 @@ func TestRenderTemplate(t *testing.T) { "CNI": CNI, "Endpoints": []string{"http://1.2.3.4:2379"}, "Params": "amd64", - "CNIVersion": "v0.8.7", - "CRIctlVersion": "v1.17.0", - "ReleaseVersion": "v0.4.0", - "Release": "v1.21.0", "DownloadDir": "/opt/bin", "PodSubnet": "192.168.0.0/17", - "KubeadmSum": "0673408403a3474c868ae86109f11f9114bca7ddce204be0d169316fb3ce0edefa4b2a472ba9b8308e423e6b927d4098ac36296405570f444f39551fb1c4bbb4", - "KubeletSum": "530689c0cc32ef1830f7ae26ac10995f815043d48a905141e23a34a5e61522c4ee2ff46953648c47c5592d7c2ffa40ce90469a697f36f68475b8da5abd73f9f5", - "CRIctlSum": "e258f4607a89b8d44c700036e636dd42cc3e2ed27a3bb13beef736f80f64f10b7974c01259a66131d3f7b44ed0c61b1ca0ea91597c416a9c095c432de5112d44", - "CNISum": "8f2cbee3b5f94d59f919054dccfe99a8e3db5473b553d91da8af4763e811138533e05df4dbeab16b3f774852b4184a7994968f5e036a3f531ad1ac4620d10ede", - "KubectlSum": "9557d298146ef62ffbcf05b3591bf1ce74f345628370447a4f614b5f64e367b5bfa8e397cc4755da9ea38f1ba04c95c65c313e735550ffc3b03c197e936c3e11", }, false, ) @@ -91,26 +82,8 @@ func TestRenderTemplate(t *testing.T) { "CiliumCLIVersion": "v0.9.0", "Endpoints": []string{"http://1.2.3.4:2379"}, "Arch": arch, - "CNIVersion": "v0.8.7", - "CRIctlVersion": "v1.17.0", - "ReleaseVersion": "v0.4.0", - "Release": "v1.21.0", "DownloadDir": "/opt/bin", "PodSubnet": "192.168.0.0/17", - "arm64": map[string]string{ - "KubeadmSum": "96248c47e809f88675d932bd8479cc1c170abb958be204965812235fb0173e788a91c46760a274a43cc56af3de4133f8ea1f5daf4f431410dbba043836e775d5", - "KubeletSum": "fc2a7e3ae6d44c0e384067f8e0bcd47b0db120d03d06cc8589c601f618792959ea894cf3325df8ab4902af23ded7fd875cf4fe718be0e67ad990a7559e4a8b1a", - "CRIctlSum": "45ab5f2dccb6579b5d376c07dd8264dd714a56ead32744655e698f5919bb0e7934a88666cccfad9cedf30d5bb713394f359f5c6a50963da9a34ddb469dbee92a", - "CNISum": "d1fcb37c727c6aa328e1f51d2a06c93a43dbdee2b7f495e12725e6d60db664d6068a1e6e26025df6c4996d9431921855c71df60c227e62bacbf5c9d213a21f8d", - "KubectlSum": "b990b81d5a885a9d131aabcc3a5ca9c37dfaff701470f2beb896682a8643c7e0c833e479a26f21129b598ac981732bf52eecdbe73896fe0ff2d9c1ffd082d1fd", - }, - "amd64": map[string]string{ - "KubeadmSum": "339e13ad840cbeab906e416f321467ab6c91cc4b66e5ad4db6f8d41a974146cf8226727edbcf686854a0803246e316158f028de7e753197cdcd2d99a604afbfd", - "KubeletSum": "1b5d530e62f0198aa7af09371ba799d135b54b9a4513981fa09b786ca5fdc98819345112b5c3a68834f6171e9b4438075cf7ec77c2c575b8e3c56b8eb15d2a86", - "CRIctlSum": "e258f4607a89b8d44c700036e636dd42cc3e2ed27a3bb13beef736f80f64f10b7974c01259a66131d3f7b44ed0c61b1ca0ea91597c416a9c095c432de5112d44", - "CNISum": "8f2cbee3b5f94d59f919054dccfe99a8e3db5473b553d91da8af4763e811138533e05df4dbeab16b3f774852b4184a7994968f5e036a3f531ad1ac4620d10ede", - "KubectlSum": "a93b2ca067629cb1fe9cbf1af1a195c12126488ed321e3652200d4dbfee9a577865647b7ef6bb673e1bdf08f03108b5dcb4b05812a649a0de5c7c9efc1407810", - }, }, false, ) diff --git a/kola/tests/kubeadm/templates.go b/kola/tests/kubeadm/templates.go index cec0b0866..04130b5ed 100644 --- a/kola/tests/kubeadm/templates.go +++ b/kola/tests/kubeadm/templates.go @@ -14,7 +14,10 @@ package kubeadm var ( - workerConfig = `systemd: + workerConfig = `--- +variant: flatcar +version: 1.0.0 +systemd: units: {{ if .cgroupv1 }} - name: containerd.service @@ -24,243 +27,77 @@ var ( [Service] Environment=CONTAINERD_CONFIG=/usr/share/containerd/config-cgroupfs.toml {{ end }} - - name: prepare-cni-plugins.service - enabled: true - contents: | - [Unit] - Description=Unpack CNI plugins to /opt/cni/bin - ConditionPathExists=!/opt/cni/bin - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - Environment=CNI_VERSION={{ .CNIVersion }} - ExecStartPre=/usr/bin/mkdir --parents /opt/cni/bin - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/cni-plugins-linux-{{ .Arch }}-${CNI_VERSION}.tgz" --directory /opt/cni/bin --no-same-owner - ExecStartPre=/usr/bin/chcon -R /opt/cni -t svirt_lxc_file_t - ExecStart=/usr/bin/rm "/opt/cni-plugins-linux-{{ .Arch }}-${CNI_VERSION}.tgz" - [Install] - WantedBy=multi-user.target - - name: prepare-critools.service - enabled: true - contents: | - [Unit] - Description=Unpack CRI tools to /opt/bin - ConditionPathExists=!/opt/bin/crictl - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - Environment=CRICTL_VERSION={{ .CRIctlVersion }} - Environment=DOWNLOAD_DIR={{ .DownloadDir}} - ExecStartPre=/usr/bin/mkdir --parents "${DOWNLOAD_DIR}" - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/crictl-${CRICTL_VERSION}-linux-{{ .Arch }}.tar.gz" --directory "${DOWNLOAD_DIR}" --no-same-owner - ExecStart=/usr/bin/rm "/opt/crictl-${CRICTL_VERSION}-linux-{{ .Arch }}.tar.gz" - [Install] - WantedBy=multi-user.target storage: + links: + - target: /opt/extensions/kubernetes/kubernetes-{{ .Release }}-{{ if eq .Arch "amd64" }}x86-64{{ else }}arm64{{ end }}.raw + path: /etc/extensions/kubernetes.raw + hard: false files: {{ if .cgroupv1 }} - path: /etc/flatcar-cgroupv1 mode: 0444 {{ end }} - - path: /opt/cni-plugins-linux-{{ .Arch }}-{{ .CNIVersion }}.tgz - filesystem: root - mode: 0644 - contents: - remote: - url: https://github.com/containernetworking/plugins/releases/download/{{ .CNIVersion }}/cni-plugins-linux-{{ .Arch }}-{{ .CNIVersion }}.tgz - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "CNISum" }} - - path: /opt/crictl-{{ .CRIctlVersion }}-linux-{{ .Arch }}.tar.gz - filesystem: root - mode: 0644 - contents: - remote: - url: https://github.com/kubernetes-sigs/cri-tools/releases/download/{{ .CRIctlVersion }}/crictl-{{ .CRIctlVersion }}-linux-{{ .Arch }}.tar.gz - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "CRIctlSum" }} - - path: {{ .DownloadDir }}/kubeadm - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/{{ .Release }}/bin/linux/{{ .Arch }}/kubeadm - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "KubeadmSum" }} - - path: {{ .DownloadDir }}/kubelet - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/{{ .Release }}/bin/linux/{{ .Arch }}/kubelet - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "KubeletSum" }} - path: /home/core/install.sh - filesystem: root mode: 0755 contents: - remote: - url: "data:text/plain;base64,{{ .WorkerScript }}" - - path: /etc/docker/daemon.json - filesystem: root - mode: 0644 + source: "data:text/plain;base64,{{ .WorkerScript }}" + - path: /opt/extensions/kubernetes/kubernetes-{{ .Release }}-{{ if eq .Arch "amd64" }}x86-64{{ else }}arm64{{ end }}.raw contents: - inline: | - { - "log-driver": "journald" - } + source: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-{{ .Release }}-{{ if eq .Arch "amd64"}}x86-64{{ else }}arm64{{ end }}.raw ` - masterConfig = `systemd: + masterConfig = `--- +variant: flatcar +version: 1.0.0 +systemd: units:{{ if .cgroupv1 }} - - name: containerd.service - dropins: - - name: 10-use-cgroupfs.conf - contents: | - [Service] - Environment=CONTAINERD_CONFIG=/usr/share/containerd/config-cgroupfs.toml{{ end }} - - name: prepare-cni-plugins.service - enabled: true - contents: | - [Unit] - Description=Unpack CNI plugins to /opt/cni/bin - ConditionPathExists=!/opt/cni/bin - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - Environment=CNI_VERSION={{ .CNIVersion }} - ExecStartPre=/usr/bin/mkdir --parents /opt/cni/bin - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/cni-plugins-linux-{{ .Arch }}-${CNI_VERSION}.tgz" --directory /opt/cni/bin --no-same-owner - ExecStartPre=/usr/bin/chcon -R /opt/cni -t svirt_lxc_file_t - ExecStart=/usr/bin/rm "/opt/cni-plugins-linux-{{ .Arch }}-${CNI_VERSION}.tgz" - [Install] - WantedBy=multi-user.target - - name: prepare-critools.service - enabled: true + - name: containerd.service + dropins: + - name: 10-use-cgroupfs.conf contents: | - [Unit] - Description=Unpack CRI tools to /opt/bin - ConditionPathExists=!/opt/bin/crictl [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - Environment=CRICTL_VERSION={{ .CRIctlVersion }} - Environment=DOWNLOAD_DIR={{ .DownloadDir}} - ExecStartPre=/usr/bin/mkdir --parents "${DOWNLOAD_DIR}" - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/crictl-${CRICTL_VERSION}-linux-{{ .Arch }}.tar.gz" --directory "${DOWNLOAD_DIR}" --no-same-owner - ExecStart=/usr/bin/rm "/opt/crictl-${CRICTL_VERSION}-linux-{{ .Arch }}.tar.gz" - [Install] - WantedBy=multi-user.target - - name: prepare-helm.service - enabled: true - contents: | - [Unit] - Description=Unpack helm to /opt/bin - ConditionPathExists=!/opt/bin/helm - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - ExecStartPre=/usr/bin/mkdir --parents "{{ .DownloadDir }}" - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz" --directory "{{ .DownloadDir }}" --strip-components=1 --no-same-owner - ExecStart=/usr/bin/rm "/opt/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz" - [Install] - WantedBy=multi-user.target + Environment=CONTAINERD_CONFIG=/usr/share/containerd/config-cgroupfs.toml{{ end }} + - name: prepare-helm.service + enabled: true + contents: | + [Unit] + Description=Unpack helm to /opt/bin + ConditionPathExists=!/opt/bin/helm + [Service] + Type=oneshot + RemainAfterExit=true + Restart=on-failure + ExecStartPre=/usr/bin/mkdir --parents "{{ .DownloadDir }}" + ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz" --directory "{{ .DownloadDir }}" --strip-components=1 --no-same-owner + ExecStart=/usr/bin/rm "/opt/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz" + [Install] + WantedBy=multi-user.target storage: + links: + - target: /opt/extensions/kubernetes/kubernetes-{{ .Release }}-{{ if eq .Arch "amd64" }}x86-64{{ else }}arm64{{ end }}.raw + path: /etc/extensions/kubernetes.raw + hard: false files:{{ if .cgroupv1 }} - path: /etc/flatcar-cgroupv1 mode: 0444{{ end }} - - path: /opt/cni-plugins-linux-{{ .Arch }}-{{ .CNIVersion }}.tgz - filesystem: root - mode: 0644 - contents: - remote: - url: https://github.com/containernetworking/plugins/releases/download/{{ .CNIVersion }}/cni-plugins-linux-{{ .Arch }}-{{ .CNIVersion }}.tgz - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "CNISum" }} - - path: /opt/crictl-{{ .CRIctlVersion }}-linux-{{ .Arch }}.tar.gz - filesystem: root - mode: 0644 - contents: - remote: - url: https://github.com/kubernetes-sigs/cri-tools/releases/download/{{ .CRIctlVersion }}/crictl-{{ .CRIctlVersion }}-linux-{{ .Arch }}.tar.gz - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "CRIctlSum" }} - - path: {{ .DownloadDir }}/kubeadm - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/{{ .Release }}/bin/linux/{{ .Arch }}/kubeadm - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "KubeadmSum" }} - - path: {{ .DownloadDir }}/kubelet - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/{{ .Release }}/bin/linux/{{ .Arch }}/kubelet - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "KubeletSum" }} - - path: {{ .DownloadDir }}/kubectl - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/{{ .Release }}/bin/linux/{{ .Arch }}/kubectl - verification: - hash: - function: sha512 - sum: {{ index (index . .Arch) "KubectlSum" }} - path: /opt/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz - filesystem: root mode: 0755 contents: - remote: - url: https://get.helm.sh/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz - - path: /etc/docker/daemon.json - filesystem: root - mode: 0644 + source: https://get.helm.sh/helm-{{ .HelmVersion }}-linux-{{ .Arch }}.tar.gz + - path: /opt/extensions/kubernetes/kubernetes-{{ .Release }}-{{ if eq .Arch "amd64" }}x86-64{{ else }}arm64{{ end }}.raw contents: - inline: | - { - "log-driver": "journald" - } -{{ if eq .CNI "cilium" }} + source: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes-{{ .Release }}-{{ if eq .Arch "amd64"}}x86-64{{ else }}arm64{{ end }}.raw + {{ if eq .CNI "cilium" }} - path: {{ .DownloadDir }}/cilium.tar.gz - filesystem: root mode: 0755 contents: - remote: - url: https://github.com/cilium/cilium-cli/releases/download/{{ .CiliumCLIVersion }}/cilium-linux-{{ .Arch }}.tar.gz -{{ end }} + source: https://github.com/cilium/cilium-cli/releases/download/{{ .CiliumCLIVersion }}/cilium-linux-{{ .Arch }}.tar.gz + {{ end }} - path: /home/core/install.sh - filesystem: root mode: 0755 contents: - remote: - url: "data:text/plain;base64,{{ .MasterScript }}" + source: "data:text/plain;base64,{{ .MasterScript }}" - path: /home/core/nginx.yaml - filesystem: root mode: 0644 contents: inline: | @@ -286,7 +123,6 @@ storage: ports: - containerPort: 80 - path: /home/core/nfs-pod.yaml - filesystem: root mode: 0644 contents: inline: | @@ -306,7 +142,6 @@ storage: persistentVolumeClaim: claimName: test-dynamic-volume-claim - path: /home/core/nfs-pvc.yaml - filesystem: root mode: 0644 contents: inline: | @@ -326,40 +161,6 @@ storage: masterScript = `#!/bin/bash set -euo pipefail -export RELEASE_VERSION={{ .ReleaseVersion }} -export DOWNLOAD_DIR={{ .DownloadDir }} -export PATH="${PATH}:${DOWNLOAD_DIR}" - -# create the required directory -mkdir --parent \ - /etc/systemd/system/kubelet.service.d \ - ${HOME}/.kube \ - /home/core/.kube - -# we download and install the various requirements: -# * kubelet service and kubeadm dropin - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" > /etc/systemd/system/kubelet.service - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" > /etc/systemd/system/kubelet.service.d/10-kubeadm.conf - - # we get the node cgroup driver # in order to pass the params to the # kubelet config for both controller and worker @@ -449,10 +250,10 @@ EOF {{ end }} { - systemctl enable --quiet --now kubelet kubeadm config images pull kubeadm init --config kubeadm-config.yaml - cp /etc/kubernetes/admin.conf $HOME/.kube/config + mkdir --parent "${HOME}"/.kube /home/core/.kube + cp /etc/kubernetes/admin.conf "${HOME}"/.kube/config cp /etc/kubernetes/admin.conf /home/core/.kube/config chown -R core:core /home/core/.kube; chmod a+r /home/core/.kube/config; @@ -511,42 +312,6 @@ EOF workerScript = `#!/bin/bash set -euo pipefail -export RELEASE_VERSION={{ .ReleaseVersion }} -export DOWNLOAD_DIR={{ .DownloadDir }} -export PATH="${PATH}:${DOWNLOAD_DIR}" - -# create the required directory -mkdir --parent \ - /opt/cni/bin \ - /etc/systemd/system/kubelet.service.d - -# we download and install the various requirements -# * kubelet service and kubeadm dropin - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | - tee /etc/systemd/system/kubelet.service - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" | - tee /etc/systemd/system/kubelet.service.d/10-kubeadm.conf - -systemctl enable --now kubelet - cat << EOF > worker-config.yaml {{ .WorkerConfig }} EOF diff --git a/kola/tests/kubeadm/testdata/master-calico-script.sh b/kola/tests/kubeadm/testdata/master-calico-script.sh index e5b318078..7b5a42f49 100644 --- a/kola/tests/kubeadm/testdata/master-calico-script.sh +++ b/kola/tests/kubeadm/testdata/master-calico-script.sh @@ -1,40 +1,6 @@ #!/bin/bash set -euo pipefail -export RELEASE_VERSION=v0.4.0 -export DOWNLOAD_DIR=/opt/bin -export PATH="${PATH}:${DOWNLOAD_DIR}" - -# create the required directory -mkdir --parent \ - /etc/systemd/system/kubelet.service.d \ - ${HOME}/.kube \ - /home/core/.kube - -# we download and install the various requirements: -# * kubelet service and kubeadm dropin - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" > /etc/systemd/system/kubelet.service - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" > /etc/systemd/system/kubelet.service.d/10-kubeadm.conf - - # we get the node cgroup driver # in order to pass the params to the # kubelet config for both controller and worker @@ -113,10 +79,10 @@ EOF { - systemctl enable --quiet --now kubelet kubeadm config images pull kubeadm init --config kubeadm-config.yaml - cp /etc/kubernetes/admin.conf $HOME/.kube/config + mkdir --parent "${HOME}"/.kube /home/core/.kube + cp /etc/kubernetes/admin.conf "${HOME}"/.kube/config cp /etc/kubernetes/admin.conf /home/core/.kube/config chown -R core:core /home/core/.kube; chmod a+r /home/core/.kube/config; diff --git a/kola/tests/kubeadm/testdata/master-cilium-amd64-config.yml b/kola/tests/kubeadm/testdata/master-cilium-amd64-config.yml index 4c1d1e532..eae0d0843 100644 --- a/kola/tests/kubeadm/testdata/master-cilium-amd64-config.yml +++ b/kola/tests/kubeadm/testdata/master-cilium-amd64-config.yml @@ -1,136 +1,47 @@ +--- +variant: flatcar +version: 1.0.0 systemd: units: - - name: prepare-cni-plugins.service - enabled: true - contents: | - [Unit] - Description=Unpack CNI plugins to /opt/cni/bin - ConditionPathExists=!/opt/cni/bin - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - Environment=CNI_VERSION=v0.8.7 - ExecStartPre=/usr/bin/mkdir --parents /opt/cni/bin - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/cni-plugins-linux-amd64-${CNI_VERSION}.tgz" --directory /opt/cni/bin --no-same-owner - ExecStartPre=/usr/bin/chcon -R /opt/cni -t svirt_lxc_file_t - ExecStart=/usr/bin/rm "/opt/cni-plugins-linux-amd64-${CNI_VERSION}.tgz" - [Install] - WantedBy=multi-user.target - - name: prepare-critools.service - enabled: true - contents: | - [Unit] - Description=Unpack CRI tools to /opt/bin - ConditionPathExists=!/opt/bin/crictl - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - Environment=CRICTL_VERSION=v1.17.0 - Environment=DOWNLOAD_DIR=/opt/bin - ExecStartPre=/usr/bin/mkdir --parents "${DOWNLOAD_DIR}" - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/crictl-${CRICTL_VERSION}-linux-amd64.tar.gz" --directory "${DOWNLOAD_DIR}" --no-same-owner - ExecStart=/usr/bin/rm "/opt/crictl-${CRICTL_VERSION}-linux-amd64.tar.gz" - [Install] - WantedBy=multi-user.target - - name: prepare-helm.service - enabled: true - contents: | - [Unit] - Description=Unpack helm to /opt/bin - ConditionPathExists=!/opt/bin/helm - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - ExecStartPre=/usr/bin/mkdir --parents "/opt/bin" - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-1.2.3-linux-amd64.tar.gz" --directory "/opt/bin" --strip-components=1 --no-same-owner - ExecStart=/usr/bin/rm "/opt/helm-1.2.3-linux-amd64.tar.gz" - [Install] - WantedBy=multi-user.target + - name: prepare-helm.service + enabled: true + contents: | + [Unit] + Description=Unpack helm to /opt/bin + ConditionPathExists=!/opt/bin/helm + [Service] + Type=oneshot + RemainAfterExit=true + Restart=on-failure + ExecStartPre=/usr/bin/mkdir --parents "/opt/bin" + ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-1.2.3-linux-amd64.tar.gz" --directory "/opt/bin" --strip-components=1 --no-same-owner + ExecStart=/usr/bin/rm "/opt/helm-1.2.3-linux-amd64.tar.gz" + [Install] + WantedBy=multi-user.target storage: + links: + - target: /opt/extensions/kubernetes/kubernetes--x86-64.raw + path: /etc/extensions/kubernetes.raw + hard: false files: - - path: /opt/cni-plugins-linux-amd64-v0.8.7.tgz - filesystem: root - mode: 0644 - contents: - remote: - url: https://github.com/containernetworking/plugins/releases/download/v0.8.7/cni-plugins-linux-amd64-v0.8.7.tgz - verification: - hash: - function: sha512 - sum: 8f2cbee3b5f94d59f919054dccfe99a8e3db5473b553d91da8af4763e811138533e05df4dbeab16b3f774852b4184a7994968f5e036a3f531ad1ac4620d10ede - - path: /opt/crictl-v1.17.0-linux-amd64.tar.gz - filesystem: root - mode: 0644 - contents: - remote: - url: https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.17.0/crictl-v1.17.0-linux-amd64.tar.gz - verification: - hash: - function: sha512 - sum: e258f4607a89b8d44c700036e636dd42cc3e2ed27a3bb13beef736f80f64f10b7974c01259a66131d3f7b44ed0c61b1ca0ea91597c416a9c095c432de5112d44 - - path: /opt/bin/kubeadm - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/v1.21.0/bin/linux/amd64/kubeadm - verification: - hash: - function: sha512 - sum: 339e13ad840cbeab906e416f321467ab6c91cc4b66e5ad4db6f8d41a974146cf8226727edbcf686854a0803246e316158f028de7e753197cdcd2d99a604afbfd - - path: /opt/bin/kubelet - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/v1.21.0/bin/linux/amd64/kubelet - verification: - hash: - function: sha512 - sum: 1b5d530e62f0198aa7af09371ba799d135b54b9a4513981fa09b786ca5fdc98819345112b5c3a68834f6171e9b4438075cf7ec77c2c575b8e3c56b8eb15d2a86 - - path: /opt/bin/kubectl - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/v1.21.0/bin/linux/amd64/kubectl - verification: - hash: - function: sha512 - sum: a93b2ca067629cb1fe9cbf1af1a195c12126488ed321e3652200d4dbfee9a577865647b7ef6bb673e1bdf08f03108b5dcb4b05812a649a0de5c7c9efc1407810 - path: /opt/helm-1.2.3-linux-amd64.tar.gz - filesystem: root mode: 0755 contents: - remote: - url: https://get.helm.sh/helm-1.2.3-linux-amd64.tar.gz - - path: /etc/docker/daemon.json - filesystem: root - mode: 0644 + source: https://get.helm.sh/helm-1.2.3-linux-amd64.tar.gz + - path: /opt/extensions/kubernetes/kubernetes--x86-64.raw contents: - inline: | - { - "log-driver": "journald" - } - + source: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes--x86-64.raw + - path: /opt/bin/cilium.tar.gz - filesystem: root mode: 0755 contents: - remote: - url: https://github.com/cilium/cilium-cli/releases/download/v0.9.0/cilium-linux-amd64.tar.gz - + source: https://github.com/cilium/cilium-cli/releases/download/v0.9.0/cilium-linux-amd64.tar.gz + - path: /home/core/install.sh - filesystem: root mode: 0755 contents: - remote: - url: "data:text/plain;base64," + source: "data:text/plain;base64," - path: /home/core/nginx.yaml - filesystem: root mode: 0644 contents: inline: | @@ -156,7 +67,6 @@ storage: ports: - containerPort: 80 - path: /home/core/nfs-pod.yaml - filesystem: root mode: 0644 contents: inline: | @@ -176,7 +86,6 @@ storage: persistentVolumeClaim: claimName: test-dynamic-volume-claim - path: /home/core/nfs-pvc.yaml - filesystem: root mode: 0644 contents: inline: | diff --git a/kola/tests/kubeadm/testdata/master-cilium-arm64-config.yml b/kola/tests/kubeadm/testdata/master-cilium-arm64-config.yml index fd691729a..d0888a496 100644 --- a/kola/tests/kubeadm/testdata/master-cilium-arm64-config.yml +++ b/kola/tests/kubeadm/testdata/master-cilium-arm64-config.yml @@ -1,136 +1,47 @@ +--- +variant: flatcar +version: 1.0.0 systemd: units: - - name: prepare-cni-plugins.service - enabled: true - contents: | - [Unit] - Description=Unpack CNI plugins to /opt/cni/bin - ConditionPathExists=!/opt/cni/bin - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - Environment=CNI_VERSION=v0.8.7 - ExecStartPre=/usr/bin/mkdir --parents /opt/cni/bin - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/cni-plugins-linux-arm64-${CNI_VERSION}.tgz" --directory /opt/cni/bin --no-same-owner - ExecStartPre=/usr/bin/chcon -R /opt/cni -t svirt_lxc_file_t - ExecStart=/usr/bin/rm "/opt/cni-plugins-linux-arm64-${CNI_VERSION}.tgz" - [Install] - WantedBy=multi-user.target - - name: prepare-critools.service - enabled: true - contents: | - [Unit] - Description=Unpack CRI tools to /opt/bin - ConditionPathExists=!/opt/bin/crictl - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - Environment=CRICTL_VERSION=v1.17.0 - Environment=DOWNLOAD_DIR=/opt/bin - ExecStartPre=/usr/bin/mkdir --parents "${DOWNLOAD_DIR}" - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/crictl-${CRICTL_VERSION}-linux-arm64.tar.gz" --directory "${DOWNLOAD_DIR}" --no-same-owner - ExecStart=/usr/bin/rm "/opt/crictl-${CRICTL_VERSION}-linux-arm64.tar.gz" - [Install] - WantedBy=multi-user.target - - name: prepare-helm.service - enabled: true - contents: | - [Unit] - Description=Unpack helm to /opt/bin - ConditionPathExists=!/opt/bin/helm - [Service] - Type=oneshot - RemainAfterExit=true - Restart=on-failure - ExecStartPre=/usr/bin/mkdir --parents "/opt/bin" - ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-1.2.3-linux-arm64.tar.gz" --directory "/opt/bin" --strip-components=1 --no-same-owner - ExecStart=/usr/bin/rm "/opt/helm-1.2.3-linux-arm64.tar.gz" - [Install] - WantedBy=multi-user.target + - name: prepare-helm.service + enabled: true + contents: | + [Unit] + Description=Unpack helm to /opt/bin + ConditionPathExists=!/opt/bin/helm + [Service] + Type=oneshot + RemainAfterExit=true + Restart=on-failure + ExecStartPre=/usr/bin/mkdir --parents "/opt/bin" + ExecStartPre=/usr/bin/tar -v --extract --file "/opt/helm-1.2.3-linux-arm64.tar.gz" --directory "/opt/bin" --strip-components=1 --no-same-owner + ExecStart=/usr/bin/rm "/opt/helm-1.2.3-linux-arm64.tar.gz" + [Install] + WantedBy=multi-user.target storage: + links: + - target: /opt/extensions/kubernetes/kubernetes--arm64.raw + path: /etc/extensions/kubernetes.raw + hard: false files: - - path: /opt/cni-plugins-linux-arm64-v0.8.7.tgz - filesystem: root - mode: 0644 - contents: - remote: - url: https://github.com/containernetworking/plugins/releases/download/v0.8.7/cni-plugins-linux-arm64-v0.8.7.tgz - verification: - hash: - function: sha512 - sum: d1fcb37c727c6aa328e1f51d2a06c93a43dbdee2b7f495e12725e6d60db664d6068a1e6e26025df6c4996d9431921855c71df60c227e62bacbf5c9d213a21f8d - - path: /opt/crictl-v1.17.0-linux-arm64.tar.gz - filesystem: root - mode: 0644 - contents: - remote: - url: https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.17.0/crictl-v1.17.0-linux-arm64.tar.gz - verification: - hash: - function: sha512 - sum: 45ab5f2dccb6579b5d376c07dd8264dd714a56ead32744655e698f5919bb0e7934a88666cccfad9cedf30d5bb713394f359f5c6a50963da9a34ddb469dbee92a - - path: /opt/bin/kubeadm - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/v1.21.0/bin/linux/arm64/kubeadm - verification: - hash: - function: sha512 - sum: 96248c47e809f88675d932bd8479cc1c170abb958be204965812235fb0173e788a91c46760a274a43cc56af3de4133f8ea1f5daf4f431410dbba043836e775d5 - - path: /opt/bin/kubelet - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/v1.21.0/bin/linux/arm64/kubelet - verification: - hash: - function: sha512 - sum: fc2a7e3ae6d44c0e384067f8e0bcd47b0db120d03d06cc8589c601f618792959ea894cf3325df8ab4902af23ded7fd875cf4fe718be0e67ad990a7559e4a8b1a - - path: /opt/bin/kubectl - filesystem: root - mode: 0755 - contents: - remote: - url: https://dl.k8s.io/release/v1.21.0/bin/linux/arm64/kubectl - verification: - hash: - function: sha512 - sum: b990b81d5a885a9d131aabcc3a5ca9c37dfaff701470f2beb896682a8643c7e0c833e479a26f21129b598ac981732bf52eecdbe73896fe0ff2d9c1ffd082d1fd - path: /opt/helm-1.2.3-linux-arm64.tar.gz - filesystem: root mode: 0755 contents: - remote: - url: https://get.helm.sh/helm-1.2.3-linux-arm64.tar.gz - - path: /etc/docker/daemon.json - filesystem: root - mode: 0644 + source: https://get.helm.sh/helm-1.2.3-linux-arm64.tar.gz + - path: /opt/extensions/kubernetes/kubernetes--arm64.raw contents: - inline: | - { - "log-driver": "journald" - } - + source: https://github.com/flatcar/sysext-bakery/releases/download/latest/kubernetes--arm64.raw + - path: /opt/bin/cilium.tar.gz - filesystem: root mode: 0755 contents: - remote: - url: https://github.com/cilium/cilium-cli/releases/download/v0.9.0/cilium-linux-arm64.tar.gz - + source: https://github.com/cilium/cilium-cli/releases/download/v0.9.0/cilium-linux-arm64.tar.gz + - path: /home/core/install.sh - filesystem: root mode: 0755 contents: - remote: - url: "data:text/plain;base64," + source: "data:text/plain;base64," - path: /home/core/nginx.yaml - filesystem: root mode: 0644 contents: inline: | @@ -156,7 +67,6 @@ storage: ports: - containerPort: 80 - path: /home/core/nfs-pod.yaml - filesystem: root mode: 0644 contents: inline: | @@ -176,7 +86,6 @@ storage: persistentVolumeClaim: claimName: test-dynamic-volume-claim - path: /home/core/nfs-pvc.yaml - filesystem: root mode: 0644 contents: inline: | diff --git a/kola/tests/kubeadm/testdata/master-cilium-script.sh b/kola/tests/kubeadm/testdata/master-cilium-script.sh index f60f6a765..7485f1eb2 100644 --- a/kola/tests/kubeadm/testdata/master-cilium-script.sh +++ b/kola/tests/kubeadm/testdata/master-cilium-script.sh @@ -1,40 +1,6 @@ #!/bin/bash set -euo pipefail -export RELEASE_VERSION=v0.4.0 -export DOWNLOAD_DIR=/opt/bin -export PATH="${PATH}:${DOWNLOAD_DIR}" - -# create the required directory -mkdir --parent \ - /etc/systemd/system/kubelet.service.d \ - ${HOME}/.kube \ - /home/core/.kube - -# we download and install the various requirements: -# * kubelet service and kubeadm dropin - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" > /etc/systemd/system/kubelet.service - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" > /etc/systemd/system/kubelet.service.d/10-kubeadm.conf - - # we get the node cgroup driver # in order to pass the params to the # kubelet config for both controller and worker @@ -78,10 +44,10 @@ EOF { - systemctl enable --quiet --now kubelet kubeadm config images pull kubeadm init --config kubeadm-config.yaml - cp /etc/kubernetes/admin.conf $HOME/.kube/config + mkdir --parent "${HOME}"/.kube /home/core/.kube + cp /etc/kubernetes/admin.conf "${HOME}"/.kube/config cp /etc/kubernetes/admin.conf /home/core/.kube/config chown -R core:core /home/core/.kube; chmod a+r /home/core/.kube/config; diff --git a/kola/tests/kubeadm/testdata/master-flannel-script.sh b/kola/tests/kubeadm/testdata/master-flannel-script.sh index e21a04a8b..506ea86bb 100644 --- a/kola/tests/kubeadm/testdata/master-flannel-script.sh +++ b/kola/tests/kubeadm/testdata/master-flannel-script.sh @@ -1,40 +1,6 @@ #!/bin/bash set -euo pipefail -export RELEASE_VERSION=v0.4.0 -export DOWNLOAD_DIR=/opt/bin -export PATH="${PATH}:${DOWNLOAD_DIR}" - -# create the required directory -mkdir --parent \ - /etc/systemd/system/kubelet.service.d \ - ${HOME}/.kube \ - /home/core/.kube - -# we download and install the various requirements: -# * kubelet service and kubeadm dropin - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" > /etc/systemd/system/kubelet.service - -curl --retry-delay 1 \ - --retry 60 \ - --retry-connrefused \ - --retry-max-time 60 \ - --connect-timeout 20 \ - --fail \ - -sSL \ - "https://raw.githubusercontent.com/kubernetes/release/${RELEASE_VERSION}/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf" | - sed "s:/usr/bin:${DOWNLOAD_DIR}:g" > /etc/systemd/system/kubelet.service.d/10-kubeadm.conf - - # we get the node cgroup driver # in order to pass the params to the # kubelet config for both controller and worker @@ -78,10 +44,10 @@ EOF { - systemctl enable --quiet --now kubelet kubeadm config images pull kubeadm init --config kubeadm-config.yaml - cp /etc/kubernetes/admin.conf $HOME/.kube/config + mkdir --parent "${HOME}"/.kube /home/core/.kube + cp /etc/kubernetes/admin.conf "${HOME}"/.kube/config cp /etc/kubernetes/admin.conf /home/core/.kube/config chown -R core:core /home/core/.kube; chmod a+r /home/core/.kube/config;