Skip to content

Commit

Permalink
Add button to enable autoscaling for a pod that has zero replicas.
Browse files Browse the repository at this point in the history
  • Loading branch information
sg00dwin committed Apr 2, 2024
1 parent c9b5118 commit be4f21d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
"All Namespaces": "All Namespaces",
"Project": "Project",
"Namespace": "Namespace",
"Enable Autoscale": "Enable Autoscale",
"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.",
Expand Down
14 changes: 14 additions & 0 deletions frontend/packages/console-shared/src/components/pod/PodRing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import { Button, Split, SplitItem, Bullseye } from '@patternfly/react-core';
import { AngleDownIcon } from '@patternfly/react-icons/dist/esm/icons/angle-down-icon';
import { AngleUpIcon } from '@patternfly/react-icons/dist/esm/icons/angle-up-icon';
import { AutomationIcon } from '@patternfly/react-icons/dist/esm/icons/automation-icon';
import * as _ from 'lodash';
import { useTranslation } from 'react-i18next';
import { ImpersonateKind } from '@console/dynamic-plugin-sdk';
Expand Down Expand Up @@ -84,6 +85,7 @@ const PodRing: React.FC<PodRingProps> = ({

const isScalingAllowed = isAccessScalingAllowed && !hpaControlledScaling;

const enableAutoscaling = !isScalingAllowed && clickCount === 0;
const resourceObj = rc || obj;
const { title, subTitle, titleComponent } = usePodRingLabel(
resourceObj,
Expand All @@ -107,6 +109,18 @@ const PodRing: React.FC<PodRingProps> = ({
/>
</div>
</SplitItem>
{enableAutoscaling && (
<SplitItem className="pf-v5-u-display-flex pf-v5-u-align-content-center">
<Button
type="button"
variant="link"
icon={<AutomationIcon />}
onClick={() => handleClick(1)}
>
{t('console-shared~Enable Autoscale')}
</Button>
</SplitItem>
)}
{isScalingAllowed && (
<SplitItem>
<Bullseye>
Expand Down

0 comments on commit be4f21d

Please sign in to comment.