From 680c3392a209e55ca49b3d8183ca2db63401954d Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Tue, 23 Nov 2021 23:31:14 -0800 Subject: [PATCH] Fix SiteInfo publishing (#549) (#553) /cherry-pick Signed-off-by: 1gtm <1gtm@appscode.com> Co-authored-by: lgtm <1gtm@users.noreply.github.com> --- go.mod | 2 +- go.sum | 8 ++++---- vendor/go.bytebuilders.dev/license-verifier/info/lib.go | 6 +++++- .../license-verifier/kubernetes/go.mod | 2 +- .../license-verifier/kubernetes/lib.go | 6 +++--- vendor/go.bytebuilders.dev/license-verifier/lib.go | 8 +++++--- vendor/modules.txt | 4 ++-- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 5476ec987..ae1b4c959 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/google/gofuzz v1.2.0 // indirect github.com/spf13/cobra v1.1.3 - go.bytebuilders.dev/license-verifier/kubernetes v0.9.6 + go.bytebuilders.dev/license-verifier/kubernetes v0.9.7 golang.org/x/tools v0.1.1-0.20210427153610-6397a11608ad // indirect gomodules.xyz/flags v0.1.3 gomodules.xyz/go-sh v0.1.0 diff --git a/go.sum b/go.sum index e67c29703..e8b149bb1 100644 --- a/go.sum +++ b/go.sum @@ -645,10 +645,10 @@ github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= go.bytebuilders.dev/license-verifier v0.9.3/go.mod h1:GpIW0o8O0wpiBVt7IIz4z7bcPuG8nza8/bCDkaupDn8= -go.bytebuilders.dev/license-verifier v0.9.6 h1:nT4Eplu0OQWM7Re81ZQibkYKeno6nDAwOzaz14Yvadc= -go.bytebuilders.dev/license-verifier v0.9.6/go.mod h1:GpIW0o8O0wpiBVt7IIz4z7bcPuG8nza8/bCDkaupDn8= -go.bytebuilders.dev/license-verifier/kubernetes v0.9.6 h1:QwiUgNug1pD4cwxLuSQmSLn1WvvNreKfBajdymoRmeM= -go.bytebuilders.dev/license-verifier/kubernetes v0.9.6/go.mod h1:b1oIjrDuNN1T3d1ixnr020hi2i0sXlR7CIsWrhkzga4= +go.bytebuilders.dev/license-verifier v0.9.7 h1:m7Z3cuVJYUUctCfTK6qT0IKtPVZurxq1b1bKzWjqwsE= +go.bytebuilders.dev/license-verifier v0.9.7/go.mod h1:GpIW0o8O0wpiBVt7IIz4z7bcPuG8nza8/bCDkaupDn8= +go.bytebuilders.dev/license-verifier/kubernetes v0.9.7 h1:TN9N9FmmxrPTQoAPJsQnHRgY00liNZgiTUyZ2QNtqyg= +go.bytebuilders.dev/license-verifier/kubernetes v0.9.7/go.mod h1:hsNtdOrSnm5v8dwTgbKLVADNTgD+b6eaZHXiJZXoPcE= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= diff --git a/vendor/go.bytebuilders.dev/license-verifier/info/lib.go b/vendor/go.bytebuilders.dev/license-verifier/info/lib.go index 1b617a84c..2cf482c12 100644 --- a/vendor/go.bytebuilders.dev/license-verifier/info/lib.go +++ b/vendor/go.bytebuilders.dev/license-verifier/info/lib.go @@ -40,7 +40,11 @@ var ( ) func Features() []string { - return strings.FieldsFunc(ProductName, func(r rune) bool { + return ParseFeatures(ProductName) +} + +func ParseFeatures(features string) []string { + return strings.FieldsFunc(features, func(r rune) bool { return unicode.IsSpace(r) || r == ',' || r == ';' }) } diff --git a/vendor/go.bytebuilders.dev/license-verifier/kubernetes/go.mod b/vendor/go.bytebuilders.dev/license-verifier/kubernetes/go.mod index ec82168ad..5d6bfd300 100644 --- a/vendor/go.bytebuilders.dev/license-verifier/kubernetes/go.mod +++ b/vendor/go.bytebuilders.dev/license-verifier/kubernetes/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.2 - go.bytebuilders.dev/license-verifier v0.9.6 + go.bytebuilders.dev/license-verifier v0.9.7 k8s.io/api v0.21.1 k8s.io/apimachinery v0.21.1 k8s.io/apiserver v0.21.1 diff --git a/vendor/go.bytebuilders.dev/license-verifier/kubernetes/lib.go b/vendor/go.bytebuilders.dev/license-verifier/kubernetes/lib.go index 7188ca8cd..278e65fda 100644 --- a/vendor/go.bytebuilders.dev/license-verifier/kubernetes/lib.go +++ b/vendor/go.bytebuilders.dev/license-verifier/kubernetes/lib.go @@ -74,7 +74,7 @@ func NewLicenseEnforcer(config *rest.Config, licenseFile string) *LicenseEnforce config: config, opts: &verifier.Options{ CACert: []byte(info.LicenseCA), - Features: info.Features(), + Features: info.ProductName, }, } } @@ -227,7 +227,7 @@ func VerifyLicensePeriodically(config *rest.Config, licenseFile string, stopCh < config: config, opts: &verifier.Options{ CACert: []byte(info.LicenseCA), - Features: info.Features(), + Features: info.ProductName, }, } @@ -286,7 +286,7 @@ func CheckLicenseFile(config *rest.Config, licenseFile string) error { config: config, opts: &verifier.Options{ CACert: []byte(info.LicenseCA), - Features: info.Features(), + Features: info.ProductName, }, } diff --git a/vendor/go.bytebuilders.dev/license-verifier/lib.go b/vendor/go.bytebuilders.dev/license-verifier/lib.go index f7742c94e..64e132af4 100644 --- a/vendor/go.bytebuilders.dev/license-verifier/lib.go +++ b/vendor/go.bytebuilders.dev/license-verifier/lib.go @@ -20,9 +20,11 @@ import ( "crypto/x509" "encoding/pem" "fmt" - "go.bytebuilders.dev/license-verifier/apis/licenses/v1alpha1" "strings" + "go.bytebuilders.dev/license-verifier/apis/licenses/v1alpha1" + "go.bytebuilders.dev/license-verifier/info" + "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" @@ -30,7 +32,7 @@ import ( type Options struct { ClusterUID string `json:"clusterUID"` - Features []string `json:"features"` + Features string `json:"features"` CACert []byte `json:"caCert,omitempty"` License []byte `json:"license"` } @@ -163,7 +165,7 @@ func VerifyLicense(opts *Options) (v1alpha1.License, error) { license.Reason = e2.Error() return license, e2 } - if !sets.NewString(cert.Subject.Organization...).HasAny(opts.Features...) { + if !sets.NewString(cert.Subject.Organization...).HasAny(info.ParseFeatures(opts.Features)...) { e2 := fmt.Errorf("license was not issued for %s", opts.Features) license.Status = v1alpha1.LicenseExpired license.Reason = e2.Error() diff --git a/vendor/modules.txt b/vendor/modules.txt index abb774d51..f5240a85f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -123,12 +123,12 @@ github.com/yudai/gojsondiff github.com/yudai/gojsondiff/formatter # github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 github.com/yudai/golcs -# go.bytebuilders.dev/license-verifier v0.9.6 +# go.bytebuilders.dev/license-verifier v0.9.7 go.bytebuilders.dev/license-verifier go.bytebuilders.dev/license-verifier/apis/licenses go.bytebuilders.dev/license-verifier/apis/licenses/v1alpha1 go.bytebuilders.dev/license-verifier/info -# go.bytebuilders.dev/license-verifier/kubernetes v0.9.6 +# go.bytebuilders.dev/license-verifier/kubernetes v0.9.7 ## explicit go.bytebuilders.dev/license-verifier/kubernetes # golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b