Skip to content

Commit 9c64b01

Browse files
authored
fix(agent): allows to specify non semver tags [SMAGENT-6093] (#1504)
1 parent db11ce9 commit 9c64b01

File tree

5 files changed

+77
-3
lines changed

5 files changed

+77
-3
lines changed

charts/agent/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ sources:
3030
- https://app.sysdigcloud.com/#/settings/user
3131
- https://github.com/draios/sysdig
3232
type: application
33-
version: 1.17.1
33+
version: 1.17.2

charts/agent/templates/_helpers.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,3 +511,11 @@ true
511511
{{- define "agent.localForwarderConfigMapName" }}
512512
{{- include "agent.configmapName" . | trunc 46 | trimSuffix "-" | printf "%s-local-forwarder" }}
513513
{{- end }}
514+
515+
{{- define "agent.enableHttpProbes" }}
516+
{{- if regexMatch "^v?([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(-([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*))?(\\+([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*))?$" .Values.image.tag }}
517+
{{- if semverCompare ">= 12.18.0-0" .Values.image.tag }}
518+
{{- printf "true" -}}
519+
{{- end }}
520+
{{- end }}
521+
{{- end }}

charts/agent/templates/daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ spec:
219219
value: /opt/draios/etc/ca-certs/{{- include "sysdig.custom_ca.keyName" (dict "global" .Values.global.ssl "component" .Values.ssl) -}}
220220
{{- end }}
221221
readinessProbe:
222-
{{- if ge (semver "12.18.0" | (semver .Values.image.tag).Compare) 0 }}
222+
{{- if eq (include "agent.enableHttpProbes" .) "true" }}
223223
httpGet:
224224
path: /healthz
225225
port: 24483

charts/agent/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ spec:
103103
value: /opt/draios/etc/ca-certs/{{- include "sysdig.custom_ca.keyName" (dict "global" .Values.global.ssl "component" .Values.ssl) -}}
104104
{{- end }}
105105
readinessProbe:
106-
{{- if ge (semver "12.18.0" | (semver .Values.image.tag).Compare) 0 }}
106+
{{- if eq (include "agent.enableHttpProbes" .) "true" }}
107107
httpGet:
108108
path: /healthz
109109
port: 24483

charts/agent/tests/readiness_probe_test.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,38 @@ tests:
4747
initialDelaySeconds: 90
4848
periodSeconds: 3
4949
template: templates/daemonset.yaml
50+
- it: "[DaemonSet] Readiness Probe (agent == dev)"
51+
set:
52+
image:
53+
tag: dev
54+
asserts:
55+
- equal:
56+
path: spec.template.spec.containers[0].readinessProbe
57+
value:
58+
exec:
59+
command:
60+
- test
61+
- -e
62+
- /opt/draios/logs/running
63+
initialDelaySeconds: 90
64+
periodSeconds: 3
65+
template: templates/daemonset.yaml
66+
- it: "[DaemonSet] Readiness Probe (agent == latest)"
67+
set:
68+
image:
69+
tag: latest
70+
asserts:
71+
- equal:
72+
path: spec.template.spec.containers[0].readinessProbe
73+
value:
74+
exec:
75+
command:
76+
- test
77+
- -e
78+
- /opt/draios/logs/running
79+
initialDelaySeconds: 90
80+
periodSeconds: 3
81+
template: templates/daemonset.yaml
5082
- it: "[DelegatedAgentDeployment] Readiness Probe (agent > 12.18.0)"
5183
set:
5284
delegatedAgentDeployment:
@@ -94,6 +126,40 @@ tests:
94126
- /opt/draios/logs/running
95127
initialDelaySeconds: 90
96128
periodSeconds: 3
129+
- it: "[DelegatedAgentDeployment] Readiness Probe (agent == dev)"
130+
set:
131+
delegatedAgentDeployment:
132+
enabled: true
133+
image:
134+
tag: dev
135+
asserts:
136+
- equal:
137+
path: spec.template.spec.containers[0].readinessProbe
138+
value:
139+
exec:
140+
command:
141+
- test
142+
- -e
143+
- /opt/draios/logs/running
144+
initialDelaySeconds: 90
145+
periodSeconds: 3
146+
- it: "[DelegatedAgentDeployment] Readiness Probe (agent == latest)"
147+
set:
148+
delegatedAgentDeployment:
149+
enabled: true
150+
image:
151+
tag: latest
152+
asserts:
153+
- equal:
154+
path: spec.template.spec.containers[0].readinessProbe
155+
value:
156+
exec:
157+
command:
158+
- test
159+
- -e
160+
- /opt/draios/logs/running
161+
initialDelaySeconds: 90
162+
periodSeconds: 3
97163
- it: Test setting probe delays
98164
set:
99165
daemonset:

0 commit comments

Comments
 (0)