Skip to content

Commit

Permalink
[cherry-pick] Fix SiteInfo publishing (#1049) (#1055)
Browse files Browse the repository at this point in the history
/cherry-pick

Signed-off-by: 1gtm <1gtm@appscode.com>
  • Loading branch information
1gtm authored Nov 24, 2021
1 parent 4bc8392 commit 716e21e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.15

require (
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
gomodules.xyz/flags v0.1.3
gomodules.xyz/go-sh v0.1.0
gomodules.xyz/logs v0.0.6
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,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=
Expand Down
6 changes: 5 additions & 1 deletion vendor/go.bytebuilders.dev/license-verifier/info/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == ';'
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions vendor/go.bytebuilders.dev/license-verifier/kubernetes/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
}
Expand Down Expand Up @@ -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,
},
}

Expand Down Expand Up @@ -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,
},
}

Expand Down
8 changes: 5 additions & 3 deletions vendor/go.bytebuilders.dev/license-verifier/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ 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"
)

type Options struct {
ClusterUID string `json:"clusterUID"`
Features []string `json:"features"`
Features string `json:"features"`
CACert []byte `json:"caCert,omitempty"`
License []byte `json:"license"`
}
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,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
Expand Down

0 comments on commit 716e21e

Please sign in to comment.