You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/01/21 20:19:32 UTC

[airflow] 07/44: Fix chart jobs delete policy for improved idempotency (#12646)

This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 70c5a8ab9997c9e9feaa676573462dca3779eae4
Author: Florent Chehab <fc...@meilleursagents.com>
AuthorDate: Tue Dec 1 19:24:42 2020 +0100

    Fix chart jobs delete policy for improved idempotency (#12646)
    
    The chart has two jobs (migrate-database & create-user).
    These jobs are run post-install and post-upgrade and only deleted on success.
    
    So if for some reason (quick reinstall / upgrade), the job fails or is stuck then helm
    will fail because the job already exists.
    
    This commit sets the `helm.sh/hook-delete-policy` to `before-hook-creation,hook-succeeded`
    so helm will always delete the jobs before creating them again.
    
    (cherry picked from commit a697c588c43450a9b69e607b052c17a27bd5ac0e)
---
 chart/templates/create-user-job.yaml      | 2 +-
 chart/templates/migrate-database-job.yaml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/chart/templates/create-user-job.yaml b/chart/templates/create-user-job.yaml
index 4df7dd6..9ae0ee7 100644
--- a/chart/templates/create-user-job.yaml
+++ b/chart/templates/create-user-job.yaml
@@ -35,7 +35,7 @@ metadata:
   annotations:
     "helm.sh/hook": post-install
     "helm.sh/hook-weight": "2"
-    "helm.sh/hook-delete-policy": hook-succeeded
+    "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
 spec:
   template:
     metadata:
diff --git a/chart/templates/migrate-database-job.yaml b/chart/templates/migrate-database-job.yaml
index 8639648..fb30498 100644
--- a/chart/templates/migrate-database-job.yaml
+++ b/chart/templates/migrate-database-job.yaml
@@ -34,7 +34,7 @@ metadata:
   annotations:
     "helm.sh/hook": post-install,post-upgrade
     "helm.sh/hook-weight": "1"
-    "helm.sh/hook-delete-policy": hook-succeeded
+    "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
 spec:
   template:
     metadata: