Skip to content

Commit

Permalink
Add Neutron's default route annotations
Browse files Browse the repository at this point in the history
When the webhook calls for Neutron defaults, it should also write the
route override annotation on Neutron's CR section.

Signed-off-by: Elvira García <[email protected]>
  • Loading branch information
elvgarrui committed Mar 26, 2024
1 parent 2fcb054 commit 722467e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1beta1
import (
"fmt"

"github.com/openstack-k8s-operators/lib-common/modules/common/route"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -318,6 +319,13 @@ func (r *OpenStackControlPlane) Default() {
r.DefaultServices()
}

// Helper function to initialize overrideSpec object. Could be moved to lib-common.
func initializeOverride(override **route.OverrideSpec) {
if *override == nil {
*override = &route.OverrideSpec{}
}
}

// DefaultServices - common function for calling individual services' defaulting functions
func (r *OpenStackControlPlane) DefaultServices() {
// RabbitMQ
Expand Down Expand Up @@ -381,6 +389,8 @@ func (r *OpenStackControlPlane) DefaultServices() {

// Neutron
r.Spec.Neutron.Template.Default()
initializeOverride(&r.Spec.Neutron.APIOverride.Route)
r.Spec.Neutron.APIOverride.Route.AddAnnotation(r.Spec.Neutron.Template.GetDefaultRouteAnnotations())

// Nova
r.Spec.Nova.Template.Default()
Expand Down

0 comments on commit 722467e

Please sign in to comment.