Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions charts/common/templates/service-cloudarmor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ metadata:
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- if .Values.cloudArmor.backendConfig.iap }}
cloud.google.com/backend-config: '{"ports": {"80":"{{ include "common.name" . }}", "443":"{{ include "common.name" . }}"},"default": "{{ include "common.name" . }}"}'
cloud.google.com/backend-config: '{"ports": {"80":"{{ include "common.name" . }}", "443":"{{ include "common.name" . }}"},"default": "{{ include "common.name" . }}", "customRequestHeaders": {{ .Values.cloudArmor.backendConfig.customHeaders | toJson }}}'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjgupta19 I'm not sure toJson is a valid type conversion, Did you mean toYaml instead?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TavoDave TavoDave Nov 2, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjgupta19 ic, Can you share the helm template --dry-run where you tested this? Just to make sure does not error out

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. erroring out -- Error: file '/Users/srajangupta/Desktop/dave-github/charts/charts/common/templates/service-cloudarmor.yaml' seems to be a YAML file, but expected a gzipped archive

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats the same error I am getting without these changes. So I guess its unrelated to my changes?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious if there is any other way we can add these custom headers? I am following this guide - https://cloud.google.com/load-balancing/docs/https/custom-headers-global

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just bumped the chart version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the documentation on the annotation you are modifying, doesn't look like it supports that directive https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-configuration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do i have to specifically mention that in backendConfig? isn't .Values.cloudArmor.backendConfig.customHeaders this essentially adding it to backendConfig?

{{- else }}
cloud.google.com/backend-config: '{"ports": {"80":"{{ include "common.name" . }}", "443":"{{ include "common.name" . }}"}}'
cloud.google.com/backend-config: '{"ports": {"80":"{{ include "common.name" . }}", "443":"{{ include "common.name" . }}"}, "customRequestHeaders": {{ .Values.cloudArmor.backendConfig.customHeaders | toJson }}}'
{{- end }}
{{- end }}
spec:
type: {{ .Values.cloudArmor.service.type }}
Expand Down
10 changes: 10 additions & 0 deletions charts/common/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ cloudArmor:
# enabled: true
# oauthclientCredentials:
# secretName: chart-iapsecret
customHeaders: []
# - name: X-Frame-Options
# value: DENY
# - name: X-XSS-Protection
# value: 1; mode=block
# - name: X-Content-Type-Options
# value: nosniff
# - name: Referrer-Policy
# value: no-referrer-when-downgrade
# - name: Content-Security-Policy
# By default we always use redirectToHttps in frontendConfig if you want to define overwrite consider including it
frontendConfig:
redirectToHttps:
Expand Down