Skip to content

Commit

Permalink
kubectl stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mosheavni committed Sep 23, 2024
1 parent f6ab925 commit 1bfa5f8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
29 changes: 29 additions & 0 deletions .config/nvim/ftplugin/k8s_fallback.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
local commands = require 'kubectl.actions.commands'
local tables = require 'kubectl.utils.tables'

vim.schedule(function()
vim.api.nvim_buf_set_keymap(0, 'n', '<Plug>(kubectl.select)', '', {
noremap = true,
silent = true,
desc = 'Go to application',
callback = function()
local _, buf_name = pcall(vim.api.nvim_buf_get_var, 0, 'buf_name')
local lower_buf_name = string.lower(buf_name)

if lower_buf_name == 'applications.argoproj.io' then
local name = tables.getCurrentSelection(2)
if not name then
return
end
local ingress_host = commands.shell_command(
'kubectl',
{ 'get', 'ingress', '-n', 'argocd', '-l', 'app.kubernetes.io/component=server', '-o', 'jsonpath={.items[].spec.rules[].host}' }
)

local final_host = string.format('https://%s/applications/argocd/%s', ingress_host, name)
vim.notify('Opening ' .. final_host)
vim.ui.open(final_host)
end
end,
})
end)
18 changes: 9 additions & 9 deletions .config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"2048.nvim": { "branch": "main", "commit": "aee7c41a9a9473117465132768ae4b4da97435c3" },
"CursorLineCurrentWindow": { "branch": "master", "commit": "b4eeea98b0d139772969fd243a8802a9883fd2a8" },
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"SchemaStore.nvim": { "branch": "main", "commit": "6e2af7e093a4b92e3dce014aa1cbb5449ad1ebf9" },
"SchemaStore.nvim": { "branch": "main", "commit": "efa0466f9f7971256ad5da010832180fc7d8996b" },
"auto-indent.nvim": { "branch": "main", "commit": "46801cf8857d42a20a73c40b0a5d3dfe8b2b6192" },
"better-escape.nvim": { "branch": "master", "commit": "bb197e51a91a635deb88630813c3bfc284413697" },
"carbon-now.nvim": { "branch": "main", "commit": "f13c3c611a6aa22cca028bfe2cec63c7f67f2c87" },
Expand All @@ -24,13 +24,13 @@
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" },
"fzf-lua": { "branch": "main", "commit": "a34542d466b46be19198d16199e5245d27e89a9e" },
"git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" },
"git-dev.nvim": { "branch": "master", "commit": "57c62bdccbe35eba19532791218fc8fcc24d0d82" },
"gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" },
"go.nvim": { "branch": "master", "commit": "ff67641861acde0a9191e9ca85a0b13eac9d0b94" },
"greyjoy.nvim": { "branch": "main", "commit": "ec609828a5be0ab527685965d3e54fa6b31033da" },
"go.nvim": { "branch": "master", "commit": "2aa81c62bd58bb013f7b472297c2e8038de827d3" },
"greyjoy.nvim": { "branch": "main", "commit": "60ff1cbf0bee07f3037d4cd5043edc316c56cd43" },
"guihua.lua": { "branch": "master", "commit": "225db770e36aae6a1e9e3a65578095c8eb4038d3" },
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
"jsonpath.nvim": { "branch": "main", "commit": "2d889eb9c39893e030e902b854122a1615c042ea" },
Expand Down Expand Up @@ -67,15 +67,15 @@
"nvim-dap-virtual-text": { "branch": "master", "commit": "3497eb39bf413a57ab5b7e7e2e192683e462148c" },
"nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" },
"nvim-hlslens": { "branch": "main", "commit": "07afd4dd14405ad14b142a501a3abea6ae44b21b" },
"nvim-lspconfig": { "branch": "master", "commit": "f4fef355efa3c5d0813512480ee7b2c050b09fe4" },
"nvim-lspconfig": { "branch": "master", "commit": "efbfce341c9f546ca2a155a9316886fc1b80eace" },
"nvim-lua-gf": { "branch": "main", "commit": "ca712497b2bab6351518917be219e9bfd8d63e4f" },
"nvim-luaref": { "branch": "main", "commit": "9cd3ed50d5752ffd56d88dd9e395ddd3dc2c7127" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
"nvim-pqf": { "branch": "main", "commit": "148ee2ca8b06d83fd9bf6f9b9497724ad39a07d6" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-tree.lua": { "branch": "master", "commit": "8405ecfbd6bb08a94ffc9c68fef211eea56e8a3b" },
"nvim-treesitter": { "branch": "master", "commit": "929ca9c76ee20bb27cffbde4ee90583b6c54d616" },
"nvim-treesitter": { "branch": "master", "commit": "621f5901f0b3e762cc4c5ed0f9246cf1495193ad" },
"nvim-treesitter-context": { "branch": "master", "commit": "3d5390c49e3f8fe457b376df2a49aa39d75b7911" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
Expand All @@ -99,7 +99,7 @@
"vim-bufsurf": { "branch": "master", "commit": "e6dbc7ad66c7e436e5eb20d304464e378bd7f28c" },
"vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" },
"vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" },
"vim-dadbod-ui": { "branch": "master", "commit": "a5ff8bd69fcaf53cd24827b54492c8ce87806d18" },
"vim-dadbod-ui": { "branch": "master", "commit": "f29c85ab42861c6ef683289b0c6a51e0d436dcf6" },
"vim-dirdiff": { "branch": "master", "commit": "84bc8999fde4b3c2d8b228b560278ab30c7ea4c9" },
"vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" },
"vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" },
Expand All @@ -117,5 +117,5 @@
"yaml-companion.nvim": { "branch": "main", "commit": "8088feaaaa6c13895afe4615c6a9cc69206162c3" },
"yaml.nvim": { "branch": "main", "commit": "615985c1886644a4b2c0eebf985c1d1ae8257dd1" },
"yanky.nvim": { "branch": "main", "commit": "73215b77d22ebb179cef98e7e1235825431d10e4" },
"yazi.nvim": { "branch": "main", "commit": "0cd48311b0ea3b331bc56d636698973bffb7a8a9" }
"yazi.nvim": { "branch": "main", "commit": "1f8bcc422956e347d2fe5e2f1e323d45130ae399" }
}
1 change: 1 addition & 0 deletions .config/nvim/lua/plugins/kubectl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ return {
cmd = { 'Kubectl', 'Kubectx', 'Kubens' },
keys = {
{ '<leader>k', '<cmd>lua require("kubectl").toggle()<cr>' },
{ '<C-k>', '<Plug>(kubectl.kill)' },
},
}

0 comments on commit 1bfa5f8

Please sign in to comment.