-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PlacementAPISpecCore struct #169
Add PlacementAPISpecCore struct #169
Conversation
This version of the struct (called "core") is meant to be used via the OpenStackControlplane. It is the same as PlacementAPISpec only it is missing the containerImages. The Default() function for webhooks has been split accordingly. Jira: OSPRH-4835
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with this patch, but I will wait for @gibizer review
@@ -121,18 +126,27 @@ func (r *PlacementAPI) ValidateDelete() (admission.Warnings, error) { | |||
} | |||
|
|||
func (r PlacementAPISpec) ValidateCreate(basePath *field.Path) field.ErrorList { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to myself: This is called by the webhook within the placement-operator via func (r *PlacementAPI) ValidateCreate()
return ValidateDefaultConfigOverwrite(basePath, r.DefaultConfigOverwrite) | ||
} | ||
|
||
func (r PlacementAPISpecCore) ValidateCreate(basePath *field.Path) field.ErrorList { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to myself: this will be called by the webhook in openstack-operator when validating the service core struct within the openstackcontrolplane struct.
func (r PlacementAPISpec) ValidateDefaultConfigOverwrite( | ||
func ValidateDefaultConfigOverwrite( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative would be to change this to use the PlacementAPISpecCore as a receiver. Then
func (r PlacementAPISpecCore) ValidateCreate
can call it directly as the type matchesfunc (r PlacementAPISpec) ValidateCreate
can call it on its internal core struct within its receiver. Golang actually expose the functions on the embedded struct on the embedding struct automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would reduce the change to gibizer@91e9a07
While this is not a big deal here in placement, I think if we apply this pattern to the nova PR that would reduce the change there significantly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applying it to nova is not a clear cut due to deeper nesting of structs without a common embedded base struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK. I will consider refactoring this to the mentioned pattern later.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprince, gibizer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
0bd583d
into
openstack-k8s-operators:main
This version of the struct (called "core") is meant to be used via the OpenStackControlplane. It is the same as PlacementAPISpec only it is missing the containerImages.
The Default() function for webhooks has been split accordingly.
Jira: OSPRH-4835