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

Add Backup warning for inclusion of NS managed by ArgoCD #8257

Merged

Conversation

shubham-pampattiwar
Copy link
Collaborator

Thank you for contributing to Velero!

Please add a summary of your change

This change adds a warning to velero backup operation if there are namespaces included in the backup which are managed by ArgoCD.

We’ve observed conflicts between Velero and ArgoCD in such environments and produce undesirable outcomes. This backup warning serves as a notification to ensure users are aware of the potential problems.

Does your change fix a particular issue?

Fix Related to #7905

Please indicate you've done the following:

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 9 lines in your changes missing coverage. Please review.

Project coverage is 58.96%. Comparing base (42de654) to head (738bb79).
Report is 100 commits behind head on main.

Files with missing lines Patch % Lines
pkg/backup/backup.go 66.66% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8257      +/-   ##
==========================================
- Coverage   59.21%   58.96%   -0.25%     
==========================================
  Files         367      368       +1     
  Lines       30841    39000    +8159     
==========================================
+ Hits        18262    22996    +4734     
- Misses      11119    14539    +3420     
- Partials     1460     1465       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

}

nsLabels := ns.GetLabels()
if len(nsLabels[ArgoCDManagedByNamespaceLabel]) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check if label exist here instead of checking if its value is not an empty string?

Copy link
Member

Choose a reason for hiding this comment

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

That would probably be better.. as long as we know it is possible label only need key and empty value is ok

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The rationale here is the having an empty value for the ArgoCD label key would not make much sense, so this acts as a additional check.

Copy link
Member

Choose a reason for hiding this comment

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

While it may not make sense, we need to match whatever argocd logic is regarding namespace it manages. If it disallows empty value label then current code is fine.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like the value here should never be empty according to docs. Value would be namespace where argocd instance lives. An Argo CD instance always live in a namespace, and namespaces are never empty string.

We can just check if length is > 0 in this case.

@shubham-pampattiwar shubham-pampattiwar force-pushed the add-warn-argocd branch 2 times, most recently from af65ba2 to 272b77e Compare October 3, 2024 08:09
kaovilai
kaovilai previously approved these changes Oct 15, 2024
sseago
sseago previously approved these changes Oct 17, 2024
sseago
sseago previously approved these changes Oct 29, 2024
Signed-off-by: Shubham Pampattiwar <[email protected]>

add changelog file

Signed-off-by: Shubham Pampattiwar <[email protected]>

run make update

Signed-off-by: Shubham Pampattiwar <[email protected]>

re-position import

Signed-off-by: Shubham Pampattiwar <[email protected]>

update argo cd label comment

Signed-off-by: Shubham Pampattiwar <[email protected]>

add nil check for backupRequest.Spec.IncludedNamespaces

Signed-off-by: Shubham Pampattiwar <[email protected]>

minor fix

Signed-off-by: Shubham Pampattiwar <[email protected]>

fix edge cases

Signed-off-by: Shubham Pampattiwar <[email protected]>

add gh issue link in code comments

Signed-off-by: Shubham Pampattiwar <[email protected]>
Copy link
Contributor

@reasonerjt reasonerjt left a comment

Choose a reason for hiding this comment

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

lgtm

@shubham-pampattiwar shubham-pampattiwar merged commit aed944c into vmware-tanzu:main Nov 20, 2024
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants