Skip to content

Commit

Permalink
Lock helm version to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
MacroPower committed Jan 3, 2025
1 parent b6d9613 commit cfb318d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 20 deletions.
1 change: 0 additions & 1 deletion modules/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Helm chart resource.
| name | type | description | default value |
| ----------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| **chart** `required` | str | The Helm chart name. | |
| **helmVersion** | str | HelmVersion is the version of Helm to use. One of: [v2, v3]. | "v3" |
| **namespace** | str | Namespace is an optional namespace to template with. | |
| **passCredentials** | bool | Set to `True` to pass credentials to all domains (Helm's `--pass-credentials`). | False |
| **project** | str | Project is a reference to the project this chart's releases belong to,<br />e.g. the Argo AppProject. This is used to segregate Helm chart caches. | |
Expand Down
7 changes: 0 additions & 7 deletions modules/helm/main.k
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ schema ChartBase:
The Helm release name to use. If omitted it will use the chart name.
namespace: str, optional.
Namespace is an optional namespace to template with.
helmVersion: str, default is "v3", optional.
HelmVersion is the version of Helm to use. One of: [v2, v3].
skipCRDs: bool, default is False, optional.
Set to `True` to skip the custom resource definition installation step
(Helm's `--skip-crds`).
Expand All @@ -36,17 +34,13 @@ schema ChartBase:
targetRevision: str
releaseName?: str
namespace?: str
helmVersion?: str = "v3"
skipCRDs?: bool = False
passCredentials?: bool = False
schemaValidator?: "KCL" | "HELM"

check:
not regex.match(repoURL, r"^oci://"), \
"Invalid repoURL: ${repoURL}. OCI registries must not include a scheme (e.g. `oci://`)"
any x in ["v2", "v3"] {
x == helmVersion
}, "Invalid helmVersion: ${helmVersion}. Must be one of: [v2, v3]"

schema Chart(ChartBase):
"""Helm chart resource.
Expand Down Expand Up @@ -126,7 +120,6 @@ template = lambda chart: Chart -> [{str:}] {
target_revision=_chart.targetRevision,
release_name=_chart.releaseName,
namespace=_chart.namespace,
helm_version=_chart.helmVersion,
skip_crds=_chart.skipCRDs,
skip_schema_validation=_skipSchemaValidation,
pass_credentials=_chart.passCredentials,
Expand Down
8 changes: 0 additions & 8 deletions modules/helm/main_test.k
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ test_Chart = lambda {
chart = "test-https"
repoURL = "https://example.com"
targetRevision = "0.1.0"
helmVersion = "v3"
}

oci = Chart {
Expand All @@ -12,13 +11,6 @@ test_Chart = lambda {
targetRevision = "0.1.0"
}

helmV2 = Chart {
chart = "test-helm-v2"
repoURL = "https://example.com"
targetRevision = "0.1.0"
helmVersion = "v2"
}

patchRenderer = Chart {
chart = "test-oci"
repoURL = "example.com"
Expand Down
3 changes: 1 addition & 2 deletions pkg/helm/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type TemplateOpts struct {
RepoURL string
ReleaseName string
Namespace string
HelmVersion string
ValuesObject map[string]any
Repositories []argohelm.HelmRepository
Credentials Creds
Expand Down Expand Up @@ -86,7 +85,7 @@ func (c *Chart) template() ([]byte, error) {
// isLocal controls helm temp dirs, does not seem to impact pull/template behavior.
isLocal := false

ha, err := argohelm.NewHelmApp(chartPath, c.TemplateOpts.Repositories, isLocal, c.TemplateOpts.HelmVersion,
ha, err := argohelm.NewHelmApp(chartPath, c.TemplateOpts.Repositories, isLocal, "v3",
c.TemplateOpts.Proxy, c.TemplateOpts.NoProxy, c.TemplateOpts.PassCredentials)
if err != nil {
return nil, fmt.Errorf("error initializing helm app object: %w", err)
Expand Down
2 changes: 0 additions & 2 deletions pkg/plugin/helm/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var Plugin = plugin.Plugin{
"repo_url": "str",
"release_name": "str",
"namespace": "str",
"helm_version": "str",
"skip_crds": "bool",
"skip_schema_validation": "bool",
"pass_credentials": "bool",
Expand Down Expand Up @@ -59,7 +58,6 @@ var Plugin = plugin.Plugin{
RepoURL: repoURL,
ReleaseName: safeArgs.StrKwArg("release_name", chartName),
Namespace: namespace,
HelmVersion: safeArgs.StrKwArg("helm_version", "v3"),
SkipCRDs: safeArgs.BoolKwArg("skip_crds", false),
SkipSchemaValidation: safeArgs.BoolKwArg("skip_schema_validation", true),
PassCredentials: safeArgs.BoolKwArg("pass_credentials", false),
Expand Down

0 comments on commit cfb318d

Please sign in to comment.