dcl-ops-lib 9.9.2 → 9.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/createFargateTask.js +4 -1
- package/exposeNlbService.d.ts +2 -1
- package/exposeNlbService.js +3 -2
- package/package.json +1 -1
package/createFargateTask.js
CHANGED
|
@@ -272,8 +272,11 @@ async function createFargateTask(serviceName, dockerImage, dockerListeningPort,
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
// NLB mappings: expose UDP/TCP ports via the shared Network Load Balancer
|
|
275
|
+
const nlbDnsDomains = new Set();
|
|
275
276
|
for (let nlbMapping of nlbMappings) {
|
|
276
|
-
const
|
|
277
|
+
const nlbDnsDomain = nlbMapping.separateDomain || hostname;
|
|
278
|
+
const exposedNlb = await (0, exposeNlbService_1.exposeNlbService)(`${serviceName}-${nlbMapping.port}-${version}`, hostname, nlbMapping.port, nlbMapping.protocol, vpc.id, nlbMapping.healthCheck, nlbMapping.separateDomain, nlbDnsDomains.has(nlbDnsDomain));
|
|
279
|
+
nlbDnsDomains.add(nlbDnsDomain);
|
|
277
280
|
targetGroups.push(exposedNlb.targetGroup);
|
|
278
281
|
if (!extraPortMappings.find((p) => p.hostPort === nlbMapping.port)) {
|
|
279
282
|
extraPortMappings.push({
|
package/exposeNlbService.d.ts
CHANGED
|
@@ -28,8 +28,9 @@ export type NLBMapping = {
|
|
|
28
28
|
* @param vpcId VPC ID for the target group
|
|
29
29
|
* @param healthCheck health check config for the NLB target group
|
|
30
30
|
* @param separateDomain if provided, creates DNS on this domain instead of the main one
|
|
31
|
+
* @param skipDnsRecord skip the Cloudflare record (another mapping on the same domain already created it)
|
|
31
32
|
*/
|
|
32
|
-
export declare function exposeNlbService(name: string, domain: string, port: number, protocol: "udp" | "tcp", vpcId: string, healthCheck?: NLBMapping["healthCheck"], separateDomain?: string): Promise<{
|
|
33
|
+
export declare function exposeNlbService(name: string, domain: string, port: number, protocol: "udp" | "tcp", vpcId: string, healthCheck?: NLBMapping["healthCheck"], separateDomain?: string, skipDnsRecord?: boolean): Promise<{
|
|
33
34
|
targetGroup: import("@pulumi/aws/lb/targetGroup").TargetGroup;
|
|
34
35
|
listener: import("@pulumi/aws/lb/listener").Listener;
|
|
35
36
|
cloudflareRecord: import("@pulumi/cloudflare/record").Record | undefined;
|
package/exposeNlbService.js
CHANGED
|
@@ -25,8 +25,9 @@ const DEFAULT_NLB_HEALTHCHECK = {
|
|
|
25
25
|
* @param vpcId VPC ID for the target group
|
|
26
26
|
* @param healthCheck health check config for the NLB target group
|
|
27
27
|
* @param separateDomain if provided, creates DNS on this domain instead of the main one
|
|
28
|
+
* @param skipDnsRecord skip the Cloudflare record (another mapping on the same domain already created it)
|
|
28
29
|
*/
|
|
29
|
-
async function exposeNlbService(name, domain, port, protocol, vpcId, healthCheck, separateDomain) {
|
|
30
|
+
async function exposeNlbService(name, domain, port, protocol, vpcId, healthCheck, separateDomain, skipDnsRecord = false) {
|
|
30
31
|
if (port < 7700 || port > 7799) {
|
|
31
32
|
throw new Error(`NLB port ${port} is outside the allowed range (7700-7799). Update the NLB security group in supra to allow a wider range if needed.`);
|
|
32
33
|
}
|
|
@@ -71,7 +72,7 @@ async function exposeNlbService(name, domain, port, protocol, vpcId, healthCheck
|
|
|
71
72
|
const dnsDomain = separateDomain || domain;
|
|
72
73
|
const domainParts = (0, getDomainAndSubdomain_1.getDomainAndSubdomain)(dnsDomain);
|
|
73
74
|
let cloudflareRecord;
|
|
74
|
-
if (dnsDomain.endsWith(`.${domain_1.publicDomain}`)) {
|
|
75
|
+
if (!skipDnsRecord && dnsDomain.endsWith(`.${domain_1.publicDomain}`)) {
|
|
75
76
|
cloudflareRecord = await (0, cloudflare_1.setRecord)({
|
|
76
77
|
recordName: domainParts.subdomain,
|
|
77
78
|
type: "CNAME",
|