-
Notifications
You must be signed in to change notification settings - Fork 2
feat: skip setup gateway api related controllers when cluster not support #215
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
Conversation
Signed-off-by: Ashing Zheng <[email protected]>
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-07-30T02:31:40Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
contact: null
organization: APISIX
project: apisix-ingress-controller
url: https://github.com/apache/apisix-ingress-controller.git
version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
result: partial
skippedTests:
- HTTPRouteHTTPSListener
statistics:
Failed: 0
Passed: 32
Skipped: 1
name: GATEWAY-HTTP
summary: Core tests partially succeeded with 1 test skips. |
conformance test report - apisix modeapiVersion: gateway.networking.k8s.io/v1
date: "2025-07-30T02:29:05Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
contact: null
organization: APISIX
project: apisix-ingress-controller
url: https://github.com/apache/apisix-ingress-controller.git
version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
failedTests:
- HTTPRouteInvalidBackendRefUnknownKind
result: failure
skippedTests:
- HTTPRouteHTTPSListener
statistics:
Failed: 1
Passed: 31
Skipped: 1
name: GATEWAY-HTTP
summary: Core tests failed with 1 test failures. |
conformance test report - apisix-standalone modeapiVersion: gateway.networking.k8s.io/v1
date: "2025-07-30T02:27:58Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
contact: null
organization: APISIX
project: apisix-ingress-controller
url: https://github.com/apache/apisix-ingress-controller.git
version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
failedTests:
- HTTPRouteInvalidBackendRefUnknownKind
result: failure
skippedTests:
- HTTPRouteHTTPSListener
statistics:
Failed: 1
Passed: 31
Skipped: 1
name: GATEWAY-HTTP
summary: Core tests failed with 1 test failures. |
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
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.
Pull Request Overview
This PR implements conditional controller registration based on cluster API resource availability, specifically skipping Gateway API controllers when the cluster doesn't support these resources.
- Adds utility functions to detect API resource availability in the cluster
- Refactors controller setup to conditionally register Gateway API controllers
- Comments out ADC_VERSION in CI workflows
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/utils/cluster.go | New utility functions for API resource detection using discovery client |
| internal/manager/controllers.go | Refactored controller setup with conditional registration logic |
| .github/workflows/apisix-e2e-test.yml | Comments out ADC_VERSION environment variable |
| .github/workflows/apisix-conformance-test.yml | Comments out ADC_VERSION environment variable |
Signed-off-by: Ashing Zheng <[email protected]>
internal/manager/controllers.go
Outdated
| var controllers []Controller | ||
|
|
||
| // Gateway API Controllers - conditional registration based on API availability | ||
| if utils.HasAPIResource(mgr, &gatewayv1.GatewayClass{}) { |
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.
The logic here is basically similar, we can write it like this:
controllers := []Controller{}
for resource, controller := range map[client.Object]Controller{
&gatewayv1.GatewayClass{}: &controller.GatewayClassReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Updater: updater,
},
&gatewayv1.Gateway{}: &controller.GatewayReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Updater: updater,
},
} {
if !utils.HasAPIResource(mgr, resource) {
// log
} else {
controllers = append(controllers, controller)
}
}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.
updated.
Signed-off-by: Ashing Zheng <[email protected]>
Type of change:
What this PR does / why we need it:
Pre-submission checklist: