From 91638eba659ae2029d463b0f7aab26dfd7e18310 Mon Sep 17 00:00:00 2001 From: Somefive Date: Mon, 6 Mar 2023 13:18:05 +0800 Subject: [PATCH] Fix: make read-only object not found error more clear (#5614) Signed-off-by: Somefive --- pkg/utils/apply/apply.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/utils/apply/apply.go b/pkg/utils/apply/apply.go index c84582487..763c8ddcb 100644 --- a/pkg/utils/apply/apply.go +++ b/pkg/utils/apply/apply.go @@ -231,7 +231,7 @@ func createOrGetExisting(ctx context.Context, act *applyAction, c client.Client, return nil, err } if act.readOnly { - return nil, fmt.Errorf("cannot create %s (%s) in read-only mode", desired.GetObjectKind().GroupVersionKind().Kind, desired.GetName()) + return nil, fmt.Errorf("%s (%s) is marked as read-only but does not exist. You should check the existence of the resource or remove the read-only policy", desired.GetObjectKind().GroupVersionKind().Kind, desired.GetName()) } if act.updateAnnotation { if err := addLastAppliedConfigAnnotation(desired); err != nil {