diff --git a/test/e2e/data/infrastructure-docker/main/bases/cluster-with-topology.yaml b/test/e2e/data/infrastructure-docker/main/bases/cluster-with-topology.yaml index 529fc15f69d2..c67097a69734 100644 --- a/test/e2e/data/infrastructure-docker/main/bases/cluster-with-topology.yaml +++ b/test/e2e/data/infrastructure-docker/main/bases/cluster-with-topology.yaml @@ -47,6 +47,26 @@ spec: rollingUpdate: maxSurge: "20%" maxUnavailable: 0 + machinePools: + - class: "default-worker" + name: "mp-0" + metadata: + labels: + Cluster.topology.machinePool.label: "Cluster.topology.machinePool.labelValue" + # Note: this label is propagated to Nodes. + Cluster.topology.machinePool.label.node.cluster.x-k8s.io: "Cluster.topology.machinePool.nodeLabelValue" + annotations: + Cluster.topology.machinePool.annotation: "Cluster.topology.machinePool.annotationValue" + nodeDeletionTimeout: "30s" + nodeVolumeDetachTimeout: "5m" + minReadySeconds: 5 + replicas: ${WORKER_MACHINE_COUNT} + failureDomains: + - fd4 + - fd5 + - fd6 + - fd7 + - fd8 variables: # We set an empty value to use the default tag kubeadm init is using. - name: etcdImageTag diff --git a/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml index 3d747dd49625..e5da91b45a88 100644 --- a/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml +++ b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml @@ -54,6 +54,24 @@ spec: - type: e2e.remediation.condition status: "False" timeout: 20s + machinePools: + - class: default-worker + template: + metadata: + labels: + ClusterClass.machinePool.label: "ClusterClass.machinePool.labelValue" + annotations: + ClusterClass.machinePool.annotation: "ClusterClass.machinePool.annotationValue" + bootstrap: + ref: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + name: quick-start-default-worker-bootstraptemplate + infrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: DockerMachinePoolTemplate + name: quick-start-default-worker-machinepooltemplate variables: - name: lbImageRepository required: true @@ -182,6 +200,19 @@ spec: valueFrom: template: | kindest/node:{{ .builtin.controlPlane.version | replace "+" "_" }} + - selector: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: DockerMachinePoolTemplate + matchResources: + machinePoolClass: + names: + - default-worker + jsonPatches: + - op: add + path: "/spec/template/spec/template/customImage" + valueFrom: + template: | + kindest/node:{{ .builtin.machinePool.version | replace "+" "_" }} - name: preloadImages description: | Sets the container images to preload to the node that is used for running dockerMachines. @@ -264,6 +295,18 @@ spec: path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs" value: cloud-provider: "external" + - selector: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + matchResources: + machinePoolClass: + names: + - '*-worker' + jsonPatches: + - op: add + path: "/spec/template/spec/joinConfiguration/nodeRegistration/kubeletExtraArgs" + value: + cloud-provider: "external" - name: localEndpointIPv6 enabledIf: "{{ .ipv6Primary }}" description: "Configures KCP to use IPv6 for its localAPIEndpoint." @@ -440,21 +483,38 @@ spec: - containerPath: "/var/run/docker.sock" hostPath: "/var/run/docker.sock" --- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: DockerMachinePoolTemplate +metadata: + name: quick-start-default-worker-machinepooltemplate + labels: + InfraMachineTemplate.machinePool.label: "InfraMachineTemplate.machinePool.labelValue" + annotations: + InfraMachineTemplate.machinePool.annotation: "InfraMachineTemplate.machinePool.annotationValue" +spec: + template: + spec: + template: {} +--- apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate metadata: name: quick-start-default-worker-bootstraptemplate labels: BootstrapConfigTemplate.machineDeployment.label: "BootstrapConfigTemplate.machineDeployment.labelValue" + BootstrapConfigTemplate.machinePool.label: "BootstrapConfigTemplate.machinePool.labelValue" annotations: BootstrapConfigTemplate.machineDeployment.annotation: "BootstrapConfigTemplate.machineDeployment.annotationValue" + BootstrapConfigTemplate.machinePool.annotation: "BootstrapConfigTemplate.machinePool.annotationValue" spec: template: metadata: labels: BootstrapConfigTemplate.machineDeployment.template.label: "BootstrapConfigTemplate.machineDeployment.template.labelValue" + BootstrapConfigTemplate.machinePool.label: "BootstrapConfigTemplate.machinePool.labelValue" annotations: BootstrapConfigTemplate.machineDeployment.template.annotation: "BootstrapConfigTemplate.machineDeployment.template.annotationValue" + BootstrapConfigTemplate.machinePool.annotation: "BootstrapConfigTemplate.machinePool.annotationValue" spec: joinConfiguration: nodeRegistration: # node registration parameters are automatically injected by CAPD according to the kindest/node image in use. diff --git a/test/framework/ownerreference_helpers.go b/test/framework/ownerreference_helpers.go index 0b727891df58..000cc967f906 100644 --- a/test/framework/ownerreference_helpers.go +++ b/test/framework/ownerreference_helpers.go @@ -280,11 +280,12 @@ var KubeadmBootstrapOwnerReferenceAssertions = map[string]func([]metav1.OwnerRef // Kinds for types in the Docker infrastructure package. var ( - dockerMachineKind = "DockerMachine" - dockerMachineTemplateKind = "DockerMachineTemplate" - dockerMachinePoolKind = "DockerMachinePool" - dockerClusterKind = "DockerCluster" - dockerClusterTemplateKind = "DockerClusterTemplate" + dockerMachineKind = "DockerMachine" + dockerMachineTemplateKind = "DockerMachineTemplate" + dockerMachinePoolKind = "DockerMachinePool" + dockerMachinePoolTemplateKind = "DockerMachinePoolTemplate" + dockerClusterKind = "DockerCluster" + dockerClusterTemplateKind = "DockerClusterTemplate" ) // DockerInfraOwnerReferenceAssertions maps Docker Infrastructure types to functions which return an error if the passed @@ -313,6 +314,10 @@ var DockerInfraOwnerReferenceAssertions = map[string]func([]metav1.OwnerReferenc // DockerMachinePool must be owned by a MachinePool. return HasExactOwners(owners, machinePoolOwner) }, + dockerMachinePoolTemplateKind: func(owners []metav1.OwnerReference) error { + // DockerMachinePoolTemplate must be owned by a ClusterClass. + return HasExactOwners(owners, clusterClassOwner) + }, } func HasExactOwners(gotOwners []metav1.OwnerReference, wantOwners ...metav1.OwnerReference) error { @@ -328,7 +333,7 @@ func HasExactOwners(gotOwners []metav1.OwnerReference, wantOwners ...metav1.Owne sort.Strings(wantComparable) if !reflect.DeepEqual(gotComparable, wantComparable) { - return fmt.Errorf("wanted %v, actual %v", wantOwners, gotOwners) + return fmt.Errorf("wanted %v, actual %v", wantComparable, gotComparable) } return nil }