feat: add cloud-init user data support via Linode Metadata#222
feat: add cloud-init user data support via Linode Metadata#222lots0logs wants to merge 2 commits intolinode:mainfrom
Conversation
* feat: support metadata user data Co-authored-by: lots0logs <4675662+lots0logs@users.noreply.github.com> * fix: address cloud-init review comments Agent-Logs-Url: https://github.com/lots0logs/docker-machine-driver-linode/sessions/7c66e84c-87fb-4861-ab2d-8874c175f8f5 Co-authored-by: lots0logs <4675662+lots0logs@users.noreply.github.com> --------- Co-authored-by: openai-code-agent[bot] <242516109+Codex@users.noreply.github.com> Co-authored-by: lots0logs <4675662+lots0logs@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds support for supplying cloud-init user data when creating Linode instances with this docker-machine driver, passing it through Linode’s Metadata service.
Changes:
- Introduces
--linode-user-data/LINODE_USER_DATAwith inline and@fileforms, encoding content as base64. - Sends the encoded user data via
InstanceCreateOptions.Metadataduring instance creation. - Adds unit tests covering inline, file-backed, and error cases, plus README option documentation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Documents the new linode-user-data option and its behavior. |
| pkg/drivers/linode/linode.go | Adds driver field/flag parsing, base64 encoding helper, and passes user-data via instance metadata on create. |
| pkg/drivers/linode/linode_test.go | Adds tests for inline and file-based user-data handling and error paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a9e2731 to
14fedda
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| userData := flags.String("linode-user-data") | ||
| if userData != "" { | ||
| encodedUserData, err := encodeUserData(userData) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| d.UserData = encodedUserData | ||
| } |
There was a problem hiding this comment.
SetConfigFromFlags reads/validates --linode-user-data (including reading the file) before checking required options like --linode-token. This makes error precedence inconsistent with other validations in this method (e.g., StackScript parsing happens after the token check) and can surface a user-data file error even when required auth is missing. Consider moving the user-data validation block to after the d.APIToken == "" check so required-flag errors are reported first and validation order stays consistent.
Summary
--linode-user-data/LINODE_USER_DATAsupport for cloud-init user data via Linode instance metadata--linode-user-datato be a plain file pathNotes
file-to-field-aliasesannotationuserData:userData@filesyntax are intentionally removed here because Rancher intercepts userdata flags before the Linode driver sees themFixes #221