Skip to content

Commit

Permalink
bump CAPD to v1beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
sbueringer committed Sep 29, 2022
1 parent 3dc581b commit 55b1406
Show file tree
Hide file tree
Showing 112 changed files with 5,682 additions and 825 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ hack/tools/bin
test/e2e/data/infrastructure-docker/v1alpha3/cluster-template*.yaml
test/e2e/data/infrastructure-docker/v1alpha4/cluster-template*.yaml
test/e2e/data/infrastructure-docker/v1beta1/cluster-template*.yaml
test/e2e/data/infrastructure-docker/v1beta2/cluster-template*.yaml

# E2e test extension deployment
test/e2e/data/test-extension/deployment.yaml
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,17 @@ linters-settings:
- pkg: sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4
alias: infrav1alpha4
- pkg: sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1
alias: infrav1beta1
- pkg: sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta2
alias: infrav1
# CAPD exp
- pkg: sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha3
alias: infraexpv1alpha3
- pkg: sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha4
alias: infraexpv1alpha4
- pkg: sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1beta1
alias: infraexpv1beta1
- pkg: sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1beta2
alias: infraexpv1
nolintlint:
allow-unused: false
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,14 @@ generate-go-conversions-capd: $(CONVERSION_GEN) ## Generate conversions go code
cd $(CAPD_DIR); $(CONVERSION_GEN) \
--input-dirs=./api/v1alpha3 \
--input-dirs=./api/v1alpha4 \
--input-dirs=./api/v1beta1 \
--input-dirs=./$(EXP_DIR)/api/v1alpha3 \
--input-dirs=./$(EXP_DIR)/api/v1alpha4 \
--input-dirs=./$(EXP_DIR)/api/v1beta1 \
--build-tag=ignore_autogenerated_capd \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha3 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha4 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1beta1 \
--output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE_CAPD) \
--go-header-file=../../../hack/boilerplate/boilerplate.generatego.txt

Expand Down
20 changes: 19 additions & 1 deletion test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $(KUSTOMIZE_BIN): $(KUSTOMIZE) ## Build a local copy of kustomize
DOCKER_TEMPLATES := $(REPO_ROOT)/test/e2e/data/infrastructure-docker

.PHONY: cluster-templates
cluster-templates: $(KUSTOMIZE) cluster-templates-v1alpha3 cluster-templates-v1alpha4 cluster-templates-v1beta1 ## Generate cluster templates for all versions
cluster-templates: $(KUSTOMIZE) cluster-templates-v1alpha3 cluster-templates-v1alpha4 cluster-templates-v1beta1 cluster-templates-v1beta2 ## Generate cluster templates for all versions

cluster-templates-v1alpha3: $(KUSTOMIZE) ## Generate cluster templates for v1alpha3
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1alpha3/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1alpha3/cluster-template.yaml
Expand Down Expand Up @@ -101,6 +101,24 @@ cluster-templates-v1beta1: $(KUSTOMIZE) ## Generate cluster templates for v1beta
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta1/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta1/cluster-template-topology.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta1/cluster-template-ignition --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta1/cluster-template-ignition.yaml

cluster-templates-v1beta2: $(KUSTOMIZE) ## Generate cluster templates for v1beta2
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-md-remediation.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-remediation.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-adoption/step1 --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-adoption.yaml
echo "---" >> $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-adoption.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-adoption/step2 --load-restrictor LoadRestrictionsNone >> $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-adoption.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-machine-pool --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-machine-pool.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-node-drain --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-node-drain.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-upgrades.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-upgrades-cgroupfs --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-upgrades-cgroupfs.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-upgrades-runtimesdk --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-upgrades-runtimesdk.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-upgrades-runtimesdk-cgroupfs --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-upgrades-runtimesdk-cgroupfs.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-kcp-scale-in.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-ipv6 --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-ipv6.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-topology.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1beta2/cluster-template-ignition --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1beta2/cluster-template-ignition.yaml

