mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
consider nil ready as ready (#4632)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user