Skip to content

Commit

Permalink
Update Octavia Controller's ready condition
Browse files Browse the repository at this point in the history
Take ready conditions of other services into account as well.
  • Loading branch information
weinimo committed Apr 24, 2024
1 parent 108cec2 commit 113ea27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 14 additions & 4 deletions api/v1beta1/octavia_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,21 @@ func init() {
SchemeBuilder.Register(&Octavia{}, &OctaviaList{})
}

// IsReady - returns true if service is ready to server requests
// IsReady - returns true if services are ready to serve requests
func (instance Octavia) IsReady() bool {
ready := instance.Status.OctaviaAPIReadyCount > 0
// TODO: add other ready counts
return ready
readyCounts := []int32{
instance.Status.OctaviaAPIReadyCount,
instance.Status.OctaviaHealthManagerReadyCount,
instance.Status.OctaviaHousekeepingReadyCount,
instance.Status.OctaviaWorkerReadyCount,
}

for _, readyCount := range readyCounts {
if readyCount < 1 {
return false
}
}
return true
}

// SetupDefaults - initializes any CRD field defaults based on environment variables (the defaulting mechanism itself is implemented via webhooks)
Expand Down
1 change: 0 additions & 1 deletion controllers/amphoracontroller_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ func (r *OctaviaAmphoraControllerReconciler) reconcileNormal(ctx context.Context
} else {
Log.Info("Not all conditions are ready for Amphora controller")
}
Log.Info("Reconciled Service successfully")
return ctrl.Result{}, nil
}

Expand Down

0 comments on commit 113ea27

Please sign in to comment.