(bin) Update kube-merge command
This commit is contained in:
parent
2465365f17
commit
001f99a0ac
23
.bin/kube-merge
Executable file
23
.bin/kube-merge
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Create backup of previous kubeconfig
|
||||||
|
cp ~/.kube/config ~/.kube/config.bak
|
||||||
|
|
||||||
|
KUBECONFIG=""
|
||||||
|
|
||||||
|
for config in ~/.kube/config-*
|
||||||
|
do
|
||||||
|
profile=$(echo $config | cut -d '-' -f 2)
|
||||||
|
|
||||||
|
# De-duplicate profile names
|
||||||
|
sed 's/default/'$profile'/g' $config > $config.tmp
|
||||||
|
KUBECONFIG="$KUBECONFIG:$config.tmp"
|
||||||
|
done
|
||||||
|
|
||||||
|
KUBECONFIG=$(echo $KUBECONFIG | cut -c2-)
|
||||||
|
|
||||||
|
# Flatten configuration and write it to file
|
||||||
|
KUBECONFIG=$KUBECONFIG kubectl config view --flatten > ~/.kube/config
|
||||||
|
|
||||||
|
# Remove building blocks
|
||||||
|
rm ~/.kube/config-*.tmp
|
5
.zshrc
5
.zshrc
@ -111,11 +111,6 @@ alias gitcommiiiiiiiiiiiiiit='cz'
|
|||||||
|
|
||||||
alias clip='xclip -selection primary'
|
alias clip='xclip -selection primary'
|
||||||
|
|
||||||
function kube-merge() {
|
|
||||||
cp ~/.kube/config ~/.kube/config.bak &&
|
|
||||||
KUBECONFIG=~/.kube/config-nuuday:~/.kube/config-halia kubectl config view --flatten > ~/.kube/config
|
|
||||||
}
|
|
||||||
|
|
||||||
# alias wg-reload="f() {sudo bash -c 'cd /etc/wireguard && wg syncconf $1 <(wg-quick strip $1)'};f"
|
# alias wg-reload="f() {sudo bash -c 'cd /etc/wireguard && wg syncconf $1 <(wg-quick strip $1)'};f"
|
||||||
function wg-reload() {
|
function wg-reload() {
|
||||||
sudo bash -c 'cd /etc/wireguard && wg syncconf $0 <(wg-quick strip $0)' $1
|
sudo bash -c 'cd /etc/wireguard && wg syncconf $0 <(wg-quick strip $0)' $1
|
||||||
|
Loading…
Reference in New Issue
Block a user