From 72354f1857a36215c85d56e055165245bb1c9bbb Mon Sep 17 00:00:00 2001 From: Samu Tamminen Date: Sun, 24 Apr 2022 17:05:53 +0800 Subject: [PATCH 01/25] Mock cluster in Headerlookup and Validator unittest (#590) * use mocked cluster to simplify test * simplify test --- pkg/filter/headerlookup/headerlookup_test.go | 187 +++++++++---------- pkg/filter/validator/validator_test.go | 125 +++++-------- 2 files changed, 135 insertions(+), 177 deletions(-) diff --git a/pkg/filter/headerlookup/headerlookup_test.go b/pkg/filter/headerlookup/headerlookup_test.go index 0859d79abf..4fd7a00d50 100644 --- a/pkg/filter/headerlookup/headerlookup_test.go +++ b/pkg/filter/headerlookup/headerlookup_test.go @@ -18,9 +18,9 @@ package headerlookup import ( - "io/ioutil" "net/http" "os" + "sort" "sync" "testing" "time" @@ -28,12 +28,14 @@ import ( lru "github.com/hashicorp/golang-lru" cluster "github.com/megaease/easegress/pkg/cluster" + "github.com/megaease/easegress/pkg/cluster/clustertest" "github.com/megaease/easegress/pkg/context/contexttest" "github.com/megaease/easegress/pkg/logger" "github.com/megaease/easegress/pkg/object/httppipeline" "github.com/megaease/easegress/pkg/supervisor" "github.com/megaease/easegress/pkg/util/httpheader" "github.com/megaease/easegress/pkg/util/yamltool" + "github.com/stretchr/testify/assert" ) func TestMain(m *testing.M) { @@ -59,17 +61,23 @@ func createHeaderLookup( return hl, nil } -func check(e error) { - if e != nil { - panic(e) +func createClusterAndSyncer() (*clustertest.MockedCluster, chan map[string]string) { + clusterInstance := clustertest.NewMockedCluster() + syncer := clustertest.NewMockedSyncer() + clusterInstance.MockedSyncer = func(t time.Duration) (cluster.Syncer, error) { + return syncer, nil } + syncerChannel := make(chan map[string]string) + syncer.MockedSyncPrefix = func(prefix string) (<-chan map[string]string, error) { + return syncerChannel, nil + } + return clusterInstance, syncerChannel } func TestValidate(t *testing.T) { - etcdDirName, err := ioutil.TempDir("", "etcd-headerlookup-test") - check(err) - defer os.RemoveAll(etcdDirName) - clusterInstance := cluster.CreateClusterForTest(etcdDirName) + assert := assert.New(t) + clusterInstance, _ := createClusterAndSyncer() + var mockMap sync.Map supervisor := supervisor.NewMock( nil, clusterInstance, mockMap, mockMap, nil, nil, false, nil, nil) @@ -128,17 +136,17 @@ headerSetters: } for _, unvalidYaml := range unvalidYamls { - if _, err := createHeaderLookup(unvalidYaml, nil, supervisor); err == nil { - t.Errorf("validate should return error") - } + _, err := createHeaderLookup(unvalidYaml, nil, supervisor) + assert.NotNil(err) } - if _, err := createHeaderLookup(validYaml, nil, supervisor); err != nil { - t.Errorf("validate should not return error: %s", err.Error()) - } + _, err := createHeaderLookup(validYaml, nil, supervisor) + assert.Nil(err) } func TestFindKeysToDelete(t *testing.T) { + assert := assert.New(t) + cache, _ := lru.New(10) kvs := make(map[string]string) kvs["doge"] = "headerA: 3\nheaderB: 6" @@ -150,9 +158,10 @@ func TestFindKeysToDelete(t *testing.T) { cache.Add("foo", "headerA: 3\nheaderB: 232") // new value cache.Add("key4", "---") // new value cache.Add("key6", "headerA: 11\nheaderB: 44") // new value - if res := findKeysToDelete(kvs, cache); res[0] == "foo" && res[1] == "key4" { - t.Errorf("findModifiedValues failed") - } + res := findKeysToDelete(kvs, cache) + sort.Strings(res) + assert.NotEqual("foo", res[0]) + assert.NotEqual("key4", res[1]) } func prepareCtxAndHeader() (*contexttest.MockedHTTPContext, http.Header) { @@ -165,9 +174,8 @@ func prepareCtxAndHeader() (*contexttest.MockedHTTPContext, http.Header) { } func TestHandle(t *testing.T) { - etcdDirName, err := ioutil.TempDir("", "etcd-headerlookup-test") - check(err) - defer os.RemoveAll(etcdDirName) + assert := assert.New(t) + const config = ` name: headerLookup kind: HeaderLookup @@ -177,37 +185,31 @@ headerSetters: - etcdKey: "ext-id" headerKey: "user-ext-id" ` - clusterInstance := cluster.CreateClusterForTest(etcdDirName) + + clusterInstance, syncerChannel := createClusterAndSyncer() + var mockMap sync.Map supervisor := supervisor.NewMock( nil, clusterInstance, mockMap, mockMap, nil, nil, false, nil, nil) // let's put data to 'foobar' - clusterInstance.Put("/custom-data/credentials/foobar", - ` + foobar := ` ext-id: 123456789 extra-entry: "extra" -`) +` + clusterInstance.MockedGet = func(key string) (*string, error) { + return &foobar, nil + } hl, err := createHeaderLookup(config, nil, supervisor) - check(err) + assert.Equal(nil, err) // 'foobar' is the id ctx, header := prepareCtxAndHeader() - hl.Handle(ctx) // does nothing as header missing - - if header.Get("user-ext-id") != "" { - t.Errorf("header should not be set") - } - + assert.Equal("", header.Get("user-ext-id")) header.Set("X-AUTH-USER", "unknown-user") - hl.Handle(ctx) // does nothing as user is missing - - if header.Get("user-ext-id") != "" { - t.Errorf("header should be set") - } - + assert.NotEqual("", header.Get("user-ext-id")) header.Set("X-AUTH-USER", "foobar") hl.Handle(ctx) // now updates header @@ -215,62 +217,48 @@ extra-entry: "extra" hl.Handle(ctx) // get from cache hdr2 := header.Get("user-ext-id") - if hdr1 != hdr2 || hdr1 != "123456789" { - t.Errorf("header should be set") - } + assert.Equal(hdr1, hdr2) + assert.Equal("123456789", hdr1) + + hl, err = createHeaderLookup(config, hl, supervisor) + ctx, header = prepareCtxAndHeader() // update key-value store - clusterInstance.Put("/custom-data/credentials/foobar", ` + foobar = ` ext-id: 77341 extra-entry: "extra" -`) - hl, err = createHeaderLookup(config, hl, supervisor) - ctx, header = prepareCtxAndHeader() +` + clusterInstance.MockedGet = func(key string) (*string, error) { + return &foobar, nil + } + kvs := make(map[string]string) + kvs["foobar"] = foobar + syncerChannel <- kvs + header.Set("X-AUTH-USER", "foobar") - tryCount := 5 - for i := 0; i <= tryCount; i++ { - time.Sleep(200 * time.Millisecond) // wait that cache item gets updated - hl.Handle(ctx) // get updated value - if header.Get("user-ext-id") == "77341" { - break // successfully updated - } else if i == tryCount { - t.Errorf("header should be updated") - } - } + hl.Handle(ctx) // get updated value + assert.Equal("77341", header.Get("user-ext-id")) + hl, err = createHeaderLookup(config, hl, supervisor) ctx, header = prepareCtxAndHeader() header.Set("X-AUTH-USER", "foobar") // delete foobar completely - clusterInstance.Delete("/custom-data/credentials/foobar") - - for j := 0; j <= tryCount; j++ { - time.Sleep(200 * time.Millisecond) // wait that cache item get deleted - hl.Handle(ctx) // get updated value - if len(header.Get("user-ext-id")) == 0 { - break // successfully deleted - } else if j == tryCount { - t.Errorf("header should be deleted, got %s", header.Get("user-ext-id")) - } + clusterInstance.MockedGet = func(key string) (*string, error) { + return nil, nil } - if hl.Status() != nil { - t.Errorf("status should be nil") - } - if len(hl.Description()) == 0 { - t.Errorf("description should not be empty") - } - hl.Close() - wg := &sync.WaitGroup{} - wg.Add(1) - clusterInstance.CloseServer(wg) - wg.Wait() + hl.Handle(ctx) // get updated value + assert.Equal(0, len(header.Get("user-ext-id"))) + + assert.Nil(hl.Status()) + assert.NotEqual(0, len(hl.Description())) + close(syncerChannel) } func TestHandleWithPath(t *testing.T) { - etcdDirName, err := ioutil.TempDir("", "etcd-headerlookup-path-test") - check(err) - defer os.RemoveAll(etcdDirName) + assert := assert.New(t) + const config = ` name: headerLookup kind: HeaderLookup @@ -281,49 +269,46 @@ headerSetters: - etcdKey: "ext-id" headerKey: "user-ext-id" ` - clusterInstance := cluster.CreateClusterForTest(etcdDirName) + clusterInstance, _ := createClusterAndSyncer() var mockMap sync.Map supervisor := supervisor.NewMock( nil, clusterInstance, mockMap, mockMap, nil, nil, false, nil, nil) - - // let's put data to 'bob' - clusterInstance.Put("/custom-data/credentials/bob-bananas", - ` + bobbanana := ` ext-id: 333 extra-entry: "extra" -`) - clusterInstance.Put("/custom-data/credentials/bob-pearls", - ` +` + bobpearl := ` ext-id: 4444 extra-entry: "extra" -`) +` + + clusterInstance.MockedGet = func(key string) (*string, error) { + if key == "/custom-data/credentials/bob-bananas" { + return &bobbanana, nil + } + if key == "/custom-data/credentials/bob-pearls" { + return &bobpearl, nil + } + return nil, nil + } + hl, err := createHeaderLookup(config, nil, supervisor) - check(err) + assert.Nil(err) ctx, header := prepareCtxAndHeader() header.Set("X-AUTH-USER", "bob") hl.Handle(ctx) // path does not match - if header.Get("user-ext-id") != "" { - t.Errorf("failed") - } + assert.Equal("", header.Get("user-ext-id")) ctx.MockedRequest.MockedPath = func() string { return "/api/bananas/9281" } hl.Handle(ctx) - if header.Get("user-ext-id") != "333" { - t.Errorf("failed") - } + assert.Equal("333", header.Get("user-ext-id")) ctx.MockedRequest.MockedPath = func() string { return "/api/pearls/" } hl.Handle(ctx) - if header.Get("user-ext-id") != "4444" { - t.Errorf("failed") - } + assert.Equal("4444", header.Get("user-ext-id")) hl.Close() - wg := &sync.WaitGroup{} - wg.Add(1) - clusterInstance.CloseServer(wg) - wg.Wait() } diff --git a/pkg/filter/validator/validator_test.go b/pkg/filter/validator/validator_test.go index 6a844e8206..242e266def 100644 --- a/pkg/filter/validator/validator_test.go +++ b/pkg/filter/validator/validator_test.go @@ -21,7 +21,6 @@ import ( "encoding/base64" "fmt" "io" - "io/ioutil" "net/http" "os" "strings" @@ -30,12 +29,14 @@ import ( "time" cluster "github.com/megaease/easegress/pkg/cluster" + "github.com/megaease/easegress/pkg/cluster/clustertest" "github.com/megaease/easegress/pkg/context/contexttest" "github.com/megaease/easegress/pkg/logger" "github.com/megaease/easegress/pkg/object/httppipeline" "github.com/megaease/easegress/pkg/supervisor" "github.com/megaease/easegress/pkg/util/httpheader" "github.com/megaease/easegress/pkg/util/yamltool" + "github.com/stretchr/testify/assert" ) func TestMain(m *testing.M) { @@ -60,7 +61,22 @@ func createValidator(yamlSpec string, prev *Validator, supervisor *supervisor.Su return v } +func createClusterAndSyncer() (*clustertest.MockedCluster, chan map[string]string) { + clusterInstance := clustertest.NewMockedCluster() + syncer := clustertest.NewMockedSyncer() + clusterInstance.MockedSyncer = func(t time.Duration) (cluster.Syncer, error) { + return syncer, nil + } + syncerChannel := make(chan map[string]string) + syncer.MockedSyncPrefix = func(prefix string) (<-chan map[string]string, error) { + return syncerChannel, nil + } + return clusterInstance, syncerChannel +} + func TestHeaders(t *testing.T) { + assert := assert.New(t) + const yamlSpec = ` kind: Validator name: validator @@ -79,27 +95,19 @@ headers: } result := v.Handle(ctx) - if result != resultInvalid { - t.Errorf("request has no header 'Is-Valid', should be invalid") - } + assert.Equal(resultInvalid, result, "request has no header 'Is-Valid'") header.Add("Is-Valid", "Invalid") result = v.Handle(ctx) - if result != resultInvalid { - t.Errorf("request has header 'Is-Valid', but value is incorrect, should be invalid") - } + assert.Equal(resultInvalid, result, "request has header 'Is-Valid', but value is incorrect") header.Set("Is-Valid", "goodplan") result = v.Handle(ctx) - if result == resultInvalid { - t.Errorf("request has header 'Is-Valid' and value is correct, should be valid") - } + assert.NotEqual(resultInvalid, result, "request has header 'Is-Valid' and value is correct") header.Set("Is-Valid", "ok-1") result = v.Handle(ctx) - if result == resultInvalid { - t.Errorf("request has header 'Is-Valid' and matches the regular expression, should be valid") - } + assert.NotEqual(resultInvalid, result, "request has header 'Is-Valid' and matches the regular expression") } func TestJWT(t *testing.T) { @@ -383,9 +391,7 @@ basicAuth: b64creds := base64.StdEncoding.EncodeToString([]byte(userIds[0])) // missing : and pw header.Set("Authorization", "Basic "+b64creds) result := v.Handle(ctx) - if result != resultInvalid { - t.Errorf("should be bad format") - } + assert.Equal(t, result, resultInvalid) }) for i := 0; i < 3; i++ { @@ -393,15 +399,7 @@ basicAuth: b64creds := base64.StdEncoding.EncodeToString([]byte(userIds[i] + ":" + passwords[i])) header.Set("Authorization", "Basic "+b64creds) result := v.Handle(ctx) - if expectedValid[i] { - if result == resultInvalid { - t.Errorf("should be authorized") - } - } else { - if result != resultInvalid { - t.Errorf("should be unauthorized") - } - } + assert.Equal(t, expectedValid[i], result != resultInvalid) } cleanFile(userFile) // no more authorized users @@ -434,25 +432,19 @@ basicAuth: b, err := io.ReadAll(reader) check(err) s := string(b) - if s != "key3:pw" { - t.Errorf("parsing failed, %s", s) - } + assert.Equal(t, "key3:pw", s) }) t.Run("dummy etcd", func(t *testing.T) { userCache := &etcdUserCache{prefix: ""} // should now skip cluster ops userCache.WatchChanges() - if userCache.Match("doge", "dogepw") { - t.Errorf("should not match") - } + assert.False(t, userCache.Match("doge", "dogepw")) userCache.Close() }) t.Run("credentials from etcd", func(t *testing.T) { - etcdDirName, err := ioutil.TempDir("", "etcd-validator-test") - check(err) - defer os.RemoveAll(etcdDirName) - clusterInstance := cluster.CreateClusterForTest(etcdDirName) + assert := assert.New(t) + clusterInstance, syncerChannel := createClusterAndSyncer() // Test newEtcdUserCache if euc := newEtcdUserCache(clusterInstance, ""); euc.prefix != "/custom-data/credentials/" { @@ -468,8 +460,12 @@ basicAuth: } return fmt.Sprintf("key: %s\npassword: %s", key, pw) } - clusterInstance.Put("/custom-data/credentials/1", pwToYaml(userIds[0], "", encryptedPasswords[0])) - clusterInstance.Put("/custom-data/credentials/2", pwToYaml("", userIds[2], encryptedPasswords[2])) + kvs := make(map[string]string) + kvs["/custom-data/credentials/1"] = pwToYaml(userIds[0], "", encryptedPasswords[0]) + kvs["/custom-data/credentials/2"] = pwToYaml("", userIds[2], encryptedPasswords[2]) + clusterInstance.MockedGetPrefix = func(key string) (map[string]string, error) { + return kvs, nil + } var mockMap sync.Map supervisor := supervisor.NewMock( @@ -489,58 +485,35 @@ basicAuth: b64creds := base64.StdEncoding.EncodeToString([]byte(userIds[i] + ":" + passwords[i])) header.Set("Authorization", "Basic "+b64creds) result := v.Handle(ctx) - if expectedValid[i] { - if result == resultInvalid { - t.Errorf("should be authorized") - } - } else { - if result != resultInvalid { - t.Errorf("should be unauthorized") - } - } + assert.Equal(expectedValid[i], result != resultInvalid) } - clusterInstance.Delete("/custom-data/credentials/1") // first user is not authorized anymore - clusterInstance.Put("/custom-data/credentials/doge", - ` + // first user is not authorized anymore + kvs = make(map[string]string) + kvs["/custom-data/credentials/2"] = pwToYaml("", userIds[2], encryptedPasswords[2]) + kvs["/custom-data/credentials/doge"] = ` randomEntry1: 21 nestedEntry: key1: val1 password: doge key: doge lastEntry: "byebye" -`) - - tryCount := 5 - for i := 0; i <= tryCount; i++ { - time.Sleep(200 * time.Millisecond) // wait that cache item gets deleted - ctx, header := prepareCtxAndHeader() - b64creds := base64.StdEncoding.EncodeToString([]byte(userIds[0] + ":" + passwords[0])) - header.Set("Authorization", "Basic "+b64creds) - result := v.Handle(ctx) - if result == resultInvalid { - break // successfully unauthorized - } - if i == tryCount && result != resultInvalid { - t.Errorf("should be unauthorized") - } - } +` + syncerChannel <- kvs + time.Sleep(time.Millisecond * 100) ctx, header := prepareCtxAndHeader() - b64creds := base64.StdEncoding.EncodeToString([]byte("doge:doge")) + b64creds := base64.StdEncoding.EncodeToString([]byte(userIds[0] + ":" + passwords[0])) header.Set("Authorization", "Basic "+b64creds) result := v.Handle(ctx) - if result == resultInvalid { - t.Errorf("should be authorized") - } - if header.Get("X-AUTH-USER") != "doge" { - t.Errorf("x-auth-user header not set") - } + assert.Equal(resultInvalid, result) + ctx, header = prepareCtxAndHeader() + b64creds = base64.StdEncoding.EncodeToString([]byte("doge:doge")) + header.Set("Authorization", "Basic "+b64creds) + result = v.Handle(ctx) + assert.NotEqual(resultInvalid, result) + assert.Equal("doge", header.Get("X-AUTH-USER")) v.Close() - wg := &sync.WaitGroup{} - wg.Add(1) - clusterInstance.CloseServer(wg) - wg.Wait() }) } From 6fd6aefe5c68c7ff290e887660706568b29ce58e Mon Sep 17 00:00:00 2001 From: SU Chen Date: Mon, 25 Apr 2022 09:39:16 +0800 Subject: [PATCH 02/25] update mqtt-proxy doc (#593) --- doc/cookbook/mqtt-proxy.md | 156 +++++++++++++++++++++--------- pkg/object/mqttproxy/mqtt_test.go | 6 +- pkg/object/mqttproxy/spec.go | 1 - 3 files changed, 112 insertions(+), 51 deletions(-) diff --git a/doc/cookbook/mqtt-proxy.md b/doc/cookbook/mqtt-proxy.md index b959b5daad..68aa9e1d3f 100644 --- a/doc/cookbook/mqtt-proxy.md +++ b/doc/cookbook/mqtt-proxy.md @@ -3,6 +3,7 @@ - [MQTT Proxy](#mqtt-proxy) - [Background](#background) - [Design](#design) + - [Topic Mapping](#topic-mapping) - [Match different topic mapping policy](#match-different-topic-mapping-policy) - [Detail of single policy](#detail-of-single-policy) - [References](#references) @@ -11,27 +12,28 @@ # Background - MQTT is a standard messaging protocol for IoT (Internet of Things) which is extremely lightweight and used by a wide variety of industries. -- By supporting MQTT Proxy in Easegress, MQTT clients can produce messages to Kafka backend directly. +- By supporting MQTT Proxy in Easegress, MQTT clients can produce messages to backend through publish packet pipeline. - We also provide the HTTP endpoint to allow the backend to send messages to MQTT clients. # Design - `MQTTProxy` is now a `BusinessController` to Easegress. - Use `github.com/eclipse/paho.mqtt.golang/packets` to parse MQTT packet. `paho.mqtt.golang` is a MQTT 3.1.1 go client introduced by Eclipse Foundation (who also introduced the most widely used MQTT broker mosquitto). -- As a MQTT proxy, we now support MQTT clients to `publish` messages to backend Kafka with a powerful topic mapper to map multi-level MQTT topics to Kafka topics with headers (Details in following). +- As a MQTT proxy, we support MQTT clients to `publish` messages to backend through publish packet pipeline. +- Just like `HTTPPipeline`, `Pipeline` in MQTTProxy can use filters to do things like user authentication or topic mapping (map MQTT multi-level topic into single topic and key-value headers). - We also support MQTT clients to `subscribe` topics (wildcard is supported) and send messages back to the MQTT clients through the HTTP endpoint. ``` - publish msg topic mapper -MQTT client ------------> Easegress MQTTProxy ------------> Kafka + publish msg publish pipeline +MQTT client ------------> Easegress MQTTProxy ----------------> Backend like Kafka -all published msg will go to Kafka, will not send to other MQTT clients. +all published msg will go to Backend, will not send to other MQTT clients. subscribe msg -MQTT client <---------------- Easegress MQTT HTTP Endpoint <---- Backend +MQTT client <---------------- Easegress MQTT HTTP Endpoint <---- Backend Server all msg send back to MQTT clients come from HTTP endpoint. ``` -- We assume that IoT devices (use MQTT client) report their status to the backend (through Kafka), and backend process these messages and send instructions back to IoT devices. +- We assume that IoT devices (use MQTT client) report their status to the backend (through tools like Kafka), and backend process these messages and send instructions back to IoT devices. # Example Save following yaml to file `mqttproxy.yaml` and then run @@ -42,33 +44,100 @@ egctl object create -f mqttproxy.yaml kind: MQTTProxy name: mqttproxy port: 1883 # tcp port for mqtt clients to connect -backendType: Kafka -kafkaBroker: - backend: ["123.123.123.123:9092", "234.234.234.234:9092"] useTLS: true certificate: - - name: cert1 - cert: balabala - key: keyForbalabala - - name: cert2 - cert: foo - key: bar -auth: - # username and password for mqtt clients to connect broker (from MQTT protocol) - - userName: test - passBase64: dGVzdA== - - userName: admin - passBase64: YWRtaW4= -topicMapper: - # map MQTT multi-level topic to Kafka topic with headers - # detail described in following - # if topicMapper is None, no map will happen and Kafka topic will be the MQTT topic +- name: cert1 + cert: balabala + key: keyForbalabala +- name: cert2 + cert: foo + key: bar +rules: +- when: + packetType: Connect + pipeline: pipeline-mqtt-auth +- when: + packetType: Publish + pipeline: pipeline-mqtt-publish + +--- + +name: pipeline-mqtt-auth +kind: Pipeline +protocol: MQTT +flow: +- filter: auth +filters: +- name: auth + kind: MQTTClientAuth + salt: salt + auth: + # username and password are both test + - username: test + saltedSha256Pass: 1bc1a361f17092bc7af4b2f82bf9194ea9ee2ca49eb2e53e39f555bc1eeaed74 + +--- + +name: pipeline-mqtt-publish +kind: Pipeline +protocol: MQTT +flow: +- filter: publish-kafka-backend +filters: +- name: publish-kafka-backend + kind: Kafka + backend: ["127.0.0.1:9092"] + topic: + default: kafka-topic +``` +In this example, we use pipeline to process MQTT Connect packet (check username and password) and Publish packet (send to Kafka backend). + +Now, we support following filters for MQTTProxy: +- `TopicMapper`: map MQTT Publish packet multi-level topic into single topic and key-value headers. +- `MQTTClientAuth`: provide username and password checking for MQTT Connect packet. +- `Kafka`: send MQTT Publish message to Kafka backend. + +# Topic Mapping +In MQTT, there are multi-levels in a topic. Topic mapping is used to map MQTT topic to a single topic with headers. For example: +``` +MQTT multi-level topics: +- beijing/car/123/log +- shanghai/tv/234/status +- nanjing/phone/456/error + +with corresponding pattern: +- loc/device/ID/event + +with Topic mapper, may produce Kafka topic: +- topic: iot_device, headers: {loc: beijing, device: car, ID: 123, event: log} +- topic: iot_device, headers: {loc: shanghai, device: tv, ID: 234, event: status} +- topic: iot_device, headers: {loc: nanjing, device: phone, ID: 456, event: error} +``` + +Topic mapping can make processing MQTT messages easier. In Easegress, we use filter `TopicMapper` to do topic mapping. + +Here's a simple example: +```yaml +name: pipeline-mqtt-publish +kind: Pipeline +protocol: MQTT +flow: +- filter: topic-mapper +- filter: publish-kafka-backend +filters: +- name: topic-mapper + kind: TopicMapper + setKV: # setKV set topic and header map into MQTT Context + topic: kafka-topic + headers: kafka-headers + # matchIndex and route will decide which policy we use to do the mapping for MQTT topic matchIndex: 0 route: - - name: gateway + - name: gateway matchExpr: "gate*" - - name: direct + - name: direct matchExpr: "dir*" + # policies define how to create topic and header map by using MQTT publish topic. policies: - name: direct topicIndex: 1 @@ -93,21 +162,16 @@ topicMapper: 1: gatewayID 2: device 3: status -``` -In MQTT, there are multi-levels in a topic. Topic mapping is used to map MQTT topic to Kafka topic with headers. For example: -``` -MQTT multi-level topics: -- beijing/car/123/log -- shanghai/tv/234/status -- nanjing/phone/456/error - -with corresponding pattern: -- loc/device/ID/event - -with Topic mapper, may produce Kafka topic: -- topic: iot_device, headers: {loc: beijing, device: car, ID: 123, event: log} -- topic: iot_device, headers: {loc: shanghai, device: tv, ID: 234, event: status} -- topic: iot_device, headers: {loc: nanjing, device: phone, ID: 456, event: error} +- name: publish-kafka-backend + kind: Kafka + backend: ["my-cluster-kafka-bootstrap.kafka:9092"] + topic: + default: kafka-topic + mqtt: + # since we don't use original topic name in MQTT Publish packet. + # we need keys to get topic and header map from MQTT Context. + topicKey: kafka-topic + headerKey: kafka-headers ``` ## Match different topic mapping policy @@ -156,7 +220,7 @@ pattern1: gateway/gatewayID/device/status -> match policy gateway pattern2: direct/device/status -> match policy direct example1: "gateway/gate123/iphone/log" -Kafka +topic and header map: topic: iot_phone headers: gateway: gateway @@ -165,7 +229,7 @@ Kafka status: log example2: "direct/xiaomi/status" -Kafka +topic and header map: topic: iot_phone headers: direct: direct @@ -173,7 +237,7 @@ Kafka status: status example3: "direct/tv/log" -Kafka +topic and header map: topic: iot_other headers: direct: direct diff --git a/pkg/object/mqttproxy/mqtt_test.go b/pkg/object/mqttproxy/mqtt_test.go index 7ed0973421..536fcbf98e 100644 --- a/pkg/object/mqttproxy/mqtt_test.go +++ b/pkg/object/mqttproxy/mqtt_test.go @@ -486,7 +486,6 @@ func TestSession(t *testing.T) { func TestSpec(t *testing.T) { yamlStr := ` port: 1883 - backendType: Kafka auth: - userName: test passBase64: dGVzdA== @@ -508,9 +507,8 @@ func TestSpec(t *testing.T) { } want := Spec{ - Port: 1883, - BackendType: "Kafka", - UseTLS: true, + Port: 1883, + UseTLS: true, Certificate: []Certificate{ {"cert1", "balabala", "keyForbalabala"}, {"cert2", "foo", "bar"}, diff --git a/pkg/object/mqttproxy/spec.go b/pkg/object/mqttproxy/spec.go index 480dd9c827..c287c24542 100644 --- a/pkg/object/mqttproxy/spec.go +++ b/pkg/object/mqttproxy/spec.go @@ -64,7 +64,6 @@ type ( EGName string `yaml:"-"` Name string `yaml:"-"` Port uint16 `yaml:"port" jsonschema:"required"` - BackendType string `yaml:"backendType" jsonschema:"required"` UseTLS bool `yaml:"useTLS" jsonschema:"omitempty"` Certificate []Certificate `yaml:"certificate" jsonschema:"omitempty"` TopicCacheSize int `yaml:"topicCacheSize" jsonschema:"omitempty"` From 3583c9503938382ae71f7e3643e7890e39668e35 Mon Sep 17 00:00:00 2001 From: jxd Date: Wed, 27 Apr 2022 18:24:01 +0800 Subject: [PATCH 03/25] [typo] fix kernel-tuning document format (#596) Co-authored-by: jxd134 --- doc/reference/kernel-tuning.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/reference/kernel-tuning.md b/doc/reference/kernel-tuning.md index c51521ff8c..75c760f55a 100644 --- a/doc/reference/kernel-tuning.md +++ b/doc/reference/kernel-tuning.md @@ -45,7 +45,7 @@ The values need to be aligned with actual memory, CPU, and network. net.core.somaxconn = 65535 ``` -7. TCP memory tuning. Refer to [Linux Administration](http://www.linux-admins.net/2010/09/linux-tcp-tuning.html) +7. TCP memory tuning. Refer to [Linux Administration](http://www.linux-admins.net/2010/09/linux-tcp-tuning.html) ```conf # Increase the default socket buffer read size (rmem_default) and write size (wmem_default) @@ -70,7 +70,7 @@ The values need to be aligned with actual memory, CPU, and network. net.ipv4.tcp_rmem=4096 87380 16777216 ``` -8. Number of packets to keep in the backlog before the kernel starts dropping them +8. Number of packets to keep in the backlog before the kernel starts dropping them ```conf net.ipv4.tcp_max_syn_backlog = 3240000 ``` @@ -108,11 +108,12 @@ The values need to be aligned with actual memory, CPU, and network. net.ipv4.tcp_fin_timeout = 7 ``` -14. Refer to this [Github post](https://github.com/ton31337/tools/wiki/tcp_slow_start_after_idle---tcp_no_metrics_save-performance) +14. Refer to this [Github post](https://github.com/ton31337/tools/wiki/tcp_slow_start_after_idle---tcp_no_metrics_save-performance) + ```conf # Avoid falling back to slow start after a connection goes idle. net.ipv4.tcp_slow_start_after_idle = 0 - + # Disable caching of TCP congestion state net.ipv4.tcp_no_metrics_save = 1 ``` From cf44f725399c18862471efe9b424f7a944c3a048 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Apr 2022 09:08:13 +0800 Subject: [PATCH 04/25] Bump github.com/lucas-clemente/quic-go from 0.25.0 to 0.26.0 (#563) Bumps [github.com/lucas-clemente/quic-go](https://github.com/lucas-clemente/quic-go) from 0.25.0 to 0.26.0. - [Release notes](https://github.com/lucas-clemente/quic-go/releases) - [Changelog](https://github.com/lucas-clemente/quic-go/blob/master/Changelog.md) - [Commits](https://github.com/lucas-clemente/quic-go/compare/v0.25.0...v0.26.0) --- updated-dependencies: - dependency-name: github.com/lucas-clemente/quic-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 ++++---- go.sum | 17 ++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index f13ff4a417..424d39eb9b 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/libdns/libdns v0.2.1 github.com/libdns/route53 v1.1.2 github.com/libdns/vultr v0.0.0-20211122184636-cd4cb5c12e51 - github.com/lucas-clemente/quic-go v0.25.0 + github.com/lucas-clemente/quic-go v0.26.0 github.com/megaease/easemesh-api v1.3.5 github.com/megaease/grace v1.0.0 github.com/mitchellh/mapstructure v1.4.3 @@ -161,9 +161,9 @@ require ( github.com/magiconair/properties v1.8.5 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/marten-seemann/qpack v0.2.1 // indirect - github.com/marten-seemann/qtls-go1-16 v0.1.4 // indirect - github.com/marten-seemann/qtls-go1-17 v0.1.0 // indirect - github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1 // indirect + github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect + github.com/marten-seemann/qtls-go1-17 v0.1.1 // indirect + github.com/marten-seemann/qtls-go1-18 v0.1.1 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect diff --git a/go.sum b/go.sum index 73ddfbdb66..a48e86d618 100644 --- a/go.sum +++ b/go.sum @@ -921,8 +921,8 @@ github.com/libdns/vultr v0.0.0-20211122184636-cd4cb5c12e51/go.mod h1:HXpNE79BzPq github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/lightstep/tracecontext.go v0.0.0-20181129014701-1757c391b1ac/go.mod h1:Frd2bnT3w5FB5q49ENTfVlztJES+1k/7lyWX2+9gq/M= -github.com/lucas-clemente/quic-go v0.25.0 h1:K+X9Gvd7JXsOHtU0N2icZ2Nw3rx82uBej3mP4CLgibc= -github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg= +github.com/lucas-clemente/quic-go v0.26.0 h1:ALBQXr9UJ8A1LyzvceX4jd9QFsHvlI0RR6BkV16o00A= +github.com/lucas-clemente/quic-go v0.26.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= @@ -942,13 +942,12 @@ github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/marten-seemann/qpack v0.2.1 h1:jvTsT/HpCn2UZJdP+UUB53FfUUgeOyG5K1ns0OJOGVs= github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= -github.com/marten-seemann/qtls-go1-15 v0.1.4/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= -github.com/marten-seemann/qtls-go1-16 v0.1.4 h1:xbHbOGGhrenVtII6Co8akhLEdrawwB2iHl5yhJRpnco= -github.com/marten-seemann/qtls-go1-16 v0.1.4/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= -github.com/marten-seemann/qtls-go1-17 v0.1.0 h1:P9ggrs5xtwiqXv/FHNwntmuLMNq3KaSIG93AtAZ48xk= -github.com/marten-seemann/qtls-go1-17 v0.1.0/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= -github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1 h1:EnzzN9fPUkUck/1CuY1FlzBaIYMoiBsdwTNmNGkwUUM= -github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1/go.mod h1:PUhIQk19LoFt2174H4+an8TYvWOGjb/hHwphBeaDHwI= +github.com/marten-seemann/qtls-go1-16 v0.1.5 h1:o9JrYPPco/Nukd/HpOHMHZoBDXQqoNtUCmny98/1uqQ= +github.com/marten-seemann/qtls-go1-16 v0.1.5/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= +github.com/marten-seemann/qtls-go1-17 v0.1.1 h1:DQjHPq+aOzUeh9/lixAGunn6rIOQyWChPSI4+hgW7jc= +github.com/marten-seemann/qtls-go1-17 v0.1.1/go.mod h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s= +github.com/marten-seemann/qtls-go1-18 v0.1.1 h1:qp7p7XXUFL7fpBvSS1sWD+uSqPvzNQK43DH+/qEkj0Y= +github.com/marten-seemann/qtls-go1-18 v0.1.1/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= From 3bed7862fb9fab3d8d53f484c49bf2f0f1598fff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 11:10:00 +0800 Subject: [PATCH 05/25] Bump github.com/lucas-clemente/quic-go from 0.26.0 to 0.27.0 (#609) Bumps [github.com/lucas-clemente/quic-go](https://github.com/lucas-clemente/quic-go) from 0.26.0 to 0.27.0. - [Release notes](https://github.com/lucas-clemente/quic-go/releases) - [Changelog](https://github.com/lucas-clemente/quic-go/blob/master/Changelog.md) - [Commits](https://github.com/lucas-clemente/quic-go/compare/v0.26.0...v0.27.0) --- updated-dependencies: - dependency-name: github.com/lucas-clemente/quic-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 424d39eb9b..4c6008a413 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/libdns/libdns v0.2.1 github.com/libdns/route53 v1.1.2 github.com/libdns/vultr v0.0.0-20211122184636-cd4cb5c12e51 - github.com/lucas-clemente/quic-go v0.26.0 + github.com/lucas-clemente/quic-go v0.27.0 github.com/megaease/easemesh-api v1.3.5 github.com/megaease/grace v1.0.0 github.com/mitchellh/mapstructure v1.4.3 diff --git a/go.sum b/go.sum index a48e86d618..1b3f30d911 100644 --- a/go.sum +++ b/go.sum @@ -921,8 +921,8 @@ github.com/libdns/vultr v0.0.0-20211122184636-cd4cb5c12e51/go.mod h1:HXpNE79BzPq github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/lightstep/tracecontext.go v0.0.0-20181129014701-1757c391b1ac/go.mod h1:Frd2bnT3w5FB5q49ENTfVlztJES+1k/7lyWX2+9gq/M= -github.com/lucas-clemente/quic-go v0.26.0 h1:ALBQXr9UJ8A1LyzvceX4jd9QFsHvlI0RR6BkV16o00A= -github.com/lucas-clemente/quic-go v0.26.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= +github.com/lucas-clemente/quic-go v0.27.0 h1:v6WY87q9zD4dKASbG8hy/LpzAVNzEQzw8sEIeloJsc4= +github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= From 9d18752b28254597438b4bf9081b5f780a6943c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 11:10:24 +0800 Subject: [PATCH 06/25] Bump actions/setup-go from 2 to 3 (#605) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/code.analysis.yml | 2 +- .github/workflows/release.yml | 8 ++++---- .github/workflows/test.yml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/code.analysis.yml b/.github/workflows/code.analysis.yml index 1ec725abae..726f400fa6 100644 --- a/.github/workflows/code.analysis.yml +++ b/.github/workflows/code.analysis.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ce700c6b4..9a9eee5631 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: os: [ubuntu-latest, macos-latest] steps: - name: Set up Go 1.x.y - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -37,7 +37,7 @@ jobs: fail-fast: false steps: - name: Set up Go 1.x.y - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -56,7 +56,7 @@ jobs: fail-fast: false steps: - name: Set up Go 1.x.y - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -73,7 +73,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} - uses: docker/login-action@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d87e6bae32..25e56e1410 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: os: [ubuntu-latest, macos-latest] steps: - name: Set up Go 1.x.y - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -55,7 +55,7 @@ jobs: fail-fast: false steps: - name: Set up Go 1.x.y - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -74,7 +74,7 @@ jobs: fail-fast: false steps: - name: Set up Go 1.x.y - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} From da6cf0fcbc0289a932cdbccc27ed06d86f0798ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 11:10:40 +0800 Subject: [PATCH 07/25] Bump codecov/codecov-action from 2.1.0 to 3.1.0 (#604) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.1.0 to 3.1.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2.1.0...v3.1.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25e56e1410..2ad9368d3b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: make test TEST_FLAGS="-race -coverprofile=coverage.txt -covermode=atomic" - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2.1.0 + uses: codecov/codecov-action@v3.1.0 with: file: ./coverage.txt test-win: From 67ad1c6df1ec4203b1da98d83f164daab8197742 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 11:10:54 +0800 Subject: [PATCH 08/25] Bump morphy2k/revive-action from 2.3.0 to 2.3.1 (#603) Bumps [morphy2k/revive-action](https://github.com/morphy2k/revive-action) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/morphy2k/revive-action/releases) - [Commits](https://github.com/morphy2k/revive-action/compare/v2.3.0...v2.3.1) --- updated-dependencies: - dependency-name: morphy2k/revive-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/code.analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code.analysis.yml b/.github/workflows/code.analysis.yml index 726f400fa6..bca470f1e3 100644 --- a/.github/workflows/code.analysis.yml +++ b/.github/workflows/code.analysis.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@v3 - name: Revive Action - uses: morphy2k/revive-action@v2.3.0 + uses: morphy2k/revive-action@v2.3.1 - name: Check formatting run: test -z $(gofmt -l .) || (gofmt -l . && exit 1) From 252cb34c9909ccef5e2a619749188a590d13cece Mon Sep 17 00:00:00 2001 From: aniaan Date: Thu, 5 May 2022 11:17:38 +0800 Subject: [PATCH 09/25] feat(etcd): support external standalone etcd (#595) * feat(etcd): init * fix(statuscontroller): remove log * fix(option): add comment * fix(chart): fix typo * style(option): revert break line --- .../easegress/templates/ConfigMap.yaml | 7 +++++ helm-charts/easegress/templates/Service.yaml | 3 +++ .../easegress/templates/StatefulSet.yaml | 11 +++++--- helm-charts/easegress/values.yaml | 4 +++ pkg/cluster/cluster.go | 27 ++++++++++--------- pkg/option/option.go | 7 +++++ 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/helm-charts/easegress/templates/ConfigMap.yaml b/helm-charts/easegress/templates/ConfigMap.yaml index 233a789c77..0b006549b2 100644 --- a/helm-charts/easegress/templates/ConfigMap.yaml +++ b/helm-charts/easegress/templates/ConfigMap.yaml @@ -24,9 +24,16 @@ data: eg-secondary.yaml: | cluster-name: easegress cluster-role: secondary + use-standalone-etcd: {{ .Values.cluster.useStandaloneEtcd }} cluster: primary-listen-peer-urls: + {{ if .Values.cluster.useStandaloneEtcd }} + {{- range $i, $endpoint := .Values.cluster.standaloneEtcdEndpoints }} + - {{ $endpoint }} + {{ end }} + {{ else }} - http://{{ .Release.Name }}-0.easegress-hs.{{ .Release.Namespace }}:2380 + {{ end }} api-addr: 0.0.0.0:2381 data-dir: /opt/easegress/data wal-dir: "" diff --git a/helm-charts/easegress/templates/Service.yaml b/helm-charts/easegress/templates/Service.yaml index 28a45a7af7..cfcaa37469 100644 --- a/helm-charts/easegress/templates/Service.yaml +++ b/helm-charts/easegress/templates/Service.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.cluster.useStandaloneEtcd }} apiVersion: v1 kind: Service metadata: @@ -24,6 +25,8 @@ spec: --- +{{- end }} + apiVersion: v1 kind: Service metadata: diff --git a/helm-charts/easegress/templates/StatefulSet.yaml b/helm-charts/easegress/templates/StatefulSet.yaml index 5ebb485541..0ff5657576 100644 --- a/helm-charts/easegress/templates/StatefulSet.yaml +++ b/helm-charts/easegress/templates/StatefulSet.yaml @@ -1,8 +1,9 @@ -{{- if eq .Values.cluster.volumeType "emptyDir" }} - {{- if ne (int .Values.cluster.primaryReplicas) 1 }} - {{- fail "When .Values.cluster.volumeType is 'emptyDir', .Values.cluster.primaryReplicas should be 1" }} +{{- if not .Values.cluster.useStandaloneEtcd }} + {{- if eq .Values.cluster.volumeType "emptyDir" }} + {{- if ne (int .Values.cluster.primaryReplicas) 1 }} + {{- fail "When .Values.cluster.volumeType is 'emptyDir', .Values.cluster.primaryReplicas should be 1" }} + {{- end }} {{- end }} -{{- end }} apiVersion: apps/v1 kind: StatefulSet metadata: @@ -96,3 +97,5 @@ spec: storageClassName: easegress-storage volumeMode: Filesystem {{- end }} + +{{- end }} \ No newline at end of file diff --git a/helm-charts/easegress/values.yaml b/helm-charts/easegress/values.yaml index c68428e1eb..7bdb4f4a4a 100644 --- a/helm-charts/easegress/values.yaml +++ b/helm-charts/easegress/values.yaml @@ -25,6 +25,10 @@ cluster: secondaryReplicas: 0 + useStandaloneEtcd: false + standaloneEtcdEndpoints: + # - endpoint-1 + # log path inside container log: path: /opt/easegress/log diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 1b0e197546..53ad962a6d 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -368,17 +368,23 @@ func (c *cluster) checkClusterName() error { return fmt.Errorf("failed to check cluster name: %v", err) } - if value == nil { + if value != nil { + if c.opt.ClusterName != *value { + err := fmt.Errorf("cluster names mismatch, local(%s) != existed(%s)", + c.opt.ClusterName, *value) + logger.Errorf("%v", err) + panic(err) + } + } else if c.opt.UseStandaloneEtcd { + err := c.Put(c.Layout().ClusterNameKey(), c.opt.ClusterName) + if err != nil { + return fmt.Errorf("register cluster name %s failed: %v", + c.opt.ClusterName, err) + } + } else { return fmt.Errorf("key %s not found", c.Layout().ClusterNameKey()) } - if c.opt.ClusterName != *value { - err := fmt.Errorf("cluster names mismatch, local(%s) != existed(%s)", - c.opt.ClusterName, *value) - logger.Errorf("%v", err) - panic(err) - } - return nil } @@ -532,7 +538,6 @@ func (c *cluster) initLease() error { } return c.grantNewLease() - } func (c *cluster) grantNewLease() error { @@ -675,9 +680,7 @@ func (c *cluster) startServer() (done, timeout chan struct{}, err error) { close(done) return done, timeout, nil } - var ( - etcdConfig *embed.Config - ) + var etcdConfig *embed.Config if c.opt.UseInitialCluster() { etcdConfig, err = CreateStaticClusterEtcdConfig(c.opt) } else { diff --git a/pkg/option/option.go b/pkg/option/option.go index fef6ec457a..fe1731344d 100644 --- a/pkg/option/option.go +++ b/pkg/option/option.go @@ -74,6 +74,7 @@ type Options struct { InitialObjectConfigFiles []string `yaml:"initial-object-config-files"` // cluster options + UseStandaloneEtcd bool `yaml:"use-standalone-etcd"` ClusterName string `yaml:"cluster-name"` ClusterRole string `yaml:"cluster-role"` ClusterRequestTimeout string `yaml:"cluster-request-timeout"` @@ -150,6 +151,7 @@ func New() *Options { opt.flags.BoolVar(&opt.SignalUpgrade, "signal-upgrade", false, "Send an upgrade signal to the server based on the local pid file, then exit. The original server will start a graceful upgrade after signal received.") opt.flags.StringVar(&opt.Name, "name", "eg-default-name", "Human-readable name for this member.") opt.flags.StringToStringVar(&opt.Labels, "labels", nil, "The labels for the instance of Easegress.") + opt.flags.BoolVar(&opt.UseStandaloneEtcd, "use-standalone-etcd", false, "Use standalone etcd instead of embedded .") addClusterVars(opt) opt.flags.StringVar(&opt.APIAddr, "api-addr", "localhost:2381", "Address([host]:port) to listen on for administration traffic.") opt.flags.BoolVar(&opt.Debug, "debug", false, "Flag to set lowest log level from INFO downgrade DEBUG.") @@ -245,6 +247,11 @@ func (opt *Options) Parse() (string, error) { } opt.renameLegacyClusterRoles() + + if opt.UseStandaloneEtcd { + opt.ClusterRole = "secondary" // when using external standalone etcd, the cluster role cannot be "primary" + } + err = opt.validate() if err != nil { return "", err From 2845b76a30b14222b654bd40a8763d3d7024fffd Mon Sep 17 00:00:00 2001 From: sodaRyCN <35725024+sodaRyCN@users.noreply.github.com> Date: Fri, 6 May 2022 15:16:07 +0800 Subject: [PATCH 10/25] sync.Pool should be passed by reference (#614) --- pkg/filter/proxy/pool.go | 20 ++++++++++---------- pkg/filter/proxy/request.go | 6 +++--- pkg/filter/proxy/request_test.go | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkg/filter/proxy/pool.go b/pkg/filter/proxy/pool.go index fdfa444e1d..190077248b 100644 --- a/pkg/filter/proxy/pool.go +++ b/pkg/filter/proxy/pool.go @@ -127,13 +127,13 @@ func (p *pool) status() *PoolStatus { return s } -var requestPool = sync.Pool{ +var requestPool = &sync.Pool{ New: func() interface{} { return &request{} }, } -var httpstatResultPool = sync.Pool{ +var httpStatResultPool = &sync.Pool{ New: func() interface{} { return &gohttpstat.Result{} }, @@ -170,7 +170,7 @@ func (p *pool) handle(ctx context.HTTPContext, reqBody io.Reader, client *Client } addLazyTag("addr", server.URL, -1) - req, err := p.prepareRequest(ctx, server, reqBody, requestPool, httpstatResultPool) + req, err := p.prepareRequest(ctx, server, reqBody, requestPool, httpStatResultPool) if err != nil { msg := stringtool.Cat("prepare request failed: ", err.Error()) logger.Errorf("BUG: %s", msg) @@ -226,9 +226,9 @@ func (p *pool) prepareRequest( ctx context.HTTPContext, server *Server, reqBody io.Reader, - requestPool sync.Pool, - httpstatResultPool sync.Pool) (req *request, err error) { - return p.newRequest(ctx, server, reqBody, requestPool, httpstatResultPool) + requestPool *sync.Pool, + httpStatResultPool *sync.Pool) (req *request, err error) { + return p.newRequest(ctx, server, reqBody, requestPool, httpStatResultPool) } func (p *pool) doRequest(ctx context.HTTPContext, req *request, client *Client) (*http.Response, error) { @@ -246,7 +246,7 @@ func (p *pool) doRequest(ctx context.HTTPContext, req *request, client *Client) return resp, nil } -var httpstatMetricPool = sync.Pool{ +var httpStatMetricPool = &sync.Pool{ New: func() interface{} { return &httpstat.Metric{} }, @@ -276,7 +276,7 @@ func (p *pool) statRequestResponse(ctx context.HTTPContext, return stringtool.Cat(p.tagPrefix, "#duration: ", duration.String()) }) // use recycled object - metric := httpstatMetricPool.Get().(*httpstat.Metric) + metric := httpStatMetricPool.Get().(*httpstat.Metric) metric.StatusCode = resp.StatusCode metric.Duration = duration metric.ReqSize = ctx.Request().Size() @@ -287,8 +287,8 @@ func (p *pool) statRequestResponse(ctx context.HTTPContext, } p.httpStat.Stat(metric) // recycle struct instances - httpstatMetricPool.Put(metric) - httpstatResultPool.Put(req.statResult) + httpStatMetricPool.Put(metric) + httpStatResultPool.Put(req.statResult) requestPool.Put(req) }) diff --git a/pkg/filter/proxy/request.go b/pkg/filter/proxy/request.go index 24e135481b..bbf25c9459 100644 --- a/pkg/filter/proxy/request.go +++ b/pkg/filter/proxy/request.go @@ -51,9 +51,9 @@ func (p *pool) newRequest( ctx context.HTTPContext, server *Server, reqBody io.Reader, - requestPool sync.Pool, - httpstatResultPool sync.Pool) (*request, error) { - statResult := httpstatResultPool.Get().(*httpstat.Result) + requestPool *sync.Pool, + httpStatResultPool *sync.Pool) (*request, error) { + statResult := httpStatResultPool.Get().(*httpstat.Result) req := requestPool.Get().(*request) req.createTime = fasttime.Now() req.server = server diff --git a/pkg/filter/proxy/request_test.go b/pkg/filter/proxy/request_test.go index d2623e6cb0..f1e398d8b0 100644 --- a/pkg/filter/proxy/request_test.go +++ b/pkg/filter/proxy/request_test.go @@ -57,7 +57,7 @@ func TestRequest(t *testing.T) { p := pool{} sr := strings.NewReader("this is the raw body") - req, _ := p.newRequest(ctx, &server, sr, requestPool, httpstatResultPool) + req, _ := p.newRequest(ctx, &server, sr, requestPool, httpStatResultPool) defer requestPool.Put(req) // recycle request req.start() @@ -83,7 +83,7 @@ func TestRequest(t *testing.T) { ctx.MockedRequest.MockedMethod = func() string { return "ééé" // not tokenable, should fail } - req, err := p.newRequest(ctx, &server, nil, requestPool, httpstatResultPool) + req, err := p.newRequest(ctx, &server, nil, requestPool, httpStatResultPool) assert.Nil(req) assert.NotNil(err) } @@ -102,7 +102,7 @@ func TestResultState(t *testing.T) { } func TestRequestStatus(t *testing.T) { - statResult := httpstatResultPool.Get().(*httpstat.Result) + statResult := httpStatResultPool.Get().(*httpstat.Result) req := requestPool.Get().(*request) req.createTime = fasttime.Now() req._startTime = time.Time{} @@ -129,7 +129,7 @@ func TestRequestStatus(t *testing.T) { t.Error("endtime should be _endtime after finish()") } - httpstatResultPool.Put(req.statResult) + httpStatResultPool.Put(req.statResult) requestPool.Put(req) } @@ -153,7 +153,7 @@ func TestAddB3PropagationHeaders(t *testing.T) { p := pool{} sr := strings.NewReader("this is the raw body") - req, _ := p.newRequest(ctx, &server, sr, requestPool, httpstatResultPool) + req, _ := p.newRequest(ctx, &server, sr, requestPool, httpStatResultPool) defer requestPool.Put(req) // recycle request header := req.std.Header From 0e762fffb2fa1026b40623021e57d580de12bbb1 Mon Sep 17 00:00:00 2001 From: Yun Long Date: Tue, 10 May 2022 09:53:03 +0800 Subject: [PATCH 11/25] Support Easegress ingress rewrite target (#617) --- pkg/object/ingresscontroller/translator.go | 3 +++ .../meshcontroller/ingresscontroller/ingresscontroller.go | 1 + 2 files changed, 4 insertions(+) diff --git a/pkg/object/ingresscontroller/translator.go b/pkg/object/ingresscontroller/translator.go index 1ba914665e..fca6bfbe18 100644 --- a/pkg/object/ingresscontroller/translator.go +++ b/pkg/object/ingresscontroller/translator.go @@ -335,6 +335,9 @@ func (st *specTranslator) translateIngressRules(b *httpServerSpecBuilder, ingres } else { p.PathPrefix = path.Path } + + p.RewriteTarget = ingress.Annotations["easegress.ingress.kubernetes.io/rewrite-target"] + r.Paths = append(r.Paths, &p) } diff --git a/pkg/object/meshcontroller/ingresscontroller/ingresscontroller.go b/pkg/object/meshcontroller/ingresscontroller/ingresscontroller.go index e7eec7fe78..3215e364eb 100644 --- a/pkg/object/meshcontroller/ingresscontroller/ingresscontroller.go +++ b/pkg/object/meshcontroller/ingresscontroller/ingresscontroller.go @@ -162,6 +162,7 @@ func (ic *IngressController) handleCert(event informer.Event, cert *spec.Certifi ic.reloadTraffic() return } + func (ic *IngressController) handleServices(services map[string]*spec.Service) (continueWatch bool) { continueWatch = true From dd6d2f062b0d31fdb97262ae422aec12d28f7a74 Mon Sep 17 00:00:00 2001 From: sodaRyCN <35725024+sodaRyCN@users.noreply.github.com> Date: Tue, 10 May 2022 09:53:59 +0800 Subject: [PATCH 12/25] The spec of the httpserver supports the AND-OR strategy of the header's match (#613) --- pkg/object/httpserver/httpserver_test.go | 62 ++++++++++++++++++++++++ pkg/object/httpserver/mux.go | 23 +++++++-- pkg/object/httpserver/spec.go | 17 ++++--- 3 files changed, 90 insertions(+), 12 deletions(-) diff --git a/pkg/object/httpserver/httpserver_test.go b/pkg/object/httpserver/httpserver_test.go index 125df62114..878eeeb607 100644 --- a/pkg/object/httpserver/httpserver_test.go +++ b/pkg/object/httpserver/httpserver_test.go @@ -71,6 +71,14 @@ func TestSearchPath(t *testing.T) { emptyHeaders := make(map[string]string) jsonHeader := make(map[string]string) jsonHeader["content-type"] = "application/json" + + moreHeader := make(map[string]string) + moreHeader["content-type"] = "application/json" + moreHeader["accept-encoding"] = "gzip" + + allMatchHeader := make(map[string]string) + allMatchHeader["content-type"] = "application/json" + allMatchHeader["accept-language"] = "zh-CN" tests := []testCase{ { "/path/1", http.MethodGet, emptyHeaders, "", []*muxRule{ @@ -172,6 +180,60 @@ func TestSearchPath(t *testing.T) { }), }, FoundSkipCache, }, + { + "/matchallheader", http.MethodGet, moreHeader, "", []*muxRule{ + newMuxRule(&ipfilter.IPFilters{}, &Rule{}, []*MuxPath{ + newMuxPath(&ipfilter.IPFilters{}, &Path{ + Path: "/matchallheader", Methods: []string{http.MethodGet}, + Headers: []*Header{{Key: "content-type", Values: []string{"application/json"}}}, + }), + }), + }, FoundSkipCache, + }, + //todo: When the pipeline refactoring is complete, the expected results `MethodNotAllowed` need to be adapted + { + "/matchallheader", http.MethodGet, jsonHeader, "", []*muxRule{ + newMuxRule(&ipfilter.IPFilters{}, &Rule{}, []*MuxPath{ + newMuxPath(&ipfilter.IPFilters{}, &Path{ + Path: "/matchallheader", Methods: []string{http.MethodGet}, + Headers: []*Header{ + {Key: "content-type", Values: []string{"application/json"}}, + {Key: "accept-language", Values: []string{"zh-CN"}}, + }, + + MatchAllHeader: true, + }), + }), + }, MethodNotAllowed, + }, + { + "/matchallheader", http.MethodGet, moreHeader, "", []*muxRule{ + newMuxRule(&ipfilter.IPFilters{}, &Rule{}, []*MuxPath{ + newMuxPath(&ipfilter.IPFilters{}, &Path{ + Path: "/matchallheader", Methods: []string{http.MethodGet}, + Headers: []*Header{ + {Key: "content-type", Values: []string{"application/json"}}, + {Key: "accept-language", Values: []string{"zh-CN"}}, + }, + MatchAllHeader: true, + }), + }), + }, MethodNotAllowed, + }, + { + "/matchallheader", http.MethodGet, allMatchHeader, "", []*muxRule{ + newMuxRule(&ipfilter.IPFilters{}, &Rule{}, []*MuxPath{ + newMuxPath(&ipfilter.IPFilters{}, &Path{ + Path: "/matchallheader", Methods: []string{http.MethodGet}, + Headers: []*Header{ + {Key: "content-type", Values: []string{"application/json"}}, + {Key: "accept-language", Values: []string{"zh-CN"}}, + }, + MatchAllHeader: true, + }), + }), + }, FoundSkipCache, + }, } for i := 0; i < len(tests); i++ { diff --git a/pkg/object/httpserver/mux.go b/pkg/object/httpserver/mux.go index 0e5bc2add8..5b1ef190f3 100644 --- a/pkg/object/httpserver/mux.go +++ b/pkg/object/httpserver/mux.go @@ -86,6 +86,7 @@ type ( rewriteTarget string backend string headers []*Header + mathAllHeader bool } // SearchResult is returned by SearchPath @@ -230,6 +231,7 @@ func newMuxPath(parentIPFilters *ipfilter.IPFilters, path *Path) *MuxPath { methods: path.Methods, backend: path.Backend, headers: path.Headers, + mathAllHeader: path.MatchAllHeader, } } @@ -299,18 +301,31 @@ func (mp *MuxPath) hasHeaders() bool { } func (mp *MuxPath) matchHeaders(ctx context.HTTPContext) bool { + var result bool for _, h := range mp.headers { + result = false v := ctx.Request().Header().Get(h.Key) if stringtool.StrInSlice(v, h.Values) { - return true + result = true + } + if !mp.mathAllHeader && result { + break + } + if mp.mathAllHeader && result { + continue } - if h.Regexp != "" && h.headerRE.MatchString(v) { - return true + result = true + } + if !mp.mathAllHeader && result { + break + } + if mp.mathAllHeader && !result { + break } } - return false + return result } func newMux(httpStat *httpstat.HTTPStat, topN *topn.TopN, mapper protocol.MuxMapper) *mux { diff --git a/pkg/object/httpserver/spec.go b/pkg/object/httpserver/spec.go index 149a19d09d..ac47b47b55 100644 --- a/pkg/object/httpserver/spec.go +++ b/pkg/object/httpserver/spec.go @@ -78,14 +78,15 @@ type ( // Path is second level entry of router. Path struct { - IPFilter *ipfilter.Spec `yaml:"ipFilter,omitempty" jsonschema:"omitempty"` - Path string `yaml:"path,omitempty" jsonschema:"omitempty,pattern=^/"` - PathPrefix string `yaml:"pathPrefix,omitempty" jsonschema:"omitempty,pattern=^/"` - PathRegexp string `yaml:"pathRegexp,omitempty" jsonschema:"omitempty,format=regexp"` - RewriteTarget string `yaml:"rewriteTarget" jsonschema:"omitempty"` - Methods []string `yaml:"methods,omitempty" jsonschema:"omitempty,uniqueItems=true,format=httpmethod-array"` - Backend string `yaml:"backend" jsonschema:"required"` - Headers []*Header `yaml:"headers" jsonschema:"omitempty"` + IPFilter *ipfilter.Spec `yaml:"ipFilter,omitempty" jsonschema:"omitempty"` + Path string `yaml:"path,omitempty" jsonschema:"omitempty,pattern=^/"` + PathPrefix string `yaml:"pathPrefix,omitempty" jsonschema:"omitempty,pattern=^/"` + PathRegexp string `yaml:"pathRegexp,omitempty" jsonschema:"omitempty,format=regexp"` + RewriteTarget string `yaml:"rewriteTarget" jsonschema:"omitempty"` + Methods []string `yaml:"methods,omitempty" jsonschema:"omitempty,uniqueItems=true,format=httpmethod-array"` + Backend string `yaml:"backend" jsonschema:"required"` + Headers []*Header `yaml:"headers" jsonschema:"omitempty"` + MatchAllHeader bool `yaml:"MatchAllHeader" jsonschema:"omitempty"` } // Header is the third level entry of router. A header entry is always under a specific path entry, that is to mean From 26506a3bae0f6322cef413e9cca57655725b4373 Mon Sep 17 00:00:00 2001 From: SU Chen Date: Tue, 10 May 2022 11:26:34 +0800 Subject: [PATCH 13/25] v1.5.2 update (#618) * v1.5.2 update * v1.5.2 update * v1.5.2 fix typo --- CHANGELOG.md | 24 ++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1919b07a1b..2e2b11c948 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog + +## [v1.5.2](https://github.com/megaease/easegress/tree/v1.5.2) (2022-04-06) + +[Full Changelog](https://github.com/megaease/easegress/compare/v1.5.1...v1.5.2) + +**Significant changes:** + +- Support external standalone etcd [\#595](https://github.com/megaease/easegress/pull/595) + +**Implemented enhancements:** + +- Support Easegress ingress rewrite target [\#617](https://github.com/megaease/easegress/pull/617) +- Support the AND-OR header strategy in HTTPServer [\#613](https://github.com/megaease/easegress/pull/613) +- Support proxy to send zipkin b3 headers [\#579](https://github.com/megaease/easegress/pull/579) + +**Fixed bugs:** +- Fix proxy pool bug [\#614](https://github.com/megaease/easegress/pull/614) +- Fix FaasController request host field [\#586](https://github.com/megaease/easegress/pull/586) +- Fix Easemonitor metrics status convert error [\#583](https://github.com/megaease/easegress/pull/583) +- Fix Status sync controller pointer error [\#582](https://github.com/megaease/easegress/pull/582) +- Fix HTTPPipeline creation fail [\#577](https://github.com/megaease/easegress/pull/577) + + + ## [v1.5.1](https://github.com/megaease/easegress/tree/v1.5.1) (2022-04-06) [Full Changelog](https://github.com/megaease/easegress/compare/v1.5.0...v1.5.1) diff --git a/Makefile b/Makefile index 993f2b5280..1dcd24b239 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ HTTPSERVER_TEST_PATH := build/test IMAGE_NAME?=megaease/easegress # Version -RELEASE?=v1.5.1 +RELEASE?=v1.5.2 # Git Related GIT_REPO_INFO=$(shell cd ${MKFILE_DIR} && git config --get remote.origin.url) From 9db3abbd4958aa97fb7fa295cd2137a7d8d46080 Mon Sep 17 00:00:00 2001 From: SU Chen Date: Tue, 17 May 2022 16:14:41 +0800 Subject: [PATCH 14/25] udpate topicmapper policy route from map to array to eliminate random order (#622) --- pkg/filter/topicmapper/topic.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pkg/filter/topicmapper/topic.go b/pkg/filter/topicmapper/topic.go index 795e61c2b8..6e84b8d51c 100644 --- a/pkg/filter/topicmapper/topic.go +++ b/pkg/filter/topicmapper/topic.go @@ -27,17 +27,22 @@ import ( type topicMapFunc func(mqttTopic string) (topic string, headers map[string]string, err error) -func getPolicyRoute(routes []*PolicyRe) map[string]*regexp.Regexp { - ans := make(map[string]*regexp.Regexp) +type policyRe struct { + name string + re *regexp.Regexp +} + +func getPolicyRoute(routes []*PolicyRe) []*policyRe { + res := make([]*policyRe, 0, len(routes)) for _, route := range routes { r, err := regexp.Compile(route.MatchExpr) if err != nil { logger.SpanErrorf(nil, "topicMapper policy <%s> match expr <%s> compile failed: %v", route.Name, route.MatchExpr, err) } else { - ans[route.Name] = r + res = append(res, &policyRe{name: route.Name, re: r}) } } - return ans + return res } type topicRouteType map[string][]*regexp.Regexp @@ -77,9 +82,9 @@ func getTopicMapFunc(topicMapper *Spec) topicMapFunc { } getPolicy := func(level string) *Policy { - for name, r := range policyRoute { - if r.MatchString(level) { - return policyMap[name] + for _, route := range policyRoute { + if route.re.MatchString(level) { + return policyMap[route.name] } } return nil From 2aa4404a0df7dfb921df2d72c401bf09cc8eb22f Mon Sep 17 00:00:00 2001 From: sodaRyCN <35725024+sodaRyCN@users.noreply.github.com> Date: Mon, 6 Jun 2022 09:39:51 +0800 Subject: [PATCH 15/25] sidecar httpserver keepalive config by spec (#626) * sidecar httpserver keepalive config by spec * adjust variable names --- pkg/object/meshcontroller/spec/spec.go | 44 +++++++++++++++++---- pkg/object/meshcontroller/spec/spec_test.go | 8 ++-- pkg/object/meshcontroller/worker/egress.go | 4 +- pkg/object/meshcontroller/worker/ingress.go | 10 ++--- 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/pkg/object/meshcontroller/spec/spec.go b/pkg/object/meshcontroller/spec/spec.go index ecb7957530..b5404ec9af 100644 --- a/pkg/object/meshcontroller/spec/spec.go +++ b/pkg/object/meshcontroller/spec/spec.go @@ -92,6 +92,8 @@ const ( // ServiceCanaryHeaderKey is the http header key of service canary. ServiceCanaryHeaderKey = "X-Mesh-Service-Canary" + + defaultKeepAliveTimeout = "60s" ) var ( @@ -135,6 +137,25 @@ type ( Log4jConfigName string `yaml:"log4jConfigName" jsonschema:"omitempty"` MonitorMTLS *MonitorMTLS `yaml:"monitorMTLS" jsonschema:"omitempty"` + WorkerSpec *WorkerSpec `yaml:"workerSpec" jsonschema:"omitempty"` + } + + // WorkerSpec is the spec of worker + WorkerSpec struct { + Ingress IngressServerSpec `yaml:"ingress" jsonschema:"omitempty"` + Egress EgressServerSpec `yaml:"egress" jsonschema:"omitempty"` + } + + // IngressServerSpec is the spec of ingress httpserver in worker + IngressServerSpec struct { + KeepAlive bool `yaml:"keepAlive" jsonschema:"omitempty"` + KeepAliveTimeout string `yaml:"keepAliveTimeout" jsonschema:"omitempty,format=duration"` + } + + // EgressServerSpec is the spec of egress httpserver in worker + EgressServerSpec struct { + KeepAlive bool `yaml:"keepAlive" jsonschema:"omitempty"` + KeepAliveTimeout string `yaml:"keepAliveTimeout" jsonschema:"omitempty,format=duration"` } // MonitorMTLS is the spec of mTLS specification of monitor. @@ -893,12 +914,13 @@ func (s *Service) IngressControllerPipelineSpec(instanceSpecs []*ServiceInstance } // SidecarIngressHTTPServerSpec generates a spec for sidecar ingress HTTP server -func (s *Service) SidecarIngressHTTPServerSpec(cert, rootCert *Certificate) (*supervisor.Spec, error) { +func (s *Service) SidecarIngressHTTPServerSpec(keepalive bool, timeout string, cert, rootCert *Certificate) (*supervisor.Spec, error) { ingressHTTPServerFormat := ` kind: HTTPServer name: %s port: %d -keepAlive: false +keepAlive: %v +keepAliveTimeout: %s https: %s certBase64: %s keyBase64: %s @@ -917,8 +939,11 @@ rules: rootCertBaser64 = rootCert.CertBase64 needHTTPS = "true" } + if timeout == "" { + timeout = defaultKeepAliveTimeout + } yamlConfig := fmt.Sprintf(ingressHTTPServerFormat, name, - s.Sidecar.IngressPort, needHTTPS, certBase64, keyBase64, rootCertBaser64, pipelineName) + s.Sidecar.IngressPort, keepalive, timeout, needHTTPS, certBase64, keyBase64, rootCertBaser64, pipelineName) superSpec, err := supervisor.NewSpec(yamlConfig) if err != nil { @@ -991,18 +1016,23 @@ func (s *Service) BackendName() string { } // SidecarEgressHTTPServerSpec returns a spec for egress HTTP server -func (s *Service) SidecarEgressHTTPServerSpec() (*supervisor.Spec, error) { +func (s *Service) SidecarEgressHTTPServerSpec(keepalive bool, timeout string) (*supervisor.Spec, error) { egressHTTPServerFormat := ` kind: HTTPServer name: %s port: %d -keepAlive: false +keepAlive: %v +keepAliveTimeout: %s https: false ` - + if timeout == "" { + timeout = defaultKeepAliveTimeout + } yamlConfig := fmt.Sprintf(egressHTTPServerFormat, s.EgressHTTPServerName(), - s.Sidecar.EgressPort) + s.Sidecar.EgressPort, + keepalive, + timeout) superSpec, err := supervisor.NewSpec(yamlConfig) if err != nil { diff --git a/pkg/object/meshcontroller/spec/spec_test.go b/pkg/object/meshcontroller/spec/spec_test.go index f55bf2cc29..95f0d711fc 100644 --- a/pkg/object/meshcontroller/spec/spec_test.go +++ b/pkg/object/meshcontroller/spec/spec_test.go @@ -1045,14 +1045,14 @@ func TestSidecarIngressPipelineSpecCert(t *testing.T) { SignTime: "2021-10-13 12:33:10", } - superSpec, err := s.SidecarIngressHTTPServerSpec(cert, rootCert) + superSpec, err := s.SidecarIngressHTTPServerSpec(false, defaultKeepAliveTimeout, cert, rootCert) if err != nil { t.Fatalf("ingress http server spec failed: %v", err) } fmt.Println(superSpec.YAMLConfig()) - superSpec, err = s.SidecarEgressHTTPServerSpec() + superSpec, err = s.SidecarEgressHTTPServerSpec(true, defaultKeepAliveTimeout) if err != nil { t.Fatalf("egress http server spec failed: %v", err) @@ -1075,14 +1075,14 @@ func TestSidecarIngressPipelineSpec(t *testing.T) { }, } - superSpec, err := s.SidecarIngressHTTPServerSpec(nil, nil) + superSpec, err := s.SidecarIngressHTTPServerSpec(true, "", nil, nil) if err != nil { t.Fatalf("ingress http server spec failed: %v", err) } fmt.Println(superSpec.YAMLConfig()) - superSpec, err = s.SidecarEgressHTTPServerSpec() + superSpec, err = s.SidecarEgressHTTPServerSpec(false, "") if err != nil { t.Fatalf("egress http server spec failed: %v", err) diff --git a/pkg/object/meshcontroller/worker/egress.go b/pkg/object/meshcontroller/worker/egress.go index ae3996810d..6f246d1677 100644 --- a/pkg/object/meshcontroller/worker/egress.go +++ b/pkg/object/meshcontroller/worker/egress.go @@ -122,7 +122,8 @@ func (egs *EgressServer) InitEgress(service *spec.Service) error { } egs.egressServerName = service.EgressHTTPServerName() - superSpec, err := service.SidecarEgressHTTPServerSpec() + admSpec := egs.superSpec.ObjectSpec().(*spec.Admin) + superSpec, err := service.SidecarEgressHTTPServerSpec(admSpec.WorkerSpec.Egress.KeepAlive, admSpec.WorkerSpec.Egress.KeepAliveTimeout) if err != nil { return err } @@ -148,7 +149,6 @@ func (egs *EgressServer) InitEgress(service *spec.Service) error { } } - admSpec := egs.superSpec.ObjectSpec().(*spec.Admin) if admSpec.EnablemTLS() { logger.Infof("egress in mtls mode, start listen ID: %s's cert", egs.instanceID) if err := egs.inf.OnServerCert(egs.serviceName, egs.instanceID, egs.reloadByCert); err != nil { diff --git a/pkg/object/meshcontroller/worker/ingress.go b/pkg/object/meshcontroller/worker/ingress.go index a08f410d33..14f0f4c413 100644 --- a/pkg/object/meshcontroller/worker/ingress.go +++ b/pkg/object/meshcontroller/worker/ingress.go @@ -132,7 +132,7 @@ func (ings *IngressServer) InitIngress(service *spec.Service, port uint32) error logger.Infof("ingress enable TLS, init httpserver with cert: %#v", cert) } - superSpec, err := service.SidecarIngressHTTPServerSpec(cert, rootCert) + superSpec, err := service.SidecarIngressHTTPServerSpec(admSpec.WorkerSpec.Ingress.KeepAlive, admSpec.WorkerSpec.Ingress.KeepAliveTimeout, cert, rootCert) if err != nil { return err } @@ -174,14 +174,14 @@ func (ings *IngressServer) reloadHTTPServer(event informer.Event, value *spec.Ce return false } - spec := ings.service.GetServiceSpec(ings.serviceName) - if spec == nil { + serviceSpec := ings.service.GetServiceSpec(ings.serviceName) + if serviceSpec == nil { logger.Infof("ingress can't find its service: %s", ings.serviceName) return false } - + admSpec := ings.superSpec.ObjectSpec().(*spec.Admin) rootCert := ings.service.GetRootCert() - superSpec, err := spec.SidecarIngressHTTPServerSpec(value, rootCert) + superSpec, err := serviceSpec.SidecarIngressHTTPServerSpec(admSpec.WorkerSpec.Ingress.KeepAlive, admSpec.WorkerSpec.Ingress.KeepAliveTimeout, value, rootCert) if err != nil { logger.Errorf("BUG: update ingress pipeline spec: %s new super spec failed: %v", superSpec.YAMLConfig(), err) From c8a90443206271eb460fc670b760d8c2fafe18fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jun 2022 09:36:44 +0800 Subject: [PATCH 16/25] Bump github.com/Shopify/sarama from 1.32.0 to 1.34.0 (#645) Bumps [github.com/Shopify/sarama](https://github.com/Shopify/sarama) from 1.32.0 to 1.34.0. - [Release notes](https://github.com/Shopify/sarama/releases) - [Changelog](https://github.com/Shopify/sarama/blob/main/CHANGELOG.md) - [Commits](https://github.com/Shopify/sarama/compare/v1.32.0...v1.34.0) --- updated-dependencies: - dependency-name: github.com/Shopify/sarama dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 +++++--- go.sum | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 4c6008a413..43c32d7124 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/ArthurHlt/go-eureka-client v1.1.0 - github.com/Shopify/sarama v1.32.0 + github.com/Shopify/sarama v1.34.0 github.com/alecthomas/jsonschema v0.0.0-20210526225647-edb03dcab7bc github.com/bytecodealliance/wasmtime-go v0.33.1 github.com/eclipse/paho.mqtt.golang v1.3.5 @@ -57,7 +57,7 @@ require ( go.etcd.io/etcd/server/v3 v3.5.2 go.uber.org/zap v1.21.0 golang.org/x/crypto v0.0.0-20220214200702-86341886e292 - golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd + golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 gopkg.in/yaml.v2 v2.4.0 @@ -137,9 +137,11 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-hclog v1.0.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-retryablehttp v0.7.0 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-uuid v1.0.2 // indirect @@ -177,7 +179,7 @@ require ( github.com/onsi/ginkgo v1.16.5 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect - github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/pierrec/lz4/v4 v4.1.14 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.11.0 // indirect diff --git a/go.sum b/go.sum index 1b3f30d911..22799ca790 100644 --- a/go.sum +++ b/go.sum @@ -154,8 +154,8 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdko github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v1.30.0/go.mod h1:zujlQQx1kzHsh4jfV1USnptCQrHAEZ2Hk8fTKCulPVs= -github.com/Shopify/sarama v1.32.0 h1:P+RUjEaRU0GMMbYexGMDyrMkLhbbBVUVISDywi+IlFU= -github.com/Shopify/sarama v1.32.0/go.mod h1:+EmJJKZWVT/faR9RcOxJerP+LId4iWdQPBGLy1Y1Njs= +github.com/Shopify/sarama v1.34.0 h1:j4zTaFHFnfvuV2fdLZyXqIg0Tu4Mzl9f064Z5/H+o4o= +github.com/Shopify/sarama v1.34.0/go.mod h1:V2ceE9UupUf4/oP1Z38SI49fAnD0/MtkqDDHvolIeeQ= github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0= @@ -507,8 +507,6 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/frankban/quicktest v1.14.2 h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns= -github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= @@ -769,8 +767,9 @@ github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqk github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.6.7/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= @@ -876,7 +875,7 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.14.4/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -1109,6 +1108,8 @@ github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2/go.mod h1:iIss55rK github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4/v4 v4.1.14 h1:+fL8AQEZtz/ijeNnpduH0bROTu0O3NZAlPjQxGn8LwE= +github.com/pierrec/lz4/v4 v4.1.14/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1354,8 +1355,9 @@ github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/scram v1.1.0/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -1614,8 +1616,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= From 044824efd6eca83b29081ce88fb974cecd723712 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jun 2022 09:37:34 +0800 Subject: [PATCH 17/25] Bump github.com/lucas-clemente/quic-go from 0.27.0 to 0.27.1 (#638) Bumps [github.com/lucas-clemente/quic-go](https://github.com/lucas-clemente/quic-go) from 0.27.0 to 0.27.1. - [Release notes](https://github.com/lucas-clemente/quic-go/releases) - [Changelog](https://github.com/lucas-clemente/quic-go/blob/master/Changelog.md) - [Commits](https://github.com/lucas-clemente/quic-go/compare/v0.27.0...v0.27.1) --- updated-dependencies: - dependency-name: github.com/lucas-clemente/quic-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 43c32d7124..be299ee167 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/libdns/libdns v0.2.1 github.com/libdns/route53 v1.1.2 github.com/libdns/vultr v0.0.0-20211122184636-cd4cb5c12e51 - github.com/lucas-clemente/quic-go v0.27.0 + github.com/lucas-clemente/quic-go v0.27.1 github.com/megaease/easemesh-api v1.3.5 github.com/megaease/grace v1.0.0 github.com/mitchellh/mapstructure v1.4.3 diff --git a/go.sum b/go.sum index 22799ca790..041051cbc9 100644 --- a/go.sum +++ b/go.sum @@ -920,8 +920,8 @@ github.com/libdns/vultr v0.0.0-20211122184636-cd4cb5c12e51/go.mod h1:HXpNE79BzPq github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/lightstep/tracecontext.go v0.0.0-20181129014701-1757c391b1ac/go.mod h1:Frd2bnT3w5FB5q49ENTfVlztJES+1k/7lyWX2+9gq/M= -github.com/lucas-clemente/quic-go v0.27.0 h1:v6WY87q9zD4dKASbG8hy/LpzAVNzEQzw8sEIeloJsc4= -github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= +github.com/lucas-clemente/quic-go v0.27.1 h1:sOw+4kFSVrdWOYmUjufQ9GBVPqZ+tu+jMtXxXNmRJyk= +github.com/lucas-clemente/quic-go v0.27.1/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= From 33321a087af8dbb3463c3f1dc47ac80f7b6332e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jun 2022 09:38:01 +0800 Subject: [PATCH 18/25] Bump goreleaser/goreleaser-action from 2 to 3 (#637) Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 2 to 3. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](https://github.com/goreleaser/goreleaser-action/compare/v2...v3) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a9eee5631..75d325a534 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - uses: goreleaser/goreleaser-action@v2 + - uses: goreleaser/goreleaser-action@v3 with: version: latest args: release --rm-dist From 53516b361b7e42663cd2b47367855bbd3936bfde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jun 2022 09:38:23 +0800 Subject: [PATCH 19/25] Bump docker/login-action from 1 to 2 (#636) Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 2. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v1...v2) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75d325a534..8f76faceb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,7 +76,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} - - uses: docker/login-action@v1 + - uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} From d98176f2aa8741e6239feca1d779ea61d90700db Mon Sep 17 00:00:00 2001 From: SU Chen Date: Tue, 7 Jun 2022 15:18:13 +0800 Subject: [PATCH 20/25] fix issue 555 about request header context-length missing (#649) * fix issue 555 about request header context-length missing * add more test * update comments * update comments * update pkg/filter/proxy/proxy.go comment Co-authored-by: Bomin Zhang Co-authored-by: Bomin Zhang --- pkg/filter/proxy/proxy.go | 17 +++++++++++++++++ pkg/filter/proxy/request.go | 10 ++++++++++ pkg/filter/proxy/request_test.go | 3 +++ 3 files changed, 30 insertions(+) diff --git a/pkg/filter/proxy/proxy.go b/pkg/filter/proxy/proxy.go index 6879ef3f20..737409c48c 100644 --- a/pkg/filter/proxy/proxy.go +++ b/pkg/filter/proxy/proxy.go @@ -343,6 +343,23 @@ func (b *Proxy) fallbackForCodes(ctx context.HTTPContext) bool { } // Handle handles HTTPContext. +// When we create new request for backend, we call http.NewRequestWithContext method and use context.Request().Body() as body. +// Based on golang std lib comments: +// https://github.com/golang/go/blob/95b68e1e02fa713719f02f6c59fb1532bd05e824/src/net/http/request.go#L856-L860 +// If body is of type *bytes.Buffer, *bytes.Reader, or +// *strings.Reader, the returned request's ContentLength is set to its +// exact value (instead of -1), GetBody is populated (so 307 and 308 +// redirects can replay the body), and Body is set to NoBody if the +// ContentLength is 0. +// +// So in this way, http.Request.ContentLength will be 0, and when http.Client send this request, it will delete +// "Content-Length" key in header. We solve this problem by set http.Request.ContentLength equal to +// http.Request.Header["Content-Length"] (if it is presented). +// Reading all context.Request().Body() and create new request with bytes.NewReader is another way, but it may cause performance loss. +// +// It is important that "Content-Length" in the Header is equal to the length of the Body. In easegress, when a filter change Request.Body, +// it will delete the header of "Content-Length". So, you should not worry about this when using our filters. +// But for customer filters, developer should make sure to delete or set "Context-Length" value in header when change Request.Body. func (b *Proxy) Handle(ctx context.HTTPContext) (result string) { result = b.handle(ctx) return ctx.CallNextHandler(result) diff --git a/pkg/filter/proxy/request.go b/pkg/filter/proxy/request.go index bbf25c9459..f14172d0d9 100644 --- a/pkg/filter/proxy/request.go +++ b/pkg/filter/proxy/request.go @@ -22,6 +22,7 @@ import ( "fmt" "io" "net/http" + "strconv" "sync" "time" @@ -30,6 +31,7 @@ import ( "github.com/megaease/easegress/pkg/context" "github.com/megaease/easegress/pkg/logger" "github.com/megaease/easegress/pkg/util/fasttime" + "github.com/megaease/easegress/pkg/util/httpheader" ) type ( @@ -80,6 +82,14 @@ func (p *pool) newRequest( stdr.Host = r.Host() } + // Based on comments in proxy.Handle, we update stdr.ContentLength here. + if val := stdr.Header.Get(httpheader.KeyContentLength); val != "" { + l, err := strconv.Atoi(val) + if err == nil { + stdr.ContentLength = int64(l) + } + } + req.std = stdr return req, nil diff --git a/pkg/filter/proxy/request_test.go b/pkg/filter/proxy/request_test.go index f1e398d8b0..20b4365f63 100644 --- a/pkg/filter/proxy/request_test.go +++ b/pkg/filter/proxy/request_test.go @@ -20,6 +20,7 @@ package proxy import ( "bytes" "net/http" + "strconv" "strings" "testing" "time" @@ -57,8 +58,10 @@ func TestRequest(t *testing.T) { p := pool{} sr := strings.NewReader("this is the raw body") + ctx.Request().Header().Add(httpheader.KeyContentLength, strconv.Itoa(sr.Len())) req, _ := p.newRequest(ctx, &server, sr, requestPool, httpStatResultPool) defer requestPool.Put(req) // recycle request + assert.Equal(int64(sr.Len()), req.std.ContentLength) req.start() tm := req.startTime() From 33c0fbccd72aa1b6f80f48c2b83cb9141a5ec674 Mon Sep 17 00:00:00 2001 From: SU Chen Date: Wed, 8 Jun 2022 14:59:37 +0800 Subject: [PATCH 21/25] remove http hop headers (#650) --- pkg/filter/proxy/pool.go | 4 +++ pkg/filter/proxy/request.go | 49 ++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/pkg/filter/proxy/pool.go b/pkg/filter/proxy/pool.go index 190077248b..20312e9e53 100644 --- a/pkg/filter/proxy/pool.go +++ b/pkg/filter/proxy/pool.go @@ -195,6 +195,10 @@ func (p *pool) handle(ctx context.HTTPContext, reqBody io.Reader, client *Client setStatusCode(http.StatusServiceUnavailable) return resultServerError } + removeConnectionHeaders(resp.Header) + for _, h := range hopHeaders { + resp.Header.Del(h) + } addLazyTag("code", "", resp.StatusCode) diff --git a/pkg/filter/proxy/request.go b/pkg/filter/proxy/request.go index f14172d0d9..11aa8b9cbb 100644 --- a/pkg/filter/proxy/request.go +++ b/pkg/filter/proxy/request.go @@ -22,11 +22,14 @@ import ( "fmt" "io" "net/http" + "net/textproto" "strconv" + "strings" "sync" "time" httpstat "github.com/tcnksm/go-httpstat" + "golang.org/x/net/http/httpguts" "github.com/megaease/easegress/pkg/context" "github.com/megaease/easegress/pkg/logger" @@ -49,6 +52,49 @@ type ( } ) +// removeConnectionHeaders removes hop-by-hop headers listed in the "Connection" header of h. +// See RFC 7230, section 6.1 +func removeConnectionHeaders(h http.Header) { + for _, f := range h["Connection"] { + for _, sf := range strings.Split(f, ",") { + if sf = textproto.TrimString(sf); sf != "" { + h.Del(sf) + } + } + } +} + +// https://github.com/golang/go/blob/95b68e1e02fa713719f02f6c59fb1532bd05e824/src/net/http/httputil/reverseproxy.go#L171-L186 +// Hop-by-hop headers. These are removed when sent to the backend. +// As of RFC 7230, hop-by-hop headers are required to appear in the +// Connection header field. These are the headers defined by the +// obsoleted RFC 2616 (section 13.5.1) and are used for backward +// compatibility. +var hopHeaders = []string{ + "Connection", + "Proxy-Connection", // non-standard but still sent by libcurl and rejected by e.g. google + "Keep-Alive", + "Proxy-Authenticate", + "Proxy-Authorization", + "Te", // canonicalized version of "TE" + "Trailer", // not Trailers per URL above; https://www.rfc-editor.org/errata_search.php?eid=4522 + "Transfer-Encoding", + "Upgrade", +} + +// info: https://github.com/golang/go/blob/95b68e1e02fa713719f02f6c59fb1532bd05e824/src/net/http/httputil/reverseproxy.go#L214 +func processHopHeaders(inReq, outReq *http.Request) { + removeConnectionHeaders(outReq.Header) + + for _, h := range hopHeaders { + outReq.Header.Del(h) + } + + if httpguts.HeaderValuesContainsToken(inReq.Header["Te"], "trailers") { + outReq.Header.Set("Te", "trailers") + } +} + func (p *pool) newRequest( ctx context.HTTPContext, server *Server, @@ -76,7 +122,7 @@ func (p *pool) newRequest( return nil, fmt.Errorf("BUG: new request failed: %v", err) } - stdr.Header = r.Header().Std() + stdr.Header = r.Header().Std().Clone() // only set host when server address is not host name OR server is explicitly told to keep the host of the request. if !server.addrIsHostName || server.KeepHost { stdr.Host = r.Host() @@ -89,6 +135,7 @@ func (p *pool) newRequest( stdr.ContentLength = int64(l) } } + processHopHeaders(r.Std(), stdr) req.std = stdr From ce53b79f46706e857d82aff20d98566c78f8ae01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Jun 2022 14:51:28 +0800 Subject: [PATCH 22/25] Bump github.com/spf13/viper from 1.10.1 to 1.12.0 (#644) Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.10.1 to 1.12.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.10.1...v1.12.0) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 57 +++++++++++------------ go.sum | 139 +++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 139 insertions(+), 57 deletions(-) diff --git a/go.mod b/go.mod index be299ee167..e564ea5e0b 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/bytecodealliance/wasmtime-go v0.33.1 github.com/eclipse/paho.mqtt.golang v1.3.5 github.com/fatih/color v1.13.0 - github.com/fsnotify/fsnotify v1.5.1 + github.com/fsnotify/fsnotify v1.5.4 github.com/ghodss/yaml v1.0.0 github.com/go-chi/chi/v5 v5.0.7 github.com/go-zookeeper/zk v1.0.2 @@ -34,7 +34,7 @@ require ( github.com/lucas-clemente/quic-go v0.27.1 github.com/megaease/easemesh-api v1.3.5 github.com/megaease/grace v1.0.0 - github.com/mitchellh/mapstructure v1.4.3 + github.com/mitchellh/mapstructure v1.5.0 github.com/nacos-group/nacos-sdk-go v1.1.0 github.com/openzipkin/zipkin-go v0.4.0 github.com/patrickmn/go-cache v2.1.0+incompatible @@ -43,8 +43,8 @@ require ( github.com/rs/cors v1.8.2 github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.10.1 - github.com/stretchr/testify v1.7.0 + github.com/spf13/viper v1.12.0 + github.com/stretchr/testify v1.7.1 github.com/tcnksm/go-httpstat v0.2.1-0.20191008022543-e866bb274419 github.com/tg123/go-htpasswd v1.2.0 github.com/tidwall/gjson v1.14.0 @@ -52,16 +52,16 @@ require ( github.com/valyala/fasttemplate v1.2.1 github.com/xeipuuv/gojsonschema v1.2.1-0.20201027075954-b076d39a02e5 github.com/yl2chen/cidranger v1.0.2 - go.etcd.io/etcd/api/v3 v3.5.2 - go.etcd.io/etcd/client/v3 v3.5.2 + go.etcd.io/etcd/api/v3 v3.5.4 + go.etcd.io/etcd/client/v3 v3.5.4 go.etcd.io/etcd/server/v3 v3.5.2 go.uber.org/zap v1.21.0 - golang.org/x/crypto v0.0.0-20220214200702-86341886e292 + golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 + golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a gopkg.in/yaml.v2 v2.4.0 - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b + gopkg.in/yaml.v3 v3.0.0 k8s.io/api v0.22.5 k8s.io/apimachinery v0.22.5 k8s.io/client-go v0.22.5 @@ -127,7 +127,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.0.1 // indirect - github.com/google/go-cmp v0.5.7 // indirect + github.com/google/go-cmp v0.5.8 // indirect github.com/google/go-containerregistry v0.8.1-0.20220120151853-ac864e57b117 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -139,14 +139,14 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-hclog v1.0.0 // indirect + github.com/hashicorp/go-hclog v1.2.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-retryablehttp v0.7.0 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-uuid v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hashicorp/serf v0.9.6 // indirect + github.com/hashicorp/serf v0.9.7 // indirect github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect @@ -160,7 +160,7 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/kelseyhightower/envconfig v1.4.0 // indirect github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect - github.com/magiconair/properties v1.8.5 // indirect + github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/marten-seemann/qpack v0.2.1 // indirect github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect @@ -177,12 +177,13 @@ require ( github.com/nrdcg/dnspod-go v0.4.0 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/onsi/ginkgo v1.16.5 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pierrec/lz4/v4 v4.1.14 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_golang v1.11.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.6.0 // indirect @@ -192,10 +193,10 @@ require ( github.com/robfig/cron/v3 v3.0.1 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/soheilhy/cmux v0.1.5 // indirect - github.com/spf13/afero v1.8.0 // indirect - github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/afero v1.8.2 // indirect + github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/subosito/gotenv v1.3.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect @@ -207,8 +208,8 @@ require ( github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect go.etcd.io/bbolt v1.3.6 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.2 // indirect - go.etcd.io/etcd/client/v2 v2.305.2 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect + go.etcd.io/etcd/client/v2 v2.305.4 // indirect go.etcd.io/etcd/pkg/v3 v3.5.2 // indirect go.etcd.io/etcd/raft/v3 v3.5.2 // indirect go.opencensus.io v0.23.0 // indirect @@ -226,20 +227,20 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/mod v0.5.1 // indirect - golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect + golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect golang.org/x/tools v0.1.8 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect - google.golang.org/api v0.63.0 // indirect + google.golang.org/api v0.81.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect - google.golang.org/grpc v1.43.0 // indirect - google.golang.org/protobuf v1.27.1 // indirect + google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect + google.golang.org/grpc v1.46.2 // indirect + google.golang.org/protobuf v1.28.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/ini.v1 v1.66.2 // indirect + gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gotest.tools/v3 v3.0.3 // indirect diff --git a/go.sum b/go.sum index 041051cbc9..93513cb220 100644 --- a/go.sum +++ b/go.sum @@ -31,14 +31,21 @@ cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+Y cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= -cloud.google.com/go v0.99.0 h1:y/cM2iqGgGi5D5DQZl6D9STN/3dR/Vx5Mp8s752oJTY= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= +cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= +cloud.google.com/go/compute v1.6.1 h1:2sMmt8prCn7DPaG4Pmh0N3Inmc8cT8ae5k1M6VJ9Wqc= +cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= @@ -475,6 +482,7 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.3.0-java/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= @@ -507,10 +515,13 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= @@ -656,8 +667,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-containerregistry v0.8.0/go.mod h1:wW5v71NHGnQyb4k+gSshjxidrC7lN33MdWEn+Mz9TsI= github.com/google/go-containerregistry v0.8.1-0.20220110151055-a61fd0a8e2bb/go.mod h1:wW5v71NHGnQyb4k+gSshjxidrC7lN33MdWEn+Mz9TsI= github.com/google/go-containerregistry v0.8.1-0.20220120151853-ac864e57b117 h1:Jcm0O+2f2Ul/sgoxCts2ocI1BTaJpP56SBb+0iO40Ug= @@ -709,6 +721,9 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= +github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= @@ -758,8 +773,9 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.0.0 h1:bkKf0BeBXcSYa7f5Fyi9gMuQ8gNsxeiNpZjR6VxNZeo= github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= +github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -802,8 +818,9 @@ github.com/hashicorp/memberlist v0.3.0 h1:8+567mCcFDnS5ADl7lrpxPMWiFCElyUEeW0gtj github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= -github.com/hashicorp/serf v0.9.6 h1:uuEX1kLR6aoda1TBttmJQKDLZE1Ob7KN0NPdE7EtCDc= github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hashicorp/serf v0.9.7 h1:hkdgbqizGQHuU5IPqYM1JdSMV8nKfpuOnZYXssk9muY= +github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -928,8 +945,9 @@ github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0Q github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -993,8 +1011,9 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= @@ -1098,9 +1117,12 @@ github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaR github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.0-beta.2/go.mod h1:+X+aW6gUj6Hda43TeYHVCIvYNG/jqY/8ZFXAeXXHl+Q= +github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc= @@ -1132,8 +1154,9 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.11.1 h1:+4eQaD7vAZ6DsfsxB15hbE0odUjGI5ARs9yskGu1v4s= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1195,6 +1218,7 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= +github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -1248,12 +1272,14 @@ github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTd github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.4.1/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/afero v1.8.0 h1:5MmtuhAgYeU6qpa7w7bP0dv6MBYuup0vekhSpSkoq60= github.com/spf13/afero v1.8.0/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= +github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= +github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= @@ -1276,8 +1302,9 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= -github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= +github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518/go.mod h1:CKI4AZ4XmGV240rTHfO0hfE83S6/a3/Q1siZJ/vXf7A= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= @@ -1296,10 +1323,12 @@ github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI= +github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1391,19 +1420,23 @@ go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489 h1:1JFLBqwIgdyHN1Zt go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.2 h1:tXok5yLlKyuQ/SXSjtqHc4uzNaMqZi2XsoSPr/LlJXI= go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= +go.etcd.io/etcd/api/v3 v3.5.4 h1:OHVyt3TopwtUQ2GKdd5wu3PmmipR4FTwCqoEjSyRdIc= +go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.2 h1:4hzqQ6hIb3blLyQ8usCU4h3NghkqcsohEQ3o3VetYxE= go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.4 h1:lrneYvz923dvC14R54XcA7FXoZ3mlGZAgmwhfm7HqOg= +go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= -go.etcd.io/etcd/client/v2 v2.305.2 h1:ymrVwTkefuqA/rPkSW7/B4ApijbPVefRumkY+stNfS0= go.etcd.io/etcd/client/v2 v2.305.2/go.mod h1:2D7ZejHVMIfog1221iLSYlQRzrtECw3kz4I4VAQm3qI= +go.etcd.io/etcd/client/v2 v2.305.4 h1:Dcx3/MYyfKcPNLpR4VVQUP5KgYrBeJtktBwEKkw08Ao= +go.etcd.io/etcd/client/v2 v2.305.4/go.mod h1:Ud+VUwIi9/uQHOMA+4ekToJ12lTxlv0zB/+DHwTGEbU= go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= -go.etcd.io/etcd/client/v3 v3.5.2 h1:WdnejrUtQC4nCxK0/dLTMqKOB+U5TP/2Ya0BJL+1otA= go.etcd.io/etcd/client/v3 v3.5.2/go.mod h1:kOOaWFFgHygyT0WlSmL8TJiXmMysO/nNUlEsSsN6W4o= +go.etcd.io/etcd/client/v3 v3.5.4 h1:p83BUL3tAYS0OT/r0qglgc3M1JjhM0diV8DSWAhVXv4= +go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= go.etcd.io/etcd/pkg/v3 v3.5.0/go.mod h1:UzJGatBQ1lXChBkQF0AuAtkRQMYnHubxAEYIrC3MSsE= go.etcd.io/etcd/pkg/v3 v3.5.2 h1:YZUojdoPhOyl5QILYnR8LTUbbNefu/sV4ma+ZMr2tto= go.etcd.io/etcd/pkg/v3 v3.5.2/go.mod h1:zsXz+9D/kijzRiG/UnFGDTyHKcVp0orwiO8iMLAi+k0= @@ -1506,8 +1539,9 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1616,6 +1650,11 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1636,8 +1675,11 @@ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 h1:OSnWWcOd/CtWQC2cYSBgbTSJv3ciqd8r54ySIW2y3RE= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1650,8 +1692,9 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 h1:w8s32wxx3sY+OjLlv9qltkLU5yvJzxjjgiHWLjdIcw4= +golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1767,8 +1810,15 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1871,8 +1921,10 @@ golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gomodules.xyz/jsonpatch/v2 v2.2.0 h1:4pT439QV83L+G9FkcCriY6EkpcK6r6bK+A5FBUMI7qY= gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= @@ -1915,8 +1967,15 @@ google.golang.org/api v0.58.0/go.mod h1:cAbP2FsxoGVNwtgNAmmn3y5G1TWAiVYRmg4yku3l google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= -google.golang.org/api v0.63.0 h1:n2bqqK895ygnBpdPDYetfy23K7fJ22wsrZKCyfuRkkA= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= +google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.81.0 h1:o8WF5AvfidafWbFjsRyupxyEQJNUWxLZJCK5NXrxZZ8= +google.golang.org/api v0.81.0/go.mod h1:FA6Mb/bZxj706H2j+j2d6mHEEaHBmbbWnkfvmorOCko= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2005,8 +2064,23 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd h1:e0TwkXOdbnH/1x5rc5MZ/VYyiZ4v+RdVfrGMqEwT68I= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -2043,8 +2117,12 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2058,8 +2136,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -2078,8 +2157,9 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= +gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -2100,8 +2180,9 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= From de365ae9b6d67ad2fd40bab5059e5406bad3d052 Mon Sep 17 00:00:00 2001 From: SU Chen Date: Tue, 28 Jun 2022 09:55:47 +0800 Subject: [PATCH 23/25] udpate k8s ingress controller route policy (#651) * udpate k8s ingress controller route policy * udpate k8s ingress controller route policy --- pkg/object/ingresscontroller/translator.go | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pkg/object/ingresscontroller/translator.go b/pkg/object/ingresscontroller/translator.go index fca6bfbe18..097bc10851 100644 --- a/pkg/object/ingresscontroller/translator.go +++ b/pkg/object/ingresscontroller/translator.go @@ -62,6 +62,30 @@ type ( } ) +func (b *httpServerSpecBuilder) sortRules() { + hostRules := []*httpserver.Rule{} + hostRegRules := []*httpserver.Rule{} + noHostRules := []*httpserver.Rule{} + for _, rule := range b.Rules { + if rule.Host != "" { + hostRules = append(hostRules, rule) + } else if rule.HostRegexp != "" { + hostRegRules = append(hostRegRules, rule) + } else { + noHostRules = append(noHostRules, rule) + } + } + sort.Slice(hostRules, func(i, j int) bool { + return hostRules[i].Host < hostRules[j].Host + }) + sort.Slice(hostRegRules, func(i, j int) bool { + return hostRegRules[i].HostRegexp < hostRegRules[j].HostRegexp + }) + newRules := append(hostRules, hostRegRules...) + newRules = append(newRules, noHostRules...) + b.Rules = newRules +} + func newPipelineSpecBuilder(name string) *pipelineSpecBuilder { return &pipelineSpecBuilder{ Kind: httppipeline.Kind, @@ -388,6 +412,7 @@ func (st *specTranslator) translate() error { } st.translateIngressRules(b, ingress) } + b.sortRules() if p := st.pipelines[defaultPipelineName]; p != nil { b.Rules = append(b.Rules, &httpserver.Rule{ From 4cc51ace211f714c4bacd311631872a1fb43e3df Mon Sep 17 00:00:00 2001 From: sodaRyCN <35725024+sodaRyCN@users.noreply.github.com> Date: Tue, 28 Jun 2022 14:23:38 +0800 Subject: [PATCH 24/25] adapter scheme header (#634) --- pkg/context/httprequest.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkg/context/httprequest.go b/pkg/context/httprequest.go index e576979a12..8701069bc9 100644 --- a/pkg/context/httprequest.go +++ b/pkg/context/httprequest.go @@ -20,6 +20,7 @@ package context import ( "io" "net/http" + "strings" "github.com/tomasen/realip" @@ -38,6 +39,10 @@ type ( } ) +const ( + xForwardedProto = "X-Forwarded-Proto" +) + func newHTTPRequest(stdr *http.Request) *httpRequest { // Reference: https://golang.org/pkg/net/http/#Request // @@ -96,8 +101,15 @@ func (r *httpRequest) Scheme() string { return scheme } - if scheme := r.std.Header.Get("X-Forwarded-Proto"); scheme != "" { - return scheme + if scheme := r.std.Header.Get(xForwardedProto); scheme != "" { + // note some proxy servers will append data in this format, + // and the last one is sent by the last proxy-server and should use for easegress's proxy + // header : { + // some-key: "ele1, ele2, ele3" + // } + // https://github.com/spring-cloud/spring-cloud-gateway/ ProxyExchange.java#appendXForwarded() + schemes := strings.Split(scheme, ",") + return schemes[len(schemes)-1] } if r.std.TLS != nil { From 1053f3c5f01ce21e7498791b1eecb53834f6ac79 Mon Sep 17 00:00:00 2001 From: SU Chen Date: Tue, 28 Jun 2022 15:23:41 +0800 Subject: [PATCH 25/25] release v1.5.3 (#672) * release v1.5.3 * Update CHANGELOG.md Co-authored-by: Bomin Zhang Co-authored-by: Bomin Zhang --- CHANGELOG.md | 13 ++++++++++++- Makefile | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e2b11c948..d967cc1b67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,18 @@ # Changelog +## [v1.5.3](https://github.com/megaease/easegress/tree/v1.5.3) (2022-06-28) -## [v1.5.2](https://github.com/megaease/easegress/tree/v1.5.2) (2022-04-06) +[Full Changelog](https://github.com/megaease/easegress/compare/v1.5.2...v1.5.3) + +**Implemented enhancements:** +- Remove HTTP hop headers [\#650](https://github.com/megaease/easegress/pull/650) +- Optimize Kubernetes IngressController rule route policy [\#651](https://github.com/megaease/easegress/pull/651) + +**Fixed bugs:** +- Wrong HTTP request scheme if the `X-Forwarded-Proto` header contains two or more items[\#634](https://github.com/megaease/easegress/pull/634) +- Fix request "Content-Length" header missing bug [\#649](https://github.com/megaease/easegress/pull/649) + +## [v1.5.2](https://github.com/megaease/easegress/tree/v1.5.2) (2022-05-10) [Full Changelog](https://github.com/megaease/easegress/compare/v1.5.1...v1.5.2) diff --git a/Makefile b/Makefile index 1dcd24b239..ab321f7b40 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ HTTPSERVER_TEST_PATH := build/test IMAGE_NAME?=megaease/easegress # Version -RELEASE?=v1.5.2 +RELEASE?=v1.5.3 # Git Related GIT_REPO_INFO=$(shell cd ${MKFILE_DIR} && git config --get remote.origin.url)