Skip to content

fix: install KEDA HTTP add-on at 1 replica in CI - #4173

Merged
knative-prow[bot] merged 1 commit into
knative:mainfrom
Elvand-Lie:fix/ci-keda-interceptor-min
Nov 26, 2026
Merged

knative-prow[bot] merged 1 commit into
knative:mainfrom
Elvand-Lie:fix/ci-keda-interceptor-min

Conversation

@Elvand-Lie

@Elvand-Lie Elvand-Lie commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

With GITHUB_ACTIONS=true, hack/cluster.sh and func cluster create previously applied the upstream KEDA HTTP add-on manifest (v0.12.0) and scaled the Deployments down afterward. Because the add-on's ScaledObject sets minReplicaCount: 3, the HPA undoes kubectl scale --replicas=1, and patching minReplicaCount after install still starts 3 replicas and waits through the HPA's 5-minute stabilization window while tests are already running.

Configure the manifest before kubectl apply --server-side when GITHUB_ACTIONS=true, matching how networking() installs Contour: set both keda-add-ons-http-interceptor and keda-add-ons-http-scaler Deployments to replicas: 1 and the interceptor ScaledObject to minReplicaCount: 1. Non-CI installs keep the upstream defaults unchanged.

Changes

  • Fetch the release manifest and rewrite Deployment replicas and ScaledObject minReplicaCount to 1 via yq before kubectl apply --server-side -f - in hack/cluster.sh when GITHUB_ACTIONS=true
  • Mirror the same pre-apply YAML transformation in pkg/cluster/keda.go (reduceKedaHTTPAddonReplicas) and remove the post-hoc scaling block
  • Add unit tests in pkg/cluster/keda_test.go covering installKedaHTTPAddon (CI and non-CI paths) and reduceKedaHTTPAddonReplicas

/kind bug

Testing

  • go test -v -race -count=1 ./pkg/cluster/... and go vet ./pkg/cluster/... pass
  • Verified both the yq v4.50.1 pipeline (hack/cluster.sh) and reduceKedaHTTPAddonReplicas (pkg/cluster/keda.go) against the real v0.12.0 release manifest: all 23 documents match semantically and only the 3 target fields change from 3 to 1
  • bash -n hack/cluster.sh passes
  • Not run locally: live kind cluster / full CI E2E suite (exercised by CI workflows)

Release Note

NONE

Docs


@knative-prow knative-prow Bot added the kind/bug Bugs label Nov 15, 2026
@knative-prow knative-prow Bot added size/S 🤖 PR changes 10-29 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels Nov 15, 2026
@knative-prow

knative-prow Bot commented Nov 15, 2026

Copy link
Copy Markdown

Hi @Elvand-Lie. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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 kubernetes-sigs/prow repository.

@lkingland lkingland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Elvand-Lie, good catch that the HPA undoes the scale.

Instead of post-hoc patches, we should be installing the keda add-on with the right settings from the start.

For example, using the same way networking() in hack/cluster.sh installs a configured Contour: fetch the release manifest, set the interceptor's minReplicaCount and both Deployments' replicas to 1, then apply it. With this patch, the interceptor only drops about six minutes in, after the E2Es are already executing.

Assuming that works, we should open a follow-up issue to do the same for local dev clusters when func cluster create --keda!

/ok-to-test

Comment thread hack/cluster.sh Resolved
@knative-prow knative-prow Bot added the ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. label Nov 25, 2026
@knative-prow knative-prow Bot removed the needs-ok-to-test 🤖 Needs an org member to approve testing label Nov 25, 2026
In CI, applying the upstream KEDA HTTP add-on manifest starts both the
interceptor and scaler Deployments at 3 replicas and creates the
interceptor ScaledObject with minReplicaCount 3. Scaling post-hoc is
undone by the HPA, and patching minReplicaCount post-hoc still waits
for the HPA stabilization window after E2Es have started.

Transform the release manifest before server-side apply when
GITHUB_ACTIONS=true, setting both Deployments' replicas and the
interceptor ScaledObject's minReplicaCount to 1 in both hack/cluster.sh
and pkg/cluster/keda.go. Add unit tests covering installKedaHTTPAddon
and reduceKedaHTTPAddonReplicas.

Signed-off-by: Elvand Lie Nababan <elvandlie@gmail.com>
@Elvand-Lie
Elvand-Lie force-pushed the fix/ci-keda-interceptor-min branch from 57c6765 to 36fa71f Compare November 25, 2026 18:25
@knative-prow knative-prow Bot added size/XL 🤖 PR changes 500-999 lines, ignoring generated files. and removed size/S 🤖 PR changes 10-29 lines, ignoring generated files. labels Nov 25, 2026
@Elvand-Lie Elvand-Lie changed the title fix: lower the KEDA interceptor minimum in CI instead of scaling it fix: install KEDA HTTP add-on at 1 replica in CI Nov 25, 2026
@Elvand-Lie

Copy link
Copy Markdown
Contributor Author

Thanks @lkingland, updated to configure the KEDA HTTP add-on manifest before kubectl apply --server-side in both hack/cluster.sh (via yq, matching networking()) and pkg/cluster/keda.go (reduceKedaHTTPAddonReplicas), removing the post-hoc scale/patch block. Both Deployments (keda-add-ons-http-interceptor, keda-add-ons-http-scaler) and the interceptor ScaledObject minReplicaCount are now set to 1 from the start when GITHUB_ACTIONS=true.

Once CI confirms this works cleanly, I'll open the follow-up issue for local dev clusters with func cluster create --keda.

@lkingland

Copy link
Copy Markdown
Member

Thanks @Elvand-Lie, this is what I had in mind, and CI ran through the new install path cleanly.

/lgtm
/approve

@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label Nov 26, 2026
@knative-prow

knative-prow Bot commented Nov 26, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Elvand-Lie, lkingland

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added the approved 🤖 PR has been approved by an approver from all required OWNERS files. label Nov 26, 2026
@knative-prow
knative-prow Bot merged commit 9bd66b2 into knative:main Nov 26, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. kind/bug Bugs lgtm 🤖 PR is ready to be merged. ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/XL 🤖 PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants