Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m31s
Foundation / postgres-tools (push) Successful in 27s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 5m39s
The Regions page opens the next region in place of the one DEV serves: the admin API reads the region overlay, its kustomization, the grant broker and the portal deployment from main at one commit, rewrites only the region id, routes, genesis commit and seeded wildlife range (refusing files whose layout differs), commits them in one Gitea multi-file commit as aevolution-bot, then starts a full Argo sync of exactly that commit. The page follows the sync until the region is live, across the portal's own restart. Credentials come from Secret aevolution-admin mounted read-only as files (--deploy-config); without it the feature stays off. A small OpenSSL HTTPS client talks to Gitea (verified) and argocd-server (verification per ARGOCD_TLS_VERIFY). The portal's NetworkPolicy gains egress to the node's ingress for Gitea and to the argocd-server pods, as approved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2.0 KiB
C++
51 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
// ADR-0182 section 15: a bounded, blocking HTTPS/1.1 client for the admin API's two outbound
|
|
// services (Gitea and Argo CD). One request per connection (Connection: close); the system
|
|
// trust store and host name check unless `verify` is false. Credentials travel only in the
|
|
// request headers and are never logged.
|
|
namespace evo::server::admin {
|
|
struct HttpsRequest {
|
|
std::string host;
|
|
std::uint16_t port{443};
|
|
std::string method{"GET"};
|
|
std::string target{"/"}; // Path and query, already percent-encoded.
|
|
std::vector<std::pair<std::string, std::string>> headers;
|
|
std::string body;
|
|
bool verify{true};
|
|
std::chrono::milliseconds timeout{10'000};
|
|
std::size_t limit{std::size_t{4} << 20U}; // Largest body accepted.
|
|
};
|
|
struct HttpsResponse {
|
|
int status{};
|
|
std::string body;
|
|
};
|
|
// The transport the admin API uses; tests substitute a fake.
|
|
using HttpsTransport = std::function<std::optional<HttpsResponse>(const HttpsRequest&)>;
|
|
|
|
// Sends `request` over TLS: the answer, or nullopt on any connection, TLS, timeout, size or
|
|
// framing failure.
|
|
[[nodiscard]] std::optional<HttpsResponse> https_request(const HttpsRequest& request);
|
|
// An HTTP/1.1 response read to the end of the connection: the status and the body (by
|
|
// Content-Length, chunked, or to the end), or nullopt when malformed or over `limit`.
|
|
[[nodiscard]] std::optional<HttpsResponse> parse_http_response(std::string_view raw,
|
|
std::size_t limit);
|
|
// "https://host[:port][/...]" split into host, port and the path prefix (no trailing slash).
|
|
struct HttpsBase {
|
|
std::string host;
|
|
std::uint16_t port{443};
|
|
std::string prefix;
|
|
};
|
|
[[nodiscard]] std::optional<HttpsBase> parse_https_base(std::string_view url);
|
|
} // namespace evo::server::admin
|