switch kubelet to use external (client-go) object references for events
This commit is contained in:
@@ -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(
|
||||
|
@@ -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,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user