Skip to content

Commit

Permalink
Add support for Helm3 OCI registries
Browse files Browse the repository at this point in the history
Signed-off-by: Mathias Åhsberg <[email protected]>
  • Loading branch information
mathias-ahsberg-resurs committed Feb 16, 2022
1 parent 456667d commit 8e99ceb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/clients/helm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package helm

import (
"fmt"
"helm.sh/helm/v3/pkg/registry"
"io/ioutil"
"net/url"
"os"
Expand All @@ -32,6 +31,7 @@ import (
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/registry"
"helm.sh/helm/v3/pkg/release"
"k8s.io/client-go/rest"
ktype "sigs.k8s.io/kustomize/api/types"
Expand Down Expand Up @@ -203,16 +203,15 @@ func (hc *client) pullChart(spec *v1beta1.ChartSpec, creds *RepoCreds, chartDir
pc.Password = creds.Password

pc.DestDir = chartDir

// TODO check if login is required

if registry.IsOCI(spec.Repository) {
parsedUrl, err := url.Parse(spec.Repository)
parsedURL, err := url.Parse(spec.Repository)
if err != nil {
return errors.Wrap(err, errFailedToParseURL)
}
var out strings.Builder
// TODO add support for insecure
err = hc.loginClient.Run(&out, parsedUrl.Host, creds.Username, creds.Password, false)
err = hc.loginClient.Run(&out, parsedURL.Host, creds.Username, creds.Password, false)
if err != nil {
hc.log.Debug(out.String())
return err
Expand Down

0 comments on commit 8e99ceb

Please sign in to comment.