Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 2 additions & 50 deletions api/formance.com/v1beta1/ledger_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,54 +17,16 @@ limitations under the License.
package v1beta1

import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type LockingStrategyRedisConfig struct {
Uri string `json:"uri,omitempty"`
// +optional
// +kubebuilder:default:=false
TLS bool `json:"tls"`
// +optional
// +kubebuilder:default:=false
InsecureTLS bool `json:"insecure,omitempty"`
// +optional
Duration time.Duration `json:"duration,omitempty"`
// +optional
Retry time.Duration `json:"retry,omitempty"`
}

type LockingStrategy struct {
// +kubebuilder:Enum:={memory,redis}
// +kubebuilder:default:=memory
// +optional
Strategy string `json:"strategy,omitempty"`
// +optional
Redis *LockingStrategyRedisConfig `json:"redis"`
}

type DeploymentStrategy string

const (
DeploymentStrategySingle = "single"
DeploymentStrategyMonoWriterMultipleReader = "single-writer"
)

type LedgerSpec struct {
ModuleProperties `json:",inline"`
StackDependency `json:",inline"`
// +optional
Auth *AuthConfig `json:"auth,omitempty"`
//+kubebuilder:Enum:={single, single-writer}
//+kubebuilder:default:=single
//+optional
// Deprecated.
DeploymentStrategy DeploymentStrategy `json:"deploymentStrategy,omitempty"`
// Locking is intended for ledger v1 only
//+optional
Locking *LockingStrategy `json:"locking,omitempty"`
}

