Add flavor extra_specs#817
Conversation
Signed-off-by: Roman Hros <roman.hros@dnation.cloud>
d67e89a to
8de585f
Compare
eshulman2
left a comment
There was a problem hiding this comment.
Thanks for the PR, generally LGTM except for the missing interface aliases.
| return deletes | ||
| } | ||
|
|
||
| func (actuator flavorActuator) GetResourceReconcilers(ctx context.Context, orcObject orcObjectPT, osResource *osResourceT, controller generic.ResourceController) ([]resourceReconciler, progress.ReconcileStatus) { |
There was a problem hiding this comment.
flavorActuator now implements ReconcileResourceActuator via GetResourceReconcilers, but the type alias and compile-time assertion are missing. Compare securitygroup/actuator.go which has:
reconcileResourceActuator = interfaces.ReconcileResourceActuator[orcObjectPT, orcObjectT, osResourceT]
// ...
var _ reconcileResourceActuator = securityGroupActuator{}The resourceReconciler alias was added, but reconcileResourceActuator wasn't. Please add:
reconcileResourceActuator = generic.ReconcileResourceActuator[orcObjectPT, orcObjectT, osResourceT]var _ reconcileResourceActuator = flavorActuator{}| } | ||
| } | ||
|
|
||
| func TestExtraSpecUpdates(t *testing.T) { |
There was a problem hiding this comment.
Nice to have: would be great to add a test covering the entire logic of the update function eg. what happens if update succeed but delete fails, etc
| // +kubebuilder:validation:MaxItems:=128 | ||
| // +listType=atomic | ||
| // +optional | ||
| ExtraSpecs []ExtraSpec `json:"extraSpecs,omitempty"` |
There was a problem hiding this comment.
The []ExtraSpec slice has no uniqueness constraint on name. If a user specifies the same name twice, extraSpecsToMap silently uses the last value - no error or warning at admission time.
A CEL validation rule on the field would catch this at admission time:
// +kubebuilder:validation:XValidation:rule="self.all(x, self.filter(y, y.name == x.name).size() == 1)",message="extraSpecs names must be unique"
ExtraSpecs []ExtraSpec `json:"extraSpecs,omitempty"`| // +listType=atomic | ||
| // +optional | ||
| ExtraSpecs []VolumeTypeExtraSpec `json:"extraSpecs,omitempty"` | ||
| ExtraSpecs []ExtraSpec `json:"extraSpecs,omitempty"` |
There was a problem hiding this comment.
same as above:
The []ExtraSpec slice has no uniqueness constraint on name. If a user specifies the same name twice, extraSpecsToMap silently uses the last value - no error or warning at admission time.
A CEL validation rule on the field would catch this at admission time:
// +kubebuilder:validation:XValidation:rule="self.all(x, self.filter(y, y.name == x.name).size() == 1)",message="extraSpecs names must be unique"
ExtraSpecs []ExtraSpec `json:"extraSpecs,omitempty"`
Add
Flavorextra_specs.Also, create common type
ExtraSpecand use it for theFlavorandVolumeType.Closes #738