fedora-csb-system-manager
 1;;; programming-containers.el --- -*- lexical-binding: t; -*-
 2;;; Commentary:
 3;;; Containers configuration
 4;;; Code:
 5(use-package dockerfile-mode
 6  :mode ("Dockerfile\\'" . dockerfile-mode))
 7
 8;; I have a bunch of different 'profiles' for kubernetes by different cluster so
 9;; i don't mess between things
10;; This allow me to set the KUBECONFIG variable between those easily
11;; TODO: add the current profile in modeline
12(defun my-switch-kubeconfig-env (&optional kubeconfig)
13  "Set KUBECONFIG environment variable for the current session"
14  (interactive
15   (list
16    (completing-read
17     "Kubeconfig: "
18     (mapcar
19      (lambda (x)
20        (replace-regexp-in-string
21         "^config\." ""
22         (file-name-nondirectory(directory-file-name x))))
23      (directory-files-recursively
24       (expand-file-name "~/.kube") "^config\.")) nil t )))
25  (setq kubeconfig (expand-file-name (format "~/.kube/config.%s" kubeconfig)))
26  (if (file-exists-p kubeconfig)
27      (setenv "KUBECONFIG" kubeconfig)
28    (error "Cannot find kubeconfig: %s" kubeconfig)))
29
30(provide 'programming-containers)
31;;; programming-containers.el ends here