Skip to content

Conversation

@benkeil
Copy link
Contributor

@benkeil benkeil commented Oct 11, 2025

@benkeil benkeil force-pushed the feat/add-volume-claim-templates branch from 4f352bb to 3461368 Compare October 11, 2025 14:20
@iliapolo iliapolo changed the title feat: add volumeClaimTemplates to kplus.StatefulSet feat(stateful-set): allow configuring volumeClaimTemplates Oct 16, 2025
@iliapolo iliapolo added backport-to-k8s-31/main Backport a PR to the k8s-31 branch backport-to-k8s-32/main Backport a PR to the k8s-32 branch labels Oct 16, 2025
*
* This name should match the name of a volume mount in one of the containers.
*/
readonly name: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we accept a Volume here instead? or a VolumeMount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would let it as it is. You could still use the volume as a variable and use name: volume.name, I would not use it like this.

I could also think about something like:

VolumeClaimTemplatesSomeSuffix.fromVolume(volume, {
  storage: Size.gibibytes(20),
  accessModes: [kplus.PersistentVolumeAccessMode.READ_WRITE_ONCE_POD],
  storageClassName: 'standard',
})

But to be honest my absolute favourite would be something like:

new kplus.StatefulSet(chart, 'StatefulSet', {
  containers: [
    {
      image: 'foobar',
      portNumber: 80,
      volumeMounts: [
        {
          volume: Volume.fromClaimTemplate({
            name: "data",
            storage: Size.gibibytes(20),
            accessModes: [kplus.PersistentVolumeAccessMode.READ_WRITE_ONCE_POD],
            storageClassName: 'standard',
          }),
          path: '/mnt/data',
        },
      ],
    },
  ],
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like Volume.fromClaimTemplate - probably a bit more involved to implement. Don't want to block on it so i'm approving this one. Feel free to add it in a subsequent PR though as an enhancement.

@benkeil benkeil force-pushed the feat/add-volume-claim-templates branch from 002c2aa to c245003 Compare October 16, 2025 16:56
benkeil and others added 15 commits October 16, 2025 19:00
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18441834896

------

*Automatically created by projen via the "upgrade-dev-dependencies-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18460692313

------

*Automatically created by projen via the "upgrade-dev-dependencies-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18470006676

------

*Automatically created by projen via the "upgrade-configuration-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18491339374

------

*Automatically created by projen via the "upgrade-dev-dependencies-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18500936773

------

*Automatically created by projen via the "upgrade-configuration-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18523663856

------

*Automatically created by projen via the "upgrade-dev-dependencies-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18528151867

------

*Automatically created by projen via the "upgrade-compiler-dependencies-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18533358066

------

*Automatically created by projen via the "upgrade-configuration-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18556119076

------

*Automatically created by projen via the "upgrade-dev-dependencies-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18560556728

------

*Automatically created by projen via the "upgrade-compiler-dependencies-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdk8s-team/cdk8s-plus/actions/runs/18565712529

------

*Automatically created by projen via the "upgrade-configuration-k8s-33-main" workflow*

Signed-off-by: Ben Keil <[email protected]>
Signed-off-by: Ben Keil <[email protected]>
@benkeil benkeil force-pushed the feat/add-volume-claim-templates branch from c245003 to e3bf4bb Compare October 16, 2025 17:00
@iliapolo
Copy link
Member

@benkeil looks good, you got some build failures though.

Signed-off-by: Ben Keil <[email protected]>
@iliapolo
Copy link
Member

@benkeil new failures :)

Signed-off-by: Ben Keil <[email protected]>
Signed-off-by: Ben Keil <[email protected]>
@benkeil
Copy link
Contributor Author

benkeil commented Oct 16, 2025

wait until it runs in my fork

@benkeil
Copy link
Contributor Author

benkeil commented Oct 16, 2025

ok, build was successful

@mergify mergify bot added the queued label Oct 17, 2025
@mergify mergify bot merged commit d9ccf66 into cdk8s-team:k8s-33/main Oct 17, 2025
13 checks passed
@mergify mergify bot removed the queued label Oct 17, 2025
cdk8s-automation pushed a commit that referenced this pull request Oct 17, 2025
cdk8s-automation pushed a commit that referenced this pull request Oct 17, 2025
cdk8s-automation pushed a commit that referenced this pull request Oct 17, 2025
@cdk8s-automation
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
k8s-31/main
k8s-32/main

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

cdk8s-automation pushed a commit that referenced this pull request Oct 17, 2025
@cdk8s-automation
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
k8s-31/main
k8s-32/main

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

mergify bot pushed a commit that referenced this pull request Oct 17, 2025
…#6382) (#6419)

# Backport

This will backport the following commits from `k8s-33/main` to `k8s-31/main`:
 - [feat(stateful-set): allow configuring &#x60;volumeClaimTemplates&#x60; (#6382)](#6382)



### Questions ?
Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport)
mergify bot pushed a commit that referenced this pull request Oct 17, 2025
…#6382) (#6420)

# Backport

This will backport the following commits from `k8s-33/main` to `k8s-32/main`:
 - [feat(stateful-set): allow configuring &#x60;volumeClaimTemplates&#x60; (#6382)](#6382)



### Questions ?
Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport)
@benkeil benkeil deleted the feat/add-volume-claim-templates branch October 18, 2025 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-k8s-31/main Backport a PR to the k8s-31 branch backport-to-k8s-32/main Backport a PR to the k8s-32 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support PersistentVolumeClaimTemplate in STS

3 participants