Skip to content

Commit

Permalink
[spicedb] Apply migrations in the ArgoCD PreSync hook
Browse files Browse the repository at this point in the history
  • Loading branch information
geropl committed Oct 12, 2023
1 parent d2adcd8 commit c5038fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion install/installer/pkg/components/spicedb/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ func migrations(ctx *common.RenderContext) ([]runtime.Object, error) {
Labels: common.CustomizeLabel(ctx, Component, common.TypeMetaBatchJob),
Annotations: common.CustomizeAnnotation(ctx, Component, common.TypeMetaBatchJob, func() map[string]string {
// Because we are using ArgoCD to deploy, we need to add these annotations so:
// 1. it knows when to apply it (during the "Sync" hook, the same phase the all other manifests are applied)
// 1. it knows when to apply it (during the "PreSync" hook, before other manifests are applied)
// 2. that it should remove it once it is done
// - this is necessary so it does not show up as "ouf of sync" once the "TTLSecondsAfterFinished" option kicks in
// - if we would not remove the job at all, we would have a name clash an future updates ("field is immutable")
// docs: https://argo-cd.readthedocs.io/en/stable/user-guide/resource_hooks/#usage
return map[string]string{
"argocd.argoproj.io/hook": "Sync",
"argocd.argoproj.io/hook-delete-policy": "HookSucceeded",
Expand Down

0 comments on commit c5038fe

Please sign in to comment.