Skip to content

Commit 481a956

Browse files
authored
Merge pull request #3 from picodata/add-support-of-vshard-groups
Add ability to specify in values.yml vshard Group for each role
2 parents 58a7c72 + fb009db commit 481a956

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

controllers/role_controller.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ func CreateStatefulSetFromTemplate(ctx context.Context, replicasetNumber int, na
278278
sts.Spec.ServiceName = role.GetAnnotations()["tarantool.io/cluster-id"]
279279
replicasetUUID := uuid.NewSHA1(space, []byte(sts.GetName()))
280280
sts.ObjectMeta.Labels["tarantool.io/replicaset-uuid"] = replicasetUUID.String()
281-
sts.ObjectMeta.Labels["tarantool.io/vshardGroupName"] = role.GetLabels()["tarantool.io/role"]
281+
if name, ok := sts.ObjectMeta.Labels["tarantool.io/vshardGroupName"]; ok {
282+
sts.ObjectMeta.Labels["tarantool.io/vshardGroupName"] = name
283+
sts.ObjectMeta.Labels["tarantool.io/useVshardGroups"] = "1"
284+
}
282285

283286
if sts.ObjectMeta.Annotations == nil {
284287
sts.ObjectMeta.Annotations = make(map[string]string)
@@ -288,7 +291,10 @@ func CreateStatefulSetFromTemplate(ctx context.Context, replicasetNumber int, na
288291
sts.ObjectMeta.Annotations["tarantool.io/replicaset-weight"] = "100"
289292

290293
sts.Spec.Template.Labels["tarantool.io/replicaset-uuid"] = replicasetUUID.String()
291-
sts.Spec.Template.Labels["tarantool.io/vshardGroupName"] = role.GetLabels()["tarantool.io/role"]
294+
if name, ok := sts.ObjectMeta.Labels["tarantool.io/vshardGroupName"]; ok {
295+
sts.Spec.Template.Labels["tarantool.io/vshardGroupName"] = name
296+
sts.Spec.Template.Labels["tarantool.io/useVshardGroups"] = "1"
297+
}
292298

293299
return sts
294300
}

helm-charts/tarantool-cartridge/templates/deployment.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ metadata:
3232
tarantool.io/cluster-id: {{ $.Values.ClusterName }}
3333
tarantool.io/replicaset-template: "{{ .RoleName }}-template"
3434
tarantool.io/role: {{ .RoleName }}
35+
{{ if .VshardGroup }}
36+
tarantool.io/useVshardGroups: "1"
37+
tarantool.io/vshardGroupName: {{ .VshardGroup }}
38+
{{ else }}
3539
tarantool.io/useVshardGroups: "0"
40+
{{ end }}
3641
annotations:
3742
tarantool.io/rolesToAssign: {{ $r }}
3843
spec:
@@ -55,7 +60,12 @@ spec:
5560
tarantool.io/cluster-id: "{{ $.Values.ClusterName }}"
5661
tarantool.io/cluster-domain-name: "{{ $.Values.ClusterDomainName }}"
5762
tarantool.io/pod-template: "{{ .RoleName }}-pod-template"
63+
{{ if .VshardGroup }}
64+
tarantool.io/useVshardGroups: "1"
65+
tarantool.io/vshardGroupName: {{ .VshardGroup }}
66+
{{ else }}
5867
tarantool.io/useVshardGroups: "0"
68+
{{ end }}
5969
annotations:
6070
tarantool.io/rolesToAssign: {{ $r }}
6171
prometheus.io/path: "{{ $.Values.Prometheus.path }}"

0 commit comments

Comments
 (0)