Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/CVE fix 20240829 #295

Open
wants to merge 10 commits into
base: release/1.2.11
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ kube-eventer
.git
coverage.txt
.DS_Store
vendor/
16 changes: 10 additions & 6 deletions common/influxdb/dummy_influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"strings"
"time"

influxdb "github.com/influxdata/influxdb/client"
influxdb "github.com/influxdata/influxdb/client/v2"
)

type PointSavedToInfluxdb struct {
Expand All @@ -33,11 +33,11 @@ func NewFakeInfluxDBClient() *FakeInfluxDBClient {
return &FakeInfluxDBClient{[]PointSavedToInfluxdb{}}
}

func (client *FakeInfluxDBClient) Write(bps influxdb.BatchPoints) (*influxdb.Response, error) {
for _, pnt := range bps.Points {
client.Pnts = append(client.Pnts, PointSavedToInfluxdb{pnt})
func (client *FakeInfluxDBClient) Write(bps influxdb.BatchPoints) error {
for _, pnt := range bps.Points() {
client.Pnts = append(client.Pnts, PointSavedToInfluxdb{*pnt})
}
return nil, nil
return nil
}

func (client *FakeInfluxDBClient) Query(q influxdb.Query) (*influxdb.Response, error) {
Expand All @@ -49,10 +49,14 @@ func (client *FakeInfluxDBClient) Query(q influxdb.Query) (*influxdb.Response, e
}, nil
}

func (client *FakeInfluxDBClient) Ping() (time.Duration, string, error) {
func (client *FakeInfluxDBClient) Ping(timeout time.Duration) (time.Duration, string, error) {
return 0, "", nil
}

func (client *FakeInfluxDBClient) Close() error {
return nil
}

var Client = NewFakeInfluxDBClient()

var Config = InfluxdbConfig{
Expand Down
26 changes: 14 additions & 12 deletions common/influxdb/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ import (

"k8s.io/client-go/pkg/version"

influxdb "github.com/influxdata/influxdb/client"
influxdb "github.com/influxdata/influxdb/client/v2"
)

const PingTimeout = time.Second * 5

type InfluxdbClient interface {
Write(influxdb.BatchPoints) (*influxdb.Response, error)
Write(influxdb.BatchPoints) error
Query(influxdb.Query) (*influxdb.Response, error)
Ping() (time.Duration, string, error)
Ping(time.Duration) (time.Duration, string, error)
Close() error
}

type InfluxdbConfig struct {
Expand All @@ -55,19 +58,18 @@ func NewClient(c InfluxdbConfig) (InfluxdbClient, error) {
url.Scheme = "https"
}

iConfig := &influxdb.Config{
URL: *url,
Username: c.User,
Password: c.Password,
UserAgent: fmt.Sprintf("%v/%v", "kube-eventer", version.Get().GitVersion),
UnsafeSsl: c.InsecureSsl,
iConfig := influxdb.HTTPConfig{
Addr: url.String(),
Username: c.User,
Password: c.Password,
UserAgent: fmt.Sprintf("%v/%v", "kube-eventer", version.Get().GitVersion),
InsecureSkipVerify: c.InsecureSsl,
}
client, err := influxdb.NewClient(*iConfig)

client, err := influxdb.NewHTTPClient(iConfig)
if err != nil {
return nil, err
}
if _, _, err := client.Ping(); err != nil {
if _, _, err := client.Ping(PingTimeout); err != nil {
return nil, fmt.Errorf("failed to ping InfluxDB server at %q - %v", c.Host, err)
}
return client, nil
Expand Down
5 changes: 3 additions & 2 deletions common/riemann/riemann.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ func CreateRiemannSink(uri *url.URL) (*RiemannSink, error) {
// Receives a sink, connect the riemann client.
func GetRiemannClient(config RiemannConfig) (riemanngo.Client, error) {
klog.Infof("Connect Riemann client...")
client := riemanngo.NewTcpClient(config.Host)
// client := riemanngo.NewTcpClient(config.Host)
client := riemanngo.NewTCPClient(config.Host, 5)
runtime.SetFinalizer(client, func(c riemanngo.Client) { c.Close() })
// 5 seconds timeout
err := client.Connect(5)
err := client.Connect()
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion deploy/Dockerfile.multi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.20.7 AS build-env
FROM --platform=$BUILDPLATFORM golang:1.22.5 AS build-env
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG BUILDARCH
Expand Down
139 changes: 111 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,36 +1,119 @@
module github.com/AliyunContainerService/kube-eventer

go 1.12
go 1.22.0

toolchain go1.22.5

require (
github.com/Shopify/sarama v1.22.1
github.com/alibabacloud-go/eventbridge-sdk v1.2.6
github.com/alibabacloud-go/tea-utils v1.3.7
github.com/aliyun/aliyun-log-go-sdk v0.1.80
github.com/aws/aws-sdk-go v1.34.28
github.com/denverdino/aliyungo v0.0.0-20190410085603-611ead8a6fed
github.com/go-sql-driver/mysql v1.5.0
github.com/golang/protobuf v1.4.3
github.com/google/cadvisor v0.33.1
github.com/google/uuid v1.1.1
github.com/imdario/mergo v0.3.7 // indirect
github.com/influxdata/influxdb v1.7.7
github.com/mailru/easyjson v0.7.0 // indirect
github.com/olivere/elastic v6.2.23+incompatible // indirect
github.com/olivere/elastic/v7 v7.0.6
github.com/pborman/uuid v1.2.0
github.com/prometheus/client_golang v1.11.1
github.com/riemann/riemann-go-client v0.4.0
github.com/Shopify/sarama v1.38.1
github.com/alibabacloud-go/eventbridge-sdk v1.3.3
github.com/alibabacloud-go/tea-utils v1.4.5
github.com/aliyun/aliyun-log-go-sdk v0.1.82
github.com/aws/aws-sdk-go v1.55.5
github.com/denverdino/aliyungo v0.0.0-20230411124812-ab98a9173ace
github.com/go-sql-driver/mysql v1.8.1
github.com/golang/protobuf v1.5.4
github.com/google/cadvisor v0.50.0
github.com/google/uuid v1.6.0
github.com/influxdata/influxdb v1.11.6
github.com/olivere/elastic/v7 v7.0.32
github.com/pborman/uuid v1.2.1
github.com/prometheus/client_golang v1.20.2
github.com/riemann/riemann-go-client v0.5.0
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9
github.com/smartystreets/gunit v1.0.0 // indirect
github.com/stretchr/testify v1.6.1
go.mongodb.org/mongo-driver v1.5.1
golang.org/x/sys v0.2.0 // indirect
github.com/stretchr/testify v1.9.0
go.mongodb.org/mongo-driver v1.16.1
gopkg.in/olivere/elastic.v3 v3.0.75
gopkg.in/olivere/elastic.v5 v5.0.81
gopkg.in/olivere/elastic.v6 v6.2.23
k8s.io/api v0.17.4
k8s.io/apimachinery v0.17.4
k8s.io/client-go v0.17.4
gopkg.in/olivere/elastic.v5 v5.0.86
gopkg.in/olivere/elastic.v6 v6.2.37
k8s.io/api v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
k8s.io/klog v1.0.0
)

require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/alibabacloud-go/debug v1.0.1 // indirect
github.com/alibabacloud-go/eventbridge-util v1.0.4 // indirect
github.com/alibabacloud-go/tea v1.2.2 // indirect
github.com/aliyun/credentials-go v1.3.9 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/eapache/go-resiliency v1.7.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/frankban/quicktest v1.11.3 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/olivere/elastic v6.2.37+incompatible // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.57.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/smartystreets/gunit v1.4.5 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240827152857-f7e401e7b4c2 // indirect
k8s.io/utils v0.0.0-20240821151609-f90d01438635 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading