-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.custom_funcs.sh
43 lines (37 loc) · 1001 Bytes
/
.custom_funcs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
export K8S_SERVICES="tds-alpine tds-rconnector tds-notebooks tds-chorus nfs-subdir-external-provisioner"
function klogs() {
deployName="$1"
shift
kubectl logs "deployment/$deployName" "$@"
}
function kexecProc() {
deployName="$1"
shift
if [ -n "$1" ]; then
kubectl exec -it "deployment/$deployName" "$@"
else
kubectl exec -it "deployment/$deployName" -- /bin/bash
fi
}
function kcleanReplicas() {
emptyReplicasets="`kubectl get replicasets | grep '0[ ]\+0[ ]\+0' | cut -d' ' -f 1`"
if [ -n "$emptyReplicasets" ]; then
kubectl delete replicasets $emptyReplicasets
fi
}
function kstopAll() {
for d in $K8S_SERVICES; do
kubectl scale --replicas=0 "deployment/$d"
done
}
function kstartAll() {
if systemctl status dnsmasq 2>/dev/null >/dev/null; then
sudo systemctl restart dnsmasq
fi
for d in $K8S_SERVICES; do
kubectl scale --replicas=1 "deployment/$d"
done
}
function kswitchNS() {
kubectl config set-context --current --namespace=$1
}