resources #2
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user