-
Notifications
You must be signed in to change notification settings - Fork 2
feat: fallback to endpoints when endpointslice disable #216
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]>
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
conformance test report - apisix-standalone modeapiVersion: gateway.networking.k8s.io/v1
date: "2025-08-01T07:10:48Z"
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-08-01T07:12:54Z"
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:
- HTTPRouteMatchingAcrossRoutes
result: failure
skippedTests:
- HTTPRouteHTTPSListener
statistics:
Failed: 1
Passed: 31
Skipped: 1
name: GATEWAY-HTTP
summary: Core tests failed with 1 test failures. |
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-08-01T07:14:26Z"
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. |
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 adds fallback support for Kubernetes 1.18 clusters by implementing compatibility with the Endpoints API when EndpointSlice API is not available. The implementation detects EndpointSlice API support at runtime and gracefully falls back to using Endpoints API for service discovery.
Key Changes:
- Added runtime detection of EndpointSlice API availability and fallback to Endpoints API
- Created utility function to convert Endpoints to EndpointSlice format for internal consistency
- Updated RBAC permissions to include endpoints resource access
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/endpoints.go | New utility function to convert Endpoints objects to EndpointSlice format |
| pkg/utils/cluster.go | Updated API resource detection to use controller-runtime's apiutil |
| internal/controller/*.go | Added EndpointSlice support detection and conditional watching/processing |
| test/e2e/framework/manifests/ingress.yaml | Added endpoints RBAC permissions |
| config/rbac/role.yaml | Updated RBAC role to include endpoints access |
| test/e2e/crds/v2/route.go | Refactored test assertion method call |
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
Signed-off-by: Ashing Zheng <[email protected]>
| predicate.Or( | ||
| predicate.GenerationChangedPredicate{}, | ||
| predicate.AnnotationChangedPredicate{}, | ||
| predicate.NewPredicateFuncs(TypePredicate[*corev1.Endpoints]()), |
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.
When supportsEndpointSlice is true, it is redundant.
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.
| terr = err | ||
| continue | ||
| // Conditionally collect EndpointSlice or Endpoints based on cluster API support | ||
| if r.supportsEndpointSlice { |
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.
Can this logic be abstracted into a function for reuse.
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.
pkg/utils/endpoints.go
Outdated
|
|
||
| for i, subset := range ep.Subsets { | ||
| // Create ports array | ||
| var ports []discoveryv1.EndpointPort |
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.
Can be pre allocated.
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: