feat: rewrite weka_runtime.py in Go (phase 1 - structure, deployment, basic modes)#2492
Conversation
Dependency ReviewThe following issues were found:
License Issuesgo.mod
OpenSSF Scorecard
Scanned Files
|
How to use the Graphite Merge QueueAdd the label main-merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Claude finished @kristina-solovyova's task in 2m 59s —— View job Code Review: Go Runtime Rewrite — Phase 1
Good overall structure for Phase 1. The code is well-organized and the Python-parity comments are helpful. A few issues ranging from critical to minor below. Critical1. JSON w/ single-quotes breaks shell script in script := fmt.Sprintf(`...
echo '%s' > %s
...`, string(b), staging, name, staging, dest)
Fix: write via 2. NETWORK_SELECTORS / MANAGEMENT_IPS_SELECTORS format mismatch —
These fields need a JSON-unmarshal parser, not a comma-splitter. This won't cause issues in Phase 1 if network modes are not yet invoked, but it's a latent bug for Phase 2. Fix this → Medium3. Silent INSTRUCTIONS parse error — if raw := os.Getenv("INSTRUCTIONS"); raw != "" {
var inst v1alpha1.Instructions
if err := json.Unmarshal([]byte(raw), &inst); err == nil {
cfg.Instructions = &inst
}
// if err != nil, cfg.Instructions stays nil — silently
}When JSON is invalid, 4. Unimplemented mode stubs silently succeed — All these are registered via 5. Context from _, logger := instrumentation.CreateLogSpan(ctx, "daemon.supervise", ...)All other callers use Minor6. Go naming convention violation — maj_min := strings.TrimSpace(string(devIndex))Should be 7. Magic string if clusterGUID != proxySignedGUID && clusterGUID != "proxy guid" && !dev.WekaInfo.IsProxy {
8. Misleading log message in hugepages — if !cfg.COSAllowHugepageConfig {
logger.Info("Skipping hugepages configuration (WEKA_COS_ALLOW_HUGEPAGE_CONFIG not set)")
// still check and error if hugepages are missing — fall through to build sedCmds
}The log says "Skipping" but the code does NOT skip — it continues and may 9. Idiomatic Go: if _, err := cmdutil.Output(ctx, ...); err == nil {
return paths, nil
} else {
logger.Warn(...)
}The if _, err := cmdutil.Output(ctx, ...); err != nil {
logger.Warn(...)
}
return paths, nilObservations / Not Issues
|
| script := fmt.Sprintf(`set -e | ||
| mkdir -p /opt/weka/k8s-scripts | ||
| echo '%s' > %s | ||
| weka local run --container %s mv %s %s`, string(b), staging, name, staging, dest) |

No description provided.