boatyard 0.9.9.dev270__tar.gz → 0.9.10.dev275__tar.gz

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.
Files changed (84) hide show
  1. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/AGENTS.md +10 -2
  2. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/PKG-INFO +1 -1
  3. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/pyproject.toml +1 -1
  4. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/lock.py +17 -0
  5. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/models/config_file.py +7 -1
  6. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/models/lock_file.py +1 -0
  7. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/models/workload.py +14 -1
  8. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/resolve.py +33 -0
  9. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score.py +6 -0
  10. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_compose.py +2 -0
  11. boatyard-0.9.10.dev275/src/boatyard/score_patch_templates/docker-socket.tpl +27 -0
  12. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_patch_templates/probe-adapter-healthchecks.tpl +20 -10
  13. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_assembly.py +37 -0
  14. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_lock.py +46 -0
  15. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_score_generate.py +85 -5
  16. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/.gitattributes +0 -0
  17. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/.github/workflows/cleanup-pr-releases.yml +0 -0
  18. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/.github/workflows/integrate.yml +0 -0
  19. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/.github/workflows/merge-gate.yml +0 -0
  20. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/.github/workflows/release.yml +0 -0
  21. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/.gitignore +0 -0
  22. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/.python-version +0 -0
  23. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/CLAUDE.md +0 -0
  24. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/LICENSE +0 -0
  25. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/NOTICE +0 -0
  26. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/README.md +0 -0
  27. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/design/AGENTS.md +0 -0
  28. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/design/CLAUDE.md +0 -0
  29. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/design/apt-hermeticity.md +0 -0
  30. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/design/mirror-digest-retention.md +0 -0
  31. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/design/precision-attribution.md +0 -0
  32. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/design/semver-image-bundle-lines.md +0 -0
  33. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/publish.yml +0 -0
  34. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/ruff.base.toml +0 -0
  35. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/ruff.toml +0 -0
  36. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/scripts/preflight.py +0 -0
  37. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/__init__.py +0 -0
  38. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/build.py +0 -0
  39. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/cli.py +0 -0
  40. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/crane.py +0 -0
  41. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/markers.py +0 -0
  42. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/models/__init__.py +0 -0
  43. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/models/image.py +0 -0
  44. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/models/k8s_pins.py +0 -0
  45. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/models/pyproject.py +0 -0
  46. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/models/values_file.py +0 -0
  47. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/paths.py +0 -0
  48. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/publish.py +0 -0
  49. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/py.typed +0 -0
  50. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_generate.py +0 -0
  51. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_k8s.py +0 -0
  52. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_patch_templates/gpu-cuda.tpl +0 -0
  53. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_patch_templates/gpu-pod.tpl +0 -0
  54. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_patch_templates/gpu-rocm.tpl +0 -0
  55. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_patch_templates/restart.tpl +0 -0
  56. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/score_patch_templates/scale-to-zero.tpl +0 -0
  57. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/temp.py +0 -0
  58. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/__init__.py +0 -0
  59. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/build.py +0 -0
  60. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/bump.py +0 -0
  61. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/down.py +0 -0
  62. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/lock.py +0 -0
  63. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/matrix.py +0 -0
  64. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/mirror.py +0 -0
  65. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/publish.py +0 -0
  66. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/score.py +0 -0
  67. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/tree_tags.py +0 -0
  68. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/verbs/up.py +0 -0
  69. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/src/boatyard/yaml.py +0 -0
  70. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/conftest.py +0 -0
  71. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_build_docker.py +0 -0
  72. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_bump.py +0 -0
  73. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_compose.py +0 -0
  74. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_config.py +0 -0
  75. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_daemon_gc.py +0 -0
  76. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_image_builds.py +0 -0
  77. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_markers.py +0 -0
  78. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_matrix.py +0 -0
  79. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_mirror.py +0 -0
  80. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_provisioners.py +0 -0
  81. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_publish_compose.py +0 -0
  82. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_tree_tags.py +0 -0
  83. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/tests/test_values.py +0 -0
  84. {boatyard-0.9.9.dev270 → boatyard-0.9.10.dev275}/uv.lock +0 -0
@@ -44,7 +44,12 @@ Design intent and silent-failure traps, one fact per bullet.
44
44
  `${listeners.<name>.port}` variables. The generation seam derives `service.ports` from the
45
45
  non-internal listeners, rewrites the names to their integers, and composes the score tools'
46
46
  document from the lens without the `listeners:` and `boatyard:` blocks, so a port integer is
47
- authored exactly once and every reference is resolvable from the file itself.
47
+ authored exactly once and every reference is resolvable from the file itself. The rendered
48
+ stanza carries the whole inventory — internal listeners included — as the
49
+ `boatyard/listeners` interchange label the bundle-record extraction reads back, and a config
50
+ `ports:` entry may target a listener by name (`target: {listener: <name>}`), resolved at
51
+ resolve against the bundle's records; internal listeners are legal targets there because a
52
+ host publish reaches the container port without the service surface.
48
53
  - Routes are claims the serving surface authors against that inventory: a workload's
