Skip to content

Commit

Permalink
migration: moving strategy to Recreate before upgrading (PROJQUAY-2586)
Browse files Browse the repository at this point in the history
During upgrade from QuayEcosystem into QuayRegistry postgres deployment
is updated to include an extra env variable:

- POSTGRESQL_ADMIN_PASSWORD

Once the deployment is updated a new replica for the database is created
but it fails to roll out due to PVC not allowing multiple attachments.

This PR forces the deployment to adopt Recreate strategy as it is the
default in 3.6 postgres deployment.
  • Loading branch information
ricardomaraschini committed Sep 28, 2021
1 parent de26800 commit 30eefd7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controllers/redhatcop/quayecosystem_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ func (r *QuayEcosystemReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}
}
postgresDeployment.Spec.Template.Spec.Containers[0].Env = envVars
postgresDeployment.Spec.Strategy = appsv1.DeploymentStrategy{
Type: appsv1.RecreateDeploymentStrategyType,
}

if err := r.Client.Update(ctx, &postgresDeployment); err != nil {
msg := "failed to update managed Postgres `Deployment` with `POSTGRESQL_ADMIN_PASSWORD` environment variable"
Expand Down

0 comments on commit 30eefd7

Please sign in to comment.