fix(cicd): 收紧 managed repository 配置与状态合同
This commit is contained in:
@@ -30,6 +30,8 @@ export interface AgentRunManagedRepositoryReconcilerSpec {
|
||||
readonly deploymentName: string;
|
||||
readonly configMapName: string;
|
||||
readonly serviceAccountName: string;
|
||||
readonly hostNetwork: boolean;
|
||||
readonly dnsPolicy: "ClusterFirst" | "ClusterFirstWithHostNet" | "Default";
|
||||
readonly imagePullPolicy: "Always" | "IfNotPresent" | "Never";
|
||||
readonly cacheMountPath: string;
|
||||
readonly stateDirectory: string;
|
||||
@@ -51,6 +53,9 @@ export interface AgentRunManagedRepositoryReconcilerSpec {
|
||||
readonly timeoutSeconds: number;
|
||||
readonly failureThreshold: number;
|
||||
};
|
||||
readonly status: {
|
||||
readonly defaultRepositoryLimit: number;
|
||||
};
|
||||
readonly lifecycle: {
|
||||
readonly undeclaredRepositoryPolicy: "retain";
|
||||
readonly managedRefs: "source-branch-only";
|
||||
@@ -1126,14 +1131,25 @@ function parseManagedRepositoryReconciler(input: Record<string, unknown>, path:
|
||||
const retry = recordField(input, "retry", path);
|
||||
const freshness = recordField(input, "freshness", path);
|
||||
const readiness = recordField(input, "readiness", path);
|
||||
const status = recordField(input, "status", path);
|
||||
const lifecycle = recordField(input, "lifecycle", path);
|
||||
const stateDirectory = relativePathField(input, "stateDirectory", path);
|
||||
const hostNetwork = booleanField(input, "hostNetwork", path);
|
||||
const dnsPolicy = enumField(input, "dnsPolicy", path, ["ClusterFirst", "ClusterFirstWithHostNet", "Default"]);
|
||||
if (stateDirectory === "." || stateDirectory.length === 0) throw new Error(`${path}.stateDirectory must name a dedicated relative directory`);
|
||||
if (hostNetwork && dnsPolicy !== "ClusterFirstWithHostNet") {
|
||||
throw new Error(`${path}.dnsPolicy must be ClusterFirstWithHostNet when ${path}.hostNetwork is true`);
|
||||
}
|
||||
if (!hostNetwork && dnsPolicy === "ClusterFirstWithHostNet") {
|
||||
throw new Error(`${path}.dnsPolicy must not be ClusterFirstWithHostNet when ${path}.hostNetwork is false`);
|
||||
}
|
||||
return {
|
||||
enabled: booleanField(input, "enabled", path),
|
||||
deploymentName: kubernetesNameField(input, "deploymentName", path),
|
||||
configMapName: kubernetesNameField(input, "configMapName", path),
|
||||
serviceAccountName: kubernetesNameField(input, "serviceAccountName", path),
|
||||
hostNetwork,
|
||||
dnsPolicy,
|
||||
imagePullPolicy: enumField(input, "imagePullPolicy", path, ["Always", "IfNotPresent", "Never"]),
|
||||
cacheMountPath: absolutePathField(input, "cacheMountPath", path),
|
||||
stateDirectory,
|
||||
@@ -1155,6 +1171,9 @@ function parseManagedRepositoryReconciler(input: Record<string, unknown>, path:
|
||||
timeoutSeconds: positiveIntegerField(readiness, "timeoutSeconds", `${path}.readiness`),
|
||||
failureThreshold: positiveIntegerField(readiness, "failureThreshold", `${path}.readiness`),
|
||||
},
|
||||
status: {
|
||||
defaultRepositoryLimit: positiveIntegerField(status, "defaultRepositoryLimit", `${path}.status`),
|
||||
},
|
||||
lifecycle: {
|
||||
undeclaredRepositoryPolicy: enumField(lifecycle, "undeclaredRepositoryPolicy", `${path}.lifecycle`, ["retain"]),
|
||||
managedRefs: enumField(lifecycle, "managedRefs", `${path}.lifecycle`, ["source-branch-only"]),
|
||||
|
||||
Reference in New Issue
Block a user