RFE-2195: expose ROUTER_METRICS_HAPROXY_SERVER_THRESHOLD value via IngressController API#1452
RFE-2195: expose ROUTER_METRICS_HAPROXY_SERVER_THRESHOLD value via IngressController API#1452himank98 wants to merge 1 commit into
Conversation
…ingOptions.haproxyServerThreshold
|
@himank98: This pull request references RFE-2195 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the feature request to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
📝 WalkthroughWalkthroughThis PR adds support for configuring the HAProxy server Prometheus metrics threshold through a new environment variable. The change introduces an exported constant 🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @himank98. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/operator/controller/ingress/deployment_test.go (1)
3110-3122: ⚡ Quick winUse
testify/assertin the new subtest assertions.Please switch the direct
t.Fatalf/t.Errorfchecks in this new test block toassert(orrequire) to align with the test guideline for this repo.As per coding guidelines,
**/*_test.go: “Use table-driven tests with subtests using t.Run() with descriptive names for nested tests, and use github.com/stretchr/testify/assert for assertions”.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/operator/controller/ingress/deployment_test.go` around lines 3110 - 3122, Replace the raw t.Fatalf/t.Errorf in this subtest with testify assertions: import "github.com/stretchr/testify/require" and "github.com/stretchr/testify/assert" (or just one as needed), then use require.NoError(t, err, "failed to generate desired router Deployment") after calling the function that returns err (the block that generates desired router Deployment) to fail fast on error, and use assert.NoError(t, checkErr, "environment variable check failed") (where checkErr is the error returned by checkDeploymentEnvironment) instead of t.Errorf; keep references to the same variables/functions (deployment, expectedEnv, RouterMetricsHAProxyServerThreshold, checkDeploymentEnvironment) so the checks are exactly swapped to require/assert calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/operator/controller/ingress/deployment_test.go`:
- Around line 3110-3122: Replace the raw t.Fatalf/t.Errorf in this subtest with
testify assertions: import "github.com/stretchr/testify/require" and
"github.com/stretchr/testify/assert" (or just one as needed), then use
require.NoError(t, err, "failed to generate desired router Deployment") after
calling the function that returns err (the block that generates desired router
Deployment) to fail fast on error, and use assert.NoError(t, checkErr,
"environment variable check failed") (where checkErr is the error returned by
checkDeploymentEnvironment) instead of t.Errorf; keep references to the same
variables/functions (deployment, expectedEnv,
RouterMetricsHAProxyServerThreshold, checkDeploymentEnvironment) so the checks
are exactly swapped to require/assert calls.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: cb10f54e-aa55-439d-a76c-44256151a4ea
⛔ Files ignored due to path filters (1)
vendor/github.com/openshift/api/operator/v1/types_ingress.gois excluded by!**/vendor/**,!vendor/**
📒 Files selected for processing (2)
pkg/operator/controller/ingress/deployment.gopkg/operator/controller/ingress/deployment_test.go
Summary
ROUTER_METRICS_HAPROXY_SERVER_THRESHOLDcontrols the maximum number of HAProxy backends (servers) per shard for which per-server Prometheus metrics are collected. When the number of active backends exceeds this threshold,per-server metrics are suppressed to prevent high-cardinality metric explosions in the monitoring stack.
Previously this variable was hardcoded to a default of 500 inside the router image with no way to tune it via the IngressController API. This PR exposes it as
spec.tuningOptions.haproxyServerThresholdso cluster administrators can adjust the value — for example, raising it to 1000 to match the typical number of routes per shard and improve metrics coverage in large clusters.