49
54
  `boatyard: {route: {path: /auth/*, port: http, strip: true}}` — the port names a
50
55
  non-internal listener — or a provisioner stanza's `route: {path, port, strip}` mapping, the
@@ -84,7 +89,10 @@ Design intent and silent-failure traps, one fact per bullet.
84
89
  facts (routes, publishes, container sources, interpolation targets) in the `boatyard:` block —
85
90
  and `boatyard.yml` holds no per-workload runtime fact. The gpu annotation (`"true"`) is
86
91
  substrate only
87
- and the patch templates are its reader; start behavior is a separate annotation —
92
+ and the patch templates are its reader; the docker-socket annotation (`"true"`, compose
93
+ rendering only) binds `/var/run/docker.sock` for container-controlling workloads — score's
94
+ workload spec carries no volume grammar, so the bind rides the same patch-template seam;
95
+ start behavior is a separate annotation —
88
96
  `boatyard/autostart: "false"` leaves the container created-stopped instead of
89
97
  started by `up`, on any service, gpu or not, recorded in the bundle records as
90
98
  held services (lock-time for remote bundles, resolve-time for local and override
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: boatyard
3
- Version: 0.9.9.dev270
3
+ Version: 0.9.10.dev275
4
4
  Summary: Deploy-files definition language and compiler, plus a runtime for the compose target
5
5
  License-File: LICENSE
6
6
  License-File: NOTICE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "boatyard"
3
- version = "0.9.9.dev270"
3
+ version = "0.9.10.dev275"
4
4
  description = "Deploy-files definition language and compiler, plus a runtime for the compose target"
5
5
  requires-python = ">=3.13"
6
6
  dependencies = [
@@ -32,6 +32,7 @@ from boatyard.models.lock_file import (
32
32
  )
33
33
  from boatyard.models.workload import (
34
34
  AUTOSTART_ANNOTATION,
35
+ LISTENERS_LABEL,
35
36
  PUBLISH_PORT_LABEL,
36
37
  ROUTE_PATH_LABEL,
37
38
  ROUTE_PATH_PATTERN,
@@ -107,6 +108,7 @@ class BundleRecords(NamedTuple):
107
108
  container_names: list[str]
108
109
  held_services: list[str]
109
110
  declared_ports: dict[str, list[tuple[int, int, str]]]
111
+ listeners: dict[str, dict[str, int]]
110
112
 
111
113
 
112
114
  def relock(config: ConfigFile, *, upgrade: bool = False, check: bool = False) -> LockFile:
@@ -145,6 +147,7 @@ def relock(config: ConfigFile, *, upgrade: bool = False, check: bool = False) ->
145
147
  container_names=records.container_names,
146
148
  held_services=records.held_services,
147
149
  declared_ports=records.declared_ports,
150
+ listeners=records.listeners,
148
151
  )
149
152
 
150
153
  # Refuse committed entries for local base_images keys
@@ -283,6 +286,7 @@ def extract_bundle_records(texts: list[str]) -> BundleRecords:
283
286
  # Read the routes and ports from the interchange labels
284
287
  routes: list[Route] = []
285
288
  ports: list[PublishedPort] = []
289
+ listeners: dict[str, dict[str, int]] = {}
286
290
  route_owners: dict[str, str] = {}
287
291
  for service_name, _stanza, service_annotations in stanzas:
288
292
  if service_annotations.get(AUTOSTART_ANNOTATION) == "false":
@@ -293,6 +297,9 @@ def extract_bundle_records(texts: list[str]) -> BundleRecords:
293
297
  f"the service {service_name!r} carries the unknown label {unknown[0]!r}; the boatyard/* "
294
298
  f"stanza labels are {list(STANZA_LABELS)}"
295
299
  )
300
+ listeners_value = service_annotations.get(LISTENERS_LABEL)
301
+ if listeners_value is not None:
302
+ _collect_listeners(listeners, service_name, listeners_value)
296
303
  route_path = service_annotations.get(ROUTE_PATH_LABEL)
297
304
  if route_path is not None:
298
305
  if ROUTE_PATH_PATTERN.fullmatch(route_path) is None:
@@ -348,6 +355,7 @@ def extract_bundle_records(texts: list[str]) -> BundleRecords:
348
355
  container_names=sorted(container_names),
349
356
  held_services=sorted(held_services),
350
357
  declared_ports=declared_ports,
358
+ listeners=listeners,
351
359
  )
352
360
 
353
361
 
@@ -360,6 +368,15 @@ def stanza_annotations(stanza: dict[str, Yaml]) -> dict[str, str]:
360
368
  return annotations
361
369
 
362
370
 
371
+ def _collect_listeners(collected: dict[str, dict[str, int]], service_name: str, value: str) -> None:
372
+ for entry in value.split(","):
373
+ # Split at the last colon: listener names may carry dots but never a colon
374
+ name, separator, port_text = entry.rpartition(":")
375
+ if not separator or not name or not port_text.isdigit() or not 1 <= int(port_text) <= 65535:
376
+ raise ValueError(f"{LISTENERS_LABEL} entry {entry!r} must be a listener-name:port pair")
377
+ collected.setdefault(service_name, {})[name] = int(port_text)
378
+
379
+
363
380
  def _collect_declared_ports(
364
381
  declared_ports: dict[str, list[tuple[int, int, str]]], service_name: str, value: Yaml
365
382
  ) -> None:
@@ -388,12 +388,18 @@ class Route(BaseModel):
388
388
  return self
389
389
 
390
390
 
391
+ class ListenerPortReference(BaseModel):
392
+ model_config = ConfigDict(extra="forbid")
393
+
394
+ listener: str
395
+
396
+
391
397
  class PublishedPort(BaseModel):
392
398
  model_config = ConfigDict(extra="forbid")
393
399
 
394
400
  service: str
395
401
  published: PortNumber
396
- target: PortNumber
402
+ target: PortNumber | ListenerPortReference
397
403
  protocol: Literal["tcp", "udp"] = "tcp"
398
404
  host_ip: str | None = None
399
405
 
@@ -159,6 +159,7 @@ class ConfigLockBundle(BaseModel):
159
159
  container_names: list[str]
160
160
  held_services: list[str] = Field(default_factory=list)
161
161
  declared_ports: dict[str, list[tuple[int, int, str]]] = Field(default_factory=dict)
162
+ listeners: dict[str, dict[str, int]] = Field(default_factory=dict)
162
163
 
163
164
  @model_validator(mode="after")
164
165
  def _require_digest_pin(self, info: ValidationInfo) -> Self:
@@ -20,22 +20,35 @@ ROUTE_PATH_LABEL = "boatyard/route-path"
20
20
  ROUTE_PORT_LABEL = "boatyard/route-port"
21
21
  ROUTE_STRIP_LABEL = "boatyard/route-strip"
22
22
  PUBLISH_PORT_LABEL = "boatyard/publish-port"
23
+ # The comma-joined name:port inventory a config ports entry resolves its target against
24
+ LISTENERS_LABEL = "boatyard/listeners"
23
25
 
24
26
  GPU_ANNOTATION = "boatyard/gpu"
25
27
 
28
+ # The host socket bind for container-controlling workloads (the compose rendering only)
29
+ DOCKER_SOCKET_ANNOTATION = "boatyard/docker-socket"
30
+
26
31
  # The closed boatyard/* label vocabulary the bundle-record extraction accepts off a rendered stanza
27
32
  STANZA_LABELS = (
28
33
  ROUTE_PATH_LABEL,
29
34
  ROUTE_PORT_LABEL,
30
35
  ROUTE_STRIP_LABEL,
31
36
  PUBLISH_PORT_LABEL,
37
+ LISTENERS_LABEL,
32
38
  PROBE_ADAPTER_ANNOTATION,
33
39
  RESTART_ANNOTATION,
34
40
  AUTOSTART_ANNOTATION,
35
41
  GPU_ANNOTATION,
42
+ DOCKER_SOCKET_ANNOTATION,
36
43
  )
37
44
 
38
- SCALAR_ANNOTATIONS = (PROBE_ADAPTER_ANNOTATION, RESTART_ANNOTATION, AUTOSTART_ANNOTATION, GPU_ANNOTATION)
45
+ SCALAR_ANNOTATIONS = (
46
+ PROBE_ADAPTER_ANNOTATION,
47
+ RESTART_ANNOTATION,
48
+ AUTOSTART_ANNOTATION,
49
+ GPU_ANNOTATION,
50
+ DOCKER_SOCKET_ANNOTATION,
51
+ )
39
52
 
40
53
  ROUTE_PATH_PATTERN = re.compile(r"(?:/\*|/(?:[^/\s*]+(?:/[^/\s*]+)*)?(?:/\*)?)")
41
54
 
