-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e & misc fixes for EnvoyPatchPolicy #1738
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1738 +/- ##
==========================================
- Coverage 64.96% 64.94% -0.02%
==========================================
Files 84 84
Lines 12010 12014 +4
==========================================
+ Hits 7802 7803 +1
- Misses 3720 3723 +3
Partials 488 488
|
* Use LocalReplyConfig to return a custom status code `418` when there is no valid route match Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
* Only add EnvoyPatchPolicy to provider resources if enabled in EnvoyGateway API * Add `omitempty` tag to `priority` field to make it optional Signed-off-by: Arko Dasgupta <[email protected]> (cherry picked from commit 93c92b9)
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
@@ -59,7 +59,7 @@ type EnvoyPatchPolicySpec struct { | |||
// the priority i.e. int32.min has the highest priority and | |||
// int32.max has the lowest priority. | |||
// Defaults to 0. | |||
Priority int32 `json:"priority"` | |||
Priority int32 `json:"priority,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this's OK to me, but I recall the api guide said should be a pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its still required internally, omitempty
allows the user to skip setting it when creating the resource and use the default value / 0
instead
@@ -62,6 +62,8 @@ data: | |||
type: Kubernetes | |||
gateway: | |||
controllerName: gateway.envoyproxy.io/gatewayclass-controller | |||
extensionApis: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems not related to an redis
example, can you address some comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the yaml used in e2e to update the startup config, I can start renaming and breaking things in separate files, would you prefer that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we can do that later
* Add E2E for EnvoyPatchPolicy * Use LocalReplyConfig to return a custom status code `406` when there is no valid route match Signed-off-by: Arko Dasgupta <[email protected]> (cherry picked from commit a7784c5)
* refactor: set defaults in Deployment, else k8s sets them for you, creating infinite reconciliation loop (#1594) * fix: envoy proxy resource apply bug. Signed-off-by: qicz <[email protected]> * update pointer. Signed-off-by: qicz <[email protected]> * add comment Signed-off-by: qicz <[email protected]> * update cm cmp logic. Signed-off-by: qicz <[email protected]> * fix lint Signed-off-by: qicz <[email protected]> * add probe field default value. Signed-off-by: qicz <[email protected]> * fix uts Signed-off-by: qicz <[email protected]> * align probe Signed-off-by: qicz <[email protected]> * optimize deploy compare logic Signed-off-by: qicz <[email protected]> * add compare deploy uts Signed-off-by: qicz <[email protected]> * rm cm binarydata cmp Signed-off-by: qicz <[email protected]> * rm deploy cmp logic Signed-off-by: qicz <[email protected]> * fix ut Signed-off-by: qicz <[email protected]> * fix lint Signed-off-by: qicz <[email protected]> --------- Signed-off-by: qicz <[email protected]> Signed-off-by: qi <[email protected]> (cherry picked from commit 9ba9103) * DeepCopy resources that require status updates (#1723) * Was seeing constant churn between provider runner publishing resources and gateway-api runner receiving them. * Tried to debug it by printing the o/p of `cmp.Diff` between current and previous values ``` diff --git a/internal/gatewayapi/runner/runner.go b/internal/gatewayapi/runner/runner.go index 050394ba..50d09f6f 100644 --- a/internal/gatewayapi/runner/runner.go +++ b/internal/gatewayapi/runner/runner.go @@ -8,6 +8,7 @@ package runner import ( "context" + "github.com/google/go-cmp/cmp" "k8s.io/apimachinery/pkg/runtime/schema" "sigs.k8s.io/gateway-api/apis/v1beta1" "sigs.k8s.io/yaml" @@ -49,6 +50,7 @@ func (r *Runner) Start(ctx context.Context) error { } func (r *Runner) subscribeAndTranslate(ctx context.Context) { + prev := &gatewayapi.Resources{} message.HandleSubscription(r.ProviderResources.GatewayAPIResources.Subscribe(ctx), func(update message.Update[string, *gatewayapi.Resources]) { val := update.Value @@ -56,6 +58,9 @@ func (r *Runner) subscribeAndTranslate(ctx context.Context) { if update.Delete || val == nil { return } + diff := cmp.Diff(prev, val) + r.Logger.WithValues("output", "diff").Info(diff) + prev = val.DeepCopy() // Translate and publish IRs. t := &gatewayapi.Translator{ ``` Here's the o/p and its empty ``` 2023-07-27T23:55:29.795Z INFO gateway-api runner/runner.go:62 {"runner": "gateway-api", "output": "diff"} ``` * Using a DeepCopy for resources that were updating the `Status` subresource seems to have solved the issue, which implies that watchable doesnt like clients to mutate the value, even though they are meant to be a `DeepCopy` Fixes: #1715 Signed-off-by: Arko Dasgupta <[email protected]> (cherry picked from commit 5b72451) * observability: add container port for metrics (#1736) container port Signed-off-by: zirain <[email protected]> (cherry picked from commit 4bba03a) * docs: Add user docs for EnvoyPatchPolicy (#1733) * Add user docs for EnvoyPatchPolicy Relates to #24 Signed-off-by: Arko Dasgupta <[email protected]> * nits Signed-off-by: Arko Dasgupta <[email protected]> * wrap up Signed-off-by: Arko Dasgupta <[email protected]> * lint Signed-off-by: Arko Dasgupta <[email protected]> * address comments && fix config Signed-off-by: Arko Dasgupta <[email protected]> --------- Signed-off-by: Arko Dasgupta <[email protected]> (cherry picked from commit 27b0939) * e2e & misc fixes for EnvoyPatchPolicy (#1738) * Add E2E for EnvoyPatchPolicy * Use LocalReplyConfig to return a custom status code `406` when there is no valid route match Signed-off-by: Arko Dasgupta <[email protected]> (cherry picked from commit a7784c5) --------- Signed-off-by: Arko Dasgupta <[email protected]> Co-authored-by: qi <[email protected]> Co-authored-by: zirain <[email protected]>
misc fixes:
EnvoyGateway API
omitempty
tag topriority
field to make it optionale2e
406
when there is no valid route matchRelates to #24