From 72cdba606d4ef07d3c4a7bdc18d6d918753b11a7 Mon Sep 17 00:00:00 2001 From: Martin Schmollinger <martin.schmollinger@reutlingen-university.de> Date: Fri, 1 Dec 2023 14:18:46 +0100 Subject: [PATCH] Simple REST-Service with K3S configuration. --- README.md | 23 +++++++++++++++ config/deployment/mytodo-deployment.yaml | 5 ++-- config/ingressroute/mytodo-ingressroute.yaml | 30 +++++++++++++++++++- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 339f8f2..500671e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,26 @@ # mytodo-msa An example implementation of a msa running of the base architecture https://gitlab.reutlingen-university.de/poegel/microservice-architecture + +## Current State of Implementation +* Service mytodo manages todo items consisting of an ID and a description. +* Items can be added or retrieves (all or by a certain ID) +* IDs are set at the server side. +* Items are stored in a slice (main memory - no data base yet in use). +* Path-Prefix ist /mytodo, each service method extends this to a full path. +* The service is exposed on port 10000. + +## Dockerfile/CI/CD +* Image is tagged with schmolli/mytodo and uploaded to DockerHub. +* Current version is 0.0.2. +* No pipline to build and push the image automatically. + +## Current State of the K8S Configuration +* Everybody can read all items or one item with a certain ID. +* Only authorized users can add new items. + +## Issues/Findings +* Why does service respond with 501 if we try to add an item without authentication? +* Why do we not use https? +* Service is accessible from windows using the IP of wsl (wsl hostname -I). +* Inside wsl we can use localhost. \ No newline at end of file diff --git a/config/deployment/mytodo-deployment.yaml b/config/deployment/mytodo-deployment.yaml index a05df17..d60e4d6 100644 --- a/config/deployment/mytodo-deployment.yaml +++ b/config/deployment/mytodo-deployment.yaml @@ -17,5 +17,6 @@ spec: spec: containers: - name: mytodo - image: schmolli/mytodo:0.0.1 - imagePullPolicy: Always \ No newline at end of file + image: schmolli/mytodo:0.0.2 + imagePullPolicy: Always + \ No newline at end of file diff --git a/config/ingressroute/mytodo-ingressroute.yaml b/config/ingressroute/mytodo-ingressroute.yaml index 985aa30..6df1452 100644 --- a/config/ingressroute/mytodo-ingressroute.yaml +++ b/config/ingressroute/mytodo-ingressroute.yaml @@ -10,7 +10,35 @@ spec: routes: - kind: Rule - match: Path(`/health`) && Method(`GET`) + match: Path(`/mytodo/health`) && Method(`GET`) + services: + - kind: Service + name: mytodo + namespace: mytodo + port: 10000 + + - kind: Rule + match: Path(`/mytodo/todos`) && Method(`GET`) + services: + - kind: Service + name: mytodo + namespace: mytodo + port: 10000 + + - kind: Rule + match: Path(`/mytodo/todos/{id:[0-9]+}`) && Method(`GET`) + services: + - kind: Service + name: mytodo + namespace: mytodo + port: 10000 + + + - kind: Rule + match: Path(`/mytodo/todos`) && Method(`POST`) + middlewares: + - name: fw-auth-mw + namespace: default services: - kind: Service name: mytodo -- GitLab