Skip to content

Commit

Permalink
Merge pull request #124 from HumairAK/fix_statuses
Browse files Browse the repository at this point in the history
Fix statuses
  • Loading branch information
openshift-merge-robot authored May 18, 2023
2 parents fe12ad9 + 4c7dcac commit c4742f4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions controllers/dspipeline_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func (r *DSPAReconciler) isDeploymentAvailable(ctx context.Context, dspa *dspav1

err := r.Get(ctx, types.NamespacedName{Name: component, Namespace: dspa.Namespace}, found)
if err == nil {
if found.Spec.Replicas != nil && *found.Spec.Replicas == 0 {
return false
}
for _, s := range found.Status.Conditions {
if s.Type == "Available" && s.Status == corev1.ConditionTrue {
return true
Expand Down Expand Up @@ -318,36 +321,37 @@ func (r *DSPAReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
func (r *DSPAReconciler) PublishMetrics(dspa *dspav1alpha1.DataSciencePipelinesApplication,
apiServerReady, persistenceAgentReady, scheduledWorkflowReady,
crReady metav1.Condition) {
r.Log.Info("Publishing Ready Metrics")
log := r.Log.WithValues("namespace", dspa.Namespace).WithValues("dspa_name", dspa.Name)
log.Info("Publishing Ready Metrics")
if apiServerReady.Status == metav1.ConditionTrue {
r.Log.Info("APIServer Ready")
log.Info("APIServer Ready")
APIServerReadyMetric.WithLabelValues(dspa.Name, dspa.Namespace).Set(1)
} else {
r.Log.Info("APIServer Not Ready")
log.Info("APIServer Not Ready")
APIServerReadyMetric.WithLabelValues(dspa.Name, dspa.Namespace).Set(0)
}

if persistenceAgentReady.Status == metav1.ConditionTrue {
r.Log.Info("PersistanceAgent Ready")
log.Info("PersistanceAgent Ready")
PersistenceAgentReadyMetric.WithLabelValues(dspa.Name, dspa.Namespace).Set(1)
} else {
r.Log.Info("PersistanceAgent Not Ready")
log.Info("PersistanceAgent Not Ready")
PersistenceAgentReadyMetric.WithLabelValues(dspa.Name, dspa.Namespace).Set(0)
}

if scheduledWorkflowReady.Status == metav1.ConditionTrue {
r.Log.Info("ScheduledWorkflow Ready")
log.Info("ScheduledWorkflow Ready")
ScheduledWorkflowReadyMetric.WithLabelValues(dspa.Name, dspa.Namespace).Set(1)
} else {
r.Log.Info("ScheduledWorkflow Not Ready")
log.Info("ScheduledWorkflow Not Ready")
ScheduledWorkflowReadyMetric.WithLabelValues(dspa.Name, dspa.Namespace).Set(0)
}

if crReady.Status == metav1.ConditionTrue {
r.Log.Info("CR Fully Ready")
log.Info("CR Fully Ready")
CrReadyMetric.WithLabelValues(dspa.Name, dspa.Namespace).Set(1)
} else {
r.Log.Info("CR Not Ready")
log.Info("CR Not Ready")
CrReadyMetric.WithLabelValues(dspa.Name, dspa.Namespace).Set(0)
}
}
Expand Down

0 comments on commit c4742f4

Please sign in to comment.