test-extension-deployment: $(KUSTOMIZE) ## Generate deployment for test extension
mkdir -p $(REPO_ROOT)/test/e2e/data/test-extension
$(KUSTOMIZE) build $(REPO_ROOT)/test/extension/config/default > $(REPO_ROOT)/test/e2e/data/test-extension/deployment.yaml
Expand Down
32 changes: 16 additions & 16 deletions test/e2e/config/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,22 @@ providers:
new: "--metrics-bind-addr=:8080\n - --logging-format=json"
files:
# Add cluster templates
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-md-remediation.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-kcp-remediation.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-kcp-adoption.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-machine-pool.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-node-drain.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-upgrades.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-upgrades-cgroupfs.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-upgrades-runtimesdk.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-kcp-scale-in.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-ipv6.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-topology.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/cluster-template-ignition.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/clusterclass-quick-start.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta1/clusterclass-quick-start-runtimesdk.yaml"
- sourcePath: "../data/shared/v1beta1/metadata.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-md-remediation.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-kcp-remediation.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-kcp-adoption.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-machine-pool.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-node-drain.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-upgrades.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-upgrades-cgroupfs.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-upgrades-runtimesdk.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-kcp-scale-in.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-ipv6.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-topology.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/cluster-template-ignition.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/clusterclass-quick-start.yaml"
- sourcePath: "../data/infrastructure-docker/v1beta2/clusterclass-quick-start-runtimesdk.yaml"
- sourcePath: "../data/shared/v1beta2/metadata.yaml"

