Skip to content

feat: support apisixupstream#168

Merged
dspo merged 10 commits into
release-v2-devfrom
feat/apisixupstream
Jun 19, 2025
Merged

feat: support apisixupstream#168
dspo merged 10 commits into
release-v2-devfrom
feat/apisixupstream

Conversation

@dspo
Copy link
Copy Markdown
Contributor

@dspo dspo commented Jun 18, 2025

Type of change:

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches
  • Documentation
  • Refactor
  • Chore
  • CI/CD or Tests

What this PR does / why we need it:

实现了 ApisixRoute 引用 ApisixUpstream 的基本业务逻辑和添加了基本的测试。
更多的细节和测试在下个 PR 中提出。

.Status 在这个 PR 中被删除了,将在下个 PR 中增加回来。

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

dspo added 4 commits June 17, 2025 16:10
…eam handling

- Remove legacy ApisixUpstream controller.
- Update related CRDs and deepcopy functions.
- Add new translator logic for ApisixUpstream.
- Introduce indexing and mapping logic for ApisixUpstream in ApisixRoute reconciliation.
- Implement `translateApisixUpstream` to support ApisixUpstream translation.
- Add handling for externalNodes with types Domain and Service.
- Update ApisixRoute translator to integrate ApisixUpstream references.
- Introduce `SchemeToPort` and `MatchHostDef` utility functions for validation and defaults.
- Enable e2e tests for ApisixRoute referencing ApisixUpstream.
- Moved HTTP rule handling to `processApisixRouteHTTPRule` for improved modularity.
- Updated ApisixRoute controller to integrate the new function.
- Enhanced indexing for ApisixRoute to include ApisixUpstream secrets and services.
- Refactored e2e tests to validate updated ApisixRoute and ApisixUpstream logic.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 18, 2025

conformance test report

apiVersion: gateway.networking.k8s.io/v1
date: "2025-06-18T12:47:46Z"
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.

@dspo dspo requested a review from Copilot June 18, 2025 01:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 18, 2025

conformance test report

apiVersion: gateway.networking.k8s.io/v1
date: "2025-06-18T12:53:34Z"
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.

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

Adds support for referencing ApisixUpstream from ApisixRoute, including CRD updates, translation logic, controller/indexer adjustments, and an end-to-end test.

  • Enable and implement ApisixRouteApisixUpstream lookup and translation in ADC translator and controller
  • Introduce MatchHostDef for validating domain names and update CRD/types for upstream retries
  • Add an e2e test covering externalName vs non-externalName service behavior

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/e2e/apisix/route.go Unskip and implement e2e test for ApisixRoute referencing upstream
internal/utils/k8s.go Add MatchHostDef regex and helper
internal/provider/provider.go Track Upstreams in translation context
internal/provider/adc/translator/apisixupstream.go New translator for ApisixUpstream
internal/provider/adc/translator/apisixroute.go Extend route translator to use ApisixUpstream data
internal/controller/indexer/indexer.go Add field index for ApisixUpstream and update service/secret indexes
internal/controller/apisixupstream_controller.go Remove stub reconciler (status subresource removed)
internal/controller/apisixroute_controller.go Wire up ApisixUpstream watch and loading in reconciler
config/crd/bases/apisix.apache.org_apisixupstreams.yaml Update format for retries, remove status subresource
api/v2/shared_types.go Add protocol/scheme, load-balancer, hashing constants
api/v2/apisixupstream_types.go Change Retries to *int64 and remove status field
api/v2/zz_generated.deepcopy.go Adjust deep-copy logic for updated types
api/adc/types.go & zz_generated.deepcopy.go Add health-check, TLS, discovery, traffic-split fields and deep-copies
Comments suppressed due to low confidence (1)

api/v2/shared_types.go:123

  • [nitpick] The comment for PassHostNode is incorrect (it mentions PassHostPass). Please update the comment to describe Node correctly.
	// PassHostPass represents node option for pass_host Upstream settings.

Comment thread test/e2e/apisix/route.go Outdated
Comment thread internal/utils/k8s.go Outdated
Comment thread internal/provider/adc/translator/apisixroute.go Outdated
dspo added 2 commits June 18, 2025 09:30
…lators

- Removed redundant `apisixUpstreams` and `adcUpstreams` variables in ApisixRoute translator logic for clarity.
- Streamlined upstream handling and variable naming in traffic-split logic.
- Updated TODO comments to reflect upcoming `.Checks`, `.TLS`, and `.Discovery*` implementations.
@dspo dspo requested a review from ronething June 18, 2025 01:33
Comment thread test/e2e/apisix/route.go Outdated
…ests

- Refactor `NewDefaultUpstream` initialization for streamlined field ordering.
- Update e2e framework's `GetServiceEndpoints` to accept `types.NamespacedName`.
- Incorporate upstream weights into traffic-split logic, including default handling and labels.
- Add comprehensive e2e tests for mixed backend and upstream scenarios.
@dspo dspo requested a review from ronething June 18, 2025 09:41
Comment thread internal/provider/adc/translator/apisixroute.go Outdated
dspo added 2 commits June 18, 2025 20:22
…upstream

# Conflicts:
#	internal/controller/apisixroute_controller.go
#	internal/controller/indexer/indexer.go
#	internal/provider/adc/translator/apisixroute.go
Copy link
Copy Markdown
Contributor

@ronething ronething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dspo dspo merged commit b55be27 into release-v2-dev Jun 19, 2025
16 of 19 checks passed
@ronething ronething deleted the feat/apisixupstream branch June 19, 2025 06:35
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.

3 participants