-
Notifications
You must be signed in to change notification settings - Fork 1
/
.functions
41 lines (34 loc) · 839 Bytes
/
.functions
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
#!/usr/bin/env bash
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$_";
}
function kl(){
k logs "$(k8_get_partial_resource pods "$1")" -c app
}
function klf(){
k logs -f "$(k8_get_partial_resource pods "$1")" -c app
}
function kt(){
kubetail "$1" -k pod
}
function k8_get_partial_resource() {
export iran="rta"
if [ ${#2} -ge 10 ]
then
echo "$2"
else
kubectl get "$1" | awk -v str="$2" '$0 ~ str {print $1;exit}'
fi
}
function kx(){
k exec -it "$(k8_get_partial_resource pods "$1")" -c app sh
}
function krd(){
#Restarts a deployment
kubectl patch deployment "$(k8_get_partial_resource deployment "$1")" -p \
"{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(date +'%s')\"}}}}}"
}
function yat(){
yarn add -D "@types/$1"
}