Merge pull request #103801 from gkarthiks/master

Remove purell package usage from kubeadm
This commit is contained in:
Kubernetes Prow Robot 2021-08-05 14:09:56 -07:00 committed by GitHub
commit 8df554bafd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -51,7 +51,6 @@ import (
utilsexec "k8s.io/utils/exec"
utilsnet "k8s.io/utils/net"
"github.com/PuerkitoBio/purell"
"github.com/pkg/errors"
)
@ -714,7 +713,7 @@ func (evc ExternalEtcdVersionCheck) Check() (warnings, errorList []error) {
resp := etcdVersionResponse{}
var err error
versionURL := fmt.Sprintf("%s/%s", endpoint, "version")
if tmpVersionURL, err := purell.NormalizeURLString(versionURL, purell.FlagRemoveDuplicateSlashes); err != nil {
if tmpVersionURL, err := normalizeURLString(versionURL); err != nil {
errorList = append(errorList, errors.Wrapf(err, "failed to normalize external etcd version url %s", versionURL))
continue
} else {
@ -1119,3 +1118,16 @@ func setHasItemOrAll(s sets.String, item string) bool {
}
return false
}
// normalizeURLString returns the normalized string, or an error if it can't be parsed into an URL object.
// It takes an URL string as input.
func normalizeURLString(s string) (string, error) {
u, err := url.Parse(s)
if err != nil {
return "", err
}
if len(u.Path) > 0 {
u.Path = strings.ReplaceAll(u.Path, "//", "/")
}
return u.String(), nil
}

1
go.mod
View File

@ -18,7 +18,6 @@ require (
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab
github.com/Microsoft/go-winio v0.4.15
github.com/Microsoft/hcsshim v0.8.10-0.20200715222032-5eafd1556990
github.com/PuerkitoBio/purell v1.1.1
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
github.com/auth0/go-jwt-middleware v1.0.1 // indirect
github.com/aws/aws-sdk-go v1.38.49

1
vendor/modules.txt vendored
View File

@ -81,7 +81,6 @@ github.com/Microsoft/hcsshim/osversion
# github.com/NYTimes/gziphandler v1.1.1 => github.com/NYTimes/gziphandler v1.1.1
github.com/NYTimes/gziphandler
# github.com/PuerkitoBio/purell v1.1.1 => github.com/PuerkitoBio/purell v1.1.1
## explicit
github.com/PuerkitoBio/purell
# github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 => github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
github.com/PuerkitoBio/urlesc