fix(integrations): не считать CNAME hostname за IP при sync
Build and Push CFDM Docker Image / build-and-push (push) Successful in 1m49s
Build and Push CFDM Docker Image / create-release (push) Skipped
Build and Push CFDM Docker Image / update-wiki (push) Successful in 6s

JOIN dns_record клал content CNAME в target_ips и блокировал разворот до origin IP / service IPs.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-08-01 01:30:25 +07:00
co-authored by Cursor
parent ec70104085
commit 721332e767
6 changed files with 86 additions and 19 deletions
+10 -5
View File
@@ -18,7 +18,7 @@ import type {
Subdomain,
SyncJob,
} from "@cfdm/shared";
import { dnsRecordNamesMatch } from "@cfdm/shared";
import { dnsRecordNamesMatch, isIpLiteral } from "@cfdm/shared";
import { and, asc, count, eq, isNull, like, notInArray, or, sql } from "drizzle-orm";
import type { Db } from "./client.js";
import { NotFoundError } from "./errors.js";
@@ -1155,20 +1155,25 @@ function enrichServiceBindingView(
const configuredIps = configured.map((c) => c.ip);
const linkedRecords = listRecordsForBinding(db, row.id);
const linkedIps = linkedRecords
.filter((record) => record.record_type.toUpperCase() === "A")
.filter((record) => {
const type = record.record_type.toUpperCase();
return (type === "A" || type === "AAAA") && isIpLiteral(record.content);
})
.map((record) => record.content);
const target_ips = [
...new Set([
...configuredIps,
...configuredIps.filter(isIpLiteral),
...linkedIps,
...(row.target_ip ? [row.target_ip] : []),
...(row.target_ip && isIpLiteral(row.target_ip) ? [row.target_ip] : []),
]),
].sort();
if (target_ips.length === 0) {
for (const record of listDnsByDomain(db, row.domain_id)) {
if (record.record_type.toUpperCase() !== "A") continue;
const type = record.record_type.toUpperCase();
if (type !== "A" && type !== "AAAA") continue;
if (!isIpLiteral(record.content)) continue;
if (!dnsRecordMatchesHostname(record.name, row.hostname, row.zone_name)) {
continue;
}