From e63903990d92829a52ac397339f86cc2c925e4f5 Mon Sep 17 00:00:00 2001 From: Gero Posmyk-Leinemann Date: Thu, 12 Oct 2023 10:21:50 +0000 Subject: [PATCH] [spicedb] Apply migrations in the ArgoCD PreSync hook --- install/installer/pkg/components/spicedb/migrations.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install/installer/pkg/components/spicedb/migrations.go b/install/installer/pkg/components/spicedb/migrations.go index b46f7b03da4a16..65681381603127 100644 --- a/install/installer/pkg/components/spicedb/migrations.go +++ b/install/installer/pkg/components/spicedb/migrations.go @@ -33,12 +33,13 @@ 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": "PreSync", "argocd.argoproj.io/hook-delete-policy": "HookSucceeded", } }),