From d6fe012c25a5c971edb5ed08f2b152794a85021f Mon Sep 17 00:00:00 2001 From: lostbean Date: Tue, 24 Sep 2024 11:37:20 -0300 Subject: [PATCH 1/3] use gateway api and k8s ingress for access --- release/obd-kardinal.yaml | 79 ++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/release/obd-kardinal.yaml b/release/obd-kardinal.yaml index 88ea69d..86af26d 100644 --- a/release/obd-kardinal.yaml +++ b/release/obd-kardinal.yaml @@ -159,24 +159,7 @@ spec: protocol: TCP appProtocol: HTTP targetPort: 8080 ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend-external - annotations: - kardinal.dev.service/ingress: "true" - kardinal.dev.service/host: "prod.app.localhost" -spec: - type: LoadBalancer - selector: - app: frontend - ports: - - name: http - port: 80 - targetPort: 8080 - protocol: TCP - appProtocol: HTTP + --- apiVersion: apps/v1 kind: Deployment @@ -328,3 +311,63 @@ spec: targetPort: 8070 protocol: TCP appProtocol: HTTP + +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: gateway + annotations: + kardinal.dev.service/gateway: "true" +spec: + gatewayClassName: istio + listeners: + - name: default + hostname: "*.app.localhost" + port: 8888 + protocol: HTTP + allowedRoutes: + namespaces: + from: All + +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: http + annotations: + kardinal.dev.service/route: "true" +spec: + parentRefs: + - name: gateway + hostnames: ["prod.app.localhost"] + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: frontend + port: 80 + +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + kardinal.dev.service/ingress: "true" + name: ingress + namespace: prod +spec: + rules: + - host: web.other.localhost + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: frontend + port: + number: 80 From 33bdf39c6d4393a33adb0acb3de13ec1c8c4cc5f Mon Sep 17 00:00:00 2001 From: lostbean Date: Tue, 24 Sep 2024 16:48:10 -0300 Subject: [PATCH 2/3] do not specify NS --- release/obd-kardinal.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/release/obd-kardinal.yaml b/release/obd-kardinal.yaml index f6a6165..325886b 100644 --- a/release/obd-kardinal.yaml +++ b/release/obd-kardinal.yaml @@ -362,7 +362,6 @@ metadata: kubernetes.io/ingress.class: nginx kardinal.dev.service/ingress: "true" name: ingress - namespace: prod spec: rules: - host: web.other.localhost From a1513ebec09404e9143287329ded0415f1705b59 Mon Sep 17 00:00:00 2001 From: lostbean Date: Wed, 25 Sep 2024 10:47:04 -0300 Subject: [PATCH 3/3] update flake --- flake.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index cd20290..2c928f6 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -28,11 +28,11 @@ ] }, "locked": { - "lastModified": 1722589758, - "narHash": "sha256-sbbA8b6Q2vB/t/r1znHawoXLysCyD4L/6n6/RykiSnA=", + "lastModified": 1725515722, + "narHash": "sha256-+gljgHaflZhQXtr3WjJrGn8NXv7MruVPAORSufuCFnw=", "owner": "nix-community", "repo": "gomod2nix", - "rev": "4e08ca09253ef996bd4c03afa383b23e35fe28a1", + "rev": "1c6fd4e862bf2f249c9114ad625c64c6c29a8a08", "type": "github" }, "original": { @@ -43,11 +43,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722987190, - "narHash": "sha256-68hmex5efCiM2aZlAAEcQgmFI4ZwWt8a80vOeB/5w3A=", + "lastModified": 1727129439, + "narHash": "sha256-nPyrcFm6FSk7CxzVW4x2hu62aLDghNcv9dX6DF3dXw8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "21cc704b5e918c5fbf4f9fff22b4ac2681706d90", + "rev": "babc25a577c3310cce57c72d5bed70f4c3c3843a", "type": "github" }, "original": { @@ -82,11 +82,11 @@ }, "unstable": { "locked": { - "lastModified": 1722813957, - "narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=", + "lastModified": 1726937504, + "narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa", + "rev": "9357f4f23713673f310988025d9dc261c20e70c6", "type": "github" }, "original": {