Skip to content

Commit

Permalink
extended getFleets
Browse files Browse the repository at this point in the history
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
  • Loading branch information
jasmingacic committed Apr 5, 2022
1 parent eea2243 commit f46c25f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
5 changes: 2 additions & 3 deletions server/go/api_apis_service_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

kusk "github.com/GIT_USER_ID/GIT_REPO_ID/kusk"
"github.com/GIT_USER_ID/GIT_REPO_ID/util"
"github.com/kubeshop/kusk-gateway/api/v1alpha1"
kuskv1 "github.com/kubeshop/kusk-gateway/api/v1alpha1"
"github.com/kubeshop/kusk-gateway/pkg/spec"
"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -96,15 +95,15 @@ func (s *ApisApiService) GetPostProcessedOpenApiSpec(ctx context.Context, namesp
return Response(http.StatusOK, string(yml)), nil
}

func (s *ApisApiService) convertAPIListCRDtoAPIsModel(apis v1alpha1.APIList) []ApiItem {
func (s *ApisApiService) convertAPIListCRDtoAPIsModel(apis kuskv1.APIList) []ApiItem {
toReturn := []ApiItem{}
for _, api := range apis.Items {
toReturn = append(toReturn, s.convertAPICRDtoAPIModel(&api))
}
return toReturn
}

func (s *ApisApiService) convertAPICRDtoAPIModel(api *v1alpha1.API) ApiItem {
func (s *ApisApiService) convertAPICRDtoAPIModel(api *kuskv1.API) ApiItem {
parser := spec.NewParser(nil)
apiItem := ApiItem{
Name: api.Name,
Expand Down
20 changes: 17 additions & 3 deletions server/go/api_fleets_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,23 @@ func (s *FleetsApiService) convertEnvoyFleetCRDtoEnvoyFleetModel(fleet *v1alpha1
})
}
}
srs := []StaticRouteItemFleet{}
staticRoutes, err := s.kuskClient.GetStaticRoutes("")
if err == nil {
for _, sr := range staticRoutes.Items {
if sr.Spec.Fleet.Name == fleet.Name && sr.Spec.Fleet.Namespace == fleet.Namespace {
srs = append(srs, StaticRouteItemFleet{
Name: sr.Name,
Namespace: sr.Namespace,
})
}
}
}

return EnvoyFleetItem{
Name: fleet.Name,
Namespace: fleet.Namespace,
Apis: apifs,
Name: fleet.Name,
Namespace: fleet.Namespace,
Apis: apifs,
StaticRoutes: srs,
}
}

0 comments on commit f46c25f

Please sign in to comment.