diff options
author | sushil masal <sushil.masal@amdocs.com> | 2019-02-28 17:04:21 +0530 |
---|---|---|
committer | sushil masal <sushil.masal@amdocs.com> | 2019-02-28 17:13:25 +0530 |
commit | 643827389ea12b4a426d707bd0ee68c178bc8e7f (patch) | |
tree | 52807e55583b81fe09f5b2dcdfeaec2428300cf2 /kubernetes/helm | |
parent | 6bfc50c41e338b52818323ffe9550a94d1111dea (diff) |
OOM-1664 add annotation last-applied-configuration
Issue-ID: OOM-1664
Change-Id: I36cbe306fbe9b391d4c0b1b5cd6816e02bc1999c
Signed-off-by: sushil masal <sushil.masal@amdocs.com>
Diffstat (limited to 'kubernetes/helm')
-rwxr-xr-x | kubernetes/helm/plugins/deploy/deploy.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kubernetes/helm/plugins/deploy/deploy.sh b/kubernetes/helm/plugins/deploy/deploy.sh index c92bc6e8b1..a07c7f4ce1 100755 --- a/kubernetes/helm/plugins/deploy/deploy.sh +++ b/kubernetes/helm/plugins/deploy/deploy.sh @@ -39,6 +39,7 @@ Flags: --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) -f, --values valueFiles specify values in a YAML file or a URL(can specify multiple) (default []) --verbose enables full helm install/upgrade output during deploy + --set-last-applied set the last-applied-configuration annotation on all objects.This annotation is required to restore services using Ark/Veloro backup restore. EOF } @@ -108,6 +109,12 @@ deploy() { FLAGS="$(echo $FLAGS| sed -n 's/--verbose//p')" VERBOSE="true" fi + # determine if set-last-applied flag is enabled + SET_LAST_APPLIED="false" + if [[ $FLAGS = *"--set-last-applied"* ]]; then + FLAGS="$(echo $FLAGS| sed -n 's/--set-last-applied//p')" + SET_LAST_APPLIED="true" + fi if [[ $FLAGS = *"--dry-run"* ]]; then VERBOSE="true" FLAGS="$FLAGS --debug" @@ -189,6 +196,12 @@ deploy() { else echo "release \"$RELEASE\" deployed" fi + # Add annotation last-applied-configuration if set-last-applied flag is set + if [[ $SET_LAST_APPLIED == "true" ]]; then + helm get manifest ${RELEASE} \ + | kubectl apply set-last-applied --create-annotation -n onap -f - \ + > $LOG_FILE.log 2>&1 + fi fi # upgrade/install each "enabled" subchart @@ -215,6 +228,12 @@ deploy() { else echo "release \"${RELEASE}-${subchart}\" deployed" fi + # Add annotation last-applied-configuration if set-last-applied flag is set + if [[ $SET_LAST_APPLIED == "true" ]]; then + helm get manifest "${RELEASE}-${subchart}" \ + | kubectl apply set-last-applied --create-annotation -n onap -f - \ + > $LOG_FILE.log 2>&1 + fi fi else array=($(helm ls -q | grep "${RELEASE}-${subchart}")) |