Skip to content

Commit b4ce7ef

Browse files
committed
operator: support configurable domain cluster name
1 parent fe1a588 commit b4ce7ef

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

examples/kv/helm-chart/templates/deployment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ spec:
5353
metadata:
5454
labels:
5555
tarantool.io/cluster-id: {{ $.Values.ClusterName }}
56+
tarantool.io/cluster-domain-name: "{{ $.Values.ClusterDomainName }}"
5657
tarantool.io/pod-template: "{{ .RoleName }}-pod-template"
5758
tarantool.io/useVshardGroups: "0"
5859
environment: "{{ $.Values.ClusterEnv }}"
@@ -114,7 +115,7 @@ spec:
114115
fieldRef:
115116
fieldPath: metadata.name
116117
- name: TARANTOOL_ADVERTISE_HOST
117-
value: "$(TARANTOOL_ADVERTISE_TMP).{{ $.Values.ClusterName }}.{{ $.Release.Namespace }}.svc.cluster.local"
118+
value: "$(TARANTOOL_ADVERTISE_TMP).{{ $.Values.ClusterName }}.{{ $.Release.Namespace }}.svc.{{ $.Values.ClusterDomainName }}"
118119
- name: TARANTOOL_ADVERTISE_URI
119120
value: "$(TARANTOOL_ADVERTISE_HOST):3301"
120121
- name: TARANTOOL_PROBE_URI_TIMEOUT

examples/kv/helm-chart/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
ClusterEnv: dev
44
ClusterName: examples-kv-cluster
5+
ClusterDomainName: cluster.local
56

67
image:
78
repository: tarantool/tarantool-operator-examples-kv

pkg/topology/builtin.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,17 @@ func GetRoles(pod *corev1.Pod) ([]string, error) {
191191
// Join comment
192192
func (s *BuiltInTopologyService) Join(pod *corev1.Pod) error {
193193

194-
advURI := fmt.Sprintf("%s.%s.%s.svc.cluster.local:3301", pod.GetObjectMeta().GetName(), s.clusterID, pod.GetObjectMeta().GetNamespace())
195-
196194
thisPodLabels := pod.GetLabels()
195+
clusterDomainName, ok := thisPodLabels["tarantool.io/cluster-domain-name"]
196+
if !ok {
197+
clusterDomainName = "cluster.local"
198+
}
199+
200+
advURI := fmt.Sprintf("%s.%s.%s.svc.%s:3301",
201+
pod.GetObjectMeta().GetName(), // Instance name
202+
s.clusterID, // Cartridge cluster name
203+
pod.GetObjectMeta().GetNamespace(), // Namespace
204+
clusterDomainName) // Cluster domain name
197205

198206
replicasetUUID, ok := thisPodLabels["tarantool.io/replicaset-uuid"]
199207
if !ok {

0 commit comments

Comments
 (0)