Skip to content

Implemented logic for optional postStart script#1439

Open
groundhog2k wants to merge 2 commits intomasterfrom
issue-1400
Open

Implemented logic for optional postStart script#1439
groundhog2k wants to merge 2 commits intomasterfrom
issue-1400

Conversation

@groundhog2k
Copy link
Copy Markdown
Owner

@groundhog2k groundhog2k commented Oct 13, 2025

Closes #1400

@groundhog2k groundhog2k self-assigned this Oct 13, 2025
@groundhog2k groundhog2k added the feature New feature or request label Oct 13, 2025
@groundhog2k groundhog2k changed the title Implemented logic for optional postStart script Closes #1400 Implemented logic for optional postStart script Oct 13, 2025
@groundhog2k groundhog2k changed the title Closes #1400 Implemented logic for optional postStart script Implemented logic for optional postStart script Oct 13, 2025
Copy link
Copy Markdown
Collaborator

@DiamondJoseph DiamondJoseph left a comment

Choose a reason for hiding this comment

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

The Secret change is the only one I am blocking on, as we are potentially allowing exposing credentials we should do it in a safer way.

if [ -f /extrascripts/poststart.sh ]; then
/extrascripts/poststart.sh &
else
echo "PostStart: /extrascripts/poststart.sh not found!" >/proc/1/fd/1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we exit with a non-zero code here? We're configured to use a post-start script, which may include authentication/authorization configuration but it is not present, rather than starting insecurely.

Copy link
Copy Markdown
Owner Author

@groundhog2k groundhog2k Oct 16, 2025

Choose a reason for hiding this comment

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

I think for single instance mode that would be no problem, but in case of a real HA cluster it could potentially harm/disturb the cluster because of rebalance or forced reboot, if these options were enabled. My personal focus lays on the HA cluster. So every change I do must be stable for the cluster mode, not only for single instance developer mode. I'm not 100% sure if this is a good idea.
If the code inside the script fails it will be ignored anyway, because it is running in background.
I would like to think another minute about it - the whole feature is experimental. :-)

Comment on lines +461 to +463
## A name of a K8s configMap containing a script file named `poststart.sh` that will be executed in background at the end of the postStart phase
postStartScriptConfig:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we make this a configMap OR secret? Means we can have authentication information mounted slightly more securely.

e.g.

postStartScript:
  configMap:
    name: RMQPostStart
    key: poststart.sh
# or
  secret:
    name: RMQUserImport
    key: poststart.sh
# or maybe even
  script: >
    sleep 30
    rabbitmqctl add_user test test
    rabbitmqctl set_permissions test ".*" ".*" ".*"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I would prefer a solution that clearly separates code from sensitive data (logins etc.). The configMap can take the script code logic and extraSecrets: mounted into the container can transport the sensitive data. The script will take the data from mounted secret to process it. A clear separation of concerns.
But I will take the suggested solution of configMap vs. inline script.

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

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RabbitMQ] Allow adding custom startup scripts

2 participants