Repository navigation
feat: add onctl import and a static provider for unmanaged hosts - #936
Merged
Merged
Conversation
…single onctl.yaml - Bind generic --type/--location/--username create flags + new --project to the corresponding gcp.* viper keys (matching hetzner/aws treatment). - Add GCloudDefaultProject() helper (best-effort gcloud fallback). - resolveGCPProject() after ReadConfig to replace the <project-id> placeholder from gcloud when available (keeps onctl.yaml usable without manual edit). - Extend flag existence/bind tests and add TestResolveGCPProject. - No change to single onctl.yaml requirement or loading; CLI flags now correctly override gcp settings the same as for other providers. Ports the useful parts of feat/gcp-zero-yaml-flags onto post-single-yaml main.
… gcp) Brings --type, --project etc. bindings and gcloud fallback for gcp, consistent with aws/hetzner. See feat/gcp-integration for details.
…--resource-group for azure - Register --subscription-id/--resource-group as root persistent flags (needed for resolve on ls/destroy/ssh etc) + locally on create for help/bind. - Bind generic + azure.* keys. - Add AzureCLISubscriptionID / AzureCLIDefaultResourceGroup + runAzCLI helpers (with fix for query). - resolveAzureIdentifiers() after load to replace placeholders from az CLI. - Extend tests (flags exist, bind cases, resolve test). - Consistent with gcp and the earlier aws/hetzner work on top of single onctl.yaml. Adapts feat/azure-zero-yaml-flags + follow-up fix.
Completes wiring for azure (subscription, resource group, type etc) so it matches other providers under the single onctl.yaml setup.
# Conflicts: # cmd/create.go # cmd/flags_defaults_test.go # cmd/root.go
Lets onctl manage servers it didn't create (e.g. Hetzner auction/dedicated boxes, which live on the Robot API and can never show up via the Cloud API provider) by registering name/IP/user/key into a local imported.yaml. The new `static` pseudo-provider serves ssh/ls/destroy from that file; destroy only forgets the host locally since onctl has no lifecycle API for it.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: deac239272
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #936 +/- ##
==========================================
+ Coverage 22.69% 24.03% +1.33%
==========================================
Files 42 44 +2
Lines 4247 4402 +155
==========================================
+ Hits 964 1058 +94
- Misses 3161 3213 +52
- Partials 122 131 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- cmd/ssh.go: a plain `onctl --provider static ssh NAME` no longer requires a global ssh.privateKey default or forces port 22 — it now lets static.SSHInto fall back to the per-host key/port saved by `onctl import` unless --key/--port were explicitly passed. - pkg/cloud/static.go: serialize Destroy's load-modify-save of imported.yaml so `destroy all`'s one-goroutine-per-VM fan-out can't race and clobber concurrent writes. Addresses Codex review comments on PR #936.
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.
Summary
onctl import NAME --ip IP [--user USER] [--port PORT] [--key PATH], which registers an existing server onctl didn't create into a localimported.yamlinventory.staticpseudo cloud provider (pkg/cloud/static.go) that servesls/ssh/destroyfrom that inventory instead of a cloud API.destroyonly removes the local record — it never touches the real machine, since onctl has no lifecycle API for it.hetznerprovider no matter what labels are set. This also covers any other unmanaged/bare-metal host.Usage:
Test plan
go build ./...,go vet ./...,go test ./...all passpkg/cloud/static_test.go(load/save round-trip, GetByName not-found, destroy removes only the named entry, unsupported ops error) andcmd/import_test.go(flag registration, import writes/updates inventory)import→--provider static lsshows the host →--provider static ssh ... -- echoactually connects and runs a command →destroyremoves it fromlswhile the real machine stays reachable directly