diff --git a/config/clusterctl-templates/cluster-template-calico-lab.yaml b/config/clusterctl-templates/cluster-template-calico-lab.yaml index 1e07261..4d8487e 100644 --- a/config/clusterctl-templates/cluster-template-calico-lab.yaml +++ b/config/clusterctl-templates/cluster-template-calico-lab.yaml @@ -527,7 +527,7 @@ data: - name: METAL_DEFAULT_EXTERNAL_NETWORK_ID value: internet - name: METAL_ADDITIONAL_NETWORKS - value: internet,${METAL_NODE_NETWORK_ID} + value: internet,${METAL_NODE_NETWORK_ID:=null} - name: METAL_SSH_PUBLICKEY value: "" image: ghcr.io/metal-stack/metal-ccm:v0.9.7 diff --git a/config/clusterctl-templates/cluster-template-calico.yaml b/config/clusterctl-templates/cluster-template-calico.yaml index 9ed3ea4..dad2287 100644 --- a/config/clusterctl-templates/cluster-template-calico.yaml +++ b/config/clusterctl-templates/cluster-template-calico.yaml @@ -523,7 +523,7 @@ data: - name: METAL_DEFAULT_EXTERNAL_NETWORK_ID value: internet - name: METAL_ADDITIONAL_NETWORKS - value: internet,${METAL_NODE_NETWORK_ID} + value: internet,${METAL_NODE_NETWORK_ID:=null} - name: METAL_SSH_PUBLICKEY value: "" image: ghcr.io/metal-stack/metal-ccm:v0.9.7 diff --git a/config/samples/metal-ccm/crs.yaml b/config/samples/metal-ccm/crs.yaml index 51f3417..8cdf5fe 100644 --- a/config/samples/metal-ccm/crs.yaml +++ b/config/samples/metal-ccm/crs.yaml @@ -228,7 +228,7 @@ data: - name: METAL_DEFAULT_EXTERNAL_NETWORK_ID value: internet - name: METAL_ADDITIONAL_NETWORKS - value: internet,${METAL_NODE_NETWORK_ID} + value: internet,${METAL_NODE_NETWORK_ID:=null} - name: METAL_SSH_PUBLICKEY value: "" image: ghcr.io/metal-stack/metal-ccm:v0.9.8 diff --git a/config/target-cluster/metal-ccm.yaml b/config/target-cluster/metal-ccm.yaml index 8d5dd85..5377c6e 100644 --- a/config/target-cluster/metal-ccm.yaml +++ b/config/target-cluster/metal-ccm.yaml @@ -188,7 +188,7 @@ spec: - name: METAL_DEFAULT_EXTERNAL_NETWORK_ID value: internet - name: METAL_ADDITIONAL_NETWORKS - value: internet,${METAL_NODE_NETWORK_ID} + value: internet,${METAL_NODE_NETWORK_ID:=null} - name: METAL_SSH_PUBLICKEY value: "" image: ghcr.io/metal-stack/metal-ccm:v0.9.7 diff --git a/test/e2e/frmwrk/cluster_upgrade_kubernetes_test.go b/test/e2e/frmwrk/cluster_upgrade_kubernetes_test.go index e3c9767..325b6ff 100644 --- a/test/e2e/frmwrk/cluster_upgrade_kubernetes_test.go +++ b/test/e2e/frmwrk/cluster_upgrade_kubernetes_test.go @@ -59,7 +59,6 @@ var _ = Describe("Upgrade Kubernetes Cluster Version", Ordered, Label("upgrade") capi_e2e_ClusterUpgradeConformanceSpec(ctx, func() capi_e2e.ClusterUpgradeConformanceSpecInput { Expect(cfg.Variables).NotTo(BeNil(), "E2E config variables map must be initialized") Expect(cfg.Variables).To(HaveKey("CONTROL_PLANE_IP")) - Expect(cfg.Variables).To(HaveKey("METAL_NODE_NETWORK_ID")) return capi_e2e.ClusterUpgradeConformanceSpecInput{ E2EConfig: cfg, ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath, diff --git a/test/e2e/frmwrk/shared_cluster.go b/test/e2e/frmwrk/shared_cluster.go index bdc208d..617c041 100644 --- a/test/e2e/frmwrk/shared_cluster.go +++ b/test/e2e/frmwrk/shared_cluster.go @@ -59,7 +59,6 @@ type E2ECluster struct { type E2EClusterRefs struct { Namespace *corev1.Namespace - NodeNetwork *metalmodels.V1NetworkResponse ControlPlaneIP *metalmodels.V1IPResponse Workload framework.ClusterProxy @@ -89,10 +88,6 @@ func (e2e *E2ECluster) Variables() map[string]string { vars["WORKER_MACHINE_SIZE"] = e2e.WorkerMachineSize vars["WORKER_MACHINE_IMAGE"] = e2e.WorkerMachineImage - if e2e.Refs.NodeNetwork != nil { - vars["METAL_NODE_NETWORK_ID"] = *e2e.Refs.NodeNetwork.ID - } - return vars } diff --git a/test/e2e/frmwrk/shared_context.go b/test/e2e/frmwrk/shared_context.go index 4cd6354..c587fa5 100644 --- a/test/e2e/frmwrk/shared_context.go +++ b/test/e2e/frmwrk/shared_context.go @@ -18,6 +18,7 @@ import ( "github.com/metal-stack/metal-go/api/client/machine" "github.com/metal-stack/metal-go/api/client/network" "github.com/metal-stack/metal-go/api/models" + "github.com/metal-stack/metal-lib/pkg/tag" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -383,9 +384,16 @@ func (ee *E2EContext) TeardownMetalStackProject(ctx context.Context) { Expect(err).ToNot(HaveOccurred(), "failed to list metal networks for project") for _, net := range nets.Payload { - if label, ok := net.Labels[capmsv1alpha1.TagInfraClusterResource]; !ok || !strings.HasPrefix(label, ee.projectNamespacePrefix()) { + label, ok := net.Labels[capmsv1alpha1.TagInfraClusterResource] + isTestGenerated := !ok || !strings.HasPrefix(label, ee.projectNamespacePrefix()) + + label, ok = net.Labels[tag.ClusterID] + isCAPMSManaged := ok && strings.HasPrefix(label, ee.projectNamespacePrefix()) + + if !isTestGenerated && !isCAPMSManaged { continue } + _, err := ee.Environment.Metal.Network().FreeNetwork(network.NewFreeNetworkParamsWithContext(ctx).WithID(*net.ID), nil) Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to free metal network %s", *net.ID)) }