fix: repair oci-vm template home volume mount, region default, and ssh debug access - #1058
Draft
bpmct wants to merge 1 commit into
Draft
fix: repair oci-vm template home volume mount, region default, and ssh debug access#1058bpmct wants to merge 1 commit into
bpmct wants to merge 1 commit into
Conversation
…h debug access Builds on #525 (registry/anis/templates/oci-vm by @aniskhalfallah).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
While testing @aniskhalfallah's OCI VM template (#525) end-to-end against a real OCI tenancy, I found a few things that don't actually work once you get past the reviews:
disk_setup/mountsrun early in cloud-init's boot sequence, before the OCI volume attachment (a separate, async API call) has actually shown up as a device. Confirmed via the instance's serial console:Device /dev/sdb did not exist and was not created with a udevadm settle./home/<user>silently ends up on the ephemeral root disk instead, so it's wiped on every stop despite the template (and README) claiming it persists.regiondefaults toeu-marseille-1, which most tenancies aren't subscribed to (including a fresh trial account, per the review thread, and my own tenancy's home region). Since the AD/image data sources aren't gated bystart_count, this makescoder templates pushitself fail with an auth-looking 401 before anyone even gets to create a workspace.ssh_public_keyis documented ("SSH public key for debugging access") but never wired into cloud-init, so there's no way to get into a workspace to debug it.This PR builds on #525's
main.tf/README/cloud-init with:runcmdscript that waits for the volume device to show up, formats it only if it isn't already formatted (matched by filesystem label, so repeated stop/start cycles don't wipe it), and mounts it via/etc/fstab. Also fixes a subtler bug this introduced: ext4 labels are capped at 16 bytes, but the existinghome_volume_labellocal is (correctly, for OCI's own 32-char display name limit) longer than that, somkfswas silently truncating it and later lookups by the untruncated label never matched. Added a dedicated 16-bytehome_fs_label.regionnow defaults tous-ashburn-1instead ofeu-marseille-1. Still not universal (no single default can be, since OCI only auto-subscribes your home region), but it's one of OCI's two original commercial regions and a much more common default than a specialty region — documented the caveat clearly either way.ssh_public_keynow actually lands in~/.ssh/authorized_keys. Had to provision it from inside the mount script rather than through cloud-init's normalssh_authorized_keys, since that runs before the home volume mount and would otherwise get shadowed by it.Tested all of the above against a real OCI tenancy (instance + volume + attachment, connected agent,
df/lsblkshowing/homeon the block volume,ssh <user>@<ip>working with the debug key).Opening as a draft since this is meant as a starting point — happy to fold it into #525 directly, split it up, or adjust approach based on what @aniskhalfallah and @DevelopmentCats prefer.
Type of Change
Template Information
Path:
registry/anis/templates/oci-vmTesting & Validation
bun test)bun fmt)Related Issues
Related to #525