Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore the "ConfigMap kube-root-ca.crt already exists" warning #8

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ HUGO_IMAGE := hugo-builder
local : ARCH ?= $(shell go env GOOS)-$(shell go env GOARCH)
ARCH ?= linux-amd64

VERSION ?= v1.14.0.4
VERSION ?= v1.14.0.5

TAG_LATEST ?= false

Expand Down
6 changes: 4 additions & 2 deletions pkg/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1589,13 +1589,15 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso
ctx.log.Infof("ServiceAccount %s successfully updated", kube.NamespaceAndName(obj))
}
default:
// Ignore the warning that kube-root-ca.crt already exists
ignoreWarning := obj.GetKind() == "ConfigMap" && obj.GetName() == "kube-root-ca.crt"
// check for the presence of existingResourcePolicy
if len(ctx.restore.Spec.ExistingResourcePolicy) > 0 {
resourcePolicy := ctx.restore.Spec.ExistingResourcePolicy
ctx.log.Infof("restore API has resource policy defined %s , executing restore workflow accordingly for changed resource %s %s", resourcePolicy, fromCluster.GroupVersionKind().Kind, kube.NamespaceAndName(fromCluster))

// existingResourcePolicy is set as none, add warning
if resourcePolicy == velerov1api.PolicyTypeNone {
if resourcePolicy == velerov1api.PolicyTypeNone && !ignoreWarning {
e := errors.Errorf("could not restore, %s %q already exists. Warning: the in-cluster version is different than the backed-up version",
obj.GetKind(), obj.GetName())
warnings.Add(namespace, e)
Expand All @@ -1610,7 +1612,7 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso
warnings.Merge(&warningsFromUpdateRP)
errs.Merge(&errsFromUpdateRP)
}
} else {
} else if !ignoreWarning {
// Preserved Velero behavior when existingResourcePolicy is not specified by the user
e := errors.Errorf("could not restore, %s %q already exists. Warning: the in-cluster version is different than the backed-up version",
obj.GetKind(), obj.GetName())
Expand Down
Loading