diff --git a/nodeup/pkg/model/context.go b/nodeup/pkg/model/context.go index 86013dde62234..0f8198fe74a23 100644 --- a/nodeup/pkg/model/context.go +++ b/nodeup/pkg/model/context.go @@ -589,32 +589,18 @@ func (c *NodeupModelContext) NodeName() (string, error) { return strings.ToLower(strings.TrimSpace(nodeName)), nil } -func (b *NodeupModelContext) AddCNIBinAssets(c *fi.NodeupModelBuilderContext, assetNames []string) error { - for _, assetName := range assetNames { - re, err := regexp.Compile(fmt.Sprintf("^%s$", regexp.QuoteMeta(assetName))) - if err != nil { - return err - } - if err := b.addCNIBinAsset(c, re); err != nil { - return err - } - } - return nil -} - -func (b *NodeupModelContext) addCNIBinAsset(c *fi.NodeupModelBuilderContext, assetPath *regexp.Regexp) error { - name, res, err := b.Assets.FindMatch(assetPath) - if err != nil { - return err +func (b *NodeupModelContext) AddCNIBinAssets(c *fi.NodeupModelBuilderContext) error { + f := b.Assets.FindMatches(regexp.MustCompile(".*")) + + for name, res := range f { + c.AddTask(&nodetasks.File{ + Path: filepath.Join(b.CNIBinDir(), name), + Contents: res, + Type: nodetasks.FileType_File, + Mode: fi.PtrTo("0755"), + }) } - c.AddTask(&nodetasks.File{ - Path: filepath.Join(b.CNIBinDir(), name), - Contents: res, - Type: nodetasks.FileType_File, - Mode: fi.PtrTo("0755"), - }) - return nil } diff --git a/nodeup/pkg/model/networking/common.go b/nodeup/pkg/model/networking/common.go index 0f3b170fc56d8..517895c1cc3b3 100644 --- a/nodeup/pkg/model/networking/common.go +++ b/nodeup/pkg/model/networking/common.go @@ -30,27 +30,7 @@ var _ fi.NodeupModelBuilder = &CommonBuilder{} // Build is responsible for copying the common CNI binaries func (b *CommonBuilder) Build(c *fi.NodeupModelBuilderContext) error { - // Based on https://github.com/containernetworking/plugins/releases/tag/v0.7.5 - assets := []string{ - "bridge", - "dhcp", - "flannel", - "host-device", - "host-local", - "ipvlan", - "loopback", - "macvlan", - "portmap", - "ptp", - "tuning", - "vlan", - "bandwidth", - "firewall", - "sbr", - "static", - } - - if err := b.AddCNIBinAssets(c, assets); err != nil { + if err := b.AddCNIBinAssets(c); err != nil { return err } diff --git a/tests/integration/update_cluster/minimal/data/aws_launch_template_master-us-test-1a.masters.minimal.example.com_user_data b/tests/integration/update_cluster/minimal/data/aws_launch_template_master-us-test-1a.masters.minimal.example.com_user_data index 9fd3d7e58d67c..7dc634171d41c 100644 --- a/tests/integration/update_cluster/minimal/data/aws_launch_template_master-us-test-1a.masters.minimal.example.com_user_data +++ b/tests/integration/update_cluster/minimal/data/aws_launch_template_master-us-test-1a.masters.minimal.example.com_user_data @@ -251,7 +251,7 @@ ClusterName: minimal.example.com ConfigBase: memfs://clusters.example.com/minimal.example.com InstanceGroupName: master-us-test-1a InstanceGroupRole: ControlPlane -NodeupConfigHash: gfxPBhZDQpJV0yPVRHpSf5oWzVF4Dgsk7r2pnha0/Ms= +NodeupConfigHash: Q8YfyZ01FrJoFj3BHdJIugpn1cny1S+QVPSd+62CaUs= __EOF_KUBE_ENV diff --git a/tests/integration/update_cluster/minimal/data/aws_launch_template_nodes.minimal.example.com_user_data b/tests/integration/update_cluster/minimal/data/aws_launch_template_nodes.minimal.example.com_user_data index d3b338e21e4b3..82605570abced 100644 --- a/tests/integration/update_cluster/minimal/data/aws_launch_template_nodes.minimal.example.com_user_data +++ b/tests/integration/update_cluster/minimal/data/aws_launch_template_nodes.minimal.example.com_user_data @@ -175,7 +175,7 @@ ConfigServer: - https://kops-controller.internal.minimal.example.com:3988/ InstanceGroupName: nodes InstanceGroupRole: Node -NodeupConfigHash: Gj7NVryCC35euCuGFWg6rTEr++c7EMmKikQnCabE5uU= +NodeupConfigHash: QrZGVvjDcvclRWRKDeUnQva9HojwCR/+W55pKgQw/AA= __EOF_KUBE_ENV diff --git a/tests/integration/update_cluster/minimal/data/aws_s3_object_nodeupconfig-master-us-test-1a_content b/tests/integration/update_cluster/minimal/data/aws_s3_object_nodeupconfig-master-us-test-1a_content index e7a321cee6e2a..ddc9f0601c8fd 100644 --- a/tests/integration/update_cluster/minimal/data/aws_s3_object_nodeupconfig-master-us-test-1a_content +++ b/tests/integration/update_cluster/minimal/data/aws_s3_object_nodeupconfig-master-us-test-1a_content @@ -57,7 +57,7 @@ Assets: - be5e79c70e926019e588c8c5c44d93efb1042f3be6f1db0de14e707141564d29@https://dl.k8s.io/release/v1.27.0-alpha.3/bin/linux/amd64/kubelet - 4d416a4bed7c1bb576e284fc6b0bb843f879c08fa8e4beb7e2376305d2dc8299@https://dl.k8s.io/release/v1.27.0-alpha.3/bin/linux/amd64/kubectl - 5035d7814c95cd3cedbc5efb447ef25a4942ef05caab2159746d55ce1698c74a@https://artifacts.k8s.io/binaries/cloud-provider-aws/v1.27.1/linux/amd64/ecr-credential-provider-linux-amd64 - - 962100bbc4baeaaa5748cdbfce941f756b1531c2eadb290129401498bfac21e7@https://storage.googleapis.com/k8s-artifacts-cni/release/v0.9.1/cni-plugins-linux-amd64-v0.9.1.tgz + - f3a841324845ca6bf0d4091b4fc7f97e18a623172158b72fc3fdcdb9d42d2d37@https://storage.googleapis.com/k8s-artifacts-cni/release/v1.2.0/cni-plugins-linux-amd64-v1.2.0.tgz - bb9a9ccd6517e2a54da748a9f60dc9aa9d79d19d4724663f2386812f083968e2@https://github.com/containerd/containerd/releases/download/v1.6.20/containerd-1.6.20-linux-amd64.tar.gz - f00b144e86f8c1db347a2e8f22caade07d55382c5f76dd5c0a5b1ab64eaec8bb@https://github.com/opencontainers/runc/releases/download/v1.1.5/runc.amd64 - f90ed6dcef534e6d1ae17907dc7eb40614b8945ad4af7f0e98d2be7cde8165c6@https://artifacts.k8s.io/binaries/kops/1.21.0-alpha.1/linux/amd64/protokube,https://github.com/kubernetes/kops/releases/download/v1.21.0-alpha.1/protokube-linux-amd64 @@ -66,7 +66,7 @@ Assets: - 2a15e9c291dce3e07db5d9948d5c37a4e52c9884343f63287189e4f0d4c3df76@https://dl.k8s.io/release/v1.27.0-alpha.3/bin/linux/arm64/kubelet - c5fad9f96ab5fe04b8927ce83ceefc4db65b032303a23b35e353276479450d2a@https://dl.k8s.io/release/v1.27.0-alpha.3/bin/linux/arm64/kubectl - b3d567bda9e2996fc1fbd9d13506bd16763d3865b5c7b0b3c4b48c6088c04481@https://artifacts.k8s.io/binaries/cloud-provider-aws/v1.27.1/linux/arm64/ecr-credential-provider-linux-arm64 - - ef17764ffd6cdcb16d76401bac1db6acc050c9b088f1be5efa0e094ea3b01df0@https://storage.googleapis.com/k8s-artifacts-cni/release/v0.9.1/cni-plugins-linux-arm64-v0.9.1.tgz + - 525e2b62ba92a1b6f3dc9612449a84aa61652e680f7ebf4eff579795fe464b57@https://storage.googleapis.com/k8s-artifacts-cni/release/v1.2.0/cni-plugins-linux-arm64-v1.2.0.tgz - c3e6a054b18b20fce06c7c3ed53f0989bb4b255c849bede446ebca955f07a9ce@https://github.com/containerd/containerd/releases/download/v1.6.20/containerd-1.6.20-linux-arm64.tar.gz - 54e79e4d48b9e191767e4abc08be1a8476a1c757e9a9f8c45c6ded001226867f@https://github.com/opencontainers/runc/releases/download/v1.1.5/runc.arm64 - 2f599c3d54f4c4bdbcc95aaf0c7b513a845d8f9503ec5b34c9f86aa1bc34fc0c@https://artifacts.k8s.io/binaries/kops/1.21.0-alpha.1/linux/arm64/protokube,https://github.com/kubernetes/kops/releases/download/v1.21.0-alpha.1/protokube-linux-arm64 diff --git a/tests/integration/update_cluster/minimal/data/aws_s3_object_nodeupconfig-nodes_content b/tests/integration/update_cluster/minimal/data/aws_s3_object_nodeupconfig-nodes_content index 3280b484c791d..33bb60123a5be 100644 --- a/tests/integration/update_cluster/minimal/data/aws_s3_object_nodeupconfig-nodes_content +++ b/tests/integration/update_cluster/minimal/data/aws_s3_object_nodeupconfig-nodes_content @@ -3,14 +3,14 @@ Assets: - be5e79c70e926019e588c8c5c44d93efb1042f3be6f1db0de14e707141564d29@https://dl.k8s.io/release/v1.27.0-alpha.3/bin/linux/amd64/kubelet - 4d416a4bed7c1bb576e284fc6b0bb843f879c08fa8e4beb7e2376305d2dc8299@https://dl.k8s.io/release/v1.27.0-alpha.3/bin/linux/amd64/kubectl - 5035d7814c95cd3cedbc5efb447ef25a4942ef05caab2159746d55ce1698c74a@https://artifacts.k8s.io/binaries/cloud-provider-aws/v1.27.1/linux/amd64/ecr-credential-provider-linux-amd64 - - 962100bbc4baeaaa5748cdbfce941f756b1531c2eadb290129401498bfac21e7@https://storage.googleapis.com/k8s-artifacts-cni/release/v0.9.1/cni-plugins-linux-amd64-v0.9.1.tgz + - f3a841324845ca6bf0d4091b4fc7f97e18a623172158b72fc3fdcdb9d42d2d37@https://storage.googleapis.com/k8s-artifacts-cni/release/v1.2.0/cni-plugins-linux-amd64-v1.2.0.tgz - bb9a9ccd6517e2a54da748a9f60dc9aa9d79d19d4724663f2386812f083968e2@https://github.com/containerd/containerd/releases/download/v1.6.20/containerd-1.6.20-linux-amd64.tar.gz - f00b144e86f8c1db347a2e8f22caade07d55382c5f76dd5c0a5b1ab64eaec8bb@https://github.com/opencontainers/runc/releases/download/v1.1.5/runc.amd64 arm64: - 2a15e9c291dce3e07db5d9948d5c37a4e52c9884343f63287189e4f0d4c3df76@https://dl.k8s.io/release/v1.27.0-alpha.3/bin/linux/arm64/kubelet - c5fad9f96ab5fe04b8927ce83ceefc4db65b032303a23b35e353276479450d2a@https://dl.k8s.io/release/v1.27.0-alpha.3/bin/linux/arm64/kubectl - b3d567bda9e2996fc1fbd9d13506bd16763d3865b5c7b0b3c4b48c6088c04481@https://artifacts.k8s.io/binaries/cloud-provider-aws/v1.27.1/linux/arm64/ecr-credential-provider-linux-arm64 - - ef17764ffd6cdcb16d76401bac1db6acc050c9b088f1be5efa0e094ea3b01df0@https://storage.googleapis.com/k8s-artifacts-cni/release/v0.9.1/cni-plugins-linux-arm64-v0.9.1.tgz + - 525e2b62ba92a1b6f3dc9612449a84aa61652e680f7ebf4eff579795fe464b57@https://storage.googleapis.com/k8s-artifacts-cni/release/v1.2.0/cni-plugins-linux-arm64-v1.2.0.tgz - c3e6a054b18b20fce06c7c3ed53f0989bb4b255c849bede446ebca955f07a9ce@https://github.com/containerd/containerd/releases/download/v1.6.20/containerd-1.6.20-linux-arm64.tar.gz - 54e79e4d48b9e191767e4abc08be1a8476a1c757e9a9f8c45c6ded001226867f@https://github.com/opencontainers/runc/releases/download/v1.1.5/runc.arm64 CAs: {} diff --git a/upup/pkg/fi/cloudup/networking.go b/upup/pkg/fi/cloudup/networking.go index 4481e4c3658e5..4775638929540 100644 --- a/upup/pkg/fi/cloudup/networking.go +++ b/upup/pkg/fi/cloudup/networking.go @@ -34,10 +34,14 @@ import ( // https://github.com/kubernetes/kubernetes/issues/30338 const ( - // defaultCNIAssetAmd64K8s_22 is the CNI tarball for k8s >= 1.22 + // CNI tarball for k8s >= 1.22 defaultCNIAssetAmd64K8s_22 = "https://storage.googleapis.com/k8s-artifacts-cni/release/v0.9.1/cni-plugins-linux-amd64-v0.9.1.tgz" defaultCNIAssetArm64K8s_22 = "https://storage.googleapis.com/k8s-artifacts-cni/release/v0.9.1/cni-plugins-linux-arm64-v0.9.1.tgz" + // CNI tarball for k8s >= 1.27 + defaultCNIAssetAmd64K8s_27 = "https://storage.googleapis.com/k8s-artifacts-cni/release/v1.2.0/cni-plugins-linux-amd64-v1.2.0.tgz" + defaultCNIAssetArm64K8s_27 = "https://storage.googleapis.com/k8s-artifacts-cni/release/v1.2.0/cni-plugins-linux-arm64-v1.2.0.tgz" + // Environment variable for overriding CNI url ENV_VAR_CNI_ASSET_URL = "CNI_VERSION_URL" ENV_VAR_CNI_ASSET_HASH = "CNI_ASSET_HASH_STRING" @@ -72,10 +76,18 @@ func findCNIAssets(c *kopsapi.Cluster, assetBuilder *assets.AssetBuilder, arch a switch arch { case architectures.ArchitectureAmd64: - cniAssetURL = defaultCNIAssetAmd64K8s_22 + if c.IsKubernetesLT("1.27") { + cniAssetURL = defaultCNIAssetAmd64K8s_22 + } else { + cniAssetURL = defaultCNIAssetAmd64K8s_27 + } klog.V(2).Infof("Adding default ARM64 CNI plugin binaries asset: %s", cniAssetURL) case architectures.ArchitectureArm64: - cniAssetURL = defaultCNIAssetArm64K8s_22 + if c.IsKubernetesLT("1.27") { + cniAssetURL = defaultCNIAssetArm64K8s_22 + } else { + cniAssetURL = defaultCNIAssetArm64K8s_27 + } klog.V(2).Infof("Adding default AMD64 CNI plugin binaries asset: %s", cniAssetURL) default: return nil, nil, fmt.Errorf("unknown arch for CNI plugin binaries asset: %s", arch)