SEC-5054-adding custom headers#142
Conversation
| 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 }}}' |
There was a problem hiding this comment.
@sjgupta19 I'm not sure toJson is a valid type conversion, Did you mean toYaml instead?
There was a problem hiding this comment.
seems like it is valid function - https://helm.sh/docs/chart_template_guide/function_list/
There was a problem hiding this comment.
@sjgupta19 ic, Can you share the helm template --dry-run where you tested this? Just to make sure does not error out
There was a problem hiding this comment.
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
There was a problem hiding this comment.
thats the same error I am getting without these changes. So I guess its unrelated to my changes?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
looks like you can use the backendconfig for this https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-configuration#request_headers
There was a problem hiding this comment.
So do i have to specifically mention that in backendConfig? isn't .Values.cloudArmor.backendConfig.customHeaders this essentially adding it to backendConfig?
vafied
left a comment
There was a problem hiding this comment.
you need to validate for .Values.cloudArmor.backendConfig.customHeaders to have a value or this line will be malformed
|
@vafied Validate as in check if it exists or not? |
SEC-5054