Lots of changes

This commit is contained in:
Marcus Noble 2021-10-14 10:11:17 +01:00
parent 7a0806ce75
commit edfbcee609
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78
9 changed files with 40 additions and 21 deletions

View File

@ -7,7 +7,6 @@ format = """\
$git_commit\
$git_state\
$git_status\
$aws\
$kubernetes\
$helm\
$golang\
@ -44,6 +43,8 @@ format = '[$symbol$context \($namespace\)]($style) '
symbol = "ﴱ "
style = "bold blue"
disabled = false
[kubernetes.context_aliases]
"gs-(?P<cluster>.+)" = "$cluster [MC]"
[terraform]
format = "[$symbol$version]($style) "

View File

@ -7,12 +7,12 @@ plugins=(
zsh-autosuggestions
)
autoload -U compinit && compinit
fpath=($fpath ~/.zsh/completion)
DISABLE_UNTRACKED_FILES_DIRTY="true"
SHOW_AWS_PROMPT=false
source $ZSH/oh-my-zsh.sh
source `brew --prefix switch`/switch.sh
# History
HISTFILE="$HOME/.zsh_history"

View File

@ -24,6 +24,8 @@ alias bandwhich='sudo bandwhich'
alias top='btm'
alias ps='procs'
alias dig='dog'
alias kubectx='switch'
alias kctx='switch'
alias machine-info='macchina -t Boron --bar'
alias watch='watch '
@ -39,7 +41,11 @@ lt() {
}
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'
git-clone() {
git clone $1
cd "$(basename "$1" .git)"
git() {
if [ "$1" = "take" ]; then
/usr/local/bin/git clone $2
cd $(basename $2 | sed 's/\.git$//')
else
/usr/local/bin/git $@
fi
}

View File

@ -1,6 +1,7 @@
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/goworkspace/bin:$HOME/.cargo/bin:/usr/local/kubebuilder/bin:$HOME/.asdf/shims"
export EDITOR='vim'
export VISUAL='code'
export GPG_TTY=$(tty)
# AWS
if [ -f ~/.aws/profile ]; then

View File

@ -1,4 +1,5 @@
alias k='kubectl '
alias kgs='kubectl-gs '
alias kshell='kubectl run -it shell --image bash --restart Never --rm -- sh'
kiam () {
@ -70,12 +71,6 @@ kube-forward() {
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}'))
@ -99,13 +94,6 @@ 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=""

View File

@ -1,5 +1,9 @@
[user]
name = Marcus Noble
signingkey = B8F2DB8A7AEBAF78
[commit]
gpgsign = true
[core]
editor = /usr/bin/vim
@ -26,8 +30,9 @@
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|grep HEAD|sed 's/.* //'"
main = "!git remote set-head origin --auto && git checkout $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') && git pull"
main = "!git remote set-head origin --auto && git checkout $(git main-branch) && 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"
@ -45,5 +50,3 @@
[url "ssh://git@github.com"]
insteadOf = https://github.com
[url "ssh://git@gitlab.et-scm.com/"]
insteadOf = https://gitlab.et-scm.com

8
.kube/switch-config.yaml Normal file
View File

@ -0,0 +1,8 @@
kind: SwitchConfig
version: v1alpha1
kubeconfigName: "*.yaml"
kubeconfigStores:
- kind: filesystem
kubeconfigName: "*.yaml"
paths:
- ~/.kube/clusters/

4
.zshrc
View File

@ -1,3 +1,7 @@
if [ ! -z ~/.additional_dotfiles/credentials ]; then
source ~/.additional_dotfiles/credentials
fi
for filename in ~/.dotfiles/*; do
source $filename
done

View File

@ -37,6 +37,7 @@ pre-reqs: ## Install all required binaries.
which procs > /dev/null || brew install procs; \
which dog > /dev/null || brew install dog; \
which asdf > /dev/null || brew install asdf; \
which switcher > /dev/null || brew install danielfoehrkn/switch/switch; \
brew install gpg gawk coreutils; \
git clone https://github.com/zsh-users/zsh-autosuggestions $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions; \
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting; \
@ -79,6 +80,7 @@ upgrade: ## Upgrade all required binaries.
which procs > /dev/null && brew upgrade procs; \
which dog > /dev/null && brew upgrade dog; \
which asdf > /dev/null && brew upgrade asdf; \
which switcher > /dev/null && brew upgrade switch; \
cd $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && git pull && cd -; \
cd $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && git pull && cd -; \
asdf plugin update --all; \
@ -104,6 +106,12 @@ dotfiles: ## Installs the dotfiles.
f=$$(basename $$file); \
ln -sfn $$file $(HOME)/.k9s/$$f; \
done; \
mkdir -p $(HOME)/.kube; \
for file in $(shell find $(CURDIR)/.kube -type f); do \
f=$$(basename $$file); \
ln -sfn $$file $(HOME)/.kube/$$f; \
done; \
.PHONY: help
help: