@@ -34,6 +34,30 @@ def _get_event_generator_helm_cmd():
34
34
)
35
35
36
36
37
+ def _get_falcosidekick_helm_cmd ():
38
+ falcosidekick_rock = env_util .get_build_meta_info_for_rock_version (
39
+ "falcosidekick" , "2.29.0" , "amd64"
40
+ )
41
+
42
+ images = [
43
+ k8s_util .HelmImage (falcosidekick_rock .image ),
44
+ ]
45
+
46
+ set_configs = [
47
+ "webui.enabled=true" ,
48
+ ]
49
+
50
+ return k8s_util .get_helm_install_command (
51
+ "falcosidekick" ,
52
+ "falcosidekick" ,
53
+ namespace = "falco" ,
54
+ repository = "https://falcosecurity.github.io/charts" ,
55
+ images = images ,
56
+ set_configs = set_configs ,
57
+ split_image_registry = True ,
58
+ )
59
+
60
+
37
61
def _get_falco_helm_cmd (falco_version : str ):
38
62
falco_rock = env_util .get_build_meta_info_for_rock_version (
39
63
"falco" , falco_version , "amd64"
@@ -69,6 +93,33 @@ def _get_falco_helm_cmd(falco_version: str):
69
93
)
70
94
71
95
96
+ def _assert_falcosidekick_up (instance : harness .Instance ):
97
+ # Assert that falcosidekick is responsive. It has a ping method, to which we should get pong.
98
+ # The falcosidekick image does not have curl or wget, but the falco image does.
99
+ LOG .info ("Checking if Falco detected irregularities." )
100
+ process = instance .exec (
101
+ [
102
+ "k8s" ,
103
+ "kubectl" ,
104
+ "--namespace" ,
105
+ "falco" ,
106
+ "exec" ,
107
+ f"{ constants .K8S_DAEMONSET } /falco" ,
108
+ "--" ,
109
+ "curl" ,
110
+ "-s" ,
111
+ "http://falcosidekick:2801/ping" ,
112
+ ],
113
+ check = True ,
114
+ capture_output = True ,
115
+ text = True ,
116
+ )
117
+
118
+ assert (
119
+ "pong" in process .stdout
120
+ ), "Expected falcosidekick to respond with pong to ping."
121
+
122
+
72
123
def _assert_falco_logs (instance : harness .Instance ):
73
124
# Falco should have noticed the unexpected behaviour from the event-generator, and it should
74
125
# have logged these events to stdout by default.
@@ -116,12 +167,26 @@ def _assert_falco_logs(instance: harness.Instance):
116
167
117
168
@pytest .mark .parametrize ("image_version" , ["0.38.2" , "0.39.0" ])
118
169
def test_integration_falco (function_instance : harness .Instance , image_version ):
170
+ # falcosidekick has readOnlyRootFilesystem=True, which means Pebble won't be able
171
+ # to copy its necessary files. This mutating webhook solves this issue by adding
172
+ # an emptydir volume to Pods for Pebble to use.
173
+ k8s_util .install_mutating_pebble_webhook (function_instance )
174
+
119
175
# Deploy Falco helm chart and wait for it to become active.
120
176
function_instance .exec (_get_falco_helm_cmd (image_version ))
121
177
178
+ # Deploy falcosidekick helm chart and wait for it to become active.
179
+ function_instance .exec (_get_falcosidekick_helm_cmd ())
180
+
122
181
# Wait for the daemonset to become Active.
123
182
k8s_util .wait_for_daemonset (function_instance , "falco" , "falco" , retry_times = 10 )
124
183
184
+ # Wait for the deployments to become Active.
185
+ for deployment in ["falcosidekick" , "falcosidekick-ui" ]:
186
+ k8s_util .wait_for_deployment (
187
+ function_instance , deployment , "falco" , retry_times = 10
188
+ )
189
+
125
190
# Deploy event-generator for Falco and wait for it to become active.
126
191
function_instance .exec (_get_event_generator_helm_cmd ())
127
192
@@ -136,3 +201,4 @@ def test_integration_falco(function_instance: harness.Instance, image_version):
136
201
)
137
202
138
203
_assert_falco_logs (function_instance )
204
+ _assert_falcosidekick_up (function_instance )
0 commit comments