Skip to content

Commit

Permalink
new(docker,scripts): dropped falco-driver-loader in favor of new `fal…
Browse files Browse the repository at this point in the history
…coctl driver` command.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Dec 6, 2023
1 parent 13991f1 commit ec4f26b
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 892 deletions.
3 changes: 2 additions & 1 deletion docker/driver-loader-legacy/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ do
ln -s "$i" "/usr/src/$base"
done

/usr/bin/falco-driver-loader "$@"
/usr/bin/falcoctl driver config "$@"
/usr/bin/falcoctl driver install
3 changes: 2 additions & 1 deletion docker/driver-loader/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ do
ln -s "$i" "/usr/src/$base"
done

/usr/bin/falco-driver-loader "$@"
/usr/bin/falcoctl driver config "$@"
/usr/bin/falcoctl driver install
5 changes: 3 additions & 2 deletions docker/falco/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ if [[ -z "${SKIP_DRIVER_LOADER}" ]]; then
done

# convert the optional space-separated env variable FALCO_DRIVER_LOADER_OPTIONS to array, prevent
# shell expansion and use it as argument list for falco-driver-loader
# shell expansion and use it as argument list for falcoctl
read -a falco_driver_loader_option_arr <<< $FALCO_DRIVER_LOADER_OPTIONS
/usr/bin/falco-driver-loader "${falco_driver_loader_option_arr[@]}"
/usr/bin/falcoctl driver config "${falco_driver_loader_option_arr[@]}"
/usr/bin/falcoctl driver install
fi

exec "$@"
2 changes: 1 addition & 1 deletion docker/no-driver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN curl -L -o falco.tar.gz \
tar -xvf falco.tar.gz && \
rm -f falco.tar.gz && \
mv falco-${FALCO_VERSION}-$(uname -m) falco && \
rm -rf /falco/usr/src/falco-* /falco/usr/bin/falco-driver-loader
rm -rf /falco/usr/src/falco-* /falco/usr/bin/falcoctl

RUN sed -e 's/time_format_iso_8601: false/time_format_iso_8601: true/' < /falco/etc/falco/falco.yaml > /falco/etc/falco/falco.yaml.new \
&& mv /falco/etc/falco/falco.yaml.new /falco/etc/falco/falco.yaml
Expand Down
2 changes: 1 addition & 1 deletion docker/no-driver/Dockerfile.distroless
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN FALCO_VERSION_URLENCODED=$(echo -n ${FALCO_VERSION}|jq -sRr @uri) && \
tar -xvf falco.tar.gz && \
rm -f falco.tar.gz && \
mv falco-${FALCO_VERSION}-$(uname -m) falco && \
rm -rf /falco/usr/src/falco-* /falco/usr/bin/falco-driver-loader
rm -rf /falco/usr/src/falco-* /falco/usr/bin/falcoctl

RUN sed -e 's/time_format_iso_8601: false/time_format_iso_8601: true/' < /falco/etc/falco/falco.yaml > /falco/etc/falco/falco.yaml.new \
&& mv /falco/etc/falco/falco.yaml.new /falco/etc/falco/falco.yaml
Expand Down
8 changes: 2 additions & 6 deletions scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
configure_file(rpm/postinstall.in rpm/postinstall COPYONLY)
configure_file(rpm/postuninstall.in rpm/postuninstall COPYONLY)
configure_file(rpm/preuninstall.in rpm/preuninstall COPYONLY)

# driver loader
configure_file(falco-driver-loader falco-driver-loader @ONLY)
install(PROGRAMS ${PROJECT_BINARY_DIR}/scripts/falco-driver-loader
DESTINATION ${FALCO_BIN_DIR} COMPONENT "${FALCO_COMPONENT_NAME}")
endif()

# Install Falcoctl config file
if (NOT WIN32 AND NOT APPLE AND NOT EMSCRIPTEN AND NOT MUSL_OPTIMIZED_BUILD)
if(NOT DEFINED FALCOCTL_ETC_DIR)
set(FALCOCTL_ETC_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/falcoctl")
endif()
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/falcoctl/falcoctl.yaml DESTINATION "${FALCOCTL_ETC_DIR}" COMPONENT "${FALCO_COMPONENT_NAME}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/falcoctl/falcoctl.yaml.in ${PROJECT_BINARY_DIR}/scripts/falcoctl/falcoctl.yaml)
install(FILES ${PROJECT_BINARY_DIR}/scripts/falcoctl/falcoctl.yaml DESTINATION "${FALCOCTL_ETC_DIR}" COMPONENT "${FALCO_COMPONENT_NAME}")
endif()
12 changes: 7 additions & 5 deletions scripts/debian/postinst.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,18 @@ set -e
echo "[POST-INSTALL] Trigger deamon-reload:"
systemctl --system daemon-reload || true

# If needed, try to load/compile the driver through falco-driver-loader
# If needed, try to load/compile the driver through falcoctl
echo "[POST-INSTALL] Configure falcoctl driver type:"
falcoctl driver config --type $chosen_driver
case "$chosen_driver" in
"kmod")
# Only compile for kmod, in this way we use dkms
echo "[POST-INSTALL] Call 'falco-driver-loader --compile module':"
falco-driver-loader --compile module
echo "[POST-INSTALL] Call 'falcoctl driver install for kmod:"
falcoctl driver install --download=false
;;
"bpf")
echo "[POST-INSTALL] Call 'falco-driver-loader bpf':"
falco-driver-loader bpf
echo "[POST-INSTALL] Call 'falcoctl driver install for bpf':"
falcoctl driver install
;;
esac

Expand Down
4 changes: 2 additions & 2 deletions scripts/debian/prerm.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case "$1" in
systemctl --system stop 'falco-custom.service' || true
systemctl --system stop 'falcoctl-artifact-follow.service' || true

echo "[PRE-REMOVE] Call 'falco-driver-loader --clean:'"
falco-driver-loader --clean
echo "[PRE-REMOVE] Call 'falcoctl driver cleanup:'"
falcoctl driver cleanup
;;
esac
Loading

0 comments on commit ec4f26b

Please sign in to comment.