From db4b5c6c2a43e31b8ee4550506aa61cf84df98a1 Mon Sep 17 00:00:00 2001 From: Richard87 Date: Thu, 13 Jun 2024 12:49:23 +0200 Subject: [PATCH 1/6] Update API CLient with KEDA Triggers support, rename ts to cts for codegen --- package-lock.json | 16 ++++++++-------- package.json | 10 +++++----- ...enapi-config.ts => cost-openapi-config.cts} | 0 ...penapi-config.ts => log-openapi-config.cts} | 0 ...napi-config.ts => radix-openapi-config.cts} | 0 ...enapi-config.ts => scan-openapi-config.cts} | 0 ...onfig.ts => service-now-openapi-config.cts} | 0 src/store/cost-api.ts | 14 ++++++++++++++ src/store/radix-api.ts | 18 ++++++++++++++++++ src/store/scan-api.ts | 17 +++++++++++++++++ 10 files changed, 62 insertions(+), 13 deletions(-) rename src/store/configs/{cost-openapi-config.ts => cost-openapi-config.cts} (100%) rename src/store/configs/{log-openapi-config.ts => log-openapi-config.cts} (100%) rename src/store/configs/{radix-openapi-config.ts => radix-openapi-config.cts} (100%) rename src/store/configs/{scan-openapi-config.ts => scan-openapi-config.cts} (100%) rename src/store/configs/{service-now-openapi-config.ts => service-now-openapi-config.cts} (100%) diff --git a/package-lock.json b/package-lock.json index db40b2e80..f7baa06f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,7 +59,7 @@ "mock-socket": "^9.3.1", "prettier": "^3.3.0", "ts-node": "^10.9.2", - "typescript": "^5.4.5", + "typescript": "~5.4.5", "vite-plugin-eslint": "^1.8.1", "vitest": "^1.6.0" }, @@ -4900,12 +4900,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -6563,9 +6563,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" diff --git a/package.json b/package.json index 83e4707a1..c16095881 100644 --- a/package.json +++ b/package.json @@ -22,11 +22,11 @@ "deps": "npm run deps:license && npm run deps:stale", "deps:license": "node scripts/deps-license-check.js", "deps:stale": "node scripts/deps-stale-check.js", - "apigen:cost": "npx @rtk-query/codegen-openapi ./src/store/configs/cost-openapi-config.ts", - "apigen:log": "npx @rtk-query/codegen-openapi ./src/store/configs/log-openapi-config.ts", - "apigen:radix": "npx @rtk-query/codegen-openapi ./src/store/configs/radix-openapi-config.ts", - "apigen:scan": "npx @rtk-query/codegen-openapi ./src/store/configs/scan-openapi-config.ts", - "apigen:service-now": "npx @rtk-query/codegen-openapi ./src/store/configs/service-now-openapi-config.ts" + "apigen:cost": "npx @rtk-query/codegen-openapi ./src/store/configs/cost-openapi-config.cts", + "apigen:log": "npx @rtk-query/codegen-openapi ./src/store/configs/log-openapi-config.cts", + "apigen:radix": "npx @rtk-query/codegen-openapi ./src/store/configs/radix-openapi-config.cts", + "apigen:scan": "npx @rtk-query/codegen-openapi ./src/store/configs/scan-openapi-config.cts", + "apigen:service-now": "npx @rtk-query/codegen-openapi ./src/store/configs/service-now-openapi-config.cts" }, "dependencies": { "@azure/msal-browser": "^3.14.0", diff --git a/src/store/configs/cost-openapi-config.ts b/src/store/configs/cost-openapi-config.cts similarity index 100% rename from src/store/configs/cost-openapi-config.ts rename to src/store/configs/cost-openapi-config.cts diff --git a/src/store/configs/log-openapi-config.ts b/src/store/configs/log-openapi-config.cts similarity index 100% rename from src/store/configs/log-openapi-config.ts rename to src/store/configs/log-openapi-config.cts diff --git a/src/store/configs/radix-openapi-config.ts b/src/store/configs/radix-openapi-config.cts similarity index 100% rename from src/store/configs/radix-openapi-config.ts rename to src/store/configs/radix-openapi-config.cts diff --git a/src/store/configs/scan-openapi-config.ts b/src/store/configs/scan-openapi-config.cts similarity index 100% rename from src/store/configs/scan-openapi-config.ts rename to src/store/configs/scan-openapi-config.cts diff --git a/src/store/configs/service-now-openapi-config.ts b/src/store/configs/service-now-openapi-config.cts similarity index 100% rename from src/store/configs/service-now-openapi-config.ts rename to src/store/configs/service-now-openapi-config.cts diff --git a/src/store/cost-api.ts b/src/store/cost-api.ts index 4589e8f6f..78130c278 100644 --- a/src/store/cost-api.ts +++ b/src/store/cost-api.ts @@ -76,21 +76,35 @@ export type GetTotalCostsApiArg = { 'Impersonate-Group'?: string; }; export type ApplicationCost = { + /** Comment regarding cost */ comment?: string; + /** Cost */ cost: number; + /** CostPercentageByCPU is cost percentage by CPU for the application. */ costPercentageByCpu?: number; + /** CostPercentageByMemory is cost percentage by memory for the application */ costPercentageByMemory?: number; + /** Creator of the application. */ creator?: string; + /** Cost currency */ currency: string; + /** Name of the application */ name: string; + /** Owner of the application (email). Can be a single person or a shared group email. */ owner?: string; + /** WBS for the application. */ wbs?: string; }; export type ApplicationCostSet = { + /** ApplicationCosts with costs. */ applicationCosts: ApplicationCost[]; + /** ApplicationCostSet period started From */ from: string; + /** ApplicationCostSet period continued To */ to: string; + /** TotalRequestedCPU within the period. */ totalRequestedCpu?: number; + /** TotalRequestedMemory within the period. */ totalRequestedMemory?: number; }; export const { diff --git a/src/store/radix-api.ts b/src/store/radix-api.ts index 55e69bfb5..0c8b5f249 100644 --- a/src/store/radix-api.ts +++ b/src/store/radix-api.ts @@ -2201,7 +2201,21 @@ export type ExternalDns = { fqdn: string; tls: Tls; }; +export type HorizontalScalingSummaryTriggerStatus = { + /** CurrentUtilization is the last measured utilization */ + current_utilization?: string; + /** Error contains short description if trigger have problems */ + error?: string; + /** Name of trigger */ + name?: string; + /** TargetUtilization is the average target across replicas */ + target_utilization?: string; + /** Type of trigger */ + type?: string; +}; export type HorizontalScalingSummary = { + /** CooldownPeriod in seconds. From radixconfig.yaml */ + cooldownPeriod?: number; /** Component current average CPU utilization over all pods, represented as a percentage of requested CPU */ currentCPUUtilizationPercentage?: number; /** Component current average memory utilization over all pods, represented as a percentage of requested memory */ @@ -2210,10 +2224,14 @@ export type HorizontalScalingSummary = { maxReplicas?: number; /** Component minimum replicas. From radixconfig.yaml */ minReplicas?: number; + /** PollingInterval in seconds. From radixconfig.yaml */ + pollingInterval?: number; /** Component target average CPU utilization over all pods */ targetCPUUtilizationPercentage?: number; /** Component target average memory utilization over all pods */ targetMemoryUtilizationPercentage?: number; + /** Triggers lists status of all triggers found in radixconfig.yaml */ + triggers?: HorizontalScalingSummaryTriggerStatus[]; }; export type AzureIdentity = { /** The Azure Key Vaults names, which use Azure Identity */ diff --git a/src/store/scan-api.ts b/src/store/scan-api.ts index 49e85ae6a..786d12db6 100644 --- a/src/store/scan-api.ts +++ b/src/store/scan-api.ts @@ -72,25 +72,41 @@ export type GetJobVulnerabilitiesApiArg = { jobName: string; }; export type Image = { + /** Base image */ baseImage?: string; + /** Name of image */ image: string; }; export type Vulnerability = { + /** A list of CVEs referencing the vulnerability */ cve?: string[]; + /** The CVSS value of the vulnerability */ cvss?: number; + /** A list of CWEs referencing the vulnerability */ cwe?: string[]; + /** A detailed description of the vulnerability */ description?: string; + /** Name of the vulnerabile package */ packageName: string; + /** The date the vulnerability was published */ publishedDate?: string; + /** A list of URLs with more information about the vulnerability */ references?: string[]; + /** The severity of the vulnerability */ severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' | 'UNKNOWN'; + /** Title of the vulnerability */ title?: string; + /** Version of the affected package */ version: string; }; export type ImageScan = { + /** Flag indicating if scan succeeded or not */ scanSuccess: boolean; + /** Date and time of scan */ scanTime: string; + /** List of vulnerabilities */ vulnerabilities?: Vulnerability[]; + /** Count of vulnerabilities grouped by severity */ vulnerabilitySummary?: { [key: string]: number; }; @@ -102,6 +118,7 @@ export type ComponentVulnerabilities = { export type EnvironmentVulnerabilities = { components?: ComponentVulnerabilities; jobs?: ComponentVulnerabilities; + /** Name of environment */ name: string; }; export type ApplicationVulnerabilities = EnvironmentVulnerabilities[]; From 7f8bd0283026ec4b89c29744001173c7d7334d58 Mon Sep 17 00:00:00 2001 From: Richard87 Date: Fri, 14 Jun 2024 11:32:03 +0200 Subject: [PATCH 2/6] update radix cli --- .../horizontal-scaling-summary.tsx | 53 ++++--------------- src/store/radix-api.ts | 10 ++-- 2 files changed, 15 insertions(+), 48 deletions(-) diff --git a/src/components/page-active-component/horizontal-scaling-summary.tsx b/src/components/page-active-component/horizontal-scaling-summary.tsx index ce77f26c9..4fc425fc1 100644 --- a/src/components/page-active-component/horizontal-scaling-summary.tsx +++ b/src/components/page-active-component/horizontal-scaling-summary.tsx @@ -1,7 +1,7 @@ import { Accordion, Typography } from '@equinor/eds-core-react'; import { isNil } from 'lodash'; import * as PropTypes from 'prop-types'; -import { FunctionComponent } from 'react'; +import { Fragment, FunctionComponent } from 'react'; import { HorizontalScalingSummary as HorizontalScalingSummaryModel } from '../../store/radix-api'; @@ -38,49 +38,16 @@ export const HorizontalScalingSummary: FunctionComponent< )} - {!isNil(data.currentCPUUtilizationPercentage) && ( - <> - - CPU utilization, current average: - - - {data.currentCPUUtilizationPercentage}% - - - )} - - {!isNil(data.targetCPUUtilizationPercentage) && ( - <> - - CPU utilization, target average: - - - {data.targetCPUUtilizationPercentage}% - - - )} - - {!isNil(data.currentMemoryUtilizationPercentage) && ( - <> - - Memory utilization, current average: - - - {data.currentMemoryUtilizationPercentage}% + {data.triggers.map((trigger, i) => ( + + {trigger.name}: + + {trigger.current_utilization}% of{' '} + {trigger.target_utilization}% + target utilization - - )} - - {!isNil(data.targetMemoryUtilizationPercentage) && ( - <> - - Memory utilization, target average: - - - {data.targetMemoryUtilizationPercentage}% - - - )} + + ))} diff --git a/src/store/radix-api.ts b/src/store/radix-api.ts index 0c8b5f249..5b45371f2 100644 --- a/src/store/radix-api.ts +++ b/src/store/radix-api.ts @@ -2216,9 +2216,9 @@ export type HorizontalScalingSummaryTriggerStatus = { export type HorizontalScalingSummary = { /** CooldownPeriod in seconds. From radixconfig.yaml */ cooldownPeriod?: number; - /** Component current average CPU utilization over all pods, represented as a percentage of requested CPU */ + /** Deprecated: Component current average CPU utilization over all pods, represented as a percentage of requested CPU. Use Triggers instead. Will be removed from Radix API 2025-01-01. */ currentCPUUtilizationPercentage?: number; - /** Component current average memory utilization over all pods, represented as a percentage of requested memory */ + /** Deprecated: Component current average memory utilization over all pods, represented as a percentage of requested memory. Use Triggers instead. Will be removed from Radix API 2025-01-01. */ currentMemoryUtilizationPercentage?: number; /** Component maximum replicas. From radixconfig.yaml */ maxReplicas?: number; @@ -2226,9 +2226,9 @@ export type HorizontalScalingSummary = { minReplicas?: number; /** PollingInterval in seconds. From radixconfig.yaml */ pollingInterval?: number; - /** Component target average CPU utilization over all pods */ + /** Deprecated: Component target average CPU utilization over all pods. Use Triggers instead. Will be removed from Radix API 2025-01-01. */ targetCPUUtilizationPercentage?: number; - /** Component target average memory utilization over all pods */ + /** Deprecated: Component target average memory utilization over all pods. use Triggers instead. Will be removed from Radix API 2025-01-01. */ targetMemoryUtilizationPercentage?: number; /** Triggers lists status of all triggers found in radixconfig.yaml */ triggers?: HorizontalScalingSummaryTriggerStatus[]; @@ -2350,7 +2350,7 @@ export type Component = { ports?: Port[]; /** Array of ReplicaSummary */ replicaList?: ReplicaSummary[]; - /** Array of pod names */ + /** Deprecated: Array of pod names. Use ReplicaList instead */ replicas?: string[]; resources?: ResourceRequirements; /** ScheduledJobPayloadPath defines the payload path, where payload for Job Scheduler will be mapped as a file. From radixconfig.yaml */ From e848d98324676826b84f2e6cd954844fec2648ad Mon Sep 17 00:00:00 2001 From: Richard87 Date: Fri, 14 Jun 2024 12:38:58 +0200 Subject: [PATCH 3/6] extract TriggerStatus --- .../horizontal-scaling-summary.tsx | 64 ++++++++++++++++--- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/src/components/page-active-component/horizontal-scaling-summary.tsx b/src/components/page-active-component/horizontal-scaling-summary.tsx index 4fc425fc1..df3daaf04 100644 --- a/src/components/page-active-component/horizontal-scaling-summary.tsx +++ b/src/components/page-active-component/horizontal-scaling-summary.tsx @@ -1,9 +1,13 @@ import { Accordion, Typography } from '@equinor/eds-core-react'; import { isNil } from 'lodash'; import * as PropTypes from 'prop-types'; -import { Fragment, FunctionComponent } from 'react'; +import { FunctionComponent } from 'react'; -import { HorizontalScalingSummary as HorizontalScalingSummaryModel } from '../../store/radix-api'; +import { + HorizontalScalingSummary as HorizontalScalingSummaryModel, + HorizontalScalingSummaryTriggerStatus, +} from '../../store/radix-api'; +import { pluraliser } from '../../utils/string'; export const HorizontalScalingSummary: FunctionComponent< HorizontalScalingSummaryModel @@ -38,15 +42,26 @@ export const HorizontalScalingSummary: FunctionComponent< )} - {data.triggers.map((trigger, i) => ( - - {trigger.name}: - - {trigger.current_utilization}% of{' '} - {trigger.target_utilization}% - target utilization + {!isNil(data.pollingInterval) && ( + <> + Polling interval: + + {data.pollingInterval}sec + + + )} + + {!isNil(data.cooldownPeriod) && ( + <> + Cooldown period: + + {data.cooldownPeriod}sec - + + )} + + {data.triggers.map((trigger, i) => ( + ))} @@ -63,3 +78,32 @@ HorizontalScalingSummary.propTypes = { targetCPUUtilizationPercentage: PropTypes.number, targetMemoryUtilizationPercentage: PropTypes.number, }; + +type TriggerStatusProps = { + trigger: HorizontalScalingSummaryTriggerStatus; +}; +const TriggerStatus = ({ trigger }: TriggerStatusProps) => { + let unitFn = pluraliser('%', '%'); + + if (trigger.type == 'cron') { + unitFn = pluraliser('replica', 'replicas'); + } + if (trigger.type == 'azure-servicebus') { + unitFn = pluraliser('message', 'messages'); + } + + return ( + <> + {trigger.name}: + + + {trigger.current_utilization + ? unitFn(Number(trigger.current_utilization)) + : '-'} + {' '} + of {unitFn(Number(trigger.target_utilization))} + target utilization {trigger.error} + + + ); +}; From 0b30b5a6bd5e5e11b71f24c0b6f2123210d5113e Mon Sep 17 00:00:00 2001 From: Richard87 Date: Fri, 14 Jun 2024 15:01:16 +0200 Subject: [PATCH 4/6] add current/desired replica status --- .../horizontal-scaling-summary.tsx | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/components/page-active-component/horizontal-scaling-summary.tsx b/src/components/page-active-component/horizontal-scaling-summary.tsx index df3daaf04..ce0ba677a 100644 --- a/src/components/page-active-component/horizontal-scaling-summary.tsx +++ b/src/components/page-active-component/horizontal-scaling-summary.tsx @@ -8,6 +8,7 @@ import { HorizontalScalingSummaryTriggerStatus, } from '../../store/radix-api'; import { pluraliser } from '../../utils/string'; +import { Alert } from '../alert'; export const HorizontalScalingSummary: FunctionComponent< HorizontalScalingSummaryModel @@ -24,6 +25,16 @@ export const HorizontalScalingSummary: FunctionComponent<
+ Current replicas: + + {data.currentReplicas} + + + Desired replicas: + + {data.currentReplicas} + + {!isNil(data.minReplicas) && ( <> Min replicas: @@ -42,7 +53,7 @@ export const HorizontalScalingSummary: FunctionComponent< )} - {!isNil(data.pollingInterval) && ( + {data.pollingInterval > 0 && ( <> Polling interval: @@ -51,7 +62,7 @@ export const HorizontalScalingSummary: FunctionComponent< )} - {!isNil(data.cooldownPeriod) && ( + {data.cooldownPeriod > 0 && ( <> Cooldown period: @@ -85,24 +96,27 @@ type TriggerStatusProps = { const TriggerStatus = ({ trigger }: TriggerStatusProps) => { let unitFn = pluraliser('%', '%'); - if (trigger.type == 'cron') { - unitFn = pluraliser('replica', 'replicas'); - } - if (trigger.type == 'azure-servicebus') { + if (trigger.type == 'cron') unitFn = pluraliser('replica', 'replicas'); + if (trigger.type == 'azure-servicebus') unitFn = pluraliser('message', 'messages'); - } return ( <> {trigger.name}: - {trigger.current_utilization - ? unitFn(Number(trigger.current_utilization)) + {trigger.currentUtilization + ? unitFn(Number(trigger.currentUtilization)) : '-'} {' '} - of {unitFn(Number(trigger.target_utilization))} - target utilization {trigger.error} + of {unitFn(Number(trigger.targetUtilization))} + target utilization + {trigger.error && ( + <> +
+ {trigger.error} + + )}
); From 088384362ba5c822bddeb76f2f267ebb0f7f206d Mon Sep 17 00:00:00 2001 From: Richard87 Date: Fri, 14 Jun 2024 15:14:09 +0200 Subject: [PATCH 5/6] add current/desired replica status --- .../page-active-component/horizontal-scaling-summary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/page-active-component/horizontal-scaling-summary.tsx b/src/components/page-active-component/horizontal-scaling-summary.tsx index ce0ba677a..4a84498a7 100644 --- a/src/components/page-active-component/horizontal-scaling-summary.tsx +++ b/src/components/page-active-component/horizontal-scaling-summary.tsx @@ -32,7 +32,7 @@ export const HorizontalScalingSummary: FunctionComponent< Desired replicas: - {data.currentReplicas} + {data.desiredReplicas} {!isNil(data.minReplicas) && ( From 9beff4d7830c69a5e275a65004fdb9fc8800f563 Mon Sep 17 00:00:00 2001 From: Richard87 Date: Fri, 14 Jun 2024 15:34:32 +0200 Subject: [PATCH 6/6] Show stopped by autoscaler info --- .../active-component-overview.tsx | 2 +- src/components/page-active-component/dev.tsx | 5 +-- .../horizontal-scaling-summary.tsx | 31 ++++++++++--------- .../page-active-component/overview.tsx | 10 +++++- src/store/radix-api.ts | 8 +++-- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/components/page-active-component/active-component-overview.tsx b/src/components/page-active-component/active-component-overview.tsx index 39b5fab1a..b5a1aa10e 100644 --- a/src/components/page-active-component/active-component-overview.tsx +++ b/src/components/page-active-component/active-component-overview.tsx @@ -142,7 +142,7 @@ export const ActiveComponentOverview: FunctionComponent<{ {component.horizontalScalingSummary && ( )}
diff --git a/src/components/page-active-component/dev.tsx b/src/components/page-active-component/dev.tsx index f9780d921..546a38833 100644 --- a/src/components/page-active-component/dev.tsx +++ b/src/components/page-active-component/dev.tsx @@ -1,6 +1,7 @@ import { HorizontalScalingSummary } from './horizontal-scaling-summary'; +import { HorizontalScalingSummary as HorizontalScalingSummaryModel } from '../../store/radix-api'; -const testData: Array[0]> = [ +const testData: Array = [ { minReplicas: 4, maxReplicas: 20, @@ -40,7 +41,7 @@ export default ( backgroundColor: 'var(--eds_ui_background__default)', }} > - + ))} diff --git a/src/components/page-active-component/horizontal-scaling-summary.tsx b/src/components/page-active-component/horizontal-scaling-summary.tsx index 4a84498a7..378d4d9bb 100644 --- a/src/components/page-active-component/horizontal-scaling-summary.tsx +++ b/src/components/page-active-component/horizontal-scaling-summary.tsx @@ -1,7 +1,6 @@ import { Accordion, Typography } from '@equinor/eds-core-react'; import { isNil } from 'lodash'; import * as PropTypes from 'prop-types'; -import { FunctionComponent } from 'react'; import { HorizontalScalingSummary as HorizontalScalingSummaryModel, @@ -10,9 +9,11 @@ import { import { pluraliser } from '../../utils/string'; import { Alert } from '../alert'; -export const HorizontalScalingSummary: FunctionComponent< - HorizontalScalingSummaryModel -> = (data) => ( +type Props = { + summary: HorizontalScalingSummaryModel; +}; + +export const HorizontalScalingSummary = ({ summary }: Props) => ( @@ -27,51 +28,51 @@ export const HorizontalScalingSummary: FunctionComponent<
Current replicas: - {data.currentReplicas} + {summary.currentReplicas} Desired replicas: - {data.desiredReplicas} + {summary.desiredReplicas} - {!isNil(data.minReplicas) && ( + {!isNil(summary.minReplicas) && ( <> Min replicas: - {data.minReplicas} + {summary.minReplicas} )} - {!isNil(data.maxReplicas) && ( + {!isNil(summary.maxReplicas) && ( <> Max replicas: - {data.maxReplicas} + {summary.maxReplicas} )} - {data.pollingInterval > 0 && ( + {summary.pollingInterval > 0 && ( <> Polling interval: - {data.pollingInterval}sec + {summary.pollingInterval}sec )} - {data.cooldownPeriod > 0 && ( + {summary.cooldownPeriod > 0 && ( <> Cooldown period: - {data.cooldownPeriod}sec + {summary.cooldownPeriod}sec )} - {data.triggers.map((trigger, i) => ( + {summary.triggers.map((trigger, i) => ( ))}
diff --git a/src/components/page-active-component/overview.tsx b/src/components/page-active-component/overview.tsx index 5f0f4be13..1dc4e602c 100644 --- a/src/components/page-active-component/overview.tsx +++ b/src/components/page-active-component/overview.tsx @@ -44,11 +44,18 @@ export const Overview: FunctionComponent<{ const dnsExternalAliasUrls = dnsExternalAliases ? dnsExternalAliases.map((alias) => alias.fqdn) : []; + + const isStopped = component.status == 'Stopped'; + const isScaledDown = + component.horizontalScalingSummary?.desiredReplicas === 0 && isStopped; + + console.log({ component, isScaledDown, isStopped }); + return (
Overview - {component.status === 'Stopped' && ( + {isStopped && !isScaledDown && ( Component has been manually stopped; please note that a new deployment will cause it to be restarted unless you set replicas of @@ -61,6 +68,7 @@ export const Overview: FunctionComponent<{ )} + {isScaledDown && Component has been stopped by autoscaler.}
diff --git a/src/store/radix-api.ts b/src/store/radix-api.ts index 5b45371f2..08375f5a9 100644 --- a/src/store/radix-api.ts +++ b/src/store/radix-api.ts @@ -2203,13 +2203,13 @@ export type ExternalDns = { }; export type HorizontalScalingSummaryTriggerStatus = { /** CurrentUtilization is the last measured utilization */ - current_utilization?: string; + currentUtilization?: string; /** Error contains short description if trigger have problems */ error?: string; /** Name of trigger */ name?: string; /** TargetUtilization is the average target across replicas */ - target_utilization?: string; + targetUtilization?: string; /** Type of trigger */ type?: string; }; @@ -2220,6 +2220,10 @@ export type HorizontalScalingSummary = { currentCPUUtilizationPercentage?: number; /** Deprecated: Component current average memory utilization over all pods, represented as a percentage of requested memory. Use Triggers instead. Will be removed from Radix API 2025-01-01. */ currentMemoryUtilizationPercentage?: number; + /** CurrentReplicas returns the current number of replicas */ + currentReplicas?: number; + /** DesiredReplicas returns the target number of replicas across all triggers */ + desiredReplicas?: number; /** Component maximum replicas. From radixconfig.yaml */ maxReplicas?: number; /** Component minimum replicas. From radixconfig.yaml */