Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis replicationFactor/replicaNodes immutable #677

Merged
merged 1 commit into from
Jan 25, 2024
Merged

Redis replicationFactor/replicaNodes immutable #677

merged 1 commit into from
Jan 25, 2024

Conversation

worryg0d
Copy link
Collaborator

This PR provides immutability for the replicationFactor and replicaNodes fields of the Redis data centre.

Also, it provides automatical reconcile of external changes of the k8s resource spec equals to instaclustr resource spec.

closes #676

Comment on lines 68 to 75
if dataCentre.ReplicationFactor > 0 && dataCentre.NodesNumber == 0 {
dataCentre.NodesNumber = dataCentre.MasterNodes * dataCentre.ReplicationFactor
} else if dataCentre.NodesNumber > 0 && dataCentre.ReplicationFactor == 0 {
dataCentre.ReplicationFactor = dataCentre.NodesNumber / dataCentre.MasterNodes
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the replication factor and nodes number are equal to 0, I assume that we create master nodes only, am I right?

Copy link
Collaborator Author

@worryg0d worryg0d Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are

Comment on lines 68 to 69
fmt.Println("DEFAULTER")
fmt.Println("nodes number", dataCentre.NodesNumber)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it pls

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -869,9 +869,22 @@ func (r *RedisReconciler) newWatchStatusJob(redis *v1beta1.Redis) scheduler.Job
}
}

if iRedis.Status.CurrentClusterOperationStatus == models.NoOperation &&
equals := redis.Spec.IsEqual(iRedis.Spec)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add this logic to the rest Kinds

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already fixed

@worryg0d worryg0d force-pushed the issue-676 branch 2 times, most recently from 99a3b4e to f270654 Compare January 22, 2024 10:28
@worryg0d worryg0d requested a review from ribaraka January 22, 2024 10:29
@ribaraka ribaraka merged commit b0b9418 into main Jan 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redis replicationFactor/replicaNodes immutable
4 participants