Skip to content

Commit a8a7677

Browse files
committed
updated docs and added a missing test
1 parent 942665b commit a8a7677

3 files changed

Lines changed: 84 additions & 0 deletions

File tree

TILE_AUTHOR_GUIDE.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,43 @@ The property definition in [releen/hello-tile/properties/hello.yml](https://gith
129129
in referenced in `base.yml` using `$( property "port" )`.
130130
Most other product template part functions behave similarly.
131131

132+
### Carvel / Kubernetes Tile Metadata (`base.yml`)
133+
134+
When building Carvel/Kubernetes tiles using `kiln carvel bake`, the `base.yml` metadata file supports the following additional top-level fields:
135+
136+
- `supports_parallel_deploys` (boolean): Indicates whether the tile supports parallel deployments in Ops Manager.
137+
- `requires_product_versions` (list): Specifies product version dependencies required by the tile.
138+
- `name`: Product name.
139+
- `version`: Version requirement constraint (e.g. `>=1.0.0`).
140+
- `optional` (boolean): Whether the dependency is optional.
141+
- `compatible_kubernetes_distributions` (list): Supported Kubernetes distribution criteria.
142+
- `name`: Distribution name (e.g. `k0s`).
143+
- `version`: Version requirement constraint (e.g. `>0.0.0`).
144+
- `package_installs` (list): References to Carvel package install templates.
145+
146+
Example Carvel tile `base.yml`:
147+
148+
```yaml
149+
name: k8s-tile-name
150+
label: "My K8s Tile"
151+
icon_image: $( icon )
152+
metadata_version: "3.2.0"
153+
minimum_version_for_upgrade: 0.0.0
154+
product_version: $( version )
155+
rank: 1
156+
serial: false
157+
supports_parallel_deploys: true
158+
requires_product_versions:
159+
- name: some-other-product
160+
version: ">=1.0.0"
161+
optional: true
162+
compatible_kubernetes_distributions:
163+
- name: k0s
164+
version: ">0.0.0"
165+
package_installs:
166+
- $( package "my-package" )
167+
```
168+
132169
## <a id="bosh-release-tarballs"></a> Managing BOSH Release Tarballs
133170
134171
`kiln fetch` downloads BOSH Release Tarballs from any of the following "sources"

internal/acceptance/carvel/fixtures/sample-tile/base.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ package_installs:
1717
compatible_kubernetes_distributions:
1818
- name: k0s
1919
version: '>0.0.0'
20+
supports_parallel_deploys: true
21+
requires_product_versions:
22+
- name: some-other-product
23+
version: '>=1.0.0'
24+
optional: true

internal/carvel/baker_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,48 @@ consumes:
558558
Expect(err.Error()).To(ContainSubstring("tile metadata_version too old"))
559559
})
560560
})
561+
562+
When("the tile does not set parallel deploys or product version requirements", func() {
563+
BeforeEach(func() {
564+
m := models.Metadata{
565+
Name: "k8s-tile-test",
566+
Label: "test tile",
567+
IconImage: "$( icon )",
568+
MetadataVersion: "3.2.0",
569+
MinimumVersionForUpgrade: "0.0.0",
570+
ProductVersion: "$( version )",
571+
Rank: 1,
572+
Serial: false,
573+
PropertyBlueprints: []string{
574+
`$( property "database_name" )`,
575+
`$( property "admin_password" )`,
576+
},
577+
FormTypes: []string{`$( form "db_props" )`},
578+
Variables: []proofing.Variable{},
579+
PackageInstalls: []string{`$( package "test-install" )`},
580+
}
581+
yamlData, err := yaml.Marshal(&m)
582+
Expect(err).NotTo(HaveOccurred())
583+
err = os.WriteFile(path.Join(inputPath, "base.yml"), yamlData, 0644) // 0644 sets file permissions
584+
Expect(err).NotTo(HaveOccurred())
585+
})
586+
587+
It("omits both fields from the generated base.yml", func() {
588+
Expect(err).NotTo(HaveOccurred())
589+
590+
yamlPath := path.Join(outputPath, "base.yml")
591+
rawYaml, err := os.ReadFile(yamlPath)
592+
Expect(err).NotTo(HaveOccurred())
593+
Expect(string(rawYaml)).NotTo(ContainSubstring("supports_parallel_deploys"))
594+
Expect(string(rawYaml)).NotTo(ContainSubstring("requires_product_versions"))
595+
596+
outMeta := models.MetadataOut{}
597+
err = yaml.Unmarshal(rawYaml, &outMeta)
598+
Expect(err).NotTo(HaveOccurred())
599+
Expect(outMeta.SupportsParallelDeploys).To(BeFalse())
600+
Expect(outMeta.RequiresProductVersions).To(BeEmpty())
601+
})
602+
})
561603
})
562604
})
563605

0 commit comments

Comments
 (0)