Skip to content

Commit a4c185e

Browse files
committed
move replacing nodes to aggregation
1 parent 40a12fa commit a4c185e

File tree

6 files changed

+71
-97
lines changed

6 files changed

+71
-97
lines changed

pkg/cmd/operator/bootstrapgate.go

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ import (
1212
"github.com/scylladb/scylla-operator/pkg/controllerhelpers"
1313
"github.com/scylladb/scylla-operator/pkg/genericclioptions"
1414
"github.com/scylladb/scylla-operator/pkg/naming"
15-
"github.com/scylladb/scylla-operator/pkg/pointer"
1615
"github.com/scylladb/scylla-operator/pkg/signals"
1716
"github.com/scylladb/scylla-operator/pkg/version"
1817
"github.com/spf13/cobra"
1918
corev1 "k8s.io/api/core/v1"
2019
apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
21-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2220
apimachineryutilerrors "k8s.io/apimachinery/pkg/util/errors"
2321
apimachineryutilsets "k8s.io/apimachinery/pkg/util/sets"
2422
"k8s.io/client-go/kubernetes"
@@ -35,9 +33,6 @@ type AutoGenerateSSTables struct {
3533
Bootstrapped struct {
3634
Value string `json:"value"`
3735
} `json:"bootstrapped"`
38-
HostID struct {
39-
Value string `json:"value"`
40-
} `json:"host_id"`
4136
} `json:"columns"`
4237
} `json:"clustering_elements"`
4338
} `json:"anonymous"`
@@ -53,7 +48,6 @@ type BootstrapGateOptions struct {
5348
SStableSystemLocalDumpPath string
5449

5550
bootstrapped bool
56-
hostID *string
5751

5852
kubeClient kubernetes.Interface
5953
scyllaClient scyllaversionedclient.Interface
@@ -161,9 +155,6 @@ func (o *BootstrapGateOptions) Complete(args []string) error {
161155
if ce.Columns.Bootstrapped.Value == "COMPLETED" {
162156
o.bootstrapped = true
163157
}
164-
if len(ce.Columns.HostID.Value) != 0 {
165-
o.hostID = pointer.Ptr(ce.Columns.HostID.Value)
166-
}
167158
}
168159
}
169160

