-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Faster requeue when object has been modified error happens (#1496) * Faster requeue when object has been modified error happens * Add api-gateway metrics * Register metrics * Add unit test * Fix lint * chore: prepare 2.10.2 * QOL updates to APIRule v2alpha1 integration tests (#1507) * Remove dupplicated inits from apirule tests * Add template file name * switch files * Scale down oathkeeper for faster startup * Revert delay * Conditional teardown * Re-add len parameter to RNG * Adapt according to review comments * Full support for special characters in asterisk paths (#1569) * Full support for special characters in asterisk paths * Fix regex pattern * Only use scenario initializer for v2alpha1 tests (#1521) * Apply suggestions from code review Co-authored-by: Natalia Sitko <80401180+nataliasitko@users.noreply.github.com> --------- Co-authored-by: Patryk Strugacz <werdes72@users.noreply.github.com> Co-authored-by: Bartosz Chwila <103247439+barchw@users.noreply.github.com> Co-authored-by: Natalia Sitko <80401180+nataliasitko@users.noreply.github.com>
- Loading branch information
1 parent
3ce8dab
commit f5cd439
Showing
54 changed files
with
687 additions
and
781 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.10.1 | ||
2.10.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## New Features | ||
|
||
- We've implemented a faster requeue when the error `object has been modified` occurs [#1496](https://github.com/kyma-project/api-gateway/pull/1496) | ||
- We've added full support for special characters in asterisk paths [#1569](https://github.com/kyma-project/api-gateway/pull/1569) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
|
||
ctrlmetrics "sigs.k8s.io/controller-runtime/pkg/metrics" | ||
) | ||
|
||
type ApiGatewayMetrics struct { | ||
apiRuleObjectModifiedErrorsCounter prometheus.Counter | ||
} | ||
|
||
func NewApiGatewayMetrics() *ApiGatewayMetrics { | ||
apiGatewayMetrics := &ApiGatewayMetrics{ | ||
apiRuleObjectModifiedErrorsCounter: prometheus.NewCounter(prometheus.CounterOpts{ | ||
Name: "api_rule_object_modified_errors_total", | ||
Namespace: "api_gateway", | ||
Help: "The total number of errors that occurred while modifying the APIRule object", | ||
}), | ||
} | ||
ctrlmetrics.Registry.MustRegister(apiGatewayMetrics.apiRuleObjectModifiedErrorsCounter) | ||
return apiGatewayMetrics | ||
} | ||
|
||
func (m *ApiGatewayMetrics) IncreaseApiRuleObjectModifiedErrorsCounter() { | ||
m.apiRuleObjectModifiedErrorsCounter.Inc() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package metrics | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
dto "github.com/prometheus/client_model/go" | ||
) | ||
|
||
var _ = Describe("ApiGateway metrics", func() { | ||
It("ApiRule object modified errors should increase the counter", func() { | ||
metrics := NewApiGatewayMetrics() | ||
metrics.IncreaseApiRuleObjectModifiedErrorsCounter() | ||
|
||
metric := metrics.apiRuleObjectModifiedErrorsCounter | ||
|
||
pb := &dto.Metric{} | ||
err := metric.Write(pb) | ||
|
||
Expect(err).To(BeNil()) | ||
Expect(pb.GetCounter().GetValue()).To(Equal(float64(1))) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
internal/processing/processors/v2alpha1/virtualservice/regex_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package virtualservice | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"regexp" | ||
) | ||
|
||
var _ = Describe("Envoy templates regex matching", func() { | ||
DescribeTable(`{\*} template`, | ||
func(input string, shouldMatch bool) { | ||
// when | ||
matched, err := regexp.MatchString(prepareRegexPath("/{*}"), input) | ||
|
||
// then | ||
Expect(err).To(Not(HaveOccurred())) | ||
Expect(matched).To(Equal(shouldMatch)) | ||
}, | ||
Entry("should not match empty path", "/", false), | ||
Entry("should match path with one segment", "/segment", true), | ||
Entry("should match special characters", "/segment-._~!$&'()*+,;=:@", true), | ||
Entry("should match with correct % encoding", "/segment%20", true), | ||
Entry("should not match with incorrect % encoding", "/segment%2", false), | ||
Entry("should not match path with multiple segments", "/segment1/segment2/segment3", false), | ||
) | ||
|
||
DescribeTable(`{\*\*} template`, func(input string, shouldMatch bool) { | ||
// when | ||
matched, err := regexp.MatchString(prepareRegexPath("/{**}"), input) | ||
|
||
// then | ||
Expect(err).To(Not(HaveOccurred())) | ||
Expect(matched).To(Equal(shouldMatch)) | ||
}, | ||
Entry("should match empty path", "/", true), | ||
Entry("should match path with one segment", "/segment", true), | ||
Entry("should match special characters", "/segment-._~!$&'()*+,;=:@", true), | ||
Entry("should match with correct % encoding", "/segment%20", true), | ||
Entry("should not match with incorrect % encoding", "/segment%2", false), | ||
Entry("should match path with multiple segments", "/segment1/segment2/segment3", true), | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.