-
Notifications
You must be signed in to change notification settings - Fork 1
feat: support apisix global rule #163
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 <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-06-12T09:38: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:
failedTests:
- HTTPRouteCrossNamespace
- HTTPRouteMatchingAcrossRoutes
result: failure
skippedTests:
- HTTPRouteHTTPSListener
statistics:
Failed: 2
Passed: 30
Skipped: 1
name: GATEWAY-HTTP
summary: Core tests failed with 2 test failures. |
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-06-12T09:37:49Z"
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:
- HTTPRouteCrossNamespace
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 <[email protected]>
Signed-off-by: ashing <[email protected]>
secretRef := gatewayProxy.Spec.Provider.ControlPlane.Auth.AdminKey.ValueFrom.SecretKeyRef | ||
secret := &corev1.Secret{} |
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.
有个问题想问下,gatewayproxy 引用的 secret 发生了变化,会触发 apisixglobalrule 的 Reconcile 吗?
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.
Currently not, the previous implementations should not have considered this either.
ref: #109
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[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 support for the Apisix Global Rule by extending the ADC provider, cache interface, controllers, CRDs, and associated APIs. It introduces new methods for managing global rules in cache, a new ApisixGlobalRuleReconciler implementation, and updates to configuration samples and CRD definitions.
- Added global rule methods to the cache and provider interfaces.
- Integrated ApisixGlobalRule handling in the ADC client and created a new controller.
- Updated CRD defaults, API types, and configuration samples to support global rule functionality.
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
internal/provider/adc/cache/cache.go | Added new global rule methods to the Cache interface. |
internal/provider/adc/adc.go | Extended ADC client logic to process ApisixGlobalRule resources. |
internal/controller/apisixglobalrule_controller.go | Implemented the ApisixGlobalRuleReconciler with comprehensive reconciliation, status updates, and event filtering. |
config/samples/config.yaml | Changed the secure_metrics configuration from an empty string to a boolean. |
Other CRD and API files | Updated relevant CRD definitions and API types to incorporate global rule support. |
Comments suppressed due to low confidence (1)
config/samples/config.yaml:28
- Verify that changing 'secure_metrics' from an empty string to a boolean does not break existing configurations, and update the related documentation accordingly.
secure_metrics: false
internal/provider/adc/adc.go
Outdated
if obj.GetObjectKind().GroupVersionKind().Group == "apisix.apache.org" && | ||
obj.GetObjectKind().GroupVersionKind().Version == "v2" { | ||
log.Debugw("api version is v2, skip sync", zap.Any("obj", obj)) | ||
return nil | ||
} |
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.
if obj.GetObjectKind().GroupVersionKind().Group == "apisix.apache.org" && | |
obj.GetObjectKind().GroupVersionKind().Version == "v2" { | |
log.Debugw("api version is v2, skip sync", zap.Any("obj", obj)) | |
return nil | |
} | |
if obj.GetObjectKind().GroupVersionKind().GroupVersion() == apiv2.GroupVersion { | |
log.Debugw("api version is v2, skip sync", zap.Any("obj", obj)) | |
return nil | |
} |
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.
Done.
Signed-off-by: ashing <[email protected]>
tctx.ResourceParentRefs[globalRuleKind] = append(tctx.ResourceParentRefs[globalRuleKind], ingressClassKind) | ||
|
||
// check if the provider field references a secret | ||
if gatewayProxy.Spec.Provider != nil && gatewayProxy.Spec.Provider.Type == v1alpha1.ProviderTypeControlPlane { |
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.
v2 API 会有 gatewayProxy.Spec.Provider.Type == v1alpha1.ProviderTypeControlPlane
的情况吗?
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.
Currently, there is only this type. we can consider whether it is necessary to differentiate.
Signed-off-by: ashing [email protected]
support apisix global rule