2017-04-26 165 views
0

我已成功使用Fabric8 Kubernetes客戶端events() API訂閱我的minikube安裝發出的一堆事件。非常酷!在fabric8 Kubernetes客戶端事件()API中,Watcher.Action指示什麼?

的(無證)Watcher類有一個(未記錄的)eventReceived() method,其第一個參數是一個Watcher.Action(一個enumADDEDMODIFIEDDELETEDERROR值)。它的第二個參數是(我發現了in another questionEvent,它代表了一個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-080027117396DELETED(這是很多情況下很無用的信息,但我可以看到,我猜,如果事件是資源,你會得到,以及事件表明他們的刪除,我猜)?

回答

0

事實上,這的確是這個意思。 Event是在某些情況下由WatchEvent表示的資源。有關事件的某些kubectl行爲報告了這兩者的混合情況,但可以刪除Event(例如,當它概念上描述的事物消失時),並且Event的刪除表示爲WatchEvent

+0

我已經寫了一些關於此的詳細信息:https://lairdnelson.wordpress.com/2017/04/27/kubernetes-events-can-be-complicated/ –

相關問題