vim kubernetes snippets

This commit is contained in:
Noah Masur 2021-04-11 20:05:25 -04:00
parent b04e8387c3
commit 511f0b808a
11 changed files with 142 additions and 9 deletions

View File

@ -83,6 +83,10 @@ set undofile " Keeps undos after quit
set backupdir=~/.config/nvim/dirs/backup set backupdir=~/.config/nvim/dirs/backup
set undodir=~/.config/nvim/dirs/undo set undodir=~/.config/nvim/dirs/undo
" Keep selection when tabbing
vnoremap < <gv
vnoremap > >gv
" Create backup directories if they don't exist " Create backup directories if they don't exist
if !isdirectory(&backupdir) if !isdirectory(&backupdir)
call mkdir(&backupdir, "p") call mkdir(&backupdir, "p")
@ -94,8 +98,8 @@ endif
" Custom Commands " Custom Commands
"---------------- "----------------
command! Vimrc edit ~/.config/nvim/init.vim " Edit .vimrc (this file) command! Vimrc edit $MYVIMRC " Edit .vimrc (this file)
command! Refresh source ~/.config/nvim/init.vim " Refresh from .vimrc (this file) command! Refresh source $MYVIMRC " Refresh from .vimrc (this file)
" Custom Keybinds " Custom Keybinds
"---------------- "----------------
@ -168,12 +172,29 @@ nnoremap <Leader>rp :Refresh<cr> :PlugInstall<cr>
" Open file tree " Open file tree
noremap <silent> <Leader>ft :Fern . -drawer -width=35 -toggle<CR><C-w>= noremap <silent> <Leader>ft :Fern . -drawer -width=35 -toggle<CR><C-w>=
" Tabularize
nnoremap <Leader>ta :Tabularize /
nnoremap <Leader>t# :Tabularize /#<CR>
nnoremap <Leader>t" :Tabularize /"<CR>
" Snippets " Snippets
"--------- "---------
" Basic programming files
nnoremap ,sh :-1read $DOTS/shell/templates/skeleton.sh<CR>Gdd03kC nnoremap ,sh :-1read $DOTS/shell/templates/skeleton.sh<CR>Gdd03kC
nnoremap ,py :-1read $DOTS/shell/templates/skeleton.py<CR>Gdd08kC nnoremap ,py :-1read $DOTS/shell/templates/skeleton.py<CR>Gdd08kC
" Kubernetes
nnoremap ,cm :-1read $DOTS/shell/templates/configmap.yaml<CR>Gdd0gg
nnoremap ,sec :-1read $DOTS/shell/templates/secret.yaml<CR>Gdd0gg
nnoremap ,dep :-1read $DOTS/shell/templates/deployment.yaml<CR>Gdd0gg
nnoremap ,svc :-1read $DOTS/shell/templates/service.yaml<CR>Gdd0gg
nnoremap ,cro :-1read $DOTS/shell/templates/clusterrole.yaml<CR>Gdd0gg
nnoremap ,crb :-1read $DOTS/shell/templates/clusterrolebinding.yaml<CR>Gdd0gg
nnoremap ,ro :-1read $DOTS/shell/templates/role.yaml<CR>Gdd0gg
nnoremap ,rb :-1read $DOTS/shell/templates/rolebinding.yaml<CR>Gdd0gg
nnoremap ,sa :-1read $DOTS/shell/templates/serviceaccount.yaml<CR>Gdd0gg
" LaTeX Settings " LaTeX Settings
"--------------- "---------------

View File

@ -1,12 +1,12 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# Set $PATH for finding programs set -U FISH_DIR (readlink ~/.config/fish) # Used for getting to this repo
set -U FISH_DIR (readlink ~/.config/fish) set -Ux DOTS (dirname $FISH_DIR) # Directory of this config repo
set -Ux DOTS (dirname $FISH_DIR) set -U CDPATH . $HOME # Directories available for immediate cd
set -U CDPATH . $HOME set -U EDITOR nvim # Preferred text editor
set -U EDITOR nvim set -U PROJ $HOME/dev/work # Projects directory
set -U PROJ $HOME/dev/work set -Ux NOTES_PATH $HOME/notes # Notes directory
set -Ux NOTES_PATH $HOME/notes set -Ux MANPAGER "nvim +Man!" # Used for reading man pages
# Load abbreviations # Load abbreviations
abbrs abbrs

View File

@ -0,0 +1,8 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name:
rules:
- apiGroups: [""]
resources:
verbs: []

View File

@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name:
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name:
subjects:
- kind: ServiceAccount
name:
namespace: default

View File

@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name:
namespace: default
annotations:
replicator.v1.mittwald.de/replicate-to: ".*"
data:

View File

@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name:
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app:
template:
metadata:
labels:
app:
spec:
serviceAccountName:
containers:
- name:
image:
imagePullPolicy: Always
envFrom:
- configMapRef:
name:
- secretRef:
name:
ports:
- containerPort:
protocol: TCP
resources:
limits:
cpu:
requests:
cpu:

10
shell/templates/role.yaml Normal file
View File

@ -0,0 +1,10 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name:
namespace: default
rules:
- apiGroups: [""]
resourceNames:
resources:
verbs:

View File

@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name:
namespace: default
roleRef:
kind:
name:
apiGroup: rbac.authorization.k8s.io
subjects:
- kind:
name:
apiGroup: rbac.authorization.k8s.io

View File

@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name:
namespace: default
annotations:
replicator.v1.mittwald.de/replicate-to: ".*"
data:

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
annotations:
alb.ingress.kubernetes.io/healthcheck-path:
name:
namespace: default
spec:
ports:
- port: 443
protocol: TCP
targetPort: 80
selector:
app:
type: NodePort

View File

@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name:
namespace: default