Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added serveral endpoints #28

Merged
merged 10 commits into from
Apr 5, 2022
Merged

added serveral endpoints #28

merged 10 commits into from
Apr 5, 2022

Conversation

jasmingacic
Copy link
Contributor

Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
@topliceanurazvan
Copy link
Member

topliceanurazvan commented Apr 5, 2022

Looks good @jasmingacic, all the endpoints seems to be in place. The fleets CRD endpoint is missing from description, but I've tested it on the server and it looks like it's working.

Copy link
Contributor

@kylehodgetts kylehodgetts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes. Could you also go fmt all of the code, please? 😁

Makefile Outdated
@@ -9,3 +9,5 @@ run:

run-minikube:
docker-compose -f docker-compose.yaml -f docker-compose-minikube.yaml up --build -d
test:
cd ./server && FAKE=true go test -v ./...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

go/Dockerfile
Dockerfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

@@ -25,20 +25,10 @@ go run main.go

To run the server in a docker container
```
make build
docker build --network=host -t openapi .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put make build back, please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the other make commands too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was not aware of this. change :D
I will have it reverted

server/go/api.go Outdated
// FleetsApiRouter defines the required methods for binding the api requests to a responses for the FleetsApi
// The FleetsApiRouter implementation should parse necessary information from the http request,
// pass the data to a FleetsApiServicer to perform the required actions, then write the service results to the http response.
type FleetsApiRouter interface {
type FleetsApiRouter interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this file been go fmt'ed?

GetEnvoyFleet(http.ResponseWriter, *http.Request)
GetEnvoyFleetCRD(http.ResponseWriter, *http.Request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns the CRD definition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the object as is

@@ -14,26 +14,43 @@ import (
"net/http"
"strings"

kusk "github.com/GIT_USER_ID/GIT_REPO_ID/kusk"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need an alias if the package is already kusk?

// GetService - Get details for a single service
func (s *ServicesApiService) GetService(ctx context.Context, namespace string, name string) (ImplResponse, error) {
svc, err := s.kuskClient.GetSvc(namespace, name)
if err != nil {
return Response(http.StatusInternalServerError, err), err
}

port := ServicePortItem{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go fmt


// GetStaticRouteCRD - Get static route CRD
func (s *StaticRoutesApiService) GetStaticRouteCRD(ctx context.Context, namespace string, name string) (ImplResponse, error) {
staticRoute, err := s.kuskClient.GetStaticRoute(namespace, name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staticRoute, err := s.kuskClient.GetStaticRoute(namespace, name)

Should this be called GetStaticRouteCRD(...) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. The only difference is that here we don't do any operations on fleet object we just return it at the end of the method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure I understand, the Service method is called GetStaticRouteCRD but inside we call the kuskClient GetStaticRoute? that's the correct behaviour?

@@ -216,4 +216,4 @@ func parseInt32ArrayParameter(param, delim string, required bool) ([]int32, erro
}

return ints, nil
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
Signed-off-by: Jasmin Gacic <jasmin.gacic@gmail.com>
@jasmingacic jasmingacic merged commit eceb80e into main Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants