Skip to content

feat(plugin): add PluginContext.ControlPlaneURL to the plugin SDK for #225 part 1 - #271

Open
colin-riddell wants to merge 1 commit into
datum-cloud:mainfrom
colin-riddell:feat/datumctl-225-part1-plugin-control-plane-url
Open

feat(plugin): add PluginContext.ControlPlaneURL to the plugin SDK for #225 part 1#271
colin-riddell wants to merge 1 commit into
datum-cloud:mainfrom
colin-riddell:feat/datumctl-225-part1-plugin-control-plane-url

Conversation

@colin-riddell

@colin-riddell colin-riddell commented Aug 14, 2026

Copy link
Copy Markdown

Part 1 of #225.

Plugins all rebuild the same control-plane URL from the injected DATUM_ORG / DATUM_PROJECT / DATUM_API_HOST. The host injects the API host without a scheme, and if you forget to add one you apparently hit an HTML endpoint and get a "serializer for text/html" error, which isn't much of a clue.

So PluginContext.ControlPlaneURL() now builds it: project scope if Project is set, org otherwise. Same precedence as auth update-kubeconfig. It errors if the API host is missing, or if neither scope is set, and says which variable to set. plugin.ControlPlaneURL() is a shorthand, like plugin.Token(). Paths match internal/miloapi/urls.go.

The scheme handling is copied from internal/datumconfig rather than importedinternal/ can only be imported inside datumctl.

Part 2 the rest.Config helper will come in a separate PR as it pulls in client-go.

Verification

go test ./plugin/... passes. Table-driven coverage: project-over-org precedence, org-only, a host already carrying https://, http:// preserved for local dev, trailing slash trimmed, and both error paths. One env-based test covers the package-level function.

@cla-assistant

cla-assistant Bot commented Aug 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant