-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploy: Modularize gcp terraform (#717)
refactor of gcp terraform into modules * Add maintenance time variable with default * Changes bastion image to centos * Removes destroy trigger for patching reclaimpolicy PV * Adds bash script to change pv reclaimpolicy from Retain to Delete
- Loading branch information
Showing
28 changed files
with
851 additions
and
885 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
# Set the ReclaimPolicy of persistent volumes bound to PVCs for a TiDB cluster in a given namespace | ||
# Inputs: Path to a valid kubeconfig file and the namespace in which the PVCs live. | ||
# Run before terraform destroy | ||
|
||
set -euo pipefail | ||
set -x | ||
|
||
KUBECONFIGFILE=$1 | ||
NAMESPACE=$2 | ||
|
||
if [[ ! -f ${KUBECONFIGFILE} ]]; then | ||
echo "The given kubeconfig file does not exist" | ||
exit 1 | ||
fi | ||
|
||
if ! kubectl --kubeconfig ${KUBECONFIGFILE} get ns ${NAMESPACE}; then | ||
echo "The given namespace was not found in the kubernetes cluster for the given kubeconfig file" | ||
exit 1 | ||
fi | ||
|
||
kubectl --kubeconfig ${KUBECONFIGFILE} get pvc -n ${NAMESPACE} -o jsonpath='{.items[*].spec.volumeName}'|fmt -1 | xargs -I {} kubectl --kubeconfig ${KUBECONFIGFILE} patch pv {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.