From 5d9dc2b2974975013281601f4fe80a0037de416c Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Mon, 7 Jun 2021 17:45:29 -0700 Subject: [PATCH] Refactor infrastructure-azure templates required by CAPI tests to match CAPD --- .gitignore | 3 + Makefile | 17 +- .../test/dev/cluster-template-v1alpha4.yaml | 0 test/e2e/capi_test.go | 24 ++ test/e2e/config/azure-dev.yaml | 8 +- .../cluster-template-kcp-adoption.yaml | 303 ------------------ .../cluster-template-kcp-remediation.yaml | 239 -------------- .../cluster-template-md-remediation.yaml | 244 -------------- .../bases/cluster-with-kcp.yaml} | 157 +++------ .../v1alpha4/bases/crs.yaml | 24 ++ .../v1alpha4/bases/md.yaml | 66 ++++ .../v1alpha4/bases/mp.yaml | 64 ++++ .../step1/cluster-with-cp0.yaml | 144 +++++++++ .../step1/kustomization.yaml | 8 + .../step2/kustomization.yaml | 6 + .../kustomization.yaml | 5 + .../cluster-template-kcp-remediation/mhc.yaml | 18 ++ .../cluster-with-kcp.yaml | 9 + .../kustomization.yaml | 7 + .../kustomization.yaml | 4 + .../kustomization.yaml | 8 + .../cluster-template-md-remediation/md.yaml | 9 + .../cluster-template-md-remediation/mhc.yaml | 18 ++ .../cluster-with-kcp.yaml | 8 + .../kustomization.yaml | 8 + .../cluster-template-node-drain/md.yaml | 8 + .../kustomization.yaml | 5 + .../cluster-template/kustomization.yaml | 5 + 28 files changed, 511 insertions(+), 908 deletions(-) create mode 100644 templates/test/dev/cluster-template-v1alpha4.yaml delete mode 100644 test/e2e/data/infrastructure-azure/cluster-template-kcp-adoption.yaml delete mode 100644 test/e2e/data/infrastructure-azure/cluster-template-kcp-remediation.yaml delete mode 100644 test/e2e/data/infrastructure-azure/cluster-template-md-remediation.yaml rename test/e2e/data/infrastructure-azure/{cluster-template-kcp-scale-in.yaml => v1alpha4/bases/cluster-with-kcp.yaml} (61%) create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/bases/crs.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/bases/md.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/bases/mp.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step1/cluster-with-cp0.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step1/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step2/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation/mhc.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in/cluster-with-kcp.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-machine-pool/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/md.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/mhc.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/cluster-with-kcp.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/md.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-upgrades/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-azure/v1alpha4/cluster-template/kustomization.yaml diff --git a/.gitignore b/.gitignore index c2a839e8334..bd003e8a108 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,9 @@ test/e2e/config/azure-dev-envsubst.yaml test/e2e/logs/* _artifacts +# E2E test templates +test/e2e/data/infrastructure-azure/v1alpha4/cluster-template*.yaml + # boilerplate_test output hack/boilerplate/__pycache__ hack/boilerplate/*.pyc diff --git a/Makefile b/Makefile index 1e7c8de5a1c..bdd850cabd2 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,7 @@ E2E_DATA_DIR ?= $(ROOT_DIR)/test/e2e/data KUBETEST_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/conformance.yaml) KUBETEST_WINDOWS_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/upstream-windows.yaml) KUBETEST_REPO_LIST_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/repo-list.yaml) +AZURE_TEMPLATES := $(E2E_DATA_DIR)/infrastructure-azure # set --output-base used for conversion-gen which needs to be different for in GOPATH and outside GOPATH dev ifneq ($(abspath $(ROOT_DIR)),$(GOPATH)/src/sigs.k8s.io/cluster-api-provider-azure) @@ -168,7 +169,7 @@ test-cover: envs-test $(KUBECTL) $(KUBE_APISERVER) $(ETCD) ## Run tests with cod go tool cover -html=coverage.out -o coverage.html .PHONY: test-e2e-run -test-e2e-run: $(ENVSUBST) $(KUBECTL) $(GINKGO) ## Run e2e tests +test-e2e-run: generate-e2e-templates $(ENVSUBST) $(KUBECTL) $(GINKGO) ## Run e2e tests $(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \ $(GINKGO) -v -trace -tags=e2e -focus="$(GINKGO_FOCUS)" -skip="$(GINKGO_SKIP)" -nodes=$(GINKGO_NODES) --noColor=$(GINKGO_NOCOLOR) $(GINKGO_ARGS) ./test/e2e -- \ -e2e.artifacts-folder="$(ARTIFACTS)" \ @@ -289,6 +290,7 @@ generate: ## Generate code $(MAKE) generate-go $(MAKE) generate-manifests $(MAKE) generate-flavors + $(MAKE) generate-e2e-templates .PHONY: generate-go generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(CONVERSION_GEN) ## Runs Go related generate targets @@ -328,6 +330,19 @@ generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc. generate-flavors: $(KUSTOMIZE) ./hack/gen-flavors.sh +.PHONY: generate-e2e-templates ## Generate Azure infrastructure templates for the v1alpha4 CAPI test suite. +generate-e2e-templates: $(KUSTOMIZE) + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template.yaml + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-md-remediation.yaml + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-remediation.yaml + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption/step1 --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml + echo "---" >> $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption/step2 --load-restrictor LoadRestrictionsNone >> $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-adoption.yaml + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-machine-pool --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-machine-pool.yaml + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-node-drain --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-node-drain.yaml + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-upgrades.yaml + $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1alpha4/cluster-template-kcp-scale-in.yaml + ## -------------------------------------- ## Docker ## -------------------------------------- diff --git a/templates/test/dev/cluster-template-v1alpha4.yaml b/templates/test/dev/cluster-template-v1alpha4.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/e2e/capi_test.go b/test/e2e/capi_test.go index 7967a3acc9c..cc0065c9be8 100644 --- a/test/e2e/capi_test.go +++ b/test/e2e/capi_test.go @@ -144,4 +144,28 @@ var _ = Describe("Running the Cluster API E2E tests", func() { } }) }) + + Context("Should successfully scale out and scale in a MachineDeployment", func() { + capi_e2e.MachineDeploymentScaleSpec(context.TODO(), func() capi_e2e.MachineDeploymentScaleSpecInput { + return capi_e2e.MachineDeploymentScaleSpecInput{ + E2EConfig: e2eConfig, + ClusterctlConfigPath: clusterctlConfigPath, + BootstrapClusterProxy: bootstrapClusterProxy.(framework.ClusterProxy), + ArtifactFolder: artifactFolder, + SkipCleanup: skipCleanup, + } + }) + }) + + Context("Should successfully set and use node drain timeout", func() { + capi_e2e.NodeDrainTimeoutSpec(context.TODO(), func() capi_e2e.NodeDrainTimeoutSpecInput { + return capi_e2e.NodeDrainTimeoutSpecInput{ + E2EConfig: e2eConfig, + ClusterctlConfigPath: clusterctlConfigPath, + BootstrapClusterProxy: bootstrapClusterProxy.(framework.ClusterProxy), + ArtifactFolder: artifactFolder, + SkipCleanup: skipCleanup, + } + }) + }) }) diff --git a/test/e2e/config/azure-dev.yaml b/test/e2e/config/azure-dev.yaml index 5a399ac00cd..7dfa98c2f76 100644 --- a/test/e2e/config/azure-dev.yaml +++ b/test/e2e/config/azure-dev.yaml @@ -55,15 +55,15 @@ providers: - sourcePath: "../data/shared/v1alpha4/metadata.yaml" - sourcePath: "${PWD}/templates/test/ci/cluster-template-prow.yaml" targetName: "cluster-template.yaml" - - sourcePath: "../data/infrastructure-azure/cluster-template-kcp-adoption.yaml" + - sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption.yaml" targetName: "cluster-template-kcp-adoption.yaml" - sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-ipv6.yaml" targetName: "cluster-template-ipv6.yaml" - - sourcePath: "../data/infrastructure-azure/cluster-template-md-remediation.yaml" + - sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-md-remediation.yaml" targetName: "cluster-template-md-remediation.yaml" - - sourcePath: "../data/infrastructure-azure/cluster-template-kcp-remediation.yaml" + - sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation.yaml" targetName: "cluster-template-kcp-remediation.yaml" - - sourcePath: "../data/infrastructure-azure/cluster-template-kcp-scale-in.yaml" + - sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in.yaml" targetName: "cluster-template-kcp-scale-in.yaml" - sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-machine-pool.yaml" targetName: "cluster-template-machine-pool.yaml" diff --git a/test/e2e/data/infrastructure-azure/cluster-template-kcp-adoption.yaml b/test/e2e/data/infrastructure-azure/cluster-template-kcp-adoption.yaml deleted file mode 100644 index 801f24e9c77..00000000000 --- a/test/e2e/data/infrastructure-azure/cluster-template-kcp-adoption.yaml +++ /dev/null @@ -1,303 +0,0 @@ -## -# these resources are sequenced by label: -# 1. kcp-adoption.step1: just the resources to bootstrap an kcp-adoption.step1 controlplane -# 2. kcp: the KCP resources (note the duplicated Cluster to associate the control plane) -## -### -# 1. kcp-adoption.step1 -### - -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: Cluster -metadata: - name: ${CLUSTER_NAME} - labels: - kcp-adoption.step1: '' - cni: "${CLUSTER_NAME}-crs-0" -spec: - clusterNetwork: - pods: - cidrBlocks: - - 192.168.0.0/16 - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureCluster - name: ${CLUSTER_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureCluster -metadata: - name: ${CLUSTER_NAME} - labels: - kcp-adoption.step1: '' -spec: - additionalTags: - creationTimestamp: ${TIMESTAMP} - jobName: ${JOB_NAME} - location: ${AZURE_LOCATION} - networkSpec: - vnet: - name: ${CLUSTER_NAME}-vnet - resourceGroup: ${CLUSTER_NAME} - subscriptionID: ${AZURE_SUBSCRIPTION_ID} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureMachine -metadata: - name: ${CLUSTER_NAME}-control-plane-0 - labels: - kcp-adoption.step1: '' -spec: - dataDisks: - - diskSizeGB: 256 - lun: 0 - nameSuffix: etcddisk - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: Standard_D2s_v3 ---- -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: Machine -metadata: - name: ${CLUSTER_NAME}-control-plane-0 - labels: - kcp-adoption.step1: '' - cluster.x-k8s.io/control-plane: "true" -spec: - version: ${KUBERNETES_VERSION} - clusterName: ${CLUSTER_NAME} - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 - kind: KubeadmConfig - name: ${CLUSTER_NAME}-control-plane-0 - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureMachine - name: ${CLUSTER_NAME}-control-plane-0 ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 -kind: KubeadmConfig -metadata: - name: ${CLUSTER_NAME}-control-plane-0 - labels: - kcp-adoption.step1: '' -spec: - initConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - clusterConfiguration: - apiServer: - timeoutForControlPlane: 20m - extraArgs: - cloud-provider: azure - cloud-config: /etc/kubernetes/azure.json - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - controllerManager: - extraArgs: - cloud-provider: azure - cloud-config: /etc/kubernetes/azure.json - allocate-node-cidrs: "false" - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - etcd: - local: - dataDir: /var/lib/etcddisk/etcd - diskSetup: - filesystems: - - device: /dev/disk/azure/scsi1/lun0 - extraOpts: - - -E - - lazy_itable_init=1,lazy_journal_init=1 - filesystem: ext4 - label: etcd_disk - - device: ephemeral0.1 - filesystem: ext4 - label: ephemeral0 - replaceFS: ntfs - partitions: - - device: /dev/disk/azure/scsi1/lun0 - layout: true - overwrite: false - tableType: gpt - mounts: - - - LABEL=etcd_disk - - /var/lib/etcddisk - files: - - contentFrom: - secret: - key: control-plane-azure.json - name: ${CLUSTER_NAME}-control-plane-0-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" ---- -### -# 2. kcp -### -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: Cluster -metadata: - name: ${CLUSTER_NAME} - labels: - kcp-adoption.step2: "" - cni: "${CLUSTER_NAME}-crs-0" -spec: - clusterNetwork: - pods: - cidrBlocks: - - 192.168.0.0/16 - controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 - kind: KubeadmControlPlane - name: ${CLUSTER_NAME}-control-plane - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureCluster - name: ${CLUSTER_NAME} ---- -apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 -kind: KubeadmControlPlane -metadata: - name: ${CLUSTER_NAME}-control-plane - labels: - cluster.x-k8s.io/cluster-name: "${ CLUSTER_NAME }" - kcp-adoption.step2: "" -spec: - machineTemplate: - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-control-plane - kubeadmConfigSpec: - clusterConfiguration: - apiServer: - extraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - timeoutForControlPlane: 20m - controllerManager: - extraArgs: - allocate-node-cidrs: "false" - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - cluster-name: ${CLUSTER_NAME} - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - etcd: - local: - dataDir: /var/lib/etcddisk/etcd - diskSetup: - filesystems: - - device: /dev/disk/azure/scsi1/lun0 - extraOpts: - - -E - - lazy_itable_init=1,lazy_journal_init=1 - filesystem: ext4 - label: etcd_disk - - device: ephemeral0.1 - filesystem: ext4 - label: ephemeral0 - replaceFS: ntfs - partitions: - - device: /dev/disk/azure/scsi1/lun0 - layout: true - overwrite: false - tableType: gpt - files: - - contentFrom: - secret: - key: control-plane-azure.json - name: ${CLUSTER_NAME}-control-plane-0-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - initConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - mounts: - - - LABEL=etcd_disk - - /var/lib/etcddisk - replicas: ${CONTROL_PLANE_MACHINE_COUNT} - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-control-plane - labels: - kcp-adoption.step2: "" -spec: - template: - spec: - dataDisks: - - diskSizeGB: 256 - lun: 0 - nameSuffix: etcddisk - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: Standard_D2s_v3 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: "cni-${CLUSTER_NAME}-crs-0" - labels: - kcp-adoption.step1: '' -data: ${CNI_RESOURCES} ---- -apiVersion: addons.cluster.x-k8s.io/v1alpha4 -kind: ClusterResourceSet -metadata: - name: "${CLUSTER_NAME}-crs-0" - labels: - kcp-adoption.step1: '' -spec: - strategy: ApplyOnce - clusterSelector: - matchLabels: - cni: "${CLUSTER_NAME}-crs-0" - resources: - - name: "cni-${CLUSTER_NAME}-crs-0" - kind: ConfigMap diff --git a/test/e2e/data/infrastructure-azure/cluster-template-kcp-remediation.yaml b/test/e2e/data/infrastructure-azure/cluster-template-kcp-remediation.yaml deleted file mode 100644 index 247a79293a3..00000000000 --- a/test/e2e/data/infrastructure-azure/cluster-template-kcp-remediation.yaml +++ /dev/null @@ -1,239 +0,0 @@ -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: Cluster -metadata: - labels: - cni: ${CLUSTER_NAME}-crs-0 - name: ${CLUSTER_NAME} - namespace: default -spec: - clusterNetwork: - pods: - cidrBlocks: - - 192.168.0.0/16 - controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 - kind: KubeadmControlPlane - name: ${CLUSTER_NAME}-control-plane - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureCluster - name: ${CLUSTER_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureCluster -metadata: - name: ${CLUSTER_NAME} - namespace: default -spec: - additionalTags: - creationTimestamp: ${TIMESTAMP} - jobName: ${JOB_NAME} - location: ${AZURE_LOCATION} - networkSpec: - vnet: - name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} - resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} - subscriptionID: ${AZURE_SUBSCRIPTION_ID} ---- -apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 -kind: KubeadmControlPlane -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - machineTemplate: - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-control-plane - kubeadmConfigSpec: - clusterConfiguration: - apiServer: - extraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - timeoutForControlPlane: 20m - controllerManager: - extraArgs: - allocate-node-cidrs: "false" - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - cluster-name: ${CLUSTER_NAME} - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - etcd: - local: - dataDir: /var/lib/etcddisk/etcd - diskSetup: - filesystems: - - device: /dev/disk/azure/scsi1/lun0 - extraOpts: - - -E - - lazy_itable_init=1,lazy_journal_init=1 - filesystem: ext4 - label: etcd_disk - - device: ephemeral0.1 - filesystem: ext4 - label: ephemeral0 - replaceFS: ntfs - partitions: - - device: /dev/disk/azure/scsi1/lun0 - layout: true - overwrite: false - tableType: gpt - files: - - contentFrom: - secret: - key: control-plane-azure.json - name: ${CLUSTER_NAME}-control-plane-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - initConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - mounts: - - - LABEL=etcd_disk - - /var/lib/etcddisk - replicas: ${CONTROL_PLANE_MACHINE_COUNT} - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - template: - spec: - dataDisks: - - diskSizeGB: 256 - lun: 0 - nameSuffix: etcddisk - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} ---- -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: MachineDeployment -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - replicas: ${WORKER_MACHINE_COUNT} - selector: - matchLabels: null - template: - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 - kind: KubeadmConfigTemplate - name: ${CLUSTER_NAME}-md-0 - clusterName: ${CLUSTER_NAME} - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-md-0 - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_NODE_MACHINE_TYPE} ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 -kind: KubeadmConfigTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - files: - - contentFrom: - secret: - key: worker-node-azure.json - name: ${CLUSTER_NAME}-md-0-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' ---- -# MachineHealthCheck object with -# - a selector that targets all the machines with label e2e.remediation.label="" -# - unhealthyConditions triggering remediation after 10s the condition is set -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: MachineHealthCheck -metadata: - name: ${CLUSTER_NAME}-mhc-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - maxUnhealthy: 100% - selector: - matchLabels: - cluster.x-k8s.io/control-plane: "" - unhealthyConditions: - - type: e2e.remediation.condition - status: "False" - timeout: 10s ---- -apiVersion: v1 -data: ${CNI_RESOURCES} -kind: ConfigMap -metadata: - name: cni-${CLUSTER_NAME}-crs-0 - namespace: default ---- -apiVersion: addons.cluster.x-k8s.io/v1alpha4 -kind: ClusterResourceSet -metadata: - name: ${CLUSTER_NAME}-crs-0 - namespace: default -spec: - clusterSelector: - matchLabels: - cni: ${CLUSTER_NAME}-crs-0 - resources: - - kind: ConfigMap - name: cni-${CLUSTER_NAME}-crs-0 - strategy: ApplyOnce diff --git a/test/e2e/data/infrastructure-azure/cluster-template-md-remediation.yaml b/test/e2e/data/infrastructure-azure/cluster-template-md-remediation.yaml deleted file mode 100644 index 443dcb37a31..00000000000 --- a/test/e2e/data/infrastructure-azure/cluster-template-md-remediation.yaml +++ /dev/null @@ -1,244 +0,0 @@ -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: Cluster -metadata: - labels: - cni: ${CLUSTER_NAME}-crs-0 - name: ${CLUSTER_NAME} - namespace: default -spec: - clusterNetwork: - pods: - cidrBlocks: - - 192.168.0.0/16 - controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 - kind: KubeadmControlPlane - name: ${CLUSTER_NAME}-control-plane - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureCluster - name: ${CLUSTER_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureCluster -metadata: - name: ${CLUSTER_NAME} - namespace: default -spec: - additionalTags: - creationTimestamp: ${TIMESTAMP} - jobName: ${JOB_NAME} - location: ${AZURE_LOCATION} - networkSpec: - vnet: - name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} - resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} - subscriptionID: ${AZURE_SUBSCRIPTION_ID} ---- -apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 -kind: KubeadmControlPlane -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - machineTemplate: - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-control-plane - kubeadmConfigSpec: - clusterConfiguration: - apiServer: - extraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - timeoutForControlPlane: 20m - controllerManager: - extraArgs: - allocate-node-cidrs: "false" - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - cluster-name: ${CLUSTER_NAME} - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - etcd: - local: - dataDir: /var/lib/etcddisk/etcd - diskSetup: - filesystems: - - device: /dev/disk/azure/scsi1/lun0 - extraOpts: - - -E - - lazy_itable_init=1,lazy_journal_init=1 - filesystem: ext4 - label: etcd_disk - - device: ephemeral0.1 - filesystem: ext4 - label: ephemeral0 - replaceFS: ntfs - partitions: - - device: /dev/disk/azure/scsi1/lun0 - layout: true - overwrite: false - tableType: gpt - files: - - contentFrom: - secret: - key: control-plane-azure.json - name: ${CLUSTER_NAME}-control-plane-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - initConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - mounts: - - - LABEL=etcd_disk - - /var/lib/etcddisk - useExperimentalRetryJoin: true - replicas: ${CONTROL_PLANE_MACHINE_COUNT} - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - template: - spec: - dataDisks: - - diskSizeGB: 256 - lun: 0 - nameSuffix: etcddisk - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} ---- -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: MachineDeployment -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - replicas: ${WORKER_MACHINE_COUNT} - selector: - matchLabels: null - template: - metadata: - labels: - "e2e.remediation.label": "" - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 - kind: KubeadmConfigTemplate - name: ${CLUSTER_NAME}-md-0 - clusterName: ${CLUSTER_NAME} - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-md-0 - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_NODE_MACHINE_TYPE} ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 -kind: KubeadmConfigTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - files: - - contentFrom: - secret: - key: worker-node-azure.json - name: ${CLUSTER_NAME}-md-0-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - useExperimentalRetryJoin: true ---- -# MachineHealthCheck object with -# - a selector that targets all the machines with label e2e.remediation.label="" -# - unhealthyConditions triggering remediation after 10s the condition is set -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: MachineHealthCheck -metadata: - name: ${CLUSTER_NAME}-mhc-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - maxUnhealthy: 100% - selector: - matchLabels: - e2e.remediation.label: "" - unhealthyConditions: - - type: e2e.remediation.condition - status: "False" - timeout: 10s ---- -apiVersion: v1 -data: ${CNI_RESOURCES} -kind: ConfigMap -metadata: - name: cni-${CLUSTER_NAME}-crs-0 - namespace: default ---- -apiVersion: addons.cluster.x-k8s.io/v1alpha4 -kind: ClusterResourceSet -metadata: - name: ${CLUSTER_NAME}-crs-0 - namespace: default -spec: - clusterSelector: - matchLabels: - cni: ${CLUSTER_NAME}-crs-0 - resources: - - kind: ConfigMap - name: cni-${CLUSTER_NAME}-crs-0 - strategy: ApplyOnce diff --git a/test/e2e/data/infrastructure-azure/cluster-template-kcp-scale-in.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/bases/cluster-with-kcp.yaml similarity index 61% rename from test/e2e/data/infrastructure-azure/cluster-template-kcp-scale-in.yaml rename to test/e2e/data/infrastructure-azure/v1alpha4/bases/cluster-with-kcp.yaml index ee3aa91b145..da279150017 100644 --- a/test/e2e/data/infrastructure-azure/cluster-template-kcp-scale-in.yaml +++ b/test/e2e/data/infrastructure-azure/v1alpha4/bases/cluster-with-kcp.yaml @@ -1,3 +1,23 @@ +--- +# AzureCluster object referenced by the Cluster object +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +kind: AzureCluster +metadata: + name: '${CLUSTER_NAME}' +spec: + additionalTags: + creationTimestamp: ${TIMESTAMP} + jobName: ${JOB_NAME} + location: ${AZURE_LOCATION} + networkSpec: + vnet: + name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} + resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} + subscriptionID: ${AZURE_SUBSCRIPTION_ID} +--- +# 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/v1alpha4 kind: Cluster metadata: @@ -19,27 +39,34 @@ spec: kind: AzureCluster name: ${CLUSTER_NAME} --- +# AzureMachineTemplate object referenced by the KubeadmControlPlane object apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureCluster +kind: AzureMachineTemplate metadata: - name: ${CLUSTER_NAME} + name: ${CLUSTER_NAME}-control-plane namespace: default spec: - additionalTags: - creationTimestamp: ${TIMESTAMP} - jobName: ${JOB_NAME} - location: ${AZURE_LOCATION} - networkSpec: - vnet: - name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} - resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} - subscriptionID: ${AZURE_SUBSCRIPTION_ID} + template: + spec: + dataDisks: + - diskSizeGB: 256 + lun: 0 + nameSuffix: etcddisk + osDisk: + diskSizeGB: 128 + osType: Linux + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} --- +# 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. apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 kind: KubeadmControlPlane metadata: name: ${CLUSTER_NAME}-control-plane - namespace: default + labels: + cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" + kcp-adoption.step2: "" spec: machineTemplate: infrastructureRef: @@ -93,7 +120,7 @@ spec: - contentFrom: secret: key: control-plane-azure.json - name: ${CLUSTER_NAME}-control-plane-azure-json + name: ${CLUSTER_NAME}-control-plane-0-azure-json owner: root:root path: /etc/kubernetes/azure.json permissions: "0644" @@ -114,107 +141,3 @@ spec: - /var/lib/etcddisk replicas: ${CONTROL_PLANE_MACHINE_COUNT} version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - template: - spec: - dataDisks: - - diskSizeGB: 256 - lun: 0 - nameSuffix: etcddisk - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} ---- -apiVersion: cluster.x-k8s.io/v1alpha4 -kind: MachineDeployment -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - replicas: ${WORKER_MACHINE_COUNT} - selector: - matchLabels: null - template: - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 - kind: KubeadmConfigTemplate - name: ${CLUSTER_NAME}-md-0 - clusterName: ${CLUSTER_NAME} - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-md-0 - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_NODE_MACHINE_TYPE} ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 -kind: KubeadmConfigTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - files: - - contentFrom: - secret: - key: worker-node-azure.json - name: ${CLUSTER_NAME}-md-0-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' ---- -apiVersion: v1 -data: ${CNI_RESOURCES} -kind: ConfigMap -metadata: - name: cni-${CLUSTER_NAME}-crs-0 - namespace: default ---- -apiVersion: addons.cluster.x-k8s.io/v1alpha4 -kind: ClusterResourceSet -metadata: - name: ${CLUSTER_NAME}-crs-0 - namespace: default -spec: - clusterSelector: - matchLabels: - cni: ${CLUSTER_NAME}-crs-0 - resources: - - kind: ConfigMap - name: cni-${CLUSTER_NAME}-crs-0 - strategy: ApplyOnce diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/bases/crs.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/bases/crs.yaml new file mode 100644 index 00000000000..7f8f9f9d46e --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/bases/crs.yaml @@ -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/v1alpha4 +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 diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/bases/md.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/bases/md.yaml new file mode 100644 index 00000000000..6d41c1f51f5 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/bases/md.yaml @@ -0,0 +1,66 @@ +--- +# AzureMachineTemplate referenced by the MachineDeployment +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +kind: AzureMachineTemplate +metadata: + name: ${CLUSTER_NAME}-md-0 + namespace: default +spec: + template: + spec: + osDisk: + diskSizeGB: 128 + managedDisk: + storageAccountType: Premium_LRS + osType: Linux + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: ${AZURE_NODE_MACHINE_TYPE} +--- +# KubeadmConfigTemplate referenced by the MachineDeployment +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 +kind: KubeadmConfigTemplate +metadata: + name: ${CLUSTER_NAME}-md-0 + namespace: default +spec: + template: + spec: + files: + - contentFrom: + secret: + key: worker-node-azure.json + name: ${CLUSTER_NAME}-md-0-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-config: /etc/kubernetes/azure.json + cloud-provider: azure + name: '{{ ds.meta_data["local_hostname"] }}' +--- +# MachineDeployment object +apiVersion: cluster.x-k8s.io/v1alpha4 +kind: MachineDeployment +metadata: + name: ${CLUSTER_NAME}-md-0 + namespace: default +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${WORKER_MACHINE_COUNT} + selector: + matchLabels: null + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 + kind: KubeadmConfigTemplate + name: ${CLUSTER_NAME}-md-0 + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 + kind: AzureMachineTemplate + name: ${CLUSTER_NAME}-md-0 + version: ${KUBERNETES_VERSION} \ No newline at end of file diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/bases/mp.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/bases/mp.yaml new file mode 100644 index 00000000000..ce882b9afed --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/bases/mp.yaml @@ -0,0 +1,64 @@ +--- +# MachinePool which references the DockerMachinePool and KubeadmConfigTemplate below +apiVersion: cluster.x-k8s.io/v1alpha4 +kind: MachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${WORKER_MACHINE_COUNT} + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 + kind: KubeadmConfig + name: ${CLUSTER_NAME}-mp-0 + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 + kind: AzureMachinePool + name: ${CLUSTER_NAME}-mp-0 + version: ${KUBERNETES_VERSION} +--- +# AzureMachinePool using default values referenced by the MachinePool +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +kind: AzureMachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + identity: SystemAssigned + location: ${AZURE_LOCATION} + template: + osDisk: + diskSizeGB: 30 + managedDisk: + storageAccountType: Premium_LRS + osType: Linux + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: ${AZURE_NODE_MACHINE_TYPE} +--- +# KubeadmConfigTemplate referenced by the MachinePool +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 +kind: KubeadmConfig +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + files: + - contentFrom: + secret: + key: worker-node-azure.json + name: ${CLUSTER_NAME}-mp-0-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + azure-container-registry-config: /etc/kubernetes/azure.json + cloud-config: /etc/kubernetes/azure.json + cloud-provider: azure + name: '{{ ds.meta_data["local_hostname"] }}' diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step1/cluster-with-cp0.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step1/cluster-with-cp0.yaml new file mode 100644 index 00000000000..6e4ae8f63c0 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step1/cluster-with-cp0.yaml @@ -0,0 +1,144 @@ +--- +# DockerCluster object referenced by the Cluster object +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +kind: AzureCluster +metadata: + name: ${CLUSTER_NAME} +spec: + additionalTags: + creationTimestamp: ${TIMESTAMP} + jobName: ${JOB_NAME} + location: ${AZURE_LOCATION} + networkSpec: + vnet: + name: ${CLUSTER_NAME}-vnet + resourceGroup: ${CLUSTER_NAME} + subscriptionID: ${AZURE_SUBSCRIPTION_ID} +--- +# Cluster object with +# - No 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/v1alpha4 +kind: Cluster +metadata: + name: ${CLUSTER_NAME} + labels: + cni: "${CLUSTER_NAME}-crs-0" +spec: + clusterNetwork: + pods: + cidrBlocks: + - 192.168.0.0/16 + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 + kind: AzureCluster + name: ${CLUSTER_NAME} +--- +# DockerMachine referenced by the Machine cp0 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +kind: AzureMachine +metadata: + name: ${CLUSTER_NAME}-control-plane-0 +spec: + dataDisks: + - diskSizeGB: 256 + lun: 0 + nameSuffix: etcddisk + osDisk: + diskSizeGB: 128 + managedDisk: + storageAccountType: Premium_LRS + osType: Linux + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: Standard_D2s_v3 +--- +# KubeadmConfig referenced by the Machine cp0 +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 +kind: KubeadmConfig +metadata: + name: ${CLUSTER_NAME}-control-plane-0 +spec: + initConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-config: /etc/kubernetes/azure.json + cloud-provider: azure + name: '{{ ds.meta_data["local_hostname"] }}' + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-config: /etc/kubernetes/azure.json + cloud-provider: azure + name: '{{ ds.meta_data["local_hostname"] }}' + clusterConfiguration: + apiServer: + timeoutForControlPlane: 20m + extraArgs: + cloud-provider: azure + cloud-config: /etc/kubernetes/azure.json + extraVolumes: + - hostPath: /etc/kubernetes/azure.json + mountPath: /etc/kubernetes/azure.json + name: cloud-config + readOnly: true + controllerManager: + extraArgs: + cloud-provider: azure + cloud-config: /etc/kubernetes/azure.json + allocate-node-cidrs: "false" + extraVolumes: + - hostPath: /etc/kubernetes/azure.json + mountPath: /etc/kubernetes/azure.json + name: cloud-config + readOnly: true + etcd: + local: + dataDir: /var/lib/etcddisk/etcd + diskSetup: + filesystems: + - device: /dev/disk/azure/scsi1/lun0 + extraOpts: + - -E + - lazy_itable_init=1,lazy_journal_init=1 + filesystem: ext4 + label: etcd_disk + - device: ephemeral0.1 + filesystem: ext4 + label: ephemeral0 + replaceFS: ntfs + partitions: + - device: /dev/disk/azure/scsi1/lun0 + layout: true + overwrite: false + tableType: gpt + mounts: + - - LABEL=etcd_disk + - /var/lib/etcddisk + files: + - contentFrom: + secret: + key: control-plane-azure.json + name: ${CLUSTER_NAME}-control-plane-0-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" +--- +# cp0 Machine +apiVersion: cluster.x-k8s.io/v1alpha4 +kind: Machine +metadata: + name: ${CLUSTER_NAME}-control-plane-0 + labels: + cluster.x-k8s.io/control-plane: "true" +spec: + version: ${KUBERNETES_VERSION} + clusterName: ${CLUSTER_NAME} + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 + kind: KubeadmConfig + name: ${CLUSTER_NAME}-control-plane-0 + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 + kind: AzureMachine + name: ${CLUSTER_NAME}-control-plane-0 \ No newline at end of file diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step1/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step1/kustomization.yaml new file mode 100644 index 00000000000..fa5f1edcc2f --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step1/kustomization.yaml @@ -0,0 +1,8 @@ +commonLabels: + kcp-adoption.step1: "" + +bases: + - cluster-with-cp0.yaml + - ../../bases/crs.yaml + + diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step2/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step2/kustomization.yaml new file mode 100644 index 00000000000..f7b1382cfa0 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-adoption/step2/kustomization.yaml @@ -0,0 +1,6 @@ +commonLabels: + kcp-adoption.step2: "" + +bases: + - ../../bases/cluster-with-kcp.yaml + diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation/kustomization.yaml new file mode 100644 index 00000000000..e234e37be1b --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../bases/cluster-with-kcp.yaml + - ../bases/md.yaml + - ../bases/crs.yaml + - mhc.yaml diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation/mhc.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation/mhc.yaml new file mode 100644 index 00000000000..1de43a1efd4 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-remediation/mhc.yaml @@ -0,0 +1,18 @@ +--- +# MachineHealthCheck object with +# - a selector that targets all the machines with label cluster.x-k8s.io/control-plane="" +# - unhealthyConditions triggering remediation after 10s the condition is set +apiVersion: cluster.x-k8s.io/v1alpha4 +kind: MachineHealthCheck +metadata: + name: "${CLUSTER_NAME}-mhc-0" +spec: + clusterName: "${CLUSTER_NAME}" + maxUnhealthy: 100% + selector: + matchLabels: + cluster.x-k8s.io/control-plane: "" + unhealthyConditions: + - type: e2e.remediation.condition + status: "False" + timeout: 10s diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in/cluster-with-kcp.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in/cluster-with-kcp.yaml new file mode 100644 index 00000000000..f1d6e65a4aa --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in/cluster-with-kcp.yaml @@ -0,0 +1,9 @@ +# KubeadmControlPlane referenced by the Cluster object with +kind: KubeadmControlPlane +apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 +metadata: + name: "${CLUSTER_NAME}-control-plane" +spec: + rolloutStrategy: + rollingUpdate: + maxSurge: 0 \ No newline at end of file diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in/kustomization.yaml new file mode 100644 index 00000000000..50546094a8a --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-kcp-scale-in/kustomization.yaml @@ -0,0 +1,7 @@ +bases: +- ../bases/crs.yaml +- ../bases/md.yaml +- ../bases/cluster-with-kcp.yaml + +patchesStrategicMerge: +- ./cluster-with-kcp.yaml \ No newline at end of file diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-machine-pool/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-machine-pool/kustomization.yaml new file mode 100644 index 00000000000..2323bae83ae --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-machine-pool/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - ../bases/cluster-with-kcp.yaml + - ../bases/mp.yaml + - ../bases/crs.yaml diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/kustomization.yaml new file mode 100644 index 00000000000..82c8029e8b3 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/kustomization.yaml @@ -0,0 +1,8 @@ +bases: + - ../bases/cluster-with-kcp.yaml + - ../bases/md.yaml + - ../bases/crs.yaml + - mhc.yaml + +patchesStrategicMerge: +- ./md.yaml diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/md.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/md.yaml new file mode 100644 index 00000000000..3b58c64b200 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/md.yaml @@ -0,0 +1,9 @@ +apiVersion: cluster.x-k8s.io/v1alpha4 +kind: MachineDeployment +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + template: + metadata: + labels: + "e2e.remediation.label": "" \ No newline at end of file diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/mhc.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/mhc.yaml new file mode 100644 index 00000000000..236c3632daa --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-md-remediation/mhc.yaml @@ -0,0 +1,18 @@ +--- +# MachineHealthCheck object with +# - a selector that targets all the machines with label e2e.remediation.label="" +# - unhealthyConditions triggering remediation after 10s the condition is set +apiVersion: cluster.x-k8s.io/v1alpha4 +kind: MachineHealthCheck +metadata: + name: "${CLUSTER_NAME}-mhc-0" +spec: + clusterName: "${CLUSTER_NAME}" + maxUnhealthy: 100% + selector: + matchLabels: + e2e.remediation.label: "" + unhealthyConditions: + - type: e2e.remediation.condition + status: "False" + timeout: 10s diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/cluster-with-kcp.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/cluster-with-kcp.yaml new file mode 100644 index 00000000000..79b9f5bb09c --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/cluster-with-kcp.yaml @@ -0,0 +1,8 @@ +# 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/v1alpha4 +metadata: + name: "${CLUSTER_NAME}-control-plane" +spec: + nodeDrainTimeout: ${NODE_DRAIN_TIMEOUT} diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/kustomization.yaml new file mode 100644 index 00000000000..dde0c51f0d2 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/kustomization.yaml @@ -0,0 +1,8 @@ +bases: +- ../bases/crs.yaml +- ../bases/md.yaml +- ../bases/cluster-with-kcp.yaml + +patchesStrategicMerge: +- ./md.yaml +- ./cluster-with-kcp.yaml diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/md.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/md.yaml new file mode 100644 index 00000000000..4f4ca9c2f80 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-node-drain/md.yaml @@ -0,0 +1,8 @@ +apiVersion: cluster.x-k8s.io/v1alpha4 +kind: MachineDeployment +metadata: + name: "${CLUSTER_NAME}-md-0" +spec: + template: + spec: + nodeDrainTimeout: "${NODE_DRAIN_TIMEOUT}" diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-upgrades/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-upgrades/kustomization.yaml new file mode 100644 index 00000000000..08c1848d79f --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-upgrades/kustomization.yaml @@ -0,0 +1,5 @@ +resources: + - ../bases/cluster-with-kcp.yaml + - ../bases/crs.yaml + - ../bases/md.yaml + - ../bases/mp.yaml diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template/kustomization.yaml b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template/kustomization.yaml new file mode 100644 index 00000000000..adb5919cec6 --- /dev/null +++ b/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template/kustomization.yaml @@ -0,0 +1,5 @@ +bases: +- ../bases/cluster-with-kcp.yaml +- ../bases/md.yaml +- ../bases/crs.yaml +