Add CRD name to error message when it is not ready to use

When debugging this error it is currently hard to identify what
CRD is causing the issue. This is particularly difficult when
dealing with over a hundred CRDs.

Signed-off-by: Jose Arevalo <jose.matias.arevalo@gmail.com>
This commit is contained in:
Jose Arevalo
2024-01-10 11:57:09 +10:00
committed by Jose Arevalo
parent e65ef28948
commit 0b307ca035
2 changed files with 2 additions and 1 deletions

View File

@@ -0,0 +1 @@
Add CRD name to error message when it is not ready to use

View File

@@ -1757,7 +1757,7 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso
if groupResource == kuberesource.CustomResourceDefinitions {
available, err := ctx.crdAvailable(name, resourceClient)
if err != nil {
errs.Add(namespace, errors.Wrapf(err, "error verifying custom resource definition is ready to use"))
errs.Add(namespace, errors.Wrapf(err, "error verifying the CRD %s is ready to use", name))
} else if !available {
errs.Add(namespace, fmt.Errorf("the CRD %s is not available to use for custom resources", name))
}