Skip to content

Conversation

didierofrivia
Copy link
Member

@didierofrivia didierofrivia commented Mar 26, 2025

Closes #1200

This PR introduces a way to configure multiple controller names, as in GatewayClass.ControllerName exposing an environment variable per Gateway implementation, ISTIO_GATEWAY_CONTROLLER_NAMES and ENVOY_GATEWAY_GATEWAY_CONTROLLER_NAMES respectively. Which configures the operator to also reconcile with multiple custom names, i.e:

ISTIO_GATEWAY_CONTROLLER_NAMES= istio.io/gateway-controller-alpha1, istio.io/gateway-controller-rc2

Kuadrant operator will reconcile not only the controllers defined in the env var, but also the default one istio.io/gateway-controller

Notes

  • Should we document this? and if so, how/where?
  • To configure this on Helm Charts/OLM would be best to have a different issue, since it's a much bigger topic, at least with helm values.yml

@didierofrivia didierofrivia force-pushed the custom-gateway-controller-names branch from 9eaa61a to 07c5858 Compare March 26, 2025 16:11
@didierofrivia didierofrivia moved this to In Progress in Kuadrant Mar 26, 2025
@didierofrivia didierofrivia self-assigned this Mar 26, 2025
@didierofrivia didierofrivia added the kind/enhancement New feature or request label Mar 26, 2025
Copy link

codecov bot commented Mar 26, 2025

Codecov Report

Attention: Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.

Project coverage is 77.12%. Comparing base (1e6ee22) to head (c97a5fc).
Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
...l/controller/envoy_gateway_extension_reconciler.go 0.00% 0 Missing and 1 partial ⚠️
internal/controller/istio_extension_reconciler.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1240      +/-   ##
==========================================
- Coverage   77.46%   77.12%   -0.34%     
==========================================
  Files          82       82              
  Lines        7388     7406      +18     
==========================================
- Hits         5723     5712      -11     
- Misses       1477     1497      +20     
- Partials      188      197       +9     
Flag Coverage Δ
bare-k8s-integration 28.82% <22.22%> (+0.04%) ⬆️
controllers-integration 76.64% <80.55%> (-0.44%) ⬇️
envoygateway-integration 44.40% <50.00%> (+0.41%) ⬆️
gatewayapi-integration 22.34% <22.22%> (-0.51%) ⬇️
istio-integration 46.82% <44.44%> (-0.34%) ⬇️
unit 18.55% <44.44%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api/v1beta1 (u) 90.78% <ø> (ø)
api/v1beta2 (u) ∅ <ø> (∅)
pkg/common (u) ∅ <ø> (∅)
pkg/istio (u) ∅ <ø> (∅)
pkg/log (u) ∅ <ø> (∅)
pkg/reconcilers (u) ∅ <ø> (∅)
pkg/rlptools (u) ∅ <ø> (∅)
controllers (i) ∅ <ø> (∅)
Files with missing lines Coverage Δ
internal/controller/auth_policy_status_updater.go 88.51% <100.00%> (+0.05%) ⬆️
...nternal/controller/data_plane_policies_workflow.go 100.00% <100.00%> (ø)
...ontroller/envoy_gateway_auth_cluster_reconciler.go 77.62% <100.00%> (-2.80%) ⬇️
...ller/envoy_gateway_ratelimit_cluster_reconciler.go 80.28% <100.00%> (ø)
...ternal/controller/istio_auth_cluster_reconciler.go 81.11% <100.00%> (ø)
...l/controller/istio_ratelimit_cluster_reconciler.go 79.45% <100.00%> (ø)
internal/controller/observability_reconciler.go 93.70% <100.00%> (-2.10%) ⬇️
...rnal/controller/ratelimit_policy_status_updater.go 87.34% <100.00%> (-1.84%) ⬇️
...l/controller/envoy_gateway_extension_reconciler.go 83.54% <0.00%> (ø)
internal/controller/istio_extension_reconciler.go 86.89% <0.00%> (ø)

... and 64 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@didierofrivia didierofrivia force-pushed the custom-gateway-controller-names branch 4 times, most recently from e7e68ec to 95a1ad6 Compare March 27, 2025 11:06

func getGatewayControllerNames(envName string, defaultGatewayControllerName string) []gatewayapiv1.GatewayController {
envValue := env.GetString(envName, defaultGatewayControllerName)
gatewayControllers := utils.Map(strings.Split(envValue, ","), func(c string) gatewayapiv1.GatewayController {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please use github.com/samber/lo here and avoid importing another package?

Copy link
Member Author

Choose a reason for hiding this comment

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

is there any equivalent to strings.Split in lo ?

Copy link
Contributor

Choose a reason for hiding this comment

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

There is nothing wrong with utils.Map. As long as it is there, we are free to use it.

@guicassolato if you think github.com/samber/lo is a better library than 4 lines of code on our own repo, be my guest and open a PR deleting the utils.Map function from the repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think he means to avoid including strings and slices and use the already imported github.com/samber/lo

Copy link
Contributor

Choose a reason for hiding this comment

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

strings and slices packages come from the standard library, which is always more stable and performant than any other third party lib.

@guicassolato can you clarify your request?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we could decide if it makes sense to remove the slice utils in favor of lo (not as part of this PR tho)

@didierofrivia didierofrivia force-pushed the custom-gateway-controller-names branch from 95a1ad6 to d63d1ac Compare March 31, 2025 10:14
@didierofrivia didierofrivia marked this pull request as ready for review March 31, 2025 12:45
@didierofrivia didierofrivia requested a review from a team as a code owner March 31, 2025 12:45
@didierofrivia didierofrivia moved this from In Progress to Ready For Review in Kuadrant Mar 31, 2025
@didierofrivia didierofrivia force-pushed the custom-gateway-controller-names branch from d63d1ac to 3c48a8e Compare March 31, 2025 17:21
eguzki
eguzki previously approved these changes Apr 2, 2025
Copy link
Contributor

@eguzki eguzki left a comment

Choose a reason for hiding this comment

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

LGTM

🥇

@maleck13
Copy link
Collaborator

maleck13 commented Apr 4, 2025

@didierofrivia are we good to merge here? This will allow @trepel etc to start testing with 4.19 hopefully

@didierofrivia didierofrivia added this pull request to the merge queue Apr 7, 2025
Merged via the queue into main with commit 8997497 Apr 7, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Kuadrant Apr 7, 2025
@didierofrivia didierofrivia deleted the custom-gateway-controller-names branch April 7, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Custom Gateway Controller Names
4 participants