linter fixes
This commit is contained in:
@@ -80,15 +80,23 @@ func (r *DeploymentDefaultsReconciler) Reconcile(ctx context.Context, req ctrl.R
|
||||
defaultMemLim, errMemLim := parseQuantity(defaults.MemoryLimit)
|
||||
|
||||
var parseErrors []string
|
||||
if errCPUReq != nil { parseErrors = append(parseErrors, fmt.Sprintf("CPURequest: %v", errCPUReq)) }
|
||||
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 errCPUReq != nil {
|
||||
parseErrors = append(parseErrors, fmt.Sprintf("CPURequest: %v", errCPUReq))
|
||||
}
|
||||
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 {
|
||||
errMsg := fmt.Sprintf("Invalid resource quantity format in NodeTainterConfig %s: %s", config.Name, strings.Join(parseErrors, "; "))
|
||||
log.Error(fmt.Errorf(errMsg), "Default resource parsing failed")
|
||||
r.Recorder.Eventf(&deployment, corev1.EventTypeWarning, "ConfigError", "Invalid defaults in config %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(parsingError, "Default resource parsing failed", "configName", config.Name, "parsingErrors", parseErrors)
|
||||
r.Recorder.Eventf(&deployment, corev1.EventTypeWarning, "ConfigError", parsingError.Error())
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user