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