vmware-tanzu/sources-for-knative

Log resource name and namespace in `ReconcileKind`

embano1 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Comply with Tanzu TAP logging guidelines:

Webhooks/Controllers (in the context of reconciling a specific resource) should include the resource-being-reconciled’s namespace, kind, and name as structured fields in all entries.

Describe the solution you'd like
Verify (or add if not present) resource name and namespace during the various ReconcileKind stages (incl. sub-stages, i.e. individual kind resources).

Describe alternatives you've considered
Keep as is/verify whether existing knative/pkg logging already does this.

Additional context
Add any other context or screenshots about the feature request here.

Update:

The current implementation in the vsphere reconciler already logs this information via the standardized knative.dev/key and knative.dev/kind fields e.g.:

{
    "level": "info",
    "ts": "2022-04-25T09:27:17.713Z",
    "logger": "vsphere-source-webhook",
    "caller": "controller/controller.go:550",
    "msg": "Reconcile succeeded",
    "commit": "9018e18",
    "knative.dev/controller": "github.com.vmware-tanzu.sources-for-knative.pkg.reconciler.vspheresource.Reconciler",
    "knative.dev/kind": "sources.tanzu.vmware.com.VSphereSource",
    "knative.dev/traceid": "6676c8bc-32eb-4aa7-ab75-c5d933a15997",
    "knative.dev/key": "default/vcsim",
    "duration": 0.0616764
}

TODO:

  • Add Reconciled vspheresource %q at the end of a ReconcileKind loop for clarity
  • Distinct between creating and updating a deployment during ReconcileKind for clarity