vmware-tanzu / cartographer

Cartographer is a Supply Chain Choreographer.
https://cartographer.sh
Apache License 2.0
447 stars 64 forks source link

Missing 'finished' and 'no longer exists' messages when a resource is deleted #62

Open squeedee opened 3 years ago

squeedee commented 3 years ago
In order to reason about and debug supply-chain-controller behavior
When I delete a workload or supply-chain
I want to see completion log output for the reconcile loop

Acceptance Criteria

Given I have a workload(or supplychain) applied
And it has a status (indicating it's been reconciled)
When I delete the workload
Then I see controller log output saying that the workload(or supplychain) no longer exists
And I see a "finished" log message
Given I have a workload(or supplychain) applied
When the reconcile runs, but the apiserver is unreachable (or any other exceptional circumstance)
Then I see controller log output saying that the workload(or supplychain) could not be fetched
And I see a "finished" log message

Details

Regardless of what happens in a reconcile, I expect to see a matching 'finished' log message.

They are absent when a get from the apiserver fails or returns nil.

We should also log

  1. "no longer exists" messages
  2. any catastrophic api errors (cant reach, server error, client error etc)

https://github.com/vmware-tanzu/cartographer/blob/c1fe468d2bc1a037da2b2c38f125dfdbea2c6ee1/pkg/controller/workload/reconciler.go#L58-L64

https://github.com/vmware-tanzu/cartographer/blob/c1fe468d2bc1a037da2b2c38f125dfdbea2c6ee1/pkg/controller/supplychain/reconciler.go#L59-L65

squeedee commented 3 years ago

In the case of unreachable, controller-runtime may be logging the error (after 'finished', though)