kubernetes/kops · error

error building nova client: %v

Error message

error building nova client: %v

What it means

New() builds a Nova (compute v2) service client via openstack.NewComputeV2 using the authenticated provider and region. This error wraps any failure creating that client, typically endpoint/catalog or region mismatch issues.

Source

Thrown at pkg/nodeidentity/openstack/identify.go:84

	ua := gophercloud.UserAgent{}
	ua.Prepend("kops/nodeidentity")
	provider.UserAgent = ua
	klog.V(4).Infof("Using user-agent %s", ua.Join())

	// node-controller should be able to renew it tokens against OpenStack API
	env.AllowReauth = true

	err = openstack.Authenticate(context.TODO(), provider, env)
	if err != nil {
		return nil, err
	}

	novaClient, err := openstack.NewComputeV2(provider, gophercloud.EndpointOpts{
		Type:   "compute",
		Region: region,
	})
	if err != nil {
		return nil, fmt.Errorf("error building nova client: %v", err)
	}

	return &nodeIdentifier{
		novaClient:   novaClient,
		cache:        expirationcache.NewTTLStore(stringKeyFunc, cacheTTL),
		cacheEnabled: cacheNodeidentityInfo,
	}, nil
}

// IdentifyNode queries OpenStack for the node identity information
func (i *nodeIdentifier) IdentifyNode(ctx context.Context, node *corev1.Node) (*nodeidentity.Info, error) {
	providerID := node.Spec.ProviderID
	if providerID == "" {
		return nil, fmt.Errorf("providerID was not set for node %s", node.Name)
	}
	if !strings.HasPrefix(providerID, "openstack://") {
		return nil, fmt.Errorf("providerID %q not recognized for node %s", providerID, node.Name)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify 'openstack catalog list' shows a compute service with an endpoint for the configured region
  2. Correct OS_REGION_NAME to a region that exists in the Keystone catalog
  3. Check the endpoint type is available (public/internal/admin) and adjust network access or EndpointOpts accordingly
  4. Confirm authentication succeeds (try 'openstack server list' with the same credentials)

Example fix

// before
export OS_REGION_NAME="WrongRegion"
// after
export OS_REGION_NAME="RegionOne" # matches keystone catalog
Defensive patterns

Strategy: try-catch

Validate before calling

// Preflight: confirm a compute endpoint exists for the region before building the identifier.
out, err := exec.Command("openstack", "catalog", "list").Output() // or use tokens/client
// ensure output contains service type 'compute' for OS_REGION_NAME

Try / catch

id, err := openstack.New()
if err != nil && strings.Contains(err.Error(), "error building nova client") {
    return fmt.Errorf("cannot build nova client; check keystone catalog/region/endpoint: %w", err)
}

Prevention

When it happens

Trigger: openstack.NewComputeV2 returns an error: no 'compute' service in the auth catalog, no endpoint for the given region, wrong endpoint type ('compute' public/admin/internal mismatch), or the region name does not match any catalog entry.

Common situations: OS_REGION_NAME set to a region not present in the service catalog, Keystone catalog lacking compute endpoints, service type renamed (e.g. custom compute service types), or connectivity/auth problems surfacing as endpoint lookup failures.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/22730fa3095bb9c8. Report an issue: GitHub.