-
Notifications
You must be signed in to change notification settings - Fork 789
fix: skip provision when IR Infra is invalid #7754
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
57ec432
fix: do not trigger IR deletion when EnvoyProxy is invalid
zirain c839278
add Invalid to ir.Infra
zirain 92c9522
fix gen
zirain 48a3d9c
add e2e
zirain 740ec80
remove invalid
zirain 051d32d
add comments
zirain c74d004
update
zirain fb98dea
merge loop
zirain 422b0d6
move back
zirain 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 hidden or 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 hidden or 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
82 changes: 82 additions & 0 deletions
82
internal/gatewayapi/testdata/envoyproxy-for-gatewayclass.in.yaml
This file contains hidden or 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,82 @@ | ||
| gatewayClass: | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: GatewayClass | ||
| metadata: | ||
| name: envoy-gateway-class | ||
| spec: | ||
| controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
| parametersRef: | ||
| group: gateway.envoyproxy.io | ||
| kind: EnvoyProxy | ||
| name: invalid | ||
| namespace: envoy-gateway-system | ||
| envoyProxyForGatewayClass: | ||
| apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
| kind: EnvoyProxy | ||
| metadata: | ||
| namespace: envoy-gateway | ||
| name: invalid | ||
| spec: | ||
| telemetry: | ||
| accessLog: | ||
| settings: | ||
| - format: | ||
| type: Text | ||
| text: | | ||
| [%START_TIME%] "%REQ(:METHOD)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"\n | ||
| sinks: | ||
| - type: File | ||
| - type: ALS | ||
| - type: OpenTelemetry | ||
| envoyProxiesForGateways: | ||
| - apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
| kind: EnvoyProxy | ||
| metadata: | ||
| namespace: envoy-gateway | ||
| name: valid | ||
| spec: | ||
| telemetry: | ||
| accessLog: | ||
| settings: | ||
| - format: | ||
| type: Text | ||
| text: | | ||
| [%START_TIME%] "%REQ(:METHOD)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"\n | ||
| sinks: | ||
| - type: File | ||
| file: | ||
| path: /dev/stdout | ||
| gateways: | ||
| - apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| namespace: envoy-gateway | ||
| name: ep-from-gtw | ||
| spec: | ||
| gatewayClassName: envoy-gateway-class | ||
| listeners: | ||
| - name: http | ||
| protocol: HTTP | ||
| port: 80 | ||
| allowedRoutes: | ||
| namespaces: | ||
| from: Same | ||
| infrastructure: | ||
| parametersRef: | ||
| group: gateway.envoyproxy.io | ||
| kind: EnvoyProxy | ||
| name: valid | ||
| - apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| namespace: envoy-gateway | ||
| name: ep-from-gc | ||
| spec: | ||
| gatewayClassName: envoy-gateway-class | ||
| listeners: | ||
| - name: http | ||
| protocol: HTTP | ||
| port: 80 | ||
| allowedRoutes: | ||
| namespaces: | ||
| from: Same |
190 changes: 190 additions & 0 deletions
190
internal/gatewayapi/testdata/envoyproxy-for-gatewayclass.out.yaml
This file contains hidden or 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,190 @@ | ||
| gatewayClass: | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: GatewayClass | ||
| metadata: | ||
| name: envoy-gateway-class | ||
| spec: | ||
| controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
| parametersRef: | ||
| group: gateway.envoyproxy.io | ||
| kind: EnvoyProxy | ||
| name: invalid | ||
| namespace: envoy-gateway-system | ||
| status: | ||
| conditions: | ||
| - lastTransitionTime: null | ||
| message: 'Invalid parametersRef: [unable to configure access log when using | ||
| File sink type but "file" field being empty, unable to configure access log | ||
| when using OpenTelemetry sink type but "openTelemetry" field being empty]' | ||
| reason: InvalidParameters | ||
| status: "False" | ||
| type: Accepted | ||
| gateways: | ||
| - apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| name: ep-from-gtw | ||
| namespace: envoy-gateway | ||
| spec: | ||
| gatewayClassName: envoy-gateway-class | ||
| infrastructure: | ||
| parametersRef: | ||
| group: gateway.envoyproxy.io | ||
| kind: EnvoyProxy | ||
| name: valid | ||
| listeners: | ||
| - allowedRoutes: | ||
| namespaces: | ||
| from: Same | ||
| name: http | ||
| port: 80 | ||
| protocol: HTTP | ||
| status: | ||
| listeners: | ||
| - attachedRoutes: 0 | ||
| 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 | ||
| - apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| name: ep-from-gc | ||
| namespace: envoy-gateway | ||
| spec: | ||
| gatewayClassName: envoy-gateway-class | ||
| listeners: | ||
| - allowedRoutes: | ||
| namespaces: | ||
| from: Same | ||
| name: http | ||
| port: 80 | ||
| protocol: HTTP | ||
| status: | ||
| conditions: | ||
| - lastTransitionTime: null | ||
| message: 'Invalid parametersRef:: [unable to configure access log when using | ||
| File sink type but "file" field being empty, unable to configure access log | ||
| when using OpenTelemetry sink type but "openTelemetry" field being empty]' | ||
| reason: InvalidParameters | ||
| status: "False" | ||
| type: Accepted | ||
| infraIR: | ||
| envoy-gateway/ep-from-gc: | ||
| proxy: | ||
| metadata: | ||
| labels: | ||
| gateway.envoyproxy.io/owning-gateway-name: ep-from-gc | ||
| gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway | ||
| ownerReference: | ||
| kind: GatewayClass | ||
| name: envoy-gateway-class | ||
| name: envoy-gateway/ep-from-gc | ||
| namespace: envoy-gateway-system | ||
| envoy-gateway/ep-from-gtw: | ||
| proxy: | ||
| config: | ||
| apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
| kind: EnvoyProxy | ||
| metadata: | ||
| name: valid | ||
| namespace: envoy-gateway | ||
| spec: | ||
| logging: {} | ||
| telemetry: | ||
| accessLog: | ||
| settings: | ||
| - format: | ||
| text: | | ||
| [%START_TIME%] "%REQ(:METHOD)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"\n | ||
| type: Text | ||
| sinks: | ||
| - file: | ||
| path: /dev/stdout | ||
| type: File | ||
| status: {} | ||
| listeners: | ||
| - address: null | ||
| name: envoy-gateway/ep-from-gtw/http | ||
| ports: | ||
| - containerPort: 10080 | ||
| name: http-80 | ||
| protocol: HTTP | ||
| servicePort: 80 | ||
| metadata: | ||
| labels: | ||
| gateway.envoyproxy.io/owning-gateway-name: ep-from-gtw | ||
| gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway | ||
| ownerReference: | ||
| kind: GatewayClass | ||
| name: envoy-gateway-class | ||
| name: envoy-gateway/ep-from-gtw | ||
| namespace: envoy-gateway-system | ||
| xdsIR: | ||
| envoy-gateway/ep-from-gc: {} | ||
| envoy-gateway/ep-from-gtw: | ||
| accessLog: | ||
| text: | ||
| - format: | | ||
| [%START_TIME%] "%REQ(:METHOD)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"\n | ||
| path: /dev/stdout | ||
| globalResources: | ||
| proxyServiceCluster: | ||
| metadata: | ||
| kind: Service | ||
| name: envoy-envoy-gateway-ep-from-gtw-90cb3c57 | ||
| namespace: envoy-gateway-system | ||
| sectionName: "8080" | ||
| name: envoy-gateway/ep-from-gtw | ||
| settings: | ||
| - addressType: IP | ||
| endpoints: | ||
| - host: 7.6.5.4 | ||
| port: 8080 | ||
| zone: zone1 | ||
| metadata: | ||
| kind: Service | ||
| name: envoy-envoy-gateway-ep-from-gtw-90cb3c57 | ||
| namespace: envoy-gateway-system | ||
| sectionName: "8080" | ||
| name: envoy-gateway/ep-from-gtw | ||
| protocol: TCP | ||
| http: | ||
| - address: 0.0.0.0 | ||
| externalPort: 80 | ||
| hostnames: | ||
| - '*' | ||
| isHTTP2: false | ||
| metadata: | ||
| kind: Gateway | ||
| name: ep-from-gtw | ||
| namespace: envoy-gateway | ||
| sectionName: http | ||
| name: envoy-gateway/ep-from-gtw/http | ||
| path: | ||
| escapedSlashesAction: UnescapeAndRedirect | ||
| mergeSlashes: true | ||
| port: 10080 | ||
| readyListener: | ||
| address: 0.0.0.0 | ||
| ipFamily: IPv4 | ||
| path: /ready | ||
| port: 19003 |
This file contains hidden or 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.
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.
follow up, should this be Accepted:True and ResolvedRefs:False ?
cc @zhaohuabing
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.
should we use
RefNotPermittedhere?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.
probably
ListenersNotResolved, from https://github.com/kubernetes-sigs/gateway-api/blob/8ecfe98081f74aec9eb8c44ef265380e2edb9094/apis/v1/gateway_types.go#L1323RefNotPermittedseems more scoped to ReferenceGrant issues