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

Fix OADP-5111: Backups partially fails when backing up all namespaces #355

Merged

Conversation

shubham-pampattiwar
Copy link
Member

Thank you for contributing to Velero!

Please add a summary of your change

Does your change fix a particular issue?

Fixes #(issue)

Please indicate you've done the following:

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Oct 24, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 24, 2024

@shubham-pampattiwar: This pull request references OADP-5111 which is a valid jira issue.

In response to this:

Thank you for contributing to Velero!

Please add a summary of your change

Does your change fix a particular issue?

Fixes #(issue)

Please indicate you've done the following:

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link

openshift-ci bot commented Oct 24, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 24, 2024
@kaovilai
Copy link
Member

Related to #354

@kaovilai
Copy link
Member

kaovilai commented Oct 25, 2024

just noting that current warning code would not work for vmware-tanzu#8342 if it merges

@shubham-pampattiwar shubham-pampattiwar marked this pull request as ready for review October 25, 2024 16:47
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 25, 2024
@kaovilai
Copy link
Member

kaovilai commented Oct 25, 2024

This might work for vmware-tanzu#8342 a bit better.

backup.go/BackupWithResolvers

	if len(backupRequest.Spec.IncludedNamespaces) > 0 {
		nsManagedByArgoCD := getNamespacesManagedByArgoCD(kb.kbClient, backupRequest.NamespaceIncludesExcludes, log)
func getNamespacesManagedByArgoCD(kbClient kbclient.Client, includedNamespaces *collections.IncludesExcludes, log logrus.FieldLogger) []string {
	var nsManagedByArgoCD []string

	for _, nsName := range includedNamespaces.GetIncludes() {
	    ns := corev1api.Namespace{}
	    if err := kbClient.Get(context.Background(), kbclient.ObjectKey{Name: nsName}, &ns); err != nil {
		    // check for only those ns that exist and are included in backup
		    // here we ignore cases like "" or "*" specified under includedNamespaces
		    if apierrors.IsNotFound(err) {
			    continue
		    }
		    log.WithError(err).Errorf("error getting namespace %s", nsName)
		    continue
	    }
    
	    nsLabels := ns.GetLabels()
	    if len(nsLabels[ArgoCDManagedByNamespaceLabel]) > 0 {
		    nsManagedByArgoCD = append(nsManagedByArgoCD, nsName)
	    }
	}
	return nsManagedByArgoCD
}

@shubham-pampattiwar
Copy link
Member Author

yeah we would need additional changes for covering namespacesIncludedByLabelSelector. Anyways current PR should be fine OADP 1.3.z

Copy link
Member

@kaovilai kaovilai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 25, 2024
Copy link

openshift-ci bot commented Oct 25, 2024

@shubham-pampattiwar: all tests passed!

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

@kaovilai kaovilai added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 25, 2024
Copy link

openshift-ci bot commented Oct 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: kaovilai, shubham-pampattiwar, sseago

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 42944e9 into openshift:oadp-1.3 Oct 25, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants