From edcb049126d56ad20faa70c2717bd4e1c918871b Mon Sep 17 00:00:00 2001 From: Amol Deodhar Date: Wed, 21 Aug 2024 11:30:08 -0400 Subject: [PATCH] update NB delete if condition --- controller/linodecluster_controller.go | 4 ++-- .../minimal-linodecluster/chainsaw-test.yaml | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/controller/linodecluster_controller.go b/controller/linodecluster_controller.go index 8d4fb6a5a..0e4ca50b0 100644 --- a/controller/linodecluster_controller.go +++ b/controller/linodecluster_controller.go @@ -211,7 +211,7 @@ func (r *LinodeClusterReconciler) reconcileCreate(ctx context.Context, logger lo // handle creation for the loadbalancer for the control plane if clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "dns" { r.handleDNS(clusterScope) - } else if clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "NodeBalancer" || clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "" { + } else { if err := r.handleNBCreate(ctx, logger, clusterScope); err != nil { return err } @@ -305,7 +305,7 @@ func (r *LinodeClusterReconciler) reconcileDelete(ctx context.Context, logger lo } conditions.MarkFalse(clusterScope.LinodeCluster, ConditionLoadBalancing, "cleared loadbalancer", clusterv1.ConditionSeverityInfo, "") - if clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "NodeBalancer" && clusterScope.LinodeCluster.Spec.Network.NodeBalancerID != nil { + if clusterScope.LinodeCluster.Spec.Network.LoadBalancerType != "dns" && clusterScope.LinodeCluster.Spec.Network.NodeBalancerID != nil { err := clusterScope.LinodeClient.DeleteNodeBalancer(ctx, *clusterScope.LinodeCluster.Spec.Network.NodeBalancerID) if util.IgnoreLinodeAPIError(err, http.StatusNotFound) != nil { logger.Error(err, "failed to delete NodeBalancer") diff --git a/e2e/linodecluster-controller/minimal-linodecluster/chainsaw-test.yaml b/e2e/linodecluster-controller/minimal-linodecluster/chainsaw-test.yaml index 565517c65..5b65c0d06 100755 --- a/e2e/linodecluster-controller/minimal-linodecluster/chainsaw-test.yaml +++ b/e2e/linodecluster-controller/minimal-linodecluster/chainsaw-test.yaml @@ -103,7 +103,3 @@ spec: ($error): ~ (json_parse($stdout)): results: 0 - catch: - - describe: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 - kind: LinodeCluster