Skip to content

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

Merged
merged 31 commits into from
Dec 3, 2021
Merged

227 standby clusters #289

merged 31 commits into from
Dec 3, 2021

Conversation

eberlep
Copy link
Collaborator

@eberlep eberlep commented Nov 3, 2021

No description provided.

@eberlep eberlep linked an issue Nov 29, 2021 that may be closed by this pull request
@@ -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"`
Copy link
Contributor

Choose a reason for hiding this comment

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

PostgresConnectionSpec

Copy link
Collaborator Author

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

ConnectedPostgresID string `json:"connectedPostgresID,omitempty"`
ConnectionSecretName string `json:"secretName,omitempty"`

ConnectionMethod string `json:"method,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably canditate for removal

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Replaced with hardcoded string :-)

@@ -656,6 +690,14 @@ func setSharedBufferSize(parameters map[string]string, shmSize string) {
}
}

func (p *Postgres) IsPrimaryLeader() bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

IsReplicationPrimary

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

renamed

"context"
"encoding/json"
goerrors "errors"
Copy link
Contributor

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

Copy link
Collaborator Author

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"
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Collaborator Author

@eberlep eberlep Dec 2, 2021

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
Copy link
Contributor

Choose a reason for hiding this comment

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

check for update

Copy link
Collaborator Author

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)
Copy link
Contributor

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


ConnectionMethod string `json:"method,omitempty"`
ConnectionIP string `json:"ip,omitempty"`
ConnectionPort int32 `json:"port,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

uint8 ?

Copy link
Collaborator Author

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 :-)

@majst01 majst01 marked this pull request as ready for review December 3, 2021 12:26
@majst01 majst01 merged commit fa2e82b into main Dec 3, 2021
@majst01 majst01 deleted the 227-standby-clusters branch December 3, 2021 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standby Clusters
2 participants