diff options
author | 2021-05-17 16:10:30 -0400 | |
---|---|---|
committer | 2021-05-17 16:10:30 -0400 | |
commit | 540937964890ad36b56841374f7f83ef7a2a0247 (patch) | |
tree | e65ebfc78e531043c8c322f7bdb8c848818f346b /plugin | |
parent | fc24fe076f1c9a829841ec8abcd0ef4e300965e0 (diff) | |
download | coredns-540937964890ad36b56841374f7f83ef7a2a0247.tar.gz coredns-540937964890ad36b56841374f7f83ef7a2a0247.tar.zst coredns-540937964890ad36b56841374f7f83ef7a2a0247.zip |
consider nil ready as ready (#4632)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/kubernetes/object/endpoint.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugin/kubernetes/object/endpoint.go b/plugin/kubernetes/object/endpoint.go index f504904a8..6ce7bfefa 100644 --- a/plugin/kubernetes/object/endpoint.go +++ b/plugin/kubernetes/object/endpoint.go @@ -128,7 +128,7 @@ func EndpointSliceToEndpoints(obj meta.Object) (meta.Object, error) { } for _, end := range ends.Endpoints { - if end.Conditions.Ready == nil || !*end.Conditions.Ready { + if !endpointsliceReady(end.Conditions.Ready) { continue } for _, a := range end.Addresses { @@ -178,7 +178,7 @@ func EndpointSliceV1beta1ToEndpoints(obj meta.Object) (meta.Object, error) { } for _, end := range ends.Endpoints { - if end.Conditions.Ready == nil || !*end.Conditions.Ready { + if !endpointsliceReady(end.Conditions.Ready) { continue } for _, a := range end.Addresses { @@ -200,6 +200,15 @@ func EndpointSliceV1beta1ToEndpoints(obj meta.Object) (meta.Object, error) { 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. func (e *Endpoints) CopyWithoutSubsets() *Endpoints { e1 := &Endpoints{ |