Skip to content

Commit

Permalink
compute: Allow postgres user to power off the VM (#10710)
Browse files Browse the repository at this point in the history
I plan to use this when launching a fast_import job in a VM. There's
currently no good way for an executable running in a NeonVM to exit
gracefully and have the VM shut down. The inittab we use always respawns
the payload command. The idea is that the control plane can use
"fast_import ... && poweroff" as the command, so that when fast_import
completes successfully, the VM is terminated, and the k8s Pod and
VirtualMachine object are marked as completed successfully.

I'm working on bigger changes to how we launch VMs, and will try to come
up with a nicer system for that, but in the meanwhile, this quick hack
allows us to proceed with using VMs for one-off jobs like fast_import.
  • Loading branch information
hlinnaka authored Feb 7, 2025
1 parent 9609f75 commit 0abff59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compute/vm-image-spec-bookworm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ files:
# Allow postgres user (which is what compute_ctl runs as) to run /neonvm/bin/resize-swap
# and /neonvm/bin/set-disk-quota as root without requiring entering a password (NOPASSWD),
# regardless of hostname (ALL)
postgres ALL=(root) NOPASSWD: /neonvm/bin/resize-swap, /neonvm/bin/set-disk-quota
#
# Also allow it to shut down the VM. The fast_import job does that when it's finished.
postgres ALL=(root) NOPASSWD: /neonvm/bin/resize-swap, /neonvm/bin/set-disk-quota, /neonvm/bin/poweroff
- filename: cgconfig.conf
content: |
# Configuration for cgroups in VM compute nodes
Expand Down

1 comment on commit 0abff59

@github-actions
Copy link

Choose a reason for hiding this comment

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

7576 tests run: 7208 passed, 0 failed, 368 skipped (full report)


Flaky tests (1)

Postgres 17

Code coverage* (full report)

  • functions: 33.2% (8583 of 25822 functions)
  • lines: 49.1% (72275 of 147231 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
0abff59 at 2025-02-07T18:37:25.383Z :recycle:

Please sign in to comment.