Skip to content

Commit

Permalink
Merge pull request #722 from elvgarrui/route_default_timeout
Browse files Browse the repository at this point in the history
Add Neutron's default route annotations
  • Loading branch information
karelyatin authored Apr 2, 2024
2 parents 06771c8 + e655525 commit 0219303
Show file tree
Hide file tree
Showing 2 changed files with 15 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,14 @@ func (r *OpenStackControlPlane) Default() {
r.DefaultServices()
}

// Helper function to initialize overrideSpec object. Could be moved to lib-common.
func initializeOverrideSpec(override **route.OverrideSpec, anno map[string]string) {
if *override == nil {
*override = &route.OverrideSpec{}
}
(*override).AddAnnotation(anno)
}

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

// Neutron
r.Spec.Neutron.Template.Default()
initializeOverrideSpec(&r.Spec.Neutron.APIOverride.Route, r.Spec.Neutron.Template.GetDefaultRouteAnnotations())

// Nova
r.Spec.Nova.Template.Default()
Expand Down
5 changes: 5 additions & 0 deletions tests/functional/openstackoperator_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ var _ = Describe("OpenStackOperator controller", func() {
g.Expect(keystoneAPI).Should(Not(BeNil()))
}, timeout, interval).Should(Succeed())
})
// Default route timeouts are set
It("should have default timeout for the routes set", func() {
OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName)
Expect(OSCtlplane.Spec.Neutron.APIOverride.Route.Annotations).Should(HaveKeyWithValue("haproxy.router.openshift.io/timeout", "120s"))
})

It("should create selfsigned issuer and public+internal CA and issuer", func() {
OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName)
Expand Down

0 comments on commit 0219303

Please sign in to comment.