(message "Now using Kubernetes context `%s'." context)
(kubed-update-all))
-(defun kubed-current-namespace ()
- "Return current Kubernetes namespace."
- (car (process-lines kubed-kubectl-executable
- "config" "view" "-o" "jsonpath={..namespace}")))
+(defun kubed-current-namespace (&optional context)
+ "Return current Kubernetes namespace for context CONTEXT."
+ (car (process-lines
+ kubed-kubectl-executable
+ "config" "view" "-o"
+ (format "jsonpath={.contexts[?(.name==\"%s\")].context.namespace}"
+ (or context (kubed-current-context))))))
;;;###autoload
(defun kubed-set-namespace (ns)