Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCI support in Helm builtin #4614

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions api/internal/builtins/HelmChartInflationGenerator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,15 @@ func (p *HelmChartInflationGeneratorPlugin) pullCommand() []string {
args := []string{
"pull",
"--untar",
"--untardir", p.absChartHome(),
"--repo", p.Repo,
p.Name}
"--untardir", p.absChartHome()}

// OCI pull combine the repo and the chart name into one URL
if strings.HasPrefix(p.Repo, "oci://") {
chartUrl := p.Repo + "/" + p.Name

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify, it's saying Url should be URL in the variable name, I missed the distinction on first read-through.

args = append(args, chartUrl)
} else {
args = append(args, "--repo", p.Repo, p.Name)
}
if p.Version != "" {
args = append(args, "--version", p.Version)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,3 +579,25 @@ valuesInline:
`)
th.AssertActualEqualsExpected(rm, "")
}

func TestHelmChartInflationGeneratorOciRegistry(t *testing.T) {
th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t).
PrepBuiltin("HelmChartInflationGenerator")
defer th.Reset()
if err := th.ErrIfNoHelm(); err != nil {
t.Skip("skipping: " + err.Error())
}

rm := th.LoadAndRunGenerator(`
apiVersion: builtin
kind: HelmChartInflationGenerator
metadata:
name: ocichart
name: chart1
version: 0.1.0
repo: oci://us-central1-docker.pkg.dev/mikebz-ex1/charts
valuesInline:
nameOverride: foobar
`)
th.AssertActualEqualsExpected(rm, "")
}