mfordjody commented on code in PR #892:
URL: https://github.com/apache/dubbo-go-pixiu/pull/892#discussion_r3004301539
##########
controllers/internal/controller/gateway_controller.go:
##########
@@ -1159,3 +1259,116 @@ func isNumeric(s string) bool {
}
return len(s) > 0
}
+
+// resolveServiceClusterEndpoints resolves Service DNS names in
ServiceClusterConfig endpoints to actual IPs
+func (r *GatewayReconciler) resolveServiceClusterEndpoints(ctx
context.Context, namespace string, cluster *converter.Cluster, serviceConfig
*v1alpha1.ServiceClusterConfig) {
+ if len(serviceConfig.Endpoints) == 0 {
+ return
+ }
+
+ for i := range serviceConfig.Endpoints {
+ ep := &serviceConfig.Endpoints[i]
+ if !isIPAddress(ep.Address) {
+ serviceName, serviceNamespace :=
parseServiceAddress(ep.Address, namespace)
+ r.Log.Info("resolving service DNS", "address",
ep.Address, "serviceName", serviceName, "namespace", serviceNamespace)
+
+ endpoints, err := r.resolveServiceEndpoints(ctx,
serviceNamespace, serviceName, ep.Port)
+ if err == nil && len(endpoints) > 0 {
+ r.Log.Info("resolved service to endpoints",
"service", serviceName, "endpointCount", len(endpoints))
+ serviceConfig.Endpoints =
[]v1alpha1.EndpointConfig{}
Review Comment:
done.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]