Skip to content

Commit b1d3239

Browse files
maxwellgagnoneywalker
authored andcommitted
Update doc strings to improve clarity
1 parent e01b069 commit b1d3239

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

internal/config/types.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,13 @@ func (c *DevEnvConfig) GPU() int {
154154
return c.Resources.GPU
155155
}
156156

157-
// CPU returns the canonical CPU quantity formatted for Kubernetes (e.g., "2500m").
158-
// Returns "0" if CPU <= 0 so callers can omit the field or treat as no request.
157+
// CPU returns the canonical Kubernetes CPU quantity for this config as a
158+
// millicore-formatted string (e.g., "2500m"). The value is computed on demand
159+
// by parsing/normalizing the raw CPU input (e.g., "2", "2.5", "500m", 3)
160+
// via getCanonicalCPU(), which yields a count of millicores. If normalization
161+
// fails or the resulting value is non-positive, CPU returns "0" so callers
162+
// can omit the field or treat it as no explicit CPU request in generated
163+
// manifests.
159164
func (c *DevEnvConfig) CPU() string {
160165
CPU_in_millicores, err := c.Resources.getCanonicalCPU()
161166
if err != nil || CPU_in_millicores <= 0 {
@@ -164,7 +169,13 @@ func (c *DevEnvConfig) CPU() string {
164169
return fmt.Sprintf("%dm", CPU_in_millicores)
165170
}
166171

167-
// Memory returns "Gi" or "Mi" ("" means omit).
172+
// Memory returns the canonical Kubernetes memory quantity for this config,
173+
// choosing "Gi" when the normalized value is an exact Gi multiple and "Mi"
174+
// otherwise. The value is computed on demand by parsing/normalizing the raw
175+
// memory input (e.g., "16Gi", "512Mi", "500M", 1.5) via getCanonicalMemory(),
176+
// which yields a count of mebibytes (Mi). If normalization fails or the
177+
// resulting value is non-positive, Memory returns the empty string so callers
178+
// can omit the field in generated manifests.
168179
func (c *DevEnvConfig) Memory() string {
169180
memory_in_Mi, err := c.Resources.getCanonicalMemory()
170181
if err != nil || memory_in_Mi <= 0 {

0 commit comments

Comments
 (0)