Skip to content

Commit

Permalink
fix(webhooks): Migration only for v2 (#1142)
Browse files Browse the repository at this point in the history
  • Loading branch information
flemzord authored Jan 22, 2024
1 parent 92e7b7c commit c2c14ec
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions components/operator/internal/modules/webhooks/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,54 @@ func (w module) Postgres(ctx modules.ReconciliationConfig) stackv1beta3.Postgres
func (w module) Versions() map[string]modules.Version {
return map[string]modules.Version{
"v0.0.0": {
Services: func(ctx modules.ReconciliationConfig) modules.Services {
return modules.Services{
{
HasVersionEndpoint: true,
ExposeHTTP: modules.DefaultExposeHTTP,
InjectPostgresVariables: true,
ListenEnvVar: "LISTEN",
Annotations: ctx.Configuration.Spec.Services.Webhooks.Annotations.Service,
Container: func(resolveContext modules.ContainerResolutionConfiguration) modules.Container {
return modules.Container{
Image: modules.GetImage("webhooks", resolveContext.Versions.Spec.Webhooks),
Env: w.webhooksEnvVars(resolveContext),
Resources: modules.GetResourcesWithDefault(
resolveContext.Configuration.Spec.Services.Webhooks.ResourceProperties,
modules.ResourceSizeSmall(),
),
Debug: ctx.Configuration.Spec.Services.Webhooks.Debug,
}
},
},
{
Name: "worker",
InjectPostgresVariables: true,
ListenEnvVar: "LISTEN",
Liveness: modules.LivenessDisable,
Annotations: ctx.Configuration.Spec.Services.Webhooks.Annotations.Service,
Container: func(resolveContext modules.ContainerResolutionConfiguration) modules.Container {
return modules.Container{
Image: modules.GetImage("webhooks", resolveContext.Versions.Spec.Webhooks),
Env: w.webhooksEnvVars(resolveContext).Append(
modules.Env("KAFKA_TOPICS", strings.Join([]string{
resolveContext.Stack.GetServiceName("ledger"),
resolveContext.Stack.GetServiceName("payments"),
}, " ")),
),
Args: []string{"worker"},
Resources: modules.GetResourcesWithDefault(
resolveContext.Configuration.Spec.Services.Webhooks.ResourceProperties,
modules.ResourceSizeSmall(),
),
Debug: ctx.Configuration.Spec.Services.Webhooks.Debug,
}
},
},
}
},
},
"v2.0.0-alpha": {
DatabaseMigration: &modules.DatabaseMigration{
Shutdown: true,
Command: []string{"migrate"},
Expand Down

0 comments on commit c2c14ec

Please sign in to comment.