@@ -131,12 +131,12 @@ const (
131131
132132// ensureRouterDeployment ensures the router deployment exists for a given
133133// ingresscontroller.
134- func (r * reconciler ) ensureRouterDeployment (ci * operatorv1.IngressController , infraConfig * configv1.Infrastructure , ingressConfig * configv1.Ingress , apiConfig * configv1.APIServer , networkConfig * configv1.Network , haveClientCAConfigmap bool , clientCAConfigmap * corev1.ConfigMap , clusterProxyConfig * configv1.Proxy , proxyNeeded bool ) (bool , * appsv1.Deployment , error ) {
134+ func (r * reconciler ) ensureRouterDeployment (ci * operatorv1.IngressController , infraConfig * configv1.Infrastructure , ingressConfig * configv1.Ingress , apiConfig * configv1.APIServer , networkConfig * configv1.Network , haveClientCAConfigmap bool , clientCAConfigmap * corev1.ConfigMap , clusterProxyConfig * configv1.Proxy , currentLBService * corev1. Service , proxyNeeded bool ) (bool , * appsv1.Deployment , error ) {
135135 haveDepl , current , err := r .currentRouterDeployment (ci )
136136 if err != nil {
137137 return false , nil , err
138138 }
139- desired , err := desiredRouterDeployment (ci , & r .config , ingressConfig , infraConfig , apiConfig , networkConfig , proxyNeeded , haveClientCAConfigmap , clientCAConfigmap , clusterProxyConfig )
139+ desired , err := desiredRouterDeployment (ci , & r .config , ingressConfig , infraConfig , apiConfig , networkConfig , currentLBService , proxyNeeded , haveClientCAConfigmap , clientCAConfigmap , clusterProxyConfig )
140140 if err != nil {
141141 return haveDepl , current , fmt .Errorf ("failed to build router deployment: %v" , err )
142142 }
@@ -258,7 +258,7 @@ func headerValues(values []operatorv1.IngressControllerHTTPHeader) string {
258258}
259259
260260// desiredRouterDeployment returns the desired router deployment.
261- func desiredRouterDeployment (ci * operatorv1.IngressController , config * Config , ingressConfig * configv1.Ingress , infraConfig * configv1.Infrastructure , apiConfig * configv1.APIServer , networkConfig * configv1.Network , proxyNeeded bool , haveClientCAConfigmap bool , clientCAConfigmap * corev1.ConfigMap , clusterProxyConfig * configv1.Proxy ) (* appsv1.Deployment , error ) {
261+ func desiredRouterDeployment (ci * operatorv1.IngressController , config * Config , ingressConfig * configv1.Ingress , infraConfig * configv1.Infrastructure , apiConfig * configv1.APIServer , networkConfig * configv1.Network , currentLBService * corev1. Service , proxyNeeded bool , haveClientCAConfigmap bool , clientCAConfigmap * corev1.ConfigMap , clusterProxyConfig * configv1.Proxy ) (* appsv1.Deployment , error ) {
262262 deployment := manifests .RouterDeployment ()
263263 name := controller .RouterDeploymentName (ci )
264264 deployment .Name = name .Name
@@ -650,6 +650,33 @@ func desiredRouterDeployment(ci *operatorv1.IngressController, config *Config, i
650650 }
651651 env = append (env , corev1.EnvVar {Name : RouterHAProxyThreadsEnvName , Value : strconv .Itoa (threads )})
652652
653+ // Check for AWS deployment, and if so and exposed via NLB, need to change default timeout tunnel to less than 350s
654+ // https://issues.redhat.com/browse/OCPBUGS-54702
655+ var tunnelTimeout * time.Duration
656+ if ci .Spec .TuningOptions .TunnelTimeout != nil && ci .Spec .TuningOptions .TunnelTimeout .Duration > 0 * time .Second {
657+ // honor any configuration provided by the user
658+ tunnelTimeout = & ci .Spec .TuningOptions .TunnelTimeout .Duration
659+ } else {
660+ // no config from the user, checking for NLB
661+ isAWS := infraConfig .Status .PlatformStatus != nil &&
662+ infraConfig .Status .PlatformStatus .Type == configv1 .AWSPlatformType
663+ if isAWS {
664+ var lbType operatorv1.AWSLoadBalancerType
665+ if currentLBService != nil {
666+ lbType = getAWSLoadBalancerTypeFromServiceAnnotation (currentLBService )
667+ } else {
668+ lbType = getAWSLoadBalancerTypeInStatus (ci )
669+ }
670+ if lbType == operatorv1 .AWSNetworkLoadBalancer {
671+ // NLB at AWS, need to use less than 350s as the timeout
672+ tunnelTimeout = ptr .To ((awsNLBDefaultTunnelTimeoutSeconds - 1 ) * time .Second )
673+ }
674+ }
675+ }
676+ if tunnelTimeout != nil {
677+ env = append (env , corev1.EnvVar {Name : "ROUTER_DEFAULT_TUNNEL_TIMEOUT" , Value : durationToHAProxyTimespec (* tunnelTimeout )})
678+ }
679+
653680 if ci .Spec .HTTPHeaders != nil && len (ci .Spec .HTTPHeaders .Actions .Response ) != 0 {
654681 env = append (env , corev1.EnvVar {Name : RouterHTTPResponseHeaders , Value : headerValues (ci .Spec .HTTPHeaders .Actions .Response )})
655682 }
@@ -670,9 +697,6 @@ func desiredRouterDeployment(ci *operatorv1.IngressController, config *Config, i
670697 if ci .Spec .TuningOptions .ServerFinTimeout != nil && ci .Spec .TuningOptions .ServerFinTimeout .Duration > 0 * time .Second {
671698 env = append (env , corev1.EnvVar {Name : "ROUTER_DEFAULT_SERVER_FIN_TIMEOUT" , Value : durationToHAProxyTimespec (ci .Spec .TuningOptions .ServerFinTimeout .Duration )})
672699 }
673- if ci .Spec .TuningOptions .TunnelTimeout != nil && ci .Spec .TuningOptions .TunnelTimeout .Duration > 0 * time .Second {
674- env = append (env , corev1.EnvVar {Name : "ROUTER_DEFAULT_TUNNEL_TIMEOUT" , Value : durationToHAProxyTimespec (ci .Spec .TuningOptions .TunnelTimeout .Duration )})
675- }
676700 if ci .Spec .TuningOptions .ConnectTimeout != nil && ci .Spec .TuningOptions .ConnectTimeout .Duration > 0 * time .Second {
677701 env = append (env , corev1.EnvVar {Name : "ROUTER_DEFAULT_CONNECT_TIMEOUT" , Value : durationToHAProxyTimespec (ci .Spec .TuningOptions .ConnectTimeout .Duration )})
678702 }
0 commit comments