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 Apr 1, 2024
1 parent 5d82498 commit e3a9c72
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 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
4 changes: 2 additions & 2 deletions apis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/openstack-k8s-operators/openstack-operator/apis
go 1.20

require (
github.com/onsi/ginkgo/v2 v2.16.0
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.32.0
github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-20240310115941-5124bc86e50e
github.com/openstack-k8s-operators/cinder-operator/api v0.3.1-0.20240315185259-92a4d93fc876
Expand All @@ -18,7 +18,7 @@ require (
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20240314165949-fec16b14c33b
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240315120315-d76653575db5
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240314113200-40cf3e6aa38e
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240308065128-4ba88761f83f
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240328201705-3f89f274c32f
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240313153742-4685453be3fb
github.com/openstack-k8s-operators/octavia-operator/api v0.3.1-0.20240326115129-7fd1a4fa51c3
github.com/openstack-k8s-operators/ovn-operator/api v0.3.1-0.20240318052728-f132fab5c943
Expand Down
5 changes: 5 additions & 0 deletions apis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.16.0 h1:7q1w9frJDzninhXxjZd+Y/x54XNjG/UlRLIYPZafsPM=
github.com/onsi/ginkgo/v2 v2.16.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk=
github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg=
github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxCMwNRnMjhhIDOWHJowi6q8G6koI=
Expand Down Expand Up @@ -101,8 +102,12 @@ github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240315120315-d
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240315120315-d76653575db5/go.mod h1:802RCwt0cea6338iJUgrsEQ0+obtvVAdvDquIASJKEQ=
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240314113200-40cf3e6aa38e h1:HUJV2Rd0NQZAXwV0UNdHKjO7fY5QLlDuLdI9f/OIc0Y=
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240314113200-40cf3e6aa38e/go.mod h1:f9IIyWeoskWoeWaDFF3qmAJ2Kqyovfi0Ar/QUfk3qag=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.0 h1:QLcbVW93dai51o/P5w28+UMIF96+ullprZg9KMIc8J8=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.0/go.mod h1:UV+KJ1V/b+FQr5Nq1Ga3BDxJcfAT6nyirrCRnzcY+ME=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240308065128-4ba88761f83f h1:/a/+8/2zx+GAr5urESTrxac71BDjeG6vYNEScUyytFg=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240308065128-4ba88761f83f/go.mod h1:gOepjTKpq6rF0Lf69edviPOjFpjw4LHan/tWC4LB4Fs=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240328201705-3f89f274c32f h1:uTyho5XjL/nmdEh3aRZ/ByGzrXCtYTpwsb+TaKS9UyI=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240328201705-3f89f274c32f/go.mod h1:3noVvcFj00ClDf7LLmf+kpdAMGaS3tCHhntFXGX2qA0=
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240313153742-4685453be3fb h1:WwiFdrd3Qk7AsXQWMIysL8LW4XHC9gJhJ4LmbIYi4HI=
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240313153742-4685453be3fb/go.mod h1:s9ZDTDlY5f7cu/ZT35kGYvLD8v6mto6MOLPcsK73e54=
github.com/openstack-k8s-operators/octavia-operator/api v0.3.1-0.20240326115129-7fd1a4fa51c3 h1:eBwnx+PrS4SBQxYLlByJFX7poKigiBJsv/CGoEFGIaI=
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/go-logr/logr v1.4.1
github.com/google/uuid v1.6.0
github.com/imdario/mergo v0.3.16
github.com/onsi/ginkgo/v2 v2.16.0
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.32.0
github.com/openshift/api v3.9.0+incompatible
github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-20240310115941-5124bc86e50e
Expand All @@ -27,12 +27,11 @@ require (
github.com/openstack-k8s-operators/lib-common/modules/test v0.3.1-0.20240314165949-fec16b14c33b
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240315120315-d76653575db5
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240314113200-40cf3e6aa38e
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240308065128-4ba88761f83f
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240328201705-3f89f274c32f
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240313153742-4685453be3fb
github.com/openstack-k8s-operators/octavia-operator/api v0.3.1-0.20240326115129-7fd1a4fa51c3
github.com/openstack-k8s-operators/openstack-ansibleee-operator/api v0.3.1-0.20240313103756-fb4ac5373b65
github.com/openstack-k8s-operators/openstack-baremetal-operator/api v0.3.1-0.20240318132611-4df20882649d
github.com/openstack-k8s-operators/openstack-operator/apis v0.0.0-00010101000000-000000000000
github.com/openstack-k8s-operators/ovn-operator/api v0.3.1-0.20240318052728-f132fab5c943
github.com/openstack-k8s-operators/placement-operator/api v0.3.1-0.20240313145348-1dd69c7bc338
github.com/openstack-k8s-operators/swift-operator/api v0.3.1-0.20240315154317-8b38ff1e6a8d
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.16.0 h1:7q1w9frJDzninhXxjZd+Y/x54XNjG/UlRLIYPZafsPM=
github.com/onsi/ginkgo/v2 v2.16.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8=
github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk=
github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg=
github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxCMwNRnMjhhIDOWHJowi6q8G6koI=
Expand Down Expand Up @@ -130,8 +132,12 @@ github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240315120315-d
github.com/openstack-k8s-operators/manila-operator/api v0.3.1-0.20240315120315-d76653575db5/go.mod h1:802RCwt0cea6338iJUgrsEQ0+obtvVAdvDquIASJKEQ=
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240314113200-40cf3e6aa38e h1:HUJV2Rd0NQZAXwV0UNdHKjO7fY5QLlDuLdI9f/OIc0Y=
github.com/openstack-k8s-operators/mariadb-operator/api v0.3.1-0.20240314113200-40cf3e6aa38e/go.mod h1:f9IIyWeoskWoeWaDFF3qmAJ2Kqyovfi0Ar/QUfk3qag=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.0 h1:QLcbVW93dai51o/P5w28+UMIF96+ullprZg9KMIc8J8=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.0/go.mod h1:UV+KJ1V/b+FQr5Nq1Ga3BDxJcfAT6nyirrCRnzcY+ME=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240308065128-4ba88761f83f h1:/a/+8/2zx+GAr5urESTrxac71BDjeG6vYNEScUyytFg=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240308065128-4ba88761f83f/go.mod h1:gOepjTKpq6rF0Lf69edviPOjFpjw4LHan/tWC4LB4Fs=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240328201705-3f89f274c32f h1:uTyho5XjL/nmdEh3aRZ/ByGzrXCtYTpwsb+TaKS9UyI=
github.com/openstack-k8s-operators/neutron-operator/api v0.3.1-0.20240328201705-3f89f274c32f/go.mod h1:3noVvcFj00ClDf7LLmf+kpdAMGaS3tCHhntFXGX2qA0=
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240313153742-4685453be3fb h1:WwiFdrd3Qk7AsXQWMIysL8LW4XHC9gJhJ4LmbIYi4HI=
github.com/openstack-k8s-operators/nova-operator/api v0.3.1-0.20240313153742-4685453be3fb/go.mod h1:s9ZDTDlY5f7cu/ZT35kGYvLD8v6mto6MOLPcsK73e54=
github.com/openstack-k8s-operators/octavia-operator/api v0.3.1-0.20240326115129-7fd1a4fa51c3 h1:eBwnx+PrS4SBQxYLlByJFX7poKigiBJsv/CGoEFGIaI=
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 e3a9c72

Please sign in to comment.