diff --git a/util/conditions/v1beta2/getter_test.go b/util/conditions/v1beta2/getter_test.go index 956aafb183c4..03e940871336 100644 --- a/util/conditions/v1beta2/getter_test.go +++ b/util/conditions/v1beta2/getter_test.go @@ -78,7 +78,7 @@ func TestGet(t *testing.T) { LastTransitionTime: now, }, }, - V1Beta2: &builder.Phase1ObjStatusV1Beta2{ + V1Beta2: &builder.Phase1ObjV1Beta2Status{ Conditions: []metav1.Condition{ { Type: "barCondition", @@ -112,8 +112,8 @@ func TestGet(t *testing.T) { foo := &builder.Phase2Obj{ Status: builder.Phase2ObjStatus{ Conditions: nil, - Deprecated: &builder.Phase2ObjStatusDeprecated{ - V1Beta1: &builder.Phase2ObjStatusDeprecatedV1Beta1{ + Deprecated: &builder.Phase2ObjDeprecatedStatus{ + V1Beta1: &builder.Phase2ObjDeprecatedV1Beta1Status{ Conditions: clusterv1.Conditions{ { Type: "bazCondition", @@ -135,8 +135,8 @@ func TestGet(t *testing.T) { foo := &builder.Phase2Obj{ Status: builder.Phase2ObjStatus{ Conditions: []metav1.Condition{}, - Deprecated: &builder.Phase2ObjStatusDeprecated{ - V1Beta1: &builder.Phase2ObjStatusDeprecatedV1Beta1{ + Deprecated: &builder.Phase2ObjDeprecatedStatus{ + V1Beta1: &builder.Phase2ObjDeprecatedV1Beta1Status{ Conditions: clusterv1.Conditions{ { Type: "bazCondition", @@ -165,8 +165,8 @@ func TestGet(t *testing.T) { Reason: "fooReason", }, }, - Deprecated: &builder.Phase2ObjStatusDeprecated{ - V1Beta1: &builder.Phase2ObjStatusDeprecatedV1Beta1{ + Deprecated: &builder.Phase2ObjDeprecatedStatus{ + V1Beta1: &builder.Phase2ObjDeprecatedV1Beta1Status{ Conditions: clusterv1.Conditions{ { Type: "bazCondition", @@ -321,7 +321,7 @@ func TestUnstructuredGet(t *testing.T) { LastTransitionTime: now, }, }, - V1Beta2: &builder.Phase1ObjStatusV1Beta2{ + V1Beta2: &builder.Phase1ObjV1Beta2Status{ Conditions: []metav1.Condition{ { Type: "barCondition", @@ -359,8 +359,8 @@ func TestUnstructuredGet(t *testing.T) { foo := &builder.Phase2Obj{ Status: builder.Phase2ObjStatus{ Conditions: nil, - Deprecated: &builder.Phase2ObjStatusDeprecated{ - V1Beta1: &builder.Phase2ObjStatusDeprecatedV1Beta1{ + Deprecated: &builder.Phase2ObjDeprecatedStatus{ + V1Beta1: &builder.Phase2ObjDeprecatedV1Beta1Status{ Conditions: clusterv1.Conditions{ { Type: "bazCondition", @@ -386,8 +386,8 @@ func TestUnstructuredGet(t *testing.T) { foo := &builder.Phase2Obj{ Status: builder.Phase2ObjStatus{ Conditions: []metav1.Condition{}, - Deprecated: &builder.Phase2ObjStatusDeprecated{ - V1Beta1: &builder.Phase2ObjStatusDeprecatedV1Beta1{ + Deprecated: &builder.Phase2ObjDeprecatedStatus{ + V1Beta1: &builder.Phase2ObjDeprecatedV1Beta1Status{ Conditions: clusterv1.Conditions{ { Type: "bazCondition", @@ -420,8 +420,8 @@ func TestUnstructuredGet(t *testing.T) { Reason: "fooReason", }, }, - Deprecated: &builder.Phase2ObjStatusDeprecated{ - V1Beta1: &builder.Phase2ObjStatusDeprecatedV1Beta1{ + Deprecated: &builder.Phase2ObjDeprecatedStatus{ + V1Beta1: &builder.Phase2ObjDeprecatedV1Beta1Status{ Conditions: clusterv1.Conditions{ { Type: "bazCondition", diff --git a/util/conditions/v1beta2/setter_test.go b/util/conditions/v1beta2/setter_test.go index 208236a134b3..1659d7918ec4 100644 --- a/util/conditions/v1beta2/setter_test.go +++ b/util/conditions/v1beta2/setter_test.go @@ -67,7 +67,7 @@ func TestSet(t *testing.T) { LastTransitionTime: now, }, }, - V1Beta2: &builder.Phase1ObjStatusV1Beta2{ + V1Beta2: &builder.Phase1ObjV1Beta2Status{ Conditions: []metav1.Condition{ { Type: "barCondition", @@ -100,8 +100,8 @@ func TestSet(t *testing.T) { LastTransitionTime: now, }, }, - Deprecated: &builder.Phase2ObjStatusDeprecated{ - V1Beta1: &builder.Phase2ObjStatusDeprecatedV1Beta1{ + Deprecated: &builder.Phase2ObjDeprecatedStatus{ + V1Beta1: &builder.Phase2ObjDeprecatedV1Beta1Status{ Conditions: clusterv1.Conditions{ { Type: "barCondition", diff --git a/util/patch/patch_test.go b/util/patch/patch_test.go index c660c4d5b1f4..eb01dabc929c 100644 --- a/util/patch/patch_test.go +++ b/util/patch/patch_test.go @@ -1784,7 +1784,7 @@ func TestPatchHelperForV1beta2Transition(t *testing.T) { g.Expect(patcher.Patch(ctx, obj)).NotTo(Succeed()) t.Log("Validating the object has not been updated") - g.Eventually(func() *builder.Phase1ObjStatusV1Beta2 { + g.Eventually(func() *builder.Phase1ObjV1Beta2Status { objAfter := obj.DeepCopy() if err := env.Get(ctx, key, objAfter); err != nil { return nil diff --git a/util/patch/utils_test.go b/util/patch/utils_test.go index 1af2a1039dd4..3f54e047a47b 100644 --- a/util/patch/utils_test.go +++ b/util/patch/utils_test.go @@ -262,7 +262,7 @@ func TestIdentifyConditionsFieldsPath(t *testing.T) { }{ {obj: &builder.Phase1Obj{}}, {obj: &builder.Phase1Obj{Status: builder.Phase1ObjStatus{V1Beta2: nil}}}, - {obj: &builder.Phase1Obj{Status: builder.Phase1ObjStatus{V1Beta2: &builder.Phase1ObjStatusV1Beta2{Conditions: nil}}}}, + {obj: &builder.Phase1Obj{Status: builder.Phase1ObjStatus{V1Beta2: &builder.Phase1ObjV1Beta2Status{Conditions: nil}}}}, } for _, tt := range tests { metav1ConditionsFields, clusterv1ConditionsFields, err := identifyConditionsFieldsPath(tt.obj) @@ -279,8 +279,8 @@ func TestIdentifyConditionsFieldsPath(t *testing.T) { }{ {obj: &builder.Phase2Obj{}}, {obj: &builder.Phase2Obj{Status: builder.Phase2ObjStatus{Deprecated: nil}}}, - {obj: &builder.Phase2Obj{Status: builder.Phase2ObjStatus{Deprecated: &builder.Phase2ObjStatusDeprecated{V1Beta1: nil}}}}, - {obj: &builder.Phase2Obj{Status: builder.Phase2ObjStatus{Deprecated: &builder.Phase2ObjStatusDeprecated{V1Beta1: &builder.Phase2ObjStatusDeprecatedV1Beta1{Conditions: nil}}}}}, + {obj: &builder.Phase2Obj{Status: builder.Phase2ObjStatus{Deprecated: &builder.Phase2ObjDeprecatedStatus{V1Beta1: nil}}}}, + {obj: &builder.Phase2Obj{Status: builder.Phase2ObjStatus{Deprecated: &builder.Phase2ObjDeprecatedStatus{V1Beta1: &builder.Phase2ObjDeprecatedV1Beta1Status{Conditions: nil}}}}}, } for _, tt := range tests { metav1ConditionsFields, clusterv1ConditionsFields, err := identifyConditionsFieldsPath(tt.obj) diff --git a/util/test/builder/crd/test.cluster.x-k8s.io_phase1obj.yaml b/util/test/builder/crd/test.cluster.x-k8s.io_phase1obj.yaml index 640bca7a649a..cc990c9bed01 100644 --- a/util/test/builder/crd/test.cluster.x-k8s.io_phase1obj.yaml +++ b/util/test/builder/crd/test.cluster.x-k8s.io_phase1obj.yaml @@ -97,7 +97,7 @@ spec: type: object type: array v1beta2: - description: Phase1ObjStatusV1Beta2 defines the status.V1Beta2 of + description: Phase1ObjV1Beta2Status defines the status.V1Beta2 of a Phase1Obj. properties: conditions: diff --git a/util/test/builder/crd/test.cluster.x-k8s.io_phase2obj.yaml b/util/test/builder/crd/test.cluster.x-k8s.io_phase2obj.yaml index 063228371145..0e40a9d59bf2 100644 --- a/util/test/builder/crd/test.cluster.x-k8s.io_phase2obj.yaml +++ b/util/test/builder/crd/test.cluster.x-k8s.io_phase2obj.yaml @@ -111,11 +111,11 @@ spec: - type x-kubernetes-list-type: map deprecated: - description: Phase2ObjStatusDeprecated defines the status.Deprecated + description: Phase2ObjDeprecatedStatus defines the status.Deprecated of a Phase2Obj. properties: v1beta1: - description: Phase2ObjStatusDeprecatedV1Beta1 defines the status.Deprecated.V1Beta2 + description: Phase2ObjDeprecatedV1Beta1Status defines the status.Deprecated.V1Beta2 of a Phase2Obj. properties: conditions: diff --git a/util/test/builder/v1beta2_transition.go b/util/test/builder/v1beta2_transition.go index 0920620235ce..6ddd071d606e 100644 --- a/util/test/builder/v1beta2_transition.go +++ b/util/test/builder/v1beta2_transition.go @@ -129,11 +129,11 @@ type Phase1ObjStatus struct { Conditions clusterv1.Conditions `json:"conditions,omitempty"` // +optional - V1Beta2 *Phase1ObjStatusV1Beta2 `json:"v1beta2,omitempty"` + V1Beta2 *Phase1ObjV1Beta2Status `json:"v1beta2,omitempty"` } -// Phase1ObjStatusV1Beta2 defines the status.V1Beta2 of a Phase1Obj. -type Phase1ObjStatusV1Beta2 struct { +// Phase1ObjV1Beta2Status defines the status.V1Beta2 of a Phase1Obj. +type Phase1ObjV1Beta2Status struct { // +optional // +listType=map @@ -163,7 +163,7 @@ func (o *Phase1Obj) GetV1Beta2Conditions() []metav1.Condition { // SetV1Beta2Conditions sets conditions for an API object. func (o *Phase1Obj) SetV1Beta2Conditions(conditions []metav1.Condition) { if o.Status.V1Beta2 == nil { - o.Status.V1Beta2 = &Phase1ObjStatusV1Beta2{} + o.Status.V1Beta2 = &Phase1ObjV1Beta2Status{} } o.Status.V1Beta2.Conditions = conditions } @@ -206,18 +206,18 @@ type Phase2ObjStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` // +optional - Deprecated *Phase2ObjStatusDeprecated `json:"deprecated,omitempty"` + Deprecated *Phase2ObjDeprecatedStatus `json:"deprecated,omitempty"` } -// Phase2ObjStatusDeprecated defines the status.Deprecated of a Phase2Obj. -type Phase2ObjStatusDeprecated struct { +// Phase2ObjDeprecatedStatus defines the status.Deprecated of a Phase2Obj. +type Phase2ObjDeprecatedStatus struct { // +optional - V1Beta1 *Phase2ObjStatusDeprecatedV1Beta1 `json:"v1beta1,omitempty"` + V1Beta1 *Phase2ObjDeprecatedV1Beta1Status `json:"v1beta1,omitempty"` } -// Phase2ObjStatusDeprecatedV1Beta1 defines the status.Deprecated.V1Beta2 of a Phase2Obj. -type Phase2ObjStatusDeprecatedV1Beta1 struct { +// Phase2ObjDeprecatedV1Beta1Status defines the status.Deprecated.V1Beta2 of a Phase2Obj. +type Phase2ObjDeprecatedV1Beta1Status struct { // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` @@ -234,10 +234,10 @@ func (o *Phase2Obj) GetConditions() clusterv1.Conditions { // SetConditions sets the conditions on this object. func (o *Phase2Obj) SetConditions(conditions clusterv1.Conditions) { if o.Status.Deprecated == nil { - o.Status.Deprecated = &Phase2ObjStatusDeprecated{V1Beta1: &Phase2ObjStatusDeprecatedV1Beta1{}} + o.Status.Deprecated = &Phase2ObjDeprecatedStatus{V1Beta1: &Phase2ObjDeprecatedV1Beta1Status{}} } if o.Status.Deprecated.V1Beta1 == nil { - o.Status.Deprecated.V1Beta1 = &Phase2ObjStatusDeprecatedV1Beta1{} + o.Status.Deprecated.V1Beta1 = &Phase2ObjDeprecatedV1Beta1Status{} } o.Status.Deprecated.V1Beta1.Conditions = conditions } diff --git a/util/test/builder/zz_generated.deepcopy.go b/util/test/builder/zz_generated.deepcopy.go index 599a358ee3fb..696a9b99ee24 100644 --- a/util/test/builder/zz_generated.deepcopy.go +++ b/util/test/builder/zz_generated.deepcopy.go @@ -1027,7 +1027,7 @@ func (in *Phase1ObjStatus) DeepCopyInto(out *Phase1ObjStatus) { } if in.V1Beta2 != nil { in, out := &in.V1Beta2, &out.V1Beta2 - *out = new(Phase1ObjStatusV1Beta2) + *out = new(Phase1ObjV1Beta2Status) (*in).DeepCopyInto(*out) } } @@ -1043,7 +1043,7 @@ func (in *Phase1ObjStatus) DeepCopy() *Phase1ObjStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Phase1ObjStatusV1Beta2) DeepCopyInto(out *Phase1ObjStatusV1Beta2) { +func (in *Phase1ObjV1Beta2Status) DeepCopyInto(out *Phase1ObjV1Beta2Status) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions @@ -1054,12 +1054,12 @@ func (in *Phase1ObjStatusV1Beta2) DeepCopyInto(out *Phase1ObjStatusV1Beta2) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase1ObjStatusV1Beta2. -func (in *Phase1ObjStatusV1Beta2) DeepCopy() *Phase1ObjStatusV1Beta2 { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase1ObjV1Beta2Status. +func (in *Phase1ObjV1Beta2Status) DeepCopy() *Phase1ObjV1Beta2Status { if in == nil { return nil } - out := new(Phase1ObjStatusV1Beta2) + out := new(Phase1ObjV1Beta2Status) in.DeepCopyInto(out) return out } @@ -1091,6 +1091,48 @@ func (in *Phase2Obj) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Phase2ObjDeprecatedStatus) DeepCopyInto(out *Phase2ObjDeprecatedStatus) { + *out = *in + if in.V1Beta1 != nil { + in, out := &in.V1Beta1, &out.V1Beta1 + *out = new(Phase2ObjDeprecatedV1Beta1Status) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase2ObjDeprecatedStatus. +func (in *Phase2ObjDeprecatedStatus) DeepCopy() *Phase2ObjDeprecatedStatus { + if in == nil { + return nil + } + out := new(Phase2ObjDeprecatedStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Phase2ObjDeprecatedV1Beta1Status) DeepCopyInto(out *Phase2ObjDeprecatedV1Beta1Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(v1beta1.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase2ObjDeprecatedV1Beta1Status. +func (in *Phase2ObjDeprecatedV1Beta1Status) DeepCopy() *Phase2ObjDeprecatedV1Beta1Status { + if in == nil { + return nil + } + out := new(Phase2ObjDeprecatedV1Beta1Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Phase2ObjList) DeepCopyInto(out *Phase2ObjList) { *out = *in @@ -1150,7 +1192,7 @@ func (in *Phase2ObjStatus) DeepCopyInto(out *Phase2ObjStatus) { } if in.Deprecated != nil { in, out := &in.Deprecated, &out.Deprecated - *out = new(Phase2ObjStatusDeprecated) + *out = new(Phase2ObjDeprecatedStatus) (*in).DeepCopyInto(*out) } } @@ -1165,48 +1207,6 @@ func (in *Phase2ObjStatus) DeepCopy() *Phase2ObjStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Phase2ObjStatusDeprecated) DeepCopyInto(out *Phase2ObjStatusDeprecated) { - *out = *in - if in.V1Beta1 != nil { - in, out := &in.V1Beta1, &out.V1Beta1 - *out = new(Phase2ObjStatusDeprecatedV1Beta1) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase2ObjStatusDeprecated. -func (in *Phase2ObjStatusDeprecated) DeepCopy() *Phase2ObjStatusDeprecated { - if in == nil { - return nil - } - out := new(Phase2ObjStatusDeprecated) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Phase2ObjStatusDeprecatedV1Beta1) DeepCopyInto(out *Phase2ObjStatusDeprecatedV1Beta1) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(v1beta1.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Phase2ObjStatusDeprecatedV1Beta1. -func (in *Phase2ObjStatusDeprecatedV1Beta1) DeepCopy() *Phase2ObjStatusDeprecatedV1Beta1 { - if in == nil { - return nil - } - out := new(Phase2ObjStatusDeprecatedV1Beta1) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Phase3Obj) DeepCopyInto(out *Phase3Obj) { *out = *in