Commit 54093796 authored by Chris O'Haver's avatar Chris O'Haver Committed by GitHub

consider nil ready as ready (#4632)

Signed-off-by: default avatarChris O'Haver <cohaver@infoblox.com>
parent fc24fe07
...@@ -128,7 +128,7 @@ func EndpointSliceToEndpoints(obj meta.Object) (meta.Object, error) { ...@@ -128,7 +128,7 @@ func EndpointSliceToEndpoints(obj meta.Object) (meta.Object, error) {
} }
for _, end := range ends.Endpoints { for _, end := range ends.Endpoints {
if end.Conditions.Ready == nil || !*end.Conditions.Ready { if !endpointsliceReady(end.Conditions.Ready) {
continue continue
} }
for _, a := range end.Addresses { for _, a := range end.Addresses {
...@@ -178,7 +178,7 @@ func EndpointSliceV1beta1ToEndpoints(obj meta.Object) (meta.Object, error) { ...@@ -178,7 +178,7 @@ func EndpointSliceV1beta1ToEndpoints(obj meta.Object) (meta.Object, error) {
} }
for _, end := range ends.Endpoints { for _, end := range ends.Endpoints {
if end.Conditions.Ready == nil || !*end.Conditions.Ready { if !endpointsliceReady(end.Conditions.Ready) {
continue continue
} }
for _, a := range end.Addresses { for _, a := range end.Addresses {
...@@ -200,6 +200,15 @@ func EndpointSliceV1beta1ToEndpoints(obj meta.Object) (meta.Object, error) { ...@@ -200,6 +200,15 @@ func EndpointSliceV1beta1ToEndpoints(obj meta.Object) (meta.Object, error) {
return e, nil return e, nil
} }
func endpointsliceReady(ready *bool) bool {
// Per API docs: a nil value indicates an unknown state. In most cases consumers
// should interpret this unknown state as ready.
if ready == nil {
return true
}
return *ready
}
// CopyWithoutSubsets copies e, without the subsets. // CopyWithoutSubsets copies e, without the subsets.
func (e *Endpoints) CopyWithoutSubsets() *Endpoints { func (e *Endpoints) CopyWithoutSubsets() *Endpoints {
e1 := &Endpoints{ e1 := &Endpoints{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment