feat: add HTTPRoute
All checks were successful
functions / build (push) Successful in 1m28s

This commit is contained in:
Peter 2025-01-17 12:07:23 +01:00
parent d4c283e5c4
commit 95d08e57ce
Signed by: prskr
GPG key ID: F56BED6903BC5E37
3 changed files with 25 additions and 1 deletions

View file

@ -28,11 +28,16 @@ type ImageReference struct {
func init() {
router := spinhttp.NewRouter()
router.GET("/monkeyuser", monkeyUserComic)
router.GET("/comics/random", randomComic)
router.GET("/comics/monkeyuser", monkeyUserComic)
spinhttp.Handle(router.ServeHTTP)
}
func randomComic(w http.ResponseWriter, re *http.Request, params httprouter.Params) {
monkeyUserComic(w, re, params)
}
func monkeyUserComic(w http.ResponseWriter, re *http.Request, _ httprouter.Params) {
indexResponse, err := spinhttp.Get("https://www.monkeyuser.com/index.json")
if err != nil {

View file

@ -6,4 +6,5 @@ namespace: functions
resources:
- resources/namespace.yaml
- resources/executor.yaml
- resources/routes.yaml
- apps/comics.yaml

View file

@ -0,0 +1,18 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: functions-https
spec:
parentRefs:
- name: contour
sectionName: https
namespace: projectcontour
hostnames:
- "functions.icb4dc0.de"
rules:
- matches:
- path:
value: "/comics"
backendRefs:
- name: comics
port: 80