@@ -45,9 +45,11 @@ import (
4545 "github.com/openstack-k8s-operators/lib-common/modules/common/service"
4646 "github.com/openstack-k8s-operators/lib-common/modules/common/tls"
4747 manilav1 "github.com/openstack-k8s-operators/manila-operator/api/v1beta1"
48+ novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1"
4849 clientv1 "github.com/openstack-k8s-operators/openstack-operator/apis/client/v1beta1"
4950 corev1 "github.com/openstack-k8s-operators/openstack-operator/apis/core/v1beta1"
5051 ovnv1 "github.com/openstack-k8s-operators/ovn-operator/api/v1beta1"
52+ placementv1 "github.com/openstack-k8s-operators/placement-operator/api/v1beta1"
5153)
5254
5355var _ = Describe ("OpenStackOperator controller" , func () {
@@ -2931,6 +2933,14 @@ var _ = Describe("OpenStackOperator controller galera and rabbitmq", func() {
29312933 th .CreateCertSecret (names .RabbitMQCertName )
29322934 th .CreateCertSecret (names .RabbitMQCell1CertName )
29332935
2936+ // create cert secrets for ovn instance
2937+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .OVNNorthdCertName ))
2938+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .OVNControllerCertName ))
2939+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .NeutronOVNCertName ))
2940+
2941+ // create cert secrets for memcached instance
2942+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .MemcachedCertName ))
2943+
29342944 extGalera := CreateGaleraConfig (namespace , GetDefaultGaleraSpec ())
29352945 extGaleraName .Name = extGalera .GetName ()
29362946 extGaleraName .Namespace = extGalera .GetNamespace ()
@@ -3102,6 +3112,122 @@ var _ = Describe("OpenStackOperator controller galera and rabbitmq", func() {
31023112
31033113 })
31043114
3115+ When ("The novncproxy k8s service is created" , func () {
3116+ BeforeEach (func () {
3117+
3118+ novncProxyPublicSvcName := types.NamespacedName {
3119+ Name : "nova-novncproxy-cell1-public" ,
3120+ Namespace : namespace }
3121+
3122+ th .CreateService (
3123+ novncProxyPublicSvcName ,
3124+ map [string ]string {
3125+ "osctlplane-service" : "nova-novncproxy" ,
3126+ "osctlplane" : "" ,
3127+ },
3128+ k8s_corev1.ServiceSpec {
3129+ Ports : []k8s_corev1.ServicePort {
3130+ {
3131+ Name : "nova-novncproxy-cell1-public" ,
3132+ Port : int32 (6080 ),
3133+ Protocol : k8s_corev1 .ProtocolTCP ,
3134+ },
3135+ },
3136+ })
3137+
3138+ novncProxySvc := th .GetService (novncProxyPublicSvcName )
3139+
3140+ if novncProxySvc .Annotations == nil {
3141+ novncProxySvc .Annotations = map [string ]string {}
3142+ }
3143+
3144+ novncProxySvc .Annotations [service .AnnotationIngressCreateKey ] = "true"
3145+ novncProxySvc .Annotations [service .AnnotationEndpointKey ] = "public"
3146+
3147+ // Expect(th.K8sClient.Status().Update(th.Ctx, keystoneSvc)).To(Succeed())
3148+ Expect (th .K8sClient .Status ().Update (th .Ctx , novncProxySvc )).To (Succeed ())
3149+
3150+ // th.CreateService(
3151+ // keystoneInternalSvcName,
3152+ // map[string]string{
3153+ // "osctlplane-service": "keystone",
3154+ // "osctlplane": "",
3155+ // },
3156+ // k8s_corev1.ServiceSpec{
3157+ // Ports: []k8s_corev1.ServicePort{
3158+ // {
3159+ // Name: "keystone-internal",
3160+ // Port: int32(5000),
3161+ // Protocol: k8s_corev1.ProtocolTCP,
3162+ // },
3163+ // },
3164+ // })
3165+ // keystoneSvc = th.GetService(keystoneInternalSvcName)
3166+ // if keystoneSvc.Annotations == nil {
3167+ // keystoneSvc.Annotations = map[string]string{}
3168+ // }
3169+ // keystoneSvc.Annotations[service.AnnotationIngressCreateKey] = "false"
3170+ // keystoneSvc.Annotations[service.AnnotationEndpointKey] = "internal"
3171+ // Expect(th.K8sClient.Status().Update(th.Ctx, keystoneSvc)).To(Succeed())
3172+
3173+ // vnproxy certs
3174+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .NoVNCProxyCell1CertPublicRouteName ))
3175+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .NoVNCProxyCell1CertPublicSvcName ))
3176+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .NoVNCProxyCell1CertVencryptName ))
3177+
3178+ })
3179+
3180+ It ("cell1 certs should be deleted from CR" , func () {
3181+
3182+ // enable Nova and dependencies
3183+ Eventually (func (g Gomega ) {
3184+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
3185+ OSCtlplane .Spec .Nova .Enabled = true
3186+ OSCtlplane .Spec .Nova .Template = & novav1.NovaSpecCore {}
3187+ // enable "Galera, Memcached, RabbitMQ, Keystone, Glance, Neutron, Placement" too
3188+
3189+ OSCtlplane .Spec .Keystone .Enabled = true
3190+ OSCtlplane .Spec .Glance .Enabled = true
3191+ OSCtlplane .Spec .Neutron .Enabled = true
3192+ OSCtlplane .Spec .Placement .Enabled = true
3193+ // th.Logger.Info("", "number 5", "")
3194+
3195+ // th.Logger.Info("", ">>> pre-update", OSCtlplane)
3196+
3197+ if OSCtlplane .Spec .Placement .Template == nil {
3198+ OSCtlplane .Spec .Placement .Template = & placementv1.PlacementAPISpecCore {}
3199+ OSCtlplane .Spec .Placement .Template .APITimeout = 10
3200+ }
3201+ g .Expect (k8sClient .Update (ctx , OSCtlplane )).Should (Succeed ())
3202+ }, timeout , interval ).Should (Succeed ())
3203+
3204+ // OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName)
3205+
3206+ // certNames := []types.NamespacedName{
3207+ // {Name: "cert-nova-novncproxy-cell1-public-route", Namespace: namespace},
3208+ // {Name: "cert-nova-novncproxy-cell1-public-svc", Namespace: namespace},
3209+ // {Name: "cert-nova-novncproxy-cell1-vencrypt", Namespace: namespace},
3210+ // }
3211+
3212+ // Eventually(func(g Gomega) {
3213+ // for _, certName := range certNames {
3214+ // cert := crtmgr.GetCert(certName)
3215+ // g.Expect(cert).NotTo(BeNil())
3216+ // th.Logger.Info("XXX cert created", "", cert.Name)
3217+ // }
3218+ // }, timeout, interval).Should(Succeed())
3219+
3220+ certs := crtmgr .GetCerts (namespace )
3221+ th .Logger .Info ("XXX---" , "" , certs )
3222+ // for _, certName := range certs.Items {
3223+ // th.Logger.Info("XXX---", "", certName)
3224+
3225+ // }
3226+
3227+ })
3228+
3229+ })
3230+
31053231 })
31063232
31073233})
0 commit comments