Skip to content

Commit 79f4b52

Browse files
Merge pull request #42 from uselagoon/rename-var-storage-size
chore: rename variables to avoid confusion about data type
2 parents d19aa1a + 39487a0 commit 79f4b52

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

internal/storage/pod.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,13 @@ func (c *Calculator) createStoragePod(
203203
c.cleanup(ctx, opLog, storagePod)
204204
return fmt.Errorf("error checking storage-calculator pod %s/%s for pvc %s size: %v", namespace.Name, podName, vol.Name, err)
205205
}
206-
pBytes := strings.TrimSpace(pvcValue)
207-
pBytesInt, _ := strconv.Atoi(pBytes)
206+
kiBytes := strings.TrimSpace(pvcValue)
207+
kiBytesInt, _ := strconv.Atoi(kiBytes)
208208
storData.Claims = append(storData.Claims, StorageClaim{
209209
Environment: environmentID,
210210
PersisteStorageClaim: vol.Name,
211-
BytesUsed: uint64(pBytesInt),
212-
KiBUsed: uint64(pBytesInt),
211+
BytesUsed: uint64(kiBytesInt),
212+
KiBUsed: uint64(kiBytesInt),
213213
})
214214
}
215215

@@ -229,20 +229,20 @@ func (c *Calculator) createStoragePod(
229229
if mdbValue != "" {
230230
// if there is a value returned that isn't "no database"
231231
// then storedata against the event data
232-
mBytes := strings.TrimSpace(mdbValue)
233-
mBytesInt, _ := strconv.Atoi(mBytes)
232+
kiBytes := strings.TrimSpace(mdbValue)
233+
kiBytesInt, _ := strconv.Atoi(kiBytes)
234234
storData.Claims = append(storData.Claims, StorageClaim{
235235
Environment: environmentID,
236236
PersisteStorageClaim: "mariadb",
237-
BytesUsed: uint64(mBytesInt),
238-
KiBUsed: uint64(mBytesInt),
237+
BytesUsed: uint64(kiBytesInt),
238+
KiBUsed: uint64(kiBytesInt),
239239
})
240240
// and attempt to patch the namespace with the labels
241241
mergePatch, _ := json.Marshal(map[string]interface{}{
242242
"metadata": map[string]interface{}{
243243
"labels": map[string]string{
244-
"lagoon/storage-mariadb": mBytes,
245-
"lagoon.sh/storage-mariadb": mBytes,
244+
"lagoon/storage-mariadb": kiBytes,
245+
"lagoon.sh/storage-mariadb": kiBytes,
246246
},
247247
},
248248
})

0 commit comments

Comments
 (0)