Skip to content

fix(helm): spec.strategy.rollingUpdate: Forbidden: may not be specified when strategy is 'Recreate' #40138

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

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

Conversation

fbuchmeier-abi
Copy link

@fbuchmeier-abi fbuchmeier-abi commented Apr 7, 2025

Description

When setting .Values.strategyType: Recreate during Helm install or upgrade, the installation fails with the following error message:

spec.strategy.rollingUpdate: Forbidden: may not be specified when strategy  is 'Recreate'

This is because the Helm Chart still renders the rollingUpdate even though the strategy is not set to RollingUpdate.

See the Kubernetes API Reference Docs for Deployments for reference.

In case you have any suggestions or improvements, let me know.

Best regards,
Florian.

Summary by CodeRabbit

  • New Features
    • Improved deployment process with enhanced update handling for smoother, more reliable rollouts.
  • Style
    • Applied a minor formatting improvement to ensure consistent configuration presentation.

…n strategy is 'Recreate'

Signed-off-by: Florian Buchmeier <[email protected]>
Copy link
Contributor

coderabbitai bot commented Apr 7, 2025

Walkthrough

The changes update the Helm deployment template by adding conditional logic to handle the "RollingUpdate" strategy. A new block checks if the strategyType is "RollingUpdate" and, if so, injects the rollingUpdate configuration using values from updateStrategy (i.e., maxSurge and maxUnavailable). Additionally, a formatting adjustment was made in the volumes section by removing an extra space before the configMap key.

Changes

File(s) Summary of Changes
deploy/.../deployment.yaml - Added conditional block to check if strategyType equals "RollingUpdate" and include corresponding rollingUpdate config using updateStrategy values (maxSurge, maxUnavailable).
- Removed extra space in the volumes section for consistent formatting.

Sequence Diagram(s)

sequenceDiagram
    participant U as User/CI Pipeline
    participant CT as Helm Template Renderer
    participant D as Deployment Service

    U->>CT: Provide deployment parameters (strategyType, updateStrategy)
    alt strategyType is "RollingUpdate"
        CT->>D: Deploy with rollingUpdate config (maxSurge, maxUnavailable)
    else Other strategy
        CT->>D: Deploy without rollingUpdate config
    end
    D-->>U: Return deployment status
Loading

Poem

In the Helm chart where configs align,
A condition rises, precise and fine.
Rolling updates add their flair,
With max surge and no despair.
Code refined, now crisp and divine!


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.
    • 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

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 (2)
deploy/helm/templates/deployment.yaml (2)

3-4: Avoid Duplicate Variable Assignment
The variable $postgrespass is assigned twice with the same value. Although this does not break the template, removing the redundancy can improve clarity and maintainability.


171-172: Fix Volume Formatting for configMap
The adjustment in the indentation for the configMap key improves the readability and consistency of the YAML structure. Make sure that the new formatting does not inadvertently change the intended configuration of the volume.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7d6551f and 80a0209.

📒 Files selected for processing (1)
  • deploy/helm/templates/deployment.yaml (2 hunks)
🔇 Additional comments (1)
deploy/helm/templates/deployment.yaml (1)

21-26: Conditionally Render rollingUpdate Configuration
The new conditional block correctly ensures that the rollingUpdate field is only included when .Values.strategyType is set to "RollingUpdate". This change addresses the deployment failure when the strategy is "Recreate". Please verify that the indentation and Helm templating syntax continue to yield valid YAML output.

Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant