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: admin export and import applications and applicationsets from other namespaces #19510

Conversation

ilia-medvedev-codefresh
Copy link
Contributor

Closes #14596

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
@ilia-medvedev-codefresh ilia-medvedev-codefresh requested a review from a team as a code owner August 13, 2024 07:52
Copy link

bunnyshell bot commented Aug 13, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

bunnyshell bot commented Aug 13, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@pasha-codefresh pasha-codefresh self-requested a review August 13, 2024 07:52
@pasha-codefresh
Copy link
Member

@CodiumAI-Agent /review

@CodiumAI-Agent
Copy link

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 Security concerns

No specific security vulnerabilities identified in the PR code, but ensure that all new network interactions, file operations, and data processing are secure and validate inputs appropriately.

⚡ Key issues to review

Error Handling
The use of errors.CheckError(err) directly after operations like dynamic.NewForConfig(config) or acdClients.configMaps.Get(ctx, common.ArgoCDConfigMapName, v1.GetOptions()) could lead to termination of the program. Consider handling errors gracefully without exiting the program, especially in a command-line application where returning an error message might be more appropriate.

Security Concern
The function redactor in the iterateStringFields method is designed to mask secrets in configurations. Ensure that all sensitive fields are considered and that this method is thoroughly tested to prevent accidental exposure of sensitive data.

Namespace Handling
The logic for handling namespaces in the export and import commands seems complex and could be prone to errors, especially with the manual string manipulations and checks. Consider simplifying this logic or using existing Kubernetes utilities that handle namespace filtering.

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
cmd/argocd/commands/admin/admin.go Outdated Show resolved Hide resolved
cmd/argocd/commands/admin/admin.go Outdated Show resolved Hide resolved
cmd/argocd/commands/admin/admin.go Outdated Show resolved Hide resolved
@pasha-codefresh
Copy link
Member

@ilia-medvedev-codefresh please run

make lint-local
make codegen-local

Let me know if help needed

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 23.91304% with 70 lines in your changes missing coverage. Please review.

Project coverage is 55.79%. Comparing base (588b251) to head (246607a).
Report is 515 commits behind head on master.

Files with missing lines Patch % Lines
cmd/argocd/commands/admin/backup.go 0.00% 66 Missing ⚠️
cmd/argocd/commands/admin/admin.go 84.61% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19510      +/-   ##
==========================================
- Coverage   55.80%   55.79%   -0.02%     
==========================================
  Files         316      316              
  Lines       43682    43737      +55     
==========================================
+ Hits        24376    24401      +25     
- Misses      16743    16773      +30     
  Partials     2563     2563              

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

@reggie-k
Copy link
Member

LGTM.
As per discussion with Pasha, it would be beneficial for the "import --prune" option to have an "Are you sure" prompt, listing the number of the resources that are expected to be deleted.
Opening a separate issue for that (since adding a prompt is a breaking change for CI/other automations).

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
@ilia-medvedev-codefresh ilia-medvedev-codefresh requested a review from a team as a code owner August 13, 2024 09:42
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
@pasha-codefresh pasha-codefresh enabled auto-merge (squash) August 13, 2024 10:40
Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
@pasha-codefresh pasha-codefresh enabled auto-merge (squash) August 13, 2024 10:56
@pasha-codefresh pasha-codefresh self-requested a review August 13, 2024 16:08
@pasha-codefresh pasha-codefresh merged commit 2cb7616 into argoproj:master Aug 13, 2024
27 of 28 checks passed
reggie-k pushed a commit to reggie-k/argo-cd that referenced this pull request Aug 14, 2024
…her namespaces (argoproj#19510)

* add support for all namespaces for apps and appsets in export and import

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* cleanup accidental merge issue

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* address comments and run lint

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* small fix

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* switch to make for slice

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* remove new line in command flags

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

---------

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
ChichiCaleb pushed a commit to ChichiCaleb/argo-cd that referenced this pull request Aug 15, 2024
…her namespaces (argoproj#19510)

* add support for all namespaces for apps and appsets in export and import

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* cleanup accidental merge issue

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* address comments and run lint

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* small fix

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* switch to make for slice

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* remove new line in command flags

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

---------

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
Signed-off-by: ChichiCaleb <ChichiCaleb@chichiuchenna@gmail.com>
ChichiCaleb pushed a commit to ChichiCaleb/argo-cd that referenced this pull request Aug 15, 2024
…her namespaces (argoproj#19510)

* add support for all namespaces for apps and appsets in export and import

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* cleanup accidental merge issue

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* address comments and run lint

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* small fix

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* switch to make for slice

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

* remove new line in command flags

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>

---------

Signed-off-by: Ilia Medvedev <ilia.medvedev@codefresh.io>
Signed-off-by: ChichiCaleb <ChichiCaleb@chichiuchenna@gmail.com>
Signed-off-by: ChichiCaleb <chichiuchenna@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"argocd admin export" only exports ArgoCD apps from the same namespace as where ArgoCD is deployed
4 participants