From d3be8ba3e6e9cfaa674bb0b571df7e71be39f7bf Mon Sep 17 00:00:00 2001 From: Swapnil Date: Tue, 12 May 2026 21:19:18 +0530 Subject: [PATCH 1/4] RFE-3935: Add non-scalable image warning when scaling workloads 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 --- .../locales/en/console-shared.json | 3 +- .../src/components/pod/PodRing.tsx | 40 +++-- .../useNonScalableImageCheck.spec.ts | 146 ++++++++++++++++++ .../src/hooks/useNonScalableImageCheck.ts | 105 +++++++++++++ .../__tests__/configure-count-modal.spec.tsx | 107 +++++++++++++ .../modals/configure-count-modal.tsx | 25 ++- frontend/public/locales/en/public.json | 2 + 7 files changed, 416 insertions(+), 12 deletions(-) create mode 100644 frontend/packages/console-shared/src/hooks/__tests__/useNonScalableImageCheck.spec.ts create mode 100644 frontend/packages/console-shared/src/hooks/useNonScalableImageCheck.ts create mode 100644 frontend/public/components/modals/__tests__/configure-count-modal.spec.tsx diff --git a/frontend/packages/console-shared/locales/en/console-shared.json b/frontend/packages/console-shared/locales/en/console-shared.json index 01ed4c5bd31..266bcf1870e 100644 --- a/frontend/packages/console-shared/locales/en/console-shared.json +++ b/frontend/packages/console-shared/locales/en/console-shared.json @@ -231,6 +231,7 @@ "Project": "Project", "Namespace": "Namespace", "Enable Autoscale": "Enable Autoscale", + "This image is not intended to run with more than one replica. Scaling up may cause unexpected behavior.": "This image is not intended to run with more than one replica. Scaling up may cause unexpected behavior.", "Increase the Pod count": "Increase the Pod count", "Decrease the Pod count": "Decrease the Pod count", "No Pods found for this resource.": "No Pods found for this resource.", @@ -320,4 +321,4 @@ "Name must consist of lower-case letters, numbers and hyphens. It must start with a letter and end with a letter or number.": "Name must consist of lower-case letters, numbers and hyphens. It must start with a letter and end with a letter or number.", "Cannot be longer than {{characterCount}} characters.": "Cannot be longer than {{characterCount}} characters.", "Required": "Required" -} \ No newline at end of file +} diff --git a/frontend/packages/console-shared/src/components/pod/PodRing.tsx b/frontend/packages/console-shared/src/components/pod/PodRing.tsx index 458c10b58b0..73da73059ac 100644 --- a/frontend/packages/console-shared/src/components/pod/PodRing.tsx +++ b/frontend/packages/console-shared/src/components/pod/PodRing.tsx @@ -1,12 +1,13 @@ import type { FC } from 'react'; import { useState, useEffect } from 'react'; -import { Button, Split, SplitItem, Bullseye } from '@patternfly/react-core'; +import { Button, Split, SplitItem, Bullseye, Tooltip } from '@patternfly/react-core'; import { AngleDownIcon, AngleUpIcon, AutomationIcon } from '@patternfly/react-icons'; import * as _ from 'lodash'; import { useTranslation } from 'react-i18next'; import type { ImpersonateKind } from '@console/dynamic-plugin-sdk'; import type { K8sResourceKind, K8sKind } from '@console/internal/module/k8s'; import { k8sPatch } from '@console/internal/module/k8s'; +import { useNonScalableImageCheck } from '../../hooks/useNonScalableImageCheck'; import { useRelatedHPA } from '../../hooks/useRelatedHPA'; import type { ExtPodKind } from '../../types'; import { usePodRingLabel, usePodScalingAccessStatus } from '../../utils/pod-ring-utils'; @@ -82,6 +83,7 @@ const PodRing: FC = ({ } = obj; const [hpa] = useRelatedHPA(apiVersion, kind, name, namespace); const hpaControlledScaling = !!hpa; + const { isNonScalable } = useNonScalableImageCheck(obj); const isScalingAllowed = isAccessScalingAllowed && !hpaControlledScaling; @@ -126,15 +128,33 @@ const PodRing: FC = ({
-