55 "fmt"
66
77 "github.com/openstack-k8s-operators/lib-common/modules/certmanager"
8+ "github.com/openstack-k8s-operators/lib-common/modules/common/clusterdns"
89 "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
910 "github.com/openstack-k8s-operators/lib-common/modules/common/helper"
1011
@@ -73,6 +74,7 @@ func ReconcileOVN(ctx context.Context, instance *corev1beta1.OpenStackControlPla
7374
7475func ReconcileOVNDbClusters (ctx context.Context , instance * corev1beta1.OpenStackControlPlane , version * corev1beta1.OpenStackVersion , helper * helper.Helper ) (bool , error ) {
7576 Log := GetLogger (ctx )
77+ dnsSuffix := clusterdns .GetDNSClusterDomain ()
7678
7779 OVNDBClustersReady := len (instance .Spec .Ovn .Template .OVNDBCluster ) != 0
7880 for name , dbcluster := range instance .Spec .Ovn .Template .OVNDBCluster {
@@ -111,7 +113,7 @@ func ReconcileOVNDbClusters(ctx context.Context, instance *corev1beta1.OpenStack
111113 // Cert needs to be valid for the individual pods in the statefulset so make this a wildcard cert
112114 Hostnames : []string {
113115 fmt .Sprintf ("*.%s.svc" , instance .Namespace ),
114- fmt .Sprintf ("*.%s.svc.%s" , instance .Namespace , ovnv1 . DNSSuffix ),
116+ fmt .Sprintf ("*.%s.svc.%s" , instance .Namespace , dnsSuffix ),
115117 },
116118 Ips : nil ,
117119 Usages : []certmgrv1.KeyUsage {
@@ -217,6 +219,7 @@ func ReconcileOVNNorthd(ctx context.Context, instance *corev1beta1.OpenStackCont
217219 }
218220 if instance .Spec .TLS .PodLevel .Enabled {
219221 ovnNorthdSpec .TLS = OVNNorthd .Spec .TLS
222+ dnsSuffix := clusterdns .GetDNSClusterDomain ()
220223
221224 serviceName := ovnv1 .ServiceNameOvnNorthd
222225 // create certificate for ovnnorthd
@@ -225,7 +228,7 @@ func ReconcileOVNNorthd(ctx context.Context, instance *corev1beta1.OpenStackCont
225228 CertName : fmt .Sprintf ("%s-ovndbs" , "ovnnorthd" ),
226229 Hostnames : []string {
227230 fmt .Sprintf ("%s.%s.svc" , serviceName , instance .Namespace ),
228- fmt .Sprintf ("%s.%s.svc.%s" , serviceName , instance .Namespace , ovnv1 . DNSSuffix ),
231+ fmt .Sprintf ("%s.%s.svc.%s" , serviceName , instance .Namespace , dnsSuffix ),
229232 },
230233 Ips : nil ,
231234 Usages : []certmgrv1.KeyUsage {
@@ -338,6 +341,7 @@ func ReconcileOVNController(ctx context.Context, instance *corev1beta1.OpenStack
338341 }
339342 }
340343 if instance .Spec .TLS .PodLevel .Enabled {
344+ dnsSuffix := clusterdns .GetDNSClusterDomain ()
341345 ovnControllerSpec .TLS = OVNController .Spec .TLS
342346
343347 serviceName := ovnv1 .ServiceNameOvnController
@@ -347,7 +351,7 @@ func ReconcileOVNController(ctx context.Context, instance *corev1beta1.OpenStack
347351 CertName : fmt .Sprintf ("%s-ovndbs" , "ovncontroller" ),
348352 Hostnames : []string {
349353 fmt .Sprintf ("%s.%s.svc" , serviceName , instance .Namespace ),
350- fmt .Sprintf ("%s.%s.svc.%s" , serviceName , instance .Namespace , ovnv1 . DNSSuffix ),
354+ fmt .Sprintf ("%s.%s.svc.%s" , serviceName , instance .Namespace , dnsSuffix ),
351355 },
352356 Ips : nil ,
353357 Usages : []certmgrv1.KeyUsage {
0 commit comments