kubeshop / kusk-gateway

Kusk-gateway is an OpenAPI-driven API Gateway for Kubernetes
https://kubeshop.github.io/kusk-gateway/
MIT License
253 stars 21 forks source link

Create a command to deploy frontend applications in Kubernetes #1011

Open aabedraba opened 1 year ago

aabedraba commented 1 year ago

Would be cool if we enabled frontend developers to deploy their containerized web applications simply with Kusk.

A command like

kusk deploy pages --container dockerhub/containername

Under the hood it would create a deployment and expose it

kubectl create deployment web-app --image=usernameweb-application
kubectl expose deployment web-app --name web-app-svc --port=3000

and then it would create a simple StaticRoute and connect it:

apiVersion: gateway.kusk.io/v1alpha1
kind: StaticRoute
metadata:
  name: web-app-static-route
spec:
  fleet:
    name: kusk-gateway-envoy-fleet
    namespace: kusk-system
  upstream:
    service:
      name: web-app-svc
      namespace: default
      port: 3000

Alternatively, if that's complicated, we could just create the StaticRoute given a service name:

kusk deploy pages --service web-app 

Which would create the StaticRoute under-the-hood.

olensmar commented 1 year ago

although this is cool - aren't there other tools out there that already to this? could/should we start with "containerised APIs" instead? - i.e.

kusk deploy api --container swaggerapi/peststorev3 --definition <external-url-or-path-exposed-by-container-to-openapi>

?

aabedraba commented 1 year ago

@olensmar definitely would be better to start with APIs.

you mention other tools solving this for frontend, which ones have you seen so far the solve this? I’m not aware of any.

jasmingacic commented 1 year ago

Actually why not both. Users can pick what they want to deploy either an API or a FE app.

kusk create page --service web-app --image myrepo/myimage:latest --port 80
kusk create api --service api-svc --image myrepo/myapi:latest 

We can make only image parameter required and we autogenerate service name

This would mean from 0 to fully working FE/API in 5 minutes

aabedraba commented 1 year ago

This would mean from 0 to fully working FE/API in 5 minutes

Actually, less than a minute :P

olensmar commented 1 year ago

For create api I guess we would require a path/url to the openapi definition?

jasmingacic commented 1 year ago

Yes that is correct I forgot to add it