openshift / openshift/oadp-operator

Improve DPA reconcile error messages

Open
#1,536 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lifecycle/frozen
Dominant language
Go
Stars
92
Forks
93
Avg merge
1d 23h
Merged PRs (30d)
43

Description

Problem

It is difficult for users (and developers) to debug OADP errors without more context (studying DPA, for example).

Example

Some months ago, a new user was not able to set custom credential name to BSL (managed by DPA), as DPA would reconcile false with the generic error

Secret "cloud-credentials" not found

After some hours, OADP team asked for user DPA, and the problem was found. There was also VSL defined in DPA (probably copy/paste from example DPA)

https://github.com/openshift/oadp-operator/blob/68a1c47edd28a9acfd5f93bb76dd08989a6667ac/config/samples/oadp_v1alpha1_dpa.yaml#L28-L33

This problem could have been resolved immediately if the error message was more informative. Example

VolumeSnapshotLocation <VSL-name> defined in DPA spec.snapshotLocations[<index>] is invalid: 
   create Secret "cloud-credentials" in namespace <namespace-name> or change Secret name in DPA spec.snapshotLocations[<index>].velero.credential.name

Solution

Solution would be to rewrite OADP error messages to be more informative.

A first approach suggestion is to check error messages in tests that are already written, BUT do NOT check error messages.

Example

This test

https://github.com/openshift/oadp-operator/blob/68a1c47edd28a9acfd5f93bb76dd08989a6667ac/controllers/bsl_test.go#L57

only checks if error occurred, without testing the error message.

This is very WRONG. Some of these tests are broken, because their error messages do not relate to what is being tested. But they are are not failing in CI, as we check only if an error occurred, and not what error occurred.

Maybe this command can help found other tests like this

grep -Iinr 'wantErr:' . --include=\*_test.go

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with controllers/bsl_test.go and use the suggested grep command to find tests that only check whether an error occurred. Review the DPA example in config/samples/oadp_v1alpha1_dpa.yaml for the credential and snapshot-location context. Done means reconciliation errors identify the relevant DPA location, secret, namespace, or field, with tests checking the resulting messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.