feat(vm): add install_guest_agent to inject qemu-guest-agent via cloud-init#174
Open
jniedergang wants to merge 1 commit intoharvester:masterfrom
Open
feat(vm): add install_guest_agent to inject qemu-guest-agent via cloud-init#174jniedergang wants to merge 1 commit intoharvester:masterfrom
jniedergang wants to merge 1 commit intoharvester:masterfrom
Conversation
…d-init Add `install_guest_agent` boolean field that injects the qemu-guest-agent package and service enablement into cloud-init user_data. The snippet is only injected when user_data_base64 and user_data_secret_name are not set, and when qemu-guest-agent is not already present in user_data. - Add `install_guest_agent` schema field (bool, default false) - Inject cloud-init snippet: package_update, packages, runcmd - Import by detecting qemu-guest-agent in cloud-init volumes - Unit tests for all detection cases (present, absent, base64) Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
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.
Related Issue
harvester/harvester#10141
Description
Add
install_guest_agentboolean field to theharvester_virtualmachineresource that injects the qemu-guest-agent package and service enablement into cloud-inituser_data, matching the Harvester UI "Install Guest Agent" checkbox behavior.Changes
install_guest_agentschema field (bool, defaultfalse)InstallGuestAgentfield to Constructor, processed before CloudInitpackage_update,packages,runcmd) intouser_datawhen:install_guest_agent = trueuser_data_base64anduser_data_secret_nameare not setqemu-guest-agentis not already present inuser_dataqemu-guest-agentin cloud-init volume UserDatamake generateExample
The guest agent snippet is appended to the existing
user_data.Test plan
go test ./pkg/importer/ -run TestInstallGuestAgent— passgo build ./...— compilation passesgofmt -l .— no formatting issuesgo generate ./...— docs generatedinstall_guest_agent = true— verified cloud-init user_data containsqemu-guest-agentpackage andsystemctl enable --now qemu-guest-agentruncmdterraform planshows 0 changesinstall_guest_agent = false— cloud-init snippet removedterraform destroy— VM cleaned up