-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add read replica rotator #2241
Add read replica rotator #2241
Conversation
[WARNING:INTCFG] Changes in |
[CHATOPS:HELP] ChatOps commands.
|
Observability *config.Observability `json:"observability" yaml:"observability"` | ||
|
||
// TODO: | ||
ReadreplicaRotate *config.ReadreplicaRotate `json:"rotator" yaml:"rotator"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReadreplicaRotate *config.ReadreplicaRotate `json:"rotator" yaml:"rotator"` | |
ReadReplicaRotate *config.ReadreplicaRotate `json:"rotator" yaml:"rotator"` |
🤔 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if replicaID == "" { | ||
return nil, fmt.Errorf("readreplica id is empty. it should be set via MY_TARGET_REPLICA_ID env var") | ||
} | ||
r.readReplicaID = replicaID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use functional options e.g. func() WithReplicaID(id string) error {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because replicaID
is mandatory. Let's merge this first and discuss it later.
* Implement sample read replica rotation logic * Add external-snapshotter in go.mod * Add readreplica initial implementation * Add service implementation of readreplica rotator * Add readreplica rotate config * Refactor to read labels * replace id to _MY_TARGET_REPLICA_ID_ * Add snapshot k8s client * Format * Fix snapshot client initialization * Add Apache License to main.go * Use GetConfigOrDie * Use internal/k8s client * Refactor * Use controller-runtime for CRUD in readreplica * Remove snapshot client and use controller-runtime * Move LabelSelector into internal/k8s * Report error to span * Update go modules * Remove old example * Refactor * Disable exhaustruct for now * Fix predeclared * Fix stylecheck * nolint:gomnd * Add test template * Add test for getNewBaseName * fix misspelling * Apply format * Fix camel case
Description:
This PR implements read replica rotation algorithm. Tests will be added when job is implemented after this PR.
Related Issue:
Versions:
Checklist:
Special notes for your reviewer: