-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
now just need to clean it all up
- Loading branch information
Jeff Peeler
committed
Aug 10, 2019
1 parent
8ffdb5b
commit fc43c40
Showing
4 changed files
with
189 additions
and
28 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
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 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 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,78 @@ | ||
#!/bin/bash | ||
|
||
namespace=local | ||
csv_name=etcdoperator.v0.9.4-clusterwide | ||
delay=5 | ||
|
||
|
||
function show_resources_simple() { | ||
echo "--- Showing resources of interest" | ||
echo "Listing cluster roles:" | ||
kubectl get clusterrole | grep etcd | ||
echo "Listing cluster roles bindings:" | ||
kubectl get clusterrolebinding | grep etcd | ||
echo "Listing service accounts:" | ||
kubectl get sa --all-namespaces | grep etcd | ||
echo "---" | ||
} | ||
|
||
function show_resources() { | ||
echo "--- Showing detailed resources of interest" | ||
echo "Listing cluster roles:" | ||
for item in $(kubectl get clusterrole -o=name | grep etcd); do | ||
kubectl get "$item" -o jsonpath='{.metadata}' | ||
echo "" | ||
done | ||
|
||
echo "Listing cluster roles bindings:" | ||
for item in $(kubectl get clusterrolebinding -o=name | grep etcd); do | ||
kubectl get "$item" -o jsonpath='{.metadata}' | ||
echo "" | ||
done | ||
|
||
echo "Listing service accounts:" | ||
for item in $(kubectl get sa --all-namespaces -o=name | grep etcd); do | ||
kubectl get "$item" -o jsonpath='{.metadata}' | ||
echo "" | ||
done | ||
|
||
echo "---" | ||
#k get clusterrolebinding -o jsonpath='{range .items[*]}{.metadata}{"\n"}{end}' | ||
} | ||
|
||
cat <<EOF | kubectl apply -f - | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: etcd | ||
namespace: $namespace | ||
spec: | ||
channel: clusterwide-alpha | ||
name: etcd | ||
source: operatorhubio-catalog | ||
sourceNamespace: local | ||
EOF | ||
|
||
retries=50 | ||
until [[ $retries == 0 || $new_csv_phase == "Succeeded" ]]; do | ||
new_csv_phase=$(kubectl get csv -n "${namespace}" $csv_name -o jsonpath='{.status.phase}' 2>/dev/null || echo "Waiting for CSV to appear") | ||
if [[ $new_csv_phase != "$csv_phase" ]]; then | ||
csv_phase=$new_csv_phase | ||
echo "CSV phase: $csv_phase" | ||
fi | ||
sleep 1 | ||
retries=$((retries - 1)) | ||
done | ||
|
||
echo "Sleeping for $delay seconds to let OLM settle" | ||
sleep $delay | ||
|
||
show_resources | ||
|
||
echo "Deleting subscription and CSV" | ||
kubectl delete subscription -n $namespace etcd | ||
kubectl delete csv -n $namespace $csv_name | ||
echo "$csv_name deleted" | ||
sleep $((delay*3)) | ||
|
||
show_resources |