Skip to content

Commit 3ea69da

Browse files
committed
remove empty condition list when doing conversion.
1 parent 40fdedb commit 3ea69da

File tree

2 files changed

+3
-37
lines changed

2 files changed

+3
-37
lines changed

apix/v1alpha2/inferencepool_conversion.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ func convertStatusToV1(src *InferencePoolStatus) (*v1.InferencePoolStatus, error
103103
}
104104
for _, p := range src.Parents {
105105
ps := v1.ParentStatus{
106-
ParentRef: toV1ParentRef(p.GatewayRef),
107-
Conditions: make([]metav1.Condition, 0, len(p.Conditions)),
106+
ParentRef: toV1ParentRef(p.GatewayRef),
108107
}
109108
for _, c := range p.Conditions {
110109
cc := c
@@ -133,7 +132,6 @@ func convertStatusFromV1(src *v1.InferencePoolStatus) (*InferencePoolStatus, err
133132
for _, p := range src.Parents {
134133
ps := PoolStatus{
135134
GatewayRef: fromV1ParentRef(p.ParentRef),
136-
Conditions: make([]metav1.Condition, 0, len(p.Conditions)),
137135
}
138136
for _, c := range p.Conditions {
139137
cc := c

apix/v1alpha2/inferencepool_conversion_test.go

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func TestInferencePoolConvertTo(t *testing.T) {
127127
wantErr: false,
128128
},
129129
{
130-
name: "conversion from v1alpha2 to v1 with empty extensionRef",
130+
name: "conversion from v1alpha2 to v1 with empty extensionRef and empty status condition",
131131
src: &InferencePool{
132132
TypeMeta: metav1.TypeMeta{
133133
Kind: "InferencePool",
@@ -147,14 +147,6 @@ func TestInferencePoolConvertTo(t *testing.T) {
147147
Parents: []PoolStatus{
148148
{
149149
GatewayRef: ParentGatewayReference{Name: "my-gateway"},
150-
Conditions: []metav1.Condition{
151-
{
152-
Type: string(InferencePoolConditionAccepted),
153-
Status: metav1.ConditionTrue,
154-
Reason: string(InferencePoolReasonAccepted),
155-
LastTransitionTime: timestamp,
156-
},
157-
},
158150
},
159151
},
160152
},
@@ -180,14 +172,6 @@ func TestInferencePoolConvertTo(t *testing.T) {
180172
Parents: []v1.ParentStatus{
181173
{
182174
ParentRef: v1.ParentReference{Name: "my-gateway"},
183-
Conditions: []metav1.Condition{
184-
{
185-
Type: string(v1.InferencePoolConditionAccepted),
186-
Status: metav1.ConditionTrue,
187-
Reason: string(v1.InferencePoolReasonAccepted),
188-
LastTransitionTime: timestamp,
189-
},
190-
},
191175
},
192176
},
193177
},
@@ -300,7 +284,7 @@ func TestInferencePoolConvertFrom(t *testing.T) {
300284
wantErr: false,
301285
},
302286
{
303-
name: "conversion from v1 to v1alpha2 with empty extensionRef",
287+
name: "conversion from v1 to v1alpha2 with empty extensionRef and empty status condition",
304288
src: &v1.InferencePool{
305289
TypeMeta: metav1.TypeMeta{
306290
Kind: "InferencePool",
@@ -322,14 +306,6 @@ func TestInferencePoolConvertFrom(t *testing.T) {
322306
Parents: []v1.ParentStatus{
323307
{
324308
ParentRef: v1.ParentReference{Name: "my-gateway"},
325-
Conditions: []metav1.Condition{
326-
{
327-
Type: string(v1.InferencePoolConditionAccepted),
328-
Status: metav1.ConditionTrue,
329-
Reason: string(v1.InferencePoolReasonAccepted),
330-
LastTransitionTime: timestamp,
331-
},
332-
},
333309
},
334310
},
335311
},
@@ -353,14 +329,6 @@ func TestInferencePoolConvertFrom(t *testing.T) {
353329
Parents: []PoolStatus{
354330
{
355331
GatewayRef: ParentGatewayReference{Name: "my-gateway"},
356-
Conditions: []metav1.Condition{
357-
{
358-
Type: string(InferencePoolConditionAccepted),
359-
Status: metav1.ConditionTrue,
360-
Reason: string(InferencePoolReasonAccepted),
361-
LastTransitionTime: timestamp,
362-
},
363-
},
364332
},
365333
},
366334
},

0 commit comments

Comments
 (0)