Skip to content

Use bosh-agent enable-monit-access#98

Open
mariash wants to merge 5 commits intocloudfoundry:mainfrom
mariash:use-agent-enable-access
Open

Use bosh-agent enable-monit-access#98
mariash wants to merge 5 commits intocloudfoundry:mainfrom
mariash:use-agent-enable-access

Conversation

@mariash
Copy link
Member

@mariash mariash commented Feb 18, 2026

Feature or Bug Description

This PR uses bosh-agent enable-monit-access command that performs the same behavior as bosh-monit-access package

cloudfoundry/bosh-linux-stemcell-builder#474

Motivation

Move bosh-monit-access as a bosh-agent command so that more releases can consumed it. The helper script /var/vcap/bosh/etc/monit-access-helper.sh now will call it as well.

@mariash mariash changed the title Use agent enable access Use bosh-agent enable-monit-access Feb 18, 2026
@mariash mariash force-pushed the use-agent-enable-access branch from 3b7e7c1 to 6e3a80e Compare February 25, 2026 00:36
@mariash mariash marked this pull request as ready for review February 25, 2026 18:36
# New firewall with jobs chain exists - use bosh-monit-access helper
/var/vcap/packages/bosh-monit-access/bin/bosh-monit-access 1>&2
else
if ! /var/vcap/bosh/bin/bosh-agent enable-monit-access; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it cleaner to check if the monit access helper shell script exists?

Don't like that there is not way to distinguish between the access helper failing and the command not being available. Also wondering what an older agent without the command does when invoked this way.

Copy link
Member

@abg abg Feb 25, 2026

Choose a reason for hiding this comment

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

Also wondering what an older agent without the command does when invoked this way.

So when I first saw this PR my thought was "eh, it will just fail and fallback on old stemcells".

But revisiting today, I realize the issue is a little more serious than that.

This galera-agent service script runs under bpm, so it needs access to the command to run or else it will fail with an error. In this case with /var/vcap/bosh/bin/bosh-agent we would see something like this:

.../bin/service: ... /var/vcap/bosh/bin/bosh-agent: No such file or directory

This error occurs becuase the bpm managed mount namespaces do not include /var/vcap/bosh/bin. This is a problem whether it is run directly (in this PR) or if pxc-release consumes this setup via monit-access-helper.sh.

To handle this in pxc-release, we would have to update the bpm.yml config file and add access to the bosh/bin directory. But that is not a backwards compatible change which is the whole point of the bosh-agent enable-monit-access change.

If galera-agent did have access to /var/vcap/bosh/bin today, then on old stemcells without this subcommand, the service script would try to start the bosh-agent (and likely fail - hopefully without a larger blast radius than confusing galera-agent logs).

Perhaps the approach could be rescued if the enable-monit-access binary were located in a "safe" place, like /usr/local or something.

@github-project-automation github-project-automation bot moved this from Inbox to Waiting for Changes | Open for Contribution in Foundational Infrastructure Working Group Feb 25, 2026
Signed-off-by: Maria Shaldybin <maria.shaldybin@broadcom.com>
Co-authored-by: Maria Shaldybin <maria.shaldybin@broadcom.com>
@mariash mariash force-pushed the use-agent-enable-access branch from 6e3a80e to 89db70f Compare February 25, 2026 22:23
/var/vcap/packages/bosh-monit-access/bin/bosh-monit-access 1>&2
else
set +e
/var/vcap/bosh/etc/bosh-enable-monit-access
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this essentially the same as:

if ! /var/vcap/bosh/etc/bosh-enable-monit-access; then
...

Can we rewrite it like something like this to avoid getting "command not found" errors in the logs when running on older stemcells?

if ! [[ -x /var/vcap/bosh/etc/bosh-enable-monit-access ]] || ! /var/vcap/bosh/etc/bosh-enable-monit-access; then
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting for Changes | Open for Contribution

Development

Successfully merging this pull request may close these issues.

4 participants