Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new(config): add container_engines config to falco.yaml #3266

Merged
merged 5 commits into from
Aug 27, 2024

Conversation

incertum
Copy link
Contributor

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

/kind release

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area tests

/area proposals

/area CI

What this PR does / why we need it:

Fixes #3258

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

new(config): add `container_engines` config to falco.yaml

@incertum
Copy link
Contributor Author

/milestone 0.39.0

@poiana poiana added this to the 0.39.0 milestone Jun 27, 2024
@incertum
Copy link
Contributor Author

Re unit tests: Curious to know where to add tests as for most configs we do not have any here except for example for engine_modern_config.yaml etc. And / or likely more tests in libs make more sense given we just call some API here?

userspace/falco/configuration.cpp Outdated Show resolved Hide resolved
falco.yaml Outdated
enabled: true
cri:
enabled: true
cri: ["/run/containerd/containerd.sock", "/run/crio/crio.sock", "/run/k3s/containerd/containerd.sock"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cri: ["/run/containerd/containerd.sock", "/run/crio/crio.sock", "/run/k3s/containerd/containerd.sock"]
sockets: ["/run/containerd/containerd.sock", "/run/crio/crio.sock", "/run/k3s/containerd/containerd.sock"]

falco.yaml Outdated
cri:
enabled: true
cri: ["/run/containerd/containerd.sock", "/run/crio/crio.sock", "/run/k3s/containerd/containerd.sock"]
disable-cri-async: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
disable-cri-async: false
disable-async: false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leogr? Re both names we ok with having them different to the CLI args?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw ok with me.

@FedeDP
Copy link
Contributor

FedeDP commented Jun 28, 2024

I'd also add a debug print of enabled container engines during the startup of Falco ;)

@FedeDP
Copy link
Contributor

FedeDP commented Jun 28, 2024

And / or likely more tests in libs make more sense given we just call some API here?

Yes, agree! Also, you could add some tests to https://github.com/falcosecurity/testing/blob/main/tests/falco/config_test.go; for example you could test that enabling each container engine yields a debug log (aforementioned) with the requested engine enabled.

falco.yaml Outdated
Comment on lines 1246 to 1247
rocket:
enabled: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK rocket was the initial name, but its official name is rkt

Still, rkt was discontinued in 2020 (https://github.com/rkt/rkt), so I don't see any compelling reason to keep it.

@falcosecurity/libs-maintainers wdyt? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't know, yes can change it to rkt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@falcosecurity/libs-maintainers wdyt? 🤔

Agree, we can clean it up; +1 from me!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it. It's not relevant for Falco as you pointed out.

}
}

// Decide whether to do sync or async for CRI metadata fetch
inspector->set_cri_async(!s.options.disable_cri_async);

if(s.options.disable_cri_async || s.config->m_container_engines_disable_cri_async)
{
falco_logger::log(falco_logger::level::DEBUG, "Disabling async lookups for 'CRI'");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to extend the API and add a is_cri_async and a get_cri_socket_paths methods. If you also think it would be good I can do it during this dev cycle, but no rush.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

falcosecurity/libs#2022 also added a label "good first issue" if someone wanted to get started helping us.

@FedeDP
Copy link
Contributor

FedeDP commented Jul 2, 2024

So, TestFalco_Legacy_TimeIso8601 is failing because it sees:

Fri Jun 28 21:37:49 2024: Enabled container engine 'docker'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'podman'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'CRI'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'lxc'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'libvirt_lxc'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'bpm'

log before the initial:

    	            	2024-06-28T21:37:49+0000: Falco version: 0.39.0-33+0dfb7b8 (x86_64)

string.
I don't get it though, since the Falco version one is logged by load_config that is the first app::run step, while your new logs come from init_inspectors step.

@FedeDP
Copy link
Contributor

FedeDP commented Jul 2, 2024

Aside from ☝️ , LGTM!

@incertum
Copy link
Contributor Author

incertum commented Jul 2, 2024

So, TestFalco_Legacy_TimeIso8601 is failing because it sees:

Fri Jun 28 21:37:49 2024: Enabled container engine 'docker'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'podman'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'CRI'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'lxc'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'libvirt_lxc'
        	            	Fri Jun 28 21:37:49 2024: Enabled container engine 'bpm'

log before the initial:

    	            	2024-06-28T21:37:49+0000: Falco version: 0.39.0-33+0dfb7b8 (x86_64)

string. I don't get it though, since the Falco version one is logged by load_config that is the first app::run step, while your new logs come from init_inspectors step.

The test should not be dependent on the order? If so, we should adjust the test anyways. Above ones are generated while parsing the config.

@FedeDP
Copy link
Contributor

FedeDP commented Jul 3, 2024

The test should not be dependent on the order?

Yes but the test enforces that the very first log line should be Falco version..., and that makes sense from an UX perspective IMHO.
I'd move the logs here from config loading to inspector init time (also if you think that makes sense because in that case, we would only log when the syscall inspector is actually in use, but we won't log if we are eg: plugin only).

@FedeDP
Copy link
Contributor

FedeDP commented Jul 4, 2024

We need to fix #3270 in order to fix CI, since centos7 is eol.

@leogr
Copy link
Member

leogr commented Jul 18, 2024

We need to fix #3270 in order to fix CI, since centos7 is eol.

Is #3274 enough? 🤔

@FedeDP
Copy link
Contributor

FedeDP commented Aug 26, 2024

Hey Melissa, we were finally able to bump libs in Falco master, can you rebase this one? :)

@incertum incertum force-pushed the container-engines-config branch 2 times, most recently from b2ece6a to 425adc3 Compare August 26, 2024 17:04
@incertum
Copy link
Contributor Author

Hey Melissa, we were finally able to bump libs in Falco master, can you rebase this one? :)

Thanks @FedeDP

m_metrics_include_empty_values(false)
m_metrics_include_empty_values(false),
m_container_engines_mask(0),
m_container_engines_cri_socket_paths({"/run/containerd/containerd.sock", "/run/crio/crio.sock","/run/k3s/containerd/containerd.sock"}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for now but i'd expose these defaults as static strings from libs cri namespace, like: libsinsp::container_engines::cri::s_default_socket_paths.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema_json in this file must be updated to match the newly added config key.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also fix CI of course.

incertum and others added 5 commits August 26, 2024 17:40
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
…pector

Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@poiana
Copy link

poiana commented Aug 27, 2024

LGTM label has been added.

Git tree hash: 4a0d14e5afced1c00a54495c6fbb28b65032016c

@poiana
Copy link

poiana commented Aug 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, incertum

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 8a3cb76 into falcosecurity:master Aug 27, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Create container_engines configs in falco.yaml
5 participants