@@ -423,43 +423,33 @@ func (r *AgentReconciler) getA2AHealthPath(protocol *runtimev1alpha1.AgentProtoc
423423
424424// generateReadinessProbe generates appropriate readiness probe based on agent protocols
425425func (r * AgentReconciler ) generateReadinessProbe (agent * runtimev1alpha1.Agent ) * corev1.Probe {
426+ // Check if agent has external dependencies (subAgents or tools)
427+ hasExternalDeps := len (agent .Spec .SubAgents ) > 0 || len (agent .Spec .Tools ) > 0
428+
426429 // Priority: A2A > OpenAI > None
427430 if r .hasA2AProtocol (agent ) {
428431 // Use A2A agent card endpoint for health check
429432 a2aProtocol := r .getA2AProtocol (agent )
430433 healthPath := r .getA2AHealthPath (a2aProtocol )
431434 port := r .getProtocolPort (a2aProtocol , 8000 )
432435
433- return & corev1.Probe {
434- ProbeHandler : corev1.ProbeHandler {
435- HTTPGet : & corev1.HTTPGetAction {
436- Path : healthPath ,
437- Port : intstr .FromInt (int (port )),
438- },
439- },
440- InitialDelaySeconds : 10 ,
441- PeriodSeconds : 5 ,
442- TimeoutSeconds : 3 ,
443- SuccessThreshold : 1 ,
444- FailureThreshold : 3 ,
436+ probe := r .buildA2AReadinessProbe (healthPath , port )
437+ if hasExternalDeps {
438+ // More generous timing for agents with external dependencies
439+ return delay (probe , 180 , 20 , 10 )
445440 }
441+ return probe
446442 } else if r .hasOpenAIProtocol (agent ) {
447443 // Use TCP probe for OpenAI-only agents
448444 openaiProtocol := r .getOpenAIProtocol (agent )
449445 port := r .getProtocolPort (openaiProtocol , 8000 )
450446
451- return & corev1.Probe {
452- ProbeHandler : corev1.ProbeHandler {
453- TCPSocket : & corev1.TCPSocketAction {
454- Port : intstr .FromInt (int (port )),
455- },
456- },
457- InitialDelaySeconds : 10 ,
458- PeriodSeconds : 5 ,
459- TimeoutSeconds : 3 ,
460- SuccessThreshold : 1 ,
461- FailureThreshold : 3 ,
447+ probe := r .buildOpenAIReadinessProbe (port )
448+ if hasExternalDeps {
449+ // More generous timing for agents with external dependencies
450+ return delay (probe , 180 , 20 , 10 )
462451 }
452+ return probe
463453 }
464454
465455 // No recognized protocols - no readiness probe
@@ -881,3 +871,46 @@ func (r *AgentReconciler) SetupWithManager(mgr ctrl.Manager) error {
881871 Named ("agent" ).
882872 Complete (r )
883873}
874+
875+ // buildOpenAIReadinessProbe creates TCP-readiness-probe for OpenAI-protocols
876+ func (r * AgentReconciler ) buildOpenAIReadinessProbe (port int32 ) * corev1.Probe {
877+ return & corev1.Probe {
878+ ProbeHandler : corev1.ProbeHandler {
879+ TCPSocket : & corev1.TCPSocketAction {
880+ Port : intstr .FromInt (int (port )),
881+ },
882+ },
883+ InitialDelaySeconds : 10 ,
884+ PeriodSeconds : 5 ,
885+ TimeoutSeconds : 3 ,
886+ SuccessThreshold : 1 ,
887+ FailureThreshold : 3 ,
888+ }
889+ }
890+
891+ // buildA2AReadinessProbe creates HTTP-readiness-probe for A2A-protocols.
892+ func (r * AgentReconciler ) buildA2AReadinessProbe (healthPath string , port int32 ) * corev1.Probe {
893+ return & corev1.Probe {
894+ ProbeHandler : corev1.ProbeHandler {
895+ HTTPGet : & corev1.HTTPGetAction {
896+ Path : healthPath ,
897+ Port : intstr .FromInt (int (port )),
898+ },
899+ },
900+ InitialDelaySeconds : 10 ,
901+ PeriodSeconds : 5 ,
902+ TimeoutSeconds : 3 ,
903+ SuccessThreshold : 1 ,
904+ FailureThreshold : 3 ,
905+ }
906+ }
907+
908+ // delay modifies probe timing settings for agents with external dependencies
909+ func delay (probe * corev1.Probe , initialDelaySeconds int32 , timeoutSeconds int32 , failureThreshold int32 ) * corev1.Probe {
910+ if probe != nil {
911+ probe .InitialDelaySeconds = initialDelaySeconds
912+ probe .TimeoutSeconds = timeoutSeconds
913+ probe .FailureThreshold = failureThreshold
914+ }
915+ return probe
916+ }
0 commit comments