Skip to content

Commit 156fd65

Browse files
committed
Improve Cluster RemoteConnectionProbe condition
Signed-off-by: Stefan Büringer buringerst@vmware.com
1 parent 7702621 commit 156fd65

File tree

4 files changed

+9
-43
lines changed

4 files changed

+9
-43
lines changed

api/v1beta1/cluster_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ const (
269269
ClusterRemoteConnectionProbeV1Beta2Condition = "RemoteConnectionProbe"
270270

271271
// ClusterRemoteConnectionProbeFailedV1Beta2Reason surfaces issues with the connection to the workload cluster.
272-
ClusterRemoteConnectionProbeFailedV1Beta2Reason = "RemoteConnectionProbeFailed"
272+
ClusterRemoteConnectionProbeFailedV1Beta2Reason = "ProbeFailed"
273273

274274
// ClusterRemoteConnectionProbeSucceededV1Beta2Reason is used to report a working connection with the workload cluster.
275-
ClusterRemoteConnectionProbeSucceededV1Beta2Reason = "RemoteConnectionProbeSucceeded"
275+
ClusterRemoteConnectionProbeSucceededV1Beta2Reason = "ProbeSucceeded"
276276
)
277277

278278
// Cluster's ScalingUp condition and corresponding reasons that will be used in v1Beta2 API version.

internal/controllers/cluster/cluster_controller.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ const (
6363
// deleteRequeueAfter is how long to wait before checking again to see if the cluster still has children during
6464
// deletion.
6565
deleteRequeueAfter = 5 * time.Second
66-
67-
// remoteConnectionProbeSucceededMessage is the message to be used when remote connection probe succeeded.
68-
remoteConnectionProbeSucceededMessage = "Remote connection probe succeeded"
6966
)
7067

7168
// Update permissions on /finalizers subresrouce is required on management clusters with 'OwnerReferencesPermissionEnforcement' plugin enabled.
@@ -203,10 +200,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (retRes ct
203200
})
204201
} else {
205202
v1beta2conditions.Set(cluster, metav1.Condition{
206-
Type: clusterv1.ClusterRemoteConnectionProbeV1Beta2Condition,
207-
Status: metav1.ConditionTrue,
208-
Reason: clusterv1.ClusterRemoteConnectionProbeSucceededV1Beta2Reason,
209-
Message: remoteConnectionProbeSucceededMessage,
203+
Type: clusterv1.ClusterRemoteConnectionProbeV1Beta2Condition,
204+
Status: metav1.ConditionTrue,
205+
Reason: clusterv1.ClusterRemoteConnectionProbeSucceededV1Beta2Reason,
210206
})
211207
}
212208

internal/controllers/cluster/cluster_controller_status.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -969,10 +969,6 @@ func setAvailableCondition(ctx context.Context, cluster *clusterv1.Cluster) {
969969
overrideConditions = append(overrideConditions, *controlPlaneAvailableCondition)
970970
}
971971

972-
if remoteConnectionProbeCondition := calculateRemoteConnectionProbeForSummary(cluster); remoteConnectionProbeCondition != nil {
973-
overrideConditions = append(overrideConditions, *remoteConnectionProbeCondition)
974-
}
975-
976972
if len(overrideConditions) > 0 {
977973
summaryOpts = append(summaryOpts, overrideConditions)
978974
}
@@ -1053,31 +1049,6 @@ func calculateControlPlaneAvailableForSummary(cluster *clusterv1.Cluster) *v1bet
10531049
}
10541050
}
10551051

1056-
func calculateRemoteConnectionProbeForSummary(cluster *clusterv1.Cluster) *v1beta2conditions.ConditionWithOwnerInfo {
1057-
remoteConnectionProbeCondition := v1beta2conditions.Get(cluster, clusterv1.ClusterRemoteConnectionProbeV1Beta2Condition)
1058-
if remoteConnectionProbeCondition == nil {
1059-
return nil
1060-
}
1061-
1062-
message := remoteConnectionProbeCondition.Message
1063-
if remoteConnectionProbeCondition.Status == metav1.ConditionTrue && remoteConnectionProbeCondition.Message == remoteConnectionProbeSucceededMessage {
1064-
message = ""
1065-
}
1066-
1067-
return &v1beta2conditions.ConditionWithOwnerInfo{
1068-
OwnerResource: v1beta2conditions.ConditionOwnerInfo{
1069-
Kind: "Cluster",
1070-
Name: cluster.Name,
1071-
},
1072-
Condition: metav1.Condition{
1073-
Type: remoteConnectionProbeCondition.Type,
1074-
Status: remoteConnectionProbeCondition.Status,
1075-
Reason: remoteConnectionProbeCondition.Reason,
1076-
Message: message,
1077-
},
1078-
}
1079-
}
1080-
10811052
func aggregateUnhealthyMachines(machines collections.Machines) string {
10821053
if len(machines) == 0 {
10831054
return ""

internal/controllers/cluster/cluster_controller_status_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ func TestSetAvailableCondition(t *testing.T) {
19801980
},
19811981
},
19821982
{
1983-
name: "Drops messages from InfraCluster and ControlPlane when using fallback to fields; drop message from RemoteConnectionProbe when true",
1983+
name: "Drops messages from InfraCluster and ControlPlane when using fallback to fields",
19841984
cluster: &clusterv1.Cluster{
19851985
ObjectMeta: metav1.ObjectMeta{
19861986
Name: "machine-test",
@@ -2013,10 +2013,9 @@ func TestSetAvailableCondition(t *testing.T) {
20132013
Reason: "Foo",
20142014
},
20152015
{
2016-
Type: clusterv1.ClusterRemoteConnectionProbeV1Beta2Condition,
2017-
Status: metav1.ConditionTrue,
2018-
Reason: clusterv1.ClusterRemoteConnectionProbeSucceededV1Beta2Reason,
2019-
Message: remoteConnectionProbeSucceededMessage,
2016+
Type: clusterv1.ClusterRemoteConnectionProbeV1Beta2Condition,
2017+
Status: metav1.ConditionTrue,
2018+
Reason: clusterv1.ClusterRemoteConnectionProbeSucceededV1Beta2Reason,
20202019
},
20212020
{
20222021
Type: clusterv1.ClusterDeletingV1Beta2Condition,

0 commit comments

Comments
 (0)