Skip to content

Keystone: Implement Region controller#862

Open
gndrmnn wants to merge 10 commits into
k-orc:mainfrom
gndrmnn:implement_region
Open

Keystone: Implement Region controller#862
gndrmnn wants to merge 10 commits into
k-orc:mainfrom
gndrmnn:implement_region

Conversation

@gndrmnn

@gndrmnn gndrmnn commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Regions are weird in that they have an id field, which is used as a name (no UUID) but they lack a proper name field.

I took the liberty to do a name -> id mapping in the actuator and status as I think that makes more sense form a k-orc perspective. Though if you want I can rename the field to id just to be consistent with the upstream naming.

gndrmnn added 6 commits July 15, 2026 13:48
$ go run ./cmd/scaffold-controller -interactive=false \
    -kind=Region \
    -gophercloud-client=NewIdentityV3 \
    -gophercloud-module=github.com/gophercloud/gophercloud/v2/openstack/identity/v3/regions \
    -gophercloud-type=Region \
    -openstack-json-object=region

On-behalf-of: SAP nils.gondermann@sap.com
Register with the resource generator

On-behalf-of: SAP nils.gondermann@sap.com
Add the OpenStack client to scope

On-behalf-of: SAP nils.gondermann@sap.com
Register the controller

On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com

@dlaw4608 dlaw4608 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gndrmnn thanks for PR, I did a quick once over, this is what I saw so far 👍

Comment thread internal/controllers/region/actuator.go Outdated
Comment thread internal/controllers/region/actuator.go Outdated
Comment thread internal/controllers/region/actuator.go Outdated
Comment thread internal/controllers/region/actuator.go Outdated
Comment thread internal/controllers/region/actuator.go Outdated
Comment thread internal/controllers/region/actuator.go Outdated
Comment thread internal/controllers/region/actuator.go Outdated
gndrmnn added 4 commits July 23, 2026 16:26
On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
Generate the OLM bundle

On-behalf-of: SAP nils.gondermann@sap.com
On-behalf-of: SAP nils.gondermann@sap.com
@gndrmnn
gndrmnn force-pushed the implement_region branch from 9fdcdd6 to 0c56e56 Compare July 23, 2026 14:26

@winiciusallan winiciusallan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gndrmnn, great work! At a first glance, this looks very good to me. I left a few comments, but I'm still missing a review in the tests. Will do it later.


// RegionResourceSpec contains the desired state of the resource.
type RegionResourceSpec struct {
// name will be the ID of the Region.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add this as a note and keep the doc more descriptive. Something like:

Suggested change
// name will be the ID of the Region.
// name is the name of the Region resource. This field will be passed as the region ID in the Keystone API.


// RegionResourceStatus represents the observed state of the resource.
type RegionResourceStatus struct {
// name is the ID for the resource.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same suggestion as from spec.name

// RegionResourceSpec contains the desired state of the resource.
type RegionResourceSpec struct {
// name will be the ID of the Region.
// +required

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can have this field optional and fallback to the k8s resource name, still using it as the RegionID. Wdyt?

// so we must use client-side filtering.
filters := []osclients.ResourceFilter[osResourceT]{
func(r *regions.Region) bool {
return r.ID == string(orcObject.Spec.Resource.Name)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you already have the resourceSpec stored in a variable. You can use:

Suggested change
return r.ID == string(orcObject.Spec.Resource.Name)
return r.ID == string(resourceSpec.Name)

Comment on lines +97 to +105
// TODO(scaffolding): Add more resource-specific validation tests.
// Some common things to test:
// - Immutability of fields with `self == oldSelf` validation
// - Enum validation (valid and invalid values)
// - Numeric range validation (min/max bounds)
// - Tag uniqueness (if the resource has tags with listType=set)
// - Format validation (CIDR, UUID, etc.)
// - Cross-field validation rules
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, take a look at these. The code comment is very good wrt what you could implement here.

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

Labels

semver:major Breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants