From cf08963fc1a526400d1fdda92e872dc956a7b418 Mon Sep 17 00:00:00 2001 From: nasc17 <69922333+nasc17@users.noreply.github.com> Date: Mon, 1 Mar 2021 16:45:05 -0800 Subject: [PATCH] Node configuration needs to show different size for data and logs volume for postgresql. (#14466) * Included storage size of log and data * Added backups and removed putting 0 * Added localized constants --- extensions/arc/src/localizedConstants.ts | 3 +++ extensions/arc/src/models/postgresModel.ts | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/extensions/arc/src/localizedConstants.ts b/extensions/arc/src/localizedConstants.ts index d856b9d10e..ad7ba25ee8 100644 --- a/extensions/arc/src/localizedConstants.ts +++ b/extensions/arc/src/localizedConstants.ts @@ -192,6 +192,9 @@ export function instanceDeleted(name: string): string { return localize('arc.ins export function instanceUpdated(name: string): string { return localize('arc.instanceUpdated', "Instance '{0}' updated", name); } export function copiedToClipboard(name: string): string { return localize('arc.copiedToClipboard', "{0} copied to clipboard", name); } export function clickTheTroubleshootButton(resourceType: string): string { return localize('arc.clickTheTroubleshootButton', "Click the troubleshoot button to open the Azure Arc {0} troubleshooting notebook.", resourceType); } +export function dataStorage(value: string): string { return localize('arc.dataStorage', "{0} data", value); } +export function logStorage(value: string): string { return localize('arc.logStorage', "{0} log", value); } +export function backupsStorage(value: string): string { return localize('arc.backupsStorage', "{0} backups", value); } export function numVCores(vCores: string | undefined): string { if (vCores && +vCores > 0) { if (+vCores === 1) { diff --git a/extensions/arc/src/models/postgresModel.ts b/extensions/arc/src/models/postgresModel.ts index e79e4a9ea7..8c6973dd11 100644 --- a/extensions/arc/src/models/postgresModel.ts +++ b/extensions/arc/src/models/postgresModel.ts @@ -76,7 +76,9 @@ export class PostgresModel extends ResourceModel { const ramLimit = this._config.spec.scheduling?.default?.resources?.limits?.memory; const cpuRequest = this._config.spec.scheduling?.default?.resources?.requests?.cpu; const ramRequest = this._config.spec.scheduling?.default?.resources?.requests?.memory; - const storage = this._config.spec.storage?.data?.size; + const dataStorage = this._config.spec.storage?.data?.size; + const logStorage = this._config.spec.storage?.logs?.size; + const backupsStorage = this._config.spec.storage?.backups?.size; // scale.shards was renamed to scale.workers. Check both for backwards compatibility. const scale = this._config.spec.scale; @@ -94,8 +96,19 @@ export class PostgresModel extends ResourceModel { configuration.push(`${ramLimit ?? ramRequest!} ${loc.ram}`); } - if (storage) { - configuration.push(`${storage} ${loc.storagePerNode}`); + let storage: string[] = []; + if (dataStorage) { + storage.push(loc.dataStorage(dataStorage)); + } + if (logStorage) { + storage.push(loc.logStorage(logStorage)); + } + if (backupsStorage) { + storage.push(loc.backupsStorage(backupsStorage)); + } + if (dataStorage || logStorage || backupsStorage) { + storage.push(`${loc.storagePerNode}`); + configuration.push(storage.join(' ')); } return configuration.join(', ');