@@ -207,43 +198,13 @@ func (o *BootstrapGateOptions) Run(originalStreams genericclioptions.IOStreams,
207198

208199
func (o *BootstrapGateOptions) Execute(ctx context.Context, originalStreams genericclioptions.IOStreams, cmd *cobra.Command) error {
209200
var err error
210-
ignoredNodes := apimachineryutilsets.New[string]()
211201

212-
// FIXME
213-
// Skip the rolling restart case for now.
214202
if o.bootstrapped {
215-
if o.hostID == nil {
216-
return fmt.Errorf("node is bootstrapped but hostID is nil, this should never happen")
217-
}
218-
219-
// Node is restarting, other nodes are going to consider it down.
220-
// FIXME: we should add it to ignored nodes instead if we want to support blocking the rolling restart.
221-
klog.V(2).InfoS("Node has already been bootstrapped, assuming it's being rolling restarted. Skipping.", "Service", naming.ManualRef(o.Namespace, o.ServiceName), "Bootstrapped", o.bootstrapped, "HostID", o.hostID)
203+
klog.V(2).InfoS("Node has already been bootstrapped, assuming it's being rolling restarted. Skipping.", "Service", naming.ManualRef(o.Namespace, o.ServiceName), "Bootstrapped", o.bootstrapped)
222204
return nil
223205
}
224-
//
225-
226-
// Node replace case.
227-
var svc *corev1.Service
228-
svc, err = o.kubeClient.CoreV1().Services(o.Namespace).Get(ctx, o.ServiceName, metav1.GetOptions{})
229-
if err != nil {
230-
return fmt.Errorf("can't get service %q: %w", naming.ManualRef(o.Namespace, o.ServiceName), err)
231-
}
232206

233-
replacingHostID, ok := svc.Labels[naming.ReplacingNodeHostIDLabel]
234-
if ok && len(replacingHostID) == 0 {
235-
return fmt.Errorf("service %q has an empty %q label, this should never happen", naming.ManualRef(o.Namespace, o.ServiceName), naming.ReplacingNodeHostIDLabel)
236-
}
237-
238-
if len(replacingHostID) > 0 {
239-
klog.V(2).InfoS("Node is replacing another node", "Service", naming.ManualRef(o.Namespace, o.ServiceName), "Bootstrapped", o.bootstrapped, "HostID", o.hostID, "ReplacingHostID", replacingHostID)
240-
ignoredNodes.Insert(replacingHostID)
241-
}
242-
//
243-
244-
// ALTERNATIVE: instead of getting the configmap with statuses, this is where we could ask all other nodes for their statuses (by using broadcastAddresses from corresponding services/pods)
245-
246-
klog.V(2).InfoS("Waiting for required bootstrap conditions", "Service", naming.ManualRef(o.Namespace, o.ServiceName), "Bootstrapped", o.bootstrapped, "HostID", o.hostID, "ReplacingHostID", replacingHostID, "IgnoredNodes", ignoredNodes.UnsortedList())
207+
klog.V(2).InfoS("Waiting for required bootstrap conditions", "Service", naming.ManualRef(o.Namespace, o.ServiceName), "Bootstrapped", o.bootstrapped)
247208
_, err = controllerhelpers.WaitForConfigMapState(
248209
ctx,
249210
o.kubeClient.CoreV1().ConfigMaps(o.Namespace),
@@ -255,16 +216,16 @@ func (o *BootstrapGateOptions) Execute(ctx context.Context, originalStreams gene
255216
return false, fmt.Errorf("missing %s key", naming.ScyllaDBClusterStatusKey)
256217
}
257218

258-
var nodeClusterStatuses []controllerhelpers.ClusterStatus
259-
err = json.Unmarshal([]byte(data), &nodeClusterStatuses)
219+
var clusterStatus controllerhelpers.ClusterStatus
220+
err = json.Unmarshal([]byte(data), &clusterStatus)
260221
if err != nil {
261222
return false, fmt.Errorf("can't unmarshal cluster status: %w", err)
262223
}
263224

264225
// FIXME: this could be preprocessed
265226
hostIDs := apimachineryutilsets.New[string]()
266227
hostIDToStatusMap := make(map[string]map[string]bool)
267-
for _, nodeClusterStatus := range nodeClusterStatuses {
228+
for _, nodeClusterStatus := range clusterStatus.NodeClusterStatuses {
268229
if nodeClusterStatus.Error != nil {
269230
// We might get errors from nodes that haven't started bootstrap yet, so we need to ignore them.
270231
// If the node is already a part of the cluster, we'll see it in other nodes' statuses.
@@ -281,7 +242,10 @@ func (o *BootstrapGateOptions) Execute(ctx context.Context, originalStreams gene
281242
hostIDToStatusMap[nodeClusterStatus.HostID] = otherNodesHostIDToStatusMap
282243
}
283244

284-
klog.V(4).InfoS("Cluster status", "Service", naming.ManualRef(o.Namespace, o.ServiceName), "HostIDs", hostIDs.UnsortedList(), "HostIDToStatusMap", hostIDToStatusMap)
245+
// Ignore nodes that are being replaced.
246+
ignoredNodes := apimachineryutilsets.New[string](clusterStatus.ReplacingHostIDs...)
247+
248+
klog.V(4).InfoS("Cluster status", "Service", naming.ManualRef(o.Namespace, o.ServiceName), "HostIDs", hostIDs.UnsortedList(), "HostIDToStatusMap", hostIDToStatusMap, "IgnoredNodes", ignoredNodes.UnsortedList())
285249
for hostID := range hostIDs {
286250
if ignoredNodes.Has(hostID) {
287251
// We don't care about this node.

pkg/cmd/operator/scylladbapistatusupdate.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,17 @@ func (c *controller) sync(ctx context.Context) error {
265265
return fmt.Errorf("can't get service %q: %w", naming.ManualRef(c.namespace, c.serviceName), err)
266266
}
267267

268-
clusterStatus, err := getClusterStatus(ctx)
268+
nodeClusterStatus, err := getNodeClusterStatus(ctx)
269269
if err != nil {
270270
return fmt.Errorf("can't get cluster status: %w", err)
271271
}
272272

273-
statusAnnotationValue, err := makeClusterStatusAnnotationValue(clusterStatus)
273+
statusAnnotationValue, err := makeNodeClusterStatusAnnotationValue(nodeClusterStatus)
274274
if err != nil {
275275
return fmt.Errorf("can't make cluster status annotation value: %w", err)
276276
}
277277

278-
patch, err := controllerhelpers.PrepareSetAnnotationPatch(svc, naming.ClusterStatusAnnotation, &statusAnnotationValue)
278+
patch, err := controllerhelpers.PrepareSetAnnotationPatch(svc, naming.NodeClusterStatusAnnotation, &statusAnnotationValue)
279279
if err != nil {
280280
return fmt.Errorf("can't prepare annotation patch: %w", err)
281281
}
@@ -288,7 +288,7 @@ func (c *controller) sync(ctx context.Context) error {
288288
return nil
289289
}
290290

291-
func getClusterStatus(ctx context.Context) (*controllerhelpers.ClusterStatus, error) {
291+
func getNodeClusterStatus(ctx context.Context) (*controllerhelpers.NodeClusterStatus, error) {
292292
scyllaClient, err := controllerhelpers.NewScyllaClientForLocalhost()
293293
if err != nil {
294294
return nil, fmt.Errorf("can't create Scylla client for localhost: %w", err)
@@ -299,32 +299,32 @@ func getClusterStatus(ctx context.Context) (*controllerhelpers.ClusterStatus, er
299299
nodeStatuses, err := scyllaClient.Status(ctx, localhost)
300300
if err != nil {
301301
klog.V(4).InfoS("Error getting node statuses", "error", err)
302-
return &controllerhelpers.ClusterStatus{
302+
return &controllerhelpers.NodeClusterStatus{
303303
Error: pointer.Ptr(err.Error()),
304304
}, nil
305305
}
306306

307307
hostID, err := scyllaClient.GetLocalHostId(ctx, localhost, false)
308308
if err != nil {
309309
klog.V(4).InfoS("Error getting local host ID", "error", err)
310-
return &controllerhelpers.ClusterStatus{
310+
return &controllerhelpers.NodeClusterStatus{
311311
Error: pointer.Ptr(err.Error()),
312312
}, nil
313313
}
314314

315-
return &controllerhelpers.ClusterStatus{
315+
return &controllerhelpers.NodeClusterStatus{
316316
HostID: hostID,
317317
Status: nodeStatuses,
318318
}, nil
319319
}
320320

321-
func makeClusterStatusAnnotationValue(status *controllerhelpers.ClusterStatus) (string, error) {
321+
func makeNodeClusterStatusAnnotationValue(status *controllerhelpers.NodeClusterStatus) (string, error) {
322322
var err error
323323
buf := bytes.Buffer{}
324324

325325
err = json.NewEncoder(&buf).Encode(status)
326326
if err != nil {
327-
return "", fmt.Errorf("can't encode status: %w", err)
327+
return "", fmt.Errorf("can't encode node cluster status: %w", err)
328328
}
329329

330330
return buf.String(), nil

pkg/controller/scylladbcluster/resource.go

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,10 @@ func makeLocalClusterStatusConfigMap(sc *scyllav1alpha1.ScyllaDBCluster, remoteN
15441544
return progressingConditions, nil, fmt.Errorf("can't get cluster statuses configmap name for ScyllaDBCluster %q: %w", naming.ObjRef(sc), err)
15451545
}
15461546

1547-
var nodeClusterStatuses []controllerhelpers.ClusterStatus
1547+
clusterStatus := &controllerhelpers.ClusterStatus{
1548+
ReplacingHostIDs: []string{},
1549+
NodeClusterStatuses: []controllerhelpers.NodeClusterStatus{},
1550+
}
15481551
for _, dc := range sc.Spec.Datacenters {
15491552
dcNamespace, ok := remoteNamespaces[dc.RemoteKubernetesClusterName]
15501553
if !ok {
@@ -1561,18 +1564,19 @@ func makeLocalClusterStatusConfigMap(sc *scyllav1alpha1.ScyllaDBCluster, remoteN
15611564

15621565
// TODO: move to func
15631566
dcServiceSelector := naming.DatacenterMemberServiceSelector(sc, &dc)
1564-
dcNodeClusterStatuses, err := getNodeClusterStatusesFromRemoteDCMemberServices(sc, &dc, dcNamespace, dcServiceSelector, remoteServiceLister)
1567+
dcClusterStatus, err := getClusterStatusFromRemoteDCMemberServices(sc, &dc, dcNamespace, dcServiceSelector, remoteServiceLister)
15651568
if err != nil {
1566-
return progressingConditions, nil, fmt.Errorf("can't get node cluster statuses for ScyllaDBCluster %q Datacenter %q remote member services: %w", naming.ObjRef(sc), dc.Name, err)
1569+
return progressingConditions, nil, fmt.Errorf("can't get cluster status for ScyllaDBCluster %q Datacenter %q remote member services: %w", naming.ObjRef(sc), dc.Name, err)
15671570
}
15681571

1569-
nodeClusterStatuses = append(nodeClusterStatuses, dcNodeClusterStatuses...)
1572+
clusterStatus.ReplacingHostIDs = append(clusterStatus.ReplacingHostIDs, dcClusterStatus.ReplacingHostIDs...)
1573+
clusterStatus.NodeClusterStatuses = append(clusterStatus.NodeClusterStatuses, dcClusterStatus.NodeClusterStatuses...)
15701574
}
15711575

15721576
buf := bytes.Buffer{}
1573-
err = json.NewEncoder(&buf).Encode(nodeClusterStatuses)
1577+
err = json.NewEncoder(&buf).Encode(clusterStatus)
15741578
if err != nil {
1575-
return progressingConditions, nil, fmt.Errorf("can't encode node cluster statuses: %w", err)
1579+
return progressingConditions, nil, fmt.Errorf("can't encode cluster status: %w", err)
15761580
}
15771581

15781582
cm := &corev1.ConfigMap{
@@ -1611,30 +1615,32 @@ func makeLocalClusterStatusConfigMap(sc *scyllav1alpha1.ScyllaDBCluster, remoteN
16111615
return progressingConditions, cm, nil
16121616
}
16131617

1614-
func getNodeClusterStatusesFromRemoteDCMemberServices(sc *scyllav1alpha1.ScyllaDBCluster, remoteDC *scyllav1alpha1.ScyllaDBClusterDatacenter, remoteDCNamespace *corev1.Namespace, remoteDCMemberServiceSelector apimachinerylabels.Selector, remoteServiceLister remotelister.GenericClusterLister[corev1listers.ServiceLister]) ([]controllerhelpers.ClusterStatus, error) {
1615-
var nodeClusterStatuses []controllerhelpers.ClusterStatus
1618+
func getClusterStatusFromRemoteDCMemberServices(sc *scyllav1alpha1.ScyllaDBCluster, remoteDC *scyllav1alpha1.ScyllaDBClusterDatacenter, remoteDCNamespace *corev1.Namespace, remoteDCMemberServiceSelector apimachinerylabels.Selector, remoteServiceLister remotelister.GenericClusterLister[corev1listers.ServiceLister]) (*controllerhelpers.ClusterStatus, error) {
1619+
clusterStatus := &controllerhelpers.ClusterStatus{
1620+
ReplacingHostIDs: []string{},
1621+
NodeClusterStatuses: []controllerhelpers.NodeClusterStatus{},
1622+
}
16161623

16171624
dcMemberServices, err := remoteServiceLister.Cluster(remoteDC.RemoteKubernetesClusterName).Services(remoteDCNamespace.Name).List(remoteDCMemberServiceSelector)
16181625
if err != nil {
16191626
return nil, fmt.Errorf("can't list member Services for %q ScyllaDBCluster %q Datacenter: %w", naming.ObjRef(sc), remoteDC.Name, err)
16201627
}
16211628

16221629
for _, svc := range dcMemberServices {
1623-
nodeClusterStatusAnnotation, ok := svc.Annotations[naming.ClusterStatusAnnotation]
1624-
if !ok {
1625-
// The node might not have reported its status yet.
1626-
// FIXME: should we wait? Sidecar would have to be moved to init containers.
1627-
continue
1630+
if replacingNodeHostIDLabel, ok := svc.Labels[naming.ReplacingNodeHostIDLabel]; ok {
1631+
clusterStatus.ReplacingHostIDs = append(clusterStatus.ReplacingHostIDs, replacingNodeHostIDLabel)
16281632
}
16291633

1630-
var nodeClusterStatus controllerhelpers.ClusterStatus
1631-
err = json.NewDecoder(strings.NewReader(nodeClusterStatusAnnotation)).Decode(&nodeClusterStatus)
1632-
if err != nil {
1633-
return nil, fmt.Errorf("can't decode annotation %q of service %q for ScyllaDBCluster %q Datacenter %q: %w", naming.ClusterStatusAnnotation, naming.ObjRef(svc), naming.ObjRef(sc), remoteDC.Name, err)
1634-
}
1634+
if nodeClusterStatusAnnotation, ok := svc.Annotations[naming.NodeClusterStatusAnnotation]; ok {
1635+
var nodeClusterStatus controllerhelpers.NodeClusterStatus
1636+
err = json.NewDecoder(strings.NewReader(nodeClusterStatusAnnotation)).Decode(&nodeClusterStatus)
1637+
if err != nil {
1638+
return nil, fmt.Errorf("can't decode annotation %q of service %q for ScyllaDBCluster %q Datacenter %q: %w", naming.NodeClusterStatusAnnotation, naming.ObjRef(svc), naming.ObjRef(sc), remoteDC.Name, err)
1639+
}
16351640

1636-
nodeClusterStatuses = append(nodeClusterStatuses, nodeClusterStatus)
1641+
clusterStatus.NodeClusterStatuses = append(clusterStatus.NodeClusterStatuses, nodeClusterStatus)
1642+
}
16371643
}
16381644

1639-
return nodeClusterStatuses, nil
1645+
return clusterStatus, nil
16401646
}

pkg/controller/scylladbdatacenter/resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,7 +2245,7 @@ func cloneMapExcludingKeysOrEmpty[M ~map[K]V, S ~[]K, K comparable, V any](m M,
22452245
return r
22462246
}
22472247

2248-
func MakeClusterStatusConfigMap(sdc *scyllav1alpha1.ScyllaDBDatacenter, nodeClusterStatuses []controllerhelpers.ClusterStatus) (*corev1.ConfigMap, error) {
2248+
func MakeClusterStatusConfigMap(sdc *scyllav1alpha1.ScyllaDBDatacenter, clusterStatus *controllerhelpers.ClusterStatus) (*corev1.ConfigMap, error) {
22492249
var err error
22502250

22512251
name, err := naming.ScyllaDBDatacenterClusterStatusesConfigMapName(sdc)
@@ -2254,9 +2254,9 @@ func MakeClusterStatusConfigMap(sdc *scyllav1alpha1.ScyllaDBDatacenter, nodeClus
22542254
}
22552255

22562256
buf := bytes.Buffer{}
2257-
err = json.NewEncoder(&buf).Encode(nodeClusterStatuses)
2257+
err = json.NewEncoder(&buf).Encode(clusterStatus)
22582258
if err != nil {
2259-
return nil, fmt.Errorf("can't encode node cluster statuses: %w", err)
2259+
return nil, fmt.Errorf("can't encode node cluster status: %w", err)
22602260
}
22612261

22622262
labels := cloneMapExcludingKeysOrEmpty(sdc.Labels, nonPropagatedLabelKeys)

pkg/controller/scylladbdatacenter/sync_clusterstatus.go

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ func (sdcc *Controller) syncClusterStatusConfigMap(
2525
var progressingConditions []metav1.Condition
2626
var err error
2727

28-
var nodeClusterStatuses []controllerhelpers.ClusterStatus
28+
var clusterStatus *controllerhelpers.ClusterStatus
2929
if clusterStatusOverrideConfigMapRef, ok := sdc.Annotations[naming.ScyllaDBClusterStatusOverrideConfigMapRefAnnotation]; ok {
3030
// TODO: move to func
31-
3231
overrideCM, err := sdcc.configMapLister.ConfigMaps(sdc.Namespace).Get(clusterStatusOverrideConfigMapRef)
3332
if err != nil {
3433
if !apierrors.IsNotFound(err) {
@@ -44,23 +43,26 @@ func (sdcc *Controller) syncClusterStatusConfigMap(
4443
return progressingConditions, nil
4544
}
4645

46+
var overrideClusterStatus controllerhelpers.ClusterStatus
4747
data, ok := overrideCM.Data[naming.ScyllaDBClusterStatusKey]
4848
if !ok {
4949
return progressingConditions, fmt.Errorf("missing %s key", naming.ScyllaDBClusterStatusKey)
5050
}
5151

52-
err = json.Unmarshal([]byte(data), &nodeClusterStatuses)
52+
err = json.Unmarshal([]byte(data), &overrideClusterStatus)
5353
if err != nil {
5454
return progressingConditions, fmt.Errorf("can't unmarshal cluster status: %w", err)
5555
}
56+
57+
clusterStatus = &overrideClusterStatus
5658
} else {
57-
nodeClusterStatuses, err = getNodeClusterStatuses(sdc, services)
59+
clusterStatus, err = getClusterStatus(sdc, services)
5860
if err != nil {
5961
return progressingConditions, fmt.Errorf("can't get node cluster statuses: %w", err)
6062
}
6163
}
6264

63-
requiredConfigMap, err := MakeClusterStatusConfigMap(sdc, nodeClusterStatuses)
65+
requiredConfigMap, err := MakeClusterStatusConfigMap(sdc, clusterStatus)
6466
if err != nil {
6567
return progressingConditions, fmt.Errorf("can't make cluster status configmap: %w", err)
6668
}
@@ -76,8 +78,11 @@ func (sdcc *Controller) syncClusterStatusConfigMap(
7678
return progressingConditions, nil
7779
}
7880

79-
func getNodeClusterStatuses(sdc *scyllav1alpha1.ScyllaDBDatacenter, services map[string]*corev1.Service) ([]controllerhelpers.ClusterStatus, error) {
80-
var nodeClusterStatuses []controllerhelpers.ClusterStatus
81+
func getClusterStatus(sdc *scyllav1alpha1.ScyllaDBDatacenter, services map[string]*corev1.Service) (*controllerhelpers.ClusterStatus, error) {
82+
clusterStatus := &controllerhelpers.ClusterStatus{
83+
ReplacingHostIDs: []string{},
84+
NodeClusterStatuses: []controllerhelpers.NodeClusterStatus{},
85+
}
8186

8287
for _, rack := range sdc.Spec.Racks {
8388
stsName := naming.StatefulSetNameForRack(rack, sdc)
@@ -96,22 +101,21 @@ func getNodeClusterStatuses(sdc *scyllav1alpha1.ScyllaDBDatacenter, services map
96101
continue
97102
}
98103

99-
nodeClusterStatusAnnotation, ok := svc.Annotations[naming.ClusterStatusAnnotation]
100-
if !ok {
101-
// The node might not have reported its status yet.
102-
// FIXME: should we wait? Sidecar would have to be moved to init containers.
103-
continue
104+
if replacingHostIDAnnotation, ok := svc.Annotations[naming.ReplacingNodeHostIDLabel]; ok {
105+
clusterStatus.ReplacingHostIDs = append(clusterStatus.ReplacingHostIDs, replacingHostIDAnnotation)
104106
}
105107

106-
var nodeClusterStatus controllerhelpers.ClusterStatus
107-
err = json.NewDecoder(strings.NewReader(nodeClusterStatusAnnotation)).Decode(&nodeClusterStatus)
108-
if err != nil {
109-
return nil, fmt.Errorf("can't decode annotation %q of service %q for ScyllaDBDatacenter %q: %w", naming.ClusterStatusAnnotation, naming.ManualRef(sdc.Namespace, svcName), naming.ObjRef(sdc), err)
110-
}
108+
if nodeClusterStatusAnnotation, ok := svc.Annotations[naming.NodeClusterStatusAnnotation]; ok {
109+
var nodeClusterStatus controllerhelpers.NodeClusterStatus
110+
err = json.NewDecoder(strings.NewReader(nodeClusterStatusAnnotation)).Decode(&nodeClusterStatus)
111+
if err != nil {
112+
return nil, fmt.Errorf("can't decode annotation %q of service %q for ScyllaDBDatacenter %q: %w", naming.NodeClusterStatusAnnotation, naming.ManualRef(sdc.Namespace, svcName), naming.ObjRef(sdc), err)
113+
}
111114

112-
nodeClusterStatuses = append(nodeClusterStatuses, nodeClusterStatus)
115+
clusterStatus.NodeClusterStatuses = append(clusterStatus.NodeClusterStatuses, nodeClusterStatus)
116+
}
113117
}
114118
}
115119

116-
return nodeClusterStatuses, nil
120+
return clusterStatus, nil
117121
}

pkg/naming/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const (
4747
// CleanupJobTokenRingHashAnnotation reflects which version of token ring cleanup Job is cleaning.
4848
CleanupJobTokenRingHashAnnotation = "internal.scylla-operator.scylladb.com/cleanup-token-ring-hash"
4949

50-
ClusterStatusAnnotation = "internal.scylla-operator.scylladb.com/cluster-status"
50+
NodeClusterStatusAnnotation = "internal.scylla-operator.scylladb.com/cluster-status"
5151
)
5252

5353
// Annotations used for feature backward compatibility between v1.ScyllaCluster and v1alpha1.ScyllaDBDatacenter

0 commit comments

Comments
 (0)