@@ -13,6 +13,7 @@ from boatyard.models.config_file import (
13
13
  ConfigFile,
14
14
  FlattenedServiceEntry,
15
15
  Image,
16
+ ListenerPortReference,
16
17
  PublishedPort,
17
18
  Route,
18
19
  Slot,
@@ -50,6 +51,7 @@ class BundleProject(NamedTuple):
50
51
  container_names: list[str]
51
52
  held_services: list[str]
52
53
  declared_ports: dict[str, list[tuple[int, int, str]]]
54
+ listeners: dict[str, dict[str, int]]
53
55
 
54
56
 
55
57
  class PublicFace(NamedTuple):
@@ -182,6 +184,7 @@ def resolve(config: ConfigFile, lock: LockFile, values: ValuesFile) -> AssemblyP
182
184
  adopted_container_names = list(locked.container_names)
183
185
  adopted_held_services = list(locked.held_services)
184
186
  adopted_declared_ports = dict(locked.declared_ports)
187
+ adopted_listeners = dict(locked.listeners)
185
188
  bundle_path = None
186
189
  pinned_reference = locked.reference
187
190
  else:
@@ -193,12 +196,16 @@ def resolve(config: ConfigFile, lock: LockFile, values: ValuesFile) -> AssemblyP
193
196
  adopted_container_names = records.container_names
194
197
  adopted_held_services = records.held_services
195
198
  adopted_declared_ports = records.declared_ports
199
+ adopted_listeners = records.listeners
196
200
  bundle_path = paths[name]
197
201
  pinned_reference = None
198
202
 
199
203
  # If config port declarations exist, they replace the adopted set wholesale
200
204
  effective_ports = list(row.effective_ports) if row.effective_ports else adopted_ports
201
205
 
206
+ # Listener-referenced targets resolve against the bundle's declared inventories
207
+ effective_ports = [_resolve_port_target(name, port, adopted_listeners) for port in effective_ports]
208
+
202
209
  bundles.append(
203
210
  BundleProject(
204
211
  entry_name=name,
@@ -211,6 +218,7 @@ def resolve(config: ConfigFile, lock: LockFile, values: ValuesFile) -> AssemblyP
211
218
  container_names=adopted_container_names,
212
219
  held_services=adopted_held_services,
213
220
  declared_ports=adopted_declared_ports,
221
+ listeners=adopted_listeners,
214
222
  )
215
223
  )
216
224
 
@@ -408,6 +416,31 @@ def route_specificity(route: Route) -> tuple[int, int, str]:
408
416
  return (-len(concrete), 1 if wildcard else 0, route.path)
409
417
 
410
418
 
419
+ def _resolve_port_target(
420
+ entry_name: str,
421
+ port: PublishedPort,
422
+ listeners: dict[str, dict[str, int]],
423
+ ) -> PublishedPort:
424
+ # A bare listener name resolves against the port's own service, an inventory the rendered
425
+ # stanza carries as the listeners interchange label — internal listeners included, because
426
+ # a host publish targets the container port without the service surface
427
+ if not isinstance(port.target, ListenerPortReference):
428
+ return port
429
+ reference = port.target.listener
430
+ inventory = listeners.get(port.service)
431
+ if inventory is None:
432
+ raise ValueError(
433
+ f"services entry {entry_name!r}: the port on {port.service!r} targets listener {reference!r}, "
434
+ f"but the bundle carries no listener inventory for that service"
435
+ )
436
+ if reference not in inventory:
437
+ raise ValueError(
438
+ f"services entry {entry_name!r}: the port on {port.service!r} targets listener {reference!r}, "
439
+ f"which the service does not declare ({', '.join(sorted(inventory))})"
440
+ )
441
+ return port.model_copy(update={"target": inventory[reference]})
442
+
443
+
411
444
  def _entry_env(env: dict[str, str], shas_by_root: dict[Path, dict[str, str]], sources: BundleSources) -> None:
412
445
  # Spell machine slots after the producer's entry name, not the consumer's
413
446
  entry = sources.bundle_path.stem.removeprefix("compose.")
@@ -28,6 +28,7 @@ from boatyard.models.config_file import (
28
28
  from boatyard.models.image import dockerfile_stem
29
29
  from boatyard.models.workload import (
30
30
  PUBLISH_PORT_LABEL,
31
+ LISTENERS_LABEL,
31
32
  ROUTE_PATH_LABEL,
32
33
  ROUTE_PORT_LABEL,
33
34
  ROUTE_STRIP_LABEL,
@@ -330,6 +331,11 @@ def injected_workload(config: ConfigFile, workload: LoadedWorkload, variable_val
330
331
  labels[PUBLISH_PORT_LABEL] = ",".join(
331
332
  f"{entry.published}:{entry.target}/{entry.protocol}" for entry in block.publish
332
333
  )
334
+ # The full inventory, internal listeners included: a config ports entry targets a container
335
+ # port, which a host publish reaches without the service surface
336
+ inventory = document.listener_ports
337
+ if inventory:
338
+ labels[LISTENERS_LABEL] = ",".join(f"{name}:{port}" for name, port in inventory.items())
333
339
  if labels:
334
340
  metadata = tool.setdefault("metadata", {})
335
341
  annotations = metadata.setdefault("annotations", {})
@@ -42,6 +42,7 @@ TOOL = "score-compose"
42
42
 
43
43
  HEALTHCHECK_TEMPLATE = "probe-adapter-healthchecks.tpl"
44
44
  RESTART_TEMPLATE = "restart.tpl"
45
+ DOCKER_SOCKET_TEMPLATE = "docker-socket.tpl"
45
46
  GPU_COMPOSE_TEMPLATES = {"cuda": "gpu-cuda.tpl", "rocm": "gpu-rocm.tpl"}
46
47
 
47
48
 
@@ -187,6 +188,7 @@ def generate_compose(config: ConfigFile, lock: LockFile) -> list[Path]:
187
188
  templates=[
188
189
  HEALTHCHECK_TEMPLATE,
189
190
  RESTART_TEMPLATE,
191
+ DOCKER_SOCKET_TEMPLATE,
190
192
  *(
191
193
  GPU_COMPOSE_TEMPLATES[value]
192
194
  for variable, value in entry.vars.items()
@@ -0,0 +1,27 @@
1
+ # Docker socket bind for workloads declaring boatyard/docker-socket —
2
+ # container-controllers that start and stop sibling services through the
3
+ # host daemon (score's workload spec carries no volume grammar, so the bind
4
+ # rides this compose patch the same way device reservations ride the gpu
5
+ # templates). The socket path is the one compose itself defaults to; hosts
6
+ # with a different daemon socket spell an absolute-source bind in a
7
+ # provisioner service instead. No k8s twin: a workload held out of the k8s
8
+ # list never reaches that rendering, and cluster workloads take a
9
+ # service-account scoped Docker API, not a node socket.
10
+ {{- $matched := false }}
11
+ {{- range $workloadName, $workload := .Workloads }}
12
+ {{- if eq (dig "metadata" "annotations" "boatyard/docker-socket" "" $workload) "true" }}
13
+ {{- range $containerName, $_ := $workload.containers }}
14
+ {{- $matched = true }}
15
+ - op: set
16
+ path: services.{{ $workloadName }}-{{ $containerName }}.volumes
17
+ value:
18
+ - type: bind
19
+ source: /var/run/docker.sock
20
+ target: /var/run/docker.sock
21
+ description: Docker socket bind for {{ $workloadName }}-{{ $containerName }}
22
+ {{- end }}
23
+ {{- end }}
24
+ {{- end }}
25
+ {{- if not $matched }}
26
+ []
27
+ {{- end }}
@@ -4,23 +4,33 @@
4
4
  # class closes that drift for workloads declaring a probe adapter
5
5
  # (boatyard/probe-adapter): it converts the workload's readinessProbe,
6
6
  # else livenessProbe, into a compose healthcheck against the computed
7
- # <workload>-<container> service name. The adapter picks the exec spell the
8
- # image runtime can run — python-urllib (python-based workloads shipping
9
- # neither wget nor curl) or bash-http (workloads whose image ships bash and
10
- # nothing else, spelling HTTP over /dev/tcp); a workload declaring an httpGet
11
- # probe without the adapter refuses at generation (devkit code — templates are
12
- # data).
7
+ # <workload>-<container> service name. The timing derives from the same
8
+ # probe's authored fields — periodSeconds→interval,
9
+ # initialDelaySeconds→start_period, timeoutSeconds→timeout,
10
+ # failureThreshold→retries — defaulting to 5s/5s/5s/3 when unauthored, so
11
+ # one probe spell drives both renderings' timing. The adapter picks the exec
12
+ # spell the image runtime can run — python-urllib (python-based workloads
13
+ # shipping neither wget nor curl) or bash-http (workloads whose image ships
14
+ # bash and nothing else, spelling HTTP over /dev/tcp); a workload declaring
15
+ # an httpGet probe without the adapter refuses at generation (devkit code —
16
+ # templates are data).
13
17
  {{- $matched := false }}
14
18
  {{- range $workloadName, $workload := .Workloads }}
15
19
  {{- $adapter := dig "metadata" "annotations" "boatyard/probe-adapter" "" $workload }}
16
20
  {{- if or (eq $adapter "python-urllib") (eq $adapter "bash-http") }}
17
21
  {{- range $containerName, $container := $workload.containers }}
22
+ {{- $probeBlock := $container.readinessProbe }}
18
23
  {{- $probe := $container.readinessProbe.httpGet }}
19
24
  {{- if not $probe }}
25
+ {{- $probeBlock = $container.livenessProbe }}
20
26
  {{- $probe = $container.livenessProbe.httpGet }}
21
27
  {{- end }}
22
28
  {{- with $probe }}
23
29
  {{- $matched = true }}
30
+ {{- $interval := dig "periodSeconds" 5 $probeBlock }}
31
+ {{- $startPeriod := dig "initialDelaySeconds" 5 $probeBlock }}
32
+ {{- $timeout := dig "timeoutSeconds" 5 $probeBlock }}
33
+ {{- $retries := dig "failureThreshold" 3 $probeBlock }}
24
34
  - op: set
25
35
  path: services.{{ $workloadName }}-{{ $containerName }}.healthcheck
26
36
  value:
@@ -41,10 +51,10 @@
41
51
  "exec 3<>/dev/tcp/127.0.0.1/{{ .port }} && printf 'GET {{ .path }} HTTP/1.0\\r\\nHost: localhost\\r\\n\\r\\n' >&3 && read -r status <&3 && case $$status in *200*) exit 0;; *) exit 1;; esac",
42
52
  ]
43
53
  {{- end }}
44
- interval: 5s
45
- start_period: 5s
46
- timeout: 5s
47
- retries: 3
54
+ interval: {{ $interval }}s
55
+ start_period: {{ $startPeriod }}s
56
+ timeout: {{ $timeout }}s
57
+ retries: {{ $retries }}
48
58
  description: Healthcheck from httpGet probe for {{ $workloadName }}-{{ $containerName }}
49
59
  {{- end }}
50
60
  {{- end }}
@@ -276,6 +276,7 @@ def _resolve_tree(
276
276
  lock_livekit_routes: list[dict[str, object]] | None = None,
277
277
  lock_livekit_ports: list[dict[str, object]] | None = None,
278
278
  lock_livekit_slots: dict[str, object] | None = None,
279
+ lock_livekit_listeners: dict[str, dict[str, int]] | None = None,
279
280
  values_extra: dict[str, object] | None = None,
280
281
  ):
281
282
  livekit_entry: dict[str, object] = {"ref": LIVEKIT_REF}
@@ -302,6 +303,8 @@ def _resolve_tree(
302
303
  }
303
304
  if lock_livekit_slots is not None:
304
305
  livekit_bundle["slots"] = lock_livekit_slots
306
+ if lock_livekit_listeners is not None:
307
+ livekit_bundle["listeners"] = lock_livekit_listeners
305
308
  lock_images: dict[str, object] = {}
306
309
  tmp_path.joinpath(*LOCK_PATH.parts).write_text(
307
310
  yaml.safe_dump({
@@ -829,6 +832,40 @@ class TestAdoption:
829
832
  [bundle] = plan.bundles
830
833
  assert [(port.service, port.published) for port in bundle.effective_ports] == [("livekit", 6178)]
831
834
 
835
+ def test_a_listener_referenced_target_resolves_from_the_locked_inventory(
836
+ self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
837
+ ) -> None:
838
+ plan = _resolve_tree(
839
+ tmp_path,
840
+ monkeypatch,
841
+ livekit_ports=[{"service": "livekit", "published": 6178, "target": {"listener": "http"}}],
842
+ lock_livekit_listeners={"livekit": {"http": 8000, "debug": 5678}},
843
+ )
844
+
845
+ [bundle] = plan.bundles
846
+ assert [(port.service, port.published, port.target) for port in bundle.effective_ports] == [
847
+ ("livekit", 6178, 8000)
848
+ ]
849
+
850
+ def test_a_listener_target_without_an_inventory_refuses(
851
+ self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
852
+ ) -> None:
853
+ with pytest.raises(ValueError, match="carries no listener inventory for that service"):
854
+ _resolve_tree(
855
+ tmp_path,
856
+ monkeypatch,
857
+ livekit_ports=[{"service": "livekit", "published": 6178, "target": {"listener": "http"}}],
858
+ )
859
+
860
+ def test_an_unknown_listener_target_refuses(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
861
+ with pytest.raises(ValueError, match="'metrics', which the service does not declare"):
862
+ _resolve_tree(
863
+ tmp_path,
864
+ monkeypatch,
865
+ livekit_ports=[{"service": "livekit", "published": 6178, "target": {"listener": "metrics"}}],
866
+ lock_livekit_listeners={"livekit": {"http": 8000}},
867
+ )
868
+
832
869
  def test_an_unknown_values_ports_service_refuses(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
833
870
  with pytest.raises(ValueError, match="are services of no selected bundle"):
834
871
  _resolve_tree(
@@ -1110,6 +1110,21 @@ def test_extract_bundle_records_holds_services_marked_no_autostart() -> None:
1110
1110
  assert records.held_services == ["livekit"]
1111
1111
 
1112
1112
 
1113
+ def test_extract_bundle_records_accepts_the_docker_socket_label() -> None:
1114
+ from boatyard.lock import extract_bundle_records
1115
+
1116
+ text = (
1117
+ "services:\n"
1118
+ " orchestrator:\n"
1119
+ " image: demo/orchestrator:1\n"
1120
+ ' annotations:\n boatyard/docker-socket: "true"\n'
1121
+ )
1122
+
1123
+ records = extract_bundle_records([text])
1124
+
1125
+ assert records.services == ["orchestrator"]
1126
+
1127
+
1113
1128
  def test_extract_bundle_records_parses_the_publish_label_into_port_records() -> None:
1114
1129
  from boatyard.lock import extract_bundle_records
1115
1130
 
@@ -1129,6 +1144,37 @@ def test_extract_bundle_records_parses_the_publish_label_into_port_records() ->
1129
1144
  ]
1130
1145
 
1131
1146
 
1147
+ def test_extract_bundle_records_parses_the_listeners_label_into_inventories() -> None:
1148
+ from boatyard.lock import extract_bundle_records
1149
+
1150
+ text = (
1151
+ "services:\n"
1152
+ " livekit:\n"
1153
+ " image: demo/livekit:1\n"
1154
+ " annotations:\n"
1155
+ " boatyard/listeners: http:8000,debug.py:5678\n"
1156
+ )
1157
+
1158
+ records = extract_bundle_records([text])
1159
+
1160
+ assert records.listeners == {"livekit": {"http": 8000, "debug.py": 5678}}
1161
+
1162
+
1163
+ def test_a_malformed_listeners_label_refuses() -> None:
1164
+ from boatyard.lock import extract_bundle_records
1165
+
1166
+ text = (
1167
+ "services:\n"
1168
+ " livekit:\n"
1169
+ " image: demo/livekit:1\n"
1170
+ " annotations:\n"
1171
+ " boatyard/listeners: http-eight-thousand\n"
1172
+ )
1173
+
1174
+ with pytest.raises(ValueError, match="must be a listener-name:port pair"):
1175
+ extract_bundle_records([text])
1176
+
1177
+
1132
1178
  def _skip_crane_install() -> None:
1133
1179
  return None
1134
1180
 
@@ -952,6 +952,7 @@ class TestRenderedNameClaims:
952
952
  SHIPPED_TEMPLATES = {
953
953
  "probe-adapter-healthchecks.tpl",
954
954
  "restart.tpl",
955
+ "docker-socket.tpl",
955
956
  "gpu-cuda.tpl",
956
957
  "gpu-rocm.tpl",
957
958
  "gpu-pod.tpl",
@@ -1001,6 +1002,72 @@ def test_the_bash_http_spell_uses_the_slash_port_spelling() -> None:
1001
1002
  assert "/dev/tcp/127.0.0.1:{{ .port }}" not in text
1002
1003
 
1003
1004
 
1005
+ def test_the_healthcheck_template_derives_its_timing_from_the_probe_fields() -> None:
1006
+ text = (files("boatyard") / "score_patch_templates" / "probe-adapter-healthchecks.tpl").read_text(encoding="utf-8")
1007
+
1008
+ assert 'dig "periodSeconds" 5' in text
1009
+ assert 'dig "initialDelaySeconds" 5' in text
1010
+ assert 'dig "timeoutSeconds" 5' in text
1011
+ assert 'dig "failureThreshold" 3' in text
1012
+ assert "interval: {{ $interval }}s" in text
1013
+ assert "start_period: {{ $startPeriod }}s" in text
1014
+ assert "timeout: {{ $timeout }}s" in text
1015
+ assert "retries: {{ $retries }}" in text
1016
+
1017
+
1018
+ PROBE_TIMING_WORKLOAD = (
1019
+ "metadata:\n"
1020
+ " name: api\n"
1021
+ " annotations:\n"
1022
+ " boatyard/probe-adapter: python-urllib\n"
1023
+ "boatyard:\n"
1024
+ " lock:\n"
1025
+ " api: API_IMAGE\n"
1026
+ "listeners:\n"
1027
+ " web: 8081\n"
1028
+ "containers:\n"
1029
+ " api:\n"
1030
+ " readinessProbe:\n"
1031
+ " httpGet:\n"
1032
+ " path: /health\n"
1033
+ " port: web\n"
1034
+ " initialDelaySeconds: 30\n"
1035
+ " periodSeconds: 10\n"
1036
+ " timeoutSeconds: 2\n"
1037
+ " failureThreshold: 6\n"
1038
+ )
1039
+
1040
+
1041
+ def test_the_expanded_workload_copy_carries_the_authored_probe_timing(
1042
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
1043
+ ) -> None:
1044
+ (tmp_path / "stack" / "score").mkdir(parents=True, exist_ok=True)
1045
+ (tmp_path / "stack" / "score" / "api.yaml").write_text(PROBE_TIMING_WORKLOAD, encoding="utf-8")
1046
+ recorder = WorkloadContentsRecorder(API_SERVICE_RENDERING)
1047
+ monkeypatch.setattr(score_module, "bash", recorder.run)
1048
+ config = _generated_config(
1049
+ tmp_path,
1050
+ ["api.yaml"],
1051
+ repository="ghcr.io/org/repo",
1052
+ project_name="example",
1053
+ platforms=["linux/amd64"],
1054
+ services={"core": {"options": {"main": {"workloads": ["api.yaml"]}}}},
1055
+ )
1056
+ score_compose_module.generate_compose(
1057
+ config,
1058
+ _lock_for_images({"API_IMAGE": "ghcr.io/org/api:1@" + DIGEST, **ALPINE_LOCK}),
1059
+ )
1060
+
1061
+ document = yaml.safe_load(recorder.workload_contents["api.yaml"])
1062
+ assert document["containers"]["api"]["readinessProbe"] == {
1063
+ "httpGet": {"path": "/health", "port": 8081},
1064
+ "initialDelaySeconds": 30,
1065
+ "periodSeconds": 10,
1066
+ "timeoutSeconds": 2,
1067
+ "failureThreshold": 6,
1068
+ }
1069
+
1070
+
1004
1071
  PROVISIONER_WITH_SERVICES = """
1005
1072
  - uri: template://example/config
1006
1073
  type: example-config
@@ -1104,7 +1171,7 @@ def test_barrier_pin_stays_unregistered_without_provisioner_services(
1104
1171
  },
1105
1172
  )
1106
1173
 
1107
- assert templates == [["probe-adapter-healthchecks.tpl", "restart.tpl"]]
1174
+ assert templates == [["probe-adapter-healthchecks.tpl", "restart.tpl", "docker-socket.tpl"]]
1108
1175
 
1109
1176
 
1110
1177
  def test_provisioners_register_by_resource_type_closure(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
@@ -1366,6 +1433,7 @@ def test_the_seam_composes_the_tool_document_from_the_lens() -> None:
1366
1433
  "boatyard/route-path": "/auth/*",
1367
1434
  "boatyard/route-port": "8081",
1368
1435
  "boatyard/route-strip": "true",
1436
+ "boatyard/listeners": "web:8081,admin:9090,mgmt:9000",
1369
1437
  },
1370
1438
  },
1371
1439
  "resources": {"db": {"type": "example-db"}},
@@ -2113,6 +2181,18 @@ def test_the_gpu_annotation_parses() -> None:
2113
2181
  assert document.metadata.annotations == {"boatyard/gpu": "true"}
2114
2182
 
2115
2183
 
2184
+ def test_the_docker_socket_annotation_parses() -> None:
2185
+ document = parse_workload(
2186
+ {
2187
+ "metadata": {"name": "api", "annotations": {"boatyard/docker-socket": "true"}},
2188
+ "containers": {},
2189
+ },
2190
+ "api.yaml",
2191
+ )
2192
+
2193
+ assert document.metadata.annotations == {"boatyard/docker-socket": "true"}
2194
+
2195
+
2116
2196
  def test_the_compose_rendering_receives_the_resolved_probe_port(
2117
2197
  tmp_path: Path, monkeypatch: pytest.MonkeyPatch
2118
2198
  ) -> None:
@@ -2512,7 +2592,7 @@ def test_adapted_probe_bearing_workloads_register_the_healthcheck_template(
2512
2592
  generated=API_SERVICE_RENDERING,
2513
2593
  )
2514
2594
 
2515
- assert templates == [["probe-adapter-healthchecks.tpl", "restart.tpl"]]
2595
+ assert templates == [["probe-adapter-healthchecks.tpl", "restart.tpl", "docker-socket.tpl"]]
2516
2596
 
2517
2597
 
2518
2598
  def test_restart_values_outside_the_compose_enum_refuse(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
@@ -2539,7 +2619,7 @@ def test_restart_annotation_with_an_enum_value_passes(tmp_path: Path, monkeypatc
2539
2619
  },
2540
2620
  )
2541
2621
 
2542
- assert templates == [["probe-adapter-healthchecks.tpl", "restart.tpl"]]
2622
+ assert templates == [["probe-adapter-healthchecks.tpl", "restart.tpl", "docker-socket.tpl"]]
2543
2623
 
2544
2624
 
2545
2625
  def test_bare_literal_workload_image_refuses(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
@@ -2692,8 +2772,8 @@ def test_gpu_compose_templates_register_per_the_renderings_variant(
2692
2772
  templates = _compose_init_templates(monkeypatch, tmp_path, config, {}, {})
2693
2773
 
2694
2774
  assert templates == [
2695
- ["probe-adapter-healthchecks.tpl", "restart.tpl", "gpu-cuda.tpl"],
2696
- ["probe-adapter-healthchecks.tpl", "restart.tpl", "gpu-rocm.tpl"],
2775
+ ["probe-adapter-healthchecks.tpl", "restart.tpl", "docker-socket.tpl", "gpu-cuda.tpl"],
2776
+ ["probe-adapter-healthchecks.tpl", "restart.tpl", "docker-socket.tpl", "gpu-rocm.tpl"],
2697
2777
  ]
2698
2778
 
2699
2779
 
File without changes