type LedgerStatus struct {
Expand All @@ -73,18 +35,8 @@ type LedgerStatus struct {

// Ledger is the module allowing to install a ledger instance.
//
// The ledger is actually a stateful application on the writer part.
// So we cannot scale the ledger as we want without prior configuration.
//
// So, the ledger can run in two modes :
// * single instance: Only one instance will be deployed. We cannot scale in that mode.
// * single writer / multiple reader: In this mode, we will have a single writer and multiple readers if needed.
//
// Use setting `ledger.deployment-strategy` with either the value :
// - single : For the single instance mode.
// - single-writer: For the single writer / multiple reader mode.
// Under the hood, the operator create two deployments and force the scaling of the writer to stay at 1.
// Then you can scale the deployment of the reader to the value you want.
// The ledger is a stateful application that manages financial transactions
// and maintains an immutable audit trail.
//
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
Expand Down
40 changes: 0 additions & 40 deletions api/formance.com/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 2 additions & 50 deletions config/crd/bases/formance.com_ledgers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,8 @@ spec:
Ledger is the module allowing to install a ledger instance.


The ledger is actually a stateful application on the writer part.
So we cannot scale the ledger as we want without prior configuration.


So, the ledger can run in two modes :
* single instance: Only one instance will be deployed. We cannot scale in that mode.
* single writer / multiple reader: In this mode, we will have a single writer and multiple readers if needed.


Use setting `ledger.deployment-strategy` with either the value :
- single : For the single instance mode.
- single-writer: For the single writer / multiple reader mode.
Under the hood, the operator create two deployments and force the scaling of the writer to stay at 1.
Then you can scale the deployment of the reader to the value you want.
The ledger is a stateful application that manages financial transactions
and maintains an immutable audit trail.
properties:
apiVersion:
description: |-
Expand Down Expand Up @@ -85,48 +73,12 @@ spec:
default: false
description: Allow to enable debug mode on the module
type: boolean
deploymentStrategy:
default: single
description: Deprecated.
type: string
dev:
default: false
description: |-
Allow to enable dev mode on the module
Dev mode is used to allow some application to do custom setup in development mode (allow insecure certificates for example)
type: boolean
locking:
description: Locking is intended for ledger v1 only
properties:
redis:
properties:
duration:
description: |-
A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the
largest representable duration to approximately 290 years.
format: int64
type: integer
insecure:
default: false
type: boolean
retry:
description: |-
A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the
largest representable duration to approximately 290 years.
format: int64
type: integer
tls:
default: false
type: boolean
uri:
type: string
type: object
strategy:
default: memory
type: string
type: object
stack:
description: Stack indicates the stack on which the module is installed
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,20 +741,8 @@ Gateway is the Schema for the gateways API
Ledger is the module allowing to install a ledger instance.


The ledger is actually a stateful application on the writer part.
So we cannot scale the ledger as we want without prior configuration.


So, the ledger can run in two modes :
* single instance: Only one instance will be deployed. We cannot scale in that mode.
* single writer / multiple reader: In this mode, we will have a single writer and multiple readers if needed.


Use setting `ledger.deployment-strategy` with either the value :
- single : For the single instance mode.
- single-writer: For the single writer / multiple reader mode.
Under the hood, the operator create two deployments and force the scaling of the writer to stay at 1.
Then you can scale the deployment of the reader to the value you want.
The ledger is a stateful application that manages financial transactions
and maintains an immutable audit trail.



Expand Down Expand Up @@ -806,82 +794,6 @@ Use setting `ledger.deployment-strategy` with either the value :
| `dev` _boolean_ | Allow to enable dev mode on the module<br />Dev mode is used to allow some application to do custom setup in development mode (allow insecure certificates for example) | false | |
| `version` _string_ | Version allow to override global version defined at stack level for a specific module | | |
| `stack` _string_ | Stack indicates the stack on which the module is installed | | |
| `deploymentStrategy` _[DeploymentStrategy](#deploymentstrategy)_ | Deprecated. | single | |
| `locking` _[LockingStrategy](#lockingstrategy)_ | Locking is intended for ledger v1 only | | |

###### DeploymentStrategy

_Underlying type:_ _string_


















###### LockingStrategy



















| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `strategy` _string_ | | memory | |
| `redis` _[LockingStrategyRedisConfig](#lockingstrategyredisconfig)_ | | | |

###### LockingStrategyRedisConfig



















| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `uri` _string_ | | | |
| `tls` _boolean_ | | false | |
| `insecure` _boolean_ | | false | |
| `duration` _string_ | | | |
| `retry` _string_ | | | |



Expand Down
4 changes: 2 additions & 2 deletions helm/crds/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "2.8.3"
version: "3.0.0"
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: v2.8.3
appVersion: v3.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,8 @@ spec:
Ledger is the module allowing to install a ledger instance.


The ledger is actually a stateful application on the writer part.
So we cannot scale the ledger as we want without prior configuration.


So, the ledger can run in two modes :
* single instance: Only one instance will be deployed. We cannot scale in that mode.
* single writer / multiple reader: In this mode, we will have a single writer and multiple readers if needed.


Use setting `ledger.deployment-strategy` with either the value :
- single : For the single instance mode.
- single-writer: For the single writer / multiple reader mode.
Under the hood, the operator create two deployments and force the scaling of the writer to stay at 1.
Then you can scale the deployment of the reader to the value you want.
The ledger is a stateful application that manages financial transactions
and maintains an immutable audit trail.
properties:
apiVersion:
description: |-
Expand Down Expand Up @@ -85,48 +73,12 @@ spec:
default: false
description: Allow to enable debug mode on the module
type: boolean
deploymentStrategy:
default: single
description: Deprecated.
type: string
dev:
default: false
description: |-
Allow to enable dev mode on the module
Dev mode is used to allow some application to do custom setup in development mode (allow insecure certificates for example)
type: boolean
locking:
description: Locking is intended for ledger v1 only
properties:
redis:
properties:
duration:
description: |-
A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the
largest representable duration to approximately 290 years.
format: int64
type: integer
insecure:
default: false
type: boolean
retry:
description: |-
A Duration represents the elapsed time between two instants
as an int64 nanosecond count. The representation limits the
largest representable duration to approximately 290 years.
format: int64
type: integer
tls:
default: false
type: boolean
uri:
type: string
type: object
strategy:
default: memory
type: string
type: object
stack:
description: Stack indicates the stack on which the module is installed
type: string
Expand Down
Loading
Loading