From 511f0b808a1d4647f710db9824d651fbc2a5bc33 Mon Sep 17 00:00:00 2001 From: Noah Masur Date: Sun, 11 Apr 2021 20:05:25 -0400 Subject: [PATCH] vim kubernetes snippets --- nvim.configlink/init.vim | 25 +++++++++++++++++-- scripts/setup_fish | 14 +++++------ shell/templates/clusterrole.yaml | 8 ++++++ shell/templates/clusterrolebinding.yaml | 12 +++++++++ shell/templates/configmap.yaml | 8 ++++++ shell/templates/deployment.yaml | 33 +++++++++++++++++++++++++ shell/templates/role.yaml | 10 ++++++++ shell/templates/rolebinding.yaml | 13 ++++++++++ shell/templates/secret.yaml | 8 ++++++ shell/templates/service.yaml | 15 +++++++++++ shell/templates/serviceaccount.yaml | 5 ++++ 11 files changed, 142 insertions(+), 9 deletions(-) create mode 100644 shell/templates/clusterrole.yaml create mode 100644 shell/templates/clusterrolebinding.yaml create mode 100644 shell/templates/configmap.yaml create mode 100644 shell/templates/deployment.yaml create mode 100644 shell/templates/role.yaml create mode 100644 shell/templates/rolebinding.yaml create mode 100644 shell/templates/secret.yaml create mode 100644 shell/templates/service.yaml create mode 100644 shell/templates/serviceaccount.yaml diff --git a/nvim.configlink/init.vim b/nvim.configlink/init.vim index 1f496af..2a77a60 100644 --- a/nvim.configlink/init.vim +++ b/nvim.configlink/init.vim @@ -83,6 +83,10 @@ set undofile " Keeps undos after quit set backupdir=~/.config/nvim/dirs/backup set undodir=~/.config/nvim/dirs/undo +" Keep selection when tabbing +vnoremap < >gv + " Create backup directories if they don't exist if !isdirectory(&backupdir) call mkdir(&backupdir, "p") @@ -94,8 +98,8 @@ endif " Custom Commands "---------------- -command! Vimrc edit ~/.config/nvim/init.vim " Edit .vimrc (this file) -command! Refresh source ~/.config/nvim/init.vim " Refresh from .vimrc (this file) +command! Vimrc edit $MYVIMRC " Edit .vimrc (this file) +command! Refresh source $MYVIMRC " Refresh from .vimrc (this file) " Custom Keybinds "---------------- @@ -168,12 +172,29 @@ nnoremap rp :Refresh :PlugInstall " Open file tree noremap ft :Fern . -drawer -width=35 -toggle= +" Tabularize +nnoremap ta :Tabularize / +nnoremap t# :Tabularize /# +nnoremap t" :Tabularize /" + " Snippets "--------- +" Basic programming files nnoremap ,sh :-1read $DOTS/shell/templates/skeleton.shGdd03kC nnoremap ,py :-1read $DOTS/shell/templates/skeleton.pyGdd08kC +" Kubernetes +nnoremap ,cm :-1read $DOTS/shell/templates/configmap.yamlGdd0gg +nnoremap ,sec :-1read $DOTS/shell/templates/secret.yamlGdd0gg +nnoremap ,dep :-1read $DOTS/shell/templates/deployment.yamlGdd0gg +nnoremap ,svc :-1read $DOTS/shell/templates/service.yamlGdd0gg +nnoremap ,cro :-1read $DOTS/shell/templates/clusterrole.yamlGdd0gg +nnoremap ,crb :-1read $DOTS/shell/templates/clusterrolebinding.yamlGdd0gg +nnoremap ,ro :-1read $DOTS/shell/templates/role.yamlGdd0gg +nnoremap ,rb :-1read $DOTS/shell/templates/rolebinding.yamlGdd0gg +nnoremap ,sa :-1read $DOTS/shell/templates/serviceaccount.yamlGdd0gg + " LaTeX Settings "--------------- diff --git a/scripts/setup_fish b/scripts/setup_fish index 99bdc8a..0c9f367 100755 --- a/scripts/setup_fish +++ b/scripts/setup_fish @@ -1,12 +1,12 @@ #!/usr/bin/env fish -# Set $PATH for finding programs -set -U FISH_DIR (readlink ~/.config/fish) -set -Ux DOTS (dirname $FISH_DIR) -set -U CDPATH . $HOME -set -U EDITOR nvim -set -U PROJ $HOME/dev/work -set -Ux NOTES_PATH $HOME/notes +set -U FISH_DIR (readlink ~/.config/fish) # Used for getting to this repo +set -Ux DOTS (dirname $FISH_DIR) # Directory of this config repo +set -U CDPATH . $HOME # Directories available for immediate cd +set -U EDITOR nvim # Preferred text editor +set -U PROJ $HOME/dev/work # Projects directory +set -Ux NOTES_PATH $HOME/notes # Notes directory +set -Ux MANPAGER "nvim +Man!" # Used for reading man pages # Load abbreviations abbrs diff --git a/shell/templates/clusterrole.yaml b/shell/templates/clusterrole.yaml new file mode 100644 index 0000000..10fc326 --- /dev/null +++ b/shell/templates/clusterrole.yaml @@ -0,0 +1,8 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: +rules: + - apiGroups: [""] + resources: + verbs: [] diff --git a/shell/templates/clusterrolebinding.yaml b/shell/templates/clusterrolebinding.yaml new file mode 100644 index 0000000..3d5095e --- /dev/null +++ b/shell/templates/clusterrolebinding.yaml @@ -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 diff --git a/shell/templates/configmap.yaml b/shell/templates/configmap.yaml new file mode 100644 index 0000000..0dfc20a --- /dev/null +++ b/shell/templates/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: + namespace: default + annotations: + replicator.v1.mittwald.de/replicate-to: ".*" +data: diff --git a/shell/templates/deployment.yaml b/shell/templates/deployment.yaml new file mode 100644 index 0000000..204bcfc --- /dev/null +++ b/shell/templates/deployment.yaml @@ -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: diff --git a/shell/templates/role.yaml b/shell/templates/role.yaml new file mode 100644 index 0000000..395080d --- /dev/null +++ b/shell/templates/role.yaml @@ -0,0 +1,10 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: + namespace: default +rules: +- apiGroups: [""] + resourceNames: + resources: + verbs: diff --git a/shell/templates/rolebinding.yaml b/shell/templates/rolebinding.yaml new file mode 100644 index 0000000..6fcb96c --- /dev/null +++ b/shell/templates/rolebinding.yaml @@ -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 diff --git a/shell/templates/secret.yaml b/shell/templates/secret.yaml new file mode 100644 index 0000000..a8025a0 --- /dev/null +++ b/shell/templates/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: + namespace: default + annotations: + replicator.v1.mittwald.de/replicate-to: ".*" +data: diff --git a/shell/templates/service.yaml b/shell/templates/service.yaml new file mode 100644 index 0000000..e375f08 --- /dev/null +++ b/shell/templates/service.yaml @@ -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 diff --git a/shell/templates/serviceaccount.yaml b/shell/templates/serviceaccount.yaml new file mode 100644 index 0000000..1c89f57 --- /dev/null +++ b/shell/templates/serviceaccount.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: + namespace: default