Skip to content

Commit

Permalink
minor fixes of the client
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 6, 2022
1 parent 3123b62 commit ffb4b06
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions server/go/api_apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (c *ApisApiController) GetApis(w http.ResponseWriter, r *http.Request) {
fleetnameParam := query.Get("fleetname")
fleetnamespaceParam := query.Get("fleetnamespace")
namespaceParam := query.Get("namespace")

result, err := c.service.GetApis(r.Context(), fleetnameParam, fleetnamespaceParam, namespaceParam)
// If an error occurred, encode the error with the status code
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion server/go/api_apis_service_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (s *ApisApiService) GetApis(ctx context.Context, namespace string, fleetnam
}

} else {
apis, err = s.kuskClient.GetApiByEnvoyFleet(fleetnamespace, fleetname)
apis, err = s.kuskClient.GetApiByEnvoyFleet(namespace, fleetnamespace, fleetname)
if err != nil {
return Response(http.StatusInternalServerError, err), err
}
Expand Down
2 changes: 1 addition & 1 deletion server/go/api_fleets_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *FleetsApiService) convertEnvoyFleetListCRDtoEnvoyFleetsModel(fleets *v1

func (s *FleetsApiService) convertEnvoyFleetCRDtoEnvoyFleetModel(fleet *v1alpha1.EnvoyFleet) EnvoyFleetItem {
apifs := []ApiItemFleet{}
apis, err := s.kuskClient.GetApiByEnvoyFleet(fleet.Namespace, fleet.Name)
apis, err := s.kuskClient.GetApiByEnvoyFleet("", fleet.Namespace, fleet.Name)
if err == nil {
for _, api := range apis.Items {
apifs = append(apifs, ApiItemFleet{
Expand Down
6 changes: 3 additions & 3 deletions server/kusk/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Client interface {

GetApis(namespace string) (*kuskv1.APIList, error)
GetApi(namespace, name string) (*kuskv1.API, error)
GetApiByEnvoyFleet(fleetNamespace, fleetName string) (*kuskv1.APIList, error)
GetApiByEnvoyFleet(namespace, fleetNamespace, fleetName string) (*kuskv1.APIList, error)
GetStaticRoute(namespace, name string) (*kuskv1.StaticRoute, error)
GetStaticRoutes(namespace string) (*kuskv1.StaticRouteList, error)

Expand Down Expand Up @@ -71,9 +71,9 @@ func (k *kuskClient) GetApi(namespace, name string) (*kuskv1.API, error) {
}

// GetApiByFleet gets all APIs associated with the EnvoyFleet
func (k *kuskClient) GetApiByEnvoyFleet(fleetNamespace, fleetName string) (*kuskv1.APIList, error) {
func (k *kuskClient) GetApiByEnvoyFleet(namespace, fleetNamespace, fleetName string) (*kuskv1.APIList, error) {
list := kuskv1.APIList{}
if err := k.client.List(context.TODO(), &list, &client.ListOptions{}); err != nil {
if err := k.client.List(context.TODO(), &list, &client.ListOptions{Namespace: namespace}); err != nil {
return nil, err
}

Expand Down

0 comments on commit ffb4b06

Please sign in to comment.