From: Eshel Yaron Date: Thu, 25 Jul 2024 08:13:56 +0000 (+0200) Subject: Rename 'kubed-kubectl-executable' to '-program' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e4ef283345030b1a5285ecd109285718a033fd0f;p=emacs.git Rename 'kubed-kubectl-executable' to '-program' --- diff --git a/lisp/net/kubed.el b/lisp/net/kubed.el index 1e5aef557c0..9f0eb7b775c 100644 --- a/lisp/net/kubed.el +++ b/lisp/net/kubed.el @@ -57,7 +57,7 @@ "List of functions that `kubed-update-all' runs." :type 'hook) -(defcustom kubed-kubectl-executable "kubectl" +(defcustom kubed-kubectl-program "kubectl" "Name of `kubectl' executable to use for interacting with Kubernetes." :type 'string) @@ -290,7 +290,7 @@ Other keyword arguments that go between PROPERTIES and COMMANDS are: :buffer ,out-name :stderr ,err-name :command (list - kubed-kubectl-executable + kubed-kubectl-program "get" ,(format "%Ss" resource) ,@(when namespaced `((concat "--all-namespaces=" @@ -389,7 +389,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) (erase-buffer) (unless (zerop (call-process - kubed-kubectl-executable nil ,buf-name t "get" + kubed-kubectl-program nil ,buf-name t "get" (if k8sns (concat "--namespace=" k8sns) "--all-namespaces=false") @@ -407,7 +407,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) (erase-buffer) (unless (zerop (call-process - kubed-kubectl-executable nil ,buf-name t "get" + kubed-kubectl-program nil ,buf-name t "get" ,(symbol-name resource) "--output=yaml" ,resource)) (error ,(format "`kubectl get %S' failed" resource)))) (goto-char (point-min)) @@ -472,7 +472,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) (cons (concat "KUBE_EDITOR=" emacsclient-program-name) process-environment))) (start-process ,(format "*kubed-%S-edit*" plrl-var) nil - kubed-kubectl-executable "edit" + kubed-kubectl-program "edit" (if k8sns (concat "--namespace=" k8sns) "-o=yaml") @@ -485,7 +485,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) (cons (concat "KUBE_EDITOR=" emacsclient-program-name) process-environment))) (start-process ,(format "*kubed-%S-edit*" plrl-var) nil - kubed-kubectl-executable "edit" + kubed-kubectl-program "edit" ,(symbol-name resource) ,resource)))) ,(if namespaced @@ -504,7 +504,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) " `%s' in namespace `%s'...") name space) (if (zerop (call-process - kubed-kubectl-executable nil nil nil + kubed-kubectl-program nil nil nil "delete" "--namespace" space ,(symbol-name plrl-var) name)) (message ,(concat "Deleting Kubernetes " @@ -520,7 +520,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) " `%s'...") (string-join ,plrl-var "', `")) (if (zerop (apply #'call-process - kubed-kubectl-executable nil nil nil + kubed-kubectl-program nil nil nil "delete" ,(symbol-name plrl-var) ,plrl-var)) (message ,(concat "Deleting Kubernetes " (symbol-name plrl-var) @@ -541,7 +541,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) " `%s'...") (string-join ,plrl-var "', `")) (if (zerop (apply #'call-process - kubed-kubectl-executable nil nil nil + kubed-kubectl-program nil nil nil "delete" ,(symbol-name plrl-var) ,plrl-var)) (message ,(concat "Deleting Kubernetes " (symbol-name plrl-var) @@ -604,7 +604,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) (make-process :name ,(format "*kubed-%Ss-execute*" resource) :stderr ,dlt-errb - :command (list kubed-kubectl-executable + :command (list kubed-kubectl-program "delete" "--namespace" space ,(symbol-name plrl-var) @@ -634,7 +634,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) :name ,(format "*kubed-%Ss-execute*" resource) :stderr ,dlt-errb :command (append - (list kubed-kubectl-executable + (list kubed-kubectl-program "delete" ,(symbol-name plrl-var)) delete-list) :sentinel (lambda (_proc status) @@ -660,7 +660,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) :name ,(format "*kubed-%Ss-execute*" resource) :stderr ,dlt-errb :command (append - (list kubed-kubectl-executable + (list kubed-kubectl-program "delete" ,(symbol-name plrl-var)) delete-list) :sentinel (lambda (_proc status) @@ -869,7 +869,7 @@ Optional argument DEFAULT is the minibuffer default argument." resource) (interactive (list (read-string "Create namespace with name: "))) (unless (zerop (call-process - kubed-kubectl-executable nil nil nil + kubed-kubectl-program nil nil nil "create" "namespace" name)) (user-error "Failed to create Kubernetes namespace with name `%s'" name)) (message "Created Kubernetes namespace with name `%s'." name) @@ -964,7 +964,7 @@ optional command to run in the images." (list name images namespace replicas port command))) (unless (zerop (apply #'call-process - kubed-kubectl-executable nil nil nil + kubed-kubectl-program nil nil nil "create" "deployment" name (append (mapcar (lambda (image) (concat "--image=" image)) images) @@ -1006,11 +1006,11 @@ optional command to run in the images." (defun kubed-contexts () "Return list of Kubernetes contexts." - (process-lines kubed-kubectl-executable "config" "get-contexts" "-o" "name")) + (process-lines kubed-kubectl-program "config" "get-contexts" "-o" "name")) (defun kubed-current-context () "Return current Kubernetes context." - (car (process-lines kubed-kubectl-executable "config" "current-context"))) + (car (process-lines kubed-kubectl-program "config" "current-context"))) (defvar kubed-context-history nil "History list for `kubed-read-context'.") @@ -1030,7 +1030,7 @@ Optional argument DEFAULT is the minibuffer default argument." (list (kubed-read-context "Use context" (kubed-current-context)))) (unless (zerop (call-process - kubed-kubectl-executable nil nil nil + kubed-kubectl-program nil nil nil "config" "use-context" context)) (user-error "Failed to use Kubernetes context `%s'" context)) (message "Now using Kubernetes context `%s'." context) @@ -1039,7 +1039,7 @@ Optional argument DEFAULT is the minibuffer default argument." (defun kubed-current-namespace (&optional context) "Return current Kubernetes namespace for context CONTEXT." (car (process-lines - kubed-kubectl-executable + kubed-kubectl-program "config" "view" "-o" (format "jsonpath={.contexts[?(.name==\"%s\")].context.namespace}" (or context (kubed-current-context)))))) @@ -1051,7 +1051,7 @@ Optional argument DEFAULT is the minibuffer default argument." (list (kubed-read-namespace "Set namespace" (kubed-current-namespace)))) (unless (zerop (call-process - kubed-kubectl-executable nil nil nil + kubed-kubectl-program nil nil nil "config" "set-context" "--current" "--namespace" ns)) (user-error "Failed to set Kubernetes namespace to `%s'" ns)) (message "Kubernetes namespace is now `%s'." ns) @@ -1123,7 +1123,7 @@ completion candidates." (message "Creating Kubernetes %s with definition `%s'..." kind definition) (message "Creating Kubernetes %s with definition `%s'... Done. New %s name is `%s'." kind definition kind - (car (process-lines kubed-kubectl-executable + (car (process-lines kubed-kubectl-program "create" "-f" (expand-file-name definition) "-o" "jsonpath={.metadata.name}"))))) @@ -1131,7 +1131,7 @@ completion candidates." "Return list of containers in Kubernetes pod POD in namespace K8SNS." (string-split (car (process-lines - kubed-kubectl-executable "get" + kubed-kubectl-program "get" (if k8sns (concat "--namespace=" k8sns) "--all-namespaces=false") "pod" pod "-o" "jsonpath={.spec.containers[*].name}")) " ")) @@ -1139,7 +1139,7 @@ completion candidates." (defun kubed-pod-default-container (pod &optional k8sns) "Return default container of Kubernetes pod POD in namespace K8SNS, or nil." (car (process-lines - kubed-kubectl-executable + kubed-kubectl-program "get" (if k8sns (concat "--namespace=" k8sns) "--all-namespaces=false") "pod" pod "-o" @@ -1191,7 +1191,7 @@ use it; otherwise, fall back to prompting." (message "Getting logs for container `%s' in pod `%s' in namespace `%s'..." container pod k8sns) (message "Getting logs for container `%s' in pod `%s'..." container pod)) (start-process "*kubed-logs*" buf - kubed-kubectl-executable "logs" + kubed-kubectl-program "logs" (if k8sns (concat "--namespace=" k8sns) "--tail=-1") "-f" "-c" container pod) (display-buffer buf))) @@ -1230,7 +1230,7 @@ use it; otherwise, fall back to prompting." pod local-port remote-port (if k8sns (concat " in " k8sns) "")) (start-process "*kubed-port-forward*" nil - kubed-kubectl-executable "port-forward" + kubed-kubectl-program "port-forward" (if k8sns (concat "--namespace=" k8sns) "--address=localhost") pod (format "%d:%d" local-port remote-port))) kubed-port-forward-process-alist))