Skip to content

PROJQUAY-12383: fix(cmpstatus): handle unmanaged component HPAs - #1311

Open
LiZhang19817 wants to merge 1 commit into
quay:masterfrom
LiZhang19817:fix/hpa-status-managed-components-master
Open

PROJQUAY-12383: fix(cmpstatus): handle unmanaged component HPAs#1311
LiZhang19817 wants to merge 1 commit into
quay:masterfrom
LiZhang19817:fix/hpa-status-managed-components-master

Conversation

@LiZhang19817

@LiZhang19817 LiZhang19817 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix ComponentHPAReady=False / Available=False when HPA is managed but mirror or clair (or both) are unmanaged
  • Only require clair-app and quay-mirror HPAs when their backing components are managed
  • Include the missing HPA name in ComponentHPAReady failure messages for debuggability
  • Add regression test coverage for all unmanaged component combinations

Root Cause

The HPA health checker in pkg/cmpstatus/hpa.go hard-coded a loop over all three HPAs (quay-app, clair-app, quay-mirror) without checking whether the respective backing component is managed. When mirror or clair is unmanaged, kustomize never emits their HPA manifests, so the checker hits a not-found and permanently reports ComponentHPAReady=False, which cascades to Available=False — even though Quay is fully functional.

Changes

File Change
pkg/cmpstatus/hpa.go Build HPA suffix list dynamically: always include quay-app, conditionally include clair-app (if clair managed) and quay-mirror (if mirror managed). Include HPA name in not-found error message.
pkg/cmpstatus/hpa_test.go Add ownedHPA() test helper. Add 3 new test cases: clair unmanaged, mirror unmanaged, both unmanaged. Update existing "all managed" test to explicitly declare clair+mirror as managed. Update expected error message.
pkg/cmpstatus/evaluator_test.go Update expected error message to include HPA name.

Jira

Test plan

  • go test ./pkg/cmpstatus — all unit tests pass
  • Deploy QuayRegistry with horizontalpodautoscaler: managed: true, mirror: managed: false → verify ComponentHPAReady=True and Available=True
  • Deploy QuayRegistry with horizontalpodautoscaler: managed: true, clair: managed: false → verify ComponentHPAReady=True and Available=True
  • Deploy QuayRegistry with horizontalpodautoscaler: managed: true, both clair and mirror unmanaged → verify ComponentHPAReady=True
  • Deploy QuayRegistry with all components managed (default) → verify no regression, all 3 HPAs checked, Available=True
  • Verify not-found error message includes HPA name (e.g. "Horizontal pod autoscaler registry-quay-app not found")

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "tools"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

HPA evaluation now checks only managed component HPAs and reports the specific missing resource name. Tests add shared owned-HPA construction and cover Clair and Mirror management combinations.

Changes

HPA checks

