From 45e93a6ad2dd36ab80fdc83e233622ff23ffda0b Mon Sep 17 00:00:00 2001 From: Alix Cook Date: Fri, 22 Jan 2021 11:49:25 -0500 Subject: [PATCH] add mapping for devportal to inject cache-control header when loading assets --- templates/aes-internal.yaml | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/templates/aes-internal.yaml b/templates/aes-internal.yaml index 67346889d..1b7be6338 100644 --- a/templates/aes-internal.yaml +++ b/templates/aes-internal.yaml @@ -30,6 +30,39 @@ spec: --- apiVersion: getambassador.io/v2 kind: Mapping +metadata: + name: {{ include "ambassador.fullname" . }}-devportal-assets + labels: + app.kubernetes.io/name: {{ include "ambassador.name" . }} + app.kubernetes.io/part-of: {{ .Release.Name }} + helm.sh/chart: {{ include "ambassador.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{- if .Values.deploymentTool }} + app.kubernetes.io/managed-by: {{ .Values.deploymentTool }} + {{- else }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- end }} + app.kubernetes.io/component: {{ include "ambassador.name" . }}-devportal-assets + product: aes +spec: + {{- if .Values.env }} + {{- if hasKey .Values.env "AMBASSADOR_ID" }} + ambassador_id: {{ .Values.env.AMBASSADOR_ID | quote }} + {{- end }} + {{- end }} + prefix: /documentation/(assets|styles)/(.*)(.css) + prefix_regex: true + regex_rewrite: + pattern: /documentation/(.*) + substitution: /docs/\1 + service: "127.0.0.1:8500" + add_response_headers: + cache-control: + value: "public, max-age=3600, immutable" + append: false +--- +apiVersion: getambassador.io/v2 +kind: Mapping metadata: # This Mapping name is what the demo uses. Sigh. name: {{ include "ambassador.fullname" . }}-devportal-demo @@ -81,4 +114,4 @@ spec: prefix: /openapi/ rewrite: "" service: "127.0.0.1:8500" -{{ end }} \ No newline at end of file +{{ end }}