Skip to content
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

feat: support ingress translator #78

Merged
merged 14 commits into from
Apr 7, 2025
Merged

Conversation

ronething
Copy link
Contributor

Signed-off-by: ashing [email protected]

Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
@ronething ronething requested a review from Copilot March 31, 2025 10:36
Copy link

@Copilot 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 PR introduces ingress translator support by extending the translation context with Service resources and adding logic to convert Ingress resources into corresponding ADC objects.

  • Add a Services map in TranslateContext to manage Service objects.
  • Implement and enhance the ingress translation including TLS handling, route generation, and endpoint slice processing.
  • Update controller logic to integrate the new Service processing and adjust resource deletion and indexing.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/provider/provider.go Adds Services map to TranslateContext to support ingress translation.
internal/provider/adc/translator/ingress.go Implements ingress translation logic including TLS, service, and route creation.
internal/provider/adc/translator/gateway.go Adjusts TLS handling logic for gateway translation.
internal/provider/adc/adc.go Updates ADC deletion logic to include Ingress resources.
internal/controller/ingress_controller.go Updates controller to process Service objects and handle nil secret data.
internal/controller/indexer/indexer.go Minor reordering of constant definitions.
api/adc/types.go Modifies JSON serialization behavior for Upstream Nodes.
Comments suppressed due to low confidence (1)

internal/provider/adc/translator/ingress.go:194

  • Parameter 'servciePort' appears to be misspelled; consider renaming it to 'servicePort' for improved readability.
func (t *Translator) translateEndpointSliceForIngress(weight int, endpointSlices []discoveryv1.EndpointSlice, servciePort *corev1.ServicePort) adctypes.UpstreamNodes {

Copy link

github-actions bot commented Mar 31, 2025

conformance test report

apiVersion: gateway.networking.k8s.io/v1
date: "2025-04-07T17:19:28Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
  contact: null
  organization: API7
  project: api7-ingress-controller
  url: https://github.com/api7/api7-ingress-controller.git
  version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
    failedTests:
    - HTTPRoutePathMatchOrder
    - HTTPRouteRedirectHostAndStatus
    - HTTPRouteSimpleSameNamespace
    result: failure
    skippedTests:
    - GatewayInvalidTLSConfiguration
    - GatewaySecretInvalidReferenceGrant
    - GatewaySecretMissingReferenceGrant
    - GatewaySecretReferenceGrantAllInNamespace
    - GatewaySecretReferenceGrantSpecific
    - HTTPRouteExactPathMatching
    - HTTPRouteHTTPSListener
    - HTTPRouteHeaderMatching
    - HTTPRouteHostnameIntersection
    - HTTPRouteInvalidBackendRefUnknownKind
    - HTTPRouteInvalidCrossNamespaceBackendRef
    - HTTPRouteInvalidCrossNamespaceParentRef
    - HTTPRouteInvalidNonExistentBackendRef
    - HTTPRouteInvalidParentRefNotMatchingSectionName
    - HTTPRouteInvalidReferenceGrant
    - HTTPRouteListenerHostnameMatching
    - HTTPRouteMatching
    - HTTPRouteMatchingAcrossRoutes
    - HTTPRoutePartiallyInvalidViaInvalidReferenceGrant
    - HTTPRouteReferenceGrant
    - HTTPRouteRequestHeaderModifier
    - HTTPRouteWeight
    statistics:
      Failed: 3
      Passed: 8
      Skipped: 22
  name: GATEWAY-HTTP
  summary: Core tests failed with 3 test failures.

@ronething ronething requested a review from AlinsRan April 7, 2025 01:18
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
@ronething ronething requested a review from AlinsRan April 7, 2025 10:12
@AlinsRan AlinsRan requested a review from Copilot April 7, 2025 11:48
Copy link

@Copilot 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.

Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.

Files not reviewed (3)
  • Makefile: Language not supported
  • test/e2e/framework/manifests/cert.pem: Language not supported
  • test/e2e/framework/manifests/key.pem: Language not supported
Comments suppressed due to low confidence (2)

api/adc/types.go:151

  • Removing 'omitempty' from the Nodes field may cause issues when the nodes list is empty; verify that this change is intentional and that downstream consumers can handle an empty list.
Nodes        UpstreamNodes `json:"nodes" yaml:"nodes"`

test/e2e/ingress/ingress.go:67

  • [nitpick] Using fixed sleep durations can lead to flaky tests; consider using a polling mechanism or wait function to reliably detect when resources are ready.
time.Sleep(5 * time.Second)

@ronething ronething merged commit 2d3e218 into release-v2-dev Apr 7, 2025
8 checks passed
@ronething ronething deleted the feat/ingress_translator branch April 7, 2025 17:24
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.

2 participants