@@ -34,6 +34,26 @@ def _get_event_generator_helm_cmd():
34
34
)
35
35
36
36
37
+ def _get_falco_exporter_helm_cmd (instance : harness .Instance ):
38
+ falco_exporter_rock = env_util .get_build_meta_info_for_rock_version (
39
+ "falco-exporter" , "0.8.7" , "amd64"
40
+ )
41
+
42
+ images = [
43
+ k8s_util .HelmImage (falco_exporter_rock .image ),
44
+ ]
45
+
46
+ return k8s_util .get_helm_install_command (
47
+ "falco-exporter" ,
48
+ "falco-exporter" ,
49
+ namespace = "falco" ,
50
+ repository = "https://falcosecurity.github.io/charts" ,
51
+ images = images ,
52
+ runAsUser = 0 ,
53
+ split_image_registry = True ,
54
+ )
55
+
56
+
37
57
def _get_falcosidekick_helm_cmd ():
38
58
falcosidekick_rock = env_util .get_build_meta_info_for_rock_version (
39
59
"falcosidekick" , "2.29.0" , "amd64"
@@ -79,6 +99,10 @@ def _get_falco_helm_cmd(falco_version: str):
79
99
80
100
set_configs = [
81
101
"driver.kind=modern_ebpf" ,
102
+ # required for the falco-exporter.
103
+ # https://github.com/falcosecurity/charts/tree/master/charts/falco-exporter#falco-exporter-helm-chart
104
+ "falco.grpc.enabled=true" ,
105
+ "falco.grpc_output.enabled=true" ,
82
106
]
83
107
84
108
return k8s_util .get_helm_install_command (
@@ -93,6 +117,33 @@ def _get_falco_helm_cmd(falco_version: str):
93
117
)
94
118
95
119
120
+ def _assert_falco_exporter_up (instance : harness .Instance ):
121
+ # Assert that falco-exporter is responsive. The falco-exporter image is a bare image,
122
+ # so, we're using the falco Pod to curl the falco-exporter endpoint instead.
123
+ LOG .info ("Checking if falco-exporter is being responsive." )
124
+ process = instance .exec (
125
+ [
126
+ "k8s" ,
127
+ "kubectl" ,
128
+ "--namespace" ,
129
+ "falco" ,
130
+ "exec" ,
131
+ f"{ constants .K8S_DAEMONSET } /falco" ,
132
+ "--" ,
133
+ "curl" ,
134
+ "-s" ,
135
+ "http://falco-exporter:9376/metrics" ,
136
+ ],
137
+ check = True ,
138
+ capture_output = True ,
139
+ text = True ,
140
+ )
141
+
142
+ assert (
143
+ "Total number of scrapes" in process .stdout
144
+ ), "Expected falco-exporter to return metrics."
145
+
146
+
96
147
def _assert_falcosidekick_up (instance : harness .Instance ):
97
148
# Assert that falcosidekick is responsive. It has a ping method, to which we should get pong.
98
149
# The falcosidekick image does not have curl or wget, but the falco image does.
@@ -178,8 +229,14 @@ def test_integration_falco(function_instance: harness.Instance, image_version):
178
229
# Deploy falcosidekick helm chart and wait for it to become active.
179
230
function_instance .exec (_get_falcosidekick_helm_cmd ())
180
231
181
- # Wait for the daemonset to become Active.
182
- k8s_util .wait_for_daemonset (function_instance , "falco" , "falco" , retry_times = 10 )
232
+ # Deploy falco-exporter helm chart and wait for it to become active.
233
+ function_instance .exec (_get_falco_exporter_helm_cmd (function_instance ))
234
+
235
+ # Wait for the daemonsets to become Active.
236
+ for daemonset in ["falco" , "falco-exporter" ]:
237
+ k8s_util .wait_for_daemonset (
238
+ function_instance , daemonset , "falco" , retry_times = 10
239
+ )
183
240
184
241
# Wait for the deployments to become Active.
185
242
for deployment in ["falcosidekick" , "falcosidekick-ui" ]:
@@ -202,3 +259,4 @@ def test_integration_falco(function_instance: harness.Instance, image_version):
202
259
203
260
_assert_falco_logs (function_instance )
204
261
_assert_falcosidekick_up (function_instance )
262
+ _assert_falco_exporter_up (function_instance )
0 commit comments