linter fixes
All checks were successful
Lint / Run on Ubuntu (push) Successful in 21s
Tests / Run on Ubuntu (push) Successful in 26s
Lint / Run on Ubuntu (pull_request) Successful in 20s
Tests / Run on Ubuntu (pull_request) Successful in 50s

This commit is contained in:
2025-05-01 19:39:58 +05:00
parent 23b333c07d
commit 2f05069e01
2 changed files with 17 additions and 9 deletions

View File

@@ -80,15 +80,23 @@ func (r *DeploymentDefaultsReconciler) Reconcile(ctx context.Context, req ctrl.R
defaultMemLim, errMemLim := parseQuantity(defaults.MemoryLimit) defaultMemLim, errMemLim := parseQuantity(defaults.MemoryLimit)
var parseErrors []string var parseErrors []string
if errCPUReq != nil { parseErrors = append(parseErrors, fmt.Sprintf("CPURequest: %v", errCPUReq)) } if errCPUReq != nil {
if errMemReq != nil { parseErrors = append(parseErrors, fmt.Sprintf("MemoryRequest: %v", errMemReq)) } parseErrors = append(parseErrors, fmt.Sprintf("CPURequest: %v", errCPUReq))
if errCPULim != nil { parseErrors = append(parseErrors, fmt.Sprintf("CPULimit: %v", errCPULim)) } }
if errMemLim != nil { parseErrors = append(parseErrors, fmt.Sprintf("MemoryLimit: %v", errMemLim)) } if errMemReq != nil {
parseErrors = append(parseErrors, fmt.Sprintf("MemoryRequest: %v", errMemReq))
}
if errCPULim != nil {
parseErrors = append(parseErrors, fmt.Sprintf("CPULimit: %v", errCPULim))
}
if errMemLim != nil {
parseErrors = append(parseErrors, fmt.Sprintf("MemoryLimit: %v", errMemLim))
}
if len(parseErrors) > 0 { if len(parseErrors) > 0 {
errMsg := fmt.Sprintf("Invalid resource quantity format in NodeTainterConfig %s: %s", config.Name, strings.Join(parseErrors, "; ")) parsingError := fmt.Errorf("invalid resource quantity format in NodeTainterConfig %s: %s", config.Name, strings.Join(parseErrors, "; "))
log.Error(fmt.Errorf(errMsg), "Default resource parsing failed") log.Error(parsingError, "Default resource parsing failed", "configName", config.Name, "parsingErrors", parseErrors)
r.Recorder.Eventf(&deployment, corev1.EventTypeWarning, "ConfigError", "Invalid defaults in config %s: %s", config.Name, strings.Join(parseErrors, "; ")) r.Recorder.Eventf(&deployment, corev1.EventTypeWarning, "ConfigError", parsingError.Error())
return ctrl.Result{}, nil return ctrl.Result{}, nil
} }