Layer / File(s) Summary
Dynamic HPA evaluation
pkg/cmpstatus/hpa.go
HPA names are assembled from managed components, and missing-HPA conditions include the namespaced resource name.
HPA check validation
pkg/cmpstatus/hpa_test.go, pkg/cmpstatus/evaluator_test.go
Tests use a shared owned-HPA helper and cover managed and unmanaged Clair/Mirror combinations plus specific missing-HPA messages.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 9
✅ Passed checks (9 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Crd Backward Compatibility ✅ Passed No files under apis/quay/v1 were modified; the commit only changes pkg/cmpstatus/*, so CRD backward-compatibility checks are not applicable.
No Weak Cryptographic Algorithms ✅ Passed Modified HPA status code/tests contain no MD5/SHA-1/DES/RC4/3DES or InsecureSkipVerify usage.
No Privileged Containers ✅ Passed Touched files are HPA status code/tests only; diff search found no privileged:true, hostPID/Network/IPC, or SYS_ADMIN settings.
No Sensitive Data In Logs ✅ Passed Touched HPA files add no log.Info/Error/klog/fmt.Print* calls; only condition messages with HPA resource names, not secrets.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title starts with the required PROJQUAY ticket and accurately describes the unmanaged component HPA status change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@LiZhang19817 LiZhang19817 changed the title Fix HPA status for unmanaged components PROJQUAY-12383: fix(cmpstatus): handle unmanaged component HPAs Jul 23, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

@LiZhang19817: This pull request references [Jira Issue PROJQUAY-12383](https://redhat.atlassian.net/browse/PROJQUAY-12383), which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (quay-v3.18.0) matches configured target version for branch (quay-v3.18.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary

  • only require Clair and mirror HPAs when their backing components are managed
  • include the missing HPA name in ComponentHPAReady failure messages
  • add regression coverage for unmanaged Clair and mirror combinations

Jira

Testing

  • GOCACHE=/private/tmp/quay-hpa-review/go-build-cache go test ./pkg/cmpstatus

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.

@openshift-ci-robot

openshift-ci-robot commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

@LiZhang19817: This pull request references [Jira Issue PROJQUAY-12383](https://redhat.atlassian.net/browse/PROJQUAY-12383), which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (quay-v3.18.0) matches configured target version for branch (quay-v3.18.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary

  • only require Clair and mirror HPAs when their backing components are managed
  • include the missing HPA name in ComponentHPAReady failure messages
  • add regression coverage for unmanaged Clair and mirror combinations

Jira

Testing

  • GOCACHE=/private/tmp/quay-hpa-review/go-build-cache go test ./pkg/cmpstatus

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.

@openshift-ci-robot

openshift-ci-robot commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

@LiZhang19817: This pull request references [Jira Issue PROJQUAY-12383](https://redhat.atlassian.net/browse/PROJQUAY-12383), which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (quay-v3.18.0) matches configured target version for branch (quay-v3.18.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary

  • Fix ComponentHPAReady=False / Available=False when HPA is managed but mirror or clair (or both) are unmanaged
  • Only require clair-app and quay-mirror HPAs when their backing components are managed
  • Include the missing HPA name in ComponentHPAReady failure messages for debuggability
  • Add regression test coverage for all unmanaged component combinations

Root Cause

The HPA health checker in pkg/cmpstatus/hpa.go hard-coded a loop over all three HPAs (quay-app, clair-app, quay-mirror) without checking whether the respective backing component is managed. When mirror or clair is unmanaged, kustomize never emits their HPA manifests, so the checker hits a not-found and permanently reports ComponentHPAReady=False, which cascades to Available=False — even though Quay is fully functional.

Changes

File Change
pkg/cmpstatus/hpa.go Build HPA suffix list dynamically: always include quay-app, conditionally include clair-app (if clair managed) and quay-mirror (if mirror managed). Include HPA name in not-found error message.
pkg/cmpstatus/hpa_test.go Add ownedHPA() test helper. Add 3 new test cases: clair unmanaged, mirror unmanaged, both unmanaged. Update existing "all managed" test to explicitly declare clair+mirror as managed. Update expected error message.
pkg/cmpstatus/evaluator_test.go Update expected error message to include HPA name.

Jira

Test plan

  • go test ./pkg/cmpstatus — all unit tests pass
  • Deploy QuayRegistry with horizontalpodautoscaler: managed: true, mirror: managed: false → verify ComponentHPAReady=True and Available=True
  • Deploy QuayRegistry with horizontalpodautoscaler: managed: true, clair: managed: false → verify ComponentHPAReady=True and Available=True
  • Deploy QuayRegistry with horizontalpodautoscaler: managed: true, both clair and mirror unmanaged → verify ComponentHPAReady=True
  • Deploy QuayRegistry with all components managed (default) → verify no regression, all 3 HPAs checked, Available=True
  • Verify not-found error message includes HPA name (e.g. "Horizontal pod autoscaler registry-quay-app not found")

🤖 Generated with Claude Code

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.

@LiZhang19817
LiZhang19817 enabled auto-merge (squash) July 23, 2026 06:49
@Marcusk19 Marcusk19 self-assigned this Jul 23, 2026
@LiZhang19817

Copy link
Copy Markdown
Contributor Author

/test ocp-latest-e2e

@sridipta
sridipta requested a review from bcaton85 July 23, 2026 13:07
@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/test ocp-latest-e2e

2 similar comments
@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/test ocp-latest-e2e

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/test ocp-latest-e2e

@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown

@LiZhang19817: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ocp-latest-e2e b0f1590 link true /test ocp-latest-e2e

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants