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

Use existing pvc with default storage #8564

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sei-jmattson
Copy link

@sei-jmattson sei-jmattson commented Oct 18, 2024

Issue #8563

Motivation and context

How has this been tested?

Deployed with custom helm chart

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • New Features

    • Updated Helm chart version to 0.14.1.
    • Introduced new defaultStorage configurations for CVAT and KVROCKS, enhancing storage management capabilities.
  • Improvements

    • Enhanced flexibility in persistent volume claim names for CVAT backend deployments.
    • Added conditional logic for PersistentVolumeClaim to improve storage configurability.
  • Bug Fixes

    • Minor formatting adjustments for improved readability in configuration files.

Copy link
Contributor

coderabbitai bot commented Oct 18, 2024

Walkthrough

The pull request introduces several updates to the Helm chart for the CVAT application. The chart version is incremented from 0.14.0 to 0.14.1. Key modifications include dynamic adjustments to persistent volume claim names across multiple deployment templates, enhancing configurability. A new conditional block for PersistentVolumeClaim is added to the storage template, and a defaultStorage section is introduced in the values file for both CVAT and KVROCKS components, specifying storage settings.

Changes

File Path Change Summary
helm-chart/Chart.yaml Chart version updated from 0.14.0 to 0.14.1.
helm-chart/templates/cvat_backend/{server,utils,worker_annotation,worker_export,worker_import}/deployment.yml Updated claimName to use dynamic expression with fallback for persistent volume claims.
helm-chart/templates/cvat_backend/storage.yml Added conditional block for PersistentVolumeClaim based on defaultStorage settings.
helm-chart/values.yaml Introduced defaultStorage sections for cvat (20Gi) and kvrocks (100Gi) configurations.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Helm
    participant Kubernetes

    User->>Helm: Deploy CVAT Chart
    Helm->>Kubernetes: Create PersistentVolumeClaim
    alt defaultStorage enabled
        Kubernetes->>Kubernetes: Check existing claim name
        alt existing claim not provided
            Kubernetes->>Kubernetes: Define new PersistentVolumeClaim
        end
    end
    Helm->>Kubernetes: Deploy other resources
    Kubernetes-->>User: Deployment complete
Loading

🐰 In a world of code and charts so bright,
A version update brings new delight.
With claims that flex and storage anew,
Our CVAT hops forward, fresh as the dew!
So let’s cheer for changes, both big and small,
For every little tweak makes us stand tall! 🌟


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 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.

Copy link

sonarcloud bot commented Oct 18, 2024

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

🧹 Outside diff range and nitpick comments (8)
helm-chart/templates/cvat_backend/storage.yml (2)

Line range hint 2-13: LGTM: Well-structured PVC metadata with a suggestion.

The inner conditional and PVC metadata are well-structured:

  • The condition allows for using an existing PVC or creating a new one.
  • The PVC name uses the release name for uniqueness.
  • The helm.sh/resource-policy: keep annotation prevents accidental deletion.
  • Labels are properly set, including those from a common template.

Consider adding a comment explaining the purpose of the helm.sh/resource-policy: keep annotation for better maintainability.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


Line range hint 14-27: LGTM: Flexible PVC spec with a suggestion for improvement.

The PVC spec is well-structured and flexible:

  • Access modes are conditionally set, defaulting to ReadWriteMany if not specified.
  • Storage class name is optional, good for compatibility across different Kubernetes environments.
  • Storage size is configurable, essential for various deployment scenarios.

Consider adding a default storage size in case .Values.cvat.backend.defaultStorage.size is not set. This could prevent potential errors if the value is accidentally omitted. For example:

storage: {{ .Values.cvat.backend.defaultStorage.size | default "10Gi" }}
helm-chart/Chart.yaml (1)

19-19: LGTM. Don't forget to update the changelog and documentation.

The chart version increment from 0.14.0 to 0.14.1 is appropriate for the changes described in the PR. This minor version bump aligns with semantic versioning principles for non-breaking changes.

Please ensure you complete the following items from your PR checklist:

  1. Create a changelog fragment
  2. Update documentation if necessary
  3. Add tests if applicable
  4. Link any related issues
  5. Increment versions of any affected npm packages

These steps are crucial for maintaining a well-documented and traceable project history.

helm-chart/templates/cvat_backend/utils/deployment.yml (1)

130-130: Approve the change with a minor suggestion for improved readability.

The modification to use default function for the claimName is a good improvement. It allows for more flexibility in specifying an existing PVC while maintaining backward compatibility.

To slightly improve readability, consider breaking the line into multiple lines:

claimName: {{- default (printf "%s-backend-data" .Release.Name) .Values.cvat.backend.defaultStorage.existingClaimName | quote }}

This change maintains the functionality while making the line easier to read and maintain.

helm-chart/templates/cvat_backend/worker_export/deployment.yml (1)

134-134: Approved: Enhanced flexibility for PVC claim name.

This change improves the configurability of the deployment by allowing users to specify an existing claim name through .Values.cvat.backend.defaultStorage.existingClaimName. If not specified, it falls back to the previous behavior of using {{ .Release.Name }}-backend-data.

Consider adding a check for empty string to avoid potential issues:

claimName: {{ default (printf "%s-backend-data" .Release.Name) (trimAll " " .Values.cvat.backend.defaultStorage.existingClaimName) | quote}}

This ensures that if .Values.cvat.backend.defaultStorage.existingClaimName is set to an empty string or only whitespace, the default value is still used.

helm-chart/templates/cvat_backend/server/deployment.yml (1)

146-146: Approve change with a suggestion for improved readability

