Skip to content

Commit e3bf4bb

Browse files
committed
fix: better docs
Signed-off-by: Ben Keil <benkeil.pub@pm.me>
1 parent 555da41 commit e3bf4bb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

docs/plus/volume.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,28 @@ When working with StatefulSets, you can use PersistentVolumeClaim templates to c
4545
import * as kplus from 'cdk8s-plus-32';
4646
import { Size } from 'cdk8s';
4747

48-
const volume = Volume.fromName(chart, "pvc-template", "data-volume");
48+
const dataVolume = Volume.fromName(chart, "pvc-template-data", "data-volume")
4949

5050
// Create a StatefulSet with a PVC template
5151
const statefulSet = new kplus.StatefulSet(this, 'StatefulSet', {
5252
containers: [{
5353
image: 'nginx',
5454
volumeMounts: [{
55-
volume,
55+
volume: dataVolume,
56+
path: '/data',
57+
}, {
58+
volume: Volume.fromName(chart, "pvc-template-temp", "temp-volume"),
5659
path: '/data',
5760
}],
5861
}],
5962
// Define PVC templates during initialization
6063
volumeClaimTemplates: [{
61-
name: 'data-volume', // Must match a volume mount name in a container
64+
name: dataVolume.name,
65+
storage: Size.gibibytes(10),
66+
accessModes: [kplus.PersistentVolumeAccessMode.READ_WRITE_ONCE],
67+
storageClassName: 'standard', // Optional: Specify the storage class
68+
}, {
69+
name: 'temp-volume', // Must match a volume mount name in a container
6270
storage: Size.gibibytes(10),
6371
accessModes: [kplus.PersistentVolumeAccessMode.READ_WRITE_ONCE],
6472
storageClassName: 'standard', // Optional: Specify the storage class

0 commit comments

Comments
 (0)