variables:
# Default variables for the e2e test; those values could be overridden via env variables, thus
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
# DockerCluster object referenced by the Cluster object
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerCluster
metadata:
name: '${CLUSTER_NAME}'
spec:
failureDomains:
fd1:
controlPlane: true
fd2:
controlPlane: true
fd3:
controlPlane: true
fd4:
controlPlane: false
fd5:
controlPlane: false
fd6:
controlPlane: false
fd7:
controlPlane: false
fd8:
controlPlane: false
---
# Cluster object with
# - Reference to the KubeadmControlPlane object
# - the label cni=${CLUSTER_NAME}-crs-0, so the cluster can be selected by the ClusterResourceSet.
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: '${CLUSTER_NAME}'
labels:
cni: "${CLUSTER_NAME}-crs-0"
spec:
clusterNetwork:
services:
cidrBlocks: ['${DOCKER_SERVICE_CIDRS}']
pods:
cidrBlocks: ['${DOCKER_POD_CIDRS}']
serviceDomain: '${DOCKER_SERVICE_DOMAIN}'
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerCluster
name: '${CLUSTER_NAME}'
controlPlaneRef:
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
name: "${CLUSTER_NAME}-control-plane"
---
# DockerMachineTemplate object referenced by the KubeadmControlPlane object
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachineTemplate
metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
template:
spec:
extraMounts:
- containerPath: "/var/run/docker.sock"
hostPath: "/var/run/docker.sock"
---
# KubeadmControlPlane referenced by the Cluster object with
# - the label kcp-adoption.step2, because it should be created in the second step of the kcp-adoption test.
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
metadata:
name: "${CLUSTER_NAME}-control-plane"
labels:
kcp-adoption.step2: ""
spec:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
machineTemplate:
infrastructureRef:
kind: DockerMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
name: "${CLUSTER_NAME}-control-plane"
kubeadmConfigSpec:
clusterConfiguration:
controllerManager:
extraArgs: {enable-hostpath-provisioner: 'true'}
apiServer:
# host.docker.internal is required by kubetest when running on MacOS because of the way ports are proxied.
certSANs: [localhost, 127.0.0.1, 0.0.0.0, host.docker.internal]
initConfiguration:
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
kubeletExtraArgs:
eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'
joinConfiguration:
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
kubeletExtraArgs:
eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'
version: "${KUBERNETES_VERSION}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: '${CLUSTER_NAME}'
namespace: default
labels:
cni: "${CLUSTER_NAME}-crs-0"
spec:
clusterNetwork:
services:
cidrBlocks: ['${DOCKER_SERVICE_CIDRS}']
pods:
cidrBlocks: ['${DOCKER_POD_CIDRS}']
serviceDomain: '${DOCKER_SERVICE_DOMAIN}'
topology:
class: "quick-start"
version: "${KUBERNETES_VERSION}"
controlPlane:
metadata: {}
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
workers:
machineDeployments:
- class: "default-worker"
name: "md-0"
replicas: ${WORKER_MACHINE_COUNT}
failureDomain: fd4
variables:
# The imageRepository variable is defaulted by the Cluster webhook.
#- name: imageRepository
# value: k8s.gcr.io
- name: etcdImageTag
# We set an empty value to use the default tag kubeadm init is using.
value: ""
- name: coreDNSImageTag
# We set an empty value to use the default tag kubeadm init is using.
value: ""
24 changes: 24 additions & 0 deletions test/e2e/data/infrastructure-docker/v1beta2/bases/crs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# ConfigMap object referenced by the ClusterResourceSet object and with
# the CNI resource defined in the test config file
apiVersion: v1
kind: ConfigMap
metadata:
name: "cni-${CLUSTER_NAME}-crs-0"
data: ${CNI_RESOURCES}
binaryData:
---
# ClusterResourceSet object with
# a selector that targets all the Cluster with label cni=${CLUSTER_NAME}-crs-0
apiVersion: addons.cluster.x-k8s.io/v1beta1
kind: ClusterResourceSet
metadata:
name: "${CLUSTER_NAME}-crs-0"
spec:
strategy: ApplyOnce
clusterSelector:
matchLabels:
cni: "${CLUSTER_NAME}-crs-0"
resources:
- name: "cni-${CLUSTER_NAME}-crs-0"
kind: ConfigMap
52 changes: 52 additions & 0 deletions test/e2e/data/infrastructure-docker/v1beta2/bases/md.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
# DockerMachineTemplate referenced by the MachineDeployment and with
# - extraMounts for the docker sock, thus allowing self-hosting test
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachineTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
template:
spec:
extraMounts:
- containerPath: "/var/run/docker.sock"
hostPath: "/var/run/docker.sock"
---
# KubeadmConfigTemplate referenced by the MachineDeployment
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
kubeletExtraArgs:
eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'
---
# MachineDeployment object
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
clusterName: "${CLUSTER_NAME}"
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels:
template:
spec:
clusterName: "${CLUSTER_NAME}"
version: "${KUBERNETES_VERSION}"
bootstrap:
configRef:
name: "${CLUSTER_NAME}-md-0"
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
infrastructureRef:
name: "${CLUSTER_NAME}-md-0"
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachineTemplate
failureDomain: fd4
45 changes: 45 additions & 0 deletions test/e2e/data/infrastructure-docker/v1beta2/bases/mp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# MachinePool which references the DockerMachinePool and KubeadmConfigTemplate below
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
name: "${CLUSTER_NAME}-mp-0"
spec:
clusterName: '${CLUSTER_NAME}'
replicas: ${WORKER_MACHINE_COUNT}
template:
spec:
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfig
name: "${CLUSTER_NAME}-mp-0-config"
clusterName: '${CLUSTER_NAME}'
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachinePool
name: "${CLUSTER_NAME}-dmp-0"
version: "${KUBERNETES_VERSION}"
failureDomains:
- fd4
- fd5
- fd6
- fd7
- fd8
---
# DockerMachinePool using default values referenced by the MachinePool
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: DockerMachinePool
metadata:
name: "${CLUSTER_NAME}-dmp-0"
---
# KubeadmConfigTemplate referenced by the MachinePool
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfig
metadata:
name: "${CLUSTER_NAME}-mp-0-config"
spec:
joinConfiguration:
nodeRegistration:
kubeletExtraArgs:
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
kubeadmConfigSpec:
format: ignition
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
template:
spec:
format: ignition
ignition:
containerLinuxConfig:
additionalConfig: |
storage:
files:
- path: /opt/foo
filesystem: root
contents:
inline: Howdy!
mode: 0644
Loading

0 comments on commit 55b1406

Please sign in to comment.