cdk8s-team / cdk8s-plus

A software development framework that provides high level abstractions for authoring Kubernetes applications.
https://cdk8s.io/docs/latest/plus/
Apache License 2.0
133 stars 34 forks source link

Container resources readonly incosistency #4646

Open oleghind opened 3 weeks ago

oleghind commented 3 weeks ago

Description of the bug:

I can adjust cpu resources, but not memory


export class MyChart extends MyBaseChart  {
  constructor(scope: Construct, id: string, props: ChartProps = {}) {
    super(scope, id, props)
    this.someContainer.resources.cpu.request.amount = '3000m'; // Works
    this.someContainer.resources.memory.request.limit = '4096Mi' // Doesn't work, value readonly
});

Please make both adjustable, so child charts can adjust the value without patching yaml


This is :bug: Bug Report

iliapolo commented 1 week ago

@oleghind Apologies for the inconsistency, but the immutable nature of these properties is intentional. You'll note that none of the other properties in the library are mutable. The fact that amount is mutable is actually a mistake/bug:

https://github.com/cdk8s-team/cdk8s-plus/blob/a3afd28ecd403a048f984143e6c2cc7a225120b6/src/container.ts#L1344