Skip to content

Commit

Permalink
Use dns cluster info from lib common get function
Browse files Browse the repository at this point in the history
Openshift coreDNS creates the domain name using an string
located in dnses.operator.openshift.io. This string can
change in the future, calling lib-common/GetDNSClusterDomain
the responsability of gathering this information correctly
only falls under lib-common intead of all operators.

Resolves: OSPRH-3627
Depends-on: openstack-k8s-operators/lib-common#580
  • Loading branch information
averdagu committed Nov 18, 2024
1 parent 45d5df9 commit 7ab8f40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 0 additions & 4 deletions api/v1beta1/ovndbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ const (
// ServiceClusterType - Constant to identify Cluster services
ServiceClusterType = "cluster"

// DNSSuffix : hardcoded value on how DNSCore domain is configured
DNSSuffix = "cluster.local"
// TODO: retrieve it from environment

// Container image fall-back defaults

// OVNNBContainerImage is the fall-back container image for OVNDBCluster NB
Expand Down
6 changes: 5 additions & 1 deletion controllers/ovndbcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (

infranetworkv1 "github.com/openstack-k8s-operators/infra-operator/apis/network/v1beta1"
"github.com/openstack-k8s-operators/lib-common/modules/common"
"github.com/openstack-k8s-operators/lib-common/modules/common/clusterdns"
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
"github.com/openstack-k8s-operators/lib-common/modules/common/configmap"
"github.com/openstack-k8s-operators/lib-common/modules/common/env"
Expand Down Expand Up @@ -98,6 +99,7 @@ func (r *OVNDBClusterReconciler) GetLogger(ctx context.Context) logr.Logger {
//+kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;
//+kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch
//+kubebuilder:rbac:groups=network.openstack.org,resources=dnsdata,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups="operator.openshift.io",resources=dnses,verbs=get;list;watch

// service account, role, rolebinding
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update;patch
Expand Down Expand Up @@ -623,7 +625,9 @@ func (r *OVNDBClusterReconciler) reconcileNormal(ctx context.Context, instance *
if svc.Spec.ClusterIP == "None" || svc.Spec.Type == corev1.ServiceTypeLoadBalancer {
continue
}
internalDbAddress = append(internalDbAddress, fmt.Sprintf("%s:%s.%s.svc.%s:%d", scheme, svc.Name, svc.Namespace, ovnv1.DNSSuffix, svcPort))
// TODO: Watch operator.openshift.io resource once cluster domain is customizable
clusterDomain := clusterdns.getDNSClusterDomain()
internalDbAddress = append(internalDbAddress, fmt.Sprintf("%s:%s.%s.svc.%s:%d", scheme, svc.Name, svc.Namespace, clusterDomain, svcPort))
}

// Note setting this to the singular headless service address (e.g ssl:ovsdbserver-sb...) "works" but will not
Expand Down

0 comments on commit 7ab8f40

Please sign in to comment.