Skip to content

Conversation

flemzord
Copy link
Member

  • Remove deprecated DeploymentStrategy and Locking properties from Ledger CRD
  • Remove all v1-specific logic and conditional code paths
  • Simplify ledger deployment to always use v2 behavior
  • Remove v1.0.0 reindex assets
  • Remove unused Caddyfile template for ledger
  • Update documentation to remove references to deployment strategies
  • Clean up imports and remove unused dependencies

BREAKING CHANGE: This removes support for Ledger v1 deployments. All ledgers will now use v2 behavior by default.

- Remove deprecated DeploymentStrategy and Locking properties from Ledger CRD
- Remove all v1-specific logic and conditional code paths
- Simplify ledger deployment to always use v2 behavior
- Remove v1.0.0 reindex assets
- Remove unused Caddyfile template for ledger
- Update documentation to remove references to deployment strategies
- Clean up imports and remove unused dependencies

BREAKING CHANGE: This removes support for Ledger v1 deployments. All ledgers will now use v2 behavior by default.
@flemzord flemzord requested a review from a team as a code owner June 30, 2025 17:46
Copy link
Contributor

coderabbitai bot commented Jun 30, 2025

Walkthrough

This change removes all code related to multiple ledger deployment strategies and version-conditional logic, including types, fields, and branching for deployment modes and version flags. It also eliminates the embedded Caddyfile template and its associated deployment, simplifying the ledger deployment to a single, unified approach without legacy or version-dependent pathways.

Changes

File(s) Change Summary
api/formance.com/v1beta1/ledger_types.go Removed deployment strategy types, constants, and fields from LedgerSpec; simplified comments.
api/formance.com/v1beta1/zz_generated.deepcopy.go Removed deepcopy methods for LockingStrategy and related types; updated LedgerSpec deepcopy.
internal/resources/ledgers/assets.go Removed embedded Caddyfile variable and unused embed import.
internal/resources/ledgers/assets/Caddyfile.gotpl Deleted Caddyfile template file.
internal/resources/ledgers/deployments.go Removed all logic for multiple deployment strategies, version flags, and Caddy gateway; simplified deployment creation and environment variable handling.
internal/resources/ledgers/init.go Removed version-conditional logic; always uses the newer deployment path and assets.
docs/09-Configuration reference/02-Custom Resource Definitions.md Simplified Ledger module documentation by removing deployment strategy and locking fields and descriptions.

Sequence Diagram(s)

sequenceDiagram
    participant Operator
    participant LedgerDeployment
    participant Database

    Operator->>LedgerDeployment: Install single-instance ledger (no strategy/version branching)
    LedgerDeployment->>Database: Connect and configure
    Operator->>LedgerDeployment: Set standard environment variables
    Operator->>LedgerDeployment: Complete deployment (no Caddy gateway)
Loading

Poem

In the warren, code once split and wide,
Strategies and versions, now set aside.
With Caddy gone and flags all through,
The ledger hops on paths anew.
Simple, clean, and hopping fast—
This rabbit’s code refactor will last!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3aba240 and 1b82b3c.

