From ba0a88b7088694af7e930c2d931fe013b0332ccd Mon Sep 17 00:00:00 2001 From: Arvind Prabhakar Date: Sat, 5 Sep 2026 18:34:45 +0000 Subject: [PATCH] Centralize Envoy Gateway routing --- .../applications/infrastructure/gateway.yaml | 20 ++++++++ charts/argocd/templates/httproute.yaml | 21 --------- charts/longhorn/templates/httproute.yaml | 39 --------------- charts/openproject/templates/httproute.yaml | 24 ---------- charts/pgadmin/templates/httproute.yaml | 33 ------------- charts/symcrest-web/templates/httproute.yaml | 21 --------- infrastructure/gateway/envoy/envoyproxy.yaml | 19 ++++++++ .../gateway/envoy/gatewayclass.yaml | 6 +++ .../gateway/envoy/routes/argocd.yaml | 19 ++++++++ .../gateway/envoy/routes/forgejo.yaml | 26 +++++----- .../gateway/envoy/routes/longhorn.yaml | 37 +++++++++++++++ .../gateway/envoy/routes}/openproject.yaml | 7 +-- .../gateway/envoy/routes/pgadmin.yaml | 31 ++++++++++++ .../gateway/envoy/routes/symcrest-web.yaml | 19 ++++++++ .../gateway/envoy/shared-public-gateway.yaml | 19 ++++++++ rendered/argocd/argocd.yaml | 22 +-------- rendered/forgejo/forgejo.yaml | 47 ------------------- rendered/longhorn/longhorn.yaml | 38 --------------- rendered/pgadmin/pgadmin.yaml | 33 ------------- rendered/symcrest-web/symcrest-web.yaml | 21 --------- 20 files changed, 184 insertions(+), 318 deletions(-) create mode 100644 argocd-apps/applications/infrastructure/gateway.yaml delete mode 100644 charts/argocd/templates/httproute.yaml delete mode 100644 charts/longhorn/templates/httproute.yaml delete mode 100644 charts/openproject/templates/httproute.yaml delete mode 100644 charts/pgadmin/templates/httproute.yaml delete mode 100644 charts/symcrest-web/templates/httproute.yaml create mode 100644 infrastructure/gateway/envoy/envoyproxy.yaml create mode 100644 infrastructure/gateway/envoy/gatewayclass.yaml create mode 100644 infrastructure/gateway/envoy/routes/argocd.yaml rename charts/forgejo/templates/httproute.yaml => infrastructure/gateway/envoy/routes/forgejo.yaml (50%) create mode 100644 infrastructure/gateway/envoy/routes/longhorn.yaml rename {rendered/openproject => infrastructure/gateway/envoy/routes}/openproject.yaml (76%) create mode 100644 infrastructure/gateway/envoy/routes/pgadmin.yaml create mode 100644 infrastructure/gateway/envoy/routes/symcrest-web.yaml create mode 100644 infrastructure/gateway/envoy/shared-public-gateway.yaml diff --git a/argocd-apps/applications/infrastructure/gateway.yaml b/argocd-apps/applications/infrastructure/gateway.yaml new file mode 100644 index 0000000..a933086 --- /dev/null +++ b/argocd-apps/applications/infrastructure/gateway.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: gateway + namespace: argocd +spec: + project: platform + source: + repoURL: https://www.symcrest.com/internal/dev/git/symcrest/k8s-platform.git + targetRevision: main + path: infrastructure/gateway/envoy + directory: + recurse: true + destination: + server: https://kubernetes.default.svc + namespace: apps + syncPolicy: + automated: + prune: false + selfHeal: true diff --git a/charts/argocd/templates/httproute.yaml b/charts/argocd/templates/httproute.yaml deleted file mode 100644 index 7ed7470..0000000 --- a/charts/argocd/templates/httproute.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: {{ .Values.route.name }} - namespace: {{ .Values.route.namespace }} -spec: - parentRefs: - - name: {{ .Values.route.gatewayName }} - namespace: {{ .Values.route.gatewayNamespace }} - hostnames: -{{- range .Values.route.hostnames }} - - {{ . | quote }} -{{- end }} - rules: - - matches: - - path: - type: PathPrefix - value: {{ .Values.argocd.basePath | quote }} - backendRefs: - - name: {{ .Values.route.serviceName }} - port: {{ .Values.route.servicePort }} diff --git a/charts/longhorn/templates/httproute.yaml b/charts/longhorn/templates/httproute.yaml deleted file mode 100644 index 30f7901..0000000 --- a/charts/longhorn/templates/httproute.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: {{ .Values.route.name }} - namespace: {{ .Values.route.namespace }} -spec: - parentRefs: - - name: {{ .Values.route.gatewayName }} - namespace: {{ .Values.route.gatewayNamespace }} - hostnames: -{{- range .Values.route.hostnames }} - - {{ . | quote }} -{{- end }} - rules: - - matches: - - path: - type: Exact - value: {{ .Values.longhorn.basePath | quote }} - filters: - - type: RequestRedirect - requestRedirect: - path: - type: ReplaceFullPath - replaceFullPath: {{ printf "%s/" .Values.longhorn.basePath | quote }} - statusCode: 301 - - - matches: - - path: - type: PathPrefix - value: {{ printf "%s/" .Values.longhorn.basePath | quote }} - filters: - - type: URLRewrite - urlRewrite: - path: - type: ReplacePrefixMatch - replacePrefixMatch: {{ .Values.longhorn.rewriteTo | quote }} - backendRefs: - - name: {{ .Values.route.serviceName }} - port: {{ .Values.route.servicePort }} diff --git a/charts/openproject/templates/httproute.yaml b/charts/openproject/templates/httproute.yaml deleted file mode 100644 index 7f7f688..0000000 --- a/charts/openproject/templates/httproute.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: openproject - namespace: {{ .Release.Namespace }} -spec: - parentRefs: - - name: {{ .Values.gateway.name }} - namespace: {{ .Values.gateway.namespace }} - - hostnames: -{{- range .Values.hostnames }} - - {{ . | quote }} -{{- end }} - - rules: - - matches: - - path: - type: PathPrefix - value: {{ .Values.basePath | quote }} - - backendRefs: - - name: {{ .Values.service.name }} - port: {{ .Values.service.port }} diff --git a/charts/pgadmin/templates/httproute.yaml b/charts/pgadmin/templates/httproute.yaml deleted file mode 100644 index 3bec96a..0000000 --- a/charts/pgadmin/templates/httproute.yaml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: {{ .Values.route.name }} - namespace: {{ .Values.namespace }} -spec: - parentRefs: - - name: {{ .Values.route.gatewayName }} - namespace: {{ .Values.route.gatewayNamespace }} - hostnames: -{{- range .Values.route.hostnames }} - - {{ . | quote }} -{{- end }} - rules: - - matches: - - path: - type: Exact - value: {{ .Values.route.basePath | quote }} - filters: - - type: RequestRedirect - requestRedirect: - path: - type: ReplaceFullPath - replaceFullPath: {{ printf "%s/" .Values.route.basePath | quote }} - statusCode: 301 - - - matches: - - path: - type: PathPrefix - value: {{ printf "%s/" .Values.route.basePath | quote }} - backendRefs: - - name: {{ .Values.route.serviceName }} - port: {{ .Values.route.servicePort }} diff --git a/charts/symcrest-web/templates/httproute.yaml b/charts/symcrest-web/templates/httproute.yaml deleted file mode 100644 index 916ef6c..0000000 --- a/charts/symcrest-web/templates/httproute.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: {{ .Values.route.name }} - namespace: {{ .Values.namespace }} -spec: - parentRefs: - - name: {{ .Values.route.gatewayName }} - namespace: {{ .Values.route.gatewayNamespace }} - hostnames: -{{- range .Values.route.hostnames }} - - {{ . | quote }} -{{- end }} - rules: - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - - name: {{ .Values.service.name }} - port: {{ .Values.service.port }} diff --git a/infrastructure/gateway/envoy/envoyproxy.yaml b/infrastructure/gateway/envoy/envoyproxy.yaml new file mode 100644 index 0000000..4b94267 --- /dev/null +++ b/infrastructure/gateway/envoy/envoyproxy.yaml @@ -0,0 +1,19 @@ +apiVersion: gateway.envoyproxy.io/v1alpha1 +kind: EnvoyProxy +metadata: + name: public-gateway-nodeport + namespace: apps +spec: + logging: + level: + default: warn + provider: + type: Kubernetes + kubernetes: + envoyDeployment: + pod: + nodeSelector: + workload: app + envoyService: + type: NodePort + externalTrafficPolicy: Local diff --git a/infrastructure/gateway/envoy/gatewayclass.yaml b/infrastructure/gateway/envoy/gatewayclass.yaml new file mode 100644 index 0000000..cc7681d --- /dev/null +++ b/infrastructure/gateway/envoy/gatewayclass.yaml @@ -0,0 +1,6 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: GatewayClass +metadata: + name: envoy-gateway-class +spec: + controllerName: gateway.envoyproxy.io/gatewayclass-controller diff --git a/infrastructure/gateway/envoy/routes/argocd.yaml b/infrastructure/gateway/envoy/routes/argocd.yaml new file mode 100644 index 0000000..6015cf5 --- /dev/null +++ b/infrastructure/gateway/envoy/routes/argocd.yaml @@ -0,0 +1,19 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: argocd + namespace: argocd +spec: + parentRefs: + - name: public-gateway + namespace: apps + hostnames: + - "www.symcrest.com" + rules: + - matches: + - path: + type: PathPrefix + value: /internal/ops/gitops + backendRefs: + - name: argocd-server + port: 80 diff --git a/charts/forgejo/templates/httproute.yaml b/infrastructure/gateway/envoy/routes/forgejo.yaml similarity index 50% rename from charts/forgejo/templates/httproute.yaml rename to infrastructure/gateway/envoy/routes/forgejo.yaml index fb92fee..792b637 100644 --- a/charts/forgejo/templates/httproute.yaml +++ b/infrastructure/gateway/envoy/routes/forgejo.yaml @@ -1,33 +1,31 @@ apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: - name: {{ .Values.route.name }} - namespace: {{ .Values.namespace }} + name: forgejo + namespace: forgejo spec: parentRefs: - - name: {{ .Values.route.gatewayName }} - namespace: {{ .Values.route.gatewayNamespace }} + - name: public-gateway + namespace: apps hostnames: -{{- range .Values.route.hostnames }} - - {{ . | quote }} -{{- end }} + - "www.symcrest.com" rules: - matches: - path: type: Exact - value: {{ .Values.route.basePath | quote }} + value: /internal/dev/git filters: - type: RequestRedirect requestRedirect: path: type: ReplaceFullPath - replaceFullPath: {{ printf "%s/" .Values.route.basePath | quote }} + replaceFullPath: /internal/dev/git/ statusCode: 301 - matches: - path: type: PathPrefix - value: {{ printf "%s/" .Values.route.basePath | quote }} + value: /internal/dev/git/ filters: - type: URLRewrite urlRewrite: @@ -35,13 +33,13 @@ spec: type: ReplacePrefixMatch replacePrefixMatch: / backendRefs: - - name: {{ .Values.route.serviceName }} - port: {{ .Values.route.servicePort }} + - name: forgejo + port: 3000 - matches: - path: type: PathPrefix value: /v2/ backendRefs: - - name: {{ .Values.route.serviceName }} - port: {{ .Values.route.servicePort }} + - name: forgejo + port: 3000 diff --git a/infrastructure/gateway/envoy/routes/longhorn.yaml b/infrastructure/gateway/envoy/routes/longhorn.yaml new file mode 100644 index 0000000..7f731dc --- /dev/null +++ b/infrastructure/gateway/envoy/routes/longhorn.yaml @@ -0,0 +1,37 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: longhorn + namespace: longhorn-system +spec: + parentRefs: + - name: public-gateway + namespace: apps + hostnames: + - "www.symcrest.com" + rules: + - matches: + - path: + type: Exact + value: /internal/ops/volumes + filters: + - type: RequestRedirect + requestRedirect: + path: + type: ReplaceFullPath + replaceFullPath: /internal/ops/volumes/ + statusCode: 301 + + - matches: + - path: + type: PathPrefix + value: /internal/ops/volumes/ + filters: + - type: URLRewrite + urlRewrite: + path: + type: ReplacePrefixMatch + replacePrefixMatch: / + backendRefs: + - name: longhorn-frontend + port: 80 diff --git a/rendered/openproject/openproject.yaml b/infrastructure/gateway/envoy/routes/openproject.yaml similarity index 76% rename from rendered/openproject/openproject.yaml rename to infrastructure/gateway/envoy/routes/openproject.yaml index ce4e46c..3710a71 100644 --- a/rendered/openproject/openproject.yaml +++ b/infrastructure/gateway/envoy/routes/openproject.yaml @@ -1,5 +1,3 @@ ---- -# Source: openproject/templates/httproute.yaml apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: @@ -9,16 +7,13 @@ spec: parentRefs: - name: public-gateway namespace: apps - hostnames: - "www.symcrest.com" - rules: - matches: - path: type: PathPrefix - value: "/internal/dev/projectmanagement" - + value: /internal/dev/projectmanagement backendRefs: - name: openproject port: 8080 diff --git a/infrastructure/gateway/envoy/routes/pgadmin.yaml b/infrastructure/gateway/envoy/routes/pgadmin.yaml new file mode 100644 index 0000000..8d51c19 --- /dev/null +++ b/infrastructure/gateway/envoy/routes/pgadmin.yaml @@ -0,0 +1,31 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: pgadmin + namespace: pgadmin +spec: + parentRefs: + - name: public-gateway + namespace: apps + hostnames: + - "www.symcrest.com" + rules: + - matches: + - path: + type: Exact + value: /internal/dev/dbadmin/postgres + filters: + - type: RequestRedirect + requestRedirect: + path: + type: ReplaceFullPath + replaceFullPath: /internal/dev/dbadmin/postgres/ + statusCode: 301 + + - matches: + - path: + type: PathPrefix + value: /internal/dev/dbadmin/postgres/ + backendRefs: + - name: pgadmin + port: 80 diff --git a/infrastructure/gateway/envoy/routes/symcrest-web.yaml b/infrastructure/gateway/envoy/routes/symcrest-web.yaml new file mode 100644 index 0000000..f7f5ffc --- /dev/null +++ b/infrastructure/gateway/envoy/routes/symcrest-web.yaml @@ -0,0 +1,19 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: symcrest-web + namespace: apps +spec: + parentRefs: + - name: public-gateway + namespace: apps + hostnames: + - "www.symcrest.com" + rules: + - matches: + - path: + type: PathPrefix + value: / + backendRefs: + - name: symcrest-web + port: 80 diff --git a/infrastructure/gateway/envoy/shared-public-gateway.yaml b/infrastructure/gateway/envoy/shared-public-gateway.yaml new file mode 100644 index 0000000..d7d1961 --- /dev/null +++ b/infrastructure/gateway/envoy/shared-public-gateway.yaml @@ -0,0 +1,19 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: public-gateway + namespace: apps +spec: + gatewayClassName: envoy-gateway-class + infrastructure: + parametersRef: + group: gateway.envoyproxy.io + kind: EnvoyProxy + name: public-gateway-nodeport + listeners: + - name: http + protocol: HTTP + port: 80 + allowedRoutes: + namespaces: + from: All diff --git a/rendered/argocd/argocd.yaml b/rendered/argocd/argocd.yaml index ea8794e..8b13789 100644 --- a/rendered/argocd/argocd.yaml +++ b/rendered/argocd/argocd.yaml @@ -1,21 +1 @@ ---- -# Source: argocd-wrapper/templates/httproute.yaml -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: argocd - namespace: argocd -spec: - parentRefs: - - name: public-gateway - namespace: apps - hostnames: - - "www.symcrest.com" - rules: - - matches: - - path: - type: PathPrefix - value: "/internal/ops/gitops" - backendRefs: - - name: argocd-server - port: 80 + diff --git a/rendered/forgejo/forgejo.yaml b/rendered/forgejo/forgejo.yaml index 7bf0362..20361e8 100644 --- a/rendered/forgejo/forgejo.yaml +++ b/rendered/forgejo/forgejo.yaml @@ -82,50 +82,3 @@ spec: - name: forgejo-data persistentVolumeClaim: claimName: forgejo-data ---- -# Source: forgejo/templates/httproute.yaml -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: forgejo - namespace: forgejo -spec: - parentRefs: - - name: public-gateway - namespace: apps - hostnames: - - "www.symcrest.com" - rules: - - matches: - - path: - type: Exact - value: "/internal/dev/git" - filters: - - type: RequestRedirect - requestRedirect: - path: - type: ReplaceFullPath - replaceFullPath: "/internal/dev/git/" - statusCode: 301 - - - matches: - - path: - type: PathPrefix - value: "/internal/dev/git/" - filters: - - type: URLRewrite - urlRewrite: - path: - type: ReplacePrefixMatch - replacePrefixMatch: / - backendRefs: - - name: forgejo - port: 3000 - - - matches: - - path: - type: PathPrefix - value: /v2/ - backendRefs: - - name: forgejo - port: 3000 diff --git a/rendered/longhorn/longhorn.yaml b/rendered/longhorn/longhorn.yaml index 59d5e03..8b13789 100644 --- a/rendered/longhorn/longhorn.yaml +++ b/rendered/longhorn/longhorn.yaml @@ -1,39 +1 @@ ---- -# Source: longhorn-wrapper/templates/httproute.yaml -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: longhorn - namespace: longhorn-system -spec: - parentRefs: - - name: public-gateway - namespace: apps - hostnames: - - "www.symcrest.com" - rules: - - matches: - - path: - type: Exact - value: "/internal/ops/volumes" - filters: - - type: RequestRedirect - requestRedirect: - path: - type: ReplaceFullPath - replaceFullPath: "/internal/ops/volumes/" - statusCode: 301 - - matches: - - path: - type: PathPrefix - value: "/internal/ops/volumes/" - filters: - - type: URLRewrite - urlRewrite: - path: - type: ReplacePrefixMatch - replacePrefixMatch: "/" - backendRefs: - - name: longhorn-frontend - port: 80 diff --git a/rendered/pgadmin/pgadmin.yaml b/rendered/pgadmin/pgadmin.yaml index 7d1cb27..7d2aa00 100644 --- a/rendered/pgadmin/pgadmin.yaml +++ b/rendered/pgadmin/pgadmin.yaml @@ -71,36 +71,3 @@ spec: - name: pgadmin-data persistentVolumeClaim: claimName: pgadmin-data ---- -# Source: pgadmin/templates/httproute.yaml -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: pgadmin - namespace: pgadmin -spec: - parentRefs: - - name: public-gateway - namespace: apps - hostnames: - - "www.symcrest.com" - rules: - - matches: - - path: - type: Exact - value: "/internal/dev/dbadmin/postgres" - filters: - - type: RequestRedirect - requestRedirect: - path: - type: ReplaceFullPath - replaceFullPath: "/internal/dev/dbadmin/postgres/" - statusCode: 301 - - - matches: - - path: - type: PathPrefix - value: "/internal/dev/dbadmin/postgres/" - backendRefs: - - name: pgadmin - port: 80 diff --git a/rendered/symcrest-web/symcrest-web.yaml b/rendered/symcrest-web/symcrest-web.yaml index e8413d8..c5e6ee9 100644 --- a/rendered/symcrest-web/symcrest-web.yaml +++ b/rendered/symcrest-web/symcrest-web.yaml @@ -64,24 +64,3 @@ spec: requests: cpu: 50m memory: 64Mi ---- -# Source: symcrest-web/templates/httproute.yaml -apiVersion: gateway.networking.k8s.io/v1 -kind: HTTPRoute -metadata: - name: symcrest-web - namespace: apps -spec: - parentRefs: - - name: public-gateway - namespace: apps - hostnames: - - "www.symcrest.com" - rules: - - matches: - - path: - type: PathPrefix - value: / - backendRefs: - - name: symcrest-web - port: 80