@intentius/behold 0.29.51 → 0.29.52

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/dist/cli.js CHANGED
@@ -17640,6 +17640,7 @@ var AZURE_HEADLINE_KINDS = /* @__PURE__ */ new Set([
17640
17640
  var AZURE_FABRIC_KINDS = /* @__PURE__ */ new Set([
17641
17641
  "Microsoft.Network/virtualNetworks",
17642
17642
  "Microsoft.Network/virtualNetworks_subnets",
17643
+ "Microsoft.Network/virtualNetworks/subnets",
17643
17644
  "Microsoft.Network/networkSecurityGroups",
17644
17645
  "Microsoft.Network/routeTables",
17645
17646
  "Microsoft.Network/networkInterfaces",
@@ -17651,7 +17652,7 @@ var AZURE_FABRIC_KINDS = /* @__PURE__ */ new Set([
17651
17652
  "Microsoft.KeyVault/vaults"
17652
17653
  ]);
17653
17654
  var VNET_KIND = "Microsoft.Network/virtualNetworks";
17654
- var SUBNET_KIND = "Microsoft.Network/virtualNetworks_subnets";
17655
+ var SUBNET_KINDS = /* @__PURE__ */ new Set(["Microsoft.Network/virtualNetworks_subnets", "Microsoft.Network/virtualNetworks/subnets"]);
17655
17656
  var NSG_KIND = "Microsoft.Network/networkSecurityGroups";
17656
17657
  var RESOURCE_ID_RE = /resourceId\(\s*([^)]*)\)/g;
17657
17658
  var QUOTED_RE = /'([^']*)'/g;
@@ -17689,6 +17690,28 @@ function subnetShortName(node) {
17689
17690
  const name = resourceName(node);
17690
17691
  return name?.includes("/") ? name.split("/").slice(1).join("/") : name;
17691
17692
  }
17693
+ var CONCAT_SUBNET_RE = /resourceId\(\s*'Microsoft\.Network\/virtualNetworks'\s*,\s*'([^']+)'\s*\)\s*,\s*'\/subnets\/([^']+)'/gi;
17694
+ function subnetRefs(value, out = /* @__PURE__ */ new Set()) {
17695
+ if (typeof value === "string") {
17696
+ for (const call of value.matchAll(RESOURCE_ID_RE)) {
17697
+ const args = [...call[1].matchAll(QUOTED_RE)].map((m) => m[1]);
17698
+ if (args.length === 3 && /^Microsoft\.Network\/virtualNetworks[/_]subnets$/i.test(args[0])) out.add(`${args[1]}/${args[2]}`);
17699
+ }
17700
+ for (const m of value.matchAll(CONCAT_SUBNET_RE)) out.add(`${m[1]}/${m[2]}`);
17701
+ } else if (value && typeof value === "object") {
17702
+ for (const v of Object.values(value)) subnetRefs(v, out);
17703
+ }
17704
+ return out;
17705
+ }
17706
+ function inlineSubnets(vnet) {
17707
+ const list4 = vnet.attrs?.subnets;
17708
+ if (!Array.isArray(list4)) return [];
17709
+ return list4.flatMap((s) => {
17710
+ const name = s?.name;
17711
+ const prefix = s?.properties?.addressPrefix;
17712
+ return typeof name === "string" ? [[name, typeof prefix === "string" ? prefix : void 0]] : [];
17713
+ });
17714
+ }
17692
17715
  function vnetCidr(node) {
17693
17716
  const space = node.attrs?.addressSpace;
17694
17717
  const prefixes = space?.addressPrefixes;
@@ -17705,7 +17728,7 @@ function projectAzureLogical(ir, env) {
17705
17728
  if (name && !byName.has(name)) byName.set(name, n);
17706
17729
  }
17707
17730
  const vnets = azure.filter((n) => n.kind === VNET_KIND);
17708
- const subnets = azure.filter((n) => n.kind === SUBNET_KIND);
17731
+ const subnets = azure.filter((n) => SUBNET_KINDS.has(n.kind));
17709
17732
  const vnetByName = new Map(vnets.map((v) => [resourceName(v) ?? v.id, v]));
17710
17733
  const refOut = /* @__PURE__ */ new Map();
17711
17734
  for (const n of azure) {
@@ -17762,8 +17785,38 @@ function projectAzureLogical(ir, env) {
17762
17785
  const v = parentVnet ? vnetByName.get(parentVnet) : void 0;
17763
17786
  child(v ? vnetTitle(v) : RG_TITLE, subnetTitle(s));
17764
17787
  }
17788
+ const inlineBox = /* @__PURE__ */ new Map();
17789
+ for (const v of vnets) {
17790
+ for (const [name, prefix] of inlineSubnets(v)) {
17791
+ const key3 = `${resourceName(v) ?? v.id}/${name}`;
17792
+ if (subnets.some((s) => resourceName(s) === key3)) continue;
17793
+ const title = `subnet ${prefix ?? name}`;
17794
+ inlineBox.set(key3, title);
17795
+ child(vnetTitle(v), title);
17796
+ }
17797
+ }
17798
+ const inlinePlace = (start) => {
17799
+ const seen = /* @__PURE__ */ new Set();
17800
+ let frontier = [start];
17801
+ for (let depth = 0; depth < 6 && frontier.length; depth++) {
17802
+ const next = [];
17803
+ for (const id of frontier) {
17804
+ if (seen.has(id)) continue;
17805
+ seen.add(id);
17806
+ for (const key3 of subnetRefs(byId.get(id)?.attrs)) if (inlineBox.has(key3)) return inlineBox.get(key3);
17807
+ for (const r of refOut.get(id) ?? []) if (!seen.has(r)) next.push(r);
17808
+ }
17809
+ frontier = next;
17810
+ }
17811
+ return void 0;
17812
+ };
17765
17813
  const placeOf = /* @__PURE__ */ new Map();
17766
17814
  for (const n of headline) {
17815
+ const inline = inlinePlace(n.id);
17816
+ if (inline) {
17817
+ placeOf.set(n.id, inline);
17818
+ continue;
17819
+ }
17767
17820
  const subnetId = nearest(n.id, subnetIds);
17768
17821
  if (subnetId) {
17769
17822
  placeOf.set(n.id, subnetTitle(byId.get(subnetId)));
@@ -17834,7 +17887,11 @@ var GCP_HEADLINE_KINDS = /* @__PURE__ */ new Set([
17834
17887
  "GCP::Sql::Instance",
17835
17888
  "GCP::Storage::Bucket",
17836
17889
  "GCP::Compute::Instance",
17837
- "GCP::Dns::ManagedZone"
17890
+ "GCP::Dns::ManagedZone",
17891
+ // A load balancer's front end, the card the AWS lens draws for an ALB
17892
+ // (behold#824); its proxy, URL map, backend service and NEG are contracted
17893
+ // through, so the card joins the service they route to.
17894
+ "GCP::Compute::ForwardingRule"
17838
17895
  ]);
17839
17896
  var GCP_FABRIC_KINDS = /* @__PURE__ */ new Set([
17840
17897
  // networking — declared, not emulated
@@ -17916,10 +17973,25 @@ function projectGcpLogical(ir, env) {
17916
17973
  }
17917
17974
  for (const [component, members] of byComponent) {
17918
17975
  const places = new Set(members.map((m) => placeOf.get(m.id)));
17919
- const parent = places.size === 1 ? [...places][0] : PROJECT_TITLE;
17920
- if (parent === GLOBAL) child(PROJECT_TITLE, GLOBAL);
17921
- child(parent, component);
17922
- for (const m of members) child(component, m.id);
17976
+ const regional = [...places].filter((p) => p !== "location global");
17977
+ if (places.size > 1 && regional.length > 1) {
17978
+ child(PROJECT_TITLE, component);
17979
+ for (const m of members) child(component, m.id);
17980
+ continue;
17981
+ }
17982
+ if (places.size === 1) {
17983
+ const parent = [...places][0];
17984
+ if (parent === GLOBAL) child(PROJECT_TITLE, GLOBAL);
17985
+ child(parent, component);
17986
+ for (const m of members) child(component, m.id);
17987
+ continue;
17988
+ }
17989
+ for (const place of places) {
17990
+ if (place === GLOBAL) child(PROJECT_TITLE, GLOBAL);
17991
+ const part = `${component} \xB7 ${place.replace(/^location /, "")}`;
17992
+ child(place, part);
17993
+ for (const m of members) if (placeOf.get(m.id) === place) child(part, m.id);
17994
+ }
17923
17995
  }
17924
17996
  const kept = new Set(headline.map((n) => n.id));
17925
17997
  const adj = /* @__PURE__ */ new Map();
@@ -18358,10 +18430,19 @@ function componentNamer(nodes, groups) {
18358
18430
  }
18359
18431
  }
18360
18432
  }
18361
- return (node) => {
18433
+ const component = (node) => {
18362
18434
  const dirs = segments(node);
18363
18435
  return dirs[shared2] ?? dirs[dirs.length - 1] ?? "other";
18364
18436
  };
18437
+ const seen = /* @__PURE__ */ new Map();
18438
+ for (const n of nodes) {
18439
+ const m = memberOf(n);
18440
+ if (m) (seen.get(m) ?? seen.set(m, /* @__PURE__ */ new Set()).get(m)).add(component(n));
18441
+ }
18442
+ return (node) => {
18443
+ const m = memberOf(node);
18444
+ return m && seen.get(m)?.size === 1 ? m : component(node);
18445
+ };
18365
18446
  }
18366
18447
  function memberNamer(groups) {
18367
18448
  const byStack = groups?.byStack;
@@ -35,4 +35,4 @@ npx serve export
35
35
 
36
36
  `cd dns && npx chant run front-door` runs the same steps as an Op.
37
37
 
38
- Needs chant 0.124.34 or newer.
38
+ Needs chant 0.124.35 or newer.
@@ -1,13 +1,49 @@
1
- import { managedEnvironments, containerApps, output } from "@intentius/chant-lexicon-azure";
1
+ import { LogAnalyticsWorkspace, ManagedIdentity, VirtualNetwork, managedEnvironments, containerApps, output } from "@intentius/chant-lexicon-azure";
2
2
 
3
- // The website on Azure Container Apps in West Europe: one environment and one
4
- // app with external ingress.
5
- export const env = new managedEnvironments({ name: "three-cloud", location: "westeurope" });
3
+ // The website on Azure Container Apps in West Europe, set up the way a
4
+ // production environment is: the environment sits in its own VNet subnet and
5
+ // ships its logs to a Log Analytics workspace, and the app runs as a
6
+ // user-assigned identity. Container Apps brings its own ingress and load
7
+ // balancing, so there is no load balancer to declare.
8
+ const location = "westeurope";
9
+
10
+ export const logs = new LogAnalyticsWorkspace({ name: "three-cloud-logs", location, sku: { name: "PerGB2018" }, retentionInDays: 30 });
11
+
12
+ // A Container Apps environment on workload profiles takes a /23 or larger,
13
+ // delegated to it. The subnet is declared inside the VNet: chant's own Subnet
14
+ // resource writes the ARM type as virtualNetworks_subnets (reported to chant).
15
+ export const vnet = new VirtualNetwork({
16
+ name: "three-cloud-vnet",
17
+ location,
18
+ addressSpace: { addressPrefixes: ["10.40.0.0/16"] },
19
+ subnets: [{ name: "apps", properties: { addressPrefix: "10.40.0.0/23", delegations: [{ name: "apps", properties: { serviceName: "Microsoft.App/environments" } }] } }],
20
+ });
21
+
22
+ export const identity = new ManagedIdentity({ name: "three-cloud-web", location });
23
+
24
+ export const env = new managedEnvironments({
25
+ name: "three-cloud",
26
+ location,
27
+ // concat() rather than resourceId('.../virtualNetworks/subnets', vnet, subnet):
28
+ // chant 0.124.34's apply evaluates the latter to the wrong path (fixed by
29
+ // INTENTIUS/chant#4234, not yet released).
30
+ vnetConfiguration: { infrastructureSubnetId: "[concat(resourceId('Microsoft.Network/virtualNetworks', 'three-cloud-vnet'), '/subnets/apps')]", internal: false },
31
+ appLogsConfiguration: {
32
+ destination: "log-analytics",
33
+ logAnalyticsConfiguration: {
34
+ customerId: "[reference('three-cloud-logs').customerId]",
35
+ sharedKey: "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces', 'three-cloud-logs'), '2023-09-01').primarySharedKey]",
36
+ },
37
+ },
38
+ workloadProfiles: [{ name: "Consumption", workloadProfileType: "Consumption" }],
39
+ });
6
40
 
7
41
  export const app = new containerApps({
8
42
  name: "web",
9
- location: "westeurope",
43
+ location,
44
+ identity: { type: "UserAssigned", userAssignedIdentities: { "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', 'three-cloud-web')]": {} } },
10
45
  managedEnvironmentId: env.id,
46
+ workloadProfileName: "Consumption",
11
47
  configuration: { ingress: { external: true, targetPort: 80, transport: "auto" } },
12
48
  template: {
13
49
  containers: [{ name: "web", image: "traefik/whoami:v1.10", resources: { cpu: 0.25, memory: "0.5Gi" } }],
@@ -7,7 +7,9 @@ import { HostedZone, HealthCheck, RecordSet, Parameter } from "@intentius/chant-
7
7
  // Latency records name an AWS region, so Azure (West Europe) answers as
8
8
  // eu-west-1 and GCP (Tokyo) as ap-northeast-1. All three are CNAMEs, since an
9
9
  // alias can only point at an AWS target and records sharing a name must share
10
- // a type.
10
+ // a type. GCP's load balancer has an IP address rather than a hostname, so
11
+ // it gets a name of its own (an A record) and the latency record points at
12
+ // that, as a GCP load balancer is usually published.
11
13
  //
12
14
  // Each endpoint arrives as a parameter named like the output the cloud's
13
15
  // member publishes, which is the join behold draws the cross-member edge on.
@@ -18,7 +20,7 @@ export const zone = new HostedZone({ Name: "three-cloud.example." });
18
20
 
19
21
  export const awsEndpoint = new Parameter("String", { description: "The aws member's load balancer hostname" });
20
22
  export const azureEndpoint = new Parameter("String", { description: "The azure member's Container App hostname" });
21
- export const gcpEndpoint = new Parameter("String", { description: "The gcp member's Cloud Run hostname" });
23
+ export const gcpEndpoint = new Parameter("String", { description: "The gcp member's load balancer IP address" });
22
24
 
23
25
  function healthCheck(endpoint: Parameter) {
24
26
  return new HealthCheck({
@@ -32,7 +34,7 @@ function healthCheck(endpoint: Parameter) {
32
34
  });
33
35
  }
34
36
 
35
- function latencyRecord(id: string, region: string, endpoint: Parameter, check: HealthCheck) {
37
+ function latencyRecord(id: string, region: string, endpoint: Parameter | string, check: HealthCheck) {
36
38
  return new RecordSet({
37
39
  HostedZoneId: zone.Id,
38
40
  Name: NAME,
@@ -47,8 +49,14 @@ function latencyRecord(id: string, region: string, endpoint: Parameter, check: H
47
49
 
48
50
  export const awsCheck = healthCheck(awsEndpoint);
49
51
  export const azureCheck = healthCheck(azureEndpoint);
50
- export const gcpCheck = healthCheck(gcpEndpoint);
52
+ // The check on GCP probes the load balancer's address directly.
53
+ export const gcpCheck = new HealthCheck({
54
+ HealthCheckConfig: { Type: "HTTP", IPAddress: gcpEndpoint, Port: 80, ResourcePath: "/", RequestInterval: 10, FailureThreshold: 1 },
55
+ });
56
+
57
+ const GCP_ORIGIN = "gcp.three-cloud.example.";
58
+ export const gcpOrigin = new RecordSet({ HostedZoneId: zone.Id, Name: GCP_ORIGIN, Type: "A", TTL: "60", ResourceRecords: [gcpEndpoint as unknown as string] });
51
59
 
52
60
  export const awsRecord = latencyRecord("aws", "us-east-1", awsEndpoint, awsCheck);
53
61
  export const azureRecord = latencyRecord("azure", "eu-west-1", azureEndpoint, azureCheck);
54
- export const gcpRecord = latencyRecord("gcp", "ap-northeast-1", gcpEndpoint, gcpCheck);
62
+ export const gcpRecord = latencyRecord("gcp", "ap-northeast-1", GCP_ORIGIN, gcpCheck);
@@ -1,19 +1,86 @@
1
- import { CloudRunServiceComposite, output } from "@intentius/chant-lexicon-gcp";
1
+ import {
2
+ BackendService,
3
+ CloudRunServiceComposite,
4
+ ComputeAddress,
5
+ ForwardingRule,
6
+ GCPServiceAccount,
7
+ RegionNetworkEndpointGroup,
8
+ TargetHTTPProxy,
9
+ URLMap,
10
+ output,
11
+ } from "@intentius/chant-lexicon-gcp";
12
+
13
+ // The website on Cloud Run in Tokyo, running as its own service account, behind
14
+ // a global external Application Load Balancer as production sets it up: a
15
+ // static address and a forwarding rule, an HTTP proxy, a URL map, a backend
16
+ // service, and a serverless network endpoint group that names the service.
17
+ // The load balancer kinds apply with chant 0.124.35 or newer (chant#4233).
18
+ //
19
+ // Each reference is Config Connector's `{ name }`, spelled out: chant writes
20
+ // an attribute reference's `.name` as the logical id rather than the
21
+ // resource's metadata.name (reported to chant).
22
+ const region = "asia-northeast1";
23
+
24
+ export const runtime = new GCPServiceAccount({
25
+ metadata: { name: "three-cloud-run" },
26
+ displayName: "three-cloud website runtime",
27
+ });
2
28
 
3
- // The website on Cloud Run in Tokyo, open to unauthenticated callers.
4
29
  export const web = CloudRunServiceComposite({
5
- name: "web",
30
+ name: "three-cloud-site",
6
31
  image: "traefik/whoami:v1.10",
7
32
  projectId: "three-cloud",
8
- location: "asia-northeast1",
33
+ location: region,
9
34
  port: 80,
10
35
  minInstanceCount: 1,
11
36
  maxInstanceCount: 1,
12
37
  publicAccess: true,
38
+ serviceAccount: "three-cloud-run",
39
+ });
40
+
41
+ export const neg = new RegionNetworkEndpointGroup({
42
+ metadata: { name: "three-cloud-neg" },
43
+ region,
44
+ networkEndpointType: "SERVERLESS",
45
+ cloudRun: { serviceRef: { name: "three-cloud-site" } },
46
+ });
47
+
48
+ // A backend service over a serverless NEG takes no health check: Cloud Run
49
+ // reports its own readiness.
50
+ export const backend = new BackendService({
51
+ metadata: { name: "three-cloud-backend" },
52
+ location: "global",
53
+ loadBalancingScheme: "EXTERNAL_MANAGED",
54
+ protocol: "HTTP",
55
+ backend: [{ group: { networkEndpointGroupRef: { name: "three-cloud-neg" } } }],
56
+ });
57
+
58
+ export const urlMap = new URLMap({
59
+ metadata: { name: "three-cloud-map" },
60
+ location: "global",
61
+ defaultService: { backendServiceRef: { name: "three-cloud-backend" } },
62
+ });
63
+
64
+ export const proxy = new TargetHTTPProxy({
65
+ metadata: { name: "three-cloud-proxy" },
66
+ location: "global",
67
+ urlMapRef: { name: "three-cloud-map" },
68
+ });
69
+
70
+ export const address = new ComputeAddress({ metadata: { name: "three-cloud-ip" }, location: "global" });
71
+
72
+ export const rule = new ForwardingRule({
73
+ metadata: { name: "three-cloud-rule" },
74
+ location: "global",
75
+ loadBalancingScheme: "EXTERNAL_MANAGED",
76
+ portRange: "80",
77
+ ipAddress: { addressRef: { name: "three-cloud-ip" } },
78
+ target: { targetHTTPProxyRef: { name: "three-cloud-proxy" } },
13
79
  });
14
80
 
15
- // The dns member reads this as its `gcpEndpoint` parameter. Config Connector
16
- // YAML has no outputs, so `chant build` warns that this one is not written:
17
- // the graph still joins it to dns, and scripts/front-door.ts reads the URI
18
- // from the emulator to pass it on.
19
- export const gcpEndpoint = output(web.service.status_uri, "gcpEndpoint");
81
+ // The dns member reads this as its `gcpEndpoint` parameter: the load
82
+ // balancer's front end, whose IP is the reserved address. Config Connector
83
+ // YAML has no outputs and neither kind exposes the IP as an attribute, so
84
+ // this declares the join for the graph, and scripts/front-door.ts reads the
85
+ // IP from the emulator.
86
+ export const gcpEndpoint = output(rule.status_selfLink, "gcpEndpoint");
@@ -6,10 +6,10 @@
6
6
  "": {
7
7
  "name": "behold-example-three-cloud",
8
8
  "dependencies": {
9
- "@intentius/chant": "^0.124.34",
10
- "@intentius/chant-lexicon-aws": "^0.124.34",
11
- "@intentius/chant-lexicon-azure": "^0.124.34",
12
- "@intentius/chant-lexicon-gcp": "^0.124.34"
9
+ "@intentius/chant": "^0.124.35",
10
+ "@intentius/chant-lexicon-aws": "^0.124.35",
11
+ "@intentius/chant-lexicon-azure": "^0.124.35",
12
+ "@intentius/chant-lexicon-gcp": "^0.124.35"
13
13
  }
14
14
  },
15
15
  "node_modules/@dagrejs/dagre": {
@@ -444,9 +444,9 @@
444
444
  }
445
445
  },
446
446
  "node_modules/@intentius/chant": {
447
- "version": "0.124.34",
448
- "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.34.tgz",
449
- "integrity": "sha512-kjaXqQogoVu4GqWizX37QWTgVFPKgl3UOdilO9/defDJhSADEttST98KwwAZTXppq+ZtfjsoFP9z3tFmPOXAlw==",
447
+ "version": "0.124.35",
448
+ "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.35.tgz",
449
+ "integrity": "sha512-4WGA/eLFtn5bKN0SwHQILbMYnk3gEZ+nfj01a1yuq+4mTRK45JGDthZIQZMi7vTtT8lCf4lbeUjuS/UD7Qk+kw==",
450
450
  "license": "Apache-2.0",
451
451
  "dependencies": {
452
452
  "@dagrejs/dagre": "^3.0.0",
@@ -473,34 +473,34 @@
473
473
  }
474
474
  },
475
475
  "node_modules/@intentius/chant-lexicon-aws": {
476
- "version": "0.124.34",
477
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.34.tgz",
478
- "integrity": "sha512-ab0PPUKYtKBoQ5a1zSn+N/I+tJFnPiNq7Sqv6tTzAP6/ku7GsOb0ltCWvgzfsvP6Ah80Z2Xv2d81CMim6jhd3Q==",
476
+ "version": "0.124.35",
477
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.35.tgz",
478
+ "integrity": "sha512-yhne5yFhCRF+GqsUoleNJRANTUHvsHeoplJ8xdb1Q1LkJABuelnWDNCRaL5aXNh4ONu53OQH44TwdvU2Fr3Qeg==",
479
479
  "license": "Apache-2.0",
480
480
  "dependencies": {
481
481
  "fflate": "^0.8.2",
482
482
  "js-yaml": "^4.3.1"
483
483
  },
484
484
  "peerDependencies": {
485
- "@intentius/chant": "^0.124.34"
485
+ "@intentius/chant": "^0.124.35"
486
486
  }
487
487
  },
488
488
  "node_modules/@intentius/chant-lexicon-azure": {
489
- "version": "0.124.34",
490
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.34.tgz",
491
- "integrity": "sha512-SJQYxHD1LMXS/tyTIER+veR/iMFD7rz5TLCtWZ4BS8MfhZnzB1uA7/liF+lwHW/qWYhG7F8cRYi1ywKL+rlKEQ==",
489
+ "version": "0.124.35",
490
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.35.tgz",
491
+ "integrity": "sha512-pK7C2HyBbfVLxv1oTwf3YM9s+Dit4NHZTHED8dyGOcPvbO0/1+Q9B/MD5A467L94I+s5QjMMAt1yd9Gu77E9jA==",
492
492
  "license": "Apache-2.0",
493
493
  "dependencies": {
494
494
  "fflate": "^0.8.2"
495
495
  },
496
496
  "peerDependencies": {
497
- "@intentius/chant": "^0.124.34"
497
+ "@intentius/chant": "^0.124.35"
498
498
  }
499
499
  },
500
500
  "node_modules/@intentius/chant-lexicon-gcp": {
501
- "version": "0.124.34",
502
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.34.tgz",
503
- "integrity": "sha512-qPhyT4eH3sxa5jHnglnVARc37yTW+xjGmGhU6jZxDJGSjOuXLprV7NPXBVcCMtR+jd6OlUtgICFKE8b+AhdXGg==",
501
+ "version": "0.124.35",
502
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.35.tgz",
503
+ "integrity": "sha512-qB2vQKi7hZjBl2/1R/A+yDIoQ44wq1Y0QE16D2tN70pE06ufjwwRd1MKMVQi3oHxynM8cQCA3QL7HUfb8/ZR3Q==",
504
504
  "license": "Apache-2.0",
505
505
  "dependencies": {
506
506
  "@types/js-yaml": "^4.0.9",
@@ -508,7 +508,7 @@
508
508
  "js-yaml": "^4.3.1"
509
509
  },
510
510
  "peerDependencies": {
511
- "@intentius/chant": "^0.124.34"
511
+ "@intentius/chant": "^0.124.35"
512
512
  }
513
513
  },
514
514
  "node_modules/@types/js-yaml": {
@@ -8,9 +8,9 @@
8
8
  "front-door": "tsx scripts/front-door.ts all --out export"
9
9
  },
10
10
  "dependencies": {
11
- "@intentius/chant": "^0.124.34",
12
- "@intentius/chant-lexicon-aws": "^0.124.34",
13
- "@intentius/chant-lexicon-azure": "^0.124.34",
14
- "@intentius/chant-lexicon-gcp": "^0.124.34"
11
+ "@intentius/chant": "^0.124.35",
12
+ "@intentius/chant-lexicon-aws": "^0.124.35",
13
+ "@intentius/chant-lexicon-azure": "^0.124.35",
14
+ "@intentius/chant-lexicon-gcp": "^0.124.35"
15
15
  }
16
16
  }
@@ -38,9 +38,9 @@ boot() {
38
38
  }
39
39
 
40
40
  boot "${FLOCI_CONTAINER:-chant-floci}" "${FLOCI_PORT:-4566}" 4566 \
41
- "${FLOCI_IMAGE:-ghcr.io/lex00/floci:e9ebdb3}" /_floci/health
41
+ "${FLOCI_IMAGE:-ghcr.io/lex00/floci:48c6e47}" /_floci/health
42
42
  boot "${FLOCI_AZ_CONTAINER:-chant-floci-az}" "${FLOCI_AZ_PORT:-4577}" 4577 \
43
- "${FLOCI_AZ_IMAGE:-ghcr.io/lex00/floci-az:e1def56}" /_floci/health \
43
+ "${FLOCI_AZ_IMAGE:-ghcr.io/lex00/floci-az:7f079c2}" /_floci/health \
44
44
  -e FLOCI_AZ_SERVICES_CONTAINER_APPS_MOCKED=false
45
45
  boot "${FLOCI_GCP_CONTAINER:-chant-floci-gcp}" "${FLOCI_GCP_PORT:-4588}" 4588 \
46
- "${FLOCI_GCP_IMAGE:-ghcr.io/lex00/floci-gcp:4bb6a04}" /_floci-gcp/health
46
+ "${FLOCI_GCP_IMAGE:-ghcr.io/lex00/floci-gcp:641e6e8}" /_floci-gcp/health
@@ -7,7 +7,7 @@
7
7
  * until `chant lifecycle health` reads azureCheck healthy
8
8
  * tsx scripts/front-door.ts azure-off deactivate the Azure app's active revision
9
9
  * tsx scripts/front-door.ts wait until azureCheck reads unhealthy
10
- * tsx scripts/front-door.ts export --out <dir> behold export, opening on env local at the composites zoom
10
+ * tsx scripts/front-door.ts export --out <dir> behold export, opening on env local at the logical zoom
11
11
  *
12
12
  * dns/ops/front-door.op.ts runs the same steps as an Op's phases. The emulators
13
13
  * are the ones `behold demo three-cloud` boots (chant-floci, chant-floci-az,
@@ -115,10 +115,21 @@ async function applyGcp(): Promise<string> {
115
115
  // is not written (chant warns). The URI is read from the service instead.
116
116
  // The service's location is the manifest's, or us-central1 where gcpApply
117
117
  // puts a service that names none.
118
- const location = /^\s+location:\s*['"]?([a-z0-9-]+)/m.exec(readFileSync(manifest, "utf8"))?.[1] ?? "us-central1";
119
- const svc = (await getJson(`${GCP}/v2/projects/${GCP_PROJECT}/locations/${location}/services/web`)) as { uri?: string };
120
- if (!svc.uri) throw new Refusal(`gcp: the Cloud Run service web has no uri yet (${JSON.stringify(svc).slice(0, 300)})`);
121
- return new URL(svc.uri).hostname;
118
+ // The RunService's own location: the load balancer's kinds say `global`.
119
+ const location = /kind:\s*RunService[\s\S]*?^\s+location:\s*['"]?([a-z0-9-]+)/m.exec(readFileSync(manifest, "utf8"))?.[1] ?? "us-central1";
120
+ const svc = (await getJson(`${GCP}/v2/projects/${GCP_PROJECT}/locations/${location}/services/three-cloud-site`)) as { uri?: string };
121
+ if (!svc.uri) throw new Refusal(`gcp: the Cloud Run service three-cloud-site has no uri yet (${JSON.stringify(svc).slice(0, 300)})`);
122
+ say(`gcp: Cloud Run answers as ${new URL(svc.uri).hostname}`);
123
+ // Route 53 points at the load balancer's address. A chant older than
124
+ // 0.124.35 skips the load balancer kinds ("no mapper"), and then there is
125
+ // no address: the record gets one nothing answers on (192.0.2.1, kept for
126
+ // documentation by RFC 5737), and the page shows GCP failing its check.
127
+ const addr = (await fetch(`${GCP}/compute/v1/projects/${GCP_PROJECT}/global/addresses/three-cloud-ip`).then((r) => (r.ok ? r.json() : {}))) as { address?: string };
128
+ if (!addr.address) {
129
+ say("gcp: the load balancer was NOT APPLIED (it needs chant 0.124.35 or newer), so the gcp record has nothing behind it");
130
+ return "192.0.2.1";
131
+ }
132
+ return addr.address;
122
133
  }
123
134
 
124
135
  async function applyAzure(): Promise<string> {
@@ -201,7 +212,7 @@ async function applyDns(endpoints: Record<string, string>, probes: Record<string
201
212
 
202
213
  export async function apply(): Promise<void> {
203
214
  const gcp = await applyGcp();
204
- say(`gcp: web answers as ${gcp}`);
215
+ say(`gcp: the load balancer answers on ${gcp}`);
205
216
  const azure = await applyAzure();
206
217
  say(`azure: web answers as ${azure}`);
207
218
  const aws = await applyAws();
@@ -223,8 +234,8 @@ export async function apply(): Promise<void> {
223
234
  awsCheck: { address: "endpoint" in aws ? containerAddress(CONTAINERS.aws) : "192.0.2.1", port: 80 },
224
235
  // floci-az serves every app on its own port, by Host header.
225
236
  azureCheck: { address: containerAddress(CONTAINERS.azure), port: 4577 },
226
- // floci-gcp's front door serves Cloud Run services by Host header too.
227
- gcpCheck: { address: containerAddress(CONTAINERS.gcp), port: 4588 },
237
+ // floci-gcp opens a forwarding rule's port (80) in its container.
238
+ gcpCheck: { address: gcp === "192.0.2.1" ? gcp : containerAddress(CONTAINERS.gcp), port: 80 },
228
239
  },
229
240
  );
230
241
  say("dns: applied");
@@ -299,7 +310,7 @@ export function exportPage(out: string): void {
299
310
  // BEHOLD names the behold to run (a checkout's `tsx src/cli.ts`, say);
300
311
  // by default it is the published one.
301
312
  const behold = (process.env.BEHOLD ?? "npx --yes @intentius/behold").split(" ");
302
- const args = [...behold.slice(1), "export", ROOT, "--out", resolve(out), "--open-env", ENV, "--open-zoom", "composites", "--note", NOTE];
313
+ const args = [...behold.slice(1), "export", ROOT, "--out", resolve(out), "--open-env", ENV, "--open-zoom", "logical", "--note", NOTE];
303
314
  say(`export: ${behold[0]} ${args.join(" ")}`);
304
315
  const r = spawnSync(behold[0]!, args, { env: childEnv, stdio: "inherit" });
305
316
  if (r.status !== 0) throw new Refusal(`behold export exited ${r.status}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/behold",
3
- "version": "0.29.51",
3
+ "version": "0.29.52",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@hono/node-server": "^2.0.5",
50
- "@intentius/chant": "^0.124.34",
50
+ "@intentius/chant": "^0.124.35",
51
51
  "@intentius/chant-k8s-client": "^0.124.24",
52
52
  "@intentius/pinhole": "^0.5.0",
53
53
  "ajv": "^8.20.0",