From 212981d21cde52074b7e3e4f50b2f6f778241ee7 Mon Sep 17 00:00:00 2001 From: LucaZanni Date: Tue, 1 Oct 2024 14:40:38 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20(index.js,=20dist/index.js):=20m?= =?UTF-8?q?igliora=20la=20formattazione=20del=20codice=20e=20la=20leggibil?= =?UTF-8?q?it=C3=A0=20delle=20variabili=20=F0=9F=94=A7=20(index.js,=20dist?= =?UTF-8?q?/index.js):=20integra=20il=20supporto=20per=20il=20Persistent?= =?UTF-8?q?=20Volume=20Claim=20(PVC)=20nel=20deployment=20per=20una=20migl?= =?UTF-8?q?iore=20gestione=20dello=20storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.js | 31 +++++++++++++++++++++++-------- index.js | 31 +++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index 128c844..e1cf570 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31205,12 +31205,12 @@ const config = { minReplicas: parseInt(core.getInput('minReplicas'), 10) || defaultConfig.minReplicas, maxReplicas: parseInt(core.getInput('maxReplicas'), 10) || defaultConfig.maxReplicas, targetCPUUtilizationPercentage: parseInt(core.getInput('targetCPUUtilizationPercentage'), 10) || defaultConfig.targetCPUUtilizationPercentage, - cpuRequest: core.getInput('cpuRequest') || defaultConfig.cpuRequest, - memoryRequest: core.getInput('memoryRequest') || defaultConfig.memoryRequest, - cpuLimit: core.getInput('cpuLimit') || defaultConfig.cpuLimit, - memoryLimit: core.getInput('memoryLimit') || defaultConfig.memoryLimit + cpuRequest: core.getInput('cpuRequest') || defaultConfig.cpuRequest, + memoryRequest: core.getInput('memoryRequest') || defaultConfig.memoryRequest, + cpuLimit: core.getInput('cpuLimit') || defaultConfig.cpuLimit, + memoryLimit: core.getInput('memoryLimit') || defaultConfig.memoryLimit }; -const pvcSize = core.getInput("pvcSize"); +const pvcSize = core.getInput("pvcSize"); if (pvcSize) log(`pvcSize: ${pvcSize}`); log(`config: ${JSON.stringify(config)}`); @@ -31285,9 +31285,24 @@ const deployment = { cpu: config.cpuLimit, // Usa la variabile per il limite CPU memory: config.memoryLimit // Usa la variabile per il limite di memoria } - } + }, + // Mount the PVC as a volume in the container + volumeMounts: pvcSize ? [ + { + name: `${packageJson.name}-storage`, + mountPath: "/usr/src/app/storage" // Il path all'interno del container dove verrĂ  montato il volume + } + ] : [] } - ] + ], + volumes: pvcSize ? [ + { + name: `${packageJson.name}-storage`, + persistentVolumeClaim: { + claimName: `${packageJson.name}-pvc` + } + } + ] : [] } } } @@ -31313,7 +31328,7 @@ const pvc = { } } }; -if (pvcSize) +if (pvcSize) log(`pvc: ${JSON.stringify(pvc)}`); // HorizontalPodAutoscaler diff --git a/index.js b/index.js index 75c9ebf..47407f2 100644 --- a/index.js +++ b/index.js @@ -110,12 +110,12 @@ const config = { minReplicas: parseInt(core.getInput('minReplicas'), 10) || defaultConfig.minReplicas, maxReplicas: parseInt(core.getInput('maxReplicas'), 10) || defaultConfig.maxReplicas, targetCPUUtilizationPercentage: parseInt(core.getInput('targetCPUUtilizationPercentage'), 10) || defaultConfig.targetCPUUtilizationPercentage, - cpuRequest: core.getInput('cpuRequest') || defaultConfig.cpuRequest, - memoryRequest: core.getInput('memoryRequest') || defaultConfig.memoryRequest, - cpuLimit: core.getInput('cpuLimit') || defaultConfig.cpuLimit, - memoryLimit: core.getInput('memoryLimit') || defaultConfig.memoryLimit + cpuRequest: core.getInput('cpuRequest') || defaultConfig.cpuRequest, + memoryRequest: core.getInput('memoryRequest') || defaultConfig.memoryRequest, + cpuLimit: core.getInput('cpuLimit') || defaultConfig.cpuLimit, + memoryLimit: core.getInput('memoryLimit') || defaultConfig.memoryLimit }; -const pvcSize = core.getInput("pvcSize"); +const pvcSize = core.getInput("pvcSize"); if (pvcSize) log(`pvcSize: ${pvcSize}`); log(`config: ${JSON.stringify(config)}`); @@ -190,9 +190,24 @@ const deployment = { cpu: config.cpuLimit, // Usa la variabile per il limite CPU memory: config.memoryLimit // Usa la variabile per il limite di memoria } - } + }, + // Mount the PVC as a volume in the container + volumeMounts: pvcSize ? [ + { + name: `${packageJson.name}-storage`, + mountPath: "/usr/src/app/storage" // Il path all'interno del container dove verrĂ  montato il volume + } + ] : [] } - ] + ], + volumes: pvcSize ? [ + { + name: `${packageJson.name}-storage`, + persistentVolumeClaim: { + claimName: `${packageJson.name}-pvc` + } + } + ] : [] } } } @@ -218,7 +233,7 @@ const pvc = { } } }; -if (pvcSize) +if (pvcSize) log(`pvc: ${JSON.stringify(pvc)}`); // HorizontalPodAutoscaler