hm1: add GX10 MCP gateway wiring
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using FluentAssertions;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using Xunit;
|
||||
using YamlDotNet.Core;
|
||||
@@ -949,6 +950,37 @@ public sealed class FleetManifestLintTests
|
||||
EnvSecretOptional(webhook, "FlowerCore__Dns__AcmeWebhook__ApiKey").Should().Be("true");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gx10HostingManagers_AreWiredBehindMcpGateway()
|
||||
{
|
||||
var mysqlWeb = Gx10DeploymentContainer("fc-mysql", "deployment-mysql-web.json");
|
||||
JsonEnvSecretName(mysqlWeb, "FlowerCore__Mcp__ApiKey__Key").Should().Be("mysql-mcp-keys");
|
||||
JsonEnvSecretKey(mysqlWeb, "FlowerCore__Mcp__ApiKey__Key").Should().Be("credential");
|
||||
JsonEnvSecretOptional(mysqlWeb, "FlowerCore__Mcp__ApiKey__Key").Should().BeTrue();
|
||||
|
||||
var phpWeb = Gx10DeploymentContainer("fc-php", "deployment-php-web.json");
|
||||
JsonEnvSecretName(phpWeb, "FlowerCore__Mcp__ApiKey__Key").Should().Be("php-mcp-keys");
|
||||
JsonEnvSecretKey(phpWeb, "FlowerCore__Mcp__ApiKey__Key").Should().Be("credential");
|
||||
JsonEnvSecretOptional(phpWeb, "FlowerCore__Mcp__ApiKey__Key").Should().BeTrue();
|
||||
|
||||
var gatewayManifest = File.ReadAllText(Path.Combine(
|
||||
Inventory.BluejayRoot,
|
||||
"apps-gx10",
|
||||
"fc-gateway",
|
||||
"fc-gateway.yaml"));
|
||||
|
||||
gatewayManifest.Should().Contain("Host(`gateway.iamworkin.lan`)");
|
||||
gatewayManifest.Should().Contain("name: FlowerCore__Mcp__ApiKey__Key");
|
||||
gatewayManifest.Should().Contain("name: GW_BACKEND_fc_mysql_KEY");
|
||||
gatewayManifest.Should().Contain("name: mysql-mcp-keys");
|
||||
gatewayManifest.Should().Contain("name: GW_BACKEND_fc_php_KEY");
|
||||
gatewayManifest.Should().Contain("name: php-mcp-keys");
|
||||
gatewayManifest.Should().Contain("kubernetes.io/metadata.name: fc-mysql");
|
||||
gatewayManifest.Should().Contain("port: 5300");
|
||||
gatewayManifest.Should().Contain("kubernetes.io/metadata.name: fc-php");
|
||||
gatewayManifest.Should().Contain("port: 5400");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DnsAndMediaGitOpsAdoption_PreservesLiveStorageAndImageShape()
|
||||
{
|
||||
@@ -1096,6 +1128,52 @@ public sealed class FleetManifestLintTests
|
||||
: null;
|
||||
}
|
||||
|
||||
private static JsonElement Gx10DeploymentContainer(string app, string fileName)
|
||||
{
|
||||
var path = Path.Combine(Inventory.BluejayRoot, "apps-gx10", app, fileName);
|
||||
using var document = JsonDocument.Parse(File.ReadAllText(path));
|
||||
return document.RootElement
|
||||
.GetProperty("spec")
|
||||
.GetProperty("template")
|
||||
.GetProperty("spec")
|
||||
.GetProperty("containers")[0]
|
||||
.Clone();
|
||||
}
|
||||
|
||||
private static string? JsonEnvSecretName(JsonElement container, string name)
|
||||
{
|
||||
return JsonEnvMapping(container, name) is { } env
|
||||
? env.GetProperty("valueFrom").GetProperty("secretKeyRef").GetProperty("name").GetString()
|
||||
: null;
|
||||
}
|
||||
|
||||
private static string? JsonEnvSecretKey(JsonElement container, string name)
|
||||
{
|
||||
return JsonEnvMapping(container, name) is { } env
|
||||
? env.GetProperty("valueFrom").GetProperty("secretKeyRef").GetProperty("key").GetString()
|
||||
: null;
|
||||
}
|
||||
|
||||
private static bool? JsonEnvSecretOptional(JsonElement container, string name)
|
||||
{
|
||||
return JsonEnvMapping(container, name) is { } env
|
||||
? env.GetProperty("valueFrom").GetProperty("secretKeyRef").GetProperty("optional").GetBoolean()
|
||||
: null;
|
||||
}
|
||||
|
||||
private static JsonElement? JsonEnvMapping(JsonElement container, string name)
|
||||
{
|
||||
foreach (var env in container.GetProperty("env").EnumerateArray())
|
||||
{
|
||||
if (string.Equals(env.GetProperty("name").GetString(), name, StringComparison.Ordinal))
|
||||
{
|
||||
return env.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string? ProbePath(YamlMappingNode container, string probeKey)
|
||||
{
|
||||
return ManifestNodeExtensions.Scalar(container, probeKey, "httpGet", "path");
|
||||
|
||||
Reference in New Issue
Block a user