Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"net/http"
"os"
"statsd"
"time"
"github.com/thedevsaddam/gojsonq"
#!/bin/bash
mkdir bkpIngressObjects
# clusters
for cluster in cluster1 cluster2
do
mkdir bkpIngressObjects/${cluster}
kubectl config use-context $cluster
for ingObject in $(kubectl get ing -o custom-columns=NAME:.metadata.name | grep -v NAME)
kubectl get ing/$ingObject -o json > bkpIngressObjects/${cluster}/${ingObject}.bkp.json
kubectl get ing/$ingObject -o json | jq '(.spec.rules[].http.paths[].backend.serviceName) |= "maintenance-page"' > ing.tmp