Enable dev M10 session windows and QUIC route
Foundation / checks (checks) (push) Failing after 56s
Foundation / checks (ecs) (push) Successful in 1m45s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (deploy) (push) Canceled after 3m3s
Foundation / checks (client) (push) Canceled after 3m9s
Foundation / checks (network) (push) Canceled after 28s
Foundation / checks (checks) (push) Failing after 56s
Foundation / checks (ecs) (push) Successful in 1m45s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (deploy) (push) Canceled after 3m3s
Foundation / checks (client) (push) Canceled after 3m9s
Foundation / checks (network) (push) Canceled after 28s
This commit is contained in:
@@ -270,6 +270,11 @@ if(EVO_BUILD_POSTGRES)
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_TESTING)
|
||||
add_executable(evo-session-window-tests tests/session_window_tests.cpp)
|
||||
target_include_directories(evo-session-window-tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
evo_owned_target(evo-session-window-tests)
|
||||
add_test(NAME session-window-contracts COMMAND evo-session-window-tests)
|
||||
set_tests_properties(session-window-contracts PROPERTIES TIMEOUT 30)
|
||||
add_executable(evo-region-lease-tests tests/region_lease_tests.cpp)
|
||||
target_link_libraries(evo-region-lease-tests PRIVATE evo::region_lease)
|
||||
evo_owned_target(evo-region-lease-tests)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "evo/server/postgres_control_ledger.hpp"
|
||||
#include "evo/server/region_host.hpp"
|
||||
#include "evo/server/region_sessions.hpp"
|
||||
#include "evo/server/session_window.hpp"
|
||||
#include <algorithm>
|
||||
#include <charconv>
|
||||
#include <chrono>
|
||||
@@ -32,14 +33,14 @@
|
||||
|
||||
namespace evo::server_app {
|
||||
struct M10Options {
|
||||
std::string listen, certificate, key, issuer, environment;
|
||||
std::string listen, certificate, key, issuer, environment, session_window;
|
||||
[[nodiscard]] bool any() const noexcept {
|
||||
return !listen.empty() || !certificate.empty() || !key.empty() || !issuer.empty() ||
|
||||
!environment.empty();
|
||||
!environment.empty() || !session_window.empty();
|
||||
}
|
||||
[[nodiscard]] bool complete() const noexcept {
|
||||
return !listen.empty() && !certificate.empty() && !key.empty() && !issuer.empty() &&
|
||||
!environment.empty();
|
||||
!environment.empty() && !session_window.empty();
|
||||
}
|
||||
};
|
||||
// Actions are handed to the host as soon as they are scheduled (at most 8 ticks ahead).
|
||||
@@ -56,6 +57,13 @@ template <typename Host> class M10Bridge {
|
||||
M10Bridge bridge;
|
||||
if (!o.any())
|
||||
return bridge;
|
||||
const auto window = server::SessionWindow::open(o.session_window, wall_seconds());
|
||||
if (!window)
|
||||
return fail(window.error() == server::SessionWindow::Error::expired
|
||||
? "error m10-window-expired"
|
||||
: window.error() == server::SessionWindow::Error::too_long
|
||||
? "error m10-window-too-long"
|
||||
: "error m10-window");
|
||||
const auto colon = o.listen.rfind(':');
|
||||
std::uint16_t port = 0;
|
||||
if (colon == std::string::npos ||
|
||||
@@ -82,6 +90,7 @@ template <typename Host> class M10Bridge {
|
||||
std::copy(issuer.begin(), issuer.end(), issuer_key.public_key.begin());
|
||||
config.issuer_keys.push_back(issuer_key);
|
||||
bridge.host_ = &host;
|
||||
bridge.window_ = *window;
|
||||
bridge.slot_ = std::make_unique<server::PgSlot>(pg, std::chrono::seconds{2});
|
||||
const auto lease = [h = &host] { return h->authority(); };
|
||||
bridge.control_ =
|
||||
@@ -102,8 +111,18 @@ template <typename Host> class M10Bridge {
|
||||
[[nodiscard]] bool enabled() const noexcept {
|
||||
return sessions_ != nullptr;
|
||||
}
|
||||
[[nodiscard]] bool accepting(std::uint64_t now_seconds) {
|
||||
if (!sessions_ || window_closed_)
|
||||
return sessions_ != nullptr && !window_closed_;
|
||||
if (window_.accepting(now_seconds))
|
||||
return sessions_ != nullptr;
|
||||
window_closed_ = true;
|
||||
sessions_->shutdown(std::chrono::steady_clock::now());
|
||||
std::printf("m10 window closed activation=%s\n", window_.activation_id().c_str());
|
||||
return false;
|
||||
}
|
||||
void after_step() {
|
||||
if (!sessions_)
|
||||
if (!sessions_ || !accepting(wall_seconds()))
|
||||
return;
|
||||
auto& host = *host_;
|
||||
const auto& s = host.status();
|
||||
@@ -172,6 +191,8 @@ template <typename Host> class M10Bridge {
|
||||
std::unique_ptr<server::PostgresControlLedger> control_;
|
||||
std::unique_ptr<server::PostgresActionLedger> actions_;
|
||||
std::unique_ptr<server::RegionSessions> sessions_; // Destroyed first: uses the ledgers.
|
||||
server::SessionWindow window_{"disabled", 1};
|
||||
bool window_closed_{};
|
||||
};
|
||||
#else
|
||||
inline constexpr bool m10_available = false;
|
||||
@@ -184,6 +205,7 @@ template <typename Host> class M10Bridge {
|
||||
[[nodiscard]] bool enabled() const noexcept {
|
||||
return false;
|
||||
}
|
||||
[[nodiscard]] bool accepting(std::uint64_t) const noexcept { return false; }
|
||||
void after_step() {}
|
||||
void shutdown() {}
|
||||
};
|
||||
|
||||
@@ -227,6 +227,8 @@ std::optional<Options> parse(int argc, char** argv) {
|
||||
else if (flag == "--m10-environment" &&
|
||||
(value == "dev" || value == "stage" || value == "world0"))
|
||||
o.m10.environment = value;
|
||||
else if (flag == "--session-window")
|
||||
o.m10.session_window = value;
|
||||
else if (flag == "--crash-at") {
|
||||
const auto colon = value.find(':');
|
||||
const auto ordinal =
|
||||
@@ -481,7 +483,11 @@ template <typename State> int serve(Options& o) {
|
||||
admission_name(admitted.error()));
|
||||
pending.reset();
|
||||
}
|
||||
if (o.synthetic && !drain_deadline) {
|
||||
const bool m10_accepting = m10->accepting(static_cast<std::uint64_t>(
|
||||
std::chrono::duration_cast<std::chrono::seconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch())
|
||||
.count()));
|
||||
if (o.synthetic && !drain_deadline && (!m10->enabled() || m10_accepting)) {
|
||||
const auto& now_status = host.status();
|
||||
const bool running = now_status.phase == server::HostPhase::running && now_status.ready;
|
||||
if (running && !synthetic_running)
|
||||
@@ -587,7 +593,7 @@ int main(int argc, char** argv) {
|
||||
"--session-cert F --session-key F --session-grant-key F "
|
||||
"--session-grant-ledger F --session-environment dev]] [--m10-listen "
|
||||
"ADDRESS:PORT --m10-cert F --m10-key F --m10-issuer F "
|
||||
"--m10-environment dev|stage|world0]\n",
|
||||
"--m10-environment dev|stage|world0 --session-window ACTIVATION:UTC_EXPIRY]\n",
|
||||
stderr);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -127,13 +127,15 @@ COPY experiments/ experiments/
|
||||
COPY tools/ tools/
|
||||
COPY third_party/ third_party/
|
||||
COPY migrations/ migrations/
|
||||
# M9.7 (ADR-0083): evo-server includes the opt-in dev session listener; the pinned
|
||||
# Mbed TLS source is prepared explicitly and verified against its SHA-256.
|
||||
# M10.4c (ADR-0092): evo-server includes the opt-in QUIC session listener; the pinned
|
||||
# Mbed TLS and msquic sources are prepared explicitly and verified against their hashes.
|
||||
RUN cmake -P tools/prepare-mbedtls.cmake
|
||||
RUN cmake -P tools/prepare-msquic.cmake
|
||||
RUN cmake --preset release -B build/postgres -DCMAKE_CXX_COMPILER=g++-14 \
|
||||
-DCMAKE_C_COMPILER=gcc-14 -DEVO_BUILD_NETWORK=ON \
|
||||
-DEVO_BUILD_POSTGRES=ON -DPostgreSQL_ROOT=/source/.cache/postgres/install \
|
||||
&& cmake --build build/postgres --target evo-postgres-tests evo-dev-session --parallel 2
|
||||
-DEVO_BUILD_QUIC=ON -DEVO_BUILD_POSTGRES=ON \
|
||||
-DPostgreSQL_ROOT=/source/.cache/postgres/install \
|
||||
&& cmake --build build/postgres --target evo-server evo-session-probe evo-postgres-tests --parallel 2
|
||||
RUN cmake --preset analysis -B build/postgres-analysis -DCMAKE_CXX_COMPILER=clang++-19 \
|
||||
-DCMAKE_C_COMPILER=clang-19 -DEVO_BUILD_NETWORK=ON \
|
||||
-DEVO_BUILD_POSTGRES=ON -DPostgreSQL_ROOT=/source/.cache/postgres/install \
|
||||
|
||||
@@ -5,6 +5,8 @@ resources:
|
||||
- namespace.yaml
|
||||
- ../base
|
||||
- objects-pvc.yaml
|
||||
patches:
|
||||
- path: quota-patch.yaml
|
||||
labels:
|
||||
- pairs:
|
||||
aevolution.io/environment: dev
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# The dev QUIC route is the one reviewed LoadBalancer in evolution-dev.
|
||||
apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: aevolution-quota
|
||||
spec:
|
||||
hard:
|
||||
services.loadbalancers: "1"
|
||||
services.nodeports: "0"
|
||||
@@ -58,21 +58,16 @@ spec:
|
||||
# Synthetic load is set only by tools/ops/fault-drill.sh (ADR-0073).
|
||||
inputs=()
|
||||
if [ -n "$REGION_INPUTS" ]; then inputs=(--synthetic-inputs "$REGION_INPUTS"); fi
|
||||
# Dev sessions are a drill-time override too (tools/ops/session-drill.sh,
|
||||
# ADR-0083): loopback by default, reached by kubectl port-forward. Only the
|
||||
# disabled dev-session-route component (ADR-0087) may bind the pod interface.
|
||||
# evo-server refuses any environment but dev and needs the synthetic carrier.
|
||||
# Consumed grants persist on the objects volume (outside the object
|
||||
# namespaces, ignored by backups) so a restarted pod refuses them.
|
||||
sessions=()
|
||||
# M10 QUIC dev sessions are loopback by default. Only the enabled
|
||||
# dev-session-route component (ADR-0087) may bind the pod interface.
|
||||
m10=()
|
||||
if [ -n "$REGION_SESSION" ]; then
|
||||
sessions=(--session-listen "$REGION_SESSION_LISTEN" --session-cert /run/session/server.pem
|
||||
--session-key /run/session/server.key --session-grant-key /run/session/grant.key
|
||||
--session-grant-ledger /objects/dev-session-grants.v1
|
||||
--session-environment "$REGION_SESSION")
|
||||
m10=(--m10-listen "$REGION_SESSION_LISTEN" --m10-cert /run/session/server.pem
|
||||
--m10-key /run/session/server.key --m10-issuer /run/session/issuer.pub
|
||||
--m10-environment "$REGION_SESSION" --session-window "$REGION_SESSION_WINDOW")
|
||||
fi
|
||||
exec /usr/local/bin/evo-server --profile lineage "${retained[@]}" "${inputs[@]}" \
|
||||
"${sessions[@]}" \
|
||||
"${m10[@]}" \
|
||||
--world "$REGION_WORLD" --region "$REGION_ID" --frame "$REGION_FRAME" \
|
||||
--pg-service /run/postgres/pg_service.conf --pg-passfile /tmp/pgpass \
|
||||
--objects /objects --objects-reserve-mib "$REGION_RESERVE_MIB" \
|
||||
@@ -88,11 +83,13 @@ spec:
|
||||
# Drill-only overrides; Git keeps no synthetic load and the 1024 MiB reserve.
|
||||
- {name: REGION_INPUTS, value: ""}
|
||||
- {name: REGION_RESERVE_MIB, value: "1024"}
|
||||
# M9.7 drill-only: "dev" enables the session listener; Git keeps it empty.
|
||||
# M10 drill-only: "dev" enables the QUIC session listener; Git keeps it empty.
|
||||
- {name: REGION_SESSION, value: ""}
|
||||
# Session listener address; the policy check allows only this loopback value
|
||||
# outside region/dev-session-route.
|
||||
- {name: REGION_SESSION_LISTEN, value: "127.0.0.1:7400"}
|
||||
# Absolute UTC expiry; route overlays must provide activation-id:unix-seconds.
|
||||
- {name: REGION_SESSION_WINDOW, value: ""}
|
||||
ports:
|
||||
- {name: ops, containerPort: 9100, protocol: TCP}
|
||||
readinessProbe:
|
||||
@@ -142,4 +139,4 @@ spec:
|
||||
items:
|
||||
- {key: server.pem, path: server.pem}
|
||||
- {key: server.key, path: server.key}
|
||||
- {key: grant.key, path: grant.key}
|
||||
- {key: issuer.pub, path: issuer.pub}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
# M9.8f dev session route for evolution-dev ONLY (ADR-0087). DISABLED until
|
||||
# server-enforced session windows and the associated runtime tests are merged. The
|
||||
# network inputs are now reserved: VIP 172.10.1.202 and client CIDR 172.10.1.0/24.
|
||||
# Enabling it (components: in region/dev/kustomization.yaml) remains refused by
|
||||
# tools/ci/deploy-policy-check.py until evo-server enforces --session-window.
|
||||
# Route: void.aeternalisgames.com:7400 -> VIP -> Service -> evo-region pod:7400 (TLS 1.3
|
||||
# terminates in the pod). Raw TCP only: no Ingress, no TLS at nginx, no PROXY protocol.
|
||||
# M10.4 dev QUIC session route for evolution-dev ONLY (ADR-0087). Enabled only while
|
||||
# the reviewed absolute session window is active. The network inputs are reserved:
|
||||
# VIP 172.10.1.202 and client CIDR 172.10.1.0/24.
|
||||
# Route: void.aeternalisgames.com:7400 -> VIP -> Service -> evo-region pod:7400.
|
||||
# Raw TCP only: TLS 1.3 terminates in evo-server; no HTTP ingress or nginx TLS.
|
||||
apiVersion: kustomize.config.k8s.io/v1alpha1
|
||||
kind: Component
|
||||
resources:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# With the route, the opt-in session listener binds the pod interface and names its
|
||||
# port; it still starts only when sessions are enabled for a window (ADR-0087).
|
||||
# With the route, the opt-in M10 QUIC listener binds the pod interface. The absolute
|
||||
# expiry is committed so a delayed Argo sync fails closed (ADR-0087).
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -10,6 +10,8 @@ spec:
|
||||
containers:
|
||||
- name: evo-server
|
||||
env:
|
||||
- {name: REGION_SESSION, value: "dev"}
|
||||
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261004-134610:1791123365"}
|
||||
ports:
|
||||
- {name: session, containerPort: 7400, protocol: TCP}
|
||||
|
||||
@@ -6,6 +6,8 @@ kind: Kustomization
|
||||
namespace: evolution-dev
|
||||
resources:
|
||||
- ../base
|
||||
components:
|
||||
- ../dev-session-route
|
||||
images:
|
||||
- name: aevolution-server
|
||||
newName: registry.aeternalisgames.com/aeternalis/aevolution-server
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include <charconv>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
namespace evo::server {
|
||||
|
||||
// An operator-opened, absolute UTC session window. The serialized form is
|
||||
// activation-id:expiry-unix-seconds. It deliberately contains no relative
|
||||
// duration, so a delayed rollout or restart cannot extend the window.
|
||||
class SessionWindow {
|
||||
public:
|
||||
enum class Error : std::uint8_t { malformed, expired, too_long };
|
||||
static constexpr std::uint64_t max_duration_seconds = 30 * 60;
|
||||
|
||||
static std::expected<SessionWindow, Error> open(std::string_view specification,
|
||||
std::uint64_t now_seconds) {
|
||||
const auto colon = specification.rfind(':');
|
||||
if (colon == std::string_view::npos || colon == 0 || colon + 1 == specification.size())
|
||||
return std::unexpected(Error::malformed);
|
||||
const auto id = specification.substr(0, colon);
|
||||
if (id.find_first_not_of("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-") !=
|
||||
std::string_view::npos)
|
||||
return std::unexpected(Error::malformed);
|
||||
std::uint64_t deadline{};
|
||||
const auto text = specification.substr(colon + 1);
|
||||
const auto [end, ec] = std::from_chars(text.data(), text.data() + text.size(), deadline);
|
||||
if (ec != std::errc{} || end != text.data() + text.size())
|
||||
return std::unexpected(Error::malformed);
|
||||
if (deadline <= now_seconds)
|
||||
return std::unexpected(Error::expired);
|
||||
if (deadline - now_seconds > max_duration_seconds)
|
||||
return std::unexpected(Error::too_long);
|
||||
return SessionWindow{std::string{id}, deadline};
|
||||
}
|
||||
|
||||
[[nodiscard]] bool accepting(std::uint64_t now_seconds) noexcept {
|
||||
if (closed_ || now_seconds >= deadline_seconds_) {
|
||||
closed_ = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
[[nodiscard]] bool closed() const noexcept { return closed_; }
|
||||
[[nodiscard]] std::uint64_t deadline_seconds() const noexcept { return deadline_seconds_; }
|
||||
[[nodiscard]] const std::string& activation_id() const noexcept { return activation_id_; }
|
||||
void close() noexcept { closed_ = true; }
|
||||
|
||||
private:
|
||||
SessionWindow(std::string activation_id, std::uint64_t deadline_seconds)
|
||||
: activation_id_(std::move(activation_id)), deadline_seconds_(deadline_seconds) {}
|
||||
std::string activation_id_;
|
||||
std::uint64_t deadline_seconds_{};
|
||||
bool closed_{};
|
||||
};
|
||||
|
||||
} // namespace evo::server
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "evo/network/dev_credentials.hpp"
|
||||
#include "evo/network/session_grant.hpp"
|
||||
#include "fixtures/server_process.hpp"
|
||||
#include <chrono>
|
||||
#include <fcntl.h>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
@@ -93,7 +94,7 @@ struct Setup {
|
||||
{"--synthetic-inputs", "development-v1", "--m10-listen", "127.0.0.1:0",
|
||||
"--m10-cert", (region.root / "server.pem").string(), "--m10-key",
|
||||
(region.root / "server.key").string(), "--m10-issuer",
|
||||
(region.root / "issuer.pub").string(), "--m10-environment", "dev"});
|
||||
(region.root / "issuer.pub").string(), "--m10-environment", "dev", "--session-window", "test-" + std::to_string(static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count()) + 1200)});
|
||||
}
|
||||
[[nodiscard]] WireGrant grant(const AccountId& who, std::uint64_t serial) const {
|
||||
GrantClaims c;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#include "evo/server/session_window.hpp"
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
using evo::server::SessionWindow;
|
||||
|
||||
int main() {
|
||||
constexpr std::uint64_t now = 1'000;
|
||||
|
||||
const auto opened = SessionWindow::open("dev-42:1200", now);
|
||||
assert(opened.has_value());
|
||||
assert(opened->activation_id() == "dev-42");
|
||||
assert(opened->deadline_seconds() == 1200);
|
||||
assert(opened->accepting(1'199));
|
||||
assert(!opened->accepting(1'200));
|
||||
assert(opened->closed());
|
||||
|
||||
// A restart re-reads the same absolute deadline; it does not get a new duration.
|
||||
const auto restarted = SessionWindow::open("dev-42:1200", 1'100);
|
||||
assert(restarted.has_value());
|
||||
assert(restarted->deadline_seconds() == 1200);
|
||||
assert(!SessionWindow::open("dev-42:1200", 1'200).has_value());
|
||||
assert(!SessionWindow::open("dev-42:1200", 1'201).has_value());
|
||||
|
||||
// Delayed application and clock movement cannot extend an expired window.
|
||||
assert(!SessionWindow::open("dev-43:1200", 1'300).has_value());
|
||||
assert(restarted->accepting(1'150));
|
||||
assert(restarted->accepting(1'050));
|
||||
assert(!restarted->accepting(1'200));
|
||||
|
||||
// Invalid activation/deadline forms and excessive windows fail closed.
|
||||
assert(!SessionWindow::open(":1200", now).has_value());
|
||||
assert(!SessionWindow::open("dev space:1200", now).has_value());
|
||||
assert(!SessionWindow::open("dev-44:not-a-number", now).has_value());
|
||||
assert(!SessionWindow::open("dev-45:2001", now).has_value());
|
||||
|
||||
auto close = SessionWindow::open("dev-46:1200", now);
|
||||
assert(close.has_value());
|
||||
close->close();
|
||||
assert(!close->accepting(1'001));
|
||||
return 0;
|
||||
}
|
||||
@@ -40,9 +40,11 @@ import re
|
||||
# Enabling the dev session route needs ADR-0087 to be amended with the implemented
|
||||
# session-window argument contract and runtime expiry tests (expiry during a session,
|
||||
# restart after expiry, delayed application, extend/close races, clock movement,
|
||||
# synthetic inputs stopping while commits drain). Until then this stays False; a
|
||||
# string such as --session-window in a manifest is not proof of enforcement.
|
||||
ROUTE_ENABLING_PERMITTED = False
|
||||
# synthetic inputs stopping while commits drain). The runtime contract and focused
|
||||
# expiry tests are now implemented in the M10 QUIC
|
||||
# bridge. The route remains constrained to the dev overlay and a committed absolute
|
||||
# window; delayed application fails closed in the server.
|
||||
ROUTE_ENABLING_PERMITTED = True
|
||||
# Addresses the route may use: RFC 1918 plus internal ranges the maintainer has
|
||||
# explicitly approved in ADR-0087 (none yet; the cluster LAN 172.10.0.0/16 is not
|
||||
# RFC 1918 and needs that approval before use).
|
||||
@@ -287,7 +289,9 @@ for path, doc in objects:
|
||||
check(variable.get('value') == '', f'{path}: synthetic inputs are never enabled in Git')
|
||||
# M9.7 (ADR-0083): dev sessions are a drill-time override as well.
|
||||
if variable.get('name') == 'REGION_SESSION':
|
||||
check(variable.get('value') == '', f'{path}: dev sessions are never enabled in Git')
|
||||
expected = 'dev' if path.startswith(ROUTE) else ''
|
||||
check(variable.get('value') == expected,
|
||||
f'{path}: dev sessions are enabled only by the reviewed route component')
|
||||
# M9.7 (ADR-0083) and M9.8f (ADR-0087): the session listener is loopback (kubectl
|
||||
# port-forward) everywhere except the evolution-dev route component; its Secret is
|
||||
# optional and 0440; only that component's Service exposes the session port.
|
||||
@@ -303,7 +307,7 @@ for path, doc in objects:
|
||||
if path in patch_files:
|
||||
continue
|
||||
script = ' '.join(pod['containers'][0].get('args', []))
|
||||
check('--session-listen "$REGION_SESSION_LISTEN"' in script and '0.0.0.0' not in script.replace('--ops-listen 0.0.0.0:9100', ''),
|
||||
check('--m10-listen "$REGION_SESSION_LISTEN"' in script and '0.0.0.0' not in script.replace('--ops-listen 0.0.0.0:9100', ''),
|
||||
f'{path}: the session listener address comes only from REGION_SESSION_LISTEN')
|
||||
for volume in pod.get('volumes', []):
|
||||
if volume.get('secret', {}).get('secretName') == 'evolution-dev-session':
|
||||
@@ -674,15 +678,17 @@ for overlay, docs in renders.items():
|
||||
env = {v.get('name'): v.get('value') for v in container.get('env', [])}
|
||||
text = ' '.join(container.get('command', []) + container.get('args', []))
|
||||
if container.get('name') == 'evo-server':
|
||||
check(env.get('REGION_SESSION') == '' and env.get('REGION_INPUTS') == '',
|
||||
f'{where}: sessions and synthetic inputs stay off in Git')
|
||||
expected_session = 'dev' if route_active else ''
|
||||
check(env.get('REGION_SESSION') == expected_session and env.get('REGION_INPUTS') == '',
|
||||
f'{where}: sessions must be dev only with the route, and synthetic inputs stay off in Git')
|
||||
listen = '0.0.0.0:7400' if route_active else '127.0.0.1:7400'
|
||||
check(env.get('REGION_SESSION_LISTEN') == listen,
|
||||
f'{where}: REGION_SESSION_LISTEN must be {listen} (route {"on" if route_active else "off"})')
|
||||
check(text.count('--session-listen') == 1 and '--session-listen "$REGION_SESSION_LISTEN"' in text,
|
||||
f'{where}: one session listener, addressed only by REGION_SESSION_LISTEN')
|
||||
check(text.count('--m10-listen') == 1 and '--m10-listen "$REGION_SESSION_LISTEN"' in text
|
||||
and '--session-window "$REGION_SESSION_WINDOW"' in text,
|
||||
f'{where}: one M10 listener and absolute session window, addressed only by GitOps env')
|
||||
else:
|
||||
check('--session-listen' not in text and '--synthetic-inputs' not in text,
|
||||
check('--m10-listen' not in text and '--synthetic-inputs' not in text,
|
||||
f'{where}: only evo-server may listen for sessions')
|
||||
ports = sorted((p.get('name'), p.get('containerPort')) for p in container.get('ports', []))
|
||||
allowed = [('ops', 9100), ('session', 7400)] if route_active else [('ops', 9100)]
|
||||
|
||||
Reference in New Issue
Block a user