From c15d3c620f7168dd3fd43faecfe2977642dd32b3 Mon Sep 17 00:00:00 2001 From: Harry Waye Date: Tue, 20 Dec 2022 14:16:50 +0000 Subject: [PATCH 1/2] Revert "Revert "fix(ingress): ensure only capture and decide go to events (#659)" This reverts commit a95f96f73d9cd720dfa1e528d27dc3b67bf71153. --- charts/posthog/Chart.yaml | 2 +- charts/posthog/templates/ingress.yaml | 33 ++++++++++++++ .../tests/__snapshot__/ingress.yaml.snap | 44 ++++++++++++++++++- 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/charts/posthog/Chart.yaml b/charts/posthog/Chart.yaml index 16f707094..622f2585e 100644 --- a/charts/posthog/Chart.yaml +++ b/charts/posthog/Chart.yaml @@ -11,7 +11,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 30.2.6 +version: 30.2.5 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. diff --git a/charts/posthog/templates/ingress.yaml b/charts/posthog/templates/ingress.yaml index 1fa0e5cc6..fd2a7dc24 100644 --- a/charts/posthog/templates/ingress.yaml +++ b/charts/posthog/templates/ingress.yaml @@ -78,24 +78,57 @@ spec: port: number: {{ .Values.service.externalPort }} {{- if (ne (include "ingress.type" .) "clb") }} + # Match any url with a prefix ending with a forward-slash. Previously + # we would match without the forward-slash. To ensure that we pick up + # with the forward-slash omitted we also match Exact. Note that we + # could use e.g. [ingress-nginx regex support](https://kubernetes.github.io/ingress-nginx/user-guide/ingress-path-matching/#regular-expression-support) + # but to keep this agnostic we use a combination of Prefix and Exact. + # + # NOTE: we still use a Prefix match on paths with a forward-slash, + # just in case there are cases that we have subpaths for these + # endpoints that still need to be passed to the `posthog-events` pods. - pathType: Prefix + path: "/capture/" + backend: *INGESTION + - pathType: Exact path: "/capture" backend: *INGESTION + - pathType: Prefix + path: "/decide/" + backend: *INGESTION + - pathType: Exact path: "/decide" backend: *INGESTION + - pathType: Prefix + path: "/e/" + backend: *INGESTION + - pathType: Exact path: "/e" backend: *INGESTION + - pathType: Prefix + path: "/engage/" + backend: *INGESTION + - pathType: Exact path: "/engage" backend: *INGESTION + - pathType: Prefix + path: "/track/" + backend: *INGESTION + - pathType: Exact path: "/track" backend: *INGESTION + - pathType: Prefix + path: "/s/" + backend: *INGESTION + - pathType: Exact path: "/s" backend: *INGESTION + {{- else }} - pathType: ImplementationSpecific path: "/capture/*" diff --git a/charts/posthog/tests/__snapshot__/ingress.yaml.snap b/charts/posthog/tests/__snapshot__/ingress.yaml.snap index 8e068f8ef..ebdb74544 100644 --- a/charts/posthog/tests/__snapshot__/ingress.yaml.snap +++ b/charts/posthog/tests/__snapshot__/ingress.yaml.snap @@ -17,12 +17,26 @@ the "spec" path should match the snapshot when using default values: number: 8000 path: /batch pathType: Prefix + - backend: + service: + name: RELEASE-NAME-posthog-events + port: + number: 8000 + path: /capture/ + pathType: Prefix - backend: service: name: RELEASE-NAME-posthog-events port: number: 8000 path: /capture + pathType: Exact + - backend: + service: + name: RELEASE-NAME-posthog-events + port: + number: 8000 + path: /decide/ pathType: Prefix - backend: service: @@ -30,6 +44,13 @@ the "spec" path should match the snapshot when using default values: port: number: 8000 path: /decide + pathType: Exact + - backend: + service: + name: RELEASE-NAME-posthog-events + port: + number: 8000 + path: /e/ pathType: Prefix - backend: service: @@ -37,6 +58,13 @@ the "spec" path should match the snapshot when using default values: port: number: 8000 path: /e + pathType: Exact + - backend: + service: + name: RELEASE-NAME-posthog-events + port: + number: 8000 + path: /engage/ pathType: Prefix - backend: service: @@ -44,6 +72,13 @@ the "spec" path should match the snapshot when using default values: port: number: 8000 path: /engage + pathType: Exact + - backend: + service: + name: RELEASE-NAME-posthog-events + port: + number: 8000 + path: /track/ pathType: Prefix - backend: service: @@ -51,6 +86,13 @@ the "spec" path should match the snapshot when using default values: port: number: 8000 path: /track + pathType: Exact + - backend: + service: + name: RELEASE-NAME-posthog-events + port: + number: 8000 + path: /s/ pathType: Prefix - backend: service: @@ -58,4 +100,4 @@ the "spec" path should match the snapshot when using default values: port: number: 8000 path: /s - pathType: Prefix + pathType: Exact From e0c244cded2ff4b092a366d08fc41416cb17b900 Mon Sep 17 00:00:00 2001 From: Harry Waye Date: Tue, 20 Dec 2022 14:29:12 +0000 Subject: [PATCH 2/2] bump version --- charts/posthog/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/posthog/Chart.yaml b/charts/posthog/Chart.yaml index 622f2585e..a27d078fe 100644 --- a/charts/posthog/Chart.yaml +++ b/charts/posthog/Chart.yaml @@ -11,7 +11,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 30.2.5 +version: 30.2.7 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application.