fix(integrations): не считать CNAME hostname за IP при sync
JOIN dns_record клал content CNAME в target_ips и блокировал разворот до origin IP / service IPs. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user