-
Couldn't load subscription status.
- Fork 36
feat(controller/models): add apisix models #1894
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
base: ft_remove_crds
Are you sure you want to change the base?
feat(controller/models): add apisix models #1894
Conversation
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 pull request adds Apache APISIX models to replace the existing v1beta1 Kubernetes CRDs, implementing a new architecture for API gateway resource management. The change represents a significant refactor from CRD-based to APISIX-native model definitions.
Key Changes:
- Introduces new APISIX-native models (Service, Route, SSL, Proto, PluginMetadata) with Pydantic validation
- Replaces v1beta1 CRD convertors with new APISIX resource convertors
- Removes deprecated MicroGateway manager and related test infrastructure
- Updates registry interfaces to work with ApisixModel instead of KubernetesResource
Reviewed Changes
Copilot reviewed 88 out of 90 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/dashboard/apigateway/apigateway/controller/models/ |
New APISIX model definitions with comprehensive validation |
src/dashboard/apigateway/apigateway/controller/convertor/ |
New convertor implementation for APISIX resources |
src/dashboard/apigateway/apigateway/controller/registry/ |
Updated registry interfaces for APISIX models |
src/dashboard/apigateway/apigateway/controller/transformer.py |
New transformer orchestrating APISIX resource conversion |
| Various test files | Cleanup of deprecated v1beta1 and MicroGateway tests |
Comments suppressed due to low confidence (1)
src/dashboard/apigateway/apigateway/controller/convertor/service.py:1
- Debug logging statement using
logger.error()should be removed or changed to appropriate log level (debug/info) before production.
#
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/dashboard/apigateway/apigateway/controller/registry/etcd.py
Outdated
Show resolved
Hide resolved
src/dashboard/apigateway/apigateway/controller/convertor/route.py
Outdated
Show resolved
Hide resolved
src/dashboard/apigateway/apigateway/controller/convertor/route.py
Outdated
Show resolved
Hide resolved
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
Copilot reviewed 109 out of 114 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| if __name__ == "__main__": | ||
| # Example usage and testing | ||
| vars_dict = {"stage": "prod", "version": "v1"} | ||
|
|
||
| # Test URIRender | ||
| uri_renderer = URIRender() | ||
| source_uri = "/api/{env.stage}/{env.version}/users/{userId}/profile" | ||
| result_uri = uri_renderer.render(source_uri, vars_dict) | ||
| print(f"URIRender: {source_uri} -> {result_uri}") | ||
| # Expected: /api/prod/v1/users/:userId/profile | ||
|
|
||
| # Test UpstreamURIRender | ||
| upstream_renderer = UpstreamURIRender() | ||
| result_upstream = upstream_renderer.render(source_uri, vars_dict) | ||
| print(f"UpstreamURIRender: {source_uri} -> {result_upstream}") | ||
| # Expected: /api/prod/v1/users/${userId}/profile | ||
|
|
||
| # Test with missing variables | ||
| incomplete_vars = {"stage": "dev"} | ||
| result_incomplete = uri_renderer.render(source_uri, incomplete_vars) | ||
| print(f"With incomplete vars: {source_uri} -> {result_incomplete}") | ||
| # Expected: /api/dev/{env.version}/users/:userId/profile |
Copilot
AI
Oct 21, 2025
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.
Remove the if __name__ == '__main__' block from production code. This example/testing code should be moved to a separate test file or removed entirely.
| if __name__ == "__main__": | |
| # Example usage and testing | |
| vars_dict = {"stage": "prod", "version": "v1"} | |
| # Test URIRender | |
| uri_renderer = URIRender() | |
| source_uri = "/api/{env.stage}/{env.version}/users/{userId}/profile" | |
| result_uri = uri_renderer.render(source_uri, vars_dict) | |
| print(f"URIRender: {source_uri} -> {result_uri}") | |
| # Expected: /api/prod/v1/users/:userId/profile | |
| # Test UpstreamURIRender | |
| upstream_renderer = UpstreamURIRender() | |
| result_upstream = upstream_renderer.render(source_uri, vars_dict) | |
| print(f"UpstreamURIRender: {source_uri} -> {result_upstream}") | |
| # Expected: /api/prod/v1/users/${userId}/profile | |
| # Test with missing variables | |
| incomplete_vars = {"stage": "dev"} | |
| result_incomplete = uri_renderer.render(source_uri, incomplete_vars) | |
| print(f"With incomplete vars: {source_uri} -> {result_incomplete}") | |
| # Expected: /api/dev/{env.version}/users/:userId/profile |
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
Copilot reviewed 108 out of 113 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Description
Checklist