Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions internal/collector/vector/run-vector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,5 @@ VECTOR_DATA_DIR=%s
echo "Creating the directory used for persisting Vector state $VECTOR_DATA_DIR"
mkdir -p ${VECTOR_DATA_DIR}
Copy link
Contributor

Choose a reason for hiding this comment

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

If I have seen this correctly, then the data directory is the base of a VolumeMount in the current configuration, meaning that it will always exist. If that is actually the case, I think it would be safe to completely remove the startup script and directly use vector as the entrypoint for the container.

Copy link
Contributor

Choose a reason for hiding this comment

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

The operator passes in the datadir and there actually is a conditional of the value based upon the "legacy" naming convention and other. This behavior persists to support 'upgrade' behavior.

Copy link
Contributor

@xperimental xperimental Dec 19, 2024

Choose a reason for hiding this comment

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

As far as I can see the path can either be /var/lib/vector or /var/lib/vector/<namespace>/<instance>, but in both cases the path is directly used as the VolumeMount (code). I don't think the mkdir and thus the script is needed.
(But it's not directly related to this change, so consider my remarks optional)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm inclined to leave this as is and we can revisit the start up script in another scope (JIRA)


echo "Checking for buffer lock files"
# Vector does not appear to release locks when the process terminates. Try to clean up for restart
pushd ${VECTOR_DATA_DIR}
locks=$(ls -R . | awk '/:$/&&f{s=$0;f=0}
/:$/&&!f{sub(/:$/,"");s=$0;f=1;next}
NF&&f{ print s"/"$0 }' | grep \.lock)
rc=$?
if [ $rc -gt 1 ] ; then
echo "Error checking for buffer lock files returncode=$rc: '${locks}'"
exit $rc
fi
sleep 10s #try to allow other owners to finish or cleanup
echo "found lock files: '$locks'"
for lock in ${locks}; do
echo "removing file: '${lock}'"
rm $lock
done
popd

echo "Starting Vector process..."
exec /usr/bin/vector --config-toml /etc/vector/vector.toml