我已成功使用Fabric8 Kubernetes客户端events()
API订阅我的minikube安装发出的一堆事件。非常酷!在fabric8 Kubernetes客户端事件()API中,Watcher.Action指示什么?
的(无证)Watcher
类有一个(未记录的)eventReceived()
method,其第一个参数是一个Watcher.Action
(一个enum
与ADDED
,MODIFIED
,DELETED
和ERROR
值)。它的第二个参数是(我发现了in another question)Event
,它代表了一个Kubernetes Event
资源(我猜)。
我在事件流中注意到的是有用的信息,但“行动”似乎并不符合事件。例如,这里是从我实施eventReceived()
一些任意的输出(我已经打印出来+++ action:
显示我的东西与所通知的动作):
+++ action: DELETED
Event(apiVersion=v1, count=1, firstTimestamp=2017-04-25T23:41:54Z, involvedObject=ObjectReference(apiVersion=v1, fieldPath=spec.containers{controller-manager}, kind=Pod, name=catalog-catalog-controller-manager-1242994143-ddl0l, namespace=catalog, resourceVersion=462865, uid=11fc24bf-2a05-11e7-a27a-080027117396, additionalProperties={}), kind=Event, lastTimestamp=2017-04-25T23:41:54Z, message=Started container with id 7b51c389f153832e7719a99738706c2ff38aa28b298b80741f439b712f166262, metadata=ObjectMeta(annotations=null, clusterName=null, creationTimestamp=2017-04-25T23:41:54Z, deletionGracePeriodSeconds=null, deletionTimestamp=null, finalizers=[], generateName=null, generation=null, labels=null, name=catalog-catalog-controller-manager-1242994143-ddl0l.14b8c87cc177fb77, namespace=catalog, ownerReferences=[], resourceVersion=472706, selfLink=/api/v1/namespaces/catalog/events/catalog-catalog-controller-manager-1242994143-ddl0l.14b8c87cc177fb77, uid=c3851fae-2a10-11e7-a27a-080027117396, additionalProperties={}), reason=Started, source=EventSource(component=kubelet, host=minikube, additionalProperties={}), type=Normal, additionalProperties={})
所以你会注意到,行动DELETED
,和该事件似乎描述了Pod
(注意message=Started container with id…
数据)的开始。
这是什么意思?我误解了Action
参数试图告诉我什么?这是否意味着实际上Event
资源与uid=c3851fae-2a10-11e7-a27a-080027117396
已DELETED
(这是很多情况下很无用的信息,但我可以看到,我猜,如果事件是也资源,你会得到,以及事件表明他们的删除,我猜)?
我已经写了一些关于此的详细信息:https://lairdnelson.wordpress.com/2017/04/27/kubernetes-events-can-be-complicated/ –