Skip to content

Import ID in Domain doesn't allow non-UUID string #869

Description

@chenwng

Problem description

The default domain Default has an ID default, but the ID field in DomainImport only allows format uuid

type DomainImport struct {
// id contains the unique identifier of an existing OpenStack resource. Note
// that when specifying an import by ID, the resource MUST already exist.
// The ORC object will enter an error state if the resource does not exist.
// +kubebuilder:validation:Format:=uuid
// +kubebuilder:validation:MaxLength:=36
// +optional
ID *string `json:"id,omitempty"` //nolint:kubeapilinter
// filter contains a resource query which is expected to return a single
// result. The controller will continue to retry if filter returns no
// results. If filter returns multiple results the controller will set an
// error state and will not continue to retry.
// +optional
Filter *DomainFilter `json:"filter,omitempty"`
}

$openstack domain list 
+---------+---------+---------+--------------------+
| ID      | Name    | Enabled | Description        |
+---------+---------+---------+--------------------+
| default | Default | True    | The default domain |
+---------+---------+---------+--------------------+

Creating an imported Domain with import.id = default will cause a validation error.

---
apiVersion: openstack.k-orc.cloud/v1alpha1
kind: Domain
metadata:
  name: default
spec:
  cloudCredentialsRef:
    cloudName: openstack-admin
    secretName: openstack-clouds
  managementPolicy: unmanaged
  import:
    id: default
The Domain "default" is invalid: 
* spec.import.id: Invalid value: "default": spec.import.id in body must be of type uuid: "default"
* <nil>: Invalid value: null: some validation rules were not checked because the object was invalid; correct the existing errors to complete validation

ORC version

main

Additional information

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions