From dbdfa8555ca039a5254ce79fe983c821ef63c3b2 Mon Sep 17 00:00:00 2001 From: LucaZanni Date: Tue, 1 Oct 2024 14:12:35 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Aggiunge=20la=20gestione=20di=20Per?= =?UTF-8?q?sistentVolumeClaim=20e=20log=20per=20pvcSize=20nel=20file=20ind?= =?UTF-8?q?ex.js.=20=20=20Queste=20modifiche=20consentono=20di=20configura?= =?UTF-8?q?re=20dinamicamente=20la=20dimensione=20del=20PVC,=20migliorando?= =?UTF-8?q?=20l'adattabilit=C3=A0=20del=20sistema=20a=20diverse=20esigenze?= =?UTF-8?q?=20di=20storage.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 9c9a363..128c844 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31210,6 +31210,9 @@ const config = { cpuLimit: core.getInput('cpuLimit') || defaultConfig.cpuLimit, memoryLimit: core.getInput('memoryLimit') || defaultConfig.memoryLimit }; +const pvcSize = core.getInput("pvcSize"); +if (pvcSize) + log(`pvcSize: ${pvcSize}`); log(`config: ${JSON.stringify(config)}`); // Ensure mandatory parameters are present @@ -31296,6 +31299,22 @@ if (imagePullSecretsName) { deployment.spec.template.spec.imagePullSecrets = [{ name: imagePullSecretsName }]; log(`deployment.spec.template.spec.imagePullSecrets: ${JSON.stringify(deployment.spec.template.spec.imagePullSecrets)}`); } +// PersistentVolumeClaim +const pvc = { + apiVersion: "v1", + kind: "PersistentVolumeClaim", + metadata: { ...baseMetadata, name: `${packageJson.name}-pvc` }, + spec: { + accessModes: ["ReadWriteOnce"], + resources: { + requests: { + storage: pvcSize + } + } + } +}; +if (pvcSize) + log(`pvc: ${JSON.stringify(pvc)}`); // HorizontalPodAutoscaler const autoscaler = { @@ -31328,7 +31347,9 @@ if (envExist) yamlContents.push(yaml.dump(service, yamlOptions)); yamlContents.push(yaml.dump(deployment, yamlOptions)); yamlContents.push(yaml.dump(autoscaler, yamlOptions)); - +if (pvcSize) { + yamlContents.push(yaml.dump(pvc, yamlOptions)); +} const allYaml = yamlContents.join("\n---\n"); log(`allYaml: ${allYaml}`);