Skip to content

Commit c99a8ca

Browse files
Merge pull request opendatahub-io#91 from rimolive/rmartine
Remove some conditions in DSPA
2 parents efcbb82 + d846810 commit c99a8ca

File tree

2 files changed

+9
-40
lines changed

2 files changed

+9
-40
lines changed

controllers/config/defaults.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,11 @@ const (
6464
)
6565

6666
const (
67-
DatabaseReady = "DatabaseReady"
68-
DataBaseFailedToDeploy = "DataBaseFailedToDeploy"
69-
ObjectStorageReady = "ObjectStorageReady"
70-
ObjectStorageFailedToDeploy = "ObjectStorageFailedToDeploy"
71-
APIServerReady = "APIServerReady"
72-
PersistenceAgentReady = "PersistenceAgentReady"
73-
ScheduledWorkflowReady = "ScheduledWorkflowReady"
74-
UserInterfaceReady = "UserInterfaceReady"
75-
CrReady = "Ready"
76-
MinimumReplicasAvailable = "MinimumReplicasAvailable"
67+
APIServerReady = "APIServerReady"
68+
PersistenceAgentReady = "PersistenceAgentReady"
69+
ScheduledWorkflowReady = "ScheduledWorkflowReady"
70+
CrReady = "Ready"
71+
MinimumReplicasAvailable = "MinimumReplicasAvailable"
7772
)
7873

7974
// Any required Configmap paths can be added here,

controllers/dspipeline_controller.go

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ func (r *DSPAReconciler) buildCondition(conditionType string, dspa *dspav1alpha1
114114
condition.ObservedGeneration = dspa.Generation
115115
condition.Status = metav1.ConditionFalse
116116
condition.Reason = reason
117-
118-
if dspa.Status.Conditions == nil {
119-
condition.LastTransitionTime = metav1.Now()
120-
}
117+
condition.LastTransitionTime = metav1.Now()
121118

122119
return condition
123120
}
@@ -225,28 +222,16 @@ func (r *DSPAReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
225222
// Initialize conditions
226223
var conditions []metav1.Condition
227224

228-
databaseReady := r.buildCondition(config.DatabaseReady, dspa, config.DatabaseReady)
229225
err = r.ReconcileDatabase(ctx, dspa, params)
230226
if err != nil {
231227
return ctrl.Result{}, err
232228
}
233229

234-
if r.isDeploymentAvailable(ctx, dspa, "mariadb") {
235-
databaseReady.Status = metav1.ConditionTrue
236-
}
237-
conditions = append(conditions, databaseReady)
238-
239-
objectStorageReady := r.buildCondition(config.ObjectStorageReady, dspa, config.ObjectStorageReady)
240230
err = r.ReconcileStorage(ctx, dspa, params)
241231
if err != nil {
242232
return ctrl.Result{}, err
243233
}
244234

245-
if r.isDeploymentAvailable(ctx, dspa, "minio") {
246-
objectStorageReady.Status = metav1.ConditionTrue
247-
}
248-
conditions = append(conditions, objectStorageReady)
249-
250235
err = r.ReconcileCommon(dspa, params)
251236
if err != nil {
252237
return ctrl.Result{}, err
@@ -285,17 +270,11 @@ func (r *DSPAReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
285270
}
286271
conditions = append(conditions, scheduledWorkflowReady)
287272

288-
userInterfaceReady := r.buildCondition(config.UserInterfaceReady, dspa, config.MinimumReplicasAvailable)
289273
err = r.ReconcileUI(dspa, params)
290274
if err != nil {
291275
return ctrl.Result{}, err
292276
}
293277

294-
if r.isDeploymentAvailable(ctx, dspa, "ds-pipeline-ui") {
295-
userInterfaceReady.Status = metav1.ConditionTrue
296-
}
297-
conditions = append(conditions, userInterfaceReady)
298-
299278
err = r.ReconcileViewerCRD(dspa, params)
300279
if err != nil {
301280
return ctrl.Result{}, err
@@ -307,22 +286,17 @@ func (r *DSPAReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
307286
crReady.Type = config.CrReady
308287

309288
// Compute Ready Logic for the CR
310-
if ((apiServerReady.Status == metav1.ConditionTrue) &&
289+
if (apiServerReady.Status == metav1.ConditionTrue) &&
311290
(persistenceAgentReady.Status == metav1.ConditionTrue) &&
312-
(scheduledWorkflowReady.Status == metav1.ConditionTrue) &&
313-
(databaseReady.Status == metav1.ConditionTrue) &&
314-
(objectStorageReady.Status == metav1.ConditionTrue)) &&
315-
(userInterfaceReady.Status == metav1.ConditionTrue || (userInterfaceReady.Status == metav1.ConditionFalse && !dspa.Spec.MlPipelineUI.Deploy)) {
291+
(scheduledWorkflowReady.Status == metav1.ConditionTrue) {
316292
crReady.Status = metav1.ConditionTrue
317293
} else {
318294
crReady.Status = metav1.ConditionFalse
319295
}
320296
conditions = append(conditions, crReady)
321297

322298
for i, condition := range dspa.Status.Conditions {
323-
if condition.Status != conditions[i].Status {
324-
conditions[i].LastTransitionTime = metav1.Now()
325-
} else {
299+
if condition.Status == conditions[i].Status {
326300
conditions[i].LastTransitionTime = condition.LastTransitionTime
327301
}
328302
}

0 commit comments

Comments
 (0)