2023-01-15 18:03:03 +00:00
|
|
|
;;; kustomize.el --- quickly test and render kustomize overlays
|
|
|
|
;; Copyright (C) 2023 Gabriel Simmer
|
|
|
|
|
|
|
|
;; Author: Gabriel Simmer <gsimmer@protonmail.com>
|
|
|
|
;; Version: 0.0.100m
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; Render a Kustomization and display in a buffer.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
(defun render-kustomize (path)
|
|
|
|
(shell-command-to-string (concat "kubectl kustomize" " " path)))
|
|
|
|
|
|
|
|
(defun kustomize (&optional path) (interactive)
|
|
|
|
(or path (setq path ""))
|
|
|
|
(let ((buff (get-buffer-create "*kustomize*")))
|
|
|
|
(display-buffer buff
|
|
|
|
'(display-buffer-in-side-window . ((side . right))))
|
|
|
|
(with-current-buffer buff
|
2023-01-17 17:51:23 +00:00
|
|
|
(erase-buffer)
|
|
|
|
(insert (render-kustomize path))
|
2023-01-15 18:03:03 +00:00
|
|
|
(if (fboundp 'k8s-mode) (k8s-mode) (yaml-mode)))))
|
|
|
|
|
2023-01-15 18:14:22 +00:00
|
|
|
(global-set-key (kbd "C-c k") 'kustomize)
|
|
|
|
|
2023-01-15 18:03:03 +00:00
|
|
|
(provide 'kustomize)
|
|
|
|
;;; kustomize.el ends here
|