Skip to content

Commit 8a2bd42

Browse files
committed
Fix HelmChart reconciler appending login options when they do not exist
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
1 parent 326a22a commit 8a2bd42

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

internal/helm/getter/client_opts.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,19 @@ func configureOCIRegistryWithSecrets(ctx context.Context, obj *sourcev1.HelmRepo
195195
if err != nil {
196196
return "", err
197197
}
198-
199-
if loginOpt != nil {
200-
opts.RegLoginOpts = []helmreg.LoginOption{loginOpt, helmreg.LoginOptInsecure(obj.Spec.Insecure)}
198+
if loginOpt == nil {
199+
return "", nil
201200
}
201+
opts.RegLoginOpts = []helmreg.LoginOption{loginOpt, helmreg.LoginOptInsecure(obj.Spec.Insecure)}
202202

203-
// Handle TLS certificate files for OCI
203+
// Handle TLS for login options
204204
var tempCertDir string
205205
if opts.TlsConfig != nil {
206+
// Until Helm 3.19 only a file-based login option for TLS is supported.
207+
// In Helm 4 (or in Helm 3.20+ if it ever gets released), a simpler
208+
// in-memory login option for TLS will be available:
209+
// https://github.com/helm/helm/pull/31076
210+
206211
tempCertDir, err = os.MkdirTemp("", "helm-repo-oci-certs")
207212
if err != nil {
208213
return "", fmt.Errorf("cannot create temporary directory: %w", err)

0 commit comments

Comments
 (0)