refactor: variableize yaml lane node naming
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { runCommand, type CommandResult } from "./command";
|
||||
import { repoRoot } from "./config";
|
||||
import { classifyD601K3sTarget, d601NativeKubeconfig, d601RequiredNodeName, type D601K3sGuardClassification } from "./d601-k3s-guard";
|
||||
import { classifyK3sTarget, defaultNativeKubeconfig, requiredNativeNodeName, type K3sGuardClassification } from "./k3s-target-guard";
|
||||
|
||||
type PlaneStatus = "ready" | "blocked" | "degraded";
|
||||
type SignalSeverity = "blocker" | "warning";
|
||||
@@ -113,7 +113,7 @@ export interface CodeQueueExecutionPlaneObservation {
|
||||
namespace: string;
|
||||
kubeconfig: string;
|
||||
worktreePath: string;
|
||||
guard: D601K3sGuardClassification;
|
||||
guard: K3sGuardClassification;
|
||||
deployments: DeploymentObservation[];
|
||||
pods: PodObservation[];
|
||||
services: ServiceObservation[];
|
||||
@@ -185,7 +185,7 @@ function parseExecutionPlaneOptions(args: string[]): ExecutionPlaneOptions {
|
||||
const raw = hasFlag(args, "--raw");
|
||||
return {
|
||||
namespace: optionValue(args, ["--namespace"]) ?? expectedNamespace,
|
||||
kubeconfig: optionValue(args, ["--kubeconfig"]) ?? d601NativeKubeconfig,
|
||||
kubeconfig: optionValue(args, ["--kubeconfig"]) ?? defaultNativeKubeconfig,
|
||||
worktreePath: optionValue(args, ["--worktree"]) ?? expectedWorktreePath,
|
||||
full: raw || hasFlag(args, "--full"),
|
||||
raw,
|
||||
@@ -246,14 +246,14 @@ function runKubectl(args: string[], options: ExecutionPlaneOptions): ProbeResult
|
||||
return runTran(["D601:k3s", "kubectl", ...args], options);
|
||||
}
|
||||
|
||||
function collectGuard(options: ExecutionPlaneOptions): { guard: D601K3sGuardClassification; diagnostics: Record<string, unknown> } {
|
||||
function collectGuard(options: ExecutionPlaneOptions): { guard: K3sGuardClassification; diagnostics: Record<string, unknown> } {
|
||||
const context = runKubectl(["config", "current-context"], options);
|
||||
const server = runKubectl(["config", "view", "--minify", "-o", "jsonpath={.clusters[0].cluster.server}"], options);
|
||||
const nodes = runKubectl(["get", "nodes", "-o", "jsonpath={range .items[*]}{.metadata.name}{\"\\n\"}{end}"], options);
|
||||
const combinedText = [context.stdout, context.stderr, server.stdout, server.stderr, nodes.stdout, nodes.stderr].join("\n");
|
||||
const guard = classifyD601K3sTarget({
|
||||
const guard = classifyK3sTarget({
|
||||
kubeconfig: options.kubeconfig,
|
||||
expectedKubeconfig: d601NativeKubeconfig,
|
||||
expectedKubeconfig: defaultNativeKubeconfig,
|
||||
currentContext: firstLine(context.stdout),
|
||||
apiServer: firstLine(server.stdout),
|
||||
nodeNames: lines(nodes.stdout),
|
||||
@@ -433,7 +433,7 @@ function collectWorktree(options: ExecutionPlaneOptions): WorktreeObservation {
|
||||
function collectResidual(): ResidualObservation {
|
||||
const remoteOptions: ExecutionPlaneOptions = {
|
||||
namespace: expectedNamespace,
|
||||
kubeconfig: d601NativeKubeconfig,
|
||||
kubeconfig: defaultNativeKubeconfig,
|
||||
worktreePath: expectedWorktreePath,
|
||||
full: false,
|
||||
raw: false,
|
||||
@@ -734,7 +734,7 @@ function evaluateObservation(observation: CodeQueueExecutionPlaneObservation, op
|
||||
code: "d601-k3s-guard-blocked",
|
||||
severity: "blocker",
|
||||
message: observation.guard.summary,
|
||||
expected: { kubeconfig: d601NativeKubeconfig, node: d601RequiredNodeName },
|
||||
expected: { kubeconfig: defaultNativeKubeconfig, node: requiredNativeNodeName },
|
||||
observed: { status: observation.guard.status, nodes: observation.guard.nodeNames },
|
||||
}];
|
||||
const signals = [...guardSignals, ...formalSignals, ...deploymentDriftSignals, ...deprecatedResidualSignals];
|
||||
|
||||
Reference in New Issue
Block a user