Commit Graph

366 Commits

Author SHA1 Message Date
Dmitrii Dolgov 9f51d7377b Use connection pool labels 2020-03-24 16:30:21 +01:00
Felix Kunde 0aff65ee6f fix typo 2020-03-20 11:33:33 +01:00
Dmitrii Dolgov f839806616 Address feedback
Set default numberOfInstances to 2. Add verifications for config. Fix
schema/user typos. Avoid closing an empty connections.
2020-03-19 16:56:04 +01:00
Dmitrii Dolgov 20b2fb4642 Defaults for user/schema fix
Verify the defaul values only if the schema doesn't override them.
2020-03-19 11:28:39 +01:00
Dmitrii Dolgov 48cdbb6a65 Minor improvements
* Set minimum number of pool instances to 2
* Improve logging of sync reasons
* Improve logging of a new pool role
2020-03-19 10:31:58 +01:00
Dmitrii Dolgov 1c7065e4ce Address feedback
Rename application for connection pool (ideally in the future make it
configurable). Take into accounts nils for MaxInt32
2020-03-17 11:33:56 +01:00
Dmitrii Dolgov cf6541b8cf Address feedback
Small typo-like fixes and proper installing of a lookup function in all
the databases.
2020-03-17 11:12:29 +01:00
Dmitrii Dolgov 4d61adf6b7 Merge branch 'master' into feature/connection-pooler 2020-03-16 12:07:56 +01:00
Dmitrii Dolgov 6d1a1ea22c Fix role sync if default pool user/schema changed
It requires more accurate lookup function synchronization and couple
fixes on the way (e.g. few get rid of using schema from a user secret).
For lookup function, since it's idempotend, sync it when we're not sure
if it was installed (e.g. when the operator was shutdown and start sync
everything at the start) and then remember that it was installed.
2020-03-13 14:34:54 +01:00
Felix Kunde b66734a0a9
omit PgVersion diff on sync (#860)
* use PostgresParam.PgVersion everywhere
* on sync compare pgVersion with SpiloConfiguration
* update getNewPgVersion and added tests
2020-03-13 11:48:19 +01:00
zimbatm 65fb2ce1a6
add support for custom TLS certificates (#798)
* add support for custom TLS certificates
2020-03-13 11:44:38 +01:00
Dmitrii Dolgov c0a840c3ed Sync other way around 2020-03-09 14:05:04 +01:00
Dmitrii Dolgov 2e023799e1 Fix tests
To have necessary number of replicas set
2020-03-06 14:35:31 +01:00
Dmitrii Dolgov e6f1e8b7fc Merge branch 'master' into feature/connection-pooler 2020-03-06 13:40:15 +01:00
Dmitrii Dolgov 80fee17ea4 Various fixes
Sync pool user correctly, without overriding it.
Fix numberOfInstances comparison in defaults.
Fix maxDBConnections usage.
2020-03-06 13:32:04 +01:00
Dmitrii Dolgov ab118dd78b Prevent operator from wrongly syncing pooler user 2020-03-05 17:31:04 +01:00
Dmitrii Dolgov e645ca5c23 Prevent original labels from update 2020-03-05 14:36:13 +01:00
Dmitrii Dolgov 07adaf28cc Extend labels for connection pool 2020-03-05 10:32:20 +01:00
Dmitrii Dolgov a38a5aa574 Add test for sync with flag 2020-03-05 10:12:10 +01:00
Dmitrii Dolgov e0df9dea0c Sync in case of missing deployment
If nothing changed we still need to try to sync and test if the
deployment is there. Otherwise it could be deleted, and operator will
not notice.
2020-03-04 16:07:22 +01:00
Dmitrii Dolgov 918df1461b Add possibility to set max db connections
Since it's an important part of a connection pool configuration, allow
to configure max db connections, that pool will open to a target db.
From this numbers several others (like default pool size, min pool size,
reserve) will be deduced, taking into account desired number of instances.
2020-03-03 15:58:33 +01:00
Dmitrii Dolgov 037d7120ef Sync due to defaults
Since we can miss it while checking only spec
2020-03-02 16:32:15 +01:00
Dmitrii Dolgov 3e98832703 Add more tests
sync logic
system users init
needConnectionPool
2020-02-24 16:20:59 +01:00
Felix Kunde b997e3682f
be more permissive with standbys (#842)
* be more permissive with standbys
* reflect feedback and updated docs
2020-02-24 15:14:14 +01:00
Felix Kunde cf85db5d7a merge with master and resolve conflict 2020-02-20 10:09:13 +01:00
Felix Kunde 742d7334a1
use cluster-name as default label everywhere (#782)
* use cluster-name as default label everywhere
* fix e2e test
2020-02-19 15:01:01 +01:00
Dmitrii Dolgov 66129335fd Adjust sync logic 2020-02-19 14:53:58 +01:00
Dmitrii Dolgov 97217e27ed Delete if a new specification is nil
Use coalesce for username too.
2020-02-17 15:34:10 +01:00
Dmitrii Dolgov 35d82e5a17 Do sync also when there are no deployment 2020-02-17 14:28:38 +01:00
Dmitrii Dolgov 4add317b48 Merge branch 'master' into feature/connection-pooler 2020-02-17 13:11:57 +01:00
Dmitrii Dolgov 515bb2dfad Address review, add ConnectionPool init for sync 2020-02-17 13:07:40 +01:00
Felix Kunde 702a194c41
switch to rbac/v1 (#829)
* switch to rbac/v1
2020-02-17 11:25:07 +01:00
Dmitrii Dolgov a9d02bacc4 Address review 2020-02-14 14:20:35 +01:00
Dmitrii Dolgov 0095be0279 Fix uninitialized ConnectionPool structure usage
It's being used quite early to setup a connection pool user, and if only
enableConnectionPool specified, can be nil.
2020-02-14 13:04:24 +01:00
Dmitrii Dolgov e11f787664 Rename replicas to avoid potential confusion about terminology 2020-02-13 16:34:02 +01:00
Felix Kunde 3b10dc645d
patch/update services on type change (#824)
* use Update when disabling LoadBalancer + added e2e test
2020-02-13 16:24:15 +01:00
Dmitrii Dolgov 6dad83325b Cleanup configuration
Add pool configuration into CRD & charts. Add preliminary documentation.
Rename NumberOfInstances to Replicas like in Deployment. Mention couple
of potential improvement points for connection pool specification.
2020-02-13 13:36:14 +01:00
Dmitrii Dolgov 55873f06be Add test for both ways to enable connection pool 2020-02-13 11:04:11 +01:00
Dmitrii Dolgov 6c3752068b Various improvements
Add synchronization logic. For now get rid of podTemplate, type fields.
Add crd validation & configuration part, put retry on top of lookup
function installation.
2020-02-12 17:35:43 +01:00
Dmitrii Dolgov b40ea2c426 Add more tests 2020-02-12 17:31:10 +01:00
Dmitrii Dolgov 2b2f29ff0b Add CRD configuration
With convertion for config, and start tests.
2020-02-12 17:31:10 +01:00
Dmitrii Dolgov 4c69b2b996 Improve cleaning up
Set up a proper owner reference to StatefulSet, and delete with
foreground policy to not leave orphans.
2020-02-12 17:31:10 +01:00
Dmitrii Dolgov fb43ee92d6 WIP Connection pooler support
Add an initial support for a connection pooler. The idea is to make it
generic enough to be able to switch a corresponding docker image to
change from pgbouncer to e.g. odyssey. Operator needs to create a
deployment with pooler and a service for it to access.
2020-02-12 17:31:10 +01:00
Jonathan Juares Beber ba60e15d07 Add ServiceAnnotations cluster config (#803)
The [operator parameters][1] already support the
`custom_service_annotations` config.With this parameter is possible to
define custom annotations that will be used on the services created by the
operator. The `custom_service_annotations` as all the other
[operator parameters][1] are defined on the operator level and do not allow
customization on the cluster level. A cluster may require different service
annotations, as for example, set up different cloud load balancers
timeouts, different ingress annotations, and/or enable more customizable
environments.

This commit introduces a new parameter on the cluster level, called
`serviceAnnotations`, responsible for defining custom annotations just for
the services created by the operator to the specifically defined cluster.
It allows a mix of configuration between `custom_service_annotations` and
`serviceAnnotations` where the latest one will have priority. In order to
allow custom service annotations to be used on services without
LoadBalancers (as for example, service mesh services annotations) both
`custom_service_annotations` and `serviceAnnotations` are applied
independently of load-balancing configuration. For retro-compatibility
purposes, `custom_service_annotations` is still under
[Load balancer related options][2]. The two default annotations when using
LoadBalancer services, `external-dns.alpha.kubernetes.io/hostname` and
`service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout` are
still defined by the operator.
`service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout` can
be overridden by `custom_service_annotations` or `serviceAnnotations`,
allowing a more customizable environment.
`external-dns.alpha.kubernetes.io/hostname` can not be overridden once
there is no differentiation between custom service annotations for
replicas and masters.

It updates the documentation and creates the necessary unit and e2e
tests to the above-described feature too.

[1]: https://github.com/zalando/postgres-operator/blob/master/docs/reference/operator_parameters.md
[2]: https://github.com/zalando/postgres-operator/blob/master/docs/reference/operator_parameters.md#load-balancer-related-options
2020-02-10 12:03:25 +01:00
Vito Botta a660d758a5 Add region setting for logical backups to non-AWS storage (#813)
* Add region setting for logical backups to non-AWS storage
2020-02-10 11:48:24 +01:00
Felix Kunde 1f0312a014
make minimum limits boundaries configurable (#808)
* make minimum limits boundaries configurable
* add e2e test
2020-02-03 11:43:18 +01:00
Felix Kunde 7fb163252c
standby clusters can only have 1 pod for now (#797) 2020-01-16 10:47:34 +01:00
Felix Kunde cd110aabf4
Enforce minimum cpu and memory limits (#731)
* add validation for PG resources and volume size
* check resource requests also on UPDATE and SYNC + update docs
* if cluster was running don't error on sync
2019-12-12 16:43:55 +01:00
Felix Kunde 107334fe71
Add global option to enable/disable init containers and sidecars (#478)
* Add global option to enable/disable init containers and sidecars
* update dependencies
2019-12-10 15:45:54 +01:00
Armin Nesiren 5f87384d7f Passing endpoint, access and secret key to logical-backup container (#628)
* Added possibility to add custom annotations to LoadBalancer service.

* Added parameters for custom endpoint, access and secret key for logical backup.

* Modified dump.sh so it knows how to handle new features. Configurable S3 SSE
2019-11-26 10:40:49 +01:00