✨ Aggiungi il supporto per la dimensione del Persistent Volume Claim (PVC)

nel README, action.yml e index.js per migliorare la configurabilità
  e la funzionalità dell'azione.
This commit is contained in:
LucaZanni committed 2024-10-01 14:11:50 +02:00
1 parent bec4b85289
commit 4068c94480
3 files changed
+26 -2

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ jobs:
| `memoryRequest`| The minimum amount of memory guaranteed for each container, expressed in MiB (e.g., 512Mi). | No |`512Mi`|
| `cpuLimit`| The maximum amount of CPU a container can use, expressed in milliCPU (e.g., 1000m means one full CPU). | No |`1000m`|
| `memoryLimit`| The maximum amount of memory a container can use, expressed in MiB (e.g., 1024Mi). | No |`1024Mi`|
| `pvcSize` | Persistent Volume Claim size (e.g. 1Gi, 10Gi) | No | `1Gi` |
## Outputs
This action produce artifact.
+3
View File
@@ -74,6 +74,9 @@ inputs:
description: 'Output Directory path'
required: false
default: '.'
pvcSize:
description: 'Persistent Volume Claim size (e.g. 1Gi, 100m)'
required: false
runs:
using: 'node20'
main: 'dist/index.js'
+22 -1
View File
@@ -115,6 +115,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
@@ -201,6 +204,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 = {
@@ -233,7 +252,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}`);