-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix connection pooler deployment selectors #1213
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
Conversation
…r deployment selector.
pkg/cluster/connection_pooler.go
Outdated
| // 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 { |
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 we can rename this function now to not be called "Selector" - that would be more fitting
e2e/tests/test_e2e.py
Outdated
| } | ||
| }) | ||
|
|
||
| time.sleep(10) |
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.
no more sleeps, artificially slowing things down. lets talk about the issue here
pkg/cluster/connection_pooler.go
Outdated
| podTemplate := &v1.PodTemplateSpec{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Labels: c.connectionPoolerLabelsSelector(role).MatchLabels, | ||
| Labels: c.connectionPoolerLabels(role, false).MatchLabels, |
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.
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 |
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.
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`
|
👍 |
|
👍 |
1 similar comment
|
👍 |
The currently generated deployment selectors are not correct, including too many labels.
The selector should include:
application: db-connection-poolerconnection-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.