File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 33set -e
44set -u
55
6+ CLEAN_UP_ORPHANED_REPLICA_SETS=' --clean-up-orphaned-replica-sets'
67usage () {
7- echo -e " Usage: $0 <deployment|statefulset> <name>\n"
8+ echo -e " Usage: $0 <deployment|statefulset> <name> [ ${CLEAN_UP_ORPHANED_REPLICA_SETS} ] \n"
89}
910
1011if [ $# -le 1 ]; then
1112 usage
1213 exit 1
1314fi
1415
16+ SHOULD_CLEAN_UP=${3:- }
17+
1518# Override to use a different Docker image name for the sidecar.
1619export SIDECAR_IMAGE_NAME=${SIDECAR_IMAGE_NAME:- ' gcr.io/stackdriver-prometheus/stackdriver-prometheus-sidecar' }
1720
3740 - name: ${DATA_VOLUME}
3841 mountPath: ${DATA_DIR}
3942"
43+ if [[ " ${SHOULD_CLEAN_UP} " == " ${CLEAN_UP_ORPHANED_REPLICA_SETS} " ]]; then
44+ # Delete the replica sets from the old deployment. If the Prometheus Server is
45+ # a deployment that does not have `revisionHistoryLimit` set to 0, this is
46+ # useful to avoid PVC conflicts between the old replica set and the new one
47+ # that prevents the pod from entering a RUNNING state.
48+ kubectl -n " ${KUBE_NAMESPACE} " get rs | grep " $2 -" | awk ' {print $1}' | xargs kubectl delete -n " ${KUBE_NAMESPACE} " rs
49+ fi
You can’t perform that action at this time.
0 commit comments