Skip to content

Commit

Permalink
Merge pull request #837 from vyzigold/check_telemetry_deps
Browse files Browse the repository at this point in the history
Check for Ceilometer and Autoscaling dependencies
  • Loading branch information
openshift-merge-bot[bot] authored Jun 11, 2024
2 parents c2019c1 + 67446b6 commit 0659ccb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) string {
r.Spec.Ovn.Enabled) {
reqs = "Galera, Memcached, RabbitMQ, Keystone, Glance, Neutron, Nova, OVN"
}
case "Telemetry.Autoscaling":
if !(r.Spec.Galera.Enabled && r.Spec.Heat.Enabled && r.Spec.Rabbitmq.Enabled && r.Spec.Keystone.Enabled) {
reqs = "Galera, Heat, RabbitMQ, Keystone"
}
case "Telemetry.Ceilometer":
if !(r.Spec.Rabbitmq.Enabled && r.Spec.Keystone.Enabled) {
reqs = "RabbitMQ, Keystone"
}
}

// If "reqs" is not the empty string, we have missing requirements
Expand Down Expand Up @@ -384,6 +392,20 @@ func (r *OpenStackControlPlane) ValidateServiceDependencies(basePath *field.Path
allErrs = append(allErrs, err)
}
}
if r.Spec.Telemetry.Enabled && r.Spec.Telemetry.Template.Ceilometer.Enabled {
if depErrorMsg := r.checkDepsEnabled("Telemetry.Ceilometer"); depErrorMsg != "" {
err := field.Invalid(basePath.Child("telemetry").Child("template").Child("ceilometer").Child("enabled"),
r.Spec.Telemetry.Template.Ceilometer.Enabled, depErrorMsg)
allErrs = append(allErrs, err)
}
}
if r.Spec.Telemetry.Enabled && r.Spec.Telemetry.Template.Autoscaling.Enabled {
if depErrorMsg := r.checkDepsEnabled("Telemetry.Autoscaling"); depErrorMsg != "" {
err := field.Invalid(basePath.Child("telemetry").Child("template").Child("autoscaling").Child("enabled"),
r.Spec.Telemetry.Template.Autoscaling.Enabled, depErrorMsg)
allErrs = append(allErrs, err)
}
}

return allErrs
}
Expand Down

0 comments on commit 0659ccb

Please sign in to comment.