Merge branch 'master' of ssh://git.penguincoder.org:2222/penguincoder/dotfiles
commit
8167b7ef5d
|
@ -3,7 +3,7 @@
|
|||
Transparency=low
|
||||
CursorType=block
|
||||
Font=IBMPlexMono NF
|
||||
FontHeight=14
|
||||
FontHeight=16
|
||||
BoldAsFont=yes
|
||||
BoldAsColour=no
|
||||
Locale=en_US
|
||||
|
@ -34,4 +34,4 @@ BoldMagenta=177,102,177
|
|||
Cyan=102,204,204
|
||||
BoldCyan=57,173,173
|
||||
White=211,208,200
|
||||
BoldWhite=242,240,236
|
||||
BoldWhite=242,240,236
|
||||
|
|
29
README.md
29
README.md
|
@ -1,9 +1,24 @@
|
|||
# Installation
|
||||
# dotfiles
|
||||
|
||||
## Linux Bionic/Tara distributions
|
||||
These are my dotfiles, useful for my own shell configuration and not much else. Installation is easy, just paste this into your terminal.
|
||||
|
||||
sudo apt-get install git python3 ansible ansible-lint && curl -sL https://git.penguincoder.org/penguincoder/dotfiles/raw/branch/master/bin/install-dotfiles.sh | bash && ansible-playbook -i localdev-inventory.yaml linux-bionic-playbook.yaml
|
||||
|
||||
## Just the configuration files and shell scripts
|
||||
|
||||
curl -sL https://git.penguincoder.org/penguincoder/dotfiles/raw/branch/master/bin/install-dotfiles.sh | bash
|
||||
#!/bin/sh
|
||||
#Initialization script sourced from Atlassian: https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/
|
||||
git clone --bare ssh://git@git.penguincoder.org:2222/penguincoder/dotfiles.git
|
||||
function config {
|
||||
/usr/bin/git --git-dir=$HOME/dotfiles.git/ --work-tree=$HOME $@
|
||||
}
|
||||
mkdir -p .config-backup
|
||||
config checkout
|
||||
if [ $? = 0 ]; then
|
||||
echo "Checked out config.";
|
||||
else
|
||||
echo "Backing up pre-existing dot files.";
|
||||
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
|
||||
fi;
|
||||
config checkout
|
||||
config config status.showUntrackedFiles no
|
||||
config push --set-upstream origin master
|
||||
config submodule init
|
||||
config submodule update
|
||||
which fc-cache 2>/dev/null && fc-cache -f -v ~/.fonts || true
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#export AWS_ACCESS_KEY_ID=
|
||||
#export AWS_SECRET_ACCESS_KEY=
|
||||
test -s $HOME/code/vagrant-dev-env/dev-aliases && . $HOME/code/vagrant-dev-env/dev-aliases || true
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
#Initialization script sourced from Atlassian: https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/
|
||||
git clone --bare ssh://git@git.penguincoder.org:2222/penguincoder/dotfiles.git
|
||||
function config {
|
||||
/usr/bin/git --git-dir=$HOME/dotfiles.git/ --work-tree=$HOME $@
|
||||
}
|
||||
mkdir -p .config-backup
|
||||
config checkout
|
||||
if [ $? = 0 ]; then
|
||||
echo "Checked out config.";
|
||||
else
|
||||
echo "Backing up pre-existing dot files.";
|
||||
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
|
||||
fi;
|
||||
config checkout
|
||||
config config status.showUntrackedFiles no
|
||||
config push --set-upstream origin master
|
||||
config submodule init
|
||||
config submodule update
|
||||
which fc-cache 2>/dev/null && fc-cache -f -v ~/.fonts || true
|
|
@ -1,83 +0,0 @@
|
|||
#!/bin/bash
|
||||
# bash_completion for kerl
|
||||
|
||||
_kerl()
|
||||
{
|
||||
local cur prev
|
||||
if type _get_comp_words_by_ref &>/dev/null ; then
|
||||
_get_comp_words_by_ref cur prev
|
||||
else
|
||||
cur=$2 prev=$3
|
||||
fi
|
||||
|
||||
case $prev in
|
||||
kerl)
|
||||
mapfile -t COMPREPLY < <( compgen -W 'build install update list delete active path status' -- "$cur" )
|
||||
;;
|
||||
list)
|
||||
mapfile -t COMPREPLY < <( compgen -W 'releases builds installations' -- "$cur" )
|
||||
;;
|
||||
build)
|
||||
if [ "$COMP_CWORD" -eq 2 ]; then
|
||||
if [ -f "$HOME"/.kerl/otp_releases ]; then
|
||||
RELEASES=$(cat "$HOME"/.kerl/otp_releases)
|
||||
fi
|
||||
mapfile -t COMPREPLY < <( compgen -W "git $RELEASES" -- "$cur")
|
||||
else
|
||||
if [ -f "$HOME"/.kerl/otp_builds ]; then
|
||||
BUILDS=$(cut -d ',' -f 2 "$HOME"/.kerl/otp_builds)
|
||||
fi
|
||||
mapfile -t COMPREPLY < <( compgen -W "$BUILDS" -- "$cur")
|
||||
fi
|
||||
;;
|
||||
installation)
|
||||
if [ -f "$HOME"/.kerl/otp_installations ]; then
|
||||
PATHS=$(cut -d ' ' -f 2 "$HOME"/.kerl/otp_installations)
|
||||
fi
|
||||
mapfile -t COMPREPLY < <( compgen -W "$PATHS" -- "$cur")
|
||||
;;
|
||||
install)
|
||||
if [ -f "$HOME"/.kerl/otp_builds ]; then
|
||||
BUILDS=$(cut -d ',' -f 2 "$HOME"/.kerl/otp_builds)
|
||||
fi
|
||||
mapfile -t COMPREPLY < <( compgen -W "$BUILDS" -- "$cur")
|
||||
;;
|
||||
path)
|
||||
INSTALL_LIST="$HOME"/.kerl/otp_installations
|
||||
if [ -f "$INSTALL_LIST" ]; then
|
||||
NAMES=$(cut -d ' ' -f 2 "$INSTALL_LIST" | xargs basename)
|
||||
fi
|
||||
mapfile -t COMPREPLY < <( compgen -W "$NAMES" -- "$cur")
|
||||
;;
|
||||
deploy)
|
||||
if [ "$COMP_CWORD" -eq 3 ]; then
|
||||
if [ -f "$HOME"/.kerl/otp_installations ]; then
|
||||
PATHS=$(cut -d ' ' -f 2 "$HOME"/.kerl/otp_installations)
|
||||
fi
|
||||
fi
|
||||
mapfile -t COMPREPLY < <( compgen -W "$PATHS" -- "$cur")
|
||||
;;
|
||||
delete)
|
||||
mapfile -t COMPREPLY < <( compgen -W 'build installation' -- "$cur")
|
||||
;;
|
||||
update)
|
||||
mapfile -t COMPREPLY < <( compgen -W 'releases' -- "$cur")
|
||||
;;
|
||||
*)
|
||||
if [ "$COMP_CWORD" -eq 3 ]; then
|
||||
if [ -f "$HOME"/.kerl/otp_builds ]; then
|
||||
BUILDS=$(cut -d ',' -f 2 "$HOME"/.kerl/otp_builds)
|
||||
fi
|
||||
if [ -n "$BUILDS" ]; then
|
||||
for b in $BUILDS; do
|
||||
if [ "$prev" = "$b" ]; then
|
||||
_filedir
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _kerl kerl
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash
|
||||
test -s "$HOME/.kerl/installs/21.0/activate" && . "$HOME/.kerl/installs/21.0/activate"
|
||||
test -s "$HOME/.kerl/installs/22.0/activate" && . "$HOME/.kerl/installs/22.0/activate"
|
||||
|
|
227
bin/kubectx
227
bin/kubectx
|
@ -1,227 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# kubectx(1) is a utility to manage and switch between kubectl contexts.
|
||||
|
||||
# Copyright 2017 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
[[ -n $DEBUG ]] && set -x
|
||||
|
||||
set -eou pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
SELF_CMD="$0"
|
||||
KUBECTX="${XDG_CACHE_HOME:-$HOME/.kube}/kubectx"
|
||||
|
||||
usage() {
|
||||
cat <<"EOF"
|
||||
USAGE:
|
||||
kubectx : list the contexts
|
||||
kubectx <NAME> : switch to context <NAME>
|
||||
kubectx - : switch to the previous context
|
||||
kubectx <NEW_NAME>=<NAME> : rename context <NAME> to <NEW_NAME>
|
||||
kubectx <NEW_NAME>=. : rename current-context to <NEW_NAME>
|
||||
kubectx -d <NAME> [<NAME...>] : delete context <NAME> ('.' for current-context)
|
||||
(this command won't delete the user/cluster entry
|
||||
that is used by the context)
|
||||
|
||||
kubectx -h,--help : show this message
|
||||
EOF
|
||||
}
|
||||
|
||||
exit_err() {
|
||||
echo >&2 "${1}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
current_context() {
|
||||
$KUBECTL config view -o=jsonpath='{.current-context}'
|
||||
}
|
||||
|
||||
get_contexts() {
|
||||
$KUBECTL config get-contexts -o=name | sort -n
|
||||
}
|
||||
|
||||
list_contexts() {
|
||||
set -u pipefail
|
||||
local cur ctx_list
|
||||
cur="$(current_context)" || exit_err "error getting current context"
|
||||
ctx_list=$(get_contexts) || exit_err "error getting context list"
|
||||
|
||||
local yellow darkbg normal
|
||||
yellow=$(tput setaf 3 || true)
|
||||
darkbg=$(tput setab 0 || true)
|
||||
normal=$(tput sgr0 || true)
|
||||
|
||||
local cur_ctx_fg cur_ctx_bg
|
||||
cur_ctx_fg=${KUBECTX_CURRENT_FGCOLOR:-$yellow}
|
||||
cur_ctx_bg=${KUBECTX_CURRENT_BGCOLOR:-$darkbg}
|
||||
|
||||
for c in $ctx_list; do
|
||||
if [[ -n "${_KUBECTX_FORCE_COLOR:-}" || \
|
||||
-t 1 && -z "${NO_COLOR:-}" ]]; then
|
||||
# colored output mode
|
||||
if [[ "${c}" = "${cur}" ]]; then
|
||||
echo "${cur_ctx_bg}${cur_ctx_fg}${c}${normal}"
|
||||
else
|
||||
echo "${c}"
|
||||
fi
|
||||
else
|
||||
echo "${c}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
read_context() {
|
||||
if [[ -f "${KUBECTX}" ]]; then
|
||||
cat "${KUBECTX}"
|
||||
fi
|
||||
}
|
||||
|
||||
save_context() {
|
||||
local saved
|
||||
saved="$(read_context)"
|
||||
|
||||
if [[ "${saved}" != "${1}" ]]; then
|
||||
printf %s "${1}" > "${KUBECTX}"
|
||||
fi
|
||||
}
|
||||
|
||||
switch_context() {
|
||||
$KUBECTL config use-context "${1}"
|
||||
}
|
||||
|
||||
choose_context_interactive() {
|
||||
local choice
|
||||
choice="$(_KUBECTX_FORCE_COLOR=1 \
|
||||
FZF_DEFAULT_COMMAND="${SELF_CMD}" \
|
||||
fzf --ansi || true)"
|
||||
if [[ -z "${choice}" ]]; then
|
||||
echo 2>&1 "error: you did not choose any of the options"
|
||||
exit 1
|
||||
else
|
||||
set_context "${choice}"
|
||||
fi
|
||||
}
|
||||
|
||||
set_context() {
|
||||
local prev
|
||||
prev="$(current_context)" || exit_err "error getting current context"
|
||||
|
||||
switch_context "${1}"
|
||||
|
||||
if [[ "${prev}" != "${1}" ]]; then
|
||||
save_context "${prev}"
|
||||
fi
|
||||
}
|
||||
|
||||
swap_context() {
|
||||
local ctx
|
||||
ctx="$(read_context)"
|
||||
if [[ -z "${ctx}" ]]; then
|
||||
echo "error: No previous context found." >&2
|
||||
exit 1
|
||||
fi
|
||||
set_context "${ctx}"
|
||||
}
|
||||
|
||||
context_exists() {
|
||||
grep -q ^"${1}"\$ <($KUBECTL config get-contexts -o=name)
|
||||
}
|
||||
|
||||
rename_context() {
|
||||
local old_name="${1}"
|
||||
local new_name="${2}"
|
||||
|
||||
if [[ "${old_name}" == "." ]]; then
|
||||
old_name="$(current_context)"
|
||||
fi
|
||||
|
||||
if ! context_exists "${old_name}"; then
|
||||
echo "error: Context \"${old_name}\" not found, can't rename it." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if context_exists "${new_name}"; then
|
||||
echo "Context \"${new_name}\" exists, deleting..." >&2
|
||||
$KUBECTL config delete-context "${new_name}" 1>/dev/null 2>&1
|
||||
fi
|
||||
|
||||
$KUBECTL config rename-context "${old_name}" "${new_name}"
|
||||
}
|
||||
|
||||
delete_contexts() {
|
||||
for i in "${@}"; do
|
||||
delete_context "${i}"
|
||||
done
|
||||
}
|
||||
|
||||
delete_context() {
|
||||
local ctx
|
||||
ctx="${1}"
|
||||
if [[ "${ctx}" == "." ]]; then
|
||||
ctx="$(current_context)" || exit_err "error getting current context"
|
||||
fi
|
||||
echo "Deleting context \"${ctx}\"..." >&2
|
||||
$KUBECTL config delete-context "${ctx}"
|
||||
}
|
||||
|
||||
main() {
|
||||
if hash kubectl 2>/dev/null; then
|
||||
KUBECTL=kubectl
|
||||
elif hash kubectl.exe 2>/dev/null; then
|
||||
KUBECTL=kubectl.exe
|
||||
else
|
||||
echo >&2 "kubectl is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
if [[ -t 1 && -z "${KUBECTX_IGNORE_FZF:-}" && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then
|
||||
choose_context_interactive
|
||||
else
|
||||
list_contexts
|
||||
fi
|
||||
elif [[ "${1}" == "-d" ]]; then
|
||||
if [[ "$#" -lt 2 ]]; then
|
||||
echo "error: missing context NAME" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
delete_contexts "${@:2}"
|
||||
elif [[ "$#" -gt 1 ]]; then
|
||||
echo "error: too many arguments" >&2
|
||||
usage
|
||||
exit 1
|
||||
elif [[ "$#" -eq 1 ]]; then
|
||||
if [[ "${1}" == "-" ]]; then
|
||||
swap_context
|
||||
elif [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
||||
usage
|
||||
elif [[ "${1}" =~ ^-(.*) ]]; then
|
||||
echo "error: unrecognized flag \"${1}\"" >&2
|
||||
usage
|
||||
exit 1
|
||||
elif [[ "${1}" =~ (.+)=(.+) ]]; then
|
||||
rename_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
|
||||
else
|
||||
set_context "${1}"
|
||||
fi
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
214
bin/kubens
214
bin/kubens
|
@ -1,214 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# kubens(1) is a utility to switch between Kubernetes namespaces.
|
||||
|
||||
# Copyright 2017 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
[[ -n $DEBUG ]] && set -x
|
||||
|
||||
set -eou pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
SELF_CMD="$0"
|
||||
KUBENS_DIR="${XDG_CACHE_HOME:-$HOME/.kube}/kubens"
|
||||
|
||||
usage() {
|
||||
cat <<"EOF"
|
||||
USAGE:
|
||||
kubens : list the namespaces in the current context
|
||||
kubens <NAME> : change the active namespace of current context
|
||||
kubens - : switch to the previous namespace in this context
|
||||
kubens -h,--help : show this message
|
||||
EOF
|
||||
}
|
||||
|
||||
exit_err() {
|
||||
echo >&2 "${1}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
current_namespace() {
|
||||
local cur_ctx
|
||||
|
||||
cur_ctx="$(current_context)" || exit_err "error getting current context"
|
||||
ns="$($KUBECTL config view -o=jsonpath="{.contexts[?(@.name==\"${cur_ctx}\")].context.namespace}")" \
|
||||
|| exit_err "error getting current namespace"
|
||||
|
||||
if [[ -z "${ns}" ]]; then
|
||||
echo "default"
|
||||
else
|
||||
echo "${ns}"
|
||||
fi
|
||||
}
|
||||
|
||||
current_context() {
|
||||
$KUBECTL config current-context
|
||||
}
|
||||
|
||||
get_namespaces() {
|
||||
$KUBECTL get namespaces -o=jsonpath='{range .items[*].metadata.name}{@}{"\n"}{end}'
|
||||
}
|
||||
|
||||
escape_context_name() {
|
||||
echo "${1//\//-}"
|
||||
}
|
||||
|
||||
namespace_file() {
|
||||
local ctx="$(escape_context_name "${1}")"
|
||||
echo "${KUBENS_DIR}/${ctx}"
|
||||
}
|
||||
|
||||
read_namespace() {
|
||||
local f
|
||||
f="$(namespace_file "${1}")"
|
||||
[[ -f "${f}" ]] && cat "${f}"
|
||||
return 0
|
||||
}
|
||||
|
||||
save_namespace() {
|
||||
mkdir -p "${KUBENS_DIR}"
|
||||
local f saved
|
||||
f="$(namespace_file "${1}")"
|
||||
saved="$(read_namespace "${1}")"
|
||||
|
||||
if [[ "${saved}" != "${2}" ]]; then
|
||||
printf %s "${2}" > "${f}"
|
||||
fi
|
||||
}
|
||||
|
||||
switch_namespace() {
|
||||
local ctx="${1}"
|
||||
$KUBECTL config set-context "${ctx}" --namespace="${2}"
|
||||
echo "Active namespace is \"${2}\".">&2
|
||||
}
|
||||
|
||||
choose_namespace_interactive() {
|
||||
# directly calling kubens via fzf might fail with a cryptic error like
|
||||
# "$FZF_DEFAULT_COMMAND failed", so try to see if we can list namespaces
|
||||
# locally first
|
||||
if [[ -z "$(list_namespaces)" ]]; then
|
||||
echo >&2 "error: could not list namespaces (is the cluster accessible?)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local choice
|
||||
choice="$(_KUBECTX_FORCE_COLOR=1 \
|
||||
FZF_DEFAULT_COMMAND="${SELF_CMD}" \
|
||||
fzf --ansi || true)"
|
||||
if [[ -z "${choice}" ]]; then
|
||||
echo 2>&1 "error: you did not choose any of the options"
|
||||
exit 1
|
||||
else
|
||||
set_namespace "${choice}"
|
||||
fi
|
||||
}
|
||||
|
||||
set_namespace() {
|
||||
local ctx prev
|
||||
ctx="$(current_context)" || exit_err "error getting current context"
|
||||
prev="$(current_namespace)" || exit_error "error getting current namespace"
|
||||
|
||||
if grep -q ^"${1}"\$ <(get_namespaces); then
|
||||
switch_namespace "${ctx}" "${1}"
|
||||
|
||||
if [[ "${prev}" != "${1}" ]]; then
|
||||
save_namespace "${ctx}" "${prev}"
|
||||
fi
|
||||
else
|
||||
echo "error: no namespace exists with name \"${1}\".">&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
list_namespaces() {
|
||||
local yellow darkbg normal
|
||||
yellow=$(tput setaf 3 || true)
|
||||
darkbg=$(tput setab 0 || true)
|
||||
normal=$(tput sgr0 || true)
|
||||
|
||||
local cur_ctx_fg cur_ctx_bg
|
||||
cur_ctx_fg=${KUBECTX_CURRENT_FGCOLOR:-$yellow}
|
||||
cur_ctx_bg=${KUBECTX_CURRENT_BGCOLOR:-$darkbg}
|
||||
|
||||
local cur ns_list
|
||||
cur="$(current_namespace)" || exit_err "error getting current namespace"
|
||||
ns_list=$(get_namespaces) || exit_err "error getting namespace list"
|
||||
|
||||
for c in $ns_list; do
|
||||
if [[ -n "${_KUBECTX_FORCE_COLOR:-}" || \
|
||||
-t 1 && -z "${NO_COLOR:-}" ]]; then
|
||||
# colored output mode
|
||||
if [[ "${c}" = "${cur}" ]]; then
|
||||
echo "${cur_ctx_bg}${cur_ctx_fg}${c}${normal}"
|
||||
else
|
||||
echo "${c}"
|
||||
fi
|
||||
else
|
||||
echo "${c}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
swap_namespace() {
|
||||
local ctx ns
|
||||
ctx="$(current_context)" || exit_err "error getting current context"
|
||||
ns="$(read_namespace "${ctx}")"
|
||||
if [[ -z "${ns}" ]]; then
|
||||
echo "error: No previous namespace found for current context." >&2
|
||||
exit 1
|
||||
fi
|
||||
set_namespace "${ns}"
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ -z "${KUBECTL:-}" ]]; then
|
||||
if hash kubectl 2>/dev/null; then
|
||||
KUBECTL=kubectl
|
||||
elif hash kubectl.exe 2>/dev/null; then
|
||||
KUBECTL=kubectl.exe
|
||||
else
|
||||
echo >&2 "kubectl is not installed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
if [[ -t 1 && -z ${KUBECTX_IGNORE_FZF:-} && "$(type fzf &>/dev/null; echo $?)" -eq 0 ]]; then
|
||||
choose_namespace_interactive
|
||||
else
|
||||
list_namespaces
|
||||
fi
|
||||
elif [[ "$#" -eq 1 ]]; then
|
||||
if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
||||
usage
|
||||
elif [[ "${1}" == "-" ]]; then
|
||||
swap_namespace
|
||||
elif [[ "${1}" =~ ^-(.*) ]]; then
|
||||
echo "error: unrecognized flag \"${1}\"" >&2
|
||||
usage
|
||||
exit 1
|
||||
elif [[ "${1}" =~ (.+)=(.+) ]]; then
|
||||
alias_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
|
||||
else
|
||||
set_namespace "${1}"
|
||||
fi
|
||||
else
|
||||
echo "error: too many flags" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -1,9 +1,3 @@
|
|||
export MINIKUBE_WANTUPDATENOTIFICATION=true
|
||||
export MINIKUBE_WANTREPORTERRORPROMPT=false
|
||||
export MINIKUBE_WANTKUBECTLDOWNLOADMSG=false
|
||||
export MINIKUBE_HOME=$HOME
|
||||
export MINIKUBE_DRIVER=kvm2
|
||||
export CHANGE_MINIKUBE_NONE_USER=true
|
||||
test -d $HOME/.kube || mkdir $HOME/.kube
|
||||
test -f $HOME/.kube/config || touch $HOME/.kube/config
|
||||
export KUBECONFIG=$HOME/.kube/config
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +0,0 @@
|
|||
export MINIKUBE_MEMORY=4096
|
File diff suppressed because it is too large
Load Diff
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
- name: linux desktop setup
|
||||
hosts: all
|
||||
become: yes
|
||||
become_user: root
|
||||
become_method: sudo
|
||||
gather_facts: False
|
||||
vars:
|
||||
ansible_connection: local
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
tasks:
|
||||
- include_role:
|
||||
name: dev-tools
|
||||
- include_role:
|
||||
name: docker
|
||||
- include_role:
|
||||
name: k8s
|
||||
- include_role:
|
||||
name: linux-desktop
|
|
@ -1 +0,0 @@
|
|||
default ansible_connection=local
|
|
@ -1,50 +0,0 @@
|
|||
---
|
||||
- name: install apt applications
|
||||
apt:
|
||||
name: jq,vim,emacs,curl,htop,tmux,git,openvpn,build-essential,libssl-dev,libncurses5-dev
|
||||
state: present
|
||||
- name: install micro
|
||||
shell: curl -sLo /tmp/micro.tar.gz https://github.com/zyedidia/micro/releases/download/v1.4.1/micro-1.4.1-linux64.tar.gz && mkdir -p /tmp/micro && tar xzf /tmp/micro.tar.gz -C /tmp/micro && install -m 755 /tmp/micro/micro-1.4.1/micro /usr/local/bin/micro-1.4.1 && rm -rf /tmp/micro* && ln -sf /usr/local/bin/micro-1.4.1 /usr/local/bin/micro
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/micro-1.4.1
|
||||
- name: install powerline-go
|
||||
shell: curl -sLo /tmp/powerline-go https://github.com/justjanne/powerline-go/releases/download/v1.12.1/powerline-go-linux-amd64 && install -m 755 /tmp/powerline-go /usr/local/bin/powerline-go-1.12.1 && rm -f /tmp/powerline-go && ln -sf /usr/local/bin/powerline-go-1.12.1 /usr/local/bin/powerline-go
|
||||
args:
|
||||
creates: /usr/local/bin/powerline-go-1.12.1
|
||||
- name: install rustup
|
||||
become: no
|
||||
shell: curl -o t.sh https://sh.rustup.rs -sSf && chmod 700 t.sh && ./t.sh --no-modify-path --verbose -y --default-toolchain stable && rm -f t.sh
|
||||
args:
|
||||
creates: ~/.cargo/bin/rustup
|
||||
- name: install kerl
|
||||
shell: curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl && install -m 755 kerl /usr/local/bin/kerl && rm -f kerl
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/kerl
|
||||
- name: update kerl releases
|
||||
become: no
|
||||
shell: kerl update releases
|
||||
args:
|
||||
creates: ~/.kerl/otp_releases
|
||||
- name: build erlang 21.0
|
||||
become: no
|
||||
shell: kerl build 21.0 21.0
|
||||
args:
|
||||
creates: ~/.kerl/builds/21.0
|
||||
- name: install erlang 21.0
|
||||
become: no
|
||||
shell: kerl install 21.0
|
||||
args:
|
||||
creates: ~/.kerl/installs/21.0
|
||||
- name: install kiex
|
||||
become: no
|
||||
shell: curl -sSL https://raw.githubusercontent.com/taylor/kiex/master/install | bash -s
|
||||
args:
|
||||
warn: False
|
||||
creates: ~/.kiex/bin/kiex
|
||||
- name: install elixir
|
||||
become: no
|
||||
shell: . ~/bin/kerl.setup.bash && kiex install 1.7.4
|
||||
args:
|
||||
creates: ~/.kiex/elixirs/elixir-1.7.4
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
- name: add docker-ce pubkey
|
||||
shell: curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x7EA0A9C3F273FCD8" | sudo apt-key add
|
||||
args:
|
||||
warn: False
|
||||
- name: add docker-ce repo
|
||||
apt_repository:
|
||||
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
|
||||
state: present
|
||||
update_cache: true
|
||||
- name: install apt applications
|
||||
apt:
|
||||
name: libvirt-clients,libvirt-daemon-system,qemu-kvm,virt-manager,virt-top,virt-goodies,vagrant,vagrant-libvirt,vagrant-mutate,xsltproc,fop,docker-ce
|
||||
state: present
|
||||
- name: install docker-compose
|
||||
shell: curl -sLo /tmp/docker-compose https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Linux-x86_64 && install -m 755 /tmp/docker-compose /usr/local/bin/docker-compose-1.24.0 && rm -f /tmp/docker-compose && ln -sf /usr/local/bin/docker-compose-1.24.0 /usr/local/bin/docker-compose
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/docker-compose-1.24.0
|
||||
- name: install docker-machine
|
||||
shell: curl -sLo docker-machine https://github.com/docker/machine/releases/download/v0.16.0/docker-machine-linux-x86_64 && install -m 755 docker-machine /usr/local/bin/docker-machine-0.16.0 && rm -f docker-machine && ln -sf /usr/local/bin/docker-machine-0.16.0 /usr/local/bin/docker-machine
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/docker-machine-0.16.0
|
||||
- name: install docker-machine-driver-kvm2
|
||||
shell: curl -sLo docker-machine-driver-kvm2 https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 && install -m 755 docker-machine-driver-kvm2 /usr/local/bin/docker-machine-driver-kvm2 && rm -f docker-machine-driver-kvm2
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/docker-machine-driver-kvm2
|
|
@ -1,63 +0,0 @@
|
|||
---
|
||||
- name: configure static hostfile entry for starbase4.consolo.lan
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
line: "10.4.21.100 starbase4 starbase4.consolo.lan"
|
||||
- name: configure static hostfile entry for errbit.consolo.lan
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
line: "10.4.21.136 errbit.consolo.lan"
|
||||
- name: configure static hostfile entry for api-doc.consolo.lan
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
line: "10.4.21.100 api-docs.consolo.lan"
|
||||
- name: configure static hostfile entry for lxd.consolo.lan
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
line: "10.4.21.253 lxd.consolo.lan mattermost.lxd.consolo.lan"
|
||||
- name: configure static hostfile entry for git.lxd.consolo.lan
|
||||
lineinfile:
|
||||
path: /etc/hosts
|
||||
line: "10.4.21.230 git.lxd.consolo.lan"
|
||||
- name: install apt applications
|
||||
apt:
|
||||
name: python3-pip,python3-setuptools,python3-yaml,python3-wheel,socat,vpnc
|
||||
state: present
|
||||
- name: install pip applications
|
||||
pip:
|
||||
name: awscli,saws
|
||||
state: present
|
||||
- name: install kubectl
|
||||
shell: curl -sLo /tmp/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.11.3/bin/linux/amd64/kubectl && install -m 755 /tmp/kubectl /usr/local/bin/kubectl-1.11.3 && rm -f /tmp/kubectl && ln -sf /usr/local/bin/kubectl-1.11.3 /usr/local/bin/kubectl
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/kubectl-1.11.3
|
||||
- name: install kops
|
||||
shell: curl -sLo /tmp/kops -L https://github.com/kubernetes/kops/releases/download/1.10.0/kops-linux-amd64 && install -m 755 /tmp/kops /usr/local/bin/kops-1.10.0 && rm -f /tmp/kops && ln -sf /usr/local/bin/kops-1.10.0 /usr/local/bin/kops
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/kops-1.10.0
|
||||
- name: install minikube
|
||||
shell: curl -sLo /tmp/minikube https://storage.googleapis.com/minikube/releases/v1.1.1/minikube-linux-amd64 && install -m 755 /tmp/minikube /usr/local/bin/minikube-1.1.1 && rm -f /tmp/minikube && ln -sf /usr/local/bin/minikube-1.1.1 /usr/local/bin/minikube
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/minikube-1.1.1
|
||||
- name: install helm
|
||||
shell: curl -sLo /tmp/helm.tar.gz https://storage.googleapis.com/kubernetes-helm/helm-v2.13.1-linux-amd64.tar.gz && mkdir -p /tmp/helm && tar xzf /tmp/helm.tar.gz -C /tmp/helm && install -m 755 /tmp/helm/linux-amd64/helm /usr/local/bin/helm-2.13.1 && rm -rf /tmp/helm* && ln -sf /usr/local/bin/helm-2.13.1 /usr/local/bin/helm
|
||||
args:
|
||||
creates: /usr/local/bin/helm-2.13.1
|
||||
- name: install k9s
|
||||
shell: curl -sLo /tmp/k9s.tar.gz https://github.com/derailed/k9s/releases/download/0.6.7/k9s_0.6.7_Linux_x86_64.tar.gz && tar xzf /tmp/k9s.tar.gz -C /tmp && install -m 755 /tmp/k9s /usr/local/bin/k9s-0.6.7 && rm -f /tmp/k9s* && ln -sf /usr/local/bin/k9s-0.6.7 /usr/local/bin/k9s
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/k9s-0.6.7
|
||||
- name: install popeye
|
||||
shell: curl -sLo /tmp/popeye.tar.gz https://github.com/derailed/popeye/releases/download/v0.3.6/popeye_0.3.6_Linux_x86_64.tar.gz && tar xzf /tmp/popeye.tar.gz -C /tmp && install -m 755 /tmp/popeye /usr/local/bin/popeye-0.3.6 && rm -f /tmp/popeye* && ln -sf /usr/local/bin/popeye-0.3.6 /usr/local/bin/popeye
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/popeye-0.3.6
|
||||
- name: install stern
|
||||
shell: curl -sLo /tmp/stern_linux_amd64 https://github.com/wercker/stern/releases/download/1.10.0/stern_linux_amd64 && install -m 755 /tmp/stern_linux_amd64 /usr/local/bin/stern-1.10.0 && rm -f /tmp/stern_linux_amd64 && ln -sf /usr/local/bin/stern-1.10.0 /usr/local/bin/stern
|
||||
args:
|
||||
warn: False
|
||||
creates: /usr/local/bin/stern-1.10.0
|
|
@ -1,30 +0,0 @@
|
|||
---
|
||||
- name: add nextcloud pubkey
|
||||
shell: curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x60EE47FBAD3DD469" | sudo apt-key add
|
||||
args:
|
||||
warn: False
|
||||
- name: add nextcloud repo
|
||||
apt_repository:
|
||||
repo: "deb http://ppa.launchpad.net/nextcloud-devs/client/ubuntu bionic main"
|
||||
state: present
|
||||
update_cache: true
|
||||
- name: add openrazer repo
|
||||
apt_repository:
|
||||
repo: "deb http://ppa.launchpad.net/openrazer/stable/ubuntu bionic main"
|
||||
state: present
|
||||
update_cache: true
|
||||
- name: add polychromatic repo
|
||||
apt_repository:
|
||||
repo: "deb http://ppa.launchpad.net/openrazer/stable/ubuntu bionic main"
|
||||
state: present
|
||||
update_cache: true
|
||||
- name: install apt applications
|
||||
apt:
|
||||
name: openvpn,nextcloud-client,openrazer-meta,polychromatic
|
||||
state: present
|
||||
- name: install kitty terminal emulator
|
||||
become: no
|
||||
shell: curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin launch=n && ln -s ~/.local/kitty.app/bin/kitty ~/bin/ && mkdir -p ~/.local/share/applications && cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications && sed -i "s/Icon\=kitty/Icon\=\/home\/$USER\/.local\/kitty.app\/share\/icons\/hicolor\/256x256\/apps\/kitty.png/g" ~/.local/share/applications/kitty.desktop
|
||||
args:
|
||||
warn: False
|
||||
creates: ~/bin/kitty
|
Reference in New Issue