mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-06 04:54:29 +08:00
Get initial namespace from k8s context in the k8s runtime settings (#2838)
This commit is contained in:
parent
9a2bcfd751
commit
ce1b56ee37
1 changed files with 2 additions and 1 deletions
|
@ -536,6 +536,7 @@ defmodule LivebookWeb.SessionLive.K8sRuntimeComponent do
|
|||
|
||||
def handle_async(:cluster_check, {:ok, results}, socket) do
|
||||
[access_review_result, namespaces_result] = results
|
||||
context_namespace = socket.assigns.kubeconfig.current_namespace
|
||||
|
||||
access_review_result =
|
||||
case access_review_result do
|
||||
|
@ -548,7 +549,7 @@ defmodule LivebookWeb.SessionLive.K8sRuntimeComponent do
|
|||
case namespaces_result do
|
||||
{:ok, namespaces} ->
|
||||
namespace_options = Enum.map(namespaces, & &1.name)
|
||||
{:ok, namespace_options, List.first(namespace_options)}
|
||||
{:ok, namespace_options, context_namespace || List.first(namespace_options)}
|
||||
|
||||
{:error, %{status: 403}} ->
|
||||
# No access to list namespaces, we will show an input instead
|
||||
|
|
Loading…
Add table
Reference in a new issue