append status to all gateways
Signed-off-by: Roland.Ma <rolandma@kubesphere.io>
This commit is contained in:
@@ -259,12 +259,12 @@ func (c *gatewayOperator) GetGateways(namespace string) ([]*v1alpha1.Gateway, er
|
||||
}
|
||||
obj := &v1alpha1.Gateway{}
|
||||
err := c.client.Get(context.TODO(), key, obj)
|
||||
if errors.IsNotFound(err) {
|
||||
return gateways, nil
|
||||
} else if err != nil {
|
||||
|
||||
if err == nil {
|
||||
gateways = append(gateways, obj)
|
||||
} else if err != nil && !errors.IsNotFound(err) {
|
||||
return nil, err
|
||||
}
|
||||
gateways = append(gateways, obj)
|
||||
|
||||
for _, g := range gateways {
|
||||
s := &corev1.Service{}
|
||||
@@ -281,7 +281,7 @@ func (c *gatewayOperator) GetGateways(namespace string) ([]*v1alpha1.Gateway, er
|
||||
}
|
||||
}
|
||||
|
||||
return gateways, err
|
||||
return gateways, nil
|
||||
}
|
||||
|
||||
// Create a Gateway in a namespace
|
||||
|
||||
@@ -182,6 +182,9 @@ func Test_gatewayOperator_GetGateways(t *testing.T) {
|
||||
Type: corev1.ServiceTypeNodePort,
|
||||
},
|
||||
},
|
||||
Status: runtime.RawExtension{
|
||||
Raw: []byte("{\"loadBalancer\":{},\"service\":[{\"name\":\"http\",\"protocol\":\"TCP\",\"port\":80,\"targetPort\":0}]}\n"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user