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

feat: allow persistent volume name to be overridden in the helm chart #38752

Merged
merged 4 commits into from
Jan 29, 2025

Conversation

wyattwalter
Copy link
Contributor

@wyattwalter wyattwalter commented Jan 17, 2025

Description

Exposes a value under the persistence key to allow the PV name to be overridden. This was requested by a customer that does multiple deploys of Appsmith per cluster in different namespaces with the same Helm release name. Since PV's are not namespaced, the deploy was failing.

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags=""

🔍 Cypress test results

Warning

Tests have not run on the HEAD 8a0e2ba yet


Thu, 23 Jan 2025 14:35:55 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Added ability to override Persistent Volume (PV) name in Helm chart.
    • Enhanced configuration options for multi-namespace deployments.
  • Improvements

    • Introduced more flexible naming strategy for Persistent Volume resources.
    • Updated PersistentVolume and PersistentVolumeClaim resources to utilize the new naming convention.
    • Updated application version from 3.6.0 to 3.6.1.

Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Walkthrough

This pull request introduces a new function for generating a persistent volume (PV) name in the Helm chart, enhancing configurability. The function appsmith.pvName retrieves the PV name from the .Values.persistence.pvNameOverride variable, with a default fallback to appsmith.fullname. Additionally, the persistentVolume.yaml and persistentVolumeClaim.yaml files have been updated to use this new function for naming, while a new parameter pvNameOverride has been added to values.yaml to allow users to specify custom PV names.

Changes

File Change Summary
deploy/helm/templates/_helpers.tpl Added new function appsmith.pvName for generating PV names
deploy/helm/templates/persistentVolume.yaml Updated PV name to use appsmith.pvName function; removed namespace line
deploy/helm/templates/persistentVolumeClaim.yaml Modified volumeName to use appsmith.pvName function
deploy/helm/values.yaml Added pvNameOverride parameter under persistence section
deploy/helm/Chart.yaml Updated version from 3.6.0 to 3.6.1

Possibly related PRs

Suggested labels

Stale

Suggested reviewers

  • sharat87

Poem

🌟 Persistent Volumes dance and sway
With names now flexible, hip hooray!
Helm charts evolve, config takes flight
Kubernetes storage, oh so bright! 🚀


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b56968b and 8a0e2ba.

📒 Files selected for processing (1)
  • deploy/helm/Chart.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • deploy/helm/Chart.yaml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

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.

@github-actions github-actions bot added the Enhancement New feature or request label Jan 17, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
deploy/helm/values.yaml (1)

326-331: Consider adding example usage in comments

The parameter is well-documented, but would benefit from an example showing the override value format.

Add example usage like:

  ## @param persistence.pvNameOverride Override the PV name
  ## Useful when deploying multiple releases across different namespaces with the same name
  ## since PersistentVolumes are cluster-scoped resources
+ ## Example:
+ ##   pvNameOverride: "custom-appsmith-pv"
  ##
  pvNameOverride: ""
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19002c3 and fb28b72.

📒 Files selected for processing (4)
  • deploy/helm/templates/_helpers.tpl (1 hunks)
  • deploy/helm/templates/persistentVolume.yaml (1 hunks)
  • deploy/helm/templates/persistentVolumeClaim.yaml (1 hunks)
  • deploy/helm/values.yaml (1 hunks)
🔇 Additional comments (3)
deploy/helm/templates/_helpers.tpl (1)

124-128: Implementation follows Helm best practices

The new template function correctly implements the override pattern with a proper fallback mechanism.

deploy/helm/templates/persistentVolumeClaim.yaml (1)

24-24: Verify volume binding behavior

The implementation correctly uses the new pvname template. However, ensure that volume binding still works as expected when deploying multiple instances.

✅ Verification successful

Volume binding implementation verified

The PV/PVC naming implementation is safe for multiple instances:

  • Uses release-scoped names by default
  • Supports custom name override
  • Handles existing PVC scenarios
  • Configurable binding mode
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any existing PVCs that might conflict
kubectl get pvc -A --show-labels | grep "app=appsmith"

Length of output: 152


Script:

#!/bin/bash
# Check volume related configurations
echo "=== PV/PVC Templates ==="
fd . deploy/helm/templates -e yaml -x cat {} | grep -A 5 -B 5 "volumeName\|storageClassName\|bindingMode"

echo -e "\n=== Volume Name Template Function ==="
fd . deploy/helm/templates -e tpl -x cat {} | grep -A 5 -B 5 "pvname"

Length of output: 2133

deploy/helm/templates/persistentVolume.yaml (1)

5-5: Implementation maintains consistency with PVC

The PV name change correctly aligns with the PVC implementation.

Copy link
Member

@sharat87 sharat87 left a comment

Choose a reason for hiding this comment

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

Minor comment, but otherwise looks ready to go.

deploy/helm/templates/_helpers.tpl Outdated Show resolved Hide resolved
@@ -2,8 +2,7 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ include "appsmith.fullname" . }}
namespace: {{ include "appsmith.namespace" . }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing this while I'm in here. PVs are not a namespaced object. Helm and some clients will simply ignore this, but not all.

Copy link
Member

@sharat87 sharat87 left a comment

Choose a reason for hiding this comment

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

Forgot, can we change the version in Chart.yaml as well please?

@wyattwalter wyattwalter requested a review from sharat87 January 23, 2025 14:35
@wyattwalter
Copy link
Contributor Author

Ok, cool. I wasn't sure what the release process looked like for the chart yet. Bumped that up.

@wyattwalter wyattwalter dismissed sharat87’s stale review January 27, 2025 14:39

Addressed all of the issues raised.

@wyattwalter wyattwalter enabled auto-merge (squash) January 27, 2025 15:17
@pratapaprasanna pratapaprasanna merged commit 4caaa74 into release Jan 29, 2025
20 checks passed
@pratapaprasanna pratapaprasanna deleted the feat/pv-name-override branch January 29, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants