In this article, I want to share about Helmfile PosSync Hook. The problem is when I use Helmfile with KustomizationThe results of spread always provide success. I don’t know the right launch status for new distribution. So, to handle this case, the hook can be applied to helmfile.yaml.
...
releases:
- name: example-release
chart: ./backend
jsonPatches:
- ./backend/deployment.yaml.gotmpl
hooks:
- events: ["postsync"]
showlogs: true
command: "sh"
args: ["-c", "./script.sh {{`{{`}} .Release.Name {{`}}`}} {{`{{`}} .Release.Namespace {{`}}`}}"]
Script.SH
#!/bin/sh
RELEASE_NAME=$1
NAMESPACE=$2
DEPLOYMENT_NAME=$(kubectl get deployment -n $NAMESPACE -l "app=$RELEASE_NAME" -o jsonpath="{.items[0].metadata.name}")
kubectl rollout status deployment/$DEPLOYMENT_NAME -n $NAMESPACE --timeout=60s
if [ $? -ne 0 ]; then
echo "Deployment $DEPLOYMENT_NAME failed."
exit 1
else
echo "Deployment succeeded."
fi
Admin Lukmanlab, Devops engineer, site reliability engineer, system administrator.
Game Center
Game News
Review Film
Rumus Matematika
Anime Batch
Berita Terkini
Berita Terkini
Berita Terkini
Berita Terkini
review anime