Skip to content

Commit

Permalink
fix(operator): sorted versions and payments migration (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-nicolas authored Nov 10, 2023
1 parent e3e4d9a commit 94d1617
Show file tree
Hide file tree
Showing 181 changed files with 5,809 additions and 39 deletions.
1 change: 1 addition & 0 deletions components/operator/apis/stack/v1beta3/migration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
// MigrationSpec defines the desired state of Migration
type MigrationSpec struct {
Configuration string `json:"configuration"`
CurrentVersion string `json:"currentVersion"`
Version string `json:"version"`
Module string `json:"module"`
TargetedVersion string `json:"targetedVersion"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (r *MigrationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
Platform: r.platform,
}

var fn func(ctx context.Context, jobRunner modules.JobRunner, config modules.ReconciliationConfig) (bool, error)
var fn func(ctx context.Context, jobRunner modules.JobRunner, config modules.MigrationConfig) (bool, error)

if migration.Spec.PostUpgrade {
fn = version.PostUpgrade
Expand All @@ -116,8 +116,13 @@ func (r *MigrationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
jobRunner := modules.NewJobRunner(r.Client, r.Scheme, stack, migration, fmt.Sprintf("%s-%s-%s-upgrade-",
module.Name(), migration.Spec.TargetedVersion, migration.Discriminator()))

migrationConfig := modules.MigrationConfig{
ReconciliationConfig: rc,
Version: migration.Spec.CurrentVersion,
}

var returnedError error
if terminated, err := fn(ctx, jobRunner, rc); err != nil {
if terminated, err := fn(ctx, jobRunner, migrationConfig); err != nil {
returnedError = err
migration.Status.Err = returnedError.Error()
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: latest
module: payments
postUpgrade: true
targetedVersion: v0.6.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: latest
module: payments
postUpgrade: true
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: latest
module: payments
postUpgrade: true
targetedVersion: v0.8.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: latest
module: payments
postUpgrade: true
targetedVersion: v0.8.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: ""
module: search
postUpgrade: false
targetedVersion: v0.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: ""
module: search
postUpgrade: true
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: ""
module: search
postUpgrade: false
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: ""
module: wallets
postUpgrade: true
targetedVersion: v0.4.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-disabled-one-service
spec:
configuration: monopod-disabled-one-service
currentVersion: ""
module: wallets
postUpgrade: true
targetedVersion: v0.4.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: latest
module: payments
postUpgrade: true
targetedVersion: v0.6.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: latest
module: payments
postUpgrade: true
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: latest
module: payments
postUpgrade: true
targetedVersion: v0.8.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: latest
module: payments
postUpgrade: true
targetedVersion: v0.8.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: ""
module: search
postUpgrade: false
targetedVersion: v0.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: ""
module: search
postUpgrade: true
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: ""
module: search
postUpgrade: false
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: ""
module: wallets
postUpgrade: true
targetedVersion: v0.4.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-latest
spec:
configuration: monopod-latest
currentVersion: ""
module: wallets
postUpgrade: true
targetedVersion: v0.4.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: payments
postUpgrade: true
targetedVersion: v0.6.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: payments
postUpgrade: true
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: payments
postUpgrade: true
targetedVersion: v0.8.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: payments
postUpgrade: true
targetedVersion: v0.8.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: search
postUpgrade: false
targetedVersion: v0.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: search
postUpgrade: true
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: search
postUpgrade: false
targetedVersion: v0.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: wallets
postUpgrade: true
targetedVersion: v0.4.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
namespace: monopod-ledgerv1
spec:
configuration: monopod-ledgerv1
currentVersion: ""
module: wallets
postUpgrade: true
targetedVersion: v0.4.4
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: stack.formance.com/v1beta3
kind: Configuration
metadata:
name: default
spec:
light: true
broker:
kafka:
brokers:
- kafka:1234
monitoring:
traces:
otlp:
endpoint: localhost
insecure: true
mode: grpc
port: 4317
services:
auth:
postgres:
disableSSLMode: true
host: localhost
password: root
port: 5432
username: root
control: {}
ledger:
postgres:
disableSSLMode: true
host: localhost
password: root
port: 5432
username: root
orchestration:
postgres:
disableSSLMode: true
host: localhost
password: root
port: 5432
username: root
payments:
encryptionKey:
postgres:
disableSSLMode: true
host: localhost
password: root
port: 5432
username: root
search:
batching:
count:
period:
elasticSearch:
host: elasticsearch
pathPrefix: ''
port: 9200
scheme: http
stargate:
wallets:
webhooks:
postgres:
disableSSLMode: true
host: localhost
password: root
port: 5432
username: root
temporal:
address:
namespace:
tls:
crt:
key:
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v1
data:
config.yaml: |
clients:
- public: false
description: null
redirectUris:
- http://example.net/auth/login
PostLogoutRedirectUris:
- http://example.net/auth/destroy
scopes:
- openid
- profile
- email
- offline
id: control
secrets:
- mocked-secret
- public: false
description: null
redirectUris: []
PostLogoutRedirectUris: []
scopes:
- openid
id: orchestration
secrets:
- mocked-secret
- public: false
description: null
redirectUris: []
PostLogoutRedirectUris: []
scopes:
- openid
id: wallets
secrets:
- mocked-secret
kind: ConfigMap
metadata:
labels:
stack: "true"
name: auth-config
namespace: monopod-payments-after-v1-0-0-alpha-6
Loading

1 comment on commit 94d1617

@vercel
Copy link

@vercel vercel bot commented on 94d1617 Nov 10, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.