📒 Files selected for processing (2)
  • internal/resources/ledgers/assets.go (1 hunks)
  • internal/resources/ledgers/deployments.go (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/resources/ledgers/assets.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests
🔇 Additional comments (5)
internal/resources/ledgers/deployments.go (5)

58-58: Previous issue resolved correctly.

The function call now correctly passes image as the 4th parameter, fixing the issue identified in the previous review.


290-290: Environment variable prefix removal aligns with v1 deprecation.

The consistent removal of prefixes (passing empty strings "") across all environment variable configuration functions correctly implements the simplification described in the PR objectives. This eliminates the complex prefix logic that was tied to deployment strategies.

Also applies to: 295-295, 297-297, 317-317, 323-323, 362-362, 368-368


30-30: Function signature simplification improves maintainability.

The removal of version and deployment strategy parameters from function signatures correctly implements the v1 deprecation. The signatures are now cleaner and more focused on essential parameters needed for v2-only deployments.

Also applies to: 52-52, 71-71, 189-189, 260-260, 287-287, 311-311, 334-334, 342-342


47-49: Clear fallback logic for version compatibility.

The simplified fallback logic and comment clearly indicate the handling for older versions, maintaining backward compatibility while defaulting to the single instance deployment approach.


266-266: Helpful comment clarifies v2 behavior.

The comment "No volumes needed for v2" clearly documents the simplified deployment approach and helps future maintainers understand the v2-specific behavior.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch remove-stack-v1-support

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 auto-generate unit tests to generate unit tests for 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.

@flemzord flemzord changed the title feat: remove Stack v1 support and all v1 components breaking: remove Stack v1 support and all v1 components Jun 30, 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: 2

🔭 Outside diff range comments (2)
api/formance.com/v1beta1/ledger_types.go (1)

20-20: Remove unused import.

The time package is imported but not used in the file, causing a compilation error.

Apply this diff to fix the compilation error:

-import (
-	"time"
-
-	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
+import (
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
internal/resources/ledgers/deployments.go (1)

70-71: Fix function signature to use image parameter.

The function should receive image instead of version to be consistent with other deployment functions and fix the compilation error.

Apply this diff to fix the function signature:

 func installLedgerStateless(ctx core.Context, stack *v1beta1.Stack,
-	ledger *v1beta1.Ledger, database *v1beta1.Database, version string) error {
+	ledger *v1beta1.Ledger, database *v1beta1.Database, image string) error {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3f838ee and 0007f40.

⛔ Files ignored due to path filters (6)
  • config/crd/bases/formance.com_ledgers.yaml is excluded by !**/*.yaml
  • internal/resources/ledgers/assets/reindex/v1.0.0/ledger_reindex.yaml is excluded by !**/*.yaml
  • internal/resources/ledgers/assets/reindex/v1.0.0/ledger_reindex_accounts.yaml is excluded by !**/*.yaml
  • internal/resources/ledgers/assets/reindex/v1.0.0/ledger_reindex_all.yaml is excluded by !**/*.yaml
  • internal/resources/ledgers/assets/reindex/v1.0.0/ledger_reindex_transactions.yaml is excluded by !**/*.yaml
  • internal/resources/ledgers/assets/reindex/v1.0.0/ledger_reindex_volumes.yaml is excluded by !**/*.yaml
📒 Files selected for processing (6)
  • api/formance.com/v1beta1/ledger_types.go (1 hunks)
  • api/formance.com/v1beta1/zz_generated.deepcopy.go (0 hunks)
  • internal/resources/ledgers/assets.go (0 hunks)
  • internal/resources/ledgers/assets/Caddyfile.gotpl (0 hunks)
  • internal/resources/ledgers/deployments.go (8 hunks)
  • internal/resources/ledgers/init.go (3 hunks)
💤 Files with no reviewable changes (3)
  • internal/resources/ledgers/assets/Caddyfile.gotpl
  • internal/resources/ledgers/assets.go
  • api/formance.com/v1beta1/zz_generated.deepcopy.go
🧰 Additional context used
🪛 GitHub Actions: Default
api/formance.com/v1beta1/ledger_types.go

[error] 20-20: GolangCI-Lint typecheck error: "time" imported and not used.

🔇 Additional comments (5)
api/formance.com/v1beta1/ledger_types.go (1)

40-41: LGTM!

The simplified description accurately reflects the ledger's purpose after removing multiple deployment strategies.

internal/resources/ledgers/init.go (1)

86-106: LGTM!

The simplified migration logic correctly handles version changes while maintaining backward compatibility for versions >= v2.2.0-alpha.

internal/resources/ledgers/deployments.go (3)

30-49: LGTM!

The simplified deployment logic correctly handles different ledger versions while removing v1-specific code paths.


290-306: LGTM!

The consistent removal of environment variable prefixes standardizes the configuration approach across all ledger deployments.


260-285: LGTM!

The simplified deployment creation correctly removes v1-specific volume logic, making the code cleaner and more maintainable.

flemzord added 3 commits June 30, 2025 23:05
- Simplified the description of the ledger as a stateful application managing financial transactions and maintaining an immutable audit trail.
- Removed deprecated properties related to deployment strategies and locking from the Ledger CRD and documentation.
…ge parameter

- Changed the parameter name from 'version' to 'image' in the installLedgerStateless function to better reflect its purpose.
- Updated the call to setCommonAPIContainerConfiguration to use the new image parameter.
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)
docs/09-Configuration reference/02-Custom Resource Definitions.md (1)

744-745: Add an explicit migration note for removed v1-only fields

The new description is concise, but existing users upgrading from v1 will likely look here for guidance. A short, in-place note that deploymentStrategy and locking fields are no longer supported would prevent silent confusion.

 The ledger is a stateful application that manages financial transactions
 and maintains an immutable audit trail.
+
+> **Important:** Starting with Stack v2, the legacy `deploymentStrategy`
+> and `locking` fields have been removed.  Manifests that still declare
+> these properties will be rejected by the operator.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0007f40 and 3aba240.

⛔ Files ignored due to path filters (2)
  • config/crd/bases/formance.com_ledgers.yaml is excluded by !**/*.yaml
  • helm/crds/templates/crds/apiextensions.k8s.io_v1_customresourcedefinition_ledgers.formance.com.yaml is excluded by !**/*.yaml
📒 Files selected for processing (3)
  • api/formance.com/v1beta1/ledger_types.go (1 hunks)
  • docs/09-Configuration reference/02-Custom Resource Definitions.md (1 hunks)
  • internal/resources/ledgers/init.go (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • api/formance.com/v1beta1/ledger_types.go
  • internal/resources/ledgers/init.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests

- Changed the embedded asset path to include versioning for reindex YAML files.
@flemzord flemzord changed the title breaking: remove Stack v1 support and all v1 components feat!: remove Stack v1 support and all v1 components Jun 30, 2025
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.

3 participants