Skip to content

Commit

Permalink
Remove wait for DNS records to resolve
Browse files Browse the repository at this point in the history
Signed-off-by: Vince Prignano <[email protected]>
  • Loading branch information
vincepri committed Oct 10, 2023
1 parent d0c8e32 commit 07cbe0d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 33 deletions.
1 change: 1 addition & 0 deletions api/v1beta1/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const (
// WaitForDNSNameReason used while waiting for a DNS name for the API server to be populated.
WaitForDNSNameReason = "WaitForDNSName"
// WaitForDNSNameResolveReason used while waiting for DNS name to resolve.
// Deprecated: this condition is no longer used.
WaitForDNSNameResolveReason = "WaitForDNSNameResolve"
// LoadBalancerFailedReason used when an error occurs during load balancer reconciliation.
LoadBalancerFailedReason = "LoadBalancerFailed"
Expand Down
1 change: 1 addition & 0 deletions api/v1beta2/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const (
// WaitForDNSNameReason used while waiting for a DNS name for the API server to be populated.
WaitForDNSNameReason = "WaitForDNSName"
// WaitForDNSNameResolveReason used while waiting for DNS name to resolve.
// Deprecated: This condition is no longer used.
WaitForDNSNameResolveReason = "WaitForDNSNameResolve"
// LoadBalancerFailedReason used when an error occurs during load balancer reconciliation.
LoadBalancerFailedReason = "LoadBalancerFailed"
Expand Down
8 changes: 0 additions & 8 deletions controllers/awscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package controllers
import (
"context"
"fmt"
"net"
"time"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -313,13 +312,6 @@ func (r *AWSClusterReconciler) reconcileNormal(clusterScope *scope.ClusterScope)
return reconcile.Result{RequeueAfter: 15 * time.Second}, nil
}

clusterScope.Debug("looking up IP address for DNS", "dns", awsCluster.Status.Network.APIServerELB.DNSName)
if _, err := net.LookupIP(awsCluster.Status.Network.APIServerELB.DNSName); err != nil {
clusterScope.Error(err, "failed to get IP address for dns name", "dns", awsCluster.Status.Network.APIServerELB.DNSName)
conditions.MarkFalse(awsCluster, infrav1.LoadBalancerReadyCondition, infrav1.WaitForDNSNameResolveReason, clusterv1.ConditionSeverityInfo, "")
clusterScope.Info("Waiting on API server ELB DNS name to resolve")
return reconcile.Result{RequeueAfter: 15 * time.Second}, nil
}
conditions.MarkTrue(awsCluster, infrav1.LoadBalancerReadyCondition)

awsCluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
Expand Down
25 changes: 0 additions & 25 deletions controllers/awscluster_controller_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,31 +363,6 @@ func TestAWSClusterReconcileOperations(t *testing.T) {
g.Expect(err).To(BeNil())
expectAWSClusterConditions(g, cs.AWSCluster, []conditionAssertion{{infrav1.LoadBalancerReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav1.WaitForDNSNameReason}})
})
t.Run("Should fail AWSCluster create with LoadBalancer reconcile failure with WaitForDNSNameResolve condition as false", func(t *testing.T) {
g := NewWithT(t)
awsCluster := getAWSCluster("test", "test")
runningCluster := func() {
networkSvc.EXPECT().ReconcileNetwork().Return(nil)
sgSvc.EXPECT().ReconcileSecurityGroups().Return(nil)
ec2Svc.EXPECT().ReconcileBastion().Return(nil)
elbSvc.EXPECT().ReconcileLoadbalancers().Return(nil)
}
csClient := setup(t, &awsCluster)
defer teardown()
runningCluster()
cs, err := scope.NewClusterScope(
scope.ClusterScopeParams{
Client: csClient,
Cluster: &clusterv1.Cluster{},
AWSCluster: &awsCluster,
},
)
awsCluster.Status.Network.APIServerELB.DNSName = "test-apiserver.us-east-1.aws"
g.Expect(err).To(BeNil())
_, err = reconciler.reconcileNormal(cs)
g.Expect(err).To(BeNil())
expectAWSClusterConditions(g, cs.AWSCluster, []conditionAssertion{{infrav1.LoadBalancerReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrav1.WaitForDNSNameResolveReason}})
})
})
})
t.Run("Reconcile delete AWSCluster", func(t *testing.T) {
Expand Down

0 comments on commit 07cbe0d

Please sign in to comment.