Skip to content

Commit

Permalink
Chore: improve function names for clarity in che_routing.go
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Obuchowicz <[email protected]>
  • Loading branch information
AObuchow committed Oct 4, 2024
1 parent fc373a1 commit df6fd02
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers/devworkspace/solver/che_routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ func exposeAllEndpoints(cheCluster *chev2.CheCluster, routing *dwo.DevWorkspaceR
if e.Attributes.GetString(urlRewriteSupportedEndpointAttributeName, nil) == "true" {
addEndpointToTraefikConfig(componentName, e, wsRouteConfig, cheCluster, routing, endpointStrategy)
} else {
service, err := getEndpointService(objs, e, commonService)
service, err := determineEndpointService(objs, e, commonService)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -565,7 +565,7 @@ func getCommonService(objs *solvers.RoutingObjects, dwId string) *corev1.Service
return nil
}

func getServiceForEndpoint(objs *solvers.RoutingObjects, endpoint dwo.Endpoint) *corev1.Service {
func getEndpointService(objs *solvers.RoutingObjects, endpoint dwo.Endpoint) *corev1.Service {
endpointServiceName := common.EndpointName(endpoint.Name)
for _, svc := range objs.Services {
if svc.Name == endpointServiceName {
Expand All @@ -580,9 +580,9 @@ func getServiceForEndpoint(objs *solvers.RoutingObjects, endpoint dwo.Endpoint)
//
// Endpoints with the "discoverable" attribute set have their own service that should be used.
// Endpoints that do not set the "discoverable" attribute should use the common service associated with the workspace.
func getEndpointService(objs *solvers.RoutingObjects, endpoint dwo.Endpoint, commonService *corev1.Service) (*corev1.Service, error) {
func determineEndpointService(objs *solvers.RoutingObjects, endpoint dwo.Endpoint, commonService *corev1.Service) (*corev1.Service, error) {
if endpoint.Attributes.GetBoolean(string(dwo.DiscoverableAttribute), nil) {
endpointService := getServiceForEndpoint(objs, endpoint)
endpointService := getEndpointService(objs, endpoint)
if endpointService == nil {
return nil, fmt.Errorf("could not find endpoint-specfic service for endpoint '%s'", endpoint.Name)
}
Expand Down

0 comments on commit df6fd02

Please sign in to comment.