in spark-operator/src/main/java/org/apache/spark/k8s/operator/reconciler/SparkAppReconciler.java [87:112]
public UpdateControl<SparkApplication> reconcile(
SparkApplication sparkApplication, Context<SparkApplication> context) throws Exception {
LoggingUtils.TrackedMDC trackedMDC = new LoggingUtils.TrackedMDC();
try {
trackedMDC.set(sparkApplication);
if (sentinelManager.handleSentinelResourceReconciliation(
sparkApplication, context.getClient())) {
return UpdateControl.noUpdate();
}
log.debug("Start application reconciliation.");
sparkAppStatusRecorder.updateStatusFromCache(sparkApplication);
SparkAppContext ctx = new SparkAppContext(sparkApplication, context, submissionWorker);
List<AppReconcileStep> reconcileSteps = getReconcileSteps(sparkApplication);
for (AppReconcileStep step : reconcileSteps) {
ReconcileProgress progress = step.reconcile(ctx, sparkAppStatusRecorder);
if (progress.isCompleted()) {
return ReconcilerUtils.toUpdateControl(sparkApplication, progress);
}
}
return ReconcilerUtils.toUpdateControl(sparkApplication, completeAndDefaultRequeue());
} finally {
log.debug("Reconciliation completed.");
trackedMDC.reset();
}
}