squakez commented on code in PR #5157:
URL: https://github.com/apache/camel-k/pull/5157#discussion_r1491154763


##########
pkg/controller/build/build_monitor.go:
##########
@@ -129,3 +138,28 @@ func monitorRunningBuild(build *v1.Build) {
 func monitorFinishedBuild(build *v1.Build) {
        runningBuilds.Delete(types.NamespacedName{Namespace: build.Namespace, 
Name: build.Name}.String())
 }
+
+func scheduledReadyBuildcondition(build *v1.Build) *v1.BuildCondition {
+       return &v1.BuildCondition{
+               Type:   v1.BuildConditionScheduled,
+               Status: corev1.ConditionTrue,
+               Reason: v1.BuildConditionReadyReason,
+               Message: fmt.Sprintf(
+                       "the build (%s) is scheduled",
+                       build.Name,
+               ),
+       }
+}
+
+func scheduledWaitingBuildcondition(build *v1.Build, reason string) 
*v1.BuildCondition {

Review Comment:
   Duplicated code. Either you have a generic func to return a condition, or 
simply favor the inline creation of the condition from the callers.



##########
pkg/controller/build/schedule.go:
##########
@@ -59,28 +59,33 @@ func (action *scheduleAction) Handle(ctx context.Context, 
build *v1.Build) (*v1.
        action.lock.Lock()
        defer action.lock.Unlock()
 
-       if allowed, err := action.buildMonitor.canSchedule(ctx, action.reader, 
build); err != nil {
+       allowed, schedulingCondition, err := 
action.buildMonitor.canSchedule(ctx, action.reader, build)
+
+       if err != nil {
                return nil, err
        } else if !allowed {
+               action.L.Infof("GFO %s Build not allowed", build.Name)

Review Comment:
   Not really needed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to