Skip to content

Commit

Permalink
Merge pull request #15 from Broadcom/dynamic
Browse files Browse the repository at this point in the history
Support different configurable folder paths for envoy configuration, …
  • Loading branch information
atsaur authored Aug 14, 2023
2 parents ae1d3d5 + 5041ca0 commit 3e4a5a0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: titan-mesh-helm-lib-chart
version: 1.3.5
version: 1.3.6
kubeVersion: '>=1.10.0-0'
type: library
description: Titan Service Mesh Helm lib chart for every service
Expand Down
12 changes: 7 additions & 5 deletions templates/_containers/_envoy.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
{{- if $titanSideCars -}}
{{- $envoyEnabled := eq (include "static.titan-mesh-helm-lib-chart.envoyEnabled" $titanSideCars) "true" -}}
{{- $envoy := $titanSideCars.envoy -}}
{{- $envoyConfigFolder := $envoy.configFolder | default "/envoy/config" -}}
{{- $envoyScriptsFolder := $envoy.scriptsFolder | default "/envoy" -}}
{{- $envars := $envoy.env -}}
{{- $clusters := $envoy.clusters }}
{{- $remoteMyApp := index $clusters "remote-myapp" -}}
Expand Down Expand Up @@ -57,7 +59,7 @@
command:
- /usr/local/bin/envoy
- -c
- /envoy/envoy.yaml
- {{ printf "%s/envoy.yaml" (trimSuffix "/" $envoyConfigFolder) }}
- --service-cluster
- {{ .appName }}
- --service-node
Expand Down Expand Up @@ -92,7 +94,7 @@
{{- if $envoyHealthChecksStartup.useCustomhealthCheckCmds }}
exec:
command:
- {{ print ($envoyHealthChecksStartup.customHealthCheckCmdScript | default "/envoy/health_check_restart_pod.sh") | quote }}
- {{ print ($envoyHealthChecksStartup.customHealthCheckCmdScript | default (printf "%s/health_check_restart_pod.sh" (trimSuffix "/" $envoyScriptsFolder))) | quote }}
- "startup"
- {{ print ($envoy.startupFailureThreshold | default "300") | quote }}
{{- if $wasmFilterUsed }}
Expand Down Expand Up @@ -120,7 +122,7 @@
{{- if $envoyHealthChecksLiveness.useCustomhealthCheckCmds }}
exec:
command:
- {{ print ($envoyHealthChecksLiveness.customHealthCheckCmdScript | default "/envoy/health_check_restart_pod.sh") | quote }}
- {{ print ($envoyHealthChecksLiveness.customHealthCheckCmdScript | default (printf "%s/health_check_restart_pod.sh" (trimSuffix "/" $envoyScriptsFolder))) | quote }}
- "liveness"
- {{ print ($envoy.livenessFailureThreshold | default "2") | quote }}
{{- if $wasmFilterUsed }}
Expand Down Expand Up @@ -148,7 +150,7 @@
{{- if $envoyHealthChecksReadiness.useCustomhealthCheckCmds }}
exec:
command:
- {{ print ($envoyHealthChecksReadiness.customHealthCheckCmdScript | default "/envoy/health_check_restart_pod.sh") | quote }}
- {{ print ($envoyHealthChecksReadiness.customHealthCheckCmdScript | default (printf "%s/health_check_restart_pod.sh" (trimSuffix "/" $envoyScriptsFolder))) | quote }}
- "readiness"
- {{ print ($envoy.readinessFailureThreshold | default "1") | quote }}
{{- if $wasmFilterUsed }}
Expand All @@ -172,7 +174,7 @@
timeoutSeconds: {{ $envoy.readinessTimeoutSeconds | default "5" }}
{{- end }}
volumeMounts:
- mountPath: /envoy
- mountPath: {{ $envoyConfigFolder }}
name: titan-configs
- mountPath: /logs/
name: {{ include "titan-mesh-helm-lib-chart.volumes.logsVolumeName" $titanSideCars }}
Expand Down
5 changes: 3 additions & 2 deletions templates/configs/_envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
{{- if or (and $ingress (not $ingress.enabled)) (and $egress (not $egress.enabled)) }}
{{- $useDynamicConfiguration := $envoy.useDynamicConfiguration | default false }}
{{- if $useDynamicConfiguration }}
{{- $envoyConfigFolder := $envoy.configFolder | default "/envoy/config" }}
envoy.yaml: |
node:
cluster: {{ $appName }}
id: {{ printf "%s-id" $appName }}
dynamic_resources:
cds_config:
path: /envoy/cds.yaml
path: {{ printf "%s/cds.yaml" (trimSuffix "/" $envoyConfigFolder) }}
lds_config:
path: /envoy/lds.yaml
path: {{ printf "%s/lds.yaml" (trimSuffix "/" $envoyConfigFolder) }}
admin:
access_log_path: /dev/stdout
Expand Down
3 changes: 2 additions & 1 deletion templates/envoy/_filter_wasm._custom_response.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
{{- $ := set $config "custom_responses" $customResponses }}
{{- end }}
{{- if eq (include "titan-mesh-helm-lib-chart.envoy.filter.custom.response.enabled" (dict "requests" $requests "routes" $routes)) "true" }}
{{- $envoyFiltersFolder := $envoy.filtersFolder | default "/envoy" }}
- name: envoy.filters.http.custom_response
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
Expand Down Expand Up @@ -165,6 +166,6 @@
allow_precompiled: {{ $customResponseFilterAllowedPrecompiled }}
code:
local:
filename: {{ printf "/envoy/%s" $customResponseFilterName | quote }}
filename: {{ printf "%s/%s" (trimSuffix "/" $envoyFiltersFolder) $customResponseFilterName | quote }}
{{- end }}
{{- end }}
3 changes: 2 additions & 1 deletion templates/envoy/_filter_wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
{{- $ := set $enrichment "audits" $audits }}
{{- end }}
{{- if eq (include "titan-mesh-helm-lib-chart.envoy.filter.enrichment.enabled" (dict "requests" $requests "routes" $routes)) "true" }}
{{- $envoyFiltersFolder := $envoy.filtersFolder | default "/envoy" }}
- name: envoy.filters.http.enrichment
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
Expand Down Expand Up @@ -185,6 +186,6 @@
allow_precompiled: {{ $enrichfilterAllowedPrecompiled }}
code:
local:
filename: {{ printf "/envoy/%s" $enrichfilterName | quote }}
filename: {{ printf "%s/%s" (trimSuffix "/" $envoyFiltersFolder) $enrichfilterName | quote }}
{{- end }}
{{- end }}
3 changes: 2 additions & 1 deletion templates/envoy/_tls_certs.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- define "titan-mesh-helm-lib-chart.envoy.filter.tls-cert" }}
{{- $envoy := .envoy -}}
{{- $envoyConfigFolder := $envoy.configFolder | default "/envoy/config" -}}
tls_certificate_sds_secret_configs:
- name: tls_sds
sds_config:
path: {{ printf "%s/envoy-sds.yaml" ($envoy.configFolder | default "/envoy") }}
path: {{ printf "%s/envoy-sds.yaml" (trimSuffix "/" $envoyConfigFolder) }}
{{- end }}

0 comments on commit 3e4a5a0

Please sign in to comment.