diff --git a/internal/controller/validatorconfig_controller.go b/internal/controller/validatorconfig_controller.go index 29525672..e9ee8d94 100644 --- a/internal/controller/validatorconfig_controller.go +++ b/internal/controller/validatorconfig_controller.go @@ -167,7 +167,8 @@ func (r *ValidatorConfigReconciler) redeployIfNeeded(ctx context.Context, vc *v1 opts := &helm.Options{ Chart: p.Chart.Name, - Repo: fmt.Sprintf("%s/%s", helmConfig.Registry, p.Chart.Repository), + Repo: p.Chart.Repository, + Registry: helmConfig.Registry, Version: p.Chart.Version, Values: p.Values, InsecureSkipTLSVerify: helmConfig.InsecureSkipTLSVerify, @@ -201,7 +202,7 @@ func (r *ValidatorConfigReconciler) redeployIfNeeded(ctx context.Context, vc *v1 continue } ociOpts := oci.ImageOptions{ - Ref: fmt.Sprintf("%s/%s:%s", strings.TrimPrefix(opts.Repo, oci.Scheme), opts.Chart, opts.Version), + Ref: fmt.Sprintf("%s/%s/%s:%s", strings.TrimPrefix(opts.Registry, oci.Scheme), opts.Repo, opts.Chart, opts.Version), OutDir: opts.Path, OutFile: opts.Chart, } diff --git a/pkg/helm/helm.go b/pkg/helm/helm.go index e866bdc0..c1bd6a47 100644 --- a/pkg/helm/helm.go +++ b/pkg/helm/helm.go @@ -108,6 +108,9 @@ func (c *CLIClient) run(name, namespace string, options Options, command string, args = append(args, options.Path) } else if options.Chart != "" { args = append(args, options.Chart) + if options.Registry != "" { + return fmt.Errorf("chart registry cannot be null") + } if options.Repo == "" { return fmt.Errorf("chart repo cannot be null") } diff --git a/pkg/helm/options.go b/pkg/helm/options.go index e294c3b8..7b146cd0 100644 --- a/pkg/helm/options.go +++ b/pkg/helm/options.go @@ -1,10 +1,13 @@ package helm +import "fmt" + // Options holds all the options for installing/pulling/upgrading a chart. type Options struct { Chart string Path string + Registry string Repo string Version string Values string @@ -29,7 +32,7 @@ type Options struct { // ConfigureRepo adds the repo flag to the command. func (o Options) ConfigureRepo(args []string) []string { - args = append(args, "--repo", o.Repo) + args = append(args, "--repo", fmt.Sprintf("%s/%s", o.Registry, o.Repo)) return args }