Skip to content

Conversation

@wklken
Copy link
Collaborator

@wklken wklken commented Oct 15, 2025

Description

  • 增加 apisix model

Checklist

  • 填写 PR 描述及相关 issue (write PR description and related issue)
  • 代码风格检查通过 (code style check passed)
  • PR 中包含单元测试 (include unit test)
  • 单元测试通过 (unit test passed)
  • 本地开发联调环境验证通过 (local development environment verification passed)

@wklken wklken requested a review from Copilot October 17, 2025 14:21
Copy link
Contributor

Copilot AI left a 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.

@wklken wklken requested a review from Copilot October 21, 2025 12:31
Copy link
Contributor

Copilot AI left a 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.

Comment on lines 83 to 105

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
Copy link

Copilot AI Oct 21, 2025

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.

Suggested change
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 uses AI. Check for mistakes.
@wklken wklken requested a review from Han-Ya-Jun October 23, 2025 04:02
@wklken wklken requested review from F-cq and Copilot October 23, 2025 04:02
@wklken wklken marked this pull request as ready for review October 23, 2025 04:02
Copy link
Contributor

Copilot AI left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant