Skip to content

feat(resmgr): cluster-blueprint family — REST client + host_config/host_role/host_config_assignment + blueprint DS - #29

Merged
PF9-pushkar merged 1 commit into
mainfrom
feat/cluster-blueprint
Jul 14, 2026
Merged

feat(resmgr): cluster-blueprint family — REST client + host_config/host_role/host_config_assignment + blueprint DS#29
PF9-pushkar merged 1 commit into
mainfrom
feat/cluster-blueprint

Conversation

@PF9-pushkar

Copy link
Copy Markdown
Collaborator

Adds the first PCD-native (non-OpenStack) service to the provider, closing the cluster-blueprint gap from the api-docs audit.

New client pattern

resmgr has no gophercloud support, so clients.Config.ResmgrV2Client() is a hand-written REST client: it resolves the resmgr catalog endpoint via the ProviderClient's EndpointLocator and reuses the shared authenticated ProviderClient for tokens. Verified live against the CE lab.

Resources + data source

Type API
pcd_host_config CRUD /hostconfigs — traffic-type↔interface mapping + physical-network labels
pcd_host_role PUT/DELETE /hosts/{id}/roles/{name} — assign a role (e.g. pf9-ostackhost-neutron); Read checks the host's roles
pcd_host_config_assignment PUT/DELETE /hosts/{id}/hostconfig/{id}; Read checks host.hostconfig_id
pcd_cluster_blueprint (data source) read a blueprint by name; storage_backends_json exposed as a sensitive JSON string (driver credentials)

Schema modelled on the live lab responses (probed read-only), which are richer than the api-docs.

Adversarial review — 2 fixed

Both the same class as the block-storage family (fragile post-write read-back), confirmed against framework source:

  1. host_config Create could orphan the created object on a read-back failure → now seeds state from the POST response and warns.
  2. host_config Update could leave stale state on a read-back failure → now persists the applied plan and warns.

Deliberately deferred: the pcd_cluster_blueprint resource

Its write path is uniquely risky — full-object PUT, storageBackends with plaintext credentials, and create semantics I can't safely verify without mutating the lab's one working blueprint. Own follow-up (see DECISIONS.md).

Testing

build / vet / gofmt / golangci-lint (0) / unit tests / terraform fmt / docs generate — all clean. Mutating acc tests are opt-in (PCD_ACC_RESMGR); the blueprint DS test reads an existing blueprint (PCD_ACC_BLUEPRINT_NAME).

…sources

Add the first PCD-native (non-OpenStack) service to the provider.

- internal/clients: ResmgrV2Client() — a thin resmgr v2 REST client. resmgr has
  no gophercloud constructor, so it resolves the "resmgr" catalog endpoint via
  the ProviderClient's EndpointLocator and reuses the shared authenticated
  ProviderClient for tokens (verified live against the CE lab).
- internal/services/resmgr:
  - pcd_host_config: interface↔traffic-type mapping + physical-network labels
    (CRUD via /hostconfigs).
  - pcd_host_role: assign a role (e.g. pf9-ostackhost-neutron) to a host
    (PUT/DELETE /hosts/{id}/roles/{name}; Read checks the host's roles list).
  - pcd_host_config_assignment: attach a host config to a host
    (PUT/DELETE /hosts/{id}/hostconfig/{id}; Read checks host.hostconfig_id).
  - pcd_cluster_blueprint data source: read a blueprint by name (storage_backends
    exposed as a sensitive JSON string since it carries driver credentials).
- templates: "cluster"/"host" → "Cluster Blueprint" doc subcategory.

Adversarial review found and fixed two host_config read-back defects (same class
as the blockstorage family): Create could orphan a created config and Update
could leave stale state when the post-write GET failed. Both now seed state from
the response already in hand (Create) / the applied plan (Update) and warn,
instead of hard-returning.

The pcd_cluster_blueprint RESOURCE (write path) is deferred to a focused
follow-up — full-object PUT, plaintext-credential storageBackends, and create
semantics that can't be safely verified without mutating the lab's blueprint.
See DECISIONS.md. Mutating resmgr acc tests are opt-in (PCD_ACC_RESMGR).
@PF9-pushkar
PF9-pushkar force-pushed the feat/cluster-blueprint branch from c2e2ebd to 3ba4c95 Compare July 14, 2026 00:35
@PF9-pushkar
PF9-pushkar merged commit 384955c into main Jul 14, 2026
5 checks passed
@PF9-pushkar
PF9-pushkar deleted the feat/cluster-blueprint branch July 14, 2026 00:37
PF9-pushkar added a commit that referenced this pull request Jul 14, 2026
feat(resmgr): cluster-blueprint family — REST client + host_config/host_role/host_config_assignment + blueprint DS
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