Skip to content

Commit 61574e0

Browse files
committed
clusterctl: move Node's .status.v1beta2.conditions to .status.deprecated.conditions
1 parent b662943 commit 61574e0

File tree

2 files changed

+17
-34
lines changed

2 files changed

+17
-34
lines changed

cmd/clusterctl/client/tree/node_object.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ type NodeObject struct {
3737
// NodeStatus is the status of a node object.
3838
type NodeStatus struct {
3939
Deprecated *NodeDeprecatedStatus
40-
V1Beta2 *NodeObjectV1Beta2Status
41-
}
42-
43-
// NodeObjectV1Beta2Status is the v1Beta2 status of a node object.
44-
type NodeObjectV1Beta2Status struct {
4540
Conditions []metav1.Condition
4641
}
4742

@@ -77,18 +72,12 @@ func (o *NodeObject) SetV1Beta1Conditions(conditions clusterv1.Conditions) {
7772

7873
// GetConditions returns the set of conditions for this object.
7974
func (o *NodeObject) GetConditions() []metav1.Condition {
80-
if o.Status.V1Beta2 == nil {
81-
return nil
82-
}
83-
return o.Status.V1Beta2.Conditions
75+
return o.Status.Conditions
8476
}
8577

8678
// SetConditions sets conditions for an API object.
8779
func (o *NodeObject) SetConditions(conditions []metav1.Condition) {
88-
if o.Status.V1Beta2 == nil && conditions != nil {
89-
o.Status.V1Beta2 = &NodeObjectV1Beta2Status{}
90-
}
91-
o.Status.V1Beta2.Conditions = conditions
80+
o.Status.Conditions = conditions
9281
}
9382

9483
// GetUID returns object's UID.

cmd/clusterctl/client/tree/tree_test.go

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,10 @@ func Test_createGroupNode(t *testing.T) {
556556
UID: types.UID(""), // random string
557557
},
558558
Status: NodeStatus{
559-
V1Beta2: &NodeObjectV1Beta2Status{
560-
Conditions: []metav1.Condition{
561-
{Type: clusterv1.AvailableCondition, Status: metav1.ConditionTrue},
562-
{Type: clusterv1.ReadyCondition, Status: metav1.ConditionTrue, LastTransitionTime: beforeNow},
563-
{Type: clusterv1.MachineUpToDateCondition, Status: metav1.ConditionFalse},
564-
},
559+
Conditions: []metav1.Condition{
560+
{Type: clusterv1.AvailableCondition, Status: metav1.ConditionTrue},
561+
{Type: clusterv1.ReadyCondition, Status: metav1.ConditionTrue, LastTransitionTime: beforeNow},
562+
{Type: clusterv1.MachineUpToDateCondition, Status: metav1.ConditionFalse},
565563
},
566564
},
567565
}
@@ -572,11 +570,11 @@ func Test_createGroupNode(t *testing.T) {
572570
// Some values are generated randomly, so pick up them.
573571
want.SetName(got.GetName())
574572
want.SetUID(got.GetUID())
575-
for i := range got.Status.V1Beta2.Conditions {
576-
if got.Status.V1Beta2.Conditions[i].Type == clusterv1.ReadyCondition {
573+
for i := range got.Status.Conditions {
574+
if got.Status.Conditions[i].Type == clusterv1.ReadyCondition {
577575
continue
578576
}
579-
got.Status.V1Beta2.Conditions[i].LastTransitionTime = metav1.Time{}
577+
got.Status.Conditions[i].LastTransitionTime = metav1.Time{}
580578
}
581579

582580
g.Expect(got).To(BeComparableTo(want))
@@ -687,12 +685,10 @@ func Test_updateGroupNode(t *testing.T) {
687685
UID: types.UID(""), // random string
688686
},
689687
Status: NodeStatus{
690-
V1Beta2: &NodeObjectV1Beta2Status{
691-
Conditions: []metav1.Condition{
692-
{Type: clusterv1.AvailableCondition, Status: metav1.ConditionTrue},
693-
{Type: clusterv1.ReadyCondition, LastTransitionTime: beforeNow},
694-
{Type: clusterv1.MachineUpToDateCondition, Status: metav1.ConditionFalse},
695-
},
688+
Conditions: []metav1.Condition{
689+
{Type: clusterv1.AvailableCondition, Status: metav1.ConditionTrue},
690+
{Type: clusterv1.ReadyCondition, LastTransitionTime: beforeNow},
691+
{Type: clusterv1.MachineUpToDateCondition, Status: metav1.ConditionFalse},
696692
},
697693
},
698694
}
@@ -733,12 +729,10 @@ func Test_updateGroupNode(t *testing.T) {
733729
UID: types.UID(""), // random string
734730
},
735731
Status: NodeStatus{
736-
V1Beta2: &NodeObjectV1Beta2Status{
737-
Conditions: []metav1.Condition{
738-
{Type: clusterv1.AvailableCondition, Status: metav1.ConditionTrue},
739-
{Type: clusterv1.ReadyCondition, LastTransitionTime: beforeNow},
740-
{Type: clusterv1.MachineUpToDateCondition, Status: metav1.ConditionFalse},
741-
},
732+
Conditions: []metav1.Condition{
733+
{Type: clusterv1.AvailableCondition, Status: metav1.ConditionTrue},
734+
{Type: clusterv1.ReadyCondition, LastTransitionTime: beforeNow},
735+
{Type: clusterv1.MachineUpToDateCondition, Status: metav1.ConditionFalse},
742736
},
743737
},
744738
}

0 commit comments

Comments
 (0)