Skip to content

Commit

Permalink
Set base paths (#94)
Browse files Browse the repository at this point in the history
* Set a path to each service in the ETOS API

* Move the ETOS API manifests to a subdirectory

* Add a base ingress for ETOS
  • Loading branch information
t-persson authored Nov 28, 2024
1 parent fc3dc8f commit 81eb85e
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 32 deletions.
File renamed without changes.
9 changes: 9 additions & 0 deletions manifests/base/api/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- service-account.yaml
- secret.yaml
- role.yaml
- rolebinding.yaml
- service.yaml
- deployment.yaml
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions manifests/base/executionspace/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ spec:
protocol: TCP
livenessProbe:
httpGet:
path: /v1alpha/selftest/ping
path: /executionspace/v1alpha/selftest/ping
port: http
readinessProbe:
httpGet:
path: /v1alpha/selftest/ping
path: /executionspace/v1alpha/selftest/ping
port: http
47 changes: 47 additions & 0 deletions manifests/base/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: etos
labels:
app.kubernetes.io/name: etos
app.kubernetes.io/part-of: etos
app.kubernetes.io/component: etos-api
spec:
rules:
- http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: etos-api
port:
number: 80
- path: /sse
pathType: Prefix
backend:
service:
name: etos-sse
port:
number: 80
- path: /logarea
pathType: Prefix
backend:
service:
name: etos-logarea
port:
number: 80
- path: /iut
pathType: Prefix
backend:
service:
name: etos-iut
port:
number: 80
- path: /executionspace
pathType: Prefix
backend:
service:
name: etos-executionspace
port:
number: 80
4 changes: 2 additions & 2 deletions manifests/base/iut/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ spec:
protocol: TCP
livenessProbe:
httpGet:
path: /v1alpha1/selftest/ping
path: /iut/v1alpha1/selftest/ping
port: http
readinessProbe:
httpGet:
path: /v1alpha1/selftest/ping
path: /iut/v1alpha1/selftest/ping
port: http
8 changes: 2 additions & 6 deletions manifests/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- service-account.yaml
- secret.yaml
- role.yaml
- rolebinding.yaml
- service.yaml
- deployment.yaml
- ./api
- ./sse
- ./logarea
- ./iut
- ./executionspace
- ./ingress.yaml


# By generating the configmap it will get a unique name on each apply
Expand Down
4 changes: 2 additions & 2 deletions manifests/base/logarea/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ spec:
protocol: TCP
livenessProbe:
httpGet:
path: /v1alpha/selftest/ping
path: /logarea/v1alpha/selftest/ping
port: http
readinessProbe:
httpGet:
path: /v1alpha/selftest/ping
path: /logarea/v1alpha/selftest/ping
port: http
4 changes: 2 additions & 2 deletions manifests/base/sse/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ spec:
protocol: TCP
livenessProbe:
httpGet:
path: /v1alpha/selftest/ping
path: /sse/v1alpha/selftest/ping
port: http
readinessProbe:
httpGet:
path: /v1alpha/selftest/ping
path: /sse/v1alpha/selftest/ping
port: http
10 changes: 5 additions & 5 deletions pkg/executionspace/v1alpha/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ func New(cfg config.Config, log *logrus.Entry, provider provider.Provider, ctx c
// LoadRoutes loads all the v1alpha1 routes.
func (a ProviderServiceApplication) LoadRoutes(router *httprouter.Router) {
handler := &ProviderServiceHandler{a.logger, a.cfg, a.provider, a.wg}
router.GET("/v1alpha/selftest/ping", handler.Selftest)
router.POST("/start", handler.panicRecovery(handler.timeoutHandler(handler.Start)))
router.GET("/status", handler.panicRecovery(handler.timeoutHandler(handler.Status)))
router.POST("/stop", handler.panicRecovery(handler.timeoutHandler(handler.Stop)))
router.GET("/executionspace/v1alpha/selftest/ping", handler.Selftest)
router.POST("/executionspace/start", handler.panicRecovery(handler.timeoutHandler(handler.Start)))
router.GET("/executionspace/status", handler.panicRecovery(handler.timeoutHandler(handler.Status)))
router.POST("/executionspace/stop", handler.panicRecovery(handler.timeoutHandler(handler.Stop)))

router.POST(fmt.Sprintf("/v1alpha/executor/%s", a.provider.Executor().Name()), handler.panicRecovery(handler.timeoutHandler(handler.ExecutorStart)))
router.POST(fmt.Sprintf("/executionspace/v1alpha/executor/%s", a.provider.Executor().Name()), handler.panicRecovery(handler.timeoutHandler(handler.ExecutorStart)))
a.initTracer()
}

Expand Down
11 changes: 5 additions & 6 deletions pkg/iut/v1alpha1/v1alpha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ type V1Alpha1Handler struct {
wg *sync.WaitGroup
}

type Dataset struct {
}
type Dataset struct{}

// RespondWithJSON writes a JSON response with a status code to the HTTP ResponseWriter.
func RespondWithJSON(w http.ResponseWriter, code int, payload interface{}) {
Expand Down Expand Up @@ -84,10 +83,10 @@ func New(cfg config.Config, log *logrus.Entry, ctx context.Context, cli *clientv
// LoadRoutes loads all the v1alpha1 routes.
func (a V1Alpha1Application) LoadRoutes(router *httprouter.Router) {
handler := &V1Alpha1Handler{a.logger, a.cfg, a.database, a.wg}
router.GET("/v1alpha1/selftest/ping", handler.Selftest)
router.POST("/start", handler.panicRecovery(handler.timeoutHandler(handler.Start)))
router.GET("/status", handler.panicRecovery(handler.timeoutHandler(handler.Status)))
router.POST("/stop", handler.panicRecovery(handler.timeoutHandler(handler.Stop)))
router.GET("/iut/v1alpha1/selftest/ping", handler.Selftest)
router.POST("/iut/start", handler.panicRecovery(handler.timeoutHandler(handler.Start)))
router.GET("/iut/status", handler.panicRecovery(handler.timeoutHandler(handler.Status)))
router.POST("/iut/stop", handler.panicRecovery(handler.timeoutHandler(handler.Stop)))
}

// Selftest is a handler to just return 204.
Expand Down
4 changes: 2 additions & 2 deletions pkg/logarea/v1alpha/logarea.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func New(cfg config.Config, log *logrus.Entry) application.Application {
// LoadRoutes loads all the v1alpha routes.
func (a LogAreaApplication) LoadRoutes(router *httprouter.Router) {
handler := &LogAreaHandler{a.logger, a.cfg, a.client, a.regex}
router.GET("/v1alpha/selftest/ping", handler.Selftest)
router.GET("/v1alpha/logarea/:identifier", handler.panicRecovery(handler.timeoutHandler(handler.GetFileURLs)))
router.GET("/logarea/v1alpha/selftest/ping", handler.Selftest)
router.GET("/logarea/v1alpha/logarea/:identifier", handler.panicRecovery(handler.timeoutHandler(handler.GetFileURLs)))
}

// Selftest is a handler to just return 204.
Expand Down
6 changes: 3 additions & 3 deletions pkg/sse/v1/sse.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ func New(cfg config.Config, log *logrus.Entry, ctx context.Context) application.
func (a SSEApplication) LoadRoutes(router *httprouter.Router) {
kube := kubernetes.New(a.cfg, a.logger)
handler := &SSEHandler{a.logger, a.cfg, a.ctx, kube}
router.GET("/v1/selftest/ping", handler.Selftest)
router.GET("/v1/events/:identifier", handler.GetEvents)
router.GET("/v1/event/:identifier/:id", handler.GetEvent)
router.GET("/sse/v1/selftest/ping", handler.Selftest)
router.GET("/sse/v1/events/:identifier", handler.GetEvents)
router.GET("/sse/v1/event/:identifier/:id", handler.GetEvent)
}

// Selftest is a handler to just return 204.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sse/v1alpha/sse.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func New(cfg config.Config, log *logrus.Entry, ctx context.Context) application.
func (a SSEApplication) LoadRoutes(router *httprouter.Router) {
kube := kubernetes.New(a.cfg, a.logger)
handler := &SSEHandler{a.logger, a.cfg, a.ctx, kube}
router.GET("/v1alpha/selftest/ping", handler.Selftest)
router.GET("/v1alpha/logs/:identifier", handler.GetEvents)
router.GET("/sse/v1alpha/selftest/ping", handler.Selftest)
router.GET("/sse/v1alpha/logs/:identifier", handler.GetEvents)
}

// Selftest is a handler to just return 204.
Expand Down

0 comments on commit 81eb85e

Please sign in to comment.