Skip to content

Commit 7d61553

Browse files
author
Paulo Gomes
committed
Remove dependency to helm v2
Signed-off-by: Paulo Gomes <[email protected]>
1 parent f63681f commit 7d61553

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ require (
4040
k8s.io/api v0.23.3
4141
k8s.io/apimachinery v0.23.3
4242
k8s.io/client-go v0.23.3
43-
k8s.io/helm v2.17.0+incompatible
4443
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
4544
sigs.k8s.io/cli-utils v0.28.0
4645
sigs.k8s.io/controller-runtime v0.11.1

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,8 +1759,6 @@ k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8
17591759
k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
17601760
k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
17611761
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
1762-
k8s.io/helm v2.17.0+incompatible h1:Bpn6o1wKLYqKM3+Osh8e+1/K2g/GsQJ4F4yNF2+deao=
1763-
k8s.io/helm v2.17.0+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
17641762
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
17651763
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
17661764
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=

internal/helm/getter/getter.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import (
2020
"crypto/tls"
2121
"crypto/x509"
2222
"fmt"
23+
"net/url"
2324

2425
"helm.sh/helm/v3/pkg/getter"
2526
corev1 "k8s.io/api/core/v1"
26-
"k8s.io/helm/pkg/urlutil"
2727
)
2828

2929
// ClientOptionsFromSecret constructs a getter.Option slice for the given secret.
@@ -61,7 +61,7 @@ func BasicAuthFromSecret(secret corev1.Secret) (getter.Option, error) {
6161
//
6262
// Secrets with no certFile, keyFile, AND caFile are ignored, if only a
6363
// certBytes OR keyBytes is defined it returns an error.
64-
func TLSClientConfigFromSecret(secret corev1.Secret, url string) (*tls.Config, error) {
64+
func TLSClientConfigFromSecret(secret corev1.Secret, repositoryUrl string) (*tls.Config, error) {
6565
certBytes, keyBytes, caBytes := secret.Data["certFile"], secret.Data["keyFile"], secret.Data["caFile"]
6666
switch {
6767
case len(certBytes)+len(keyBytes)+len(caBytes) == 0:
@@ -91,11 +91,12 @@ func TLSClientConfigFromSecret(secret corev1.Secret, url string) (*tls.Config, e
9191

9292
tlsConf.BuildNameToCertificate()
9393

94-
sni, err := urlutil.ExtractHostname(url)
94+
u, err := url.Parse(repositoryUrl)
9595
if err != nil {
96-
return nil, err
96+
return nil, fmt.Errorf("cannot parse repository URL: %w", err)
9797
}
98-
tlsConf.ServerName = sni
98+
99+
tlsConf.ServerName = u.Hostname()
99100

100101
return tlsConf, nil
101102
}

0 commit comments

Comments
 (0)