Skip to content

Support openstacksdk-style service default microversions from clouds.yaml #287

Description

@Sharpz7

Context

Consumers that use clouds.yaml may want per-cloud service microversion defaults using the openstacksdk convention:

clouds:
  cloud_a:
    auth: ...
    compute_default_microversion: "2.87"
  cloud_b:
    auth: ...
    compute_default_microversion: "2.79"

This is useful for long-running multi-cloud processes where environment variables such as OS_COMPUTE_API_VERSION are too coarse because they apply process-wide rather than per selected cloud.

One downstream example is openstack-exporter, which can scrape multiple clouds from one clouds.yaml and currently has to manage Nova microversions outside of clouds.yaml: openstack-exporter/openstack-exporter#500

Current behavior

clientconfig.Cloud exposes typed API-version override fields such as identity_api_version and volume_api_version, but does not expose compute_default_microversion or a generic {service_type}_default_microversion mechanism. LoadCloudsYAML() unmarshals into map[string]Cloud, so callers cannot recover these keys through the public Cloud type after parsing.

Proposal

Add support for openstacksdk-style service default microversions in clientconfig, preferably in a way that can support more than Nova over time.

Possible API shapes:

  • a generic map on Cloud, e.g. DefaultMicroversions map[string]string, populated from keys matching {service_type}_default_microversion;
  • typed fields for known OpenStack services, starting with ComputeDefaultMicroversion;
  • helper methods such as cloud.DefaultMicroversion("compute") so downstream consumers do not need to duplicate key normalization rules.

Open questions:

  • Should this live only in github.com/gophercloud/utils/v2/openstack/clientconfig, or should github.com/gophercloud/gophercloud/v2/openstack/config/clouds grow equivalent support too?
  • Should service names follow catalog service types exactly, such as compute, block-storage, and shared-file-system, or openstacksdk config aliases?
  • Should env var precedence remain the caller's responsibility, or should clientconfig.NewServiceClient apply a parsed default microversion automatically where possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions