-
Notifications
You must be signed in to change notification settings - Fork 0
227 standby clusters #289
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
227 standby clusters #289
Conversation
…o struct and switched from bool pointer to bool
…deletion of standby cwnps
api/v1/postgres_types.go
Outdated
@@ -152,6 +154,9 @@ type PostgresSpec struct { | |||
// BackupSecretRef reference to the secret where the backup credentials are stored | |||
BackupSecretRef string `json:"backupSecretRef,omitempty"` | |||
|
|||
// PostgresConnectionInfo Connection info of a streaming host, independant of the current role (leader or standby) | |||
PostgresConnectionInfo *PostgresConnectionInfo `json:"connectionInfo,omitempty"` |
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.
PostgresConnectionSpec
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.
Renamed to PostgresConnection
and connection
respectively
api/v1/postgres_types.go
Outdated
ConnectedPostgresID string `json:"connectedPostgresID,omitempty"` | ||
ConnectionSecretName string `json:"secretName,omitempty"` | ||
|
||
ConnectionMethod string `json:"method,omitempty"` |
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.
Probably canditate for removal
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.
Replaced with hardcoded string :-)
api/v1/postgres_types.go
Outdated
@@ -656,6 +690,14 @@ func setSharedBufferSize(parameters map[string]string, shmSize string) { | |||
} | |||
} | |||
|
|||
func (p *Postgres) IsPrimaryLeader() bool { |
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.
IsReplicationPrimary
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.
renamed
controllers/postgres_controller.go
Outdated
"context" | ||
"encoding/json" | ||
goerrors "errors" |
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.
remove this alias and create alias to apierros in line 27
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.
renamed errors
to apierrors
, goerrors
to errors
, and used corev1
instead of v1
(which was the same import anyway)
return goerrors.New("no master pods found") | ||
} | ||
podIP := pods.Items[0].Status.PodIP | ||
podPort := "8008" |
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.
Maybe make this configurable
@@ -113,6 +113,8 @@ func (r *StatusReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr | |||
log.Info("unable to fetch the corresponding Service of type LoadBalancer") | |||
} | |||
|
|||
// TODO also update the port/ip of databases mentioned in owner.Spec.PostgresConnectionInfo so that e.g. CWNP are always up to date |
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.
review and delete if not required anymore
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.
I think we still need this.
When the Status of the ressource changes, we also update the ip and port information in the status field.
If there is a connected database, the configured ip and port would not updated currently. So in the rare case a postgres gets another port (or even another ip), the connected postgres has an outdated configuration. this would only be updated if someone made changes to that connected postgres' custom ressource.
go.mod
Outdated
sigs.k8s.io/yaml v1.2.0 // indirect | ||
) | ||
|
||
replace github.com/zalando/postgres-operator v1.6.3 => github.com/ermajn/postgres-operator v1.0.1-0.20210219114944-b6ce92e629f6 |
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.
check for update
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.
Updated dep to dirty image, allowing us to set the new StandbyApplicationName
as well.
@@ -137,6 +139,10 @@ func main() { | |||
viper.SetDefault(majorVersionUpgradeModeFlg, "manual") | |||
majorVersionUpgradeMode = viper.GetString(majorVersionUpgradeModeFlg) | |||
|
|||
// read the (space-separated) list of configured blocked params | |||
viper.SetDefault(standbyClustersSourceRangesFlg, "255.255.255.255/32") | |||
standbyClusterSourceRanges = viper.GetStringSlice(standbyClustersSourceRangesFlg) |
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.
check if result slice entries are trimmed
api/v1/postgres_types.go
Outdated
|
||
ConnectionMethod string `json:"method,omitempty"` | ||
ConnectionIP string `json:"ip,omitempty"` | ||
ConnectionPort int32 `json:"port,omitempty"` |
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.
uint8 ?
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.
uint16
. don't ask how i know :-)
No description provided.