Skip to content

Conversation

@Jan-M
Copy link
Member

@Jan-M Jan-M commented Nov 13, 2020

The currently generated deployment selectors are not correct, including too many labels.

The selector should include:

application: db-connection-pooler
connection-pooler: <name><-repl>

These two elements identify all the pods belonging to the deployment. Compare with the test manifest.

When the operator behaves properly the included e2e test should be green, and the deployment adjusted.

This PR should ideally also contain some documentation on the involved objects and their labels:
deployments and service come to mind, and the statefulset could also be mentioned, having similar selector.

// not interfere with it (it lists all the pods via labels, and if there would
// be no difference, it will recreate also pooler pods).
func (c *Cluster) connectionPoolerLabelsSelector(role PostgresRole) *metav1.LabelSelector {
func (c *Cluster) connectionPoolerLabelsSelector(role PostgresRole, moreLabels bool) *metav1.LabelSelector {
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we can rename this function now to not be called "Selector" - that would be more fitting

}
})

time.sleep(10)
Copy link
Member Author

Choose a reason for hiding this comment

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

no more sleeps, artificially slowing things down. lets talk about the issue here

podTemplate := &v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: c.connectionPoolerLabelsSelector(role).MatchLabels,
Labels: c.connectionPoolerLabels(role, false).MatchLabels,
Copy link
Member

Choose a reason for hiding this comment

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

question here is: Does it have to be the same list of what's in the selector? Or has the selector only be contained in the pod template label list (for watching)

metadata:
labels:
application: db-connection-pooler
connection-pooler: acid-minimal-cluster-pooler
Copy link
Member Author

Choose a reason for hiding this comment

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

 kubectl create -f minimal-fake-pooler-deployment.yaml
The Deployment "acid-minimal-cluster-pooler" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"application":"db-connection-pooler", "connection-pooler":"acid-minimal-cluster-pooler"}: `selector` does not match template `labels`

@Jan-M
Copy link
Member Author

Jan-M commented Nov 23, 2020

👍

@Jan-M
Copy link
Member Author

Jan-M commented Nov 23, 2020

👍

1 similar comment
@FxKu
Copy link
Member

FxKu commented Nov 23, 2020

👍

@Jan-M Jan-M merged commit c4ae116 into master Nov 23, 2020
@FxKu FxKu added this to the 1.6 milestone Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants