Skip to content

Commit

Permalink
feat: add api_versions and kube_version to helm block
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Peters committed Apr 13, 2024
1 parent 28b3868 commit d71d4c2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/data-sources/overlay.md
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ Must enable helm support via [kustomize_options](#kustomize_options---optional)
- `values_file` specify a file with helm values to use for templating. Not specifying this uses the in-chart values file, if one exists.
- `values_inline` specify helm values inline from terraform, as a string
- `values_merge` merge strategy if both `values_file` and `values_inline` are specified. Can be one of `override`, `replace`, `merge`. (default: `override`)
- `api_versions` List of Kubernetes api versions used for Capabilities.APIVersions.
- `kube_version` Allows specifying a custom kubernetes version to use when templating.

#### Example

Expand All @@ -642,6 +644,8 @@ data "kustomization_overlay" "minecraft" {
release_name = "moria"
include_crds = false
skip_tests = false
kube_version = "1.29.0"
api_versions = ["monitoring.coreos.com/v1"]
values_inline = <<VALUES
minecraftServer:
eula: true
Expand Down
9 changes: 9 additions & 0 deletions kustomize/data_source_kustomization_overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,15 @@ func dataSourceKustomizationOverlay() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"api_versions": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"kube_version": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
Expand Down
5 changes: 5 additions & 0 deletions kustomize/data_source_kustomization_overlay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,9 @@ func TestDataSourceKustomizationOverlay_helm_charts_attr(t *testing.T) {
resource.TestCheckResourceAttr("data.kustomization_overlay.test", "ids.#", "3"),
resource.TestCheckResourceAttr("data.kustomization_overlay.test", "ids_prio.#", "3"),
resource.TestCheckResourceAttr("data.kustomization_overlay.test", "manifests.%", "3"),
resource.TestCheckResourceAttr("data.kustomization_overlay.test", "helm_charts.0.kube_version", "1.29.0"),
resource.TestCheckResourceAttr("data.kustomization_overlay.test", "helm_charts.0.api_versions.#", "1"),
resource.TestCheckResourceAttr("data.kustomization_overlay.test", "helm_charts.0.api_versions.0", "monitoring.coreos.com/v1"),
),
},
},
Expand All @@ -1203,6 +1206,8 @@ data "kustomization_overlay" "test" {
version = "0.0.1"
namespace = "not-used"
skip_tests = true
kube_version = "1.29.0"
api_versions = ["monitoring.coreos.com/v1"]
}
namespace = "test-basic"
Expand Down

0 comments on commit d71d4c2

Please sign in to comment.