2023-11-13 09:59:32 +00:00
|
|
|
# docker aliases
|
2023-11-24 09:14:42 +00:00
|
|
|
|
|
|
|
# lazydocker
|
2023-11-13 09:59:32 +00:00
|
|
|
alias ld = lazydocker
|
2023-11-24 09:14:42 +00:00
|
|
|
|
|
|
|
# docker-compose
|
2023-11-13 09:59:32 +00:00
|
|
|
alias dc = docker-compose
|
2023-11-24 09:14:42 +00:00
|
|
|
|
|
|
|
# docker-compose build
|
2023-11-13 09:59:32 +00:00
|
|
|
alias dcb = docker-compose build
|
2023-11-24 09:14:42 +00:00
|
|
|
|
|
|
|
# docker-compose build and push
|
2023-11-13 09:59:32 +00:00
|
|
|
def dcp [] { docker-compose build; docker-compose push }
|
2023-11-24 09:14:42 +00:00
|
|
|
|
|
|
|
# docker-compose up with build and remove-orphans
|
2023-11-13 09:59:32 +00:00
|
|
|
alias dcu = docker-compose up -d --build --remove-orphans
|
2023-11-24 09:14:42 +00:00
|
|
|
|
|
|
|
# docker-compose down
|
2023-11-13 09:59:32 +00:00
|
|
|
alias dcd = docker-compose down
|
2023-11-24 09:14:42 +00:00
|
|
|
|
|
|
|
# docker-compose down and up
|
2023-11-13 09:59:32 +00:00
|
|
|
def dcr [] { docker-compose down; docker-compose up -d --build --remove-orphans }
|
|
|
|
|
|
|
|
# kubernetes aliases
|
|
|
|
$env.KUBECONFIG = if ([$env.HOME, .kubes, current-cube] | path join | path exists) {
|
|
|
|
open ([$env.HOME, .kubes, current-cube] | path join)
|
|
|
|
} else {
|
|
|
|
""
|
|
|
|
}
|
|
|
|
|
|
|
|
def _kube_kubes [] {
|
|
|
|
_ls ~/.kubes | where type == dir | get name | path basename
|
|
|
|
}
|
|
|
|
|
2023-11-24 09:14:42 +00:00
|
|
|
# easily switch kube config
|
2023-11-17 15:26:15 +00:00
|
|
|
def --env kube [name?: string@_kube_kubes] {
|
2023-11-13 09:59:32 +00:00
|
|
|
use assert
|
|
|
|
|
|
|
|
let kubes_path = [$env.HOME, .kubes] | path join
|
|
|
|
|
|
|
|
if $name == null {
|
|
|
|
rm ([$kubes_path, current-cube] | path join)
|
|
|
|
$env.KUBECONFIG = ""
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
let kube_config = [$kubes_path, $name, config] | path join
|
|
|
|
|
|
|
|
if not ($kube_config | path exists) {
|
|
|
|
error make {msg: ($kube_config + " does not exist")}
|
|
|
|
}
|
|
|
|
|
|
|
|
$kube_config | save -f ([$kubes_path, current-cube] | path join)
|
|
|
|
$env.KUBECONFIG = $kube_config
|
|
|
|
}
|
|
|
|
|
2023-11-24 09:14:42 +00:00
|
|
|
# k9s
|
2023-11-22 09:01:27 +00:00
|
|
|
alias kns = k9s -n all
|
2023-11-13 09:59:32 +00:00
|
|
|
|
2023-11-24 09:14:42 +00:00
|
|
|
# start minikube with test kube
|
2023-11-22 08:57:20 +00:00
|
|
|
def "minikube start" [] {
|
|
|
|
$env.KUBECONFIG = ([$env.HOME, '.kubes', 'test', 'config'] | path join)
|
|
|
|
^minikube start
|
|
|
|
}
|
|
|
|
|
2023-11-24 09:14:42 +00:00
|
|
|
# stop minikube with test kube
|
2023-11-22 08:57:20 +00:00
|
|
|
def "minikube stop" [] {
|
|
|
|
$env.KUBECONFIG = ([$env.HOME, '.kubes', 'test', 'config'] | path join)
|
|
|
|
^minikube stop
|
|
|
|
}
|
|
|
|
|
2023-11-24 09:14:42 +00:00
|
|
|
# delete minikube with test kube
|
2023-11-22 08:57:20 +00:00
|
|
|
def "minikube delete" [] {
|
|
|
|
$env.KUBECONFIG = ([$env.HOME, '.kubes', 'test', 'config'] | path join)
|
|
|
|
^minikube delete
|
|
|
|
}
|