diff options
Diffstat (limited to 'users/profiles/k8s.nix')
| -rw-r--r-- | users/profiles/k8s.nix | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/users/profiles/k8s.nix b/users/profiles/k8s.nix new file mode 100644 index 0000000..ec59228 --- /dev/null +++ b/users/profiles/k8s.nix @@ -0,0 +1,91 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + kind # k8s in docker + kubebuilder # generate controller + kubectl + kubernetes-helm # deploy applications + kubie # kubeconfig browser https://github.com/sbstp/kubie + kubelogin-oidc # OIDC plugin + ]; + + programs.k9s = { + enable = true; + settings = { + k9s = { + refreshRate = 1; + }; + }; + plugin = { + plugins = { + log-bat = { + shortCut = "Shift-L"; + description = "Logs (bat)"; + scopes = [ "po" ]; + command = "bash"; + background = false; + args = [ + "-c" + "\"$@\" | bat" + "dummy-arg" + "kubectl" + "logs" + "$NAME" + "-n" + "$NAMESPACE" + "--context" + "$CONTEXT" + "--kubeconfig" + "$KUBECONFIG" + ]; + }; + log-bat-container = { + shortCut = "Shift-L"; + description = "Logs (bat)"; + scopes = [ "containers" ]; + command = "bash"; + background = false; + args = [ + "-c" + "\"$@\" | bat" + "dummy-arg" + "kubectl" + "logs" + "-c" + "$NAME" + "$POD" + "-n" + "$NAMESPACE" + "--context" + "$CONTEXT" + "--kubeconfig" + "$KUBECONFIG" + ]; + }; + }; + }; + }; + + home.file.kubie = { + target = ".kube/kubie.yaml"; + text = '' + shell: fish + configs: + include: + - ~/.kube/rksconfig + prompt: + fish_use_rprompt: false + ''; + }; + + programs.fish = { + shellAbbrs = { + k = "kubectl"; + kctx = "kubie ctx"; + klogs = "kubectl logs"; + }; + shellAliases = { + ukctx = "${pkgs.gh}/bin/gh api --hostname github.rbx.com repos/Roblox/cell-lifecycle/contents/rks/kubeconfig --jq '.content' | base64 -d > ~/.kube/rksconfig"; + }; + }; +} |
