cluster-api-provider-vsphere icon indicating copy to clipboard operation
cluster-api-provider-vsphere copied to clipboard

Log all errors before returning reconciler result.

Open randomvariable opened this issue 5 years ago • 5 comments
trafficstars

/kind feature

Describe the solution you'd like [A clear and concise description of what you want to happen.] Whereever any controller returns an error, adopt the convention of logging the error first then returning nil or bare error. This is to preserve the line number of the error, and is a convention followed in the AWS provider.

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

  • Cluster-api-provider-vsphere version:
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):

randomvariable avatar Feb 26 '20 19:02 randomvariable

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Jul 27 '20 18:07 fejta-bot

/lifecycle frozen

randomvariable avatar Aug 03 '20 14:08 randomvariable

/help

srm09 avatar Jan 30 '22 21:01 srm09

@srm09: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jan 30 '22 21:01 k8s-ci-robot

/assign @aartij17

aartij17 avatar Jan 30 '22 23:01 aartij17

Just discussed this a bit with Christian and Naadir.

We are probably okay with not doing this assuming we use errors.Wrap and errors.New (IIRC) consistently.

Basically if JSON logging is enabled we get the full error stack already

{
  "ts": 1689767649795.3796,
  "caller": "machinedeployment/machinedeployment_controller.go:167",
  "msg": "Failed to reconcile MachineDeployment",
  "controller": "machinedeployment",
  "controllerGroup": "cluster.x-k8s.io",
  "controllerKind": "MachineDeployment",
  "MachineDeployment": {
    "name": "self-hosted-u5e02g-md-0",
    "namespace": "self-hosted-zvvcyb"
  },
  "namespace": "self-hosted-zvvcyb",
  "name": "self-hosted-u5e02g-md-0",
  "reconcileID": "45e6b413-ca5c-45bd-9b5a-2f31bedb0d1d",
  "Cluster": {
    "name": "self-hosted-u5e02g",
    "namespace": "self-hosted-zvvcyb"
  },
  "err": "failed to retrieve DockerMachineTemplate external object \"self-hosted-zvvcyb\"/\"self-hosted-u5e02g-md-0\": DockerMachineTemplate.infrastructure.cluster.x-k8s.io \"self-hosted-u5e02g-md-0\" not found",
  "errVerbose": "DockerMachineTemplate.infrastructure.cluster.x-k8s.io \"self-hosted-u5e02g-md-0\" not found\nfailed to retrieve DockerMachineTemplate external object \"self-hosted-zvvcyb\"/\"self-hosted-u5e02g-md-0\"\nsigs.k8s.io/cluster-api/controllers/external.Get\n\tsigs.k8s.io/cluster-api/controllers/external/util.go:44\nsigs.k8s.io/cluster-api/internal/controllers/machinedeployment.reconcileExternalTemplateReference\n\tsigs.k8s.io/cluster-api/internal/controllers/machinedeployment/machinedeployment_controller.go:422\nsigs.k8s.io/cluster-api/internal/controllers/machinedeployment.(*Reconciler).reconcile\n\tsigs.k8s.io/cluster-api/internal/controllers/machinedeployment/machinedeployment_controller.go:217\nsigs.k8s.io/cluster-api/internal/controllers/machinedeployment.(*Reconciler).Reconcile\n\tsigs.k8s.io/cluster-api/internal/controllers/machinedeployment/machinedeployment_controller.go:165\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:118\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:314\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226\nruntime.goexit\n\truntime/asm_amd64.s:1598"
}

sbueringer avatar Jul 19 '23 14:07 sbueringer

sgtm

/close

randomvariable avatar Jul 19 '23 15:07 randomvariable

@randomvariable: Closing this issue.

In response to this:

sgtm

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jul 19 '23 15:07 k8s-ci-robot