@@ -3015,6 +3015,19 @@ func findPoliciesForSecret(policies []*conf_v1.Policy, secretNamespace string, s
3015
3015
return res
3016
3016
}
3017
3017
3018
+ func (lbc * LoadBalancerController ) getTransportServerBackupEndpointsAndKey (transportServer * conf_v1.TransportServer , u conf_v1.TransportServerUpstream , externalNameSvcs map [string ]bool ) ([]string , string ) {
3019
+ backupEndpointsKey := configs .GenerateEndpointsKey (transportServer .Namespace , u .Backup , nil , * u .BackupPort )
3020
+ backupEndps , external , err := lbc .getEndpointsForUpstream (transportServer .Namespace , u .Backup , * u .BackupPort )
3021
+ if err != nil {
3022
+ glog .Warningf ("Error getting Endpoints for Upstream %v: %v" , u .Name , err )
3023
+ }
3024
+ if err == nil && external {
3025
+ externalNameSvcs [configs .GenerateExternalNameSvcKey (transportServer .Namespace , u .Backup )] = true
3026
+ }
3027
+ bendps := getIPAddressesFromEndpoints (backupEndps )
3028
+ return bendps , backupEndpointsKey
3029
+ }
3030
+
3018
3031
func (lbc * LoadBalancerController ) createTransportServerEx (transportServer * conf_v1.TransportServer , listenerPort int ) * configs.TransportServerEx {
3019
3032
endpoints := make (map [string ][]string )
3020
3033
externalNameSvcs := make (map [string ]bool )
@@ -3042,17 +3055,8 @@ func (lbc *LoadBalancerController) createTransportServerEx(transportServer *conf
3042
3055
}
3043
3056
}
3044
3057
3045
- // If backup defined on Upstream retrieve its external name and port.
3046
3058
if u .Backup != "" && u .BackupPort != nil {
3047
- backupEndpointsKey := configs .GenerateEndpointsKey (transportServer .Namespace , u .Backup , nil , * u .BackupPort )
3048
- backupEndps , external , err := lbc .getEndpointsForUpstream (transportServer .Namespace , u .Backup , * u .BackupPort )
3049
- if err != nil {
3050
- glog .Warningf ("Error getting Endpoints for Upstream %v: %v" , u .Name , err )
3051
- }
3052
- if err == nil && external {
3053
- externalNameSvcs [configs .GenerateExternalNameSvcKey (transportServer .Namespace , u .Backup )] = true
3054
- }
3055
- bendps := getIPAddressesFromEndpoints (backupEndps )
3059
+ bendps , backupEndpointsKey := lbc .getTransportServerBackupEndpointsAndKey (transportServer , u , externalNameSvcs )
3056
3060
endpoints [backupEndpointsKey ] = bendps
3057
3061
}
3058
3062
}
0 commit comments