Skip to content

Commit c3916c9

Browse files
committed
Add validation webhooks service operators
Adds calling service operator validations from within the openstack-operator for: - keystone - barbican - neutron - glance - cinder - heat - manila - swift - octavia - designate Depends-On: openstack-k8s-operators/keystone-operator#414 Depends-On: openstack-k8s-operators/barbican-operator#115 Depends-On: openstack-k8s-operators/neutron-operator#347 Depends-On: openstack-k8s-operators/glance-operator#529 Depends-On: openstack-k8s-operators/cinder-operator#384 Depends-On: openstack-k8s-operators/heat-operator#361 Depends-On: openstack-k8s-operators/manila-operator#273 Depends-On: openstack-k8s-operators/swift-operator#218 Depends-On: openstack-k8s-operators/octavia-operator#301 Depends-On: openstack-k8s-operators/designate-operator#166
1 parent 3b4c045 commit c3916c9

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

apis/core/v1beta1/openstackcontrolplane_webhook.go

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ func (r *OpenStackControlPlane) ValidateCreateServices(basePath *field.Path) fie
184184
errors = append(errors, r.ValidateServiceDependencies(basePath)...)
185185

186186
// Call internal validation logic for individual service operators
187+
if r.Spec.Keystone.Enabled {
188+
errors = append(errors, r.Spec.Keystone.Template.ValidateCreate(basePath.Child("keystone").Child("template"))...)
189+
}
190+
187191
if r.Spec.Ironic.Enabled {
188192
errors = append(errors, r.Spec.Ironic.Template.ValidateCreate(basePath.Child("ironic").Child("template"))...)
189193
}
@@ -196,6 +200,42 @@ func (r *OpenStackControlPlane) ValidateCreateServices(basePath *field.Path) fie
196200
errors = append(errors, r.Spec.Placement.Template.ValidateCreate(basePath.Child("placement").Child("template"))...)
197201
}
198202

203+
if r.Spec.Barbican.Enabled {
204+
errors = append(errors, r.Spec.Barbican.Template.ValidateCreate(basePath.Child("barbican").Child("template"))...)
205+
}
206+
207+
if r.Spec.Neutron.Enabled {
208+
errors = append(errors, r.Spec.Neutron.Template.ValidateCreate(basePath.Child("neutron").Child("template"))...)
209+
}
210+
211+
if r.Spec.Glance.Enabled {
212+
errors = append(errors, r.Spec.Glance.Template.ValidateCreate(basePath.Child("glance").Child("template"))...)
213+
}
214+
215+
if r.Spec.Cinder.Enabled {
216+
errors = append(errors, r.Spec.Cinder.Template.ValidateCreate(basePath.Child("cinder").Child("template"))...)
217+
}
218+
219+
if r.Spec.Heat.Enabled {
220+
errors = append(errors, r.Spec.Heat.Template.ValidateCreate(basePath.Child("heat").Child("template"))...)
221+
}
222+
223+
if r.Spec.Manila.Enabled {
224+
errors = append(errors, r.Spec.Manila.Template.ValidateCreate(basePath.Child("manila").Child("template"))...)
225+
}
226+
227+
if r.Spec.Swift.Enabled {
228+
errors = append(errors, r.Spec.Swift.Template.ValidateCreate(basePath.Child("swift").Child("template"))...)
229+
}
230+
231+
if r.Spec.Octavia.Enabled {
232+
errors = append(errors, r.Spec.Octavia.Template.ValidateCreate(basePath.Child("octavia").Child("template"))...)
233+
}
234+
235+
if r.Spec.Designate.Enabled {
236+
errors = append(errors, r.Spec.Designate.Template.ValidateCreate(basePath.Child("designate").Child("template"))...)
237+
}
238+
199239
return errors
200240
}
201241

@@ -206,6 +246,10 @@ func (r *OpenStackControlPlane) ValidateUpdateServices(old OpenStackControlPlane
206246
errors = append(errors, r.ValidateServiceDependencies(basePath)...)
207247

208248
// Call internal validation logic for individual service operators
249+
if r.Spec.Keystone.Enabled {
250+
errors = append(errors, r.Spec.Keystone.Template.ValidateUpdate(old.Keystone.Template, basePath.Child("keystone").Child("template"))...)
251+
}
252+
209253
if r.Spec.Ironic.Enabled {
210254
errors = append(errors, r.Spec.Ironic.Template.ValidateUpdate(old.Ironic.Template, basePath.Child("ironic").Child("template"))...)
211255
}
@@ -218,6 +262,42 @@ func (r *OpenStackControlPlane) ValidateUpdateServices(old OpenStackControlPlane
218262
errors = append(errors, r.Spec.Placement.Template.ValidateUpdate(old.Placement.Template, basePath.Child("placement").Child("template"))...)
219263
}
220264

265+
if r.Spec.Barbican.Enabled {
266+
errors = append(errors, r.Spec.Barbican.Template.ValidateUpdate(old.Barbican.Template, basePath.Child("barbican").Child("template"))...)
267+
}
268+
269+
if r.Spec.Neutron.Enabled {
270+
errors = append(errors, r.Spec.Neutron.Template.ValidateUpdate(old.Neutron.Template, basePath.Child("neutron").Child("template"))...)
271+
}
272+
273+
if r.Spec.Glance.Enabled {
274+
errors = append(errors, r.Spec.Glance.Template.ValidateUpdate(old.Glance.Template, basePath.Child("glance").Child("template"))...)
275+
}
276+
277+
if r.Spec.Cinder.Enabled {
278+
errors = append(errors, r.Spec.Cinder.Template.ValidateUpdate(old.Cinder.Template, basePath.Child("cinder").Child("template"))...)
279+
}
280+
281+
if r.Spec.Heat.Enabled {
282+
errors = append(errors, r.Spec.Heat.Template.ValidateUpdate(old.Heat.Template, basePath.Child("heat").Child("template"))...)
283+
}
284+
285+
if r.Spec.Manila.Enabled {
286+
errors = append(errors, r.Spec.Manila.Template.ValidateUpdate(old.Manila.Template, basePath.Child("manila").Child("template"))...)
287+
}
288+
289+
if r.Spec.Swift.Enabled {
290+
errors = append(errors, r.Spec.Swift.Template.ValidateUpdate(old.Swift.Template, basePath.Child("swift").Child("template"))...)
291+
}
292+
293+
if r.Spec.Octavia.Enabled {
294+
errors = append(errors, r.Spec.Octavia.Template.ValidateUpdate(old.Octavia.Template, basePath.Child("octavia").Child("template"))...)
295+
}
296+
297+
if r.Spec.Designate.Enabled {
298+
errors = append(errors, r.Spec.Designate.Template.ValidateUpdate(old.Designate.Template, basePath.Child("designate").Child("template"))...)
299+
}
300+
221301
return errors
222302
}
223303

0 commit comments

Comments
 (0)