Skip to content

Conversation

@dspo
Copy link
Contributor

@dspo dspo commented Apr 30, 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:

chore: Add support for Secret resources in Gateway reconciliation

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 April 30, 2025 14:30
Refactored the `SetupIndexer` function to use a loop for registering indexers, added a new `setupGatewaySecretIndex` function, and implemented secret watching in the Gateway reconciler. These changes improve code maintainability and enable dynamic reconciliation of Gateways when referenced secrets are updated.
@dspo dspo requested a review from Copilot April 30, 2025 07: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

This PR introduces support for Secret resources within Gateway reconciliation, alongside minor naming corrections and additional indexing/watching of Secret objects. Key changes include:

  • Fixing typos in variable names within end-to-end test files.
  • Adding a new secret indexer and corresponding indexing function in the controller.
  • Updating the Gateway controller to watch and reconcile Secret resources.

Reviewed Changes

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

File Description
test/e2e/gatewayapi/gateway.go Corrected variable naming typos and added secret update tests.
internal/controller/utils.go Added a helper (FullTypeName) and defined KindSecret constant.
internal/controller/indexer/indexer.go Introduced new secret indexer functions to support Secret resource lookup.
internal/controller/gateway_controller.go Updated manager setup to watch Secrets and handle them in reconciliation.
Comments suppressed due to low confidence (1)

internal/controller/gateway_controller.go:46

  • [nitpick] Add a code comment explaining the rationale for including Secret objects in the watch predicate to aid future maintainers.
WithEventFilter(predicate.Or(predicate.GenerationChangedPredicate{}, predicate.NewPredicateFuncs(func(obj client.Object) bool {

}
return nil
}

Copy link

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding inline documentation for setupGatewaySecretIndex to clarify its purpose and expected behavior for indexing Secret resources.

Suggested change
// setupGatewaySecretIndex creates an index for Gateway resources based on their associated Secrets.
// This index allows quick lookups of Gateways that reference specific Secrets, using the custom
// GatewaySecretIndexFunc to generate the index keys.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

conformance test report

apiVersion: gateway.networking.k8s.io/v1
date: "2025-04-30T07:45:57Z"
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:
    result: partial
    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: 0
      Passed: 11
      Skipped: 22
  name: GATEWAY-HTTP
  summary: Core tests partially succeeded with 22 test skips.

@dspo dspo requested a review from AlinsRan April 30, 2025 07:49
@dspo dspo merged commit bc6ef45 into release-v2-dev Apr 30, 2025
8 checks passed
@AlinsRan AlinsRan deleted the chore/update-ssl-on-secret-changing-by-watching-secret branch May 8, 2025 07:21
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