atlassian / smith

Smith is a Kubernetes workflow engine / resource manager
Apache License 2.0
285 stars 24 forks source link

Add an event recorder #379

Closed ychen-atlassian closed 5 years ago

ychen-atlassian commented 5 years ago

Fixes #94.

21s         Normal   ResourceInProgress            Bundle            UpdateInstanceRequestInFlight: Update request for ServiceInstance in-flight to Broker
21s         Normal   BundleInProgress              Bundle
20s         Normal   ResourceInProgress            Bundle            UpdatingInstance: The instance is being updated asynchronously
19s         Normal   ResourceInProgress            Bundle            UpdatingInstance: The instance is being updated asynchronously (Resource is being updated)
5s          Normal   ResourceReady                 Bundle            InstanceUpdatedSuccessfully: The instance was updated successfully
5s          Normal   ResourceReady                 Bundle            InjectedBindResult: Injected bind result
5s          Normal   ResourceReady                 Bundle
5s          Normal   ResourceReady                 Bundle            ProvisionedSuccessfully: The instance was provisioned successfully
5s          Normal   BundleReady                   Bundle

Each event is annotated with the resource name:

apiVersion: v1
count: 1
eventTime: null
firstTimestamp: 2018-11-20T07:14:33Z
involvedObject:
  apiVersion: smith.atlassian.com/v1
  kind: Bundle
  name: ychen-test-svc
  namespace: ychen-test-svc
  resourceVersion: "264528178"
  uid: a6ee32d4-e639-11e8-8e98-0a3eedf23e70
kind: Event
lastTimestamp: 2018-11-20T07:14:33Z
message: 'Blocked True "DependenciesNotReady" "Not ready: [\"noderefapp--basic--binding\"]"'
metadata:
  annotations:
    smith.atlassian.com/ResourceName: noderefapp--secretenvvar
  creationTimestamp: 2018-11-20T07:14:33Z
  name: ychen-test-svc.1568c3b96ba65b73
  namespace: ychen-test-svc
  resourceVersion: "64657438"
  selfLink: /api/v1/namespaces/ychen-test-svc/events/ychen-test-svc.1568c3b96ba65b73
  uid: ee30b1b0-ec93-11e8-8be6-06167b28a4ca
reason: ResourceBlocked
reportingComponent: ""
reportingInstance: ""
source:
  component: smith
type: Normal

Why is this good? Because we can see stuff like this in the events now:

4s          Normal   ResourceInProgress            Bundle            UpdatingInstance: The instance is being updated asynchronously (See Micros events using 'micros stream:poll ychen-test-svc-noderefapp -e ddev -i qhlpdjse1orn3e4p')

Using another system that groups these events and resources together we can build a nicer summary of what exactly happened in the state.

ash2k commented 5 years ago

LGTM, feel free to merge!