Allow setting no limits and requests for Brainstore#70
Allow setting no limits and requests for Brainstore#70Jeff McCollum (jeffmccollum) merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f45da2433d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".
| memory: {{ .Values.brainstore.reader.resources.limits.memory | quote }} | ||
| {{- $resources := .Values.brainstore.reader.resources }} | ||
| {{- if and (eq .Values.cloud "google") (eq .Values.google.mode "autopilot") .Values.brainstore.reader.volume.size }} | ||
| {{- $resources = merge (dict "requests" (merge $resources.requests (dict "ephemeral-storage" .Values.brainstore.reader.volume.size))) $resources }} |
There was a problem hiding this comment.
Deep-copy resources before merge
merge mutates its destination map, and here the destination is $resources.requests, which is a direct reference into .Values. That means rendering this template can mutate chart values in-place; if a deploy uses shared resource maps (for example via YAML anchors or generated values reused across reader/writer/fastreader), the injected ephemeral-storage request can bleed into other components unexpectedly. Wrap the merged maps in deepCopy before merging to keep template rendering isolated.
Useful? React with 👍 / 👎.
| memory: {{ .Values.brainstore.reader.resources.limits.memory | quote }} | ||
| {{- $resources := .Values.brainstore.reader.resources }} | ||
| {{- if and (eq .Values.cloud "google") (eq .Values.google.mode "autopilot") .Values.brainstore.reader.volume.size }} | ||
| {{- $resources = merge (dict "requests" (merge $resources.requests (dict "ephemeral-storage" .Values.brainstore.reader.volume.size))) $resources }} |
There was a problem hiding this comment.
Enforce autopilot ephemeral-storage with overwrite
This merge expression does not guarantee that volume.size wins: merge gives precedence to the first map, so an existing resources.requests.ephemeral-storage value is kept and the autopilot-required value from volume.size is ignored. In the autopilot branch this can render a pod request that no longer matches the configured volume size, which can lead to scheduling/rejection issues. Use mergeOverwrite (or explicit set) for ephemeral-storage in this path.
Useful? React with 👍 / 👎.
For Brainstore, pass in resources as is, other than required ones for GKE Autopilot.