#!/usr/bin/env bash
set -euo pipefail

cd "$(dirname "$0")/.."
source deploy/env.sh

TARGET_NAMESPACE="${1:-$PROD_NAMESPACE}"

echo "Rolling back deployment/$DEPLOYMENT_NAME in namespace $TARGET_NAMESPACE"
kubectl rollout undo deployment/"$DEPLOYMENT_NAME" -n "$TARGET_NAMESPACE"
kubectl rollout status deployment/"$DEPLOYMENT_NAME" -n "$TARGET_NAMESPACE"

echo "Rollback OK."
