mirror of
https://github.com/dredx/prole.git
synced 2026-09-27 15:54:30 +00:00
chore: update prole.cfg defaults for dev cluster, refine config overrides
- Updated default paths, namespaces, and cluster names for k3d/dev configuration. - Added `skip_names` set to exclude `prod.cfg` and `gcp.cfg` from override processing. - Refined init parameters for Supabase, Kubernetes, and database deployments to align with dev-specific settings. - Enhanced test coverage for excluded config files (`prod.cfg`, `gcp.cfg`) within `test_prole_conf.py`.
This commit is contained in:
parent
138a01c181
commit
090b0e882a
@ -4749,8 +4749,9 @@ class KnoeConsoleInstaller(KnoeInstaller):
|
|||||||
if self._deployment_mode() != "k8s":
|
if self._deployment_mode() != "k8s":
|
||||||
return True
|
return True
|
||||||
|
|
||||||
cmd_base, gcloud_env = inst_config._gcloud_plain(os.environ.copy())
|
gcloud_env = inst_config._augment_env_for_brew(os.environ.copy())
|
||||||
token_cmd = list(cmd_base) + ["auth", "print-access-token", "--quiet"]
|
cmd_base = ["gcloud"]
|
||||||
|
token_cmd = cmd_base + ["auth", "print-access-token", "--quiet"]
|
||||||
try:
|
try:
|
||||||
token_res = subprocess.run(
|
token_res = subprocess.run(
|
||||||
token_cmd,
|
token_cmd,
|
||||||
@ -4766,7 +4767,7 @@ class KnoeConsoleInstaller(KnoeInstaller):
|
|||||||
|
|
||||||
interactive = bool(getattr(sys.stdin, "isatty", lambda: False)())
|
interactive = bool(getattr(sys.stdin, "isatty", lambda: False)())
|
||||||
if interactive:
|
if interactive:
|
||||||
login_cmd = list(cmd_base) + ["auth", "login", "--no-launch-browser"]
|
login_cmd = cmd_base + ["auth", "login", "--no-launch-browser"]
|
||||||
self.log(
|
self.log(
|
||||||
"[ACTION] No active gcloud session found. Starting login flow: "
|
"[ACTION] No active gcloud session found. Starting login flow: "
|
||||||
+ " ".join(shlex.quote(part) for part in login_cmd)
|
+ " ".join(shlex.quote(part) for part in login_cmd)
|
||||||
|
|||||||
@ -130,8 +130,9 @@ class DependenciesMilestone(Milestone):
|
|||||||
if cluster_env not in {"prod", "production", "k8s"}:
|
if cluster_env not in {"prod", "production", "k8s"}:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
cmd_base, gcloud_env = inst_config._gcloud_plain(os.environ.copy())
|
gcloud_env = inst_config._augment_env_for_brew(os.environ.copy())
|
||||||
token_cmd = list(cmd_base) + ["auth", "print-access-token", "--quiet"]
|
cmd_base = ["gcloud"]
|
||||||
|
token_cmd = cmd_base + ["auth", "print-access-token", "--quiet"]
|
||||||
try:
|
try:
|
||||||
token_res = subprocess.run(
|
token_res = subprocess.run(
|
||||||
token_cmd,
|
token_cmd,
|
||||||
@ -147,7 +148,7 @@ class DependenciesMilestone(Milestone):
|
|||||||
|
|
||||||
interactive = bool(getattr(sys.stdin, "isatty", lambda: False)())
|
interactive = bool(getattr(sys.stdin, "isatty", lambda: False)())
|
||||||
if interactive:
|
if interactive:
|
||||||
login_cmd = list(cmd_base) + ["auth", "login", "--no-launch-browser"]
|
login_cmd = cmd_base + ["auth", "login", "--no-launch-browser"]
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"[ACTION] No active gcloud session found. Starting login flow: %s",
|
"[ACTION] No active gcloud session found. Starting login flow: %s",
|
||||||
" ".join(shlex.quote(part) for part in login_cmd),
|
" ".join(shlex.quote(part) for part in login_cmd),
|
||||||
|
|||||||
@ -42,14 +42,7 @@ public class KerberosPasswordService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class FixedCallbackHandler implements CallbackHandler {
|
private record FixedCallbackHandler(String principal, char[] password) implements CallbackHandler {
|
||||||
private final String principal;
|
|
||||||
private final char[] password;
|
|
||||||
|
|
||||||
private FixedCallbackHandler(String principal, char[] password) {
|
|
||||||
this.principal = principal;
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
|
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
|
||||||
|
|||||||
@ -69,10 +69,10 @@ public class LoginController {
|
|||||||
String safeNext = safeNext(next).toString();
|
String safeNext = safeNext(next).toString();
|
||||||
String html = """
|
String html = """
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang=\"en\">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset=\"utf-8\"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<title>Prole Login</title>
|
<title>Prole Login</title>
|
||||||
<style>
|
<style>
|
||||||
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; max-width: 720px; margin: 40px auto; padding: 0 16px; }
|
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; max-width: 720px; margin: 40px auto; padding: 0 16px; }
|
||||||
@ -85,20 +85,20 @@ public class LoginController {
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Prole Login</h1>
|
<h1>Prole Login</h1>
|
||||||
<div class=\"box\">
|
<div class="box">
|
||||||
<h2>Kerberos (recommended)</h2>
|
<h2>Kerberos (recommended)</h2>
|
||||||
<p>If your browser is configured for Kerberos/SPNEGO, use this.</p>
|
<p>If your browser is configured for Kerberos/SPNEGO, use this.</p>
|
||||||
<p><a href=\"/auth/spnego?next=%s\"><button>Login with Kerberos</button></a></p>
|
<p><a href="/auth/spnego?next=%s"><button>Login with Kerberos</button></a></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=\"box\">
|
<div class="box">
|
||||||
<h2>Fallback form</h2>
|
<h2>Fallback form</h2>
|
||||||
<p>Only available when enabled by configuration.</p>
|
<p>Only available when enabled by configuration.</p>
|
||||||
<form method=\"post\" action=\"/auth/form\">
|
<form method="post" action="/auth/form">
|
||||||
<input type=\"hidden\" name=\"next\" value=\"%s\"/>
|
<input type="hidden" name="next" value="%s"/>
|
||||||
<div class=\"row\"><label>Username</label><input name=\"username\" autocomplete=\"username\"/></div>
|
<div class="row"><label>Username</label><input name="username" autocomplete="username"/></div>
|
||||||
<div class=\"row\"><label>Password</label><input name=\"password\" type=\"password\" autocomplete=\"current-password\"/></div>
|
<div class="row"><label>Password</label><input name="password" type="password" autocomplete="current-password"/></div>
|
||||||
<button type=\"submit\">Login</button>
|
<button type="submit">Login</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -257,7 +257,7 @@ class TestServiceNamespace:
|
|||||||
inst = _TestableInstaller()
|
inst = _TestableInstaller()
|
||||||
with mock.patch.dict(os.environ, {}, clear=False):
|
with mock.patch.dict(os.environ, {}, clear=False):
|
||||||
os.environ.pop("SERVICE_NAMESPACE", None)
|
os.environ.pop("SERVICE_NAMESPACE", None)
|
||||||
assert inst._service_namespace() == "default"
|
assert inst._service_namespace() == "knoe-system"
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -1041,10 +1041,18 @@ class TestStepDependencies:
|
|||||||
|
|
||||||
inst = _TestableSilentInstaller(inputs={"init_cluster.cluster_env": "prod"})
|
inst = _TestableSilentInstaller(inputs={"init_cluster.cluster_env": "prod"})
|
||||||
|
|
||||||
|
def _unexpected_gcloud_plain(*_a, **_k):
|
||||||
|
raise AssertionError("_gcloud_plain should not be called for auth preflight")
|
||||||
|
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
actions_mod.inst_config,
|
actions_mod.inst_config,
|
||||||
"_gcloud_plain",
|
"_gcloud_plain",
|
||||||
lambda _env: (["gcloud"], {"PATH": "x"}),
|
_unexpected_gcloud_plain,
|
||||||
|
)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
actions_mod.inst_config,
|
||||||
|
"_augment_env_for_brew",
|
||||||
|
lambda _env: {"PATH": "x"},
|
||||||
)
|
)
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
actions_mod.subprocess,
|
actions_mod.subprocess,
|
||||||
@ -1066,10 +1074,18 @@ class TestStepDependencies:
|
|||||||
|
|
||||||
inst = _TestableSilentInstaller(inputs={"init_cluster.cluster_env": "prod"})
|
inst = _TestableSilentInstaller(inputs={"init_cluster.cluster_env": "prod"})
|
||||||
|
|
||||||
|
def _unexpected_gcloud_plain(*_a, **_k):
|
||||||
|
raise AssertionError("_gcloud_plain should not be called for auth preflight")
|
||||||
|
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
actions_mod.inst_config,
|
actions_mod.inst_config,
|
||||||
"_gcloud_plain",
|
"_gcloud_plain",
|
||||||
lambda _env: (["gcloud"], {"PATH": "x"}),
|
_unexpected_gcloud_plain,
|
||||||
|
)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
actions_mod.inst_config,
|
||||||
|
"_augment_env_for_brew",
|
||||||
|
lambda _env: {"PATH": "x"},
|
||||||
)
|
)
|
||||||
responses = [
|
responses = [
|
||||||
subprocess.CompletedProcess([], 1, stdout="", stderr="no auth"),
|
subprocess.CompletedProcess([], 1, stdout="", stderr="no auth"),
|
||||||
|
|||||||
@ -660,9 +660,13 @@ def test_dependencies_k8s_fails_without_gcloud_auth_session():
|
|||||||
|
|
||||||
no_token = MagicMock(returncode=1, stdout="", stderr="not logged in")
|
no_token = MagicMock(returncode=1, stdout="", stderr="not logged in")
|
||||||
|
|
||||||
|
def _unexpected_gcloud_plain(*_a, **_k):
|
||||||
|
raise AssertionError("_gcloud_plain should not be called for auth preflight")
|
||||||
|
|
||||||
with patch("knoe.config.get_dep_info", return_value=(True, "/usr/bin/gcloud", "1.0")), \
|
with patch("knoe.config.get_dep_info", return_value=(True, "/usr/bin/gcloud", "1.0")), \
|
||||||
patch("knoe.config.DEPENDENCIES", [dep]), \
|
patch("knoe.config.DEPENDENCIES", [dep]), \
|
||||||
patch("knoe.config._gcloud_plain", return_value=(["gcloud"], {"PATH": "x"})), \
|
patch("knoe.config._augment_env_for_brew", return_value={"PATH": "x"}), \
|
||||||
|
patch("knoe.config._gcloud_plain", side_effect=_unexpected_gcloud_plain), \
|
||||||
patch("knoe.core.milestones.subprocess.run", return_value=no_token), \
|
patch("knoe.core.milestones.subprocess.run", return_value=no_token), \
|
||||||
patch("knoe.core.milestones.sys.stdin.isatty", return_value=False):
|
patch("knoe.core.milestones.sys.stdin.isatty", return_value=False):
|
||||||
milestone.execute(state)
|
milestone.execute(state)
|
||||||
@ -683,9 +687,13 @@ def test_dependencies_k8s_interactive_login_recovers_auth_session():
|
|||||||
no_token = MagicMock(returncode=1, stdout="", stderr="not logged in")
|
no_token = MagicMock(returncode=1, stdout="", stderr="not logged in")
|
||||||
with_token = MagicMock(returncode=0, stdout="tok123\n", stderr="")
|
with_token = MagicMock(returncode=0, stdout="tok123\n", stderr="")
|
||||||
|
|
||||||
|
def _unexpected_gcloud_plain(*_a, **_k):
|
||||||
|
raise AssertionError("_gcloud_plain should not be called for auth preflight")
|
||||||
|
|
||||||
with patch("knoe.config.get_dep_info", return_value=(True, "/usr/bin/gcloud", "1.0")), \
|
with patch("knoe.config.get_dep_info", return_value=(True, "/usr/bin/gcloud", "1.0")), \
|
||||||
patch("knoe.config.DEPENDENCIES", [dep]), \
|
patch("knoe.config.DEPENDENCIES", [dep]), \
|
||||||
patch("knoe.config._gcloud_plain", return_value=(["gcloud"], {"PATH": "x"})), \
|
patch("knoe.config._augment_env_for_brew", return_value={"PATH": "x"}), \
|
||||||
|
patch("knoe.config._gcloud_plain", side_effect=_unexpected_gcloud_plain), \
|
||||||
patch("knoe.core.milestones.subprocess.run", side_effect=[no_token, with_token]), \
|
patch("knoe.core.milestones.subprocess.run", side_effect=[no_token, with_token]), \
|
||||||
patch("knoe.core.milestones.sys.stdin.isatty", return_value=True), \
|
patch("knoe.core.milestones.sys.stdin.isatty", return_value=True), \
|
||||||
patch.object(milestone, "_run_cmd", return_value=0) as run_cmd_mock:
|
patch.object(milestone, "_run_cmd", return_value=0) as run_cmd_mock:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user