The modification to use default function for the claimName is a good improvement. It allows for more flexibility in specifying an existing PVC while maintaining backwards compatibility.

However, the line is quite long. Consider breaking it into multiple lines for better readability:

claimName: {{- default (printf "%s-backend-data" .Release.Name) .Values.cvat.backend.defaultStorage.existingClaimName | quote }}

Also, ensure that the values.yaml file and relevant documentation are updated to reflect the new existingClaimName option under cvat.backend.defaultStorage.

helm-chart/values.yaml (2)

Line range hint 148-152: LGTM. Consider updating documentation for new storage options.

The addition of the defaultStorage configuration for CVAT is a good improvement for storage management. The default size of 20Gi seems reasonable, but it might be worth mentioning in the documentation that this can be adjusted based on specific use cases.

Also, the commented out lines (existingClaimName, storageClassName, accessModes) suggest additional configuration options. Consider documenting these options in the chart's README or values file comments to guide users on how they can be utilized.


Line range hint 307-311: LGTM. Consider maintaining consistency in commenting style.

The addition of the defaultStorage configuration for kvrocks is a good improvement, aligning with the changes made for CVAT. The larger default size of 100Gi is appropriate for a data storage component.

For consistency, consider using the same commenting style as in the CVAT section. For example:

defaultStorage:
  enabled: true
#  existingClaimName: ""
#  storageClassName: default
#  accessModes:
#    - ReadWriteOnce
  size: 100Gi

This would make it easier for users to understand and configure these options consistently across different components.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0abe52f and 643b8d1.

📒 Files selected for processing (8)
  • helm-chart/Chart.yaml (1 hunks)
  • helm-chart/templates/cvat_backend/server/deployment.yml (1 hunks)
  • helm-chart/templates/cvat_backend/storage.yml (2 hunks)
  • helm-chart/templates/cvat_backend/utils/deployment.yml (1 hunks)
  • helm-chart/templates/cvat_backend/worker_annotation/deployment.yml (1 hunks)
  • helm-chart/templates/cvat_backend/worker_export/deployment.yml (1 hunks)
  • helm-chart/templates/cvat_backend/worker_import/deployment.yml (1 hunks)
  • helm-chart/values.yaml (1 hunks)
🧰 Additional context used
🔇 Additional comments (6)
helm-chart/templates/cvat_backend/storage.yml (2)

1-1: LGTM: Conditional resource creation is a good practice.

The outer conditional block allows for optional creation of the PersistentVolumeClaim based on the .Values.cvat.backend.defaultStorage.enabled flag. This is a good practice in Helm charts as it provides flexibility in resource management.

Also applies to: 28-28

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


Line range hint 1-28: Overall, excellent improvements to storage configurability.

This change significantly enhances the flexibility of the CVAT backend storage configuration:

  1. It allows for optional PVC creation.
  2. It supports using an existing PVC or creating a new one.
  3. It provides customizable access modes, storage class, and size.

These improvements will make it easier to deploy CVAT in various Kubernetes environments with different storage requirements.

To ensure these changes are properly reflected in the Helm chart's documentation, please run the following command:

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm-chart/templates/cvat_backend/worker_import/deployment.yml (2)

133-133: Excellent enhancement to PVC configuration flexibility!

This change improves the configurability of the persistent volume claim for the backend data. By using default function with .Values.cvat.backend.defaultStorage.existingClaimName, it allows users to specify an existing claim name in their Helm values while maintaining backward compatibility with the original behavior. This aligns well with the PR objective of using existing PVC with default storage.

The use of the quote function ensures proper YAML formatting, which is a good practice.


Line range hint 1-146: Overall, this change enhances the flexibility of the CVAT backend worker import deployment.

The modification to the persistent volume claim configuration allows for better customization without breaking existing setups. This change is well-aligned with the PR objectives and follows Helm chart best practices. No issues or concerns were identified in this file.

helm-chart/templates/cvat_backend/worker_annotation/deployment.yml (1)

133-133: LGTM! Verify consistency across the chart.

The change to use {{ default (printf "%s-backend-data" .Release.Name) .Values.cvat.backend.defaultStorage.existingClaimName | quote}} for the claimName is a good improvement. It allows for more flexibility in configuration while maintaining backwards compatibility.

To ensure consistency, please run the following script to check if similar changes have been applied to other deployment files in the chart:

This will help identify any deployment files that might need similar updates for consistency.

✅ Verification successful

Claim Name Consistently Updated Across Deployment Files

All deployment files have been reviewed and the claimName is consistently set to {{ default (printf "%s-backend-data" .Release.Name) .Values.cvat.backend.defaultStorage.existingClaimName | quote}} across all relevant deployment configurations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent use of claimName across deployment files

# Test: Search for claimName in deployment files
rg --type yaml 'claimName:' helm-chart/templates

Length of output: 1047

helm-chart/values.yaml (1)

Line range hint 1-577: Overall, the changes improve storage management and configuration flexibility.

The modifications to helm-chart/values.yaml successfully introduce defaultStorage configurations for both CVAT and kvrocks components. These changes align with the PR objective of using existing PVC with default storage and enhance the flexibility of the Helm chart.

Key points:

  1. CVAT now has a default storage of 20Gi, while kvrocks has 100Gi.
  2. Both configurations include commented-out options for further customization.
  3. The changes are consistent and do not introduce conflicts with existing configurations.

These improvements will likely make it easier for users to deploy and manage storage for CVAT installations. Consider updating the chart's documentation to reflect these new configuration options and provide guidance on when and how to customize them.

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.

1 participant