RFE-3935: Add non-scalable image warning when scaling workloads#16436
RFE-3935: Add non-scalable image warning when scaling workloads#16436swshende-cmd wants to merge 4 commits into
Conversation
Warn users when scaling a workload beyond one replica if its container image has the io.openshift.non-scalable=true label. The warning appears as an inline alert in the Edit Pod count modal and as a tooltip on the PodRing scale-up button. Adds a useNonScalableImageCheck hook that resolves ImageStreamTag references from Deployment trigger annotations or DeploymentConfig ImageChange triggers, fetches the IST, and inspects image.dockerImageMetadata.Config.Labels for the non-scalable label. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@swshende-cmd: This pull request references RFE-3935 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: swshende-cmd 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 @swshende-cmd. 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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a hook to detect ImageStreamTags labeled ChangesNon-scalable image detection and UI warnings
sequenceDiagram
participant UI as UI (PodRing / Modal)
participant Hook as useNonScalableImageCheck
participant API as kube API / k8sGet
participant IST as ImageStreamTag
UI->>Hook: provide resource
Hook->>Hook: parse triggers/annotation -> IST ref?
alt IST ref found
Hook->>API: k8sGet(ImageStreamTag)
API->>IST: fetch IST
IST-->>API: IST data (includes dockerImageMetadata.Config.Labels)
API-->>Hook: IST payload
Hook->>Hook: inspect label io.openshift.non-scalable (true/'true')
Hook-->>UI: {isNonScalable: true, loading:false}
UI->>UI: show tooltip/alert when user increases replicas >1
else no IST ref or error
Hook-->>UI: {isNonScalable:false, loading:false}
end
Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 12✅ Passed checks (12 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@frontend/packages/console-shared/src/hooks/useNonScalableImageCheck.ts`:
- Line 71: The effect is unstable because it depends on the istRef object
reference (const istRef = useMemo(() => getISTReference(resource), [resource]))
which changes when resource refreshes even if name/namespace are identical;
update the effect dependency to use stable primitives instead (e.g. istRef.name
and istRef.namespace or a derived string key) so the k8sGet call only runs when
the IST identity actually changes; locate getISTReference/istRef and the effect
that calls k8sGet and replace the istRef object dependency with those stable
properties or a memoized string.
- Around line 20-21: The current logic in useNonScalableImageCheck.ts only
examines the first annotation trigger and accepts any DeploymentConfig
ImageChange trigger without verifying its kind, which can mask a valid
ImageStreamTag (IST) trigger elsewhere; update the code that finds
imageChangeTrigger (the triggers.find call) to instead iterate all triggers and
select one whose type === 'ImageChange' and whose imageChangeParams.from.kind
=== 'ImageStreamTag' (or validate kind before using .name), and likewise update
the annotation-trigger handling to scan all annotation entries (not just the
first) to detect any IST annotations before resolving the IST; ensure you
reference and modify the imageChangeTrigger selection and the annotation parsing
logic so only true IST triggers are treated as valid.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 606ab21e-dc84-48b0-8c21-1d33ecbb5d2b
📒 Files selected for processing (7)
frontend/packages/console-shared/locales/en/console-shared.jsonfrontend/packages/console-shared/src/components/pod/PodRing.tsxfrontend/packages/console-shared/src/hooks/__tests__/useNonScalableImageCheck.spec.tsfrontend/packages/console-shared/src/hooks/useNonScalableImageCheck.tsfrontend/public/components/modals/__tests__/configure-count-modal.spec.tsxfrontend/public/components/modals/configure-count-modal.tsxfrontend/public/locales/en/public.json
📜 Review details
🔇 Additional comments (6)
frontend/public/locales/en/public.json (1)
1756-1757: LGTM!frontend/packages/console-shared/locales/en/console-shared.json (1)
234-234: LGTM!frontend/public/components/modals/configure-count-modal.tsx (1)
46-47: LGTM!Also applies to: 101-112
frontend/packages/console-shared/src/components/pod/PodRing.tsx (1)
3-3: LGTM!Also applies to: 10-10, 86-86, 131-157
frontend/public/components/modals/__tests__/configure-count-modal.spec.tsx (1)
1-107: LGTM!frontend/packages/console-shared/src/hooks/__tests__/useNonScalableImageCheck.spec.ts (1)
1-147: LGTM!
|
@swshende-cmd: Jira verification commands are restricted to collaborators for this repo. 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. |
|
/verified by @swshende-cmd |
|
@dpateriya: This PR has been marked as verified by 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. |
- Validate ImageStreamTag kind in DeploymentConfig triggers before resolving - Scan all annotation triggers instead of only the first one - Use stable primitives (name, namespace) as effect dependencies Co-authored-by: Cursor <cursoragent@cursor.com>
|
/ok-to-test |
Moves new i18n keys to the parser-determined position and removes orphaned keys no longer referenced after the modal rewrite on main. Co-authored-by: Cursor <cursoragent@cursor.com>
|
/retest |
|
@swshende-cmd: This pull request references RFE-3935 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. |
Move Non-scalable image keys to parser-determined position (after "Please enter a URL." at line 874) and restore all existing keys. Remove trailing newline from console-shared.json to match parser output. Co-authored-by: Cursor <cursoragent@cursor.com>
|
/retest |
|
@swshende-cmd: all tests passed! Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
|
/verified by @swshende-cmd |
|
@dpateriya: This PR has been marked as verified by 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. |


Summary
io.openshift.non-scalable=truelabel in its metadatauseNonScalableImageCheckhook that resolves ImageStreamTag references from Deployment trigger annotations or DeploymentConfig ImageChange triggers, fetches the IST, and checksimage.dockerImageMetadata.Config.Labelsfor the non-scalable labelJIRA
RFE-3935
Changes
frontend/packages/console-shared/src/hooks/useNonScalableImageCheck.tsio.openshift.non-scalablelabel on an ImageStreamTagfrontend/public/components/modals/configure-count-modal.tsxfrontend/packages/console-shared/src/components/pod/PodRing.tsxfrontend/public/locales/en/public.jsonfrontend/packages/console-shared/locales/en/console-shared.jsonfrontend/packages/console-shared/src/hooks/__tests__/useNonScalableImageCheck.spec.tsfrontend/public/components/modals/__tests__/configure-count-modal.spec.tsxScreenshots / Recordings
To be added by author
Test plan
yarn test packages/console-shared/src/hooks/__tests__/useNonScalableImageCheck.spec.ts(7 tests)yarn test public/components/modals/__tests__/configure-count-modal.spec.tsx(4 tests)Made with Cursor
Summary by CodeRabbit
New Features
Localization
Tests