switch kubelet to use external (client-go) object references for events

This commit is contained in:
deads2k
2017-01-31 15:59:22 -05:00
committed by David Eads
parent 8a12000402
commit a106d9f848
16 changed files with 65 additions and 19 deletions

View File

@@ -11,6 +11,10 @@ go_library(
name = "go_default_library",
srcs = ["event.go"],
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//vendor:k8s.io/client-go/pkg/api/v1",
],
)
filegroup(

View File

@@ -16,6 +16,11 @@ limitations under the License.
package events
import (
clientv1 "k8s.io/client-go/pkg/api/v1"
"k8s.io/kubernetes/pkg/api/v1"
)
const (
// Container event reason list
CreatedContainer = "Created"
@@ -76,3 +81,19 @@ const (
FailedPreStopHook = "FailedPreStopHook"
UnfinishedPreStopHook = "UnfinishedPreStopHook"
)
// ToObjectReference takes an old style object reference and converts it to a client-go one
func ToObjectReference(ref *v1.ObjectReference) *clientv1.ObjectReference {
if ref == nil {
return nil
}
return &clientv1.ObjectReference{
Kind: ref.Kind,
Namespace: ref.Namespace,
Name: ref.Name,
UID: ref.UID,
APIVersion: ref.APIVersion,
ResourceVersion: ref.ResourceVersion,
FieldPath: ref.FieldPath,
}
}