Skip to content

make velero deletable - #1176

Merged
klinch0 merged 1 commit into
mainfrom
bugfix-make-velero-deletable
Jul 9, 2025
Merged

klinch0 merged 1 commit into
mainfrom
bugfix-make-velero-deletable

Conversation

@klinch0

@klinch0 klinch0 commented Jul 9, 2025 •

Copy link
Copy Markdown
Contributor

What this PR does

Release note

- make velero deletable

Summary by CodeRabbit

  • Bug Fixes

    • Included the Velero Helm release in the pre-delete suspension process to ensure proper cleanup during teardown.
  • Chores

    • Updated the Kubernetes application chart version to 0.25.2.
    • Adjusted version mapping for improved tracking of releases.

@coderabbitai

coderabbitai Bot commented Jul 9, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This update increments the Kubernetes app chart version, modifies the Helm release deletion template to include the Velero release in the pre-delete hook, and updates the version mapping to reflect the new chart version and commit hash.

Changes

File(s) Change Summary
packages/apps/kubernetes/Chart.yaml Incremented chart version from 0.25.1 to 0.25.2.
packages/apps/kubernetes/templates/helmreleases/delete.yaml Added Velero HelmRelease to pre-delete hook and RBAC permissions for HelmRelease suspension.
packages/apps/versions_map Updated version mapping: set 0.25.1 to specific commit, added 0.25.2 pointing to HEAD.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Pre-Delete Job
    participant HelmRelease (velero)
    participant RBAC

    User->>Pre-Delete Job: Initiate pre-delete hook
    Pre-Delete Job->>RBAC: Request permission for velero HelmRelease
    RBAC-->>Pre-Delete Job: Grant get/patch permission
    Pre-Delete Job->>HelmRelease (velero): Suspend HelmRelease
Loading

Possibly related PRs

Suggested labels

ok-to-test

Suggested reviewers

  • kvaps

Poem

A hop, a skip, a version bump anew,
Velero joins the pre-delete crew.
Chart numbers rise, the map aligns,
Kubernetes hums with tidy lines.
With every patch, the garden grows—
A rabbit’s work, as progress shows! 🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@klinch0
klinch0 force-pushed the bugfix-make-velero-deletable branch from 3a10ade to 99b90ff Compare July 9, 2025 08:50
@klinch0
klinch0 force-pushed the bugfix-make-velero-deletable branch from 99b90ff to 8fde834 Compare July 9, 2025 08:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
packages/apps/kubernetes/templates/helmreleases/delete.yaml (1)

28-45: Suspension loop is syntactically invalid – Velero (and the other releases) will not be patched

kubectl patch TYPE NAME … accepts exactly one resource name.
Passing a white-space separated list (lines 31-43) silently patches only the first item and ignores the rest, so {{ .Release.Name }}-velero will never be suspended.

A minimal fix is to iterate over the list:

-                kubectl
-                --namespace={{ .Release.Namespace }}
-                patch
-                helmrelease
-                {{ .Release.Name }}-cilium
-                {{ .Release.Name }}-gateway-api-crds
-                ...
-                {{ .Release.Name }}-velero
-                -p '{"spec": {"suspend": true}}'
-                --type=merge --field-manager=flux-client-side-apply || true
+                for rel in \
+                  cilium gateway-api-crds csi cert-manager cert-manager-crds \
+                  vertical-pod-autoscaler vertical-pod-autoscaler-crds \
+                  ingress-nginx fluxcd-operator fluxcd gpu-operator velero; do
+                  kubectl --namespace={{ .Release.Namespace }} \
+                    patch helmrelease {{ .Release.Name }}-${rel} \
+                    -p '{"spec": {"suspend": true}}' \
+                    --type=merge --field-manager=flux-client-side-apply || true
+                done

This guarantees Velero (and every other release) is properly suspended during the pre-delete hook.

🧹 Nitpick comments (1)
packages/apps/kubernetes/templates/helmreleases/delete.yaml (1)

73-84: RBAC list keeps drifting – consider aggregating or templating

The explicit resourceNames list was updated to include Velero (👍), but {{ .Release.Name }}-gateway-api-crds is still missing, causing the loop above (once fixed) to fail on an RBAC “forbidden” error.

Rather than manually synchronising two long lists, consider:

  1. Creating a single Helm template value (array) that enumerates all releases to suspend and re-using it in both the for loop and resourceNames.
  2. Or granting access via a label selector instead of hard-coding names.

Either approach eliminates this class of omissions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e9435c2 and 8fde834.

📒 Files selected for processing (3)
  • packages/apps/kubernetes/Chart.yaml (1 hunks)
  • packages/apps/kubernetes/templates/helmreleases/delete.yaml (2 hunks)
  • packages/apps/versions_map (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (2)
packages/apps/kubernetes/Chart.yaml (1)

19-19: Version bump looks good

Chart version incremented to 0.25.2 matching the PR intent. No further issues.

packages/apps/versions_map (1)

58-59: Validate pinned commit and HEAD mapping

0.25.1 is now pinned to acd4663a and 0.25.2 points to HEAD.
Please verify that:

  1. acd4663a exists in the kubernetes app history and corresponds to the previous chart state.
  2. CI/CD pipelines correctly resolve HEAD to the commit that includes this PR once merged.

If either check fails, downstream deployments could fetch an unexpected chart.

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@klinch0
klinch0 merged commit 68d1646 into main Jul 9, 2025
@klinch0
klinch0 deleted the bugfix-make-velero-deletable branch July 9, 2025 09:18
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.

2 participants