Repository navigation
Integrate Cyborg into Openstack Operator #2214
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ import ( | |
|
|
||
| barbicanv1 "github.com/openstack-k8s-operators/barbican-operator/api/v1beta1" | ||
| cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1" | ||
| cyborgv1 "github.com/openstack-k8s-operators/nova-operator/api/cyborg/v1beta1" | ||
| designatev1 "github.com/openstack-k8s-operators/designate-operator/api/v1beta1" | ||
| glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1" | ||
| heatv1 "github.com/openstack-k8s-operators/heat-operator/api/v1beta1" | ||
|
|
@@ -360,6 +361,10 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) string { | |
| *r.Spec.Telemetry.Template.MetricStorage.Enabled) { | ||
| reqs = "Galera, Memcached, RabbitMQ, Keystone, Telemetry, Telemetry.Ceilometer, Telemetry.MetricStorage" | ||
| } | ||
| case "Cyborg": | ||
| if !(r.Spec.Galera.Enabled && r.Spec.Rabbitmq.Enabled && r.Spec.Keystone.Enabled) { | ||
| reqs = "Galera, RabbitMQ, Keystone" | ||
| } | ||
| } | ||
|
|
||
| // If "reqs" is not the empty string, we have missing requirements | ||
|
|
@@ -490,6 +495,13 @@ func (r *OpenStackControlPlane) ValidateCreateServices(basePath *field.Path) (ad | |
| errors = append(errors, validateTLSOverrideSpec(&r.Spec.Watcher.APIOverride.Route, basePath.Child("watcher").Child("apiOverride").Child("route"))...) | ||
| } | ||
|
|
||
| if r.Spec.Cyborg.Enabled { | ||
| warns, errs := r.Spec.Cyborg.Template.ValidateCreate(basePath.Child("cyborg").Child("template"), r.Namespace) | ||
|
Comment on lines
+498
to
+499
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| errors = append(errors, errs...) | ||
| warnings = append(warnings, warns...) | ||
| errors = append(errors, validateTLSOverrideSpec(&r.Spec.Cyborg.APIOverride.Route, basePath.Child("cyborg").Child("apiOverride").Child("route"))...) | ||
| } | ||
|
|
||
| if r.Spec.Telemetry.Enabled { | ||
| warns, errs := r.Spec.Telemetry.Template.ValidateCreate(basePath.Child("telemetry").Child("template"), r.Namespace) | ||
| errors = append(errors, errs...) | ||
|
|
@@ -718,6 +730,17 @@ func (r *OpenStackControlPlane) ValidateUpdateServices(old OpenStackControlPlane | |
| warnings = append(warnings, warns...) | ||
| errors = append(errors, validateTLSOverrideSpec(&r.Spec.Watcher.APIOverride.Route, basePath.Child("watcher").Child("apiOverride").Child("route"))...) | ||
| } | ||
|
|
||
| if r.Spec.Cyborg.Enabled { | ||
| if old.Cyborg.Template == nil { | ||
| old.Cyborg.Template = &cyborgv1.CyborgSpecCore{} | ||
| } | ||
| warns, errs := r.Spec.Cyborg.Template.ValidateUpdate(*old.Cyborg.Template, basePath.Child("cyborg").Child("template"), r.Namespace) | ||
| errors = append(errors, errs...) | ||
| warnings = append(warnings, warns...) | ||
| errors = append(errors, validateTLSOverrideSpec(&r.Spec.Cyborg.APIOverride.Route, basePath.Child("cyborg").Child("apiOverride").Child("route"))...) | ||
| } | ||
|
|
||
| if r.Spec.Telemetry.Enabled { | ||
| if old.Telemetry.Template == nil { | ||
| old.Telemetry.Template = &telemetryv1.TelemetrySpecCore{} | ||
|
|
@@ -883,6 +906,12 @@ func (r *OpenStackControlPlane) ValidateServiceDependencies(basePath *field.Path | |
| allErrs = append(allErrs, err) | ||
| } | ||
| } | ||
| if r.Spec.Cyborg.Enabled { | ||
| if depErrorMsg := r.checkDepsEnabled("Cyborg"); depErrorMsg != "" { | ||
| err := field.Invalid(basePath.Child("cyborg").Child("enabled"), r.Spec.Cyborg.Enabled, depErrorMsg) | ||
| allErrs = append(allErrs, err) | ||
| } | ||
| } | ||
|
|
||
| return allErrs | ||
| } | ||
|
|
@@ -1247,6 +1276,24 @@ func (r *OpenStackControlPlane) DefaultServices() { | |
| } | ||
| } | ||
|
|
||
| // Cyborg | ||
| if r.Spec.Cyborg.Enabled || r.Spec.Cyborg.Template != nil { | ||
| if r.Spec.Cyborg.Template == nil { | ||
| r.Spec.Cyborg.Template = &cyborgv1.CyborgSpecCore{} | ||
| } | ||
| r.Spec.Cyborg.Template.Default() | ||
|
|
||
| if r.Spec.Cyborg.Enabled { | ||
| initializeOverrideSpec(&r.Spec.Cyborg.APIOverride.Route, true) | ||
| r.Spec.Cyborg.Template.SetDefaultRouteAnnotations(r.Spec.Cyborg.APIOverride.Route.Annotations) | ||
| } | ||
|
|
||
| // Default DatabaseInstance | ||
| if r.Spec.Cyborg.Template.DatabaseInstance == nil || *r.Spec.Cyborg.Template.DatabaseInstance == "" { | ||
| r.Spec.Cyborg.Template.DatabaseInstance = ptr.To("openstack") | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| // DefaultLabel - adding default label to the OpenStackControlPlane | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Script executed:
rg -n 'Placement|placement|checkDepsEnabled\("Cyborg"\)' internal/openstack/cyborg.go api/core/v1beta1/openstackcontrolplane_webhook.go api/core/v1beta1/openstackcontrolplane_types.goRepository: openstack-k8s-operators/openstack-operator
Length of output: 4388
Script executed:
Repository: openstack-k8s-operators/openstack-operator
Length of output: 42317
Script executed:
Repository: openstack-k8s-operators/openstack-operator
Length of output: 43075
Script executed:
Repository: openstack-k8s-operators/openstack-operator
Length of output: 44972
Script executed:
Repository: openstack-k8s-operators/openstack-operator
Length of output: 42314
Script executed:
Repository: openstack-k8s-operators/openstack-operator
Length of output: 34032
Validate Cyborg’s Placement dependency.
When Cyborg is enabled with Nova and Placement disabled and no external Placement endpoint, validation accepts the configuration. Cyborg cannot register accelerator resources without Placement. Require a usable Placement service before accepting Cyborg.