From 2421e7ab826e8c020653e81b7a3acd764d0cd204 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Wed, 22 Nov 2023 17:00:43 +0100 Subject: [PATCH] fixes --- Makefile | 4 +- test/e2e/clusterctl_upgrade_test.go | 2 +- test/e2e/config/vsphere-ci.yaml | 13 +-- test/e2e/config/vsphere-dev.yaml | 17 +++- .../cluster-resource-set-csi-insecure.yaml | 4 +- .../main/remote-management/kustomization.yaml | 2 + .../cluster-workload-controlplane-ip.yaml | 9 +++ .../main/workload/kustomization.yaml | 4 + .../cluster-workload-controlplane-ip.yaml | 80 +++++++++++++++++++ .../v1.8/workload/kustomization.yaml | 14 ++++ 10 files changed, 135 insertions(+), 14 deletions(-) create mode 100644 test/e2e/data/infrastructure-vsphere/main/workload/cluster-workload-controlplane-ip.yaml create mode 100644 test/e2e/data/infrastructure-vsphere/main/workload/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-vsphere/v1.8/workload/cluster-workload-controlplane-ip.yaml create mode 100644 test/e2e/data/infrastructure-vsphere/v1.8/workload/kustomization.yaml diff --git a/Makefile b/Makefile index 916f5e7d0c..e885c38bca 100644 --- a/Makefile +++ b/Makefile @@ -296,6 +296,7 @@ generate-e2e-templates-main: $(KUSTOMIZE) ## Generate test templates for the mai "$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/main/hw-upgrade > $(E2E_TEMPLATE_DIR)/main/cluster-template-hw-upgrade.yaml "$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/main/storage-policy > $(E2E_TEMPLATE_DIR)/main/cluster-template-storage-policy.yaml "$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/main/remote-management > $(E2E_TEMPLATE_DIR)/main/cluster-template-remote-management.yaml + "$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/main/workload > $(E2E_TEMPLATE_DIR)/main/cluster-template-workload.yaml "$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/main/conformance > $(E2E_TEMPLATE_DIR)/main/cluster-template-conformance.yaml # Since CAPI uses different flavor names for KCP and MD remediation using MHC "$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/main/mhc-remediation/kcp > $(E2E_TEMPLATE_DIR)/main/cluster-template-kcp-remediation.yaml @@ -314,7 +315,8 @@ generate-e2e-templates-main: $(KUSTOMIZE) ## Generate test templates for the mai .PHONY: generate-e2e-templates-v1.8 generate-e2e-templates-v1.8: $(KUSTOMIZE) - $(KUSTOMIZE) build $(E2E_TEMPLATE_DIR)/v1.8/cluster-template --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATE_DIR)/v1.8/cluster-template.yaml + "$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/v1.8/cluster-template > $(E2E_TEMPLATE_DIR)/v1.8/cluster-template.yaml + "$(KUSTOMIZE)" --load-restrictor LoadRestrictionsNone build $(E2E_TEMPLATE_DIR)/v1.8/workload > $(E2E_TEMPLATE_DIR)/v1.8/cluster-template-workload.yaml ## -------------------------------------- diff --git a/test/e2e/clusterctl_upgrade_test.go b/test/e2e/clusterctl_upgrade_test.go index 34f26e0873..bd3ef5bf53 100644 --- a/test/e2e/clusterctl_upgrade_test.go +++ b/test/e2e/clusterctl_upgrade_test.go @@ -41,7 +41,7 @@ var _ = Describe("Upgrading cluster from CAPV 1.8.X to main using clusterctl [P InitWithRuntimeExtensionProviders: []string{}, InitWithKubernetesVersion: "v1.28.0", WorkloadKubernetesVersion: "v1.28.0", - WorkloadFlavor: "", + WorkloadFlavor: "workload", } }) }) diff --git a/test/e2e/config/vsphere-ci.yaml b/test/e2e/config/vsphere-ci.yaml index 68d5852d8f..c35d4d14f1 100644 --- a/test/e2e/config/vsphere-ci.yaml +++ b/test/e2e/config/vsphere-ci.yaml @@ -72,11 +72,12 @@ providers: versions: - name: v1.8.4 # Use manifest from source files - value: ../../../../cluster-api-provider-vsphere/config/default + value: "https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/download/v1.8.4/infrastructure-components.yaml" + type: "url" contract: v1beta1 files: # Add a cluster template - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/v1.8/cluster-template.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/v1.8/cluster-template-workload.yaml" - sourcePath: "../data/shared/v1.8/v1beta1_provider/metadata.yaml" - name: v1.9.99 # Use manifest from source files @@ -89,20 +90,20 @@ providers: new: "imagePullPolicy: IfNotPresent" files: # Add a cluster template - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-conformance.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-dhcp-overrides.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-hw-upgrade.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-ignition.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-kcp-remediation.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-md-remediation.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-node-drain.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-ownerreferences.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-pci.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-remote-management.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-storage-policy.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-topology.yaml" - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-dhcp-overrides.yaml" - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-ownerreferences.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/clusterclass-quick-start.yaml" - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-ignition.yaml" - sourcePath: "../data/shared/main/v1beta1_provider/metadata.yaml" variables: diff --git a/test/e2e/config/vsphere-dev.yaml b/test/e2e/config/vsphere-dev.yaml index 7f55ebc06f..4efbe73dab 100644 --- a/test/e2e/config/vsphere-dev.yaml +++ b/test/e2e/config/vsphere-dev.yaml @@ -73,6 +73,15 @@ providers: - name: vsphere type: InfrastructureProvider versions: + - name: v1.8.4 + # Use manifest from source files + value: "https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/download/v1.8.4/infrastructure-components.yaml" + type: "url" + contract: v1beta1 + files: + # Add a cluster template + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/v1.8/cluster-template-workload.yaml" + - sourcePath: "../data/shared/v1.8/v1beta1_provider/metadata.yaml" - name: v1.9.99 # Use manifest from source files value: ../../../../cluster-api-provider-vsphere/config/default @@ -84,20 +93,20 @@ providers: new: "imagePullPolicy: IfNotPresent" files: # Add a cluster template - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-conformance.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-dhcp-overrides.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-hw-upgrade.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-ignition.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-kcp-remediation.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-md-remediation.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-node-drain.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-ownerreferences.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-pci.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-remote-management.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-storage-policy.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-topology.yaml" - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-dhcp-overrides.yaml" + - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template.yaml" - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/clusterclass-quick-start.yaml" - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-ignition.yaml" - - sourcePath: "../../../test/e2e/data/infrastructure-vsphere/main/cluster-template-ownerreferences.yaml" - sourcePath: "../data/shared/main/v1beta1_provider/metadata.yaml" variables: diff --git a/test/e2e/data/infrastructure-vsphere/main/commons/cluster-resource-set-csi-insecure.yaml b/test/e2e/data/infrastructure-vsphere/main/commons/cluster-resource-set-csi-insecure.yaml index a32e96789b..6edd2a37a0 100644 --- a/test/e2e/data/infrastructure-vsphere/main/commons/cluster-resource-set-csi-insecure.yaml +++ b/test/e2e/data/infrastructure-vsphere/main/commons/cluster-resource-set-csi-insecure.yaml @@ -8,8 +8,8 @@ stringData: apiVersion: v1 kind: Secret metadata: - name: csi-vsphere-config - namespace: kube-system + name: vsphere-config-secret + namespace: vmware-system-csi stringData: csi-vsphere.conf: |+ [Global] diff --git a/test/e2e/data/infrastructure-vsphere/main/remote-management/kustomization.yaml b/test/e2e/data/infrastructure-vsphere/main/remote-management/kustomization.yaml index 27bb5cb0b4..8d0b98e47b 100644 --- a/test/e2e/data/infrastructure-vsphere/main/remote-management/kustomization.yaml +++ b/test/e2e/data/infrastructure-vsphere/main/remote-management/kustomization.yaml @@ -2,3 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../base +patchesStrategicMerge: + - ./image-injection.yaml diff --git a/test/e2e/data/infrastructure-vsphere/main/workload/cluster-workload-controlplane-ip.yaml b/test/e2e/data/infrastructure-vsphere/main/workload/cluster-workload-controlplane-ip.yaml new file mode 100644 index 0000000000..6741ab419a --- /dev/null +++ b/test/e2e/data/infrastructure-vsphere/main/workload/cluster-workload-controlplane-ip.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: VSphereCluster +metadata: + name: ${CLUSTER_NAME} + namespace: ${NAMESPACE} +spec: + controlPlaneEndpoint: + host: ${WORKLOAD_CONTROL_PLANE_ENDPOINT_IP} diff --git a/test/e2e/data/infrastructure-vsphere/main/workload/kustomization.yaml b/test/e2e/data/infrastructure-vsphere/main/workload/kustomization.yaml new file mode 100644 index 0000000000..27bb5cb0b4 --- /dev/null +++ b/test/e2e/data/infrastructure-vsphere/main/workload/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../base diff --git a/test/e2e/data/infrastructure-vsphere/v1.8/workload/cluster-workload-controlplane-ip.yaml b/test/e2e/data/infrastructure-vsphere/v1.8/workload/cluster-workload-controlplane-ip.yaml new file mode 100644 index 0000000000..c7652c642e --- /dev/null +++ b/test/e2e/data/infrastructure-vsphere/v1.8/workload/cluster-workload-controlplane-ip.yaml @@ -0,0 +1,80 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: VSphereCluster +metadata: + name: ${CLUSTER_NAME} + namespace: ${NAMESPACE} +spec: + controlPlaneEndpoint: + host: ${WORKLOAD_CONTROL_PLANE_ENDPOINT_IP} +--- +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +kind: KubeadmControlPlane +metadata: + name: ${CLUSTER_NAME} + namespace: ${NAMESPACE} +spec: + kubeadmConfigSpec: + clusterConfiguration: + apiServer: + extraArgs: + cloud-provider: external + controllerManager: + extraArgs: + cloud-provider: external + files: + - content: | + apiVersion: v1 + kind: Pod + metadata: + creationTimestamp: null + name: kube-vip + namespace: kube-system + spec: + containers: + - args: + - manager + env: + - name: cp_enable + value: "true" + - name: vip_interface + value: ${VIP_NETWORK_INTERFACE:=""} + - name: address + value: ${WORKLOAD_CONTROL_PLANE_ENDPOINT_IP} + - name: port + value: "6443" + - name: vip_arp + value: "true" + - name: vip_leaderelection + value: "true" + - name: vip_leaseduration + value: "15" + - name: vip_renewdeadline + value: "10" + - name: vip_retryperiod + value: "2" + image: ghcr.io/kube-vip/kube-vip:v0.5.11 + imagePullPolicy: IfNotPresent + name: kube-vip + resources: {} + securityContext: + capabilities: + add: + - NET_ADMIN + - NET_RAW + volumeMounts: + - mountPath: /etc/kubernetes/admin.conf + name: kubeconfig + hostAliases: + - hostnames: + - kubernetes + ip: 127.0.0.1 + hostNetwork: true + volumes: + - hostPath: + path: /etc/kubernetes/admin.conf + type: FileOrCreate + name: kubeconfig + status: {} + owner: root:root + path: /etc/kubernetes/manifests/kube-vip.yaml \ No newline at end of file diff --git a/test/e2e/data/infrastructure-vsphere/v1.8/workload/kustomization.yaml b/test/e2e/data/infrastructure-vsphere/v1.8/workload/kustomization.yaml new file mode 100644 index 0000000000..4d99811b3b --- /dev/null +++ b/test/e2e/data/infrastructure-vsphere/v1.8/workload/kustomization.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ../bases/cluster.yaml + - ../bases/cluster-resource-set.yaml +patchesStrategicMerge: + - ../bases/cluster-resource-set-label.yaml + - ../bases/cluster-network-CIDR.yaml + - ../bases/cluster-resource-set-csi-insecure.yaml + - ./cluster-workload-controlplane-ip.yaml +patches: + - target: + kind: VSphereMachineTemplate + path: ../bases/remove-storage-policy.yaml