Skip to content

Commit

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

Signed-off-by: 1gtm <[email protected]>
  • Loading branch information
1gtm authored Nov 24, 2021
1 parent a3acd49 commit 57fea23
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 21 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ require (
github.com/robfig/cron/v3 v3.0.1
github.com/spf13/cobra v1.1.3
github.com/spf13/pflag v1.0.5
go.bytebuilders.dev/audit v0.0.13
go.bytebuilders.dev/license-verifier v0.9.6
go.bytebuilders.dev/license-verifier/kubernetes v0.9.6
go.bytebuilders.dev/audit v0.0.14
go.bytebuilders.dev/license-verifier v0.9.7
go.bytebuilders.dev/license-verifier/kubernetes v0.9.7
gomodules.xyz/blobfs v0.1.7
gomodules.xyz/cert v1.2.0
gomodules.xyz/encoding v0.0.2
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,13 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
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/audit v0.0.13 h1:Ne2tYw6aM7p5fbGOxQWfhQvGyv0IVZphLBAK3rMLGFE=
go.bytebuilders.dev/audit v0.0.13/go.mod h1:p5z/qZKf9awnjs8mKSWiwz1OwUdzbK5SXKi+Xtww5HQ=
go.bytebuilders.dev/audit v0.0.14 h1:45gtWgZ7lDuBoUresrtubXMajsSf7ZG2AKREEGrlMLo=
go.bytebuilders.dev/audit v0.0.14/go.mod h1:1hnjSI68Bz+LFJrzMepztve5A7slQg1sLK7+rISEJTY=
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 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
Expand Down
2 changes: 1 addition & 1 deletion vendor/go.bytebuilders.dev/audit/lib/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewNatsConfig(clusterID string, LicenseFile string) (*NatsConfig, error) {

opts := verifier.Options{
ClusterUID: clusterID,
Features: info.Features(),
Features: info.ProductName,
CACert: []byte(info.LicenseCA),
License: licenseBytes,
}
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
6 changes: 3 additions & 3 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,17 @@ 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/audit v0.0.13
# go.bytebuilders.dev/audit v0.0.14
## explicit
go.bytebuilders.dev/audit/api/v1
go.bytebuilders.dev/audit/lib
# go.bytebuilders.dev/license-verifier v0.9.6
# go.bytebuilders.dev/license-verifier v0.9.7
## explicit
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
# go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489 => go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489
Expand Down

0 comments on commit 57fea23

Please sign in to comment.