infra/scripts/update-istio-injection.sh
Viktor Barzin fd0f4a0365 fix: restore tree dropped by 6d224861; land stem95su gdrive-sync (10m) [ci skip]
6d224861 came from a --no-checkout worktree whose empty index made the
commit drop every file except two. This restores 05b50d2b's full tree and
correctly adds stacks/stem95su/gdrive-sync.tf + the service-catalog stem95su
entry. Forward-only (parent=6d224861, no force-push); [ci skip] since the
live infra was never applied from the broken commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 08:45:33 +00:00

28 lines
693 B
Bash
Executable file

#!/usr/bin/env bash
set -e
from=$1
to=$2
if [ -z "$from" ] || [ -z "$to" ]; then
echo 'pass 2 positional parameters - $from and $to'
exit 1
fi
commands=()
# Update terraform modules
for file in $(grep -rni "\"istio-injection\" : \"$from\"" . | grep -v '#' | awk '{print $1}' | cut -d':' -f1); do
echo $file
sed -i "s/istio-injection\" : \"$from\"/istio-injection\" : \"$to\"/" $file
ns=$(echo $file | cut -d'/' -f 4)
commands+=("kubectl -n $ns get deployments --no-headers | awk '{print \$1}' | xargs kubectl -n $ns rollout restart deployment")
done
# Apply changes
terraform apply -auto-approve
# Restart deployments
for cmd in "${commands[@]}"; do
echo $cmd
bash -c "$cmd"
done