-
Notifications
You must be signed in to change notification settings - Fork 360
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
feat: implement fallback for the Backend API #4461
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
58 changes: 58 additions & 0 deletions
58
internal/gatewayapi/testdata/backend-with-fallback.in.yaml
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,58 @@ | ||
gateways: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
namespace: envoy-gateway | ||
name: gateway-1 | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
allowedRoutes: | ||
namespaces: | ||
from: All | ||
httpRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
namespace: default | ||
name: httproute-1 | ||
spec: | ||
parentRefs: | ||
- namespace: envoy-gateway | ||
name: gateway-1 | ||
rules: | ||
- matches: | ||
- path: | ||
value: "/" | ||
backendRefs: | ||
- group: gateway.envoyproxy.io | ||
kind: Backend | ||
name: backend-1 | ||
- group: gateway.envoyproxy.io | ||
kind: Backend | ||
name: backend-2 | ||
backends: | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: Backend | ||
metadata: | ||
name: backend-1 | ||
namespace: default | ||
spec: | ||
endpoints: | ||
- ip: | ||
address: 1.1.1.1 | ||
port: 3001 | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: Backend | ||
metadata: | ||
name: backend-2 | ||
namespace: default | ||
spec: | ||
fallback: true | ||
endpoints: | ||
- ip: | ||
address: 2.2.2.2 | ||
port: 3001 |
180 changes: 180 additions & 0 deletions
180
internal/gatewayapi/testdata/backend-with-fallback.out.yaml
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,180 @@ | ||
backends: | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: Backend | ||
metadata: | ||
creationTimestamp: null | ||
name: backend-1 | ||
namespace: default | ||
spec: | ||
endpoints: | ||
- ip: | ||
address: 1.1.1.1 | ||
port: 3001 | ||
status: | ||
conditions: | ||
- lastTransitionTime: null | ||
message: The Backend was accepted | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: Backend | ||
metadata: | ||
creationTimestamp: null | ||
name: backend-2 | ||
namespace: default | ||
spec: | ||
endpoints: | ||
- ip: | ||
address: 2.2.2.2 | ||
port: 3001 | ||
fallback: true | ||
status: | ||
conditions: | ||
- lastTransitionTime: null | ||
message: The Backend was accepted | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
gateways: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
creationTimestamp: null | ||
name: gateway-1 | ||
namespace: envoy-gateway | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- allowedRoutes: | ||
namespaces: | ||
from: All | ||
name: http | ||
port: 80 | ||
protocol: HTTP | ||
status: | ||
listeners: | ||
- attachedRoutes: 1 | ||
conditions: | ||
- lastTransitionTime: null | ||
message: Sending translated listener configuration to the data plane | ||
reason: Programmed | ||
status: "True" | ||
type: Programmed | ||
- lastTransitionTime: null | ||
message: Listener has been successfully translated | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
- lastTransitionTime: null | ||
message: Listener references have been resolved | ||
reason: ResolvedRefs | ||
status: "True" | ||
type: ResolvedRefs | ||
name: http | ||
supportedKinds: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
- group: gateway.networking.k8s.io | ||
kind: GRPCRoute | ||
httpRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
creationTimestamp: null | ||
name: httproute-1 | ||
namespace: default | ||
spec: | ||
parentRefs: | ||
- name: gateway-1 | ||
namespace: envoy-gateway | ||
rules: | ||
- backendRefs: | ||
- group: gateway.envoyproxy.io | ||
kind: Backend | ||
name: backend-1 | ||
- group: gateway.envoyproxy.io | ||
kind: Backend | ||
name: backend-2 | ||
matches: | ||
- path: | ||
value: / | ||
status: | ||
parents: | ||
- conditions: | ||
- lastTransitionTime: null | ||
message: Route is accepted | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
- lastTransitionTime: null | ||
message: Resolved all the Object references for the Route | ||
reason: ResolvedRefs | ||
status: "True" | ||
type: ResolvedRefs | ||
controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
parentRef: | ||
name: gateway-1 | ||
namespace: envoy-gateway | ||
infraIR: | ||
envoy-gateway/gateway-1: | ||
proxy: | ||
listeners: | ||
- address: null | ||
name: envoy-gateway/gateway-1/http | ||
ports: | ||
- containerPort: 10080 | ||
name: http-80 | ||
protocol: HTTP | ||
servicePort: 80 | ||
metadata: | ||
labels: | ||
gateway.envoyproxy.io/owning-gateway-name: gateway-1 | ||
gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway | ||
name: envoy-gateway/gateway-1 | ||
xdsIR: | ||
envoy-gateway/gateway-1: | ||
accessLog: | ||
text: | ||
- path: /dev/stdout | ||
http: | ||
- address: 0.0.0.0 | ||
hostnames: | ||
- '*' | ||
isHTTP2: false | ||
metadata: | ||
kind: Gateway | ||
name: gateway-1 | ||
namespace: envoy-gateway | ||
sectionName: http | ||
name: envoy-gateway/gateway-1/http | ||
path: | ||
escapedSlashesAction: UnescapeAndRedirect | ||
mergeSlashes: true | ||
port: 10080 | ||
routes: | ||
- destination: | ||
name: httproute/default/httproute-1/rule/0 | ||
settings: | ||
- addressType: IP | ||
endpoints: | ||
- host: 1.1.1.1 | ||
port: 3001 | ||
weight: 1 | ||
- addressType: IP | ||
endpoints: | ||
- host: 2.2.2.2 | ||
port: 3001 | ||
priority: 1 | ||
weight: 1 | ||
hostname: '*' | ||
isHTTP2: false | ||
metadata: | ||
kind: HTTPRoute | ||
name: httproute-1 | ||
namespace: default | ||
name: httproute/default/httproute-1/rule/0/match/0/* | ||
pathMatch: | ||
distinct: false | ||
name: "" | ||
prefix: / |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nit: a link to https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/priority#arch-overview-load-balancing-priority-levels will help users to better understand how fallback works.
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.
we dont want to expose the internal details, only want to represent it as a boolean field