mirror of
https://github.com/punga78/k8s-yaml-generator
synced 2026-11-30 02:23:05 +00:00
✨ 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:
1 parent
bec4b85289
commit
4068c94480
3 files changed
+26
-2
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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'
|
||||
@@ -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}`);
|
||||
|
||||
|
||||
Reference in new issue
Block a user