Skip to content

Commit fb01763

Browse files
authored
fix(shield): do not set proxy configuration on host-shield when proxy is not configured (#2319)
1 parent 9577c0c commit fb01763

File tree

3 files changed

+65
-10
lines changed

3 files changed

+65
-10
lines changed

charts/shield/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ maintainers:
1313
- name: mavimo
1414
1515
type: application
16-
version: 1.12.5
16+
version: 1.12.6
1717
appVersion: "1.0.0"

charts/shield/templates/host/_windows_configmap_helpers.tpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@
7373
7474
{{- $_ := set $config "ssl" $sslConfig -}}
7575
76-
{{- $config := merge $config (dict "proxy" (include "host.proxy_config" . | fromYaml)) }}
76+
{{- if (include "common.proxy.enabled" . ) }}
77+
{{- $config := merge $config (dict "proxy" (include "host.proxy_config" . | fromYaml)) }}
78+
{{- end }}
7779
7880
{{- if and (include "common.semver.is_valid" .Values.host_windows.image.tag) (semverCompare ">= 0.8.0-0" .Values.host_windows.image.tag) }}
7981
{{- $runtimeAdditionalSettings := (include "host.windows.runtime_config_override" .) | fromYaml }}

charts/shield/tests/host/configmap-windows-host-shield-config_test.yaml

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ tests:
180180
in_use:
181181
enabled: true
182182
183-
- it: Default No Proxy
183+
- it: Default Proxy
184184
asserts:
185185
- hasDocuments:
186186
count: 1
@@ -193,11 +193,10 @@ tests:
193193
value: shield-namespace
194194
- exists:
195195
path: data["host-shield.yaml"]
196-
- matchRegex:
196+
- notMatchRegex:
197197
path: data["host-shield.yaml"]
198-
pattern: |-
199-
proxy:
200-
no_proxy: 127.0.0.1,localhost,169.254.0.0/16,.cluster.local
198+
pattern: |
199+
proxy: .*
201200
202201
- it: With Only HTTP Proxy (http protocol)
203202
set:
@@ -220,6 +219,7 @@ tests:
220219
pattern: |-
221220
proxy:
222221
http_proxy: http://proxy.example.com:8080
222+
no_proxy: 127.0.0.1,localhost,169.254.0.0/16,.cluster.local
223223
224224
- it: With Only HTTP Proxy (http protocol) [Existing Secret]
225225
set:
@@ -242,6 +242,7 @@ tests:
242242
pattern: |-
243243
proxy:
244244
http_proxy: http://proxy-existing.example.com:8080
245+
no_proxy: 127.0.0.1,localhost,169.254.0.0/16,.cluster.local
245246
246247
- it: With Only HTTPS Proxy (https protocol)
247248
set:
@@ -264,6 +265,7 @@ tests:
264265
pattern: |
265266
proxy:
266267
https_proxy: https://proxy.example.com:8080
268+
no_proxy: 127.0.0.1,localhost,169.254.0.0/16,.cluster.local
267269
268270
- it: With Only HTTPS Proxy (https protocol) [Existing Secret]
269271
set:
@@ -286,6 +288,7 @@ tests:
286288
pattern: |
287289
proxy:
288290
https_proxy: https://proxy-existing.example.com:8080
291+
no_proxy: 127.0.0.1,localhost,169.254.0.0/16,.cluster.local
289292
290293
- it: With Only NO Proxy
291294
set:
@@ -303,15 +306,63 @@ tests:
303306
value: shield-namespace
304307
- exists:
305308
path: data["host-shield.yaml"]
306-
- matchRegex:
309+
- notMatchRegex:
310+
path: data["host-shield.yaml"]
311+
pattern: |
312+
proxy: .*
313+
314+
- it: With Only NO Proxy [Existing Secret]
315+
set:
316+
proxy:
317+
no_proxy_existing_secret: "proxy-secret"
318+
asserts:
319+
- hasDocuments:
320+
count: 1
321+
- containsDocument:
322+
kind: ConfigMap
323+
apiVersion: v1
324+
name: release-name-shield-host-windows
325+
- equal:
326+
path: metadata.namespace
327+
value: shield-namespace
328+
- exists:
329+
path: data["host-shield.yaml"]
330+
- notMatchRegex:
307331
path: data["host-shield.yaml"]
308332
pattern: |
333+
proxy: .*
334+
335+
- it: With No Proxy
336+
set:
337+
proxy:
338+
http_proxy: "http://proxy.example.com:8080"
339+
https_proxy: "https://proxy.example.com:8080"
340+
no_proxy: "example.com"
341+
asserts:
342+
- hasDocuments:
343+
count: 1
344+
- containsDocument:
345+
kind: ConfigMap
346+
apiVersion: v1
347+
name: release-name-shield-host-windows
348+
- equal:
349+
path: metadata.namespace
350+
value: shield-namespace
351+
- exists:
352+
path: data["host-shield.yaml"]
353+
- matchRegex:
354+
path: data["host-shield.yaml"]
355+
pattern: |-
309356
proxy:
357+
http_proxy: http://proxy.example.com:8080
358+
https_proxy: https://proxy.example.com:8080
310359
no_proxy: example.com,127.0.0.1,localhost,169.254.0.0/16,.cluster.local
311360
312-
- it: With Only NO Proxy [Existing Secret]
361+
- it: With No Proxy [Existing Secret]
313362
set:
314363
proxy:
364+
http_proxy_existing_secret: "proxy-secret"
365+
https_proxy_existing_secret: "proxy-secret"
315366
no_proxy_existing_secret: "proxy-secret"
316367
asserts:
317368
- hasDocuments:
@@ -327,8 +378,10 @@ tests:
327378
path: data["host-shield.yaml"]
328379
- matchRegex:
329380
path: data["host-shield.yaml"]
330-
pattern: |
381+
pattern: |-
331382
proxy:
383+
http_proxy: http://proxy-existing.example.com:8080
384+
https_proxy: https://proxy-existing.example.com:8080
332385
no_proxy: example.com
333386
334387
- it: Alternative regions (default)

0 commit comments

Comments
 (0)