Compare commits
245 Commits
6a035990da
...
master
Author | SHA1 | Date | |
---|---|---|---|
de8451e12b
|
|||
3d836bc810
|
|||
066e482fd8
|
|||
c6a9a90dde
|
|||
1d34f433ef
|
|||
8be57f1430
|
|||
92b9c9d927
|
|||
9334e7adcc
|
|||
17ad5b51fc
|
|||
7c99a558f6
|
|||
fca2d9530e
|
|||
|
3ad35f41c3 | ||
d98212c757
|
|||
c879e18a89
|
|||
4fb6921469
|
|||
f4e7952130
|
|||
716004c46b
|
|||
e2fb52f896
|
|||
851be03ffc
|
|||
f7259cf9af
|
|||
6bb71f487c
|
|||
2ad80a9c67
|
|||
14bc3b3b7c
|
|||
3e48fec287
|
|||
ce1a34246e
|
|||
fe5e9d9c9b
|
|||
a8f0d8d043
|
|||
21f3d27493
|
|||
18732d84e9
|
|||
58cbef9432
|
|||
e8ba500810
|
|||
14750b0260
|
|||
21b88d4ec6
|
|||
74888271aa
|
|||
aab2b2a52f
|
|||
2d78ed73c9
|
|||
c305a854eb
|
|||
d501fc75d0
|
|||
5eaee93d3e
|
|||
1e6b1a9c92
|
|||
79fd63ec78
|
|||
951bbcc7fd
|
|||
a1cd7f9eae
|
|||
aae5d5791d
|
|||
7a7ceaa3bd
|
|||
b7ab28935b
|
|||
b60bf05177
|
|||
028487c55a
|
|||
071195304d
|
|||
329f4124ae
|
|||
d7469d40ae
|
|||
e1aad7b032
|
|||
9c67d15489
|
|||
67a6f50ca7
|
|||
6e93ae0969
|
|||
6b44bf8ecc
|
|||
45c9d5afcb
|
|||
09a3059378
|
|||
625aa58ce9
|
|||
4bd7292f23
|
|||
d207414434
|
|||
0f584fd297
|
|||
a822f82708
|
|||
4c10b4fb94
|
|||
ce98d5da65
|
|||
6e64c9dd6a
|
|||
5650fc8fdb
|
|||
80710a2ccf
|
|||
34ba64ab24
|
|||
1bbe379a34
|
|||
a0a1834112
|
|||
c44a00fbcb
|
|||
4b3373f76f
|
|||
80ee8996de
|
|||
3d1da1e586
|
|||
7f795ef69a
|
|||
3df7db747b
|
|||
1cd2abbcc4
|
|||
b0a62568e9
|
|||
b2487b3642
|
|||
642f685a03
|
|||
4338fae15f
|
|||
6336e83371
|
|||
c306923371
|
|||
2b6ac7ee27
|
|||
3d41d240b0
|
|||
c57251d4d5
|
|||
2a59d2b677
|
|||
08c0c58227
|
|||
5d22f6edc9
|
|||
9d4ee4e95b
|
|||
b65b3ee032
|
|||
8ac6aef897
|
|||
cdbd89cf3f
|
|||
5064c29cb4
|
|||
8795465b80
|
|||
e15ca89f5b
|
|||
64fe2474da
|
|||
0eb4663dab
|
|||
a1d663d0d6
|
|||
a6d474a93f
|
|||
1127b5fc64
|
|||
1aa3722c02
|
|||
53f6c16cf3
|
|||
855c741b0b
|
|||
7dd94b20e5
|
|||
6870e67472
|
|||
2ffd1172bf
|
|||
9271bddf7a
|
|||
6b4546694b
|
|||
b5b6d450eb
|
|||
03b058f685
|
|||
5d965ade68
|
|||
31ec51f982
|
|||
0e3be2cb83
|
|||
5b3cbc4cbd
|
|||
375ae575e5
|
|||
88474c7831
|
|||
c991af3e0f
|
|||
f363cabe84
|
|||
93134c7f30
|
|||
cbe4bdc0d7
|
|||
35853c10c2
|
|||
6009f16f95
|
|||
5a5fa09e70
|
|||
c49f1f1fc6
|
|||
10a9883a84
|
|||
6680689910
|
|||
b25a5c4c8d
|
|||
c5233d41e7
|
|||
6c7aee7b93
|
|||
1313900363
|
|||
843e1c6d20
|
|||
e918596757
|
|||
37817394c4
|
|||
475b4d3b5f
|
|||
28b8a20ff9
|
|||
15ae2e615a
|
|||
4528e35872
|
|||
381adefe87
|
|||
b9647b569d
|
|||
03ec3eea98
|
|||
d0b7ffb63b
|
|||
37497ee10a
|
|||
a08cb76510
|
|||
495da19e85
|
|||
dfba592831
|
|||
0ab4e25456
|
|||
758298694c
|
|||
8dcba62bee
|
|||
18bd3c0985
|
|||
99a1ef4575
|
|||
4b006c5c43
|
|||
ecb3beec8f
|
|||
693bb7a0e9
|
|||
9bb937fbe3
|
|||
f50d6136b9
|
|||
6462c06743
|
|||
dc6bf17452
|
|||
4265bf76ce
|
|||
ee191f8bd2
|
|||
f13e42df13
|
|||
6e2ad466d7
|
|||
e8fd0e0be6
|
|||
bca70e0e01
|
|||
e3dcb1da3d
|
|||
1568e5a56f
|
|||
fc58941ad1
|
|||
1cfabac2f5
|
|||
d0556dc92f
|
|||
d28d49cb04
|
|||
3024bbd0cc
|
|||
586538f14f
|
|||
56e07cfd24
|
|||
f79c757168
|
|||
83978cc429
|
|||
1dfe84005b
|
|||
927cf87bae
|
|||
622b9b16a8
|
|||
b1ca06ca1c
|
|||
6ab3606e20
|
|||
8752ee0267
|
|||
fd2f36cab0
|
|||
21dc2e7a00
|
|||
0b43014820
|
|||
09248c19cd
|
|||
57ee208407
|
|||
3990c8fd9c
|
|||
48ad89385b
|
|||
5d4a7758c0
|
|||
581c598ed3
|
|||
c72372296c
|
|||
9247ec3937
|
|||
383e96efec
|
|||
edfbcee609
|
|||
|
07d93ee063 | ||
|
5c6919591b | ||
|
7a0806ce75 | ||
|
6081c13f66 | ||
|
b04d770a26 | ||
|
723b7be4e5 | ||
3335b8fd82 | |||
d095509d3a | |||
223d9f28a5 | |||
|
e7dadd014f | ||
05fd6a64bd | |||
4b787f5046 | |||
|
61545c7939 | ||
|
7c5f0aba60 | ||
2cd75934ac | |||
4a0c464704 | |||
a6b8d2b29e | |||
5cf171a14e | |||
|
072aeb4c42 | ||
|
a867f65a7a | ||
|
8fd8077ba1 | ||
|
e1a40415c6 | ||
ff544ee43e | |||
17e691cf96 | |||
|
b171074349 | ||
|
a1b136155b | ||
|
18a78386a4 | ||
|
fe445a48f1 | ||
|
13a55a8b7a | ||
|
4f3b5b18d1 | ||
|
299f345a54 | ||
|
f67e206fc9 | ||
|
d92841b3f4 | ||
|
c0751c5633 | ||
dcaf6f8b17 | |||
5315d95298 | |||
fda40a53cd | |||
91f4909c0d | |||
97580de535 | |||
f7e3bf6af9 | |||
67de5ca347 | |||
17c24459cd | |||
0132d1b125 | |||
|
cffe261765 | ||
|
b8e7fffb40 | ||
|
7fd182569b | ||
7b57da7ac9 | |||
cfed6832ad | |||
387deecb80 | |||
15c860b0fe |
@@ -1,50 +0,0 @@
|
|||||||
format = """\
|
|
||||||
$directory\
|
|
||||||
$git_branch\
|
|
||||||
$git_commit\
|
|
||||||
$git_state\
|
|
||||||
$git_status\
|
|
||||||
$package\
|
|
||||||
$golang\
|
|
||||||
$nodejs\
|
|
||||||
$terraform\
|
|
||||||
$memory_usage\
|
|
||||||
$aws\
|
|
||||||
$kubernetes\
|
|
||||||
$cmd_duration\
|
|
||||||
$custom\
|
|
||||||
$line_break\
|
|
||||||
$jobs\
|
|
||||||
$battery\
|
|
||||||
$time\
|
|
||||||
$character\
|
|
||||||
"""
|
|
||||||
|
|
||||||
[character]
|
|
||||||
success_symbol = "[✨](yellow)"
|
|
||||||
error_symbol = "[✗](red)"
|
|
||||||
use_symbol_for_status = true
|
|
||||||
|
|
||||||
[aws]
|
|
||||||
symbol = " "
|
|
||||||
displayed_items = "profile"
|
|
||||||
|
|
||||||
[docker]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[git_commit]
|
|
||||||
only_detached = true
|
|
||||||
|
|
||||||
[golang]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[kubernetes]
|
|
||||||
symbol = "ﴱ "
|
|
||||||
style = "bold blue"
|
|
||||||
disabled = false
|
|
||||||
|
|
||||||
[terraform]
|
|
||||||
show_version = true
|
|
||||||
|
|
||||||
[nodejs]
|
|
||||||
symbol = " "
|
|
@@ -1,17 +0,0 @@
|
|||||||
# Aliases
|
|
||||||
alias grep='grep --color=auto'
|
|
||||||
alias watch='watch '
|
|
||||||
alias cat=' bat '
|
|
||||||
alias curl='curlie'
|
|
||||||
alias tmp='cd $(mktemp -d)'
|
|
||||||
alias ls=' exa --group-directories-first --icons --header --git --ignore-glob=.git'
|
|
||||||
lt() {
|
|
||||||
DEPTH=$(echo $1 | grep "^[0-9]*$")
|
|
||||||
if [ "$DEPTH" = "" ]; then
|
|
||||||
DEPTH=2
|
|
||||||
else
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
ls -l --tree -L $DEPTH -I ".git|cache|log|logs|node_modules|vendor" $@
|
|
||||||
}
|
|
||||||
alias aws='docker run --rm -ti -v ~/.aws:/root/.aws -v $(pwd):/aws -e AWS_PROFILE -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY amazon/aws-cli'
|
|
@@ -1,24 +0,0 @@
|
|||||||
alias aws='docker pull -q amazon/aws-cli:latest 1> /dev/null && docker run --rm -i -v ~/.aws:/root/.aws -v $(pwd):/aws -e NO_COLOR=true -e AWS_PROFILE -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN amazon/aws-cli'
|
|
||||||
|
|
||||||
assume-role() {
|
|
||||||
ROLE=$1
|
|
||||||
|
|
||||||
if [[ -z "$ROLE" ]]; then
|
|
||||||
export AWS_ACCESS_KEY_ID=
|
|
||||||
export AWS_SECRET_ACCESS_KEY=
|
|
||||||
export AWS_SESSION_TOKEN=
|
|
||||||
else
|
|
||||||
OUTPUT=$(aws sts assume-role --role-arn $ROLE --role-session-name assumed-role-session --query Credentials --output json)
|
|
||||||
|
|
||||||
export AWS_ACCESS_KEY_ID=$(echo $OUTPUT | jq -r .AccessKeyId)
|
|
||||||
export AWS_SECRET_ACCESS_KEY=$(echo $OUTPUT | jq -r .SecretAccessKey)
|
|
||||||
export AWS_SESSION_TOKEN=$(echo $OUTPUT | jq -r .SessionToken)
|
|
||||||
fi
|
|
||||||
|
|
||||||
aws sts get-caller-identity
|
|
||||||
}
|
|
||||||
|
|
||||||
aws-decode-message() {
|
|
||||||
ENCODED=$1
|
|
||||||
aws sts decode-authorization-message --query DecodedMessage --output text --encoded-message $ENCODED | jq -r '.context.action, .context.resource'
|
|
||||||
}
|
|
@@ -1,21 +0,0 @@
|
|||||||
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/goworkspace/bin"
|
|
||||||
export EDITOR='vim'
|
|
||||||
export VISUAL='code'
|
|
||||||
|
|
||||||
# AWS
|
|
||||||
if [ -f ~/.aws/profile ]; then
|
|
||||||
export AWS_PROFILE=$(cat ~/.aws/profile)
|
|
||||||
export AWS_DEFAULT_REGION=eu-west-1
|
|
||||||
export AWS_REGION=eu-west-1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Node
|
|
||||||
export NODE_ENV=localhost
|
|
||||||
export NPM_TOKEN=`head -n 1 ~/.npmrc | sed 's~//registry.npmjs.org/:_authToken=\(.*\)~\1~'`
|
|
||||||
|
|
||||||
# Go
|
|
||||||
export GOPATH=$HOME/goworkspace
|
|
||||||
export GO111MODULE=on
|
|
||||||
|
|
||||||
# Krew
|
|
||||||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
|
@@ -1,167 +0,0 @@
|
|||||||
alias k='kubectl '
|
|
||||||
alias kshell='kubectl run -it shell --image bash --restart Never --rm -- sh'
|
|
||||||
|
|
||||||
kiam () {
|
|
||||||
kubectl run -it shell --image docker-tiocoreeng-apps-virtual.bts.artifactory.tio.systems/aws-cli:latest --env=AWS_DEFAULT_REGION=eu-west-1 --overrides="{ \"metadata\": { \"annotations\": { \"iam.amazonaws.com/role\": \"$1\" } } }" --command bash --restart Never --rm
|
|
||||||
}
|
|
||||||
|
|
||||||
kube-ssh() {
|
|
||||||
sh -c "$(curl -sSL https://raw.githubusercontent.com/AverageMarcus/kube-ssh/master/ssh.sh)"
|
|
||||||
}
|
|
||||||
|
|
||||||
kube-forward() {
|
|
||||||
if [ -n "$ZSH_VERSION" ]; then
|
|
||||||
setopt LOCAL_OPTIONS NO_NOTIFY NO_MONITOR
|
|
||||||
fi
|
|
||||||
IFS=$'\n'
|
|
||||||
SERVICES=( $(kubectl get service --no-headers -o json | jq '[.items[] | select(.metadata.annotations."kube-forward" != "false")] | (.[] | .metadata.name + "\t" + ([.spec.ports[].port] | join(",")))' -r | column -t) )
|
|
||||||
unset IFS
|
|
||||||
|
|
||||||
TO_KILL=()
|
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
echo "\nClosing connections..."
|
|
||||||
for pid in "${TO_KILL[@]}"
|
|
||||||
do
|
|
||||||
(kill -2 $pid) &> /dev/null
|
|
||||||
done
|
|
||||||
|
|
||||||
trap - INT TERM
|
|
||||||
}
|
|
||||||
trap 'cleanup' INT TERM
|
|
||||||
|
|
||||||
HOST_PORT=9001
|
|
||||||
|
|
||||||
echo "Forwarding..."
|
|
||||||
|
|
||||||
for s in "${SERVICES[@]}"
|
|
||||||
do
|
|
||||||
SERVICE=( $(echo $s) )
|
|
||||||
if [ -n "$ZSH_VERSION" ]; then
|
|
||||||
NAME=${SERVICE[1]}
|
|
||||||
PORT=${SERVICE[2]}
|
|
||||||
else
|
|
||||||
NAME=${SERVICE[0]}
|
|
||||||
PORT=${SERVICE[1]}
|
|
||||||
fi
|
|
||||||
PORTS=($(echo $PORT | tr "," "\n"))
|
|
||||||
for PORT in "${PORTS[@]}"
|
|
||||||
do
|
|
||||||
(kubectl port-forward svc/$NAME $HOST_PORT:$PORT > /dev/null 2>&1) &
|
|
||||||
BG_PID=$!
|
|
||||||
|
|
||||||
if `curl -s -o /dev/null --retry 5 --retry-delay 0 --retry-connrefused -m 3 http://localhost:$HOST_PORT`
|
|
||||||
then
|
|
||||||
echo "\e[1m$NAME:$PORT\e[0m ➡ \e[34mhttp://localhost:$HOST_PORT\e[0m"
|
|
||||||
TO_KILL+=($BG_PID)
|
|
||||||
((HOST_PORT=HOST_PORT+1))
|
|
||||||
else
|
|
||||||
(kill -2 $BG_PID) &> /dev/null
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "\n\e[2m(Use [Ctl + C] to exit)"
|
|
||||||
cat
|
|
||||||
if [ -n "$BASH_VERSION" ]; then
|
|
||||||
cleanup
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
source <(kubectl completion zsh)
|
|
||||||
|
|
||||||
## Merge multiple kubeconfigs
|
|
||||||
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
|
|
||||||
KUBECONFIG="$HOME/.kube/config"
|
|
||||||
OTHER_CLUSTERS="$(join_by :$HOME/.kube/clusters/ $(echo $HOME/.kube/clusters/$(/bin/ls $HOME/.kube/clusters)))"
|
|
||||||
export KUBECONFIG=$KUBECONFIG:$OTHER_CLUSTERS
|
|
||||||
|
|
||||||
## Kubectl exec
|
|
||||||
kx () {
|
|
||||||
local pod=($(kubectl get pods --all-namespaces -owide | fzf | awk '{print $1, $2}'))
|
|
||||||
local cmd=${@:-"sh"}
|
|
||||||
|
|
||||||
echo kubectl exec -it --namespace $pod[1] $pod[2] $cmd
|
|
||||||
kubectl exec -it --namespace $pod[1] $pod[2] $cmd
|
|
||||||
}
|
|
||||||
|
|
||||||
## Kubectl logs
|
|
||||||
kl () {
|
|
||||||
local pod=($(kubectl get pods --all-namespaces -owide | fzf | awk '{print $1, $2}'))
|
|
||||||
local attr=${@:-""}
|
|
||||||
|
|
||||||
echo kubectl logs -f $attr --namespace $pod[1] $pod[2]
|
|
||||||
kubectl logs -f $attr --namespace $pod[1] $pod[2]
|
|
||||||
}
|
|
||||||
|
|
||||||
## Display everything
|
|
||||||
kall () {
|
|
||||||
kubectl get all --all-namespaces
|
|
||||||
}
|
|
||||||
|
|
||||||
kctx () {
|
|
||||||
KUBECONFIG="$HOME/.kube/config"
|
|
||||||
OTHER_CLUSTERS="$(join_by :$HOME/.kube/clusters/ $(echo $HOME/.kube/clusters/$(ls $HOME/.kube/clusters)))"
|
|
||||||
export KUBECONFIG=$KUBECONFIG:$OTHER_CLUSTERS
|
|
||||||
kubectx $@
|
|
||||||
}
|
|
||||||
|
|
||||||
k-version-test() {
|
|
||||||
VERSION=""
|
|
||||||
FILES=""
|
|
||||||
while test $# -gt 0; do
|
|
||||||
case "$1" in
|
|
||||||
-v|--version)
|
|
||||||
shift
|
|
||||||
VERSION=$1
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-f|--files)
|
|
||||||
shift
|
|
||||||
FILES=$1
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-h|--help)
|
|
||||||
echo "k-version-test - test Kubernetes manifest files against different versions of Kubernetes"
|
|
||||||
echo " "
|
|
||||||
echo "k-version-test [options]"
|
|
||||||
echo " "
|
|
||||||
echo "Options:"
|
|
||||||
echo "-h, --help show this help text"
|
|
||||||
echo "-v, --version the version of kubernetes to test against"
|
|
||||||
echo "-f, --files the manifest file(s) to test against"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
which kind &> /dev/null || (echo "'kind' not installed. Follow install instructions here: https://github.com/kubernetes-sigs/kind/"; return 1)
|
|
||||||
|
|
||||||
if [ ! -z $VERSION ];
|
|
||||||
then
|
|
||||||
TAG=$(curl -s 'https://registry.hub.docker.com/v2/repositories/kindest/node/tags/' | jq '."results" | map(.name | select(startswith("v'$VERSION'"))) | .[0]' | xargs)
|
|
||||||
kind create cluster --image kindest/node:$TAG
|
|
||||||
else
|
|
||||||
kind create cluster
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
|
|
||||||
if kubectl apply --dry-run -f $FILES ; then
|
|
||||||
echo "\n☸️ Kubernetes $VERSION. Result: ✅\n"
|
|
||||||
else
|
|
||||||
echo "\n☸️ Kubernetes $VERSION. Result: ❌\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
kind delete cluster
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fix-broken-replicasets() {
|
|
||||||
kubectl get replicasets --all-namespaces -o jsonpath='{range .items[?(@.status.replicas==0)]}--namespace {@.metadata.namespace} {@.metadata.name};{end}' | tr ";" "\n" | xargs -I {} sh -c "kubectl delete rs {}"
|
|
||||||
}
|
|
||||||
|
|
||||||
source <(tkn completion zsh)
|
|
@@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
|
||||||
load-nvmrc() {
|
|
||||||
local node_version="$(nvm version)"
|
|
||||||
local nvmrc_path="$(nvm_find_nvmrc)"
|
|
||||||
|
|
||||||
if [ -n "$nvmrc_path" ]; then
|
|
||||||
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
|
|
||||||
|
|
||||||
if [ "$nvmrc_node_version" = "N/A" ]; then
|
|
||||||
nvm install
|
|
||||||
elif [ "$nvmrc_node_version" != "$node_version" ]; then
|
|
||||||
nvm use
|
|
||||||
fi
|
|
||||||
elif [ "$node_version" != "$(nvm version default)" ]; then
|
|
||||||
echo "Reverting to nvm default version"
|
|
||||||
nvm use 4 #default
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
add-zsh-hook chpwd load-nvmrc
|
|
||||||
load-nvmrc
|
|
41
.gitconfig
41
.gitconfig
@@ -1,41 +0,0 @@
|
|||||||
[user]
|
|
||||||
name = Marcus Noble
|
|
||||||
email = github@marcusnoble.co.uk
|
|
||||||
|
|
||||||
[core]
|
|
||||||
editor = /usr/bin/vim
|
|
||||||
excludesfile = ~/.gitignore
|
|
||||||
|
|
||||||
[push]
|
|
||||||
default = simple
|
|
||||||
|
|
||||||
[credential]
|
|
||||||
helper = store
|
|
||||||
|
|
||||||
[color]
|
|
||||||
ui = true
|
|
||||||
[color "diff"]
|
|
||||||
old = red strike
|
|
||||||
new = green italic
|
|
||||||
|
|
||||||
[alias]
|
|
||||||
basename = "!git remote -v | head -n1 | awk '{print $2}' | sed 's/.*\\///' | sed 's/\\.git//'"
|
|
||||||
org-name = "!git remote -v | grep -m 1 -o ':.*/' | sed 's:^.\\(.*\\).$:\\1:'"
|
|
||||||
branch-name = "!git rev-parse --abbrev-ref HEAD"
|
|
||||||
changelog-changed = "!test $(git diff --name-only HEAD origin/master | grep CHANGELOG.md | wc -l | xargs) = 1"
|
|
||||||
|
|
||||||
main = "!git remote set-head origin --auto && git checkout $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') && git pull"
|
|
||||||
publish = "!func(){ if [[ $(git branch-name) != \"$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\" ]]; then git push -u origin $(git branch-name) && (git changelog-changed || echo '\n\n⚠️ Dont forget to update changelog ⚠️ ') ; else echo "Wat?!"; fi; }; func"
|
|
||||||
cleanup = "!git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done"
|
|
||||||
dont-change-file = "!git update-index --assume-unchanged"
|
|
||||||
ignore-file = "!git update-index --skip-worktree"
|
|
||||||
remember-file = "!git update-index --no-skip-worktree"
|
|
||||||
logg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
|
|
||||||
dif = "!git diff -w"
|
|
||||||
pop = "!git stash pop"
|
|
||||||
|
|
||||||
[help]
|
|
||||||
autocorrect = 1
|
|
||||||
|
|
||||||
[diff]
|
|
||||||
compactionHeuristic = true
|
|
10
.gitignore
vendored
10
.gitignore
vendored
@@ -22,3 +22,13 @@
|
|||||||
.env
|
.env
|
||||||
|
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
|
/os-specific/darwin/home/.gnupg/*
|
||||||
|
!/os-specific/darwin/home/.gnupg/gpg-agent.conf
|
||||||
|
/home/.kube/*
|
||||||
|
!/home/.kube/clusters/.gitkeep
|
||||||
|
!/home/.kube/switch-config.yaml
|
||||||
|
|
||||||
|
/home/.k9s/benchmarks
|
||||||
|
/home/.k9s/clusters
|
||||||
|
/home/.k9s/screen-dumps
|
||||||
|
156
.hyper.js
156
.hyper.js
@@ -1,156 +0,0 @@
|
|||||||
// Future versions of Hyper may add additional config options,
|
|
||||||
// which will not automatically be merged into this file.
|
|
||||||
// See https://hyper.is#cfg for all currently supported options.
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
config: {
|
|
||||||
// choose either `'stable'` for receiving highly polished,
|
|
||||||
// or `'canary'` for less polished but more frequent updates
|
|
||||||
updateChannel: 'stable',
|
|
||||||
|
|
||||||
scrollback: 100000,
|
|
||||||
|
|
||||||
// default font size in pixels for all tabs
|
|
||||||
fontSize: 13,
|
|
||||||
|
|
||||||
// font family with optional fallbacks
|
|
||||||
fontFamily: '"OpenDyslexicMono Nerd Font", "Fira Code", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
|
|
||||||
|
|
||||||
// default font weight: 'normal' or 'bold'
|
|
||||||
fontWeight: 'normal',
|
|
||||||
|
|
||||||
// font weight for bold characters: 'normal' or 'bold'
|
|
||||||
fontWeightBold: 'bold',
|
|
||||||
|
|
||||||
// line height as a relative unit
|
|
||||||
lineHeight: 1,
|
|
||||||
|
|
||||||
// letter spacing as a relative unit
|
|
||||||
letterSpacing: 0,
|
|
||||||
|
|
||||||
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
|
|
||||||
cursorColor: 'rgba(248,28,229,0.8)',
|
|
||||||
|
|
||||||
// terminal text color under BLOCK cursor
|
|
||||||
cursorAccentColor: '#000',
|
|
||||||
|
|
||||||
// `'BEAM'` for |, `'UNDERLINE'` for _, `'BLOCK'` for █
|
|
||||||
cursorShape: 'BEAM',
|
|
||||||
|
|
||||||
// set to `true` (without backticks and without quotes) for blinking cursor
|
|
||||||
cursorBlink: true,
|
|
||||||
|
|
||||||
// color of the text
|
|
||||||
foregroundColor: '#fff',
|
|
||||||
|
|
||||||
// terminal background color
|
|
||||||
// opacity is only supported on macOS
|
|
||||||
backgroundColor: '#000',
|
|
||||||
|
|
||||||
// terminal selection color
|
|
||||||
selectionColor: 'rgba(248,28,229,0.3)',
|
|
||||||
|
|
||||||
// border color (window, tabs)
|
|
||||||
borderColor: '#333',
|
|
||||||
|
|
||||||
// custom CSS to embed in the main window
|
|
||||||
css: `.line {
|
|
||||||
color: #999;
|
|
||||||
stroke: #999;
|
|
||||||
}`,
|
|
||||||
|
|
||||||
// custom CSS to embed in the terminal window
|
|
||||||
termCSS: '',
|
|
||||||
|
|
||||||
// if you're using a Linux setup which show native menus, set to false
|
|
||||||
// default: `true` on Linux, `true` on Windows, ignored on macOS
|
|
||||||
showHamburgerMenu: '',
|
|
||||||
|
|
||||||
// set to `false` (without backticks and without quotes) if you want to hide the minimize, maximize and close buttons
|
|
||||||
// additionally, set to `'left'` if you want them on the left, like in Ubuntu
|
|
||||||
// default: `true` (without backticks and without quotes) on Windows and Linux, ignored on macOS
|
|
||||||
showWindowControls: '',
|
|
||||||
|
|
||||||
// custom padding (CSS format, i.e.: `top right bottom left`)
|
|
||||||
padding: '12px 14px',
|
|
||||||
|
|
||||||
// the full list. if you're going to provide the full color palette,
|
|
||||||
// including the 6 x 6 color cubes and the grayscale map, just provide
|
|
||||||
// an array here instead of a color map object
|
|
||||||
colors: {
|
|
||||||
black: '#000000',
|
|
||||||
red: '#C51E14',
|
|
||||||
green: '#1DC121',
|
|
||||||
yellow: '#C7C329',
|
|
||||||
blue: '#0A2FC4',
|
|
||||||
magenta: '#C839C5',
|
|
||||||
cyan: '#20C5C6',
|
|
||||||
white: '#C7C7C7',
|
|
||||||
lightBlack: '#686868',
|
|
||||||
lightRed: '#FD6F6B',
|
|
||||||
lightGreen: '#67F86F',
|
|
||||||
lightYellow: '#FFFA72',
|
|
||||||
lightBlue: '#6A76FB',
|
|
||||||
lightMagenta: '#FD7CFC',
|
|
||||||
lightCyan: '#68FDFE',
|
|
||||||
lightWhite: '#FFFFFF',
|
|
||||||
},
|
|
||||||
|
|
||||||
// the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
|
|
||||||
// if left empty, your system's login shell will be used by default
|
|
||||||
//
|
|
||||||
// Windows
|
|
||||||
// - Make sure to use a full path if the binary name doesn't work
|
|
||||||
// - Remove `--login` in shellArgs
|
|
||||||
//
|
|
||||||
// Bash on Windows
|
|
||||||
// - Example: `C:\\Windows\\System32\\bash.exe`
|
|
||||||
//
|
|
||||||
// PowerShell on Windows
|
|
||||||
// - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
|
|
||||||
shell: '',
|
|
||||||
|
|
||||||
// for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)
|
|
||||||
// by default `['--login']` will be used
|
|
||||||
shellArgs: ['--login'],
|
|
||||||
|
|
||||||
// for environment variables
|
|
||||||
env: {},
|
|
||||||
|
|
||||||
// set to `false` for no bell
|
|
||||||
bell: `false`,
|
|
||||||
|
|
||||||
// if `true` (without backticks and without quotes), selected text will automatically be copied to the clipboard
|
|
||||||
copyOnSelect: false,
|
|
||||||
|
|
||||||
// if `true` (without backticks and without quotes), hyper will be set as the default protocol client for SSH
|
|
||||||
defaultSSHApp: true,
|
|
||||||
|
|
||||||
// if `true` (without backticks and without quotes), on right click selected text will be copied or pasted if no
|
|
||||||
// selection is present (`true` by default on Windows and disables the context menu feature)
|
|
||||||
// quickEdit: true,
|
|
||||||
|
|
||||||
// URL to custom bell
|
|
||||||
// bellSoundURL: 'http://example.com/bell.mp3',
|
|
||||||
|
|
||||||
// for advanced config flags please refer to https://hyper.is/#cfg
|
|
||||||
},
|
|
||||||
|
|
||||||
// a list of plugins to fetch and install from npm
|
|
||||||
// format: [@org/]project[#version]
|
|
||||||
// examples:
|
|
||||||
// `hyperpower`
|
|
||||||
// `@company/project`
|
|
||||||
// `project#1.0.1`
|
|
||||||
plugins: ["hyper-search", "hyperterm-paste", "hyper-tabs-enhanced", "hyper-chesterish", "hyper-quit"],
|
|
||||||
|
|
||||||
// in development, you can create a directory under
|
|
||||||
// `~/.hyper_plugins/local/` and include it here
|
|
||||||
// to load it and avoid it being `npm install`ed
|
|
||||||
localPlugins: [],
|
|
||||||
|
|
||||||
keymaps: {
|
|
||||||
// Example
|
|
||||||
// 'window:devtools': 'cmd+alt+o',
|
|
||||||
},
|
|
||||||
};
|
|
@@ -1,22 +0,0 @@
|
|||||||
k9s:
|
|
||||||
refreshRate: 2
|
|
||||||
headless: false
|
|
||||||
readOnly: false
|
|
||||||
noIcons: false
|
|
||||||
logger:
|
|
||||||
tail: 100
|
|
||||||
buffer: 5000
|
|
||||||
sinceSeconds: -1
|
|
||||||
fullScreenLogs: false
|
|
||||||
textWrap: false
|
|
||||||
showTime: false
|
|
||||||
currentContext:
|
|
||||||
currentCluster:
|
|
||||||
clusters:
|
|
||||||
thresholds:
|
|
||||||
cpu:
|
|
||||||
critical: 90
|
|
||||||
warn: 80
|
|
||||||
memory:
|
|
||||||
critical: 90
|
|
||||||
warn: 80
|
|
@@ -1,66 +0,0 @@
|
|||||||
k9s:
|
|
||||||
body:
|
|
||||||
fgColor: "#97979b"
|
|
||||||
bgColor: "#414446"
|
|
||||||
logoColor: "#5af78e"
|
|
||||||
info:
|
|
||||||
fgColor: white
|
|
||||||
sectionColor: "#5af78e"
|
|
||||||
frame:
|
|
||||||
border:
|
|
||||||
fgColor: "#5af78e"
|
|
||||||
focusColor: "#5af78e"
|
|
||||||
menu:
|
|
||||||
fgColor: white
|
|
||||||
keyColor: "#57c7ff"
|
|
||||||
numKeyColor: "#ff6ac1"
|
|
||||||
crumbs:
|
|
||||||
fgColor: "#414446"
|
|
||||||
bgColor: white
|
|
||||||
activeColor: "#f3f99d"
|
|
||||||
status:
|
|
||||||
newColor: "#eff0eb"
|
|
||||||
modifyColor: "#5af78e"
|
|
||||||
addColor: "#57c7ff"
|
|
||||||
errorColor: "#ff5c57"
|
|
||||||
highlightcolor: "#f3f99d"
|
|
||||||
killColor: mediumpurple
|
|
||||||
completedColor: gray
|
|
||||||
title:
|
|
||||||
fgColor: "#5af78e"
|
|
||||||
bgColor: "#414446"
|
|
||||||
highlightColor: white
|
|
||||||
counterColor: white
|
|
||||||
filterColor: "#57c7ff"
|
|
||||||
views:
|
|
||||||
# Charts skins...
|
|
||||||
charts:
|
|
||||||
bgColor: default
|
|
||||||
defaultDialColors:
|
|
||||||
- "#57c7ff"
|
|
||||||
- "#ff5c57"
|
|
||||||
defaultChartColors:
|
|
||||||
- "#57c7ff"
|
|
||||||
- "#ff5c57"
|
|
||||||
table:
|
|
||||||
fgColor: "#57c7ff"
|
|
||||||
bgColor: "#414446"
|
|
||||||
cursorColor: "#5af78e"
|
|
||||||
markColor: darkgoldenrod
|
|
||||||
header:
|
|
||||||
fgColor: white
|
|
||||||
bgColor: "#414446"
|
|
||||||
sorterColor: orange
|
|
||||||
xray:
|
|
||||||
fgColor: "#57c7ff"
|
|
||||||
bgColor: "#414446"
|
|
||||||
cursorColor: "#5af78e"
|
|
||||||
graphicColor: darkgoldenrod
|
|
||||||
showIcons: false
|
|
||||||
yaml:
|
|
||||||
keyColor: "#ff5c57"
|
|
||||||
colonColor: white
|
|
||||||
valueColor: "#f3f99d"
|
|
||||||
logs:
|
|
||||||
fgColor: white
|
|
||||||
bgColor: "#414446"
|
|
9
.zshrc
9
.zshrc
@@ -1,9 +0,0 @@
|
|||||||
for filename in ~/.dotfiles/*; do
|
|
||||||
source $filename
|
|
||||||
done
|
|
||||||
|
|
||||||
for filename in ~/.additional_dotfiles/*; do
|
|
||||||
source $filename
|
|
||||||
done
|
|
||||||
|
|
||||||
eval "$(starship init zsh)"
|
|
38
Makefile
38
Makefile
@@ -1,42 +1,8 @@
|
|||||||
SHELL := bash
|
SHELL := bash
|
||||||
|
|
||||||
.PHONY: Install
|
.PHONY: Install
|
||||||
install: pre-reqs dotfiles ## Installs all dotfiles and associated.
|
install: ## Installs all dotfiles and associated.
|
||||||
|
@bash ./install.sh
|
||||||
.PHONY: pre-reqs
|
|
||||||
pre-reqs: ## Install all required binaries.
|
|
||||||
which brew > /dev/null || bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"; \
|
|
||||||
[ -d ~/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"; \
|
|
||||||
brew list --cask homebrew/cask-fonts/font-open-dyslexic-nerd-font > /dev/null || brew install homebrew/cask-fonts/font-open-dyslexic-nerd-font; \
|
|
||||||
which fzf > /dev/null || brew install fzf; \
|
|
||||||
which bat > /dev/null || brew install bat; \
|
|
||||||
which curlie > /dev/null || brew install rs/tap/curlie; \
|
|
||||||
which exa > /dev/null || brew install exa; \
|
|
||||||
which kubectl > /dev/null || brew install kubectl; \
|
|
||||||
which tkn > /dev/null || brew install tektoncd/tools/tektoncd-cli; \
|
|
||||||
which k9s > /dev/null || brew install k9s; \
|
|
||||||
which helm > /dev/null || brew install helm; \
|
|
||||||
which go > /dev/null || brew install go; \
|
|
||||||
which jq > /dev/null || brew install jq; \
|
|
||||||
which kind > /dev/null || brew install kind; \
|
|
||||||
which kubectx > /dev/null || brew install kubectx; \
|
|
||||||
which tldr > /dev/null || brew install tldr; \
|
|
||||||
which progress > /dev/null || brew install progress; \
|
|
||||||
which htop > /dev/null || brew install htop; \
|
|
||||||
which starship > /dev/null || brew install starship
|
|
||||||
|
|
||||||
.PHONY: dotfiles
|
|
||||||
dotfiles: ## Installs the dotfiles.
|
|
||||||
for file in $(shell find $(CURDIR) -name ".*" -not -name ".gitignore" -not -name ".git" -not -name ".config" -not -name ".github" -not -name ".*.swp" -not -name ".gnupg"); do \
|
|
||||||
f=$$(basename $$file); \
|
|
||||||
ln -sfn $$file $(HOME)/$$f; \
|
|
||||||
done; \
|
|
||||||
mkdir -p $(HOME)/.additional_dotfiles; touch $(HOME)/.additional_dotfiles/credentials; \
|
|
||||||
mkdir -p $(HOME)/.config; \
|
|
||||||
for file in $(shell find $(CURDIR)/.config -type f); do \
|
|
||||||
f=$$(basename $$file); \
|
|
||||||
ln -sfn $$file $(HOME)/.config/$$f; \
|
|
||||||
done;
|
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
|
2
home/.bashrc
Normal file
2
home/.bashrc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
alias date='gdate'
|
||||||
|
alias sed='gsed'
|
55
home/.bin/.utils
Normal file
55
home/.bin/.utils
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
END_CHARS="\e[0m\n"
|
||||||
|
tput colors &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
bold() {
|
||||||
|
printf "\e[1m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
italic() {
|
||||||
|
printf "\e[3m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
underline() {
|
||||||
|
printf "\e[4m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
orange() {
|
||||||
|
printf "\e[38;5;208m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
blue() {
|
||||||
|
printf "\e[38;5;75m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
green() {
|
||||||
|
printf "\e[32;5;75m$@${END_CHARS}"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bold() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
|
||||||
|
italic() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
|
||||||
|
underline() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
|
||||||
|
orange() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
|
||||||
|
blue() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
|
||||||
|
green() {
|
||||||
|
echo $@
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
_fzf() {
|
||||||
|
fzf --multi --ansi -i -1 --height=50% --reverse -0 --header-lines=1 --border --info=hidden
|
||||||
|
}
|
38
home/.bin/aws-instance-type-availability
Executable file
38
home/.bin/aws-instance-type-availability
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
REGIONS=( $(aws ec2 describe-regions --region eu-west-1 | jq -r '.Regions[].RegionName') )
|
||||||
|
INSTANCE_TYPES=()
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
orange "aws-instance-type-availability - check EC2 instance type availability in all regions"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "aws-instance-type-availability [instance type IDs]"
|
||||||
|
echo " "
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
INSTANCE_TYPES+=${1}
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
for INSTANCE in "${INSTANCE_TYPES[@]}"; do
|
||||||
|
blue "${INSTANCE} availability:"
|
||||||
|
for REGION in "${REGIONS[@]}"; do
|
||||||
|
aws ec2 describe-instance-type-offerings --filters Name=instance-type,Values=${INSTANCE} --region ${REGION} | jq -r '.InstanceTypeOfferings[0].Location | select( . != null )'
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
done
|
68
home/.bin/flux-pause
Executable file
68
home/.bin/flux-pause
Executable file
@@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VERBOSE=""
|
||||||
|
ALL=""
|
||||||
|
TARGET_RESOURCE="kustomization"
|
||||||
|
NAMESPACES="-n flux-system"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "flux-pause - Suspends Flux Kustomization resources"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "flux-pause [options] RESOURCE_NAME..."
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo " --all pause all Kustomizations"
|
||||||
|
echo "-n, --namespace the namespace resources belong in. Default: flux-system"
|
||||||
|
echo "-v --verbose show full verbose output"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
RESOURCES=()
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACES="-n $1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-v|--verbose)
|
||||||
|
VERBOSE="true"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--all)
|
||||||
|
ALL="true"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
RESOURCES+=(${1})
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${ALL}" == "true" ]]; then
|
||||||
|
RESOURCES=$(kubectl get kustomization ${NAMESPACES} -o json | jq -r '.items[] | "\( .metadata.name)"')
|
||||||
|
fi
|
||||||
|
|
||||||
|
for RESOURCE in ${RESOURCES[@]}
|
||||||
|
do
|
||||||
|
printf "Pausing '${RESOURCE}'..."
|
||||||
|
if [[ "${VERBOSE}" == "true" ]]; then
|
||||||
|
echo ""
|
||||||
|
flux suspend kustomization ${NAMESPACES} ${RESOURCE} || true
|
||||||
|
else
|
||||||
|
flux suspend kustomization ${NAMESPACES} ${RESOURCE} &> /dev/null || true
|
||||||
|
printf " ✅"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
129
home/.bin/flux-refresh
Executable file
129
home/.bin/flux-refresh
Executable file
@@ -0,0 +1,129 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VERBOSE=""
|
||||||
|
TARGET_RESOURCE="all"
|
||||||
|
NAMESPACES="-A"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "flux-refresh - Refresh all flux resources"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "flux-refresh [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-t, --type the resource type to target. Valid options: gitrepo, helmrepository, kustomization, helmrelease & all. Default: all"
|
||||||
|
echo "-n, --namespace the namespace resources belong in. Default: all namespaces"
|
||||||
|
echo " --verbose show full verbose output"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-t|--type)
|
||||||
|
shift
|
||||||
|
TARGET_RESOURCE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACES="-n $1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--verbose)
|
||||||
|
VERBOSE="true"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "gitrepo" ]]; then
|
||||||
|
GITREPOS=$(kubectl get gitrepo ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
|
||||||
|
fi
|
||||||
|
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "helmrepository" ]]; then
|
||||||
|
HELMREPOS=$(kubectl get helmrepository ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
|
||||||
|
fi
|
||||||
|
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "kustomization" ]]; then
|
||||||
|
KUSTOMIZATIONS=$(kubectl get kustomization ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
|
||||||
|
fi
|
||||||
|
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "helmrelease" ]]; then
|
||||||
|
HEALMRELEASES=$(kubectl get helmrelease ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${GITREPOS}" != "" ]]; then
|
||||||
|
blue "Refreshing GitRepositories"
|
||||||
|
for RESOURCE in ${GITREPOS}
|
||||||
|
do
|
||||||
|
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
|
||||||
|
printf "${PARTS[0]}/${PARTS[2]}"
|
||||||
|
if [[ "${VERBOSE}" == "true" ]]; then
|
||||||
|
echo ""
|
||||||
|
flux reconcile source git -n ${PARTS[0]} ${PARTS[2]} || true
|
||||||
|
else
|
||||||
|
flux reconcile source git -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
|
||||||
|
printf " ✅"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${HELMREPOS}" != "" ]]; then
|
||||||
|
blue "Refreshing HelmRepositories"
|
||||||
|
for RESOURCE in ${HELMREPOS}
|
||||||
|
do
|
||||||
|
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
|
||||||
|
printf "${PARTS[0]}/${PARTS[2]}"
|
||||||
|
if [[ "${VERBOSE}" == "true" ]]; then
|
||||||
|
echo ""
|
||||||
|
flux reconcile source helm -n ${PARTS[0]} ${PARTS[2]} || true
|
||||||
|
else
|
||||||
|
flux reconcile source helm -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
|
||||||
|
printf " ✅"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${KUSTOMIZATIONS}" != "" ]]; then
|
||||||
|
blue "Refreshing Kustomizations"
|
||||||
|
for RESOURCE in ${KUSTOMIZATIONS}
|
||||||
|
do
|
||||||
|
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
|
||||||
|
printf "${PARTS[0]}/${PARTS[2]}"
|
||||||
|
if [[ "${VERBOSE}" == "true" ]]; then
|
||||||
|
echo ""
|
||||||
|
flux reconcile kustomization -n ${PARTS[0]} ${PARTS[2]} || true
|
||||||
|
else
|
||||||
|
flux reconcile kustomization -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
|
||||||
|
printf " ✅"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${HEALMRELEASES}" != "" ]]; then
|
||||||
|
blue "Refreshing HelmReleases"
|
||||||
|
for RESOURCE in ${HEALMRELEASES}
|
||||||
|
do
|
||||||
|
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
|
||||||
|
printf "${PARTS[0]}/${PARTS[2]}"
|
||||||
|
if [[ "${VERBOSE}" == "true" ]]; then
|
||||||
|
echo ""
|
||||||
|
flux reconcile helmrelease -n ${PARTS[0]} ${PARTS[2]} || true
|
||||||
|
else
|
||||||
|
flux reconcile helmrelease -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
|
||||||
|
printf " ✅"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
fi
|
43
home/.bin/flux-resume-all
Executable file
43
home/.bin/flux-resume-all
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "flux-resume-all - Resume all flux resources"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "flux-resume-all [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
KUSTOMIZATIONS=$(kubectl get kustomization -A -o json | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
|
||||||
|
GITREPOS=$(kubectl get gitrepo -A -o json | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
|
||||||
|
|
||||||
|
if [[ "${KUSTOMIZATIONS}" == "" ]] && [[ "${GITREPOS}" == "" ]]; then
|
||||||
|
italic "Nothing to resume"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for RESOURCE in ${KUSTOMIZATIONS} ${GITREPOS}
|
||||||
|
do
|
||||||
|
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
|
||||||
|
blue "Resuming ${PARTS[1]} - ${PARTS[0]}/${PARTS[2]}"
|
||||||
|
kubectl patch ${PARTS[1]} -n ${PARTS[0]} ${PARTS[2]} -p '{"spec":{"suspend":null}}' --type merge
|
||||||
|
done
|
||||||
|
|
37
home/.bin/flux-state
Executable file
37
home/.bin/flux-state
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "flux-state - Check if any Flux resources are suspended"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "flux-state [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
blue "'kustomization' resources:"
|
||||||
|
KUSTOMIZATIONS=$(kubectl get kustomization -A -o json)
|
||||||
|
echo ${KUSTOMIZATIONS} | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .metadata.name) - ⚠️Suspended"' | column -t
|
||||||
|
echo ${KUSTOMIZATIONS} | jq -r '.items[] | select(.spec.suspend!=true) | "\(.metadata.namespace)/\( .metadata.name) - ⚡️Active"' | column -t
|
||||||
|
echo ""
|
||||||
|
blue "'gitrepo' resources:"
|
||||||
|
GITREPOS=$(kubectl get gitrepo -A -o json)
|
||||||
|
echo ${GITREPOS} | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .metadata.name) - ⚠️Suspended"' | column -t
|
||||||
|
echo ${GITREPOS} | jq -r '.items[] | select(.spec.suspend!=true) | "\(.metadata.namespace)/\( .metadata.name) - ⚡️Active"' | column -t
|
37
home/.bin/jq-test
Executable file
37
home/.bin/jq-test
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
orange "jq-test - interactively use JQ against a json file"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "jq-test [FILE]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
POS_ARGS=()
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
POS_ARGS+=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#POS_ARGS[@]} -eq 0 ]
|
||||||
|
then
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo '' | fzf --preview "jq {q} < ${POS_ARGS[@]}"
|
141
home/.bin/kind-create-cluster
Executable file
141
home/.bin/kind-create-cluster
Executable file
@@ -0,0 +1,141 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAME=""
|
||||||
|
VERSION="1.34.0@sha256:7416a61b42b1662ca6ca89f02028ac133a309a2a30ba309614e8ec94d976dc5a"
|
||||||
|
NODES="2"
|
||||||
|
FEATURE_GATES="MutatingAdmissionPolicy"
|
||||||
|
RUNTIME_CONFIG="admissionregistration.k8s.io/v1alpha1"
|
||||||
|
AUDIT_POLICY=""
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
orange "kind-create-cluster - create a Kind cluster"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kind-create-cluster [cluster-name]"
|
||||||
|
echo " "
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-v, --version the version of kubernetes to use (default: ${VERSION})"
|
||||||
|
echo "-n, --nodes the number of worker nodes (default: ${NODES})"
|
||||||
|
echo "-f, --feature-gates a comma seperated list of feature-gates to enable (default: ${FEATURE_GATES})"
|
||||||
|
echo "-r, --runtime-config a comma seperated list of API versions to enable (default: ${RUNTIME_CONFIG})"
|
||||||
|
echo " --audit-policy a file containing the audit policy config"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--nodes)
|
||||||
|
shift
|
||||||
|
NODES=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-v|--version)
|
||||||
|
shift
|
||||||
|
VERSION=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-f|--feature-gates)
|
||||||
|
shift
|
||||||
|
FEATURE_GATES=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-r|--runtime-config)
|
||||||
|
shift
|
||||||
|
RUNTIME_CONFIG=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--audit-policy)
|
||||||
|
shift
|
||||||
|
AUDIT_POLICY=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Positional args
|
||||||
|
NAME=${1:-$(LC_ALL=C tr -dc a-z </dev/urandom | head -c 10)}
|
||||||
|
|
||||||
|
function node() {
|
||||||
|
TYPE=$1
|
||||||
|
COUNT=$2
|
||||||
|
for ((i = 1 ; i <= $COUNT ; i++)); do
|
||||||
|
echo "- role: ${TYPE}"
|
||||||
|
echo " image: kindest/node:${VERSION}"
|
||||||
|
if [[ "${AUDIT_POLICY}" != "" ]]; then
|
||||||
|
if [[ "${TYPE}" == "control-plane" ]]; then
|
||||||
|
echo " kubeadmConfigPatches:"
|
||||||
|
echo " - |"
|
||||||
|
echo " kind: ClusterConfiguration"
|
||||||
|
echo " apiServer:"
|
||||||
|
echo " extraArgs:"
|
||||||
|
echo " audit-log-path: /var/log/kubernetes/kube-apiserver-audit.log"
|
||||||
|
echo " audit-policy-file: /etc/kubernetes/policies/audit-policy.yaml"
|
||||||
|
echo " extraVolumes:"
|
||||||
|
echo " - name: audit-policies"
|
||||||
|
echo " hostPath: /etc/kubernetes/policies"
|
||||||
|
echo " mountPath: /etc/kubernetes/policies"
|
||||||
|
echo " readOnly: true"
|
||||||
|
echo " pathType: "DirectoryOrCreate""
|
||||||
|
echo " - name: "audit-logs""
|
||||||
|
echo " hostPath: "/var/log/kubernetes""
|
||||||
|
echo " mountPath: "/var/log/kubernetes""
|
||||||
|
echo " readOnly: false"
|
||||||
|
echo " pathType: DirectoryOrCreate"
|
||||||
|
echo " extraMounts:"
|
||||||
|
echo " - hostPath: ${AUDIT_POLICY}"
|
||||||
|
echo " containerPath: /etc/kubernetes/policies/audit-policy.yaml"
|
||||||
|
echo " readOnly: true"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function feature-gates() {
|
||||||
|
if [[ "${FEATURE_GATES}" != "" ]]; then
|
||||||
|
echo "featureGates:"
|
||||||
|
FEATURES=(${FEATURE_GATES//,/ })
|
||||||
|
for f in "${FEATURES[@]}"; do
|
||||||
|
echo " \"${f}\": true"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function runtime-config() {
|
||||||
|
if [[ "${RUNTIME_CONFIG}" != "" ]]; then
|
||||||
|
echo "runtimeConfig:"
|
||||||
|
RUNTIME=(${RUNTIME_CONFIG//,/ })
|
||||||
|
for f in "${RUNTIME[@]}"; do
|
||||||
|
echo " \"${f}\": true"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
CONFIG="kind: Cluster
|
||||||
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
|
name: ${NAME}
|
||||||
|
nodes:
|
||||||
|
$(node "control-plane" 1)
|
||||||
|
$(node "worker" $NODES)
|
||||||
|
$(feature-gates)
|
||||||
|
$(runtime-config)
|
||||||
|
"
|
||||||
|
|
||||||
|
CONFIG_FILE=`mktemp`
|
||||||
|
|
||||||
|
echo "${CONFIG}" > ${CONFIG_FILE}
|
||||||
|
|
||||||
|
cat ${CONFIG_FILE}
|
||||||
|
|
||||||
|
kind create cluster --config ${CONFIG_FILE}
|
||||||
|
|
||||||
|
kind get kubeconfig --name ${NAME} > ~/.kube/clusters/kind.yaml
|
22
home/.bin/kind-delete-cluster
Executable file
22
home/.bin/kind-delete-cluster
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
CONTEXT_NAME=$(kubectl config current-context | sed -e "s/kind-//")
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
orange "kind-delete-cluster - delete a Kind cluster"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kind-delete-cluster [cluster-name]"
|
||||||
|
echo " "
|
||||||
|
echo "If no cluster-name is provided it will attempt to get it from the current kubectl context"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Positional args
|
||||||
|
NAME=${1:-${CONTEXT_NAME}}
|
||||||
|
|
||||||
|
kind delete cluster --name ${NAME}
|
53
home/.bin/kind-list-images
Executable file
53
home/.bin/kind-list-images
Executable file
@@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
TAG_COUNT=5
|
||||||
|
MINOR_VERSION="v1."
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
orange "kind-list-images - List latest images for use with Kind nodes"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kind-list-images [minor-version]"
|
||||||
|
echo " "
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --last-n-minors return the last n minor versions (default: ${TAG_COUNT})"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--last-n-minors)
|
||||||
|
shift
|
||||||
|
TAG_COUNT=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
MINOR_VERSION=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
TAGS=( $(crane ls kindest/node | sort | grep 'v1.' | grep -vE 'alpha|beta' | grep ${MINOR_VERSION}) )
|
||||||
|
|
||||||
|
declare -A latestMinor
|
||||||
|
|
||||||
|
for TAG in "${TAGS[@]}"; do
|
||||||
|
MINOR="${TAG%.*}"
|
||||||
|
latestMinor[$MINOR]=$TAG
|
||||||
|
done
|
||||||
|
|
||||||
|
RETURN_TAGS=( $(echo $latestMinor | tr ' ' '\n' | sort -r | head -n ${TAG_COUNT}) )
|
||||||
|
|
||||||
|
for TAG in "${RETURN_TAGS[@]}"; do
|
||||||
|
echo " - kindest/node:$(blue $TAG)@$(crane digest kindest/node:$TAG)"
|
||||||
|
done
|
63
home/.bin/kube-all
Executable file
63
home/.bin/kube-all
Executable file
@@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
LABEL=""
|
||||||
|
ALL_NAMESPACES=false
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-all - A better 'kubectl get all' - actually get all Kubernetes resources, including custom resources"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-all [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the to search in"
|
||||||
|
echo "-l, --selector the label selector to match on"
|
||||||
|
echo "-A, --all-namespaces match resources in all namespaces (default: false)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-l|--selector)
|
||||||
|
shift
|
||||||
|
LABEL=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-A|--all-namespaces)
|
||||||
|
ALL_NAMESPACES=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
NAMESPACED="--namespaced"
|
||||||
|
|
||||||
|
if [[ "${LABEL}" != "" ]]; then
|
||||||
|
LABEL="-l ${LABEL}"
|
||||||
|
NAMESPACED=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
NAMES="$(kubectl api-resources ${NAMESPACED} --verbs list -o name | tr '\n' ,)"
|
||||||
|
|
||||||
|
if [[ "$ALL_NAMESPACES" == "true" ]]; then
|
||||||
|
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -A 2>/dev/null
|
||||||
|
else
|
||||||
|
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -n ${NAMESPACE} 2>/dev/null
|
||||||
|
fi
|
62
home/.bin/kube-clean-replicasets
Executable file
62
home/.bin/kube-clean-replicasets
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
LABEL=""
|
||||||
|
ALL_NAMESPACES=false
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-clean-replicasets - Remove all olf ReplicaSets with 0 desired pods"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-clean-replicasets [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the to search in"
|
||||||
|
echo "-l, --selector the label selector to match on"
|
||||||
|
echo "-A, --all-namespaces match resources in all namespaces (default: false)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-l|--selector)
|
||||||
|
shift
|
||||||
|
LABEL=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-A|--all-namespaces)
|
||||||
|
ALL_NAMESPACES=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${LABEL}" != "" ]]; then
|
||||||
|
LABEL="-l ${LABEL}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $ALL_NAMESPACES ]; then
|
||||||
|
kubectl get replicasets --all-namespaces $LABEL -o jsonpath='{range .items[?(@.status.replicas==0)]}--namespace {@.metadata.namespace} {@.metadata.name};{end}' | \
|
||||||
|
tr ";" "\n" | \
|
||||||
|
xargs -I {} sh -c "kubectl delete rs {}"
|
||||||
|
else
|
||||||
|
kubectl get replicasets --namespace $NAMESPACE $LABEL -o jsonpath='{range .items[?(@.status.replicas==0)]}--namespace {@.metadata.namespace} {@.metadata.name};{end}' | \
|
||||||
|
tr ";" "\n" | \
|
||||||
|
xargs -I {} sh -c "kubectl delete rs {}"
|
||||||
|
fi
|
29
home/.bin/kube-count-events
Executable file
29
home/.bin/kube-count-events
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-count-events - Counts events by type"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-count-events [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
kubectl get events -A | awk '{ print $4 }' | sort | uniq -c | sort -bgr
|
61
home/.bin/kube-disable-webhook
Executable file
61
home/.bin/kube-disable-webhook
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
WEBHOOK_TYPE="mutating"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-disable-webhook - Disabled a webhook by modifying the namespace selector"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-disable-webhook [options] NAME"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-t, --type the type of webhook [mutating (default), validating]"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-t|--type)
|
||||||
|
shift
|
||||||
|
WEBHOOK_TYPE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
NAME=${1}
|
||||||
|
|
||||||
|
FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","operator":"In","values":["webhook"]}]}'
|
||||||
|
|
||||||
|
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
|
||||||
|
printf "🚫 Disabling mutating webhook ${NAME}..."
|
||||||
|
kubectl annotate mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state="$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json)" &>/dev/null
|
||||||
|
HOOKS=$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
|
||||||
|
for HOOK in ${HOOKS}
|
||||||
|
do
|
||||||
|
kubectl patch mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -p '{"webhooks": [{"name": "'${HOOK}'", '${FAKE_SELECTOR}'}]}' 1>/dev/null
|
||||||
|
done
|
||||||
|
printf " ✅ Done"
|
||||||
|
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
|
||||||
|
printf "🚫 Disabling validating webhook ${NAME}..."
|
||||||
|
kubectl annotate validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state="$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json)" &>/dev/null
|
||||||
|
HOOKS=$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
|
||||||
|
for HOOK in ${HOOKS}
|
||||||
|
do
|
||||||
|
kubectl patch validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -p '{"webhooks": [{"name": "'${HOOK}'", '${FAKE_SELECTOR}'}]}' 1>/dev/null
|
||||||
|
done
|
||||||
|
printf " ✅ Done"
|
||||||
|
else
|
||||||
|
echo "Unknown webhook type"
|
||||||
|
exit 1
|
||||||
|
fi
|
94
home/.bin/kube-empty-namespace
Executable file
94
home/.bin/kube-empty-namespace
Executable file
@@ -0,0 +1,94 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
NAMESPACE=""
|
||||||
|
CONTEXT="$(kubectl config current-context)"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-empty-namespace - Force delete all resources in the provided namespace"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-empty-namespace"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo " --context sets the context from the kubeconfig to use"
|
||||||
|
echo "-n, --namespace the namespace the resources are in (required)"
|
||||||
|
}
|
||||||
|
|
||||||
|
YOLO="0"
|
||||||
|
POS_ARGS=()
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--context)
|
||||||
|
shift
|
||||||
|
CONTEXT="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--yolo)
|
||||||
|
YOLO="1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
POS_ARGS+=(`echo $1 | tr '/' ' '`)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${NAMESPACE}" == "" ]]; then
|
||||||
|
echo "Please provide the namespace to empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
function deleteResource() {
|
||||||
|
RES="${1//.v1/}"
|
||||||
|
kubectl --context "${CONTEXT}" patch -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE} ${RES} 1>/dev/null || printf ""
|
||||||
|
kubectl --context "${CONTEXT}" delete -n ${NAMESPACE} ${RES} 2>/dev/null || printf ""
|
||||||
|
}
|
||||||
|
|
||||||
|
printf "⚠️ This could leave cloud resources undeleted if finalizers aren't honoured ⚠️\n\n"
|
||||||
|
|
||||||
|
RESOURCES=()
|
||||||
|
|
||||||
|
if [[ "${YOLO}" == 0 ]]; then
|
||||||
|
printf "Are you sure you want to force delete all resources in '${NAMESPACE}'? (y/n): "
|
||||||
|
read CONFIRM
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
orange "YOLO MODE!!! (What could go wrong?!)"
|
||||||
|
CONFIRM="y"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${CONFIRM}" = "y" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "💣 OK, I hope you know what you're doing..."
|
||||||
|
echo "Deleting all resources in namespace '${NAMESPACE}'"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
NAMES="$(kubectl --context "${CONTEXT}" api-resources --namespaced --verbs list -o name 2>/dev/null | tr '\n' ,)"
|
||||||
|
RESOURCES=$(kubectl --context "${CONTEXT}" get "${NAMES::${#NAMES}-1}" --ignore-not-found -n ${NAMESPACE} -o go-template='{{range.items}}{{.kind}}.{{.apiVersion}}/{{.metadata.name}}{{"\n"}}{{end}}' 2>/dev/null | tr '[:upper:]' '[:lower:]' | sed -r "s|/(v.+)/|/|g")
|
||||||
|
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
for RESOURCE in ${RESOURCES}
|
||||||
|
do
|
||||||
|
deleteResource ${RESOURCE}
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
65
home/.bin/kube-exec
Executable file
65
home/.bin/kube-exec
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
POD=""
|
||||||
|
CMD="sh"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-exec - execute commands within a pod"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-exec [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the pod is in"
|
||||||
|
echo "-p, --pod the name of the pod"
|
||||||
|
echo "-c, --command the command to run in the pod (default: sh)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-p|--pod)
|
||||||
|
shift
|
||||||
|
POD=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-c|--command)
|
||||||
|
shift
|
||||||
|
CMD=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "$POD" == "" ]]; then
|
||||||
|
which fzf &>/dev/null || (
|
||||||
|
echo "If no pod provided, fzf is required to select pods"
|
||||||
|
echo ""
|
||||||
|
print_usage
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
|
||||||
|
pod=($(kubectl get pods --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
|
||||||
|
POD=${pod[1]}
|
||||||
|
NAMESPACE=${pod[0]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo kubectl exec -it --namespace $NAMESPACE $POD $CMD
|
||||||
|
kubectl exec -it --namespace $NAMESPACE $POD $CMD
|
113
home/.bin/kube-force-delete
Executable file
113
home/.bin/kube-force-delete
Executable file
@@ -0,0 +1,113 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
SELECTOR=""
|
||||||
|
CONTEXT="$(kubectl config current-context)"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-force-delete - Force delete resources, even those with finalizers"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-force-delete [RESOURCE_TYPE] [RESOURCE_NAME]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo " --context sets the context from the kubeconfig to use"
|
||||||
|
echo "-n, --namespace the namespace the resource is in (default: current namespace)"
|
||||||
|
}
|
||||||
|
|
||||||
|
YOLO="0"
|
||||||
|
POS_ARGS=()
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-l|--selector)
|
||||||
|
shift
|
||||||
|
SELECTOR="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--context)
|
||||||
|
shift
|
||||||
|
CONTEXT="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--yolo)
|
||||||
|
YOLO="1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
/)
|
||||||
|
# We want to ignore slash seperators between resource types and names
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
POS_ARGS+=(`echo $1 | tr '/' ' '`)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#POS_ARGS[@]} -lt 2 ] && [[ "${SELECTOR}" == "" ]]; then
|
||||||
|
echo "Please provide the resource type and name to delete"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
function deleteResource() {
|
||||||
|
RES="${1//.v1/}"
|
||||||
|
echo "Deleting ${RES}"
|
||||||
|
kubectl --context "${CONTEXT}" patch -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE} ${RES} 1>/dev/null|| printf ""
|
||||||
|
kubectl --context "${CONTEXT}" delete -n ${NAMESPACE} ${RES} 2>/dev/null || printf ""
|
||||||
|
}
|
||||||
|
|
||||||
|
printf "⚠️ This could leave cloud resources undeleted if finalizers aren't honoured ⚠️\n\n"
|
||||||
|
|
||||||
|
RESOURCES=()
|
||||||
|
|
||||||
|
if [[ "${SELECTOR}" == "" ]]; then
|
||||||
|
printf "Are you sure you want to delete ${POS_ARGS[0]}/${POS_ARGS[1]}? (y/n): "
|
||||||
|
RESOURCES=("${POS_ARGS[0]}/${POS_ARGS[1]}")
|
||||||
|
else
|
||||||
|
printf "Are you sure you want to delete all matching '${SELECTOR}'? (y/n): "
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${YOLO}" == 0 ]]; then
|
||||||
|
read CONFIRM
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
orange "YOLO MODE!!! (What could go wrong?!)"
|
||||||
|
CONFIRM="y"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${CONFIRM}" = "y" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "💣 OK, I hope you know what you're doing..."
|
||||||
|
|
||||||
|
if [[ "${SELECTOR}" != "" ]]; then
|
||||||
|
SELECTOR="-l ${SELECTOR}"
|
||||||
|
NAMES="$(kubectl --context "${CONTEXT}" api-resources --verbs list -o name 2>/dev/null | tr '\n' ,)"
|
||||||
|
RESOURCES=$(kubectl --context "${CONTEXT}" get "${NAMES::${#NAMES}-1}" --ignore-not-found ${SELECTOR} -n ${NAMESPACE} -o go-template='{{range.items}}{{.kind}}.{{.apiVersion}}/{{.metadata.name}}{{"\n"}}{{end}}' 2>/dev/null | tr '[:upper:]' '[:lower:]' | sed -r "s|/(v.+)/|/|g")
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
for RESOURCE in ${RESOURCES}
|
||||||
|
do
|
||||||
|
deleteResource ${RESOURCE}
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
90
home/.bin/kube-forward-all
Executable file
90
home/.bin/kube-forward-all
Executable file
@@ -0,0 +1,90 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
HOST_PORT=10001
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-forward-all - create port-forwards for all pods in the given namespace"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-forward-all [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace to launch the pod in"
|
||||||
|
echo "-p, --port the port to start at (and increment from for each service) (default: 10001)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-p|--port)
|
||||||
|
shift
|
||||||
|
HOST_PORT=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Get all services first
|
||||||
|
IFS=$'\n'
|
||||||
|
SERVICES=( $(kubectl get service --namespace ${NAMESPACE} --no-headers -o json | jq '[.items[] | select(.metadata.annotations."kube-forward" != "false")] | (.[] | .metadata.name + "\t" + ([.spec.ports[].port] | join(",")))' -r | column -t) )
|
||||||
|
unset IFS
|
||||||
|
|
||||||
|
# Track the port-forwards we need to clean up
|
||||||
|
TO_KILL=()
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "\nClosing connections..."
|
||||||
|
for pid in "${TO_KILL[@]}"
|
||||||
|
do
|
||||||
|
(kill -2 $pid) &> /dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
trap - INT TERM
|
||||||
|
}
|
||||||
|
trap 'cleanup' INT TERM
|
||||||
|
|
||||||
|
echo "Forwarding..."
|
||||||
|
|
||||||
|
for s in "${SERVICES[@]}"
|
||||||
|
do
|
||||||
|
SERVICE=( $(echo $s) )
|
||||||
|
NAME=${SERVICE[0]}
|
||||||
|
PORT=${SERVICE[1]}
|
||||||
|
PORTS=($(echo $PORT | tr "," "\n"))
|
||||||
|
for PORT in "${PORTS[@]}"
|
||||||
|
do
|
||||||
|
(kubectl port-forward --namespace ${NAMESPACE} svc/$NAME $HOST_PORT:$PORT &>/dev/null) &
|
||||||
|
BG_PID=$!
|
||||||
|
|
||||||
|
if `curl -s -o /dev/null --retry 5 --retry-delay 0 --retry-connrefused -m 3 http://localhost:$HOST_PORT`
|
||||||
|
then
|
||||||
|
echo "\e[1m$NAME:$PORT\e[0m ➡ \e[34mhttp://localhost:$HOST_PORT\e[0m"
|
||||||
|
TO_KILL+=($BG_PID)
|
||||||
|
((HOST_PORT=HOST_PORT+1))
|
||||||
|
else
|
||||||
|
(kill -2 $BG_PID) &> /dev/null
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "\n\e[2m(Use [Ctl + C] to exit)"
|
||||||
|
cat
|
||||||
|
cleanup
|
65
home/.bin/kube-logs
Executable file
65
home/.bin/kube-logs
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
POD=""
|
||||||
|
ARGS=""
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-logs - tail logs from a pod"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-logs [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the pod is in"
|
||||||
|
echo "-p, --pod the name of the pod to get logs for"
|
||||||
|
echo "-a, --args additional arguments to pass to kubectl logs command"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-p|--pod)
|
||||||
|
shift
|
||||||
|
POD=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-a|--args)
|
||||||
|
shift
|
||||||
|
ARGS=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "$POD" == "" ]]; then
|
||||||
|
which fzf &>/dev/null || (
|
||||||
|
echo "If no pod provided, fzf is required to select pods"
|
||||||
|
echo ""
|
||||||
|
print_usage
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
|
||||||
|
pod=($(kubectl get pods --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
|
||||||
|
POD=${pod[1]}
|
||||||
|
NAMESPACE=${pod[0]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo kubectl logs -f $ARGS --namespace $NAMESPACE $POD
|
||||||
|
kubectl logs -f $ARGS --namespace $NAMESPACE $POD
|
51
home/.bin/kube-reenable-webhook
Executable file
51
home/.bin/kube-reenable-webhook
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
WEBHOOK_TYPE="mutating"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-reenable-webhook - Re-enable a previously disabled webhook"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-reenable-webhook [options] NAME"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-t, --type the type of webhook [mutating (default), validating]"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-t|--type)
|
||||||
|
shift
|
||||||
|
WEBHOOK_TYPE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
NAME=${1}
|
||||||
|
|
||||||
|
FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","operator":"In","values":["webhook"]}]}'
|
||||||
|
|
||||||
|
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
|
||||||
|
printf "🔌 Re-enabling mutating webhook ${NAME}..."
|
||||||
|
kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o custom-columns="prev:.metadata.annotations.previous-state" --no-headers | kubectl apply -f -
|
||||||
|
printf " ✅ Done"
|
||||||
|
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
|
||||||
|
printf "🔌 Re-enabling validating webhook ${NAME}..."
|
||||||
|
kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o custom-columns="prev:.metadata.annotations.previous-state" --no-headers | kubectl apply -f -
|
||||||
|
printf " ✅ Done"
|
||||||
|
else
|
||||||
|
echo "Unknown webhook type"
|
||||||
|
exit 1
|
||||||
|
fi
|
38
home/.bin/kube-restarting
Executable file
38
home/.bin/kube-restarting
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
NAMESPACE="-A"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-restarting - Show all pods with restarts"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-restarting [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the to search in (searches all if not set)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE="-n $1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
kubectl get pod ${NAMESPACE} -o json | jq --raw-output '.items[] | select([.status.containerStatuses[].restartCount] | add > 0) | "\( .metadata.namespace)/\( .metadata.name) \t \([.status.containerStatuses[].restartCount] | add)" ' | column -t
|
58
home/.bin/kube-schedule-anywhere
Executable file
58
home/.bin/kube-schedule-anywhere
Executable file
@@ -0,0 +1,58 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
DEPLOYMENT=""
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-schedule-anywhere - modify a deployment to schedule on any node"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-schedule-anywhere [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the pod is in"
|
||||||
|
echo "-d, --deployment the name of the deployment to modify"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-d|--deployment)
|
||||||
|
shift
|
||||||
|
DEPLOYMENT=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "$DEPLOYMENT" == "" ]]; then
|
||||||
|
which fzf &>/dev/null || (
|
||||||
|
echo "If no deployment provided, fzf is required to select deployments"
|
||||||
|
echo ""
|
||||||
|
print_usage
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
|
||||||
|
deployment=($(kubectl get deployments --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
|
||||||
|
DEPLOYMENT=${deployment[1]}
|
||||||
|
NAMESPACE=${deployment[0]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
kubectl patch deployment -n ${NAMESPACE} ${DEPLOYMENT} -p '{"spec": { "template": { "spec": { "tolerations": [ { "operator": "Exists" } ] } } } }' 1>/dev/null
|
72
home/.bin/kube-shell
Executable file
72
home/.bin/kube-shell
Executable file
@@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
POD="shell"
|
||||||
|
IMAGE="digitalocean/doks-debug"
|
||||||
|
CMD="bash"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-shell - create a new pod and exec into it's shell"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-shell [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the pod should launch in"
|
||||||
|
echo "-p, --pod the name of the pod to get logs for (default: shell)"
|
||||||
|
echo "-i, --image the image to use for the shell container (default: digitalocean/doks-debug)"
|
||||||
|
echo "-c, --command the initial command to execute in the container (default: sh)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-p|--pod)
|
||||||
|
shift
|
||||||
|
POD=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-i|--image)
|
||||||
|
shift
|
||||||
|
IMAGE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-c|--command)
|
||||||
|
shift
|
||||||
|
CMD=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
|
||||||
|
OVERRIDES='{
|
||||||
|
"spec": {
|
||||||
|
"securityContext": {"runAsGroup": 1000,"runAsNonRoot": true,"runAsUser": 1000,"seccompProfile": {"type": "RuntimeDefault"}},
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name":"'$POD'","image":"'$IMAGE'", "command": ["'$CMD'"],
|
||||||
|
"stdin": true,"stdinOnce": true,"tty": true,
|
||||||
|
"securityContext": {"allowPrivilegeEscalation": false,"capabilities": {"drop": ["ALL"]},"privileged": false,"runAsGroup": 1000,"runAsNonRoot": true,"runAsUser": 1000,"seccompProfile": {"type": "RuntimeDefault"}}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
kubectl run -it --namespace $NAMESPACE $POD --image $IMAGE --restart Never --overrides "${OVERRIDES}" --rm -- $CMD
|
80
home/.bin/kube-ssh
Executable file
80
home/.bin/kube-ssh
Executable file
@@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
POD="kube-ssh"
|
||||||
|
NODE=""
|
||||||
|
IMAGE="alpine"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-ssh - gain access to a Kubernetes host node (ssh-like for when a host doesn't have ssh)"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-ssh [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace to launch the pod in"
|
||||||
|
echo "-N, --node the name of the node to access"
|
||||||
|
echo "-i, --image the image to launch for debugging (default: alpine)"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-N|--node)
|
||||||
|
shift
|
||||||
|
NODE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-i|--image)
|
||||||
|
shift
|
||||||
|
IMAGE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "$NODE" == "" ]]; then
|
||||||
|
|
||||||
|
if [ -z "$(which fzf)" ]; then
|
||||||
|
NODES=$(kubectl get nodes --no-headers -o custom-columns=name:.metadata.name)
|
||||||
|
i=0
|
||||||
|
while read -r node; do
|
||||||
|
echo "[$i] - $node"
|
||||||
|
i=$((i+1))
|
||||||
|
done <<< "$NODES"
|
||||||
|
read -p "Which node would you like to connect to? " -r
|
||||||
|
echo ""
|
||||||
|
IFS=$'\n' NODES=($NODES)
|
||||||
|
NODE=${NODES[$REPLY]}
|
||||||
|
else
|
||||||
|
NODES=$(kubectl get nodes)
|
||||||
|
NODE=$(echo "$NODES" | _fzf | awk '{print $1}')
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
SERVER_VERSION=$(kubectl version --client=false -o json 2>/dev/null | jq -r '.serverVersion.minor')
|
||||||
|
|
||||||
|
if [ ${SERVER_VERSION} -ge 22 ]; then
|
||||||
|
kubectl debug node/${NODE} -it --image ${IMAGE}
|
||||||
|
else
|
||||||
|
NODE_NAME=$(kubectl get node $NODE -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}')
|
||||||
|
NODE_SELECTOR='"nodeSelector": { "kubernetes.io/hostname": "'${NODE_NAME}'" },'
|
||||||
|
kubectl run --namespace ${NAMESPACE} $POD --rm -it --image ${IMAGE} --privileged --overrides '{"spec":{'"${NODE_SELECTOR}"'"hostPID": true}}' --command nsenter -- --mount=/proc/1/ns/mnt -- /bin/bash
|
||||||
|
fi
|
||||||
|
|
62
home/.bin/kube-template
Executable file
62
home/.bin/kube-template
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-template - Quickly template up kubernetes resources"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-template [options] RESOURCE_KIND NAME [extra arguments]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the to search in"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE="--namespace $1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
NAME=${2}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
deployment|dp)
|
||||||
|
kubectl create ${NAMESPACE} deployment ${NAME} --image=nginx:1.21 --dry-run=client -o yaml ${@:3}
|
||||||
|
;;
|
||||||
|
ingress|in)
|
||||||
|
kubectl create ${NAMESPACE} ingress ${NAME} --dry-run=client -o yaml --rule=example.com/=my-service:web ${@:3}
|
||||||
|
;;
|
||||||
|
service|svc)
|
||||||
|
kubectl create ${NAMESPACE} service clusterip ${NAME} --dry-run=client -o yaml ${@:3}
|
||||||
|
;;
|
||||||
|
configmap|cm)
|
||||||
|
kubectl create ${NAMESPACE} configmap ${NAME} --dry-run=client -o yaml ${@:3}
|
||||||
|
;;
|
||||||
|
secret|sec)
|
||||||
|
kubectl create ${NAMESPACE} secret generic ${NAME} --dry-run=client -o yaml ${@:3}
|
||||||
|
;;
|
||||||
|
cronjob|cj)
|
||||||
|
kubectl create ${NAMESPACE} cronjob ${NAME} --image=alpine:latest --schedule="1 * * * *" --dry-run=client -o yaml ${@:3}
|
||||||
|
;;
|
||||||
|
job|jo)
|
||||||
|
kubectl create ${NAMESPACE} job ${NAME} --image=alpine:latest --dry-run=client -o yaml ${@:3}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
40
home/.bin/kube-trigger-cronjob
Executable file
40
home/.bin/kube-trigger-cronjob
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
|
||||||
|
set -e
|
||||||
|
NAMESPACE=${NAMESPACE:-default}
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "kube-trigger-cronjob - Triggers a CronJob by creating a new job based on it"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "kube-trigger-cronjob [options] CRONJOB_NAME"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace the to search in"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
NAME=${1}
|
||||||
|
|
||||||
|
kubectl create job --namespace ${NAMESPACE} ${NAME}-manual --from=cronjob/${NAME} ${@:3}
|
||||||
|
|
41
home/.bin/litractl
Executable file
41
home/.bin/litractl
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z `which hidapitester` ]; then
|
||||||
|
bold "hidapitester command not found"
|
||||||
|
echo "Download from https://github.com/todbot/hidapitester"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "litractl - Control Litra Glow"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "litractl [on / off]"
|
||||||
|
}
|
||||||
|
|
||||||
|
POS_ARGS=()
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
POS_ARGS+=(`echo $1`)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${POS_ARGS[0]}" == "on" ]]; then
|
||||||
|
italic "Turning Litra Glow on... "
|
||||||
|
hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c,0x01 &>/dev/null
|
||||||
|
elif [[ "${POS_ARGS[0]}" == "off" ]]; then
|
||||||
|
italic "Turning Litra Glow off... "
|
||||||
|
hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c &>/dev/null
|
||||||
|
else
|
||||||
|
print_usage
|
||||||
|
fi
|
82
home/.bin/renovate-prs
Executable file
82
home/.bin/renovate-prs
Executable file
@@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
RENOVATE_USER="29139614"
|
||||||
|
MERGE=false
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
blue "renovate-prs - List all Renovate PRs and batch approve"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "renovate-prs [options]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-m, --merge merge PRs after approving"
|
||||||
|
}
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-m|--merge)
|
||||||
|
shift
|
||||||
|
MERGE=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
PULLS=$(curl --silent -L -H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${GITHUB_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
"https://api.github.com/search/issues?q=is%3Apr%20is%3Aopen%20archived%3Afalse%20sort%3Aupdated-desc%20review-requested%3AAverageMarcus%20renovate" \
|
||||||
|
| jq -r -c ".items[] | select(.user.id == ${RENOVATE_USER} and .draft == false) | @base64")
|
||||||
|
|
||||||
|
if [[ "${PULLS}" == "" ]]; then
|
||||||
|
blue "No Renovate PRs pending"
|
||||||
|
else
|
||||||
|
|
||||||
|
for PR in ${PULLS}; do
|
||||||
|
PR=$(echo ${PR} | base64 -d)
|
||||||
|
NUMBER=$(echo ${PR} | jq -r '.number')
|
||||||
|
TITLE=$(echo ${PR} | jq -r '.title')
|
||||||
|
URL=$(echo ${PR} | jq -r '.pull_request.html_url')
|
||||||
|
BODY=$(echo ${PR} | jq -r '.body')
|
||||||
|
|
||||||
|
PACKAGES=""
|
||||||
|
HEADER_FOUND=false
|
||||||
|
DIVIDER_FOUND=false
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [[ "${line}" == "" ]] && [[ "${HEADER_FOUND}" == "true" ]] && [[ "${DIVIDER_FOUND}" == "true" ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${HEADER_FOUND}" == "true" ]] && [[ "${DIVIDER_FOUND}" == "true" ]]; then
|
||||||
|
line=$(echo ${line} | sed -r 's/\((.+)\)//g' | sed -r 's/(\[|\]|`)//g')
|
||||||
|
parts=(${line//|/ })
|
||||||
|
|
||||||
|
PACKAGES+=" - ${parts[0]} - ${parts[${#parts[@]}-3]]} ➡ ${parts[${#parts[@]}-1]]}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${line}" == "| Package | Type | Update | Change |" ]] || [[ "${line}" == "| Package | Update | Change |" ]]; then
|
||||||
|
HEADER_FOUND=true
|
||||||
|
fi
|
||||||
|
if [[ "${line}" == "|---|---|---|---|" ]] || [[ "${line}" == "|---|---|---|" ]]; then
|
||||||
|
DIVIDER_FOUND=true
|
||||||
|
fi
|
||||||
|
done <<< "$BODY"
|
||||||
|
|
||||||
|
bold "#${NUMBER} ${STATE} $(blue "${TITLE}")"
|
||||||
|
printf "🌐 $(underline ${URL})\n"
|
||||||
|
printf "${PACKAGES}"
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
|
fi
|
71
home/.bin/talos-upgrade
Executable file
71
home/.bin/talos-upgrade
Executable file
@@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ "${TALOSCONFIG}" == "" ]]; then
|
||||||
|
echo "You need to set TALOSCONFIG before running this"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
LATEST_RELEASE=$(curl --silent https://api.github.com/repos/siderolabs/talos/releases | jq -r '[.[] | select(.prerelease == false)] | .[0]')
|
||||||
|
TALOS_VERSION="$(jq --argjson LATEST_RELEASE "$LATEST_RELEASE" -c -n -r '$LATEST_RELEASE.tag_name')"
|
||||||
|
KUBERNETES_VERSION="$(jq --argjson LATEST_RELEASE "$LATEST_RELEASE" -c -n -r '$LATEST_RELEASE.body | match("registry.k8s.io/kube-apiserver:v([0-9\\.]+)") | .captures[0].string')"
|
||||||
|
|
||||||
|
blue "TALOS_VERSION = ${TALOS_VERSION}"
|
||||||
|
blue "KUBERNETES_VERSION = ${KUBERNETES_VERSION}"
|
||||||
|
echo ""
|
||||||
|
blue "ISO URL: https://github.com/siderolabs/talos/releases/download/${TALOS_VERSION}/metal-amd64.iso"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
kubectl cluster-info
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
printf "Continue? (y/n): "
|
||||||
|
read CONFIRM
|
||||||
|
if [[ "${CONFIRM}" != "y" ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
blue "Ensuring talosctl is up-to-date..."
|
||||||
|
brew upgrade siderolabs/tap/talosctl
|
||||||
|
|
||||||
|
CONTROL_PLANE="$(talosctl get nodetaintspec -o json | jq -r '.node')"
|
||||||
|
WORKERS=( $(talosctl get nodeips -o json | jq -r '.node | select(. != "'${CONTROL_PLANE}'")'))
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
kubectl get no -o wide
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
blue "Upgrading the control plane first..."
|
||||||
|
talosctl upgrade --image ghcr.io/siderolabs/installer:${TALOS_VERSION} --preserve=true --nodes ${CONTROL_PLANE}
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
blue "Upgrading the worker nodes..."
|
||||||
|
SLEEP="10"
|
||||||
|
for NODE in "${WORKERS[@]}"
|
||||||
|
do
|
||||||
|
talosctl upgrade --image ghcr.io/siderolabs/installer:${TALOS_VERSION} --preserve=true --nodes ${NODE}
|
||||||
|
|
||||||
|
italic "Waiting for ${SLEEP} seconds to let pods settle..."
|
||||||
|
sleep ${SLEEP}
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
kubectl get no -o wide
|
||||||
|
|
||||||
|
# Only the control plane requires the k8s version upgrading, the workers are done as part of the OS upgrade
|
||||||
|
echo ""
|
||||||
|
blue "Upgrading Kubernetes..."
|
||||||
|
talosctl upgrade-k8s --nodes ${CONTROL_PLANE} --to ${KUBERNETES_VERSION}
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
kubectl get no -o wide
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
orange "🎉 Upgrade Complete! 🎉"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
blue "ISO URL: https://github.com/siderolabs/talos/releases/download/${TALOS_VERSION}/metal-amd64.iso"
|
37
home/.bin/yq-test
Executable file
37
home/.bin/yq-test
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source .utils
|
||||||
|
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
orange "yq-test - interactively use YQ against a json file"
|
||||||
|
echo " "
|
||||||
|
underline "Usage:"
|
||||||
|
echo "yq-test [FILE]"
|
||||||
|
echo " "
|
||||||
|
underline "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
}
|
||||||
|
|
||||||
|
POS_ARGS=()
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
POS_ARGS+=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#POS_ARGS[@]} -eq 0 ]
|
||||||
|
then
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo '' | fzf --preview "yq {q} < ${POS_ARGS[@]}"
|
@@ -1,10 +1,19 @@
|
|||||||
export ZSH="$HOME/.oh-my-zsh"
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
|
||||||
plugins=(git npm docker zsh-completions)
|
plugins=(
|
||||||
autoload -U compinit && compinit
|
zsh-syntax-highlighting
|
||||||
fpath=($fpath ~/.zsh/completion)
|
)
|
||||||
|
|
||||||
|
# Use this setting if you want to disable marking untracked files under VCS as dirty.
|
||||||
|
# This makes repository status checks for large repositories much, much faster.
|
||||||
|
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||||
|
SHOW_AWS_PROMPT=false
|
||||||
|
COMPLETION_WAITING_DOTS=true
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
zstyle ':omz:update' mode reminder
|
||||||
|
|
||||||
|
source `brew --prefix switch`/switch.sh
|
||||||
|
|
||||||
# History
|
# History
|
||||||
HISTFILE="$HOME/.zsh_history"
|
HISTFILE="$HOME/.zsh_history"
|
||||||
@@ -20,9 +29,6 @@ setopt HIST_REDUCE_BLANKS
|
|||||||
setopt autocd
|
setopt autocd
|
||||||
autoload -U add-zsh-hook
|
autoload -U add-zsh-hook
|
||||||
|
|
||||||
BAT_THEME="Monokai Extended Light"
|
|
||||||
BAT_STYLE="grid,header"
|
|
||||||
|
|
||||||
DISABLE_AUTO_TITLE="true"
|
DISABLE_AUTO_TITLE="true"
|
||||||
|
|
||||||
# Override auto-title when static titles are desired ($ title My new title)
|
# Override auto-title when static titles are desired ($ title My new title)
|
||||||
@@ -31,19 +37,21 @@ title() { export TITLE_OVERRIDDEN=1; echo -en "\e]0;$*\a"}
|
|||||||
autotitle() { export TITLE_OVERRIDDEN=0 }; autotitle
|
autotitle() { export TITLE_OVERRIDDEN=0 }; autotitle
|
||||||
# Condition checking if title is overridden
|
# Condition checking if title is overridden
|
||||||
overridden() { [[ $TITLE_OVERRIDDEN == 1 ]]; }
|
overridden() { [[ $TITLE_OVERRIDDEN == 1 ]]; }
|
||||||
# Echo asterisk if git state is dirty
|
|
||||||
gitDirty() { [[ $(git status 2> /dev/null | grep -o '\w\+' | tail -n1) != ("clean"|"") ]] && echo "*" }
|
|
||||||
|
|
||||||
# Show cwd when shell prompts for input.
|
# Show cwd when shell prompts for input.
|
||||||
precmd() {
|
precmd() {
|
||||||
if overridden; then return; fi
|
if overridden; then return; fi
|
||||||
pwd=$(pwd) # Store full path as variable
|
pwd=$(pwd) # Store full path as variable
|
||||||
cwd=${pwd##*/} # Extract current working dir only
|
cwd=${pwd##*/} # Extract current working dir only
|
||||||
print -Pn "\e]0;$cwd$(gitDirty)\a" # Replace with $pwd to show full path
|
print -Pn "\e]0;$cwd\a" # Replace with $pwd to show full path
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prepend command (w/o arguments) to cwd while waiting for command to complete.
|
# Prepend command (w/o arguments) to cwd while waiting for command to complete.
|
||||||
preexec() {
|
preexec() {
|
||||||
if overridden; then return; fi
|
if overridden; then return; fi
|
||||||
printf "\033]0;%s\a" "${1%% *} | $cwd$(gitDirty)" # Omit construct from $1 to show args
|
printf "\033]0;%s\a" "${1%% *} | $cwd" # Omit construct from $1 to show args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ $(/bin/ps -ef | /usr/bin/grep "ssh-agent" | /usr/bin/grep -v "grep" | wc -l) -eq 0 ]; then
|
||||||
|
eval "$(ssh-agent -s)" > /dev/null
|
||||||
|
fi
|
147
home/.dotfiles/aliases
Normal file
147
home/.dotfiles/aliases
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
# Rename existing tools
|
||||||
|
alias _cat=`which cat`
|
||||||
|
alias _curl=`which curl`
|
||||||
|
alias _ls="/bin/ls"
|
||||||
|
alias _grep="/usr/bin/grep"
|
||||||
|
alias _diff="/usr/bin/diff"
|
||||||
|
alias _du=`which du`
|
||||||
|
alias _df=`which df`
|
||||||
|
alias _find=`which find`
|
||||||
|
alias _top=`which top`
|
||||||
|
alias _ps="/bin/ps"
|
||||||
|
alias _dig=`which dig`
|
||||||
|
alias _readlink='/usr/bin/readlink'
|
||||||
|
alias _sed='/usr/bin/sed'
|
||||||
|
alias _date='/bin/date'
|
||||||
|
alias _base64='/usr/bin/base64'
|
||||||
|
alias _git=`which git`
|
||||||
|
if command -v $(brew --prefix)/bin/git &>/dev/null; then
|
||||||
|
alias _git=$(brew --prefix)/bin/git
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Aliases
|
||||||
|
alias cat='bat '
|
||||||
|
alias curl='curlie'
|
||||||
|
alias ls='eza --group-directories-first --icons --header --git --ignore-glob=.git'
|
||||||
|
alias grep='rg'
|
||||||
|
alias diff='delta'
|
||||||
|
alias du='dust'
|
||||||
|
alias df='duf -hide special'
|
||||||
|
alias find='fd'
|
||||||
|
alias find-empty-dirs='fd --type empty --type directory'
|
||||||
|
alias bandwhich='sudo bandwhich'
|
||||||
|
alias top='btm'
|
||||||
|
alias ps='procs'
|
||||||
|
alias dig='doggo'
|
||||||
|
alias kubectx='switch'
|
||||||
|
alias kctx='switch'
|
||||||
|
alias machine-info='macchina -t Boron --bar'
|
||||||
|
alias watch='watch '
|
||||||
|
alias tmp='cd $(mktemp -d)'
|
||||||
|
|
||||||
|
# Ensure GNU version of tools are used by default (symlink so they are picked up in scripts also)
|
||||||
|
which greadlink &>/dev/null && ln -sfn `which greadlink` /usr/local/bin/readlink
|
||||||
|
which gsed &>/dev/null && ln -sfn `which gsed` /usr/local/bin/sed
|
||||||
|
which gdate &>/dev/null && ln -sfn `which gdate` /usr/local/bin/date
|
||||||
|
which gbase64 &>/dev/null && ln -sfn `which gbase64` /usr/local/bin/base64
|
||||||
|
|
||||||
|
lt() {
|
||||||
|
DEPTH=$(echo $1 | grep "^[0-9]*$")
|
||||||
|
if [ "$DEPTH" = "" ]; then
|
||||||
|
DEPTH=2
|
||||||
|
else
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
ls -l --tree -L $DEPTH -I ".git|cache|log|logs|node_modules|vendor" $@
|
||||||
|
}
|
||||||
|
|
||||||
|
git() {
|
||||||
|
if [ "$1" = "take" ]; then # Git clone then cd into new directory
|
||||||
|
if [ $# -gt 2 ]; then
|
||||||
|
_git clone ${@:2}
|
||||||
|
cd $3
|
||||||
|
else
|
||||||
|
ORG=$(echo $2 | sed -e 's|https://||' -e 's|/| |g' -e 's|:| |g' | cut -f 2 -d ' ')
|
||||||
|
REPO=$(echo $2 | sed -e 's|https://||' -e 's|/| |g' -e 's|:| |g' | cut -f 3 -d ' ' | xargs basename -s .git)
|
||||||
|
|
||||||
|
DST="${HOME}/Code/${ORG}/${REPO}"
|
||||||
|
mkdir -p ${DST}
|
||||||
|
|
||||||
|
_git clone $2 ${DST}
|
||||||
|
cd ${DST}
|
||||||
|
fi
|
||||||
|
elif [ "$1" = "commit" ]; then # Sign all commits
|
||||||
|
shift
|
||||||
|
_git commit -s $@
|
||||||
|
elif [ "$1" = "co" ]; then # Create a new branch
|
||||||
|
shift
|
||||||
|
_git checkout -b $@
|
||||||
|
elif [ "$1" = "push" ]; then # Guard against pushing to certain orgs
|
||||||
|
shift
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
remote_url=$(_git remote get-url $(git current-remote))
|
||||||
|
if [[ $remote_url == *"kubernetes/"* ]] || [[ $remote_url == *"kubernetes-sigs/"* ]]; then
|
||||||
|
echo "⚠️ Don't push directly to Kubernetes"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
_git push $@
|
||||||
|
elif [ "$1" = "release" ]; then # Create a new tag
|
||||||
|
shift
|
||||||
|
SEMVER=$1
|
||||||
|
|
||||||
|
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
||||||
|
VERSION_PARTS=($(echo $CURRENT_TAG | tr "." "\n"))
|
||||||
|
VERSION_MAJOR=${VERSION_PARTS[1]}
|
||||||
|
VERSION_MINOR=${VERSION_PARTS[2]}
|
||||||
|
VERSION_PATCH=${VERSION_PARTS[3]}
|
||||||
|
|
||||||
|
case ${SEMVER} in
|
||||||
|
patch)
|
||||||
|
VERSION_PATCH=$((VERSION_PATCH+1))
|
||||||
|
;;
|
||||||
|
|
||||||
|
minor)
|
||||||
|
VERSION_MINOR=$((VERSION_MINOR+1))
|
||||||
|
VERSION_PATCH=0
|
||||||
|
;;
|
||||||
|
|
||||||
|
major)
|
||||||
|
if [[ ${VERSION_MAJOR:0:1} == "v" ]]; then
|
||||||
|
VERSION_MAJOR="v$((VERSION_MAJOR+1))"
|
||||||
|
else
|
||||||
|
VERSION_MAJOR=$((VERSION_MAJOR+1))
|
||||||
|
fi
|
||||||
|
VERSION_MINOR=0
|
||||||
|
VERSION_PATCH=0
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unknown Semver level provided"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
NEW_VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
|
||||||
|
echo ""
|
||||||
|
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
|
||||||
|
echo "Current version ${CURRENT_TAG}"
|
||||||
|
echo " New version ${NEW_VERSION}"
|
||||||
|
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
printf "Confirm? (y/n): "
|
||||||
|
read CONFIRM
|
||||||
|
|
||||||
|
if [ "${CONFIRM}" = "y" ]; then
|
||||||
|
git tag -a -m "${NEW_VERSION}" ${NEW_VERSION}
|
||||||
|
echo "New tag created, don't forget to push to remote"
|
||||||
|
else
|
||||||
|
echo "Aborting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
_git $@
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
39
home/.dotfiles/environment
Normal file
39
home/.dotfiles/environment
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
export EDITOR='vim'
|
||||||
|
export VISUAL='code'
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
|
||||||
|
# AWS
|
||||||
|
export AWS_PAGER=""
|
||||||
|
if [ -f ~/.aws/profile ]; then
|
||||||
|
export AWS_PROFILE=$(cat ~/.aws/profile)
|
||||||
|
export AWS_DEFAULT_REGION=eu-west-1
|
||||||
|
export AWS_REGION=eu-west-1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Node
|
||||||
|
export NODE_ENV=localhost
|
||||||
|
[ -f ~/.npmrc ] && export NPM_TOKEN=`head -n 1 ~/.npmrc | sed 's~//registry.npmjs.org/:_authToken=\(.*\)~\1~'`
|
||||||
|
|
||||||
|
# Go
|
||||||
|
export GOPATH=$HOME/goworkspace
|
||||||
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
# Starship
|
||||||
|
export STARSHIP_CONFIG=~/.starship/config.toml
|
||||||
|
export STARSHIP_LOG=error
|
||||||
|
|
||||||
|
# Bat
|
||||||
|
export BAT_THEME="Monokai Extended Light"
|
||||||
|
export BAT_STYLE="grid,header"
|
||||||
|
|
||||||
|
# TZ
|
||||||
|
export TZ_LIST="Europe/Berlin;Europe/Sofia;UTC"
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
export DOCKER_HOST=$(docker context inspect --format='{{.Endpoints.docker.Host}}')
|
||||||
|
|
||||||
|
# Brew - Prevent updating all packages when installing a new one
|
||||||
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||||
|
|
||||||
|
# k9s
|
||||||
|
export K9S_CONFIG_DIR="$HOME/.k9s"
|
6
home/.dotfiles/giantswarm
Normal file
6
home/.dotfiles/giantswarm
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Giant Swarm utils
|
||||||
|
which opsctl &>/dev/null && screen -dm bash -c 'opsctl version update'
|
||||||
|
which devctl &>/dev/null && screen -dm bash -c 'devctl version update'
|
||||||
|
which kubectl-gs &>/dev/null && screen -dm bash -c 'kubectl-gs selfupdate'
|
||||||
|
which opsctl &>/dev/null && opsctl completion zsh > /usr/local/share/zsh/site-functions/_opsctl
|
||||||
|
which devctl &>/dev/null && devctl completion zsh > /usr/local/share/zsh/site-functions/_devctl
|
11
home/.dotfiles/kubernetes
Normal file
11
home/.dotfiles/kubernetes
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
alias k='kubectl '
|
||||||
|
alias kx='kube-exec '
|
||||||
|
alias kl='kube-logs '
|
||||||
|
alias kshell='kube-shell '
|
||||||
|
alias kall='kube-all '
|
||||||
|
alias fix-broken-replicasets='kube-clean-replicasets '
|
||||||
|
alias kube-forward='kube-forward-all '
|
||||||
|
|
||||||
|
source <(kubectl completion zsh)
|
||||||
|
source <(tkn completion zsh)
|
||||||
|
|
2
home/.dotfiles/network
Normal file
2
home/.dotfiles/network
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Ensure local dnsmasq is used for DNS
|
||||||
|
which networksetup &>/dev/null && networksetup -setdnsservers Wi-Fi 127.0.0.1
|
69
home/.gitconfig
Normal file
69
home/.gitconfig
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
[user]
|
||||||
|
name = Marcus Noble
|
||||||
|
email = github@marcusnoble.co.uk
|
||||||
|
signingkey = B8F2DB8A7AEBAF78
|
||||||
|
|
||||||
|
[commit]
|
||||||
|
gpgsign = true
|
||||||
|
|
||||||
|
[core]
|
||||||
|
editor = /usr/bin/vim
|
||||||
|
excludesfile = ~/.gitignore
|
||||||
|
|
||||||
|
[pager]
|
||||||
|
diff = delta
|
||||||
|
log = delta
|
||||||
|
reflog = delta
|
||||||
|
show = delta
|
||||||
|
|
||||||
|
[delta]
|
||||||
|
line-numbers = true
|
||||||
|
side-by-side = true
|
||||||
|
|
||||||
|
[push]
|
||||||
|
default = simple
|
||||||
|
followTags = true
|
||||||
|
|
||||||
|
[init]
|
||||||
|
defaultBranch = main
|
||||||
|
|
||||||
|
[credential]
|
||||||
|
helper = store
|
||||||
|
|
||||||
|
[color]
|
||||||
|
ui = true
|
||||||
|
[color "diff"]
|
||||||
|
old = red strike
|
||||||
|
new = green italic
|
||||||
|
|
||||||
|
[alias]
|
||||||
|
basename = "!git remote -v | head -n1 | awk '{print $2}' | sed 's/.*\\///' | sed 's/\\.git//'"
|
||||||
|
remote-base-url = "!git remote get-url $(git fork-or-origin) | tr ':' '/' | sed 's|ssh///git@|https://|' | sed 's|git@|https://|' | sed 's|\\.git|/|'"
|
||||||
|
org-name = "!git remote -v | grep -m 1 -o ':.*/' | sed 's:^.\\(.*\\).$:\\1:'"
|
||||||
|
branch-name = "!git rev-parse --abbrev-ref HEAD"
|
||||||
|
changelog-changed = "!test $(git diff --name-only HEAD origin/$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') | grep CHANGELOG.md | wc -l | xargs) = 1"
|
||||||
|
main-branch = "!git remote show origin 2>/dev/null | grep HEAD | sed 's/.* //'"
|
||||||
|
fork-or-origin = "!func(){ $(git remote show fork &>/dev/null); if [[ $? == 0 ]]; then echo \"fork\" ; else echo \"origin\"; fi; }; func"
|
||||||
|
main = "!git remote set-head origin --auto && git checkout $(git main-branch) && git pull"
|
||||||
|
pr-link = "!echo \"$(git remote-base-url)compare/$(git main-branch)...$(git branch-name)?expand=1\""
|
||||||
|
publish = "!func(){ if [[ $(git branch-name) != \"$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\" ]]; then git push -u $(git fork-or-origin) $(git branch-name) && (git changelog-changed || echo '\n\n⚠️ Dont forget to update changelog ⚠️ ') && (echo '\n\n'; git pr-link) ; else echo "Wat?!"; fi; }; func"
|
||||||
|
cleanup = "!git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done"
|
||||||
|
dont-change-file = "!git update-index --assume-unchanged"
|
||||||
|
ignore-file = "!git update-index --skip-worktree"
|
||||||
|
remember-file = "!git update-index --no-skip-worktree"
|
||||||
|
logg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
|
||||||
|
dif = "!git diff -w"
|
||||||
|
pop = "!git stash pop"
|
||||||
|
current-remote = "!func(){ REMOTE=$(git rev-parse --abbrev-ref @{u}) ; echo ${REMOTE%/*} ; }; func"
|
||||||
|
[help]
|
||||||
|
autocorrect = 1
|
||||||
|
|
||||||
|
[diff]
|
||||||
|
compactionHeuristic = true
|
||||||
|
|
||||||
|
[url "ssh://git@github.com"]
|
||||||
|
insteadOf = https://github.com
|
||||||
|
[pull]
|
||||||
|
rebase = false
|
||||||
|
[gpg]
|
||||||
|
program = /opt/homebrew/bin/gpg
|
9
home/.k9s/aliases.yaml
Normal file
9
home/.k9s/aliases.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
aliases:
|
||||||
|
dp: deployments
|
||||||
|
sec: v1/secrets
|
||||||
|
jo: jobs
|
||||||
|
cr: clusterroles
|
||||||
|
crb: clusterrolebindings
|
||||||
|
ro: roles
|
||||||
|
rb: rolebindings
|
||||||
|
np: networkpolicies
|
42
home/.k9s/config.yaml
Normal file
42
home/.k9s/config.yaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
k9s:
|
||||||
|
liveViewAutoRefresh: false
|
||||||
|
refreshRate: 2
|
||||||
|
maxConnRetry: 5
|
||||||
|
readOnly: false
|
||||||
|
noExitOnCtrlC: false
|
||||||
|
ui:
|
||||||
|
enableMouse: false
|
||||||
|
headless: false
|
||||||
|
logoless: true
|
||||||
|
crumbsless: false
|
||||||
|
reactive: true
|
||||||
|
noIcons: false
|
||||||
|
skin: default
|
||||||
|
skipLatestRevCheck: false
|
||||||
|
disablePodCounting: false
|
||||||
|
shellPod:
|
||||||
|
image: busybox:1.35.0
|
||||||
|
namespace: default
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 100Mi
|
||||||
|
tty: true
|
||||||
|
imageScans:
|
||||||
|
enable: false
|
||||||
|
exclusions:
|
||||||
|
namespaces: []
|
||||||
|
labels: {}
|
||||||
|
logger:
|
||||||
|
tail: 5000
|
||||||
|
buffer: 50000
|
||||||
|
sinceSeconds: 0
|
||||||
|
fullScreen: false
|
||||||
|
textWrap: false
|
||||||
|
showTime: false
|
||||||
|
thresholds:
|
||||||
|
cpu:
|
||||||
|
critical: 90
|
||||||
|
warn: 80
|
||||||
|
memory:
|
||||||
|
critical: 90
|
||||||
|
warn: 80
|
154
home/.k9s/plugins.yaml
Normal file
154
home/.k9s/plugins.yaml
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
plugins:
|
||||||
|
# kubectl-blame by knight42
|
||||||
|
# Annotate each line in the given resource's YAML with information from the managedFields to show who last modified the field.
|
||||||
|
# Source: https://github.com/knight42/kubectl-blame
|
||||||
|
# Install via:
|
||||||
|
# krew: `kubectl krew install blame`
|
||||||
|
# go: `go install github.com/knight42/kubectl-blame@latest`
|
||||||
|
blame:
|
||||||
|
shortCut: b
|
||||||
|
confirm: false
|
||||||
|
description: "Blame"
|
||||||
|
scopes:
|
||||||
|
- all
|
||||||
|
command: sh
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- "kubectl-blame $RESOURCE_NAME $NAME -n $NAMESPACE --context $CONTEXT | less"
|
||||||
|
|
||||||
|
# Suspends/Resumes a cronjob
|
||||||
|
toggleCronjob:
|
||||||
|
shortCut: Shift-S
|
||||||
|
confirm: true
|
||||||
|
scopes:
|
||||||
|
- cj
|
||||||
|
description: Toggle to suspend or resume a running cronjob
|
||||||
|
command: kubectl
|
||||||
|
background: true
|
||||||
|
args:
|
||||||
|
- patch
|
||||||
|
- cronjobs
|
||||||
|
- $NAME
|
||||||
|
- -n
|
||||||
|
- $NAMESPACE
|
||||||
|
- --context
|
||||||
|
- $CONTEXT
|
||||||
|
- -p
|
||||||
|
- '{"spec" : {"suspend" : $!COL-SUSPEND }}'
|
||||||
|
|
||||||
|
# Flux
|
||||||
|
reconcile-git:
|
||||||
|
shortCut: Shift-R
|
||||||
|
confirm: false
|
||||||
|
description: Flux reconcile
|
||||||
|
scopes:
|
||||||
|
- gitrepositories
|
||||||
|
command: bash
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- >-
|
||||||
|
flux
|
||||||
|
reconcile source git
|
||||||
|
--context $CONTEXT
|
||||||
|
-n $NAMESPACE $NAME
|
||||||
|
| less -K
|
||||||
|
reconcile-hr:
|
||||||
|
shortCut: Shift-R
|
||||||
|
confirm: false
|
||||||
|
description: Flux reconcile
|
||||||
|
scopes:
|
||||||
|
- helmreleases
|
||||||
|
command: bash
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- >-
|
||||||
|
flux
|
||||||
|
reconcile helmrelease
|
||||||
|
--context $CONTEXT
|
||||||
|
-n $NAMESPACE $NAME
|
||||||
|
| less -K
|
||||||
|
reconcile-helm-repo:
|
||||||
|
shortCut: Shift-R
|
||||||
|
description: Flux reconcile
|
||||||
|
scopes:
|
||||||
|
- helmrepositories
|
||||||
|
command: bash
|
||||||
|
background: false
|
||||||
|
confirm: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- >-
|
||||||
|
flux
|
||||||
|
reconcile source helm
|
||||||
|
--context $CONTEXT
|
||||||
|
-n $NAMESPACE $NAME
|
||||||
|
| less -K
|
||||||
|
reconcile-oci-repo:
|
||||||
|
shortCut: Shift-R
|
||||||
|
description: Flux reconcile
|
||||||
|
scopes:
|
||||||
|
- ocirepositories
|
||||||
|
command: bash
|
||||||
|
background: false
|
||||||
|
confirm: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- >-
|
||||||
|
flux
|
||||||
|
reconcile source oci
|
||||||
|
--context $CONTEXT
|
||||||
|
-n $NAMESPACE $NAME
|
||||||
|
| less -K
|
||||||
|
reconcile-ks:
|
||||||
|
shortCut: Shift-R
|
||||||
|
confirm: false
|
||||||
|
description: Flux reconcile
|
||||||
|
scopes:
|
||||||
|
- kustomizations
|
||||||
|
command: bash
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- >-
|
||||||
|
flux
|
||||||
|
reconcile kustomization
|
||||||
|
--context $CONTEXT
|
||||||
|
-n $NAMESPACE $NAME
|
||||||
|
| less -K
|
||||||
|
|
||||||
|
remove_finalizers:
|
||||||
|
shortCut: Ctrl-F
|
||||||
|
confirm: true
|
||||||
|
scopes:
|
||||||
|
- all
|
||||||
|
description: |
|
||||||
|
Removes all finalizers
|
||||||
|
command: kubectl
|
||||||
|
background: true
|
||||||
|
args:
|
||||||
|
- patch
|
||||||
|
- --context
|
||||||
|
- $CONTEXT
|
||||||
|
- --namespace
|
||||||
|
- $NAMESPACE
|
||||||
|
- $RESOURCE_NAME.$RESOURCE_GROUP
|
||||||
|
- $NAME
|
||||||
|
- -p
|
||||||
|
- '{"metadata":{"finalizers":null}}'
|
||||||
|
- --type
|
||||||
|
- merge
|
||||||
|
|
||||||
|
watch-events:
|
||||||
|
shortCut: Shift-E
|
||||||
|
confirm: false
|
||||||
|
description: Watch Events
|
||||||
|
scopes:
|
||||||
|
- all
|
||||||
|
command: sh
|
||||||
|
background: false
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- "kubectl events --context $CONTEXT --namespace $NAMESPACE --for $RESOURCE_NAME.$RESOURCE_GROUP/$NAME --watch"
|
75
home/.k9s/skins/default.yml
Normal file
75
home/.k9s/skins/default.yml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# Base16 Material - k9s color config
|
||||||
|
# Scheme author: Nate Peterson
|
||||||
|
# Template author: Jef LeCompte (https://jef.buzz)
|
||||||
|
k9s:
|
||||||
|
# General K9s styles
|
||||||
|
body:
|
||||||
|
fgColor: '#eeffff'
|
||||||
|
bgColor: '#263238'
|
||||||
|
logoColor: '#89ddff'
|
||||||
|
|
||||||
|
# ClusterInfoView styles
|
||||||
|
info:
|
||||||
|
fgColor: '#c3e88d'
|
||||||
|
sectionColor: '#eeffff'
|
||||||
|
|
||||||
|
# Frame styles
|
||||||
|
frame:
|
||||||
|
# Borders styles
|
||||||
|
border:
|
||||||
|
fgColor: '#82aaff'
|
||||||
|
focusColor: '#89ddff'
|
||||||
|
|
||||||
|
# MenuView attributes and styles
|
||||||
|
menu:
|
||||||
|
fgColor: '#eeffff'
|
||||||
|
keyColor: '#c3e88d'
|
||||||
|
# Used for favorite namespaces
|
||||||
|
numKeyColor: '#c3e88d'
|
||||||
|
|
||||||
|
# CrumbView attributes for history navigation.
|
||||||
|
crumbs:
|
||||||
|
fgColor: '#89ddff'
|
||||||
|
bgColor: '#263238'
|
||||||
|
activeColor: '#263238'
|
||||||
|
|
||||||
|
# Resource status and update styles
|
||||||
|
status:
|
||||||
|
newColor: '#eeffff'
|
||||||
|
modifyColor: '#ffcb6b'
|
||||||
|
addColor: '#c3e88d'
|
||||||
|
errorColor: '#f07178'
|
||||||
|
highlightcolor: '#89ddff'
|
||||||
|
killColor: '#f07178'
|
||||||
|
completedColor: '#c3e88d'
|
||||||
|
|
||||||
|
# Border title styles.
|
||||||
|
title:
|
||||||
|
fgColor: '#eeffff'
|
||||||
|
bgColor: '#263238'
|
||||||
|
highlightColor: '#c792ea'
|
||||||
|
counterColor: '#c792ea'
|
||||||
|
filterColor: '#c792ea'
|
||||||
|
# Specific views styles
|
||||||
|
views:
|
||||||
|
# TableView attributes.
|
||||||
|
table:
|
||||||
|
fgColor: '#82aaff'
|
||||||
|
bgColor: '#263238'
|
||||||
|
cursorColor: '#89ddff'
|
||||||
|
# Header row styles.
|
||||||
|
header:
|
||||||
|
fgColor: '#82aaff'
|
||||||
|
bgColor: '#263238'
|
||||||
|
sorterColor: '#c792ea'
|
||||||
|
|
||||||
|
# YAML info styles.
|
||||||
|
yaml:
|
||||||
|
keyColor: '#f07178'
|
||||||
|
colonColor: '#89ddff'
|
||||||
|
valueColor: '#eeffff'
|
||||||
|
|
||||||
|
# Logs styles.
|
||||||
|
logs:
|
||||||
|
fgColor: '#eeffff'
|
||||||
|
bgColor: '#263238'
|
0
home/.kube/clusters/.gitkeep
Normal file
0
home/.kube/clusters/.gitkeep
Normal file
8
home/.kube/switch-config.yaml
Normal file
8
home/.kube/switch-config.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
kind: SwitchConfig
|
||||||
|
version: v1alpha1
|
||||||
|
kubeconfigName: "*.yaml"
|
||||||
|
kubeconfigStores:
|
||||||
|
- kind: filesystem
|
||||||
|
kubeconfigName: "*.yaml"
|
||||||
|
paths:
|
||||||
|
- ~/.kube/clusters/
|
4
home/.macchina/config.toml
Normal file
4
home/.macchina/config.toml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
long_uptime = true
|
||||||
|
long_shell = true
|
||||||
|
physical_cores = true
|
||||||
|
show = [ "Host", "Machine", "OperatingSystem", "Terminal", "Shell", "Uptime" ]
|
44
home/.macchina/theme.toml
Normal file
44
home/.macchina/theme.toml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
hide_ascii = true
|
||||||
|
spacing = 1
|
||||||
|
padding = 0
|
||||||
|
separator = "❯"
|
||||||
|
key_color = "Cyan"
|
||||||
|
separator_color = "LightMagenta"
|
||||||
|
|
||||||
|
[bar]
|
||||||
|
glyph = "⭘"
|
||||||
|
symbol_open = ""
|
||||||
|
symbol_close = ""
|
||||||
|
visible = true
|
||||||
|
|
||||||
|
[box]
|
||||||
|
title = " Info "
|
||||||
|
border = "double"
|
||||||
|
visible = true
|
||||||
|
|
||||||
|
[box.inner_margin]
|
||||||
|
x = 1
|
||||||
|
y = 0
|
||||||
|
|
||||||
|
[randomize]
|
||||||
|
key_color = false
|
||||||
|
separator_color = false
|
||||||
|
|
||||||
|
[keys]
|
||||||
|
host = "Host"
|
||||||
|
kernel = "Kernel"
|
||||||
|
battery = "Battery"
|
||||||
|
os = "OS"
|
||||||
|
distro = "Distro"
|
||||||
|
terminal = "Terminal"
|
||||||
|
shell = "Shell"
|
||||||
|
packages = "Packages"
|
||||||
|
uptime = "Uptime"
|
||||||
|
memory = "Memory"
|
||||||
|
machine = "Machine"
|
||||||
|
local_ip = "IP"
|
||||||
|
backlight = "Brightness"
|
||||||
|
resolution = "Resolution"
|
||||||
|
cpu_load = "CPU Load"
|
||||||
|
cpu = "CPU"
|
93
home/.starship/config.toml
Normal file
93
home/.starship/config.toml
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
format = """\
|
||||||
|
$status\
|
||||||
|
$cmd_duration\
|
||||||
|
$hostname\
|
||||||
|
$directory\
|
||||||
|
$git_branch\
|
||||||
|
$git_commit\
|
||||||
|
$git_state\
|
||||||
|
$git_status\
|
||||||
|
$kubernetes\
|
||||||
|
$helm\
|
||||||
|
$golang\
|
||||||
|
$nodejs\
|
||||||
|
$terraform\
|
||||||
|
$package\
|
||||||
|
$custom\
|
||||||
|
$time\
|
||||||
|
$line_break\
|
||||||
|
$jobs\
|
||||||
|
$character\
|
||||||
|
"""
|
||||||
|
|
||||||
|
command_timeout = 1000
|
||||||
|
add_newline = true
|
||||||
|
|
||||||
|
[hostname]
|
||||||
|
ssh_only = true
|
||||||
|
format = "🌐 [$hostname](bold dimmed blue) \n"
|
||||||
|
disabled = false
|
||||||
|
|
||||||
|
[directory]
|
||||||
|
format = "┏ [$path]($style)[$read_only]($read_only_style) "
|
||||||
|
|
||||||
|
[character]
|
||||||
|
success_symbol = "┗ [✨](yellow)"
|
||||||
|
error_symbol = "┗ [✗](fg:204)"
|
||||||
|
|
||||||
|
[git_branch]
|
||||||
|
format = "⎮ [$symbol$branch]($style) "
|
||||||
|
symbol = "🌱 "
|
||||||
|
|
||||||
|
[git_commit]
|
||||||
|
only_detached = true
|
||||||
|
|
||||||
|
[git_status]
|
||||||
|
format = '\($all_status$ahead_behind\) '
|
||||||
|
up_to_date = "[✓](green)"
|
||||||
|
modified = "[!](bold fg:208)"
|
||||||
|
untracked = "[?](bold fg:75)"
|
||||||
|
staged = '[++\($count\)](green)'
|
||||||
|
|
||||||
|
[aws]
|
||||||
|
symbol = " "
|
||||||
|
format = "⎮ [$symbol$profile]($style) "
|
||||||
|
|
||||||
|
[golang]
|
||||||
|
symbol = " "
|
||||||
|
format = "⎮ [$symbol$version](fg:45) "
|
||||||
|
|
||||||
|
[kubernetes]
|
||||||
|
format = '⎮ [$symbol$context (\($namespace\))]($style) '
|
||||||
|
symbol = "ﴱ "
|
||||||
|
style = "bold blue"
|
||||||
|
disabled = false
|
||||||
|
[kubernetes.context_aliases]
|
||||||
|
"gs-(?P<cluster>.+)" = "$cluster [MC]"
|
||||||
|
|
||||||
|
[terraform]
|
||||||
|
format = "⎮ [$symbol$version]($style) "
|
||||||
|
|
||||||
|
[nodejs]
|
||||||
|
symbol = " "
|
||||||
|
|
||||||
|
[status]
|
||||||
|
symbol = "✗"
|
||||||
|
format = "[↪ $symbol $common_meaning$signal_name$maybe_int](fg:204)\n"
|
||||||
|
map_symbol = true
|
||||||
|
disabled = false
|
||||||
|
|
||||||
|
[helm]
|
||||||
|
format = "⎮ [$symbol$version]($style) "
|
||||||
|
symbol = " "
|
||||||
|
|
||||||
|
[cmd_duration]
|
||||||
|
format = " took [$duration]($style) \n"
|
||||||
|
|
||||||
|
[package]
|
||||||
|
symbol = "📦"
|
||||||
|
format = "⎮ [$symbol$version]($style) "
|
||||||
|
|
||||||
|
[jobs]
|
||||||
|
number_threshold = 1
|
||||||
|
format = "┣ [$symbol $number background jobs\n]($style)"
|
92
home/.vim/colors/tickle-contrast.vim
Normal file
92
home/.vim/colors/tickle-contrast.vim
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
"########################################
|
||||||
|
"########################################
|
||||||
|
" Tickle Contrast (rainglow)
|
||||||
|
"
|
||||||
|
" https://github.com/rainglow/vim
|
||||||
|
"
|
||||||
|
" Copyright (c) Dayle Rees.
|
||||||
|
"########################################
|
||||||
|
"########################################
|
||||||
|
|
||||||
|
|
||||||
|
"########################################
|
||||||
|
"# Settings. #
|
||||||
|
"########################################
|
||||||
|
|
||||||
|
set background=dark
|
||||||
|
highlight clear
|
||||||
|
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:colors_name = "tickle-contrast"
|
||||||
|
|
||||||
|
"########################################
|
||||||
|
"# Base Colors. #
|
||||||
|
"########################################
|
||||||
|
|
||||||
|
hi Cursor guifg=#181819 guibg=#f8f8f0 gui=NONE
|
||||||
|
hi Visual guifg=#85ffc7 guibg=#ffffff gui=NONE
|
||||||
|
hi CursorLine guifg=NONE guibg=#1f1f21 gui=NONE
|
||||||
|
hi CursorLineNr guifg=#636367 guibg=#060607 gui=NONE
|
||||||
|
hi CursorColumn guifg=NONE guibg=#060607 gui=NONE
|
||||||
|
hi ColorColumn guifg=NONE guibg=#000000 gui=NONE
|
||||||
|
hi LineNr guifg=#313133 guibg=#0b0b0c gui=NONE
|
||||||
|
hi VertSplit guifg=#313133 guibg=#313133 gui=NONE
|
||||||
|
hi MatchParen guifg=#40a5a5 guibg=NONE gui=underline
|
||||||
|
hi StatusLine guifg=#c1c1c1 guibg=#0b0b0c gui=bold
|
||||||
|
hi StatusLineNC guifg=#c1c1c1 guibg=#0b0b0c gui=NONE
|
||||||
|
hi Pmenu guifg=#c1c1c1 guibg=#0b0b0c gui=NONE
|
||||||
|
hi PmenuSel guifg=NONE guibg=#85ffc7 gui=NONE
|
||||||
|
hi IncSearch guifg=#c1c1c1 guibg=#afd1d1 gui=NONE
|
||||||
|
hi Search guifg=NONE guibg=NONE gui=underline
|
||||||
|
hi Directory guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
hi Folded guifg=#b4b4b4 guibg=#000000 gui=NONE
|
||||||
|
hi Normal guifg=#ff8552 guibg=#181819 gui=NONE
|
||||||
|
hi Boolean guifg=#ff8552 guibg=NONE gui=NONE
|
||||||
|
hi Character guifg=#86baba guibg=NONE gui=NONE
|
||||||
|
hi Comment guifg=#606063 guibg=NONE gui=NONE
|
||||||
|
hi Conditional guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
hi Constant guifg=NONE guibg=NONE gui=NONE
|
||||||
|
hi Define guifg=#85FFC7 guibg=NONE gui=NONE
|
||||||
|
hi DiffAdd guifg=#3d3d40 guibg=#a7da1e gui=bold
|
||||||
|
hi DiffDelete guifg=#3d3d40 guibg=#e61f44 gui=NONE
|
||||||
|
hi DiffChange guifg=#3d3d40 guibg=#f7b83d gui=NONE
|
||||||
|
hi DiffText guifg=#3d3d40 guibg=#f7b83d gui=bold
|
||||||
|
hi ErrorMsg guifg=#3d3d40 guibg=#e61f44 gui=NONE
|
||||||
|
hi WarningMsg guifg=#3d3d40 guibg=#f7b83d gui=NONE
|
||||||
|
hi Float guifg=#afd1d1 guibg=NONE gui=NONE
|
||||||
|
hi Function guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
hi Identifier guifg=#ffffff guibg=NONE gui=NONE
|
||||||
|
hi Keyword guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
hi Label guifg=#86baba guibg=NONE gui=NONE
|
||||||
|
hi NonText guifg=#5b5b5b guibg=#131314 gui=NONE
|
||||||
|
hi Number guifg=#afd1d1 guibg=NONE gui=NONE
|
||||||
|
hi Operator guifg=#c1c1c1 guibg=NONE gui=NONE
|
||||||
|
hi PreProc guifg=#86868a guibg=NONE gui=NONE
|
||||||
|
hi Special guifg=#c1c1c1 guibg=NONE gui=NONE
|
||||||
|
hi SpecialKey guifg=#c1c1c1 guibg=#85ffc7 gui=NONE
|
||||||
|
hi Statement guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
hi StorageClass guifg=#40a5a5 guibg=NONE gui=NONE
|
||||||
|
hi String guifg=#86baba guibg=NONE gui=NONE
|
||||||
|
hi Tag guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
hi Title guifg=#85ffc7 guibg=NONE gui=bold
|
||||||
|
hi Todo guifg=#86868a guibg=NONE gui=inverse,bold
|
||||||
|
hi Type guifg=NONE guibg=NONE gui=NONE
|
||||||
|
hi Underlined guifg=NONE guibg=NONE gui=underline
|
||||||
|
|
||||||
|
"########################################
|
||||||
|
"# Language Overrides #
|
||||||
|
"########################################
|
||||||
|
|
||||||
|
hi phpIdentifier guifg=#ffffff
|
||||||
|
hi phpMethodsVar guifg=#cacacc
|
||||||
|
hi xmlTag guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
hi xmlTagName guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
hi xmlEndTag guifg=#85ffc7 guibg=NONE gui=NONE
|
||||||
|
|
||||||
|
"########################################
|
||||||
|
"# Light Theme Overrides #
|
||||||
|
"########################################
|
||||||
|
|
6
home/.vimrc
Normal file
6
home/.vimrc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
colorscheme tickle-contrast
|
||||||
|
set paste
|
||||||
|
set number
|
||||||
|
set linespace=3
|
||||||
|
set cursorline
|
||||||
|
syntax on
|
37
home/.zshrc
Normal file
37
home/.zshrc
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
DISABLE_AUTO_UPDATE="true"
|
||||||
|
|
||||||
|
PATH_DIRS=(
|
||||||
|
"${HOME}/.bin"
|
||||||
|
"${KREW_ROOT:-${HOME}/.krew}/bin"
|
||||||
|
"${GOPATH:-${HOME}/goworkspace}/bin"
|
||||||
|
"${HOME}/.cargo/bin"
|
||||||
|
"/home/linuxbrew/.linuxbrew/bin"
|
||||||
|
"/opt/homebrew/bin/"
|
||||||
|
"${HOME}/Library/Python/3.11/bin"
|
||||||
|
"/usr/local/bin"
|
||||||
|
"/usr/bin"
|
||||||
|
"/bin"
|
||||||
|
"/usr/sbin"
|
||||||
|
"/sbin"
|
||||||
|
"${PATH}"
|
||||||
|
)
|
||||||
|
export PATH=${"${PATH_DIRS[*]}"// /:}
|
||||||
|
export FPATH="$FPATH:/opt/homebrew/share/zsh/site-functions"
|
||||||
|
|
||||||
|
if [ ! -z ~/.additional_dotfiles/credentials ]; then
|
||||||
|
source ~/.additional_dotfiles/credentials
|
||||||
|
fi
|
||||||
|
|
||||||
|
for filename in ~/.dotfiles/*; do
|
||||||
|
source $filename
|
||||||
|
done
|
||||||
|
|
||||||
|
for filename in ~/.additional_dotfiles/*; do
|
||||||
|
source $filename
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f ~/.zcompdump; compinit
|
||||||
|
|
||||||
|
eval "$(starship init zsh)"
|
||||||
|
|
||||||
|
macchina --config ~/.macchina/config.toml --theme ~/.macchina/theme
|
254
install.sh
Executable file
254
install.sh
Executable file
@@ -0,0 +1,254 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
export PATH="/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin/:$PATH"
|
||||||
|
|
||||||
|
[ -d ~/.additional_dotfiles ] || (mkdir -p ~/.additional_dotfiles && touch ~/.additional_dotfiles/credentials)
|
||||||
|
[ -d /usr/local/share/zsh/site-functions ] || (sudo mkdir -p /usr/local/share/zsh/site-functions && sudo chmod 777 /usr/local/share/zsh/site-functions)
|
||||||
|
|
||||||
|
# Install homebrew
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Installing homebrew"
|
||||||
|
which brew >/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
echo "✅"
|
||||||
|
|
||||||
|
# Install oh-my-zsh
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Setting up zsh"
|
||||||
|
printf "Cloning oh-my-zsh..."
|
||||||
|
[ -d ${HOME}/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||||
|
printf " ✅\n"
|
||||||
|
# Install ZSH plugins
|
||||||
|
printf "Cloning zsh plugins..."
|
||||||
|
[ -d ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ] || git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
||||||
|
[ -d ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
|
||||||
|
printf " ✅\n"
|
||||||
|
|
||||||
|
# Set correct permissions on compinit dir
|
||||||
|
sudo chmod -R 755 /usr/local/share/zsh/site-functions
|
||||||
|
|
||||||
|
# Install tools
|
||||||
|
BREW_TOOLS=(
|
||||||
|
git argocd bandwhich bat danielfoehrkn/switch/switch derailed/k9s/k9s
|
||||||
|
dive doggo duf dust eza fd fzf git-delta go helm htop jq kind krew curl
|
||||||
|
kubectl kustomize node procs progress ripgrep rs/tap/curlie rust starship
|
||||||
|
tektoncd/tools/tektoncd-cli tldr tailscale yq tabby vale jless macchina tz viddy
|
||||||
|
homeassistant-cli act dnsmasq gh kubebuilder golangci-lint gnu-sed s3cmd
|
||||||
|
pulumi/tap/pulumi kubeseal fluxcd/tap/flux ical-buddy baobab
|
||||||
|
watch crane openssh siderolabs/talos/talosctl civo/tools/civo raspberry-pi-imager
|
||||||
|
gron ssup2/tap/kpexec opentofu visual-studio-code 1password-cli scw smartmontools
|
||||||
|
firefox signal slack ffmpeg openscad tsh colima docker docker-buildx nordvpn
|
||||||
|
1password tailscale-app
|
||||||
|
)
|
||||||
|
# Brew tools only available / needed on Mac
|
||||||
|
MAC_BREW_TOOLS=(
|
||||||
|
pinentry-mac gpg gawk coreutils wget stats font-open-dyslexic-nerd-font
|
||||||
|
dimentium/autoraise/autoraiseapp the-unarchiver rar mas capcut
|
||||||
|
mqtt-explorer raycast bettertouchtool calibre kdenlive royal-tsx tableplus
|
||||||
|
homebrew/cask/todoist ultimaker-cura webtorrent pika pearcleaner spotmenu
|
||||||
|
jordanbaird-ice
|
||||||
|
)
|
||||||
|
CARGO_TOOLS=( bottom )
|
||||||
|
NODE_TOOLS=( git-split-diffs )
|
||||||
|
KREW_TOOLS=( outdated tree stern explore blame access-matrix cert-manager rbac-tool resource-capacity view-secret )
|
||||||
|
APT_TOOLS=( zsh gcc )
|
||||||
|
MAS_TOOLS=(
|
||||||
|
1263070803 # Lungo
|
||||||
|
1470584107 # Dato
|
||||||
|
1351639930 # Gifski
|
||||||
|
)
|
||||||
|
|
||||||
|
# Tools removed to be cleaned up
|
||||||
|
REMOVED_BREW_TOOLS=(
|
||||||
|
exa karabiner-elements kubectx hiddenbar
|
||||||
|
)
|
||||||
|
REMOVED_KREW_TOOLS=( gs )
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Installing / updating tools"
|
||||||
|
|
||||||
|
# Install Debian/Ubuntu specific packages if apt exists
|
||||||
|
if command -v apt &>/dev/null; then
|
||||||
|
echo "'apt' found on system, assuming Ubuntu/Debian and installing pre-requisites..."
|
||||||
|
sudo apt install -y ${APT_TOOLS}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Homebrew
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Homebrew tools"
|
||||||
|
export HOMEBREW_NO_INSTALL_CLEANUP=true
|
||||||
|
for tool in "${BREW_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "${tool}..."
|
||||||
|
brew upgrade ${tool} &>/dev/null || brew install ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Cargo
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Cargo tools"
|
||||||
|
for tool in "${CARGO_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "${tool}..."
|
||||||
|
cargo install ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Krew
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Krew tools"
|
||||||
|
kubectl-krew update &>/dev/null
|
||||||
|
for tool in "${KREW_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "${tool}..."
|
||||||
|
kubectl-krew upgrade ${tool} &>/dev/null || kubectl-krew install ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
fulllink() {
|
||||||
|
if [ ! -z `which greadlink` ]
|
||||||
|
then
|
||||||
|
greadlink -f $1
|
||||||
|
else
|
||||||
|
readlink -f $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 OS Specific setup"
|
||||||
|
echo "Detected OS type: ${OSTYPE}"
|
||||||
|
|
||||||
|
case "${OSTYPE}" in
|
||||||
|
*linux*)
|
||||||
|
# Do stuff
|
||||||
|
;;
|
||||||
|
*darwin*)
|
||||||
|
# Mac specific setup
|
||||||
|
echo ""
|
||||||
|
echo "Instaling Mac-specific Brew tools..."
|
||||||
|
for tool in "${MAC_BREW_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "${tool}..."
|
||||||
|
brew upgrade ${tool} &>/dev/null || brew install ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Mac App Store
|
||||||
|
echo ""
|
||||||
|
echo "Instaling Mac-specific App Store tools..."
|
||||||
|
for tool in "${MAS_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "MAS ID: ${tool}..."
|
||||||
|
mas install ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Setting up config files"
|
||||||
|
FILES=$(/usr/bin/find ./os-specific/darwin/home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
|
||||||
|
for file in $FILES
|
||||||
|
do
|
||||||
|
f=$(fulllink "${file}")
|
||||||
|
dst="${HOME}/$(basename "./os-specific/darwin/home/${file}")"
|
||||||
|
printf "Linking ${f}=>${dst}"
|
||||||
|
ln -sfn ${f} ${dst}
|
||||||
|
printf " ✅\n"
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -f "/usr/local/bin/pinentry-mac" ] || sudo ln -s `which pinentry-mac` /usr/local/bin/pinentry-mac
|
||||||
|
gpgconf --kill gpg-agent
|
||||||
|
|
||||||
|
if [ $(gpg --list-secret-keys --keyid-format=long 2>/dev/null | wc -l | xargs) -eq 0 ]; then
|
||||||
|
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️"
|
||||||
|
echo "⚠️ You'll need to create a new GPG key ⚠️"
|
||||||
|
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Handle other files outside of the user's home directory
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Handiling non-standard files:"
|
||||||
|
# 1. Tabby config
|
||||||
|
mkdir -p "/Users/${USER}/Library/Application Support/tabby"
|
||||||
|
f=$(fulllink "./other-files/tabby/config.yaml")
|
||||||
|
dst="/Users/${USER}/Library/Application Support/tabby/config.yaml"
|
||||||
|
printf "Linking ${f}=>${dst}"
|
||||||
|
ln -sfn "${f}" "${dst}"
|
||||||
|
printf " ✅\n"
|
||||||
|
|
||||||
|
# 2. dnsmasq
|
||||||
|
f=$(fulllink "./other-files/dnsmasq/dnsmasq.conf")
|
||||||
|
dst="$(brew --prefix)/etc/dnsmasq.conf"
|
||||||
|
printf "Copying ${f}=>${dst}"
|
||||||
|
cp ${f} ${dst}
|
||||||
|
printf " ✅\n"
|
||||||
|
printf "Setting DNS server for 'Wi-Fi' interface to use dnsmasq"
|
||||||
|
sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
|
||||||
|
printf " ✅\n"
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Adding configuration"
|
||||||
|
FILES=$(/usr/bin/find ./home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
|
||||||
|
for file in $FILES
|
||||||
|
do
|
||||||
|
f=$(fulllink "${file}")
|
||||||
|
dst="${HOME}/$(basename "./home/${file}")"
|
||||||
|
printf "Linking ${f} => ${dst}"
|
||||||
|
ln -sfn ${f} ${dst}
|
||||||
|
printf " ✅\n"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Updating installed tools..."
|
||||||
|
brew upgrade
|
||||||
|
mas upgrade
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Removing old Homebrew tools"
|
||||||
|
export HOMEBREW_NO_INSTALL_CLEANUP=true
|
||||||
|
for tool in "${REMOVED_BREW_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "${tool}..."
|
||||||
|
brew uninstall ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "🔵 Removing old Krew tools"
|
||||||
|
for tool in "${REMOVED_KREW_TOOLS[@]}"
|
||||||
|
do
|
||||||
|
printf "${tool}..."
|
||||||
|
kubectl-krew uninstall ${tool} &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
printf " ✅\n"
|
||||||
|
else
|
||||||
|
printf " ❌\n"
|
||||||
|
fi
|
||||||
|
done
|
5
os-specific/darwin/home/.gnupg/gpg-agent.conf
Normal file
5
os-specific/darwin/home/.gnupg/gpg-agent.conf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
pinentry-program /opt/homebrew/bin//pinentry-mac
|
||||||
|
default-cache-ttl 0
|
||||||
|
max-cache-ttl 600
|
||||||
|
default-cache-ttl-ssh 0
|
||||||
|
max-cache-ttl-ssh 0
|
1
os-specific/darwin/home/.gnupg/gpg.conf
Normal file
1
os-specific/darwin/home/.gnupg/gpg.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
pinentry-mode loopback
|
12
os-specific/darwin/home/RaycastScripts/brand.sh
Executable file
12
os-specific/darwin/home/RaycastScripts/brand.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Brand
|
||||||
|
# @raycast.mode silent
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🤖
|
||||||
|
|
||||||
|
open 'smb://nas._smb._tcp.local/Nextcloud/Pictures/Brand'
|
||||||
|
|
16
os-specific/darwin/home/RaycastScripts/litra-glow-off.sh
Executable file
16
os-specific/darwin/home/RaycastScripts/litra-glow-off.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Litra Glow Off
|
||||||
|
# @raycast.mode silent
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon ⚫️
|
||||||
|
|
||||||
|
# Documentation:
|
||||||
|
# @raycast.description Turn off Litra Glow light
|
||||||
|
|
||||||
|
cd ~/.bin/
|
||||||
|
./litractl off
|
||||||
|
|
15
os-specific/darwin/home/RaycastScripts/litra-glow-on.sh
Executable file
15
os-specific/darwin/home/RaycastScripts/litra-glow-on.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Litra Glow On
|
||||||
|
# @raycast.mode silent
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 💡
|
||||||
|
|
||||||
|
# Documentation:
|
||||||
|
# @raycast.description Turn on Litra Glow light
|
||||||
|
|
||||||
|
cd ~/.bin/
|
||||||
|
./litractl on
|
12
os-specific/darwin/home/RaycastScripts/nextcloud.sh
Executable file
12
os-specific/darwin/home/RaycastScripts/nextcloud.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Nextcloud
|
||||||
|
# @raycast.mode silent
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🤖
|
||||||
|
|
||||||
|
open 'smb://nas._smb._tcp.local/Nextcloud'
|
||||||
|
|
11
os-specific/darwin/home/RaycastScripts/reaction-gifs.sh
Executable file
11
os-specific/darwin/home/RaycastScripts/reaction-gifs.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Reaction Gifs
|
||||||
|
# @raycast.mode silent
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🤖
|
||||||
|
|
||||||
|
open 'smb://nas._smb._tcp.local/Nextcloud/Pictures/ReactionGifs'
|
15
os-specific/darwin/home/RaycastScripts/restart-busycal.sh
Executable file
15
os-specific/darwin/home/RaycastScripts/restart-busycal.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Restart BusyCal Menu
|
||||||
|
# @raycast.mode silent
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🤖
|
||||||
|
|
||||||
|
# Documentation:
|
||||||
|
# @raycast.description Kills the BusyCal process
|
||||||
|
|
||||||
|
pkill busycal-setapp.alarm
|
||||||
|
open /Applications/Setapp/BusyCal.app
|
14
os-specific/darwin/home/RaycastScripts/restart-logi-daemon.sh
Executable file
14
os-specific/darwin/home/RaycastScripts/restart-logi-daemon.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Restart Logi daemon
|
||||||
|
# @raycast.mode silent
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🤖
|
||||||
|
|
||||||
|
# Documentation:
|
||||||
|
# @raycast.description Kills the LogiMgr process to allow a new one to spawn
|
||||||
|
|
||||||
|
pkill LogiMgr
|
12
os-specific/darwin/home/RaycastScripts/things.sh
Executable file
12
os-specific/darwin/home/RaycastScripts/things.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Things
|
||||||
|
# @raycast.mode silent
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🤖
|
||||||
|
|
||||||
|
open 'smb://nas._smb._tcp.local/Things'
|
||||||
|
|
34
os-specific/darwin/home/RaycastScripts/toggle-mic.applescript
Executable file
34
os-specific/darwin/home/RaycastScripts/toggle-mic.applescript
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/osascript
|
||||||
|
|
||||||
|
# Required parameters:
|
||||||
|
# @raycast.schemaVersion 1
|
||||||
|
# @raycast.title Toggle Microphone
|
||||||
|
# @raycast.mode silent
|
||||||
|
# @raycast.packageName System
|
||||||
|
|
||||||
|
# Optional parameters:
|
||||||
|
# @raycast.icon 🎙
|
||||||
|
|
||||||
|
# Documentation:
|
||||||
|
# @raycast.author Matthew Morek
|
||||||
|
# @raycast.authorURL https://github.com/matthewmorek
|
||||||
|
# @raycast.description Toggles microphone.
|
||||||
|
|
||||||
|
|
||||||
|
on getMicrophoneVolume()
|
||||||
|
input volume of (get volume settings)
|
||||||
|
end getMicrophoneVolume
|
||||||
|
on disableMicrophone()
|
||||||
|
set volume input volume 0
|
||||||
|
log "Microphone turned off 🔴"
|
||||||
|
end disableMicrophone
|
||||||
|
on enableMicrophone()
|
||||||
|
set volume input volume 100
|
||||||
|
log "Microphone turned on 🟢"
|
||||||
|
end enableMicrophone
|
||||||
|
|
||||||
|
if getMicrophoneVolume() is greater than 0 then
|
||||||
|
disableMicrophone()
|
||||||
|
else
|
||||||
|
enableMicrophone()
|
||||||
|
end if
|
11
other-files/dnsmasq/dnsmasq.conf
Normal file
11
other-files/dnsmasq/dnsmasq.conf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
server=/cluster.local/192.168.1.3
|
||||||
|
server=192.168.1.3
|
||||||
|
server=192.168.1.4
|
||||||
|
server=192.168.1.5
|
||||||
|
server=1.1.1.1
|
||||||
|
port=53
|
||||||
|
listen-address=127.0.0.1
|
||||||
|
bogus-priv
|
||||||
|
no-resolv
|
||||||
|
bind-interfaces
|
||||||
|
auth-ttl=0
|
218
other-files/tabby/config.yaml
Normal file
218
other-files/tabby/config.yaml
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
version: 7
|
||||||
|
profiles: []
|
||||||
|
hotkeys:
|
||||||
|
copy-current-path: []
|
||||||
|
ctrl-c:
|
||||||
|
- Ctrl-C
|
||||||
|
copy:
|
||||||
|
- ⌘-C
|
||||||
|
paste:
|
||||||
|
- ⌘-V
|
||||||
|
clear:
|
||||||
|
- ⌘-K
|
||||||
|
select-all:
|
||||||
|
- ⌘-A
|
||||||
|
zoom-in:
|
||||||
|
- ⌘-=
|
||||||
|
- ⌘-Shift-=
|
||||||
|
zoom-out:
|
||||||
|
- ⌘--
|
||||||
|
- ⌘-Shift--
|
||||||
|
reset-zoom:
|
||||||
|
- ⌘-0
|
||||||
|
home:
|
||||||
|
- ⌘-Left
|
||||||
|
- Home
|
||||||
|
end:
|
||||||
|
- ⌘-Right
|
||||||
|
- End
|
||||||
|
previous-word:
|
||||||
|
- ⌥-Left
|
||||||
|
next-word:
|
||||||
|
- ⌥-Right
|
||||||
|
delete-previous-word:
|
||||||
|
- ⌥-Backspace
|
||||||
|
delete-next-word:
|
||||||
|
- ⌥-Delete
|
||||||
|
search:
|
||||||
|
- ⌘-F
|
||||||
|
pane-focus-all:
|
||||||
|
- ⌘-Shift-I
|
||||||
|
restart-telnet-session: []
|
||||||
|
restart-ssh-session: []
|
||||||
|
launch-winscp: []
|
||||||
|
settings:
|
||||||
|
- ⌘-,
|
||||||
|
serial:
|
||||||
|
- Alt-K
|
||||||
|
restart-serial-session: []
|
||||||
|
new-window:
|
||||||
|
- ⌘-N
|
||||||
|
new-tab:
|
||||||
|
- ⌘-T
|
||||||
|
profile: {}
|
||||||
|
profile-selectors: {}
|
||||||
|
toggle-fullscreen:
|
||||||
|
- Ctrl+⌘+F
|
||||||
|
close-tab:
|
||||||
|
- ⌘-W
|
||||||
|
reopen-tab:
|
||||||
|
- ⌘-Shift-T
|
||||||
|
toggle-last-tab: []
|
||||||
|
rename-tab:
|
||||||
|
- ⌘-R
|
||||||
|
next-tab:
|
||||||
|
- Ctrl-Tab
|
||||||
|
previous-tab:
|
||||||
|
- Ctrl-Shift-Tab
|
||||||
|
move-tab-left:
|
||||||
|
- ⌘-Shift-Left
|
||||||
|
move-tab-right:
|
||||||
|
- ⌘-Shift-Right
|
||||||
|
rearrange-panes:
|
||||||
|
- ⌘-Shift
|
||||||
|
tab-1:
|
||||||
|
- ⌘-1
|
||||||
|
tab-2:
|
||||||
|
- ⌘-2
|
||||||
|
tab-3:
|
||||||
|
- ⌘-3
|
||||||
|
tab-4:
|
||||||
|
- ⌘-4
|
||||||
|
tab-5:
|
||||||
|
- ⌘-5
|
||||||
|
tab-6:
|
||||||
|
- ⌘-6
|
||||||
|
tab-7:
|
||||||
|
- ⌘-7
|
||||||
|
tab-8:
|
||||||
|
- ⌘-8
|
||||||
|
tab-9:
|
||||||
|
- ⌘-9
|
||||||
|
tab-10:
|
||||||
|
- ⌘-0
|
||||||
|
duplicate-tab: []
|
||||||
|
tab-11: []
|
||||||
|
tab-12: []
|
||||||
|
tab-13: []
|
||||||
|
tab-14: []
|
||||||
|
tab-15: []
|
||||||
|
tab-16: []
|
||||||
|
tab-17: []
|
||||||
|
tab-18: []
|
||||||
|
tab-19: []
|
||||||
|
tab-20: []
|
||||||
|
split-right:
|
||||||
|
- ⌘-Shift-D
|
||||||
|
split-bottom:
|
||||||
|
- ⌘-D
|
||||||
|
split-left: []
|
||||||
|
split-top: []
|
||||||
|
pane-nav-right:
|
||||||
|
- ⌘-⌥-Right
|
||||||
|
pane-nav-down:
|
||||||
|
- ⌘-⌥-Down
|
||||||
|
pane-nav-up:
|
||||||
|
- ⌘-⌥-Up
|
||||||
|
pane-nav-left:
|
||||||
|
- ⌘-⌥-Left
|
||||||
|
pane-nav-previous:
|
||||||
|
- ⌘-⌥-[
|
||||||
|
pane-nav-next:
|
||||||
|
- ⌘-⌥-]
|
||||||
|
pane-maximize:
|
||||||
|
- ⌘-⌥-Enter
|
||||||
|
close-pane:
|
||||||
|
- ⌘-Shift-W
|
||||||
|
profile-selector:
|
||||||
|
- ⌘-E
|
||||||
|
switch-profile:
|
||||||
|
- ⌘-Shift-E
|
||||||
|
toggle-window: []
|
||||||
|
scroll-to-bottom: []
|
||||||
|
delete-line:
|
||||||
|
- ⌘-Backspace
|
||||||
|
settings-tab: {}
|
||||||
|
explode-tab:
|
||||||
|
- ⌘-Shift-.
|
||||||
|
combine-tabs:
|
||||||
|
- ⌘-Shift-,
|
||||||
|
pane-nav-1: []
|
||||||
|
pane-nav-2: []
|
||||||
|
pane-nav-3: []
|
||||||
|
pane-nav-4: []
|
||||||
|
pane-nav-5: []
|
||||||
|
pane-nav-6: []
|
||||||
|
pane-nav-7: []
|
||||||
|
pane-nav-8: []
|
||||||
|
pane-nav-9: []
|
||||||
|
pane-increase-vertical: []
|
||||||
|
pane-decrease-vertical: []
|
||||||
|
pane-increase-horizontal: []
|
||||||
|
pane-decrease-horizontal: []
|
||||||
|
focus-all-tabs:
|
||||||
|
- ⌘-⌥-Shift-I
|
||||||
|
scroll-to-top:
|
||||||
|
- Shift-PageUp
|
||||||
|
scroll-up:
|
||||||
|
- ⌥-PageUp
|
||||||
|
scroll-down:
|
||||||
|
- ⌥-PageDown
|
||||||
|
restart-tab: []
|
||||||
|
reconnect-tab: []
|
||||||
|
disconnect-tab: []
|
||||||
|
command-selector:
|
||||||
|
- ⌘-Shift-P
|
||||||
|
terminal:
|
||||||
|
searchOptions: {}
|
||||||
|
colorScheme:
|
||||||
|
name: hyper-chesterish
|
||||||
|
foreground: '#CDD2E9'
|
||||||
|
background: '#293340'
|
||||||
|
cursor: '#2C85F7'
|
||||||
|
colors:
|
||||||
|
- '#293340'
|
||||||
|
- '#E17E85'
|
||||||
|
- '#61BA86'
|
||||||
|
- '#FFEC8E'
|
||||||
|
- '#4CB2FF'
|
||||||
|
- '#BE86E3'
|
||||||
|
- '#2DCED0'
|
||||||
|
- '#CDD2E9'
|
||||||
|
- '#546386'
|
||||||
|
- '#E17E85'
|
||||||
|
- '#61BA86'
|
||||||
|
- '#FFB68E'
|
||||||
|
- '#4CB2FF'
|
||||||
|
- '#BE86E3'
|
||||||
|
- '#2DCED0'
|
||||||
|
- '#CDD2E9'
|
||||||
|
font: OpenDyslexicMono Nerd Font
|
||||||
|
ligatures: true
|
||||||
|
cursor: beam
|
||||||
|
pasteOnMiddleClick: false
|
||||||
|
customColorSchemes: []
|
||||||
|
background: colorScheme
|
||||||
|
autoOpen: true
|
||||||
|
ssh: {}
|
||||||
|
configSync:
|
||||||
|
parts: {}
|
||||||
|
clickableLinks:
|
||||||
|
modifier: metaKey
|
||||||
|
appearance:
|
||||||
|
dockFill: 0.23
|
||||||
|
css: ''
|
||||||
|
pluginBlacklist: []
|
||||||
|
enableAnalytics: false
|
||||||
|
enableWelcomeTab: false
|
||||||
|
profileDefaults: {}
|
||||||
|
recoverTabs: false
|
||||||
|
electronFlags:
|
||||||
|
- - force_discrete_gpu
|
||||||
|
- '0'
|
||||||
|
accessibility: {}
|
||||||
|
hacks: {}
|
||||||
|
groups: []
|
||||||
|
providerBlacklist: []
|
||||||
|
commandBlacklist: []
|
||||||
|
profileBlacklist: []
|
Reference in New Issue
Block a user