Commit 6862b6f
authored
feat(carvel): add BOSH link support via job-spec-overlay and values-overlay sidecars (#663)
## Summary
Introduce two per-packageinstall sidecar conventions that kiln
auto-detects in `packageinstalls/`:
| Sidecar | Purpose | When it runs |
|---|---|---|
| `<entry>.job-spec-overlay.yml` | Declares additional BOSH link
consumptions; kiln appends them to the generated `registry-data` job.MF
| `kiln carvel bake` time |
| `<entry>.values-overlay.erb` | ERB fragment injected before
`YAML.dump(values)`; mutates the values hash via BOSH link objects |
BOSH deploy time (ERB) |
Missing sidecar files are silently skipped (no-op). Both sidecars are
co-located with the packageinstall YAML they extend.
## Motivation
Carvel tiles need to consume BOSH links from co-deployed products (e.g.
the `binding_cache` link provided by CF's `loggr-syslog-binding-cache`
job) to inject environment-specific runtime values at BOSH deploy time.
Previously only the hardcoded `cluster-info` link was available in the
generated job spec. The binding-cache has no BOSH DNS alias, so its
address can only be discovered via a BOSH link.
## Approach — co-located sidecars (mirrors the values-overlay.erb
pattern)
Tile authors declare BOSH link consumptions in a
`<name>.job-spec-overlay.yml` sidecar alongside their packageinstall
YAML. kiln reads all such files and aggregates their `consumes:` entries
into the generated `registry-data` job spec. The schema mirrors the BOSH
job spec `consumes:` block directly.
```
packageinstalls/
tnz-ear-runtime-package-install.yml
tnz-ear-runtime-package-install.job-spec-overlay.yml ← NEW: BOSH link declarations
tnz-ear-runtime-package-install.values-overlay.erb ← NEW: values mutations at deploy time
```
Example `job-spec-overlay.yml`:
```yaml
consumes:
- name: binding_cache
type: binding_cache
optional: false
```
Example `values-overlay.erb`:
```erb
<% addr = link("binding_cache").instances.first.address %>
<% values["syslog_agent"]["cache"]["url"] = "https://#{addr}:9000" %>
```
**Kilnfile is not modified.** It stays focused on dependency management
(release sources, releases, stemcell). The
`BOSHLinkConsumer`/`BOSHLinks` types and `BoshLinks` field from the
initial commit have been removed.
## Backward Compatibility
- Tiles with no `*.job-spec-overlay.yml` files produce identical output
to before (no-op)
- Tiles with no `*.values-overlay.erb` files produce identical output to
before (no-op)
- All existing `cluster-info` link behaviour is preserved
- Kilnfile schema unchanged
## Test Plan
- [x] `jobSpecOverlay` — parses a `consumes:` list, handles empty list,
handles missing key
- [x] `buildRegistryDataSpec` — includes user-declared links after
cluster-info
- [x] `buildRegistryDataSpec` — no additional links when no sidecars
present
- [x] `buildRegistryDataSpec` — optional flag rendered correctly
- [x] `generateManifestTemplate` with overlay — overlay content present
and before `YAML.dump`
- [x] `generateManifestTemplate` with empty overlay — still produces
valid template
- [x] Full suite: `go test ./...` — 0 failures (Docker integration test
skipped due to no daemon)
Made with [Cursor](https://cursor.com)3 files changed
Lines changed: 292 additions & 17 deletions
File tree
- internal/carvel
- testdata/sample-tile/packageinstalls
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
258 | 300 | | |
259 | 301 | | |
260 | 302 | | |
| |||
313 | 355 | | |
314 | 356 | | |
315 | 357 | | |
| 358 | + | |
316 | 359 | | |
317 | 360 | | |
318 | 361 | | |
| |||
362 | 405 | | |
363 | 406 | | |
364 | 407 | | |
365 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
366 | 435 | | |
367 | 436 | | |
368 | 437 | | |
| |||
374 | 443 | | |
375 | 444 | | |
376 | 445 | | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
389 | 452 | | |
390 | 453 | | |
391 | 454 | | |
| |||
395 | 458 | | |
396 | 459 | | |
397 | 460 | | |
398 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
399 | 490 | | |
400 | 491 | | |
401 | 492 | | |
| |||
442 | 533 | | |
443 | 534 | | |
444 | 535 | | |
| 536 | + | |
445 | 537 | | |
446 | 538 | | |
447 | 539 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
106 | 283 | | |
107 | 284 | | |
108 | 285 | | |
| |||
242 | 419 | | |
243 | 420 | | |
244 | 421 | | |
| 422 | + | |
| 423 | + | |
245 | 424 | | |
246 | 425 | | |
247 | 426 | | |
| |||
576 | 755 | | |
577 | 756 | | |
578 | 757 | | |
579 | | - | |
| 758 | + | |
580 | 759 | | |
581 | 760 | | |
582 | 761 | | |
| |||
585 | 764 | | |
586 | 765 | | |
587 | 766 | | |
588 | | - | |
| 767 | + | |
589 | 768 | | |
590 | 769 | | |
591 | 770 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments