From e4b0b2fec1a5cc0644cf29a10e4e80bdd559bbbd Mon Sep 17 00:00:00 2001 From: mrbobbytables Date: Sat, 19 Sep 2026 21:18:51 +0000 Subject: [PATCH] feat(k0s): deploy default ControlPlane instances and unpin dev mode in kiosk console Define initial default ControlPlane resources in files/k0s/manifests/kubestellar/35-default-controlplane.yaml for its1 (type: host, exposing the local k0s hosting cluster) and wds1 (type: k8s, backend: shared) so real workloads and control planes are discovered on first boot. Omit DEV_MODE, ALLOW_DEV_MODE_IN_CLUSTER, and DEV_USER_LOGIN from files/k0s/manifests/kubestellar/40-kubestellar-console.yaml. Invert test_kubestellar_kiosk contract assertions to ensure demo mode is excluded and OAuth secret configuration is preserved. Update test_k0s_manifests to validate the default ControlPlane manifest. Fixes #196 Assisted-by: Gemini 3.8 Flash via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: mrbobbytables --- .../kubestellar/35-default-controlplane.yaml | 38 +++++++++++++++++++ .../kubestellar/40-kubestellar-console.yaml | 6 --- tests/unit/test_k0s_manifests.py | 12 ++++++ tests/unit/test_kubestellar_kiosk.py | 7 ++-- 4 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 files/k0s/manifests/kubestellar/35-default-controlplane.yaml diff --git a/files/k0s/manifests/kubestellar/35-default-controlplane.yaml b/files/k0s/manifests/kubestellar/35-default-controlplane.yaml new file mode 100644 index 00000000..e505605f --- /dev/null +++ b/files/k0s/manifests/kubestellar/35-default-controlplane.yaml @@ -0,0 +1,38 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: its1-system + labels: + app.kubernetes.io/part-of: kubestellar +--- +apiVersion: tenancy.kflex.kubestellar.org/v1alpha1 +kind: ControlPlane +metadata: + name: its1 + labels: + app.kubernetes.io/name: controlplane + app.kubernetes.io/instance: its1 + app.kubernetes.io/part-of: kubestellar + kflex.kubestellar.org/role: its +spec: + type: host +--- +apiVersion: v1 +kind: Namespace +metadata: + name: wds1-system + labels: + app.kubernetes.io/part-of: kubestellar +--- +apiVersion: tenancy.kflex.kubestellar.org/v1alpha1 +kind: ControlPlane +metadata: + name: wds1 + labels: + app.kubernetes.io/name: controlplane + app.kubernetes.io/instance: wds1 + app.kubernetes.io/part-of: kubestellar + kflex.kubestellar.org/role: wds +spec: + type: k8s + backend: shared diff --git a/files/k0s/manifests/kubestellar/40-kubestellar-console.yaml b/files/k0s/manifests/kubestellar/40-kubestellar-console.yaml index fc502bdf..b5379c4f 100644 --- a/files/k0s/manifests/kubestellar/40-kubestellar-console.yaml +++ b/files/k0s/manifests/kubestellar/40-kubestellar-console.yaml @@ -42,12 +42,6 @@ spec: - name: console image: ghcr.io/kubestellar/console:v0.3.34 env: - - name: DEV_MODE - value: "true" - - name: ALLOW_DEV_MODE_IN_CLUSTER - value: "true" - - name: DEV_USER_LOGIN - value: "admin" - name: GITHUB_CLIENT_ID valueFrom: secretKeyRef: diff --git a/tests/unit/test_k0s_manifests.py b/tests/unit/test_k0s_manifests.py index 149ca421..39c5d541 100644 --- a/tests/unit/test_k0s_manifests.py +++ b/tests/unit/test_k0s_manifests.py @@ -36,10 +36,22 @@ def test_k0s_manifest_files(): assert (ks_dir / "10-kubeflex-operator.yaml").is_file() assert (ks_dir / "20-postgres.yaml").is_file() assert (ks_dir / "30-kubestellar-core.yaml").is_file() + assert (ks_dir / "35-default-controlplane.yaml").is_file() assert (ks_dir / "40-kubestellar-console.yaml").is_file() assert (ks_dir / "41-kubestellar-kiosk-proxy.yaml").is_file() +def test_default_controlplanes_manifest(): + manifest = ROOT / "files" / "k0s" / "manifests" / "kubestellar" / "35-default-controlplane.yaml" + assert manifest.is_file(), "35-default-controlplane.yaml missing" + docs = list(yaml.safe_load_all(manifest.read_text())) + controlplanes = [d for d in docs if d and d.get("kind") == "ControlPlane"] + assert len(controlplanes) >= 2 + types_by_name = {cp["metadata"]["name"]: cp["spec"]["type"] for cp in controlplanes} + assert types_by_name.get("its1") == "host" + assert types_by_name.get("wds1") == "k8s" + + def test_postgres_password_not_hardcoded(): # #98: the postgres superuser password must not be committed to git in # plaintext, and must not be the publicly documented kubeflex default. diff --git a/tests/unit/test_kubestellar_kiosk.py b/tests/unit/test_kubestellar_kiosk.py index ec608c72..272bb2bc 100644 --- a/tests/unit/test_kubestellar_kiosk.py +++ b/tests/unit/test_kubestellar_kiosk.py @@ -80,12 +80,11 @@ def test_gate_waits_for_session_and_blocks_until_agent_health() -> None: assert "z-index: 2147483647" in css -def test_console_provides_local_and_oauth_login_options() -> None: +def test_console_uses_github_oauth_secret_without_demo_mode() -> None: console = CONSOLE_MANIFEST.read_text(encoding="utf-8") - assert "name: DEV_MODE" in console - assert 'value: "true"' in console - assert "name: ALLOW_DEV_MODE_IN_CLUSTER" in console + assert "DEV_MODE" not in console + assert "ALLOW_DEV_MODE_IN_CLUSTER" not in console assert "hostPort:" not in console assert "name: GITHUB_CLIENT_ID" in console assert "name: GITHUB_CLIENT_SECRET" in console