Skip to content

feat: [CO-4843] let service-discover handle the setup scripts on SPIRE nodes - #50

Draft
M0Rf30 wants to merge 1 commit into
mainfrom
CO-4843-spire-pending-setup
Draft

M0Rf30 wants to merge 1 commit into
mainfrom
CO-4843-spire-pending-setup

Conversation

@M0Rf30

@M0Rf30 M0Rf30 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Jira: CO-4843 / CO-4837. Companion of zextras/service-discover#190.

Problem

On SPIRE agents (joined without the cluster credentials) there is no bootstrap token: pending-setups called service-discover bootstrap-token --setup upfront and exited on failure, and the package scripts use the root token to create policies and tokens.

Choice

Packages and their scripts are unchanged. service-discover now registers the services centrally, so the fix is in this wrapper and decided by service-discover:

  • before running a script, service-discover service pending-setup <script>: exit 0 = handled (the script is moved to done/ without running), exit 10 = run the script as before, other = failure (the script is kept);
  • the token is asked lazily, only when a script that runs needs it (SPIRE agents never ask for it: every script that belongs to a Carbonio service is handled by service-discover; the ones that still run, like the prometheus exporters' set-*, need no cluster credentials);
  • if the command does not exist (older service-discover, probed with --help) or the node doesn't use SPIRE, the behaviour is the old one.

This was preferred over detecting SPIRE here (duplicates service-discover's knowledge of which scripts it replaces) or over making bootstrap-token succeed on agents (would leak the problem into the scripts).

Checks

shellcheck package/pending-setups.sh clean. Exercised execute_script with a stubbed service-discover: handled (0, not run, moved), run (10, ran with token, moved), failure (3, kept), old binary without the command (ran with token, moved). Not run on a real node. Side effect: the credentials prompt now appears when the first script that needs it runs, not before the menu.

…E nodes

- Ask service-discover service pending-setup about every script before running it: when service-discover registers the service itself (SPIRE nodes) the script is not run; exit status 10, or a service-discover without the command, runs the script as before.
- Ask for the cluster credentials only when a script that runs needs them, since SPIRE agents have none.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant