Skip to content

Keystone: User Controller#657

Open
dlaw4608 wants to merge 2 commits intok-orc:mainfrom
dlaw4608:keystone_user
Open

Keystone: User Controller#657
dlaw4608 wants to merge 2 commits intok-orc:mainfrom
dlaw4608:keystone_user

Conversation

@dlaw4608
Copy link
Contributor

Fixes #583
Add Support for the Identity service's User resource in ORC

@github-actions github-actions bot added the semver:major Breaking change label Jan 28, 2026
@dlaw4608 dlaw4608 force-pushed the keystone_user branch 2 times, most recently from 23295c5 to dcfe645 Compare January 29, 2026 19:28
@dlaw4608 dlaw4608 marked this pull request as ready for review January 29, 2026 19:32
Copy link
Contributor

@winiciusallan winiciusallan left a comment

Choose a reason for hiding this comment

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

Hi, @dlaw4608, that was a great job!

Left a few comments about using a Project object instead of the ID directly, LMK what you think.

// +kubebuilder:validation:MinLength:=1
// +kubebuilder:validation:MaxLength:=255
// +optional
DefaultProjectID *string `json:"defaultProjectID,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it better to use a ProjectRef here so we can better control the resource?

Suggested change
DefaultProjectID *string `json:"defaultProjectID,omitempty"`
DefaultProjectID *ProjectRef `json:"defaultProjectID,omitempty"`

Copy link
Collaborator

Choose a reason for hiding this comment

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

It should indeed be a reference, but would rather be in the form:

Suggested change
DefaultProjectID *string `json:"defaultProjectID,omitempty"`
DefaultProjectRef *KubernetesNameRef `json:"defaultProjectRef,omitempty"`

See https://k-orc.cloud/development/architecture/#api-design-philosophy.

I'd like to add a lint rule to flag these.

Also, since this is an optional dependency for your controller, you should have run the scaffolding tool with -optional-create-dependency Project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, went back and recreated the user controller this time with Project included as an optional dependency
go run ./cmd/scaffold-controller -interactive=false \ -kind User \ -gophercloud-client NewIdentityV3 \ -gophercloud-module github.com/gophercloud/gophercloud/v2/openstack/identity/v3/users \ -import-dependency Domain \ -optional-create-dependency Domain \ -optional-create-dependency Project

Changed ProjectRef to DefaultProjectRef to match the OpenStack field naming. The spec only references other ORC objects (like Project) by K8s name, never OpenStack UUIDs. The controller resolves the reference to get the Project's UUID and waits for the Project to be Available before creating the User with its DefaultProjectID.

}
}

func handleDefaultProjectIDUpdate(updateOpts *users.UpdateOpts, resource *resourceSpecT, osResource *osResourceT) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly change this to use a reference instead of an ID as suggested above.

Comment on lines 29 to 33





Copy link
Contributor

Choose a reason for hiding this comment

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

Blank lines at the end. I would remove them to make it cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack, done

Comment on lines +7 to +8
resource:
name: user-create-minimal
Copy link
Contributor

Choose a reason for hiding this comment

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

I would also add enabled: true here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the review @winiciusallan, changes made

// +kubebuilder:validation:MinLength:=1
// +kubebuilder:validation:MaxLength:=255
// +optional
DefaultProjectID *string `json:"defaultProjectID,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should indeed be a reference, but would rather be in the form:

Suggested change
DefaultProjectID *string `json:"defaultProjectID,omitempty"`
DefaultProjectRef *KubernetesNameRef `json:"defaultProjectRef,omitempty"`

See https://k-orc.cloud/development/architecture/#api-design-philosophy.

I'd like to add a lint rule to flag these.

Also, since this is an optional dependency for your controller, you should have run the scaffolding tool with -optional-create-dependency Project.

// +kubebuilder:validation:MinLength:=1
// +kubebuilder:validation:MaxLength:=255
// +optional
Password *string `json:"password,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

This must be stored in a secret. See how we do it for user data in the server controller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Followed the same structure as user data in the server controller, the user_types api uses a SecretRef field to reference a secret containing the password of a user in a secret, thanks for the help!!

go run ./cmd/scaffold-controller
 -interactive=false \
 -kind User \
 -gophercloud-client NewIdentityV3 \
 -gophercloud-module github.com/gophercloud/gophercloud/v2/openstack/identity/v3/users \
 -import-dependency Domain \
 -optional-create-dependency Domain \
 -optional-create-dependency Project

Signed-off-by: Daniel Lawton <dlawton@redhat.com>
@dlaw4608 dlaw4608 force-pushed the keystone_user branch 3 times, most recently from 9e7925e to c2ebe4c Compare February 11, 2026 10:10
- E2E tests included
- API configured
- Controller
Signed-off-by: Daniel Lawton <dlawton@redhat.com>
Copy link
Collaborator

@mandre mandre left a comment

Choose a reason for hiding this comment

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

Could you also add the User resource to the README ?

projectRef: user-create-full
# TODO(scaffolding): Add all fields the resource supports
defaultProjectRef: user-create-full
enabled: true No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also try to set a password?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this test placed in the volume controller? This should be removed (I assume this is a result of local tests?).

// Until you have implemented mutability for the field, you must add a CEL validation
// preventing the field being modified:
// `// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="<fieldname> is immutable"`
SecretRef *KubernetesNameRef `json:"secretRef,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add a dependency on this ref in the controller.
Also, we don't use the password at all in the controller. If it's not going to be implemented in this PR, I suggest to drop it from the PR and handle password management (create/update) it in a subsequent PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: small typo in the file name.

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.

Keystone User Controller

3 participants