@@ -2464,6 +2464,137 @@ var _ = Describe("OpenStackOperator controller", func() {
24642464 })
24652465 })
24662466
2467+ When ("A telemetry OpenStackControlplane instance is created with cloudkitty enabled and autoscaling disabled" , func () {
2468+ BeforeEach (func () {
2469+ spec := GetDefaultOpenStackControlPlaneSpec ()
2470+ spec ["telemetry" ] = map [string ]interface {}{
2471+ "enabled" : true ,
2472+ "template" : map [string ]interface {}{
2473+ "ceilometer" : map [string ]interface {}{
2474+ "enabled" : false ,
2475+ },
2476+ "metricStorage" : map [string ]interface {}{
2477+ "enabled" : false ,
2478+ },
2479+ "logging" : map [string ]interface {}{
2480+ "enabled" : false ,
2481+ },
2482+ "autoscaling" : map [string ]interface {}{
2483+ "enabled" : false ,
2484+ },
2485+ "cloudkitty" : map [string ]interface {}{
2486+ "enabled" : true ,
2487+ "apiTimeout" : 300 ,
2488+ },
2489+ },
2490+ }
2491+
2492+ // create cert secrets for rabbitmq instances
2493+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCertName ))
2494+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCell1CertName ))
2495+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQNotificationsCertName ))
2496+ // create cert secrets for memcached instance
2497+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .MemcachedCertName ))
2498+ // create cert secrets for ovn instance
2499+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .OVNNorthdCertName ))
2500+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .OVNControllerCertName ))
2501+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .OVNMetricsCertName ))
2502+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .InstanceHAMetricsCertName ))
2503+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .NeutronOVNCertName ))
2504+ // create cert secrets for cloudkitty
2505+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (types.NamespacedName {Name : "cert-cloudkitty-public-route" , Namespace : namespace }))
2506+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (types.NamespacedName {Name : "cert-cloudkitty-public-svc" , Namespace : namespace }))
2507+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (types.NamespacedName {Name : "cert-cloudkitty-internal-svc" , Namespace : namespace }))
2508+
2509+ DeferCleanup (
2510+ th .DeleteInstance ,
2511+ CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
2512+ )
2513+ })
2514+
2515+ It ("should default the cloudkitty route timeout from the cloudkitty apiTimeout" , func () {
2516+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
2517+ Expect (OSCtlplane .Spec .Telemetry .CloudKittyAPIOverride .Route ).Should (Not (BeNil ()))
2518+ Expect (OSCtlplane .Spec .Telemetry .CloudKittyAPIOverride .Route .Annotations ).Should (HaveKeyWithValue ("haproxy.router.openshift.io/timeout" , "300s" ))
2519+ Expect (OSCtlplane .Spec .Telemetry .CloudKittyAPIOverride .Route .Annotations ).Should (HaveKeyWithValue ("api.cloudkitty.openstack.org/timeout" , "300s" ))
2520+ // aodh route defaults are independent of the cloudkitty ones
2521+ Expect (OSCtlplane .Spec .Telemetry .AodhAPIOverride .Route ).Should (Not (BeNil ()))
2522+ Expect (OSCtlplane .Spec .Telemetry .AodhAPIOverride .Route .Annotations ).Should (HaveKeyWithValue ("haproxy.router.openshift.io/timeout" , "60s" ))
2523+ Expect (OSCtlplane .Spec .Telemetry .AodhAPIOverride .Route .Annotations ).Should (HaveKeyWithValue ("api.aodh.openstack.org/timeout" , "60s" ))
2524+ })
2525+
2526+ It ("should apply the cloudKittyApiOverride and not the aodhApiOverride to the cloudkitty route" , func () {
2527+ cloudKittyPublicSvcName := types.NamespacedName {Name : "cloudkitty-public" , Namespace : namespace }
2528+ cloudKittyInternalSvcName := types.NamespacedName {Name : "cloudkitty-internal" , Namespace : namespace }
2529+ // labels as set by the telemetry-operator on the cloudkitty
2530+ // services, including the osctlplane-service label the
2531+ // openstack-operator injects via the service override
2532+ cloudKittySvcLabels := map [string ]string {
2533+ "service" : "cloudkitty" ,
2534+ "osctlplane-service" : "telemetry" ,
2535+ "osctlplane" : "" ,
2536+ }
2537+
2538+ th .CreateService (
2539+ cloudKittyPublicSvcName ,
2540+ cloudKittySvcLabels ,
2541+ k8s_corev1.ServiceSpec {
2542+ Ports : []k8s_corev1.ServicePort {
2543+ {
2544+ Name : "cloudkitty-public" ,
2545+ Port : int32 (8889 ),
2546+ Protocol : k8s_corev1 .ProtocolTCP ,
2547+ },
2548+ },
2549+ })
2550+ cloudKittySvc := th .GetService (cloudKittyPublicSvcName )
2551+ if cloudKittySvc .Annotations == nil {
2552+ cloudKittySvc .Annotations = map [string ]string {}
2553+ }
2554+ cloudKittySvc .Annotations [service .AnnotationIngressCreateKey ] = "true"
2555+ cloudKittySvc .Annotations [service .AnnotationEndpointKey ] = "public"
2556+ Expect (th .K8sClient .Status ().Update (th .Ctx , cloudKittySvc )).To (Succeed ())
2557+
2558+ th .CreateService (
2559+ cloudKittyInternalSvcName ,
2560+ cloudKittySvcLabels ,
2561+ k8s_corev1.ServiceSpec {
2562+ Ports : []k8s_corev1.ServicePort {
2563+ {
2564+ Name : "cloudkitty-internal" ,
2565+ Port : int32 (8889 ),
2566+ Protocol : k8s_corev1 .ProtocolTCP ,
2567+ },
2568+ },
2569+ })
2570+ cloudKittyIntSvc := th .GetService (cloudKittyInternalSvcName )
2571+ if cloudKittyIntSvc .Annotations == nil {
2572+ cloudKittyIntSvc .Annotations = map [string ]string {}
2573+ }
2574+ cloudKittyIntSvc .Annotations [service .AnnotationIngressCreateKey ] = "false"
2575+ cloudKittyIntSvc .Annotations [service .AnnotationEndpointKey ] = "internal"
2576+ Expect (th .K8sClient .Status ().Update (th .Ctx , cloudKittyIntSvc )).To (Succeed ())
2577+
2578+ Eventually (func (g Gomega ) {
2579+ cloudKittyRoute := & routev1.Route {}
2580+ g .Expect (th .K8sClient .Get (th .Ctx , cloudKittyPublicSvcName , cloudKittyRoute )).Should (Succeed ())
2581+ g .Expect (cloudKittyRoute .Annotations ).Should (HaveKeyWithValue ("haproxy.router.openshift.io/timeout" , "300s" ))
2582+ g .Expect (cloudKittyRoute .Annotations ).Should (HaveKeyWithValue ("api.cloudkitty.openstack.org/timeout" , "300s" ))
2583+ g .Expect (cloudKittyRoute .Annotations ).ShouldNot (HaveKey ("api.aodh.openstack.org/timeout" ))
2584+ }, timeout , interval ).Should (Succeed ())
2585+
2586+ // the cloudkitty endpoint got exposed, but the aodh service
2587+ // overrides must not be populated from the cloudkitty services
2588+ Eventually (func (g Gomega ) {
2589+ telemetry := GetTelemetry (names .TelemetryName )
2590+ g .Expect (telemetry .Spec .CloudKitty .CloudKittyAPI .Override .Service [service .EndpointPublic ].EndpointURL ).Should (Not (BeNil ()))
2591+ for _ , svcOverride := range telemetry .Spec .Autoscaling .Aodh .Override .Service {
2592+ g .Expect (svcOverride .EndpointURL ).Should (BeNil ())
2593+ }
2594+ }, timeout , interval ).Should (Succeed ())
2595+ })
2596+ })
2597+
24672598 When ("OpenStackControlplane instance is deleted" , func () {
24682599 BeforeEach (func () {
24692600 DeferCleanup (
0 commit comments