plugin/kubernetes: handle tombstones in default processor (#3890)
* handle deletion tombstones in default processor Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix terminating pod exclusion Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
parent
bb7ee5010e
commit
a3aeb3d503
4 changed files with 45 additions and 25 deletions
|
@ -1,6 +1,8 @@
|
|||
package object
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
@ -28,17 +30,16 @@ func ServiceKey(name, namespace string) string { return name + "." + namespace }
|
|||
|
||||
// ToService returns a function that converts an api.Service to a *Service.
|
||||
func ToService(skipCleanup bool) ToFunc {
|
||||
return func(obj interface{}) interface{} {
|
||||
return toService(skipCleanup, obj)
|
||||
return func(obj interface{}) (interface{}, error) {
|
||||
svc, ok := obj.(*api.Service)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected object %v", obj)
|
||||
}
|
||||
return toService(skipCleanup, svc), nil
|
||||
}
|
||||
}
|
||||
|
||||
func toService(skipCleanup bool, obj interface{}) interface{} {
|
||||
svc, ok := obj.(*api.Service)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
func toService(skipCleanup bool, svc *api.Service) *Service {
|
||||
s := &Service{
|
||||
Version: svc.GetResourceVersion(),
|
||||
Name: svc.GetName(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue