Commit Graph

890 Commits

Author SHA1 Message Date
Felix Kunde 4534a4cd9e
fix syncing of stream CRDs (#2152)
* fix syncing of stream CRDs and improve corresponding unit tests
2022-12-30 13:09:15 +01:00
Felix Kunde c1657ec484
stream resource name must be lower case (#2149) 2022-12-29 16:55:18 +01:00
Felix Kunde e80cccb93b
use random short name for stream CRDs (#2137)
* use random short name for stream CRDs
2022-12-27 16:52:01 +01:00
Felix Kunde 3e148ea57e
enable operator support for pg15 and drop support for 9.5 and 9.6 (#2140)
* enable operator support for pg15 and drop support for 9.5 and 9.6
* not offer 15 in UI before spilo-15 is available
2022-12-15 12:17:27 +01:00
Felix Kunde 0bef3b325f
fix migration of single-node clusters (#2134) 2022-12-09 12:42:10 +01:00
Polina Bungina 4d585250db
Add Patroni failsafe_mode parameter (#2076)
This commit adds support of a not-yet-released Patroni feature that allows postgres to run as primary in case of a failed leader lock update.
* Add Patroni 'failsafe_mode' local parameter (enable for a single PG cluster)
* Allow configuring Patroni 'failsafe_mode' parameter globally
2022-12-02 13:33:02 +01:00
Felix Kunde 1d44dd4694
delete secret resource from map (#2123) 2022-12-02 10:09:19 +01:00
Felix Kunde 528bb81a78
first sync wal_level then publications (#2109) 2022-11-28 16:37:34 +01:00
yoshihikoueno c895e8f61f
Bumped Spilo 14 image tag to 2.1-p7 (#2096)
* Bumped Spilo 14 image tag to 2.1-p7

Co-authored-by: yoshihiko <ariyoshi10@gmail.com>
2022-11-03 10:57:33 +01:00
Felix Kunde 529cdfc0b6
skip slots where publication sync failed (#2091) 2022-10-25 14:51:29 +02:00
Felix Kunde 70f3ee8e36
skip db sync on failed initUsers during UPDATE (#2083)
* skip db sync on failed initUsers during UPDATE
* provide unit test for teams API being unavailable
* add test for 404 case
2022-10-21 17:50:14 +02:00
Felix Kunde d55e74e1e7
create publication before creating logical replication slot (#2085) 2022-10-21 14:31:13 +02:00
machine424 640581fb46
Fix the Operator rolling update statefulsets unnecessary whien Kube API down (#2031) (#2064) 2022-10-18 10:55:25 +02:00
Polina Bungina acb3ffd702
Fix upgrade command (#2075)
Upgrade run using postgres user used to be broken by an invalid option.
Move -o pipefail directly to upgradeCommand.
+ minor formatting corrections
2022-10-17 17:36:02 +02:00
Dmitry Volodin a85023ff10
Cluster env variables should be reflected for StatefulSet update (#2045)
* Cluster env variables should be reflected for StatefulSet update
* Add unit test for comparing StatefulSet's
2022-10-13 13:54:58 +02:00
Felix Kunde 4786f53f03
Fix password rotation (#2043)
* fix password rotation
* test connection with rotation user in e2e test + minor changes
2022-10-13 11:33:26 +02:00
Felix Kunde ce8b009c66
fix team member deprecation (#2072) 2022-10-11 18:02:41 +02:00
Philipp B 84fe38a069
switch to batch API v1 for Jobs (#2066) 2022-10-07 11:27:58 +02:00
Felix Kunde 2aa52094db
switch to policy API v1 for PDBs (#2008)
* switch to policy API v1 for PDBs
* update e2e test dependencies
* use kind 0.14.0
* bump K8s client in e2e docker image
* bump e2e tests-runner
2022-10-06 09:43:17 +02:00
Felix Kunde a119772efb
add toggle to turn off readiness probes (#2004)
* add toggle to turn off readiness probes
* include PodManagementPolicy and ReadinessProbe in stateful set comparison
* add URI scheme to generated readiness probe
2022-10-05 18:25:24 +02:00
Jan Mussler b48034d762
Fix major version upgrade return code (#2056)
Fix major version upgrade return code
2022-09-21 15:25:24 +02:00
Felix Kunde e0c4603057
create streams only after postgres instances were restarted (#2034)
* create streams only after postgres instances were restarted
* checkAndSetGlobalPostgreSQLConfiguration returns if config has been patched
* restart can be pending even without a config patch
2022-09-19 15:25:55 +02:00
Felix Kunde d209612b18 use correct keys in updateSecret (#2029) 2022-09-01 10:58:42 +02:00
Felix Kunde 4c07494ac7
deprecate ClusterName field of Postgresql type and remove team from REST endpoints (#2015)
* deprecate ClusterName field of Postgresql type
* remove for teamId from operator API endpints /status /logs /history
* update dns_format_string and yaml template in UI
2022-08-29 15:00:25 +02:00
Felix Kunde 89375186b3
use old LB DNS format when teamId prefix is disabled (#2011)
* use old LB DNS format when teamId prefix is disabled
* support both old and new format in external-dns
* switch dns template from team to namespace
2022-08-25 18:29:54 +02:00
Felix Kunde 21d00e2ed7
rework map selection in updateSecret (#2010) 2022-08-24 17:33:39 +02:00
Felix Kunde ef324494a0
fetch pooler and fes_user system user only when corresponding features are used (#2009)
* fetch pooler and fes_user system user only when corresponding features are used
* cover error case in unit test
* use string formatting instead of +
2022-08-24 16:28:49 +02:00
Felix Kunde 3bfd63cbe6
Make teamId in cluster name optional (#2001)
* making teamId in clustername optional
* move teamId check to addCluster function
2022-08-24 10:12:50 +02:00
JBWatenbergScality b91b69c736
BugFix: Switchover (during a Node drain) fails randomly in synchronous mode (#1984)
* Use getSwitchoverCandidate instead of masterCandidate when trying to migrating master pod to a replica
Ref: #1983

* Remove unused masterCandidate (replaced by getSwitchoverCandidate)
Ref: #1983
2022-08-19 15:14:53 +02:00
Felix Kunde b2642fa2fc
allow in place pw rotation of system users (#1953)
* allow in place pw rotation of system users
* block postgres user from rotation
* mark pooler pods for replacement
* adding podsGetter where pooler is synced in unit tests
* move rotation code in extra function
2022-08-18 14:14:31 +02:00
Felix Kunde 88a2931550
bump pooler image to use new alpine base image (#1985)
* bump pooler image to use new alpine base image
* use a safe default for PGHOST pooler env variable
2022-08-08 17:36:43 +02:00
Jociele Padilha b41daf4f76
Set maximum CPU and Memory requests on K8s (#1959)
* Set maximum CPU and Memory requests on K8s
2022-07-28 14:18:27 +02:00
Felix Kunde 1c80ac0acd
add storage_resize_mode mixed to opConfig CRD (#1947) 2022-07-08 11:49:06 +02:00
Felix Kunde 5e4badd99c
annotation to bypass globally configured instance limits (#1943) 2022-06-30 10:40:03 +02:00
Felix Kunde 6d0117b662
bump to v1.8.2 (#1932)
* bump to v1.8.2
* update opconfig docs around pod environment secret
* fix z-index of UI tooltip
2022-06-20 14:37:21 +02:00
Felix Kunde 7d4da92872
bring back CLONE_WAL_BUCKET_SCOPE_PREFIX (#1902) 2022-05-24 16:27:34 +02:00
Felix Kunde 7c878f8aaa
bump to v1.8.1 (#1884)
* bump to v1.8.1
* quote users in REVOKE stmt
2022-05-20 12:08:41 +02:00
Felix Kunde 97be5ee1cb
use uint64 for replication lag from Patroni's member endpoint (#1893)
* use int64 for replication lag from Patroni's member endpoint
2022-05-19 09:39:56 +02:00
mujx 5dc963105c
Fix typo (#1897) 2022-05-18 17:47:05 +02:00
Felix Kunde 268a86a045
removing inner goroutine in cluster.Switchover (#1876)
* removing inner goroutine in cluster.Switchover and resolve race between processPodEvent and unregisterPodSubscriber
* unlock mutex after handling event, now with non-blocking default case
2022-05-17 18:10:39 +02:00
Felix Kunde c6f2c68588
ignore case when checking for envVar existence but do not change it (#1889) 2022-05-12 11:59:05 +02:00
Felix Kunde a77d5df158
reverse membership for additional owner roles (#1862)
* reverse membership for additional owner roles
* remove type RoleOriginSpilo
* use e2e images with cron_admin inside
* let operator resolve reversed membership
* make additional owner roles part of the sync user strategy
* add more context in the docs about additional_owner_roles
2022-04-28 11:15:40 +02:00
Felix Kunde 9eb7517218
sync CRD with example manifests (#1869) 2022-04-25 18:16:05 +02:00
Felix Kunde 8b6664f1a2
fix container ports (#1864) 2022-04-21 18:52:53 +02:00
Felix Kunde cde88d3711
bump to v1.8.0 (#1852)
* bump to v1.8.0
* fix helm instructions for ui
* update UI version package.json
* update ui chart
2022-04-20 18:30:23 +02:00
Felix Kunde 532772c5cd
do not call EBS api when there are no pvs (#1851)
* do not call EBS api when there are no pvs
* no extra aws api call in executeEBSMigration, operate on fetched cluster.EBSVolumes
2022-04-20 12:12:02 +02:00
Felix Kunde eecd13169c
refactor spilo env var generation (#1848)
* refactor spilo env generation
* enhance docs on env vars
* add unit test for appendEnvVar
2022-04-14 11:47:33 +02:00
Jociele Padilha 483bf624ee
add test team member (#1842)
* return err if teams API fails with StatusCode other than 404
* add unit test for 404 at team members

Co-authored-by: Jociele Padilha <jociele.padilha@zalando.de>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2022-04-14 10:02:54 +02:00
Dmitry Volodin 9bcb25ac7e
Ability to set pod environment variables on cluster resource (#1794)
* Ability to set pod environment variables on cluster resource

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2022-04-11 10:16:35 +02:00
Oleg 7ac9c2a98e
Bump spilo-14:2.1-p4 (#1836)
Co-authored-by: Oleg Galantsev <oleg.galantsev@t-systems.com>
2022-04-05 11:07:34 +02:00
Felix Kunde 0dc370f15d
standby cluster that streams from a remote primary (#1830)
* add the possibility to create a standby cluster that streams from a remote primary
* extending unit tests
* add more docs and e2e test

Co-authored-by: machine424 <ayoubmrini424@gmail.com>
2022-04-04 15:41:11 +02:00
Jociele Padilha 2dfb11ad4c
update team message (#1818)
* return only warning if team can't be found

Co-authored-by: Jociele Padilha <jociele.padilha@zalando.de>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2022-04-04 13:08:03 +02:00
neelasha-09 f5cca1a093
major version upgrade for rootless and ocp : solving #1689 (#1770)
* major version upgrade for rootless and ocp : solving #1689

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2022-03-31 14:53:02 +02:00
Felix Kunde 2333d531d3
Fix deletion of event streams resources (#1831)
* fix deletion of event streams
* create cluster field to store stream application ids
2022-03-31 11:48:37 +02:00
Felix Kunde 60e0685c32
define readinessProbe on statefulSet (#1825)
* define readinessProbe on statefulSet 
* do not error out on deleting Patroni cluster objects
* change delete order for patroni objects
2022-03-30 18:19:34 +02:00
evsasha 30f2ba6525
do not create endpoints when use config maps (#1760)
* do not create endpoints when use config maps
* delete cluster objects with 'leader' suffix

Co-authored-by: Евграфов Александр Александрович <aevgrafov@cmx.ru>
2022-03-28 10:09:26 +02:00
Felix Kunde 654d22d04a
Configure annotations to be ignored in comparisons during sync (#1823)
* feat: add ignored annotations when comparing during sync

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
Co-authored-by: Moshe Immerman <moshe@flanksource.com>
2022-03-24 18:38:37 +01:00
Felix Kunde 36df1bc87c
refactor GenerateResourceRequirements and provide unit tests (#1822)
* refactor GenerateResourceRequirements and provide unit tests
2022-03-24 17:35:00 +01:00
preved911 38db48c7f0
fixing toleration fields requirements (#1797)
Signed-off-by: Ildar Valiullin <preved.911@gmail.com>
2022-03-21 16:05:45 +01:00
Felix Kunde a020708ef1
fix unit test and improve stability in e2e test (#1819)
* fix unit test and improve stability in e2e test
* fix resource handling
2022-03-21 10:05:20 +01:00
Jakob Gillich f3b83c0b05
Fix empty resources spec field failing schema validation (#1589)
In Go, when a struct field is not set, it becomes a struct with
default values for all fields. These default values are included
during serialization. This causes issues with schema validation
where optional fields cannot be omitted because default values
are considered invalid.

This patch addresses this issue for `Resources` fields on several
types by using a pointer value.
2022-03-18 16:16:32 +01:00
Felix Kunde 1d88009ec4
fix comparison of event stream array (#1817)
* fix comparison of event stream array
* turn optional stream fields to pointers
2022-03-18 15:06:17 +01:00
Felix Kunde 2719d411c3
grant db owners to cron_admin (#1805)
* grant db owners to cron_admin
* allow specifiying more extra owner roles
* add unit test for InitAdditionalOwnerRoles
* add e2e test
2022-03-18 12:36:12 +01:00
Felix Kunde 6ba05fee22
Pooler sync fix (#1811)
* always sync pooler objects
* do not capitalize log messages in Go
* stretch pooler e2e test
2022-03-17 19:22:18 +01:00
Jociele Padilha 69254abeba
add new parameter for Patroni API (PatroniAPICheckInterval, PatroniAPICheckTimeout) (#1803)
Co-authored-by: Jociele Padilha <jociele.padilha@zalando.de>
2022-03-15 11:34:09 +01:00
Felix Kunde d032e4783e
LoadBalancer toggles for master and replica pooler pods (#1799)
* Add support for pooler load balancer

Signed-off-by: Sergey Shatunov <me@prok.pw>

* Rename to enable_master_pooler_load_balancer

Signed-off-by: Sergey Shatunov <me@prok.pw>

* target port should be intval
* enhance pooler e2e test
* add new options to crds.go

Co-authored-by: Sergey Shatunov <me@prok.pw>
2022-03-04 13:36:17 +01:00
A. Stoewer 695ad44caf
Logical backup retention time (#1337)
* Add optional logical backup retention time
* Set defaults for potentially unbound variables, so that the script will work with older operator versions
* Document retention time parameter for logical backups
* Add retention time parameter to resources and charts

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2022-03-02 17:39:33 +01:00
david amick ca0c27a51b
Retry when getting the pod_environment_secret (#1777)
* Retry when getting the pod_environment_secret
2022-03-01 17:56:16 +01:00
Dmitry Volodin da83982313
inherited_labels and inherited_annotations not passed to PVC (#1784)
* inherited_labels and inherited_annotations not passed to PVC
* Fix developer.md related to the local operator deployment
2022-03-01 17:07:37 +01:00
Maksim Zhylinski fb8a6c7a68
Compare container ports in a smarter way (#1755)
* Compare ports ingoring order and considering protocol defaults

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2022-02-28 11:35:41 +01:00
Felix Kunde d8a159ef1a
create CDC event stream CRD (#1570)
* provide event stream API
* check manifest settings for logical decoding before creating streams
* operator updates Postgres config and creates replication user
* name FES like the Postgres cluster
* add delete case and fix updating streams + update unit test
* check if fes CRD exists before syncing
* existing slot must use the same plugin
* make id and payload columns configurable
* sync streams only when they are defined in manifest
* introduce applicationId for separate stream CRDs
* add FES to RBAC in chart
* disable streams in chart
* switch to pgoutput plugin and let operator create publications
* reflect code review and additional refactoring

Co-authored-by: Paŭlo Ebermann <paul.ebermann@zalando.de>
2022-02-28 10:09:42 +01:00
Felix Kunde 8b404fd049
minor fixes to password rotation (#1796)
* minor fixes to password rotation
* rework unit test
2022-02-25 17:46:26 +01:00
Menzorg 06c28da97d
synchronous_node_count support (#1484)
* synchronous_node_count support
* notification about Patroni image version
* default synchronous_node_count to 1

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2022-02-25 17:21:42 +01:00
Felix Kunde 46547c4088
do not recreate pods if previous Patroni API calls fail (#1767)
* do not recreate pods if previous Patroni API calls fail
* move retry reads against Patroni API to pod.go
* remove final failover check in node affinity test
* make test_min_resource_limits more robust
2022-02-25 09:33:04 +01:00
Felix Kunde 3ce0b1e7fa
deprecate crd validation toggle and sync with manifests (#1781)
* deprecate crd validation toggle and sync with manifests
* fix description in pg crd manifests
* change CRD creation strategy
* affinity matchExpression has values
* lower repair period in e2e tests
2022-02-18 15:04:31 +01:00
Felix Kunde 658923d10d
Password rotation in secrets (#1749)
* password rotation in K8s secrets
* add db connection to syncSecrets
* add user retention
* add e2e test
* cleanup on username mismatch if rotation was switched off
* add unit test for syncSecrets + new updateSecret func
2022-02-18 11:54:47 +01:00
Felix Kunde a78a619e90
toleration diff and nodeReadinessLabel merge with manifest matchExpressions (#1729)
* include tolerations in statefulset comparison
* provide alternative merge behavior of nodeSelectorTerms for node readiness label
* add config option to change affinity merge behavior
* reworked e2e tests around node affinity
2022-01-27 15:57:24 +01:00
Damian Peckett fe340192ca
Add configuration flag for disabling operator CRD creation/update (#1733)
* Make CRD registration configurable and drop RBAC permissions when CRD registration is disabled
* add generated deep copy functions

Co-authored-by: Damian Peckett <d.peckett_admin@mgmt.innovo-cloud.de>
2022-01-13 15:20:04 +01:00
Felix Kunde b4155bc8fb
update year in LICENSE file to 2022 (#1734) 2022-01-06 10:55:29 +01:00
Felix Kunde 411abbe31e
handle case when Patroni returns that lag is unknown (#1724)
* handle case when Patroni returns that lag is unknown
* remove some prints from e2e test
2021-12-17 12:36:23 +01:00
Felix Kunde 07fd4ec00b
choose switchover candidate based on lag and role (#1700)
* choose switchover candidate based on lowest lag in MB and role (in synchronous mode)
2021-12-14 10:35:21 +01:00
Dmitry Volodin 8959618471
Make test fails due to keeping github.com autogenerated folder in root (#1713) 2021-12-06 11:21:07 +01:00
James McDonald def9e1d688
Support standby replication from GS (GCS) (#1446)
* Add support for manual gs_wal_path in standby
* Remove separate standby version configuration
* Remove setting standby path via cluster/uid/version
Picking up the version doesn't work reliably without making changes to
Spilo. It's clearer to just specify the full S3/GS bucket path.

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-12-03 11:24:29 +01:00
Felix Kunde 1ed16fadca
make sure upgrade script runs on the master (#1715)
* make sure upgrade script runs on the master
* show a bit more logs from upgrade script
2021-12-02 14:10:58 +01:00
Felix Kunde f7858ffb70
Initialize arrays of errors / error messages + minor refactoring (#1701)
* init error arrays correctly
* avoid nilPointer when syncing connectionPooler
* getInfrastructureRoles should return error
* fix unit tests and return type for getInfrastructureRoles
2021-11-29 12:49:12 +01:00
Jan Mussler 3e275d122a
Allow individual teams to do auto upgrade via operator. (#1699)
* Allow whitelisting of teams to do auto upgrade upgrade via operator.

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-11-29 12:47:18 +01:00
Dmitry Volodin fbd980af78
Operator fails with nil pointer dereference when CR validation is not passed (#1697) 2021-11-24 12:19:30 +01:00
Rafia Sabih e98439e5b6
Add log messages for usernames (#1692)
* add log messages for usernames
* document behavior better in logs

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-11-18 09:55:33 +01:00
Felix Kunde f9150aa6db
bump operator to v1.7.1 (#1670)
* bump operator to v1.7.1
* update UI image in manifest example
2021-11-03 16:55:01 +01:00
Felix Kunde 1eafd688d0
restart master first in some edge cases (#1655)
* restart master first in some edge cases

* edge case is when desired is lower than effective

* wait after config patch and restart on sync whenever we see pending_restart

* convert options to int to check decrease and add unit test

* minor update to e2e tests

* wait only after restart not every sync

* using spilo 14 e2e images
2021-10-26 16:43:19 +02:00
Felix Kunde 08665bb2b1
import PodToleration from opConfig to internal config (#1647)
* import PodToleration from opConfig to internal config
* add examples to manifests and values.yaml
2021-10-14 12:15:00 +02:00
Felix Kunde 2a33bf3313
improve Patroni config sync (#1635)
* improve Patroni config sync
* collect new and updated slots to patch patroni
* refactor httpGet in Patroni and extend unit tests
* GetMemberData should call the patroni endpoint
* add PATCH test
2021-10-13 17:17:26 +02:00
Felix Kunde ab25fb29b7
make Postgres 14 available (#1636)
* make Postgres 14 available
* don't be too hard to 9.5
* bump Spilo image and more docs updates
* update e2e test upgrading to 14
2021-10-12 12:00:59 +02:00
Jan Mussler d0d7a32d52
Clearing up error on resize failure message. (#1641)
* Clearing up error message.
2021-10-08 17:11:21 +02:00
Wolfgang Ebner e74b1bd359
use relative path instead of $PWD for go:generate (for go 1.17 compatibility) (#1615) 2021-09-14 14:54:41 +02:00
Felix Kunde ba6c3c39af
bump operator to v1.7.0 (#1599) 2021-08-27 14:33:54 +02:00
Felix Kunde 62ed7e470f
improve pooler sync (#1593)
* remove role from installLookupFunction and run it on database sync, too
* fix condition to decide on syncing pooler
* trigger lookup from database sync only if pooler is set
* use empty spec everywhere and do not sync if one lookupfunction was passed
* do not sync pooler after being disabled
2021-08-27 12:41:37 +02:00
Aaron Peschel 1dd0cd9691
Add Support for Azure WAL-G Backups (#1537)
This commit adds support for using an Azure storage account as a backup
location.

It uses the existing GCS functionality as a reference for what to do,
and follows the example set by GCS as closely as possible.

The decision to name the cloud provider key "aws_or_gcp" is unfortunate
while adding support for Azure, but I have left it alone to allow for
this changeset to be backwards compatible.
2021-08-26 14:59:03 +02:00
John Rood 2d2ce6197b
Add volume selector (#1385)
* Add volume selector
* Add slightly better documentation and gofmt changes
* Update generated deepcopy
* Add test for PV selector

Co-authored-by: John Rood <j.rood@picturae.com>
2021-08-26 14:57:54 +02:00
Quan Hoang 1b3366e9f4
Support affinity in connection pooler deployments (#1464) 2021-08-24 15:25:03 +02:00
Felix Kunde f0815fc5bd
remove debug log of Spilo env vars (#1591) 2021-08-23 15:44:34 +02:00
Felix Kunde 282b6d2863
allow secrets of default users in a different namespace (#1581)
* allow secrets of default users in a different namespace
* add warning in case secretNamespace is ignored
2021-08-18 16:00:26 +02:00
Felix Kunde 66620d5049
refactor restarting instances (#1535)
* refactor restarting instances and reduce listPods calls
* only add parameters to set if it differs from effective config
* update e2e test for updating Postgres config
* patch config only once
2021-08-09 16:23:41 +02:00
Felix Kunde 2057ad8191
reorder e2e tests to follow alphabetical sorting (#1567)
* reorder e2e tests to follow alphabetical sorting
* e2e: finish waiting for pod failover only if all pods were replaced
* wait for sync in rolling update timeout test
2021-07-27 11:41:27 +02:00
Felix Kunde 58bab073da
fix searching for users with namespace in name (#1569)
* fix searching for users with namespace in name and improve e2e test
* remove reformatting username to query
2021-07-27 09:46:55 +02:00
Rafia Sabih fa604027cf
Move flag to configmap (#1540)
* Move flag to configmap

Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-07-02 08:46:21 +02:00
Jan Mussler 330c2c4c0b
Do not modify if values are below gp3 minimum throughput. (#1543)
* Do not modify if values are below gp3 minimum throughput.
2021-06-30 15:01:55 +02:00
Felix Kunde 54e506c00b
define default access privileges for default users too (#1512)
* define default access privileges for default users too
* extend docs on defaultUsers
2021-06-22 16:45:28 +02:00
Sergey Dudoladov 53fb540c35
Add basic retry around switchover (#1510)
* add basic retry around switchover


Co-authored-by: Sergey Dudoladov <sergey.dudoladov@gmail.com>
2021-06-17 08:48:26 +02:00
Igor Yanchenko ebb3204cdd
restart instances via rest api instead of recreating pods, fixes bug with being unable to decrease some values, like max_connections (#1103)
* restart instances via rest api instead of recreating pods
* Ignore differences in bootstrap.dcs when compare SPILO_CONFIGURATION
* isBootstrapOnlyParameter is rewritten, instead of whitelist it uses blacklist
* added e2e test for max_connections decreasing
* documentation updated
* pending_restart flag added to restart api call, wait fot ttl seconds after restart
* refactoring, /restart returns error if pending_restart is set to true and patroni is not pending restart
* restart postgresql instances within pods only if pod's restart is not required
* patroni might need to restart postgresql after pods were recreated if values like max_connections decreased
* instancesRestart is not critical, try to restart pods if not successful
* cleanup

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-06-14 11:00:58 +02:00
Rafia Sabih 75a9e2be38
Create cross namespace secrets (#1490)
* Create cross namespace secrets

* add test cases

* fixes

* Fixes
- include namespace in secret name only when namespace is provided
- use username.namespace as key to pgUsers only when namespace is
  provided
- avoid conflict in the role creation in db by checking namespace
  alongwith the username

* Update unit tests

* Fix test case

* Fixes

- update regular expression for usernames
- add test to allow check for valid usernames
- create pg roles with namespace (if any) appended in rolename

* add more test cases for valid usernames

* update docs

* fixes as per review comments

* update e2e

* fixes

* Add toggle to allow namespaced secrets

* update docs

* comment update

* Update e2e/tests/test_e2e.py

* few minor fixes

* fix unit tests

* fix e2e

* fix e2e attempt 2

* fix e2e

Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-06-11 10:35:30 +02:00
Felix Kunde a37e78bd9a
bump operator to v1.6.3 (#1503) 2021-05-28 11:53:10 +02:00
Felix Kunde dd9c3907b7
pick first container if postgres is not found (#1505)
* pick first container if postgres is not found

* minor change
2021-05-28 11:44:10 +02:00
Felix Kunde 7884af2d59
get postgres container by name, not index (#1504) 2021-05-27 18:56:58 +02:00
Felix Kunde 48cdca645d
rework additional volume test (#1502) 2021-05-27 18:37:30 +02:00
Quan Hoang af5378eea5
Mount additional volumes to 'postgres' container when 'targetContains` is an empty list (#1475)
* Mount additional volumes to 'postgres' container when 'targetContainers' is an empty list

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-05-27 14:56:14 +02:00
Felix Kunde eeb59c5bfd
Rename roles that are removed from PostgresTeam CRD (#1457)
* rename db roles that are removed from manifests

* extend PostgresTeam e2e test

* make suffix configurable and add deprecated field to pgUser struct

* deny LOGIN from deprecated roles

* update feature documentation
2021-05-21 15:49:39 +02:00
Quan Hoang 18e2efe4e3
Update sts when modifying additionalVolumes (#1474) 2021-05-10 12:16:47 +02:00
Felix Kunde f0f7f25d30
Fix go lint errors (#1468)
* fix linter errors
* fix linter errors in kubectl plugin
* update PyYAML dependency in e2e tests
* declare a testVolume in volume_test
2021-05-10 11:48:03 +02:00
Felix Kunde 32e6c135b9
replace statefulset on annotation diff (#1449)
* replace statefulset on annotation diff
* remove update annotation function for statefulset
* add unit test for syncing annotations
* add inherited annotation to unit test
2021-04-22 11:22:52 +02:00
Felix Kunde 6b73ac4282
fix pooler sync with empty cluster name (#1448) 2021-04-09 14:08:28 +02:00
Felix Kunde c18241f187
Bump v1.6.2 (#1433)
* helm chart remove 1.6.0 archive from 1.6.0 archive

* bump operator to v1.6.2

* fix pointer deref

* skip connection pooler sync when empty

* revert pooler change and minor update to version msg

* do not log query on error when creating or altering users
2021-04-01 11:53:07 +02:00
neelasha-09 9e93c0a4ef
Fix for AllowPrivilegeEscalation : issue-1403 (#1412)
* Fix for AllowPrivilegeEscalation : issue-1403

* fixed syntax error

* Aligned the value for parameter

* Aligned the value for parameter

* Update crds.go

* Aligned the parameter spilo_allow_privilege_escalation

* Parameters sorted in Alphabetical order in manifests yaml

* Parameters sorted in Alphabetical order in manifests yaml

* Update pkg/controller/operator_config.go

* Update docs/reference/operator_parameters.md

Co-authored-by: Neelam Sharma <neelasha@amdocs.com>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-03-29 10:37:59 +02:00
machine424 78bfba85d2
create global default privileges in the appropriate prepared databases (#1421) 2021-03-26 14:19:26 +01:00
Felix Kunde c9acd52700
Major version upgrade config (#1386)
* reflect new major version upgrade options everywhere

* emit events during major version upgrade
2021-03-09 15:28:15 +01:00
Felix Kunde ff8143770c
Improve rolling upgrades and rolling upgrade continue (#1341)
* add TODOs for moving rooling update label on pods
* steer rolling update via pod annotation
* rename patch method and fix reading flag on sync
* pass only pods to recreatePods function
* do not take address of iterator if you use it later
* add e2e test and pass switchover targets to recreatePods
* add wait_for_pod_failover for e2e test
* add one more e2e test case
* helm chart remove 1.6.0 archive from 1.6.0 archive
* reflect code review feedback
2021-02-26 15:38:58 +01:00
Jan Mussler e837751ae0
Log result. (#1387) 2021-02-26 14:54:26 +01:00
Jan Mussler 636a9a8191
Support major version upgrade via manifest and global upgrades via min version (#1372)
Support major version upgrade trigger via manifest. There is `off` `manual` and `full`. Manual is what you expect, and full will auto upgrade clusters below a certain threshold.
2021-02-25 11:42:43 +01:00
Felix Kunde ca968ca150
Fix empty capabilities (#1380)
* helm chart remove 1.6.0 archive from 1.6.0 archive
* empty pod capabilities should be nil
2021-02-22 17:27:32 +01:00
Felix Kunde 3962e71ddd
bump to v1.6.1 (#1367)
* bump tp v1.6.1
* update UI chart
* improve docs and manifest examples
* use Spilo 2.0-r4 and update docs
* minor updates to admin docs
2021-02-18 13:38:27 +01:00
georgebarbarosie cee4bf82c7
small fix for postgresql CRD (#1368) 2021-02-18 08:21:26 +01:00
Felix Kunde 41858a702c
making pgTeamMap a pointer (#1349)
* making pgTeamMap a pointer
* init empty map
* add e2e test for additional teams and members
* update test_min_resource_limits
* add more waiting in node_affinity_test
* no need for pointers in map of postgresTeamMebership
* another minor update on node affinity test
* refactor and fix fetching additional members
2021-02-16 10:38:20 +01:00
Michael Seiwald 17da6bc649
Truncate cronjob name at 52 characters (#1208) 2021-02-15 17:00:21 +01:00
Jan Mussler 772f0ca771
Fix volume sync order. (#1340) 2021-02-12 17:36:11 +01:00
Tommaso Pozzetti c1c0d5faa1
Fix operator configs runasuser and runasgroup (#1361)
This commit fixes a typo in the operator's configuration
that would lead to the configs spilo_runasuser and
spilo_runasgroup to be ignored.
2021-02-12 11:04:23 +01:00
zvier 6aeb92f024
code optimization (#1350)
* pre-allocate cap for slice structure
* if clause is no need because of range, and kubelet also use range
  method to get each capability so there is no side-effect

Signed-off-by: Jeff Zvier <zvier20@gmail.com>
2021-02-09 09:35:24 +01:00
Felix Kunde 0cce565b65
fix when adding only one capability (#1339)
* fix when adding only one capability

* fix error messages in unit test
2021-01-29 16:10:27 +01:00
Felix Kunde 12ad8c91fa
configurable container capabilities (#1336)
* configurable container capabilities

* revert change on TestTLS

* fix e2e test

* minor fix
2021-01-29 14:54:48 +01:00
Jan Mussler 43168ca622
Also sync volumes on updates. (#1330) 2021-01-25 20:28:37 +01:00
Felix Kunde ac2a00c45e
set allowPrivilegeEscalation for deployment templates (#1328)
* set allowPrivilegeEscalation for deployment templates

* securityContext of container, not pod

* aligning

* default service account for pooler
2021-01-25 18:23:29 +01:00
Jan Mussler 4a88f00a3f
Full AWS gp3 support for iops and througput config. (#1261)
Support new AWS EBS volume type `gp3` with `iops` and `throughput` in the manifest.

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2021-01-25 10:07:18 +01:00
Felix Kunde 4ea0b5f432
set AllowPrivilegeEscalation on container securityContext (#1326) 2021-01-22 14:06:19 +01:00
Rafia Sabih a9b677c957
Use fake client for connection pooler (#1301)
Connection pooler creation, deletion, and synchronization now tested using fake client API.

Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
2021-01-19 17:40:20 +01:00
Felix Kunde 258799b420
allow additional members from other teams (#1314) 2021-01-15 15:11:02 +01:00
Rafia Sabih e398cf8c7e
Avoid syncing when possible (#1274)
Avoid extra syncing in case there are no changes in pooler requirements.
Add pooler specific labels to pooler secrets.
Add test case to check for pooler secret creation and deletion.

Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
2021-01-14 09:53:09 +01:00
Felix Kunde f927d6616c
add default values to operatorconfiguration crd (#1283)
* add default values to operatorconfiguration crd

* leave default for enable_master_load_balancer to true

* add missing bits for new logical backup option

* fix wrong lb tag and update chart package
2021-01-11 17:24:24 +01:00
Felix Kunde 2eac36d003
update year in generated code and maintainer info in Dockerfiles (#1298)
* update year in generated code and maintainer info in Dockerfiles

* minor update in admin docs
2021-01-08 17:07:28 +01:00
Sergey Dudoladov b7f4cde541
wrap getting Patroni state into retry (#1293)
Retry calls to Patorni API to get cluster state

Co-authored-by: Sergey Dudoladov <sergey.dudoladov@zalando.de>
2021-01-08 15:08:44 +01:00
Sergey Dudoladov 168b679506
add a prefix for the name of a logical backup job (#1287)
* add a prefix for the name of a logical backup job

Co-authored-by: Sergey Dudoladov <sergey.dudoladov@zalando.de>
2021-01-07 10:38:07 +01:00
Felix Kunde 102178409b
bump tp v1.6.0 (#1265)
* bump tp v1.6.0
* update logical-backup image
* Using smaller image for e2e test.
* fix env var name in docs
* add postgresql-client-13 to logical backup image

Co-authored-by: Jan Mussler <janm81@gmail.com>
2020-12-18 13:10:35 +01:00
Felix Kunde 07c4f52ede
use pointer type for nodeAffinity (#1263)
* use pointer type for nodeAffinity
2020-12-18 12:07:59 +01:00
Jan Mussler a63ad49ef8
Initial commit for new 1.6 release with Postgres 13 support. (#1257)
* Initial commit for new 1.6 release with Postgres 13 support.
* Updating maintainers, Go version, Codeowners.
* Use lazy upgrade image that contains pg13.
* fix typo for ownerReference
* fix clusterrole in helm chart
* reflect GCP logical backup in validation
* improve PostgresTeam docs
* change defaults for enable_pgversion_env_var and storage_resize_mode
* explain manual part of in-place upgrade
* remove gsoc docs

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2020-12-17 15:00:29 +01:00
Pavel Tumik 77252e316c
Add node affinity support (#1166)
* Adding nodeaffinity support alongside node_readiness_label
* add documentation for node affinity
* add node affinity e2e test
* add unit test for node affinity

Co-authored-by: Steffen Pøhner Henriksen <str3sses@gmail.com>
Co-authored-by: Adrian Astley <adrian.astley@activision.com>
2020-12-16 14:56:28 +01:00
Rafia Sabih f28706e940
Sync sts at pgversion upgrade (#1256)
When pgversion is updated to a higher major version number, sync statefulSets also.

Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
2020-12-16 13:50:24 +01:00
Pavel Tumik 5076e669cb
Fix timestamp regex (#1178) 2020-12-16 11:17:08 +01:00
Pavel Tumik fbd04896c2
Add ability to upload logical backup to gcs (#1173)
Support logical backup provider/storage S3 and GCS equivalent
2020-12-16 10:41:08 +01:00
Felix Kunde 929075814a
diff SecurityContext of containers (#1255)
* diff SecurityContext of containers
* change log messages to use "does not" vs "doesn't"
2020-12-15 10:06:53 +01:00
Felix Kunde 83fbccac5a
new env var for backwards compatability between spilo 12 and 13 (#1254) 2020-12-14 18:43:53 +01:00
Felix Kunde 028f23eec7
raise pooler image and fix pgversion config in chart (#1253)
* raise pooler image and fix pgversion config in chart
* enable_ebs_gp3_migration_max_size with quotes
* set ConnectionPoolerMinInstances to 1
2020-12-14 12:37:09 +01:00
Jan Mussler b88d8e34e1
Fix function name in test (#1250)
* Fix function name in test

Error was somehow introduced in last 2 PRs merged.

* Update volumes_test.go
2020-12-12 00:35:27 +01:00
Felix Kunde 6a97316a69
Support inherited annotations for all major objects (#1236)
* add comments where inherited annotations could be added

* add inheritedAnnotations feature

* return nil if no annotations are set

* minor changes

* first downscaler then inherited annotations

* add unit test for inherited annotations

* add pvc to test + minor changes

* missing comma

* fix nil map assignment

* set annotations in the same order it is done in other places

* replace acidClientSet with acid getters in K8s client

* more fixes on clientSet vs getters

* minor changes

* remove endpoints from annotation test

* refine unit test - but deployment and sts are still empty

* fix checkinng sts and deployment

* make annotations setter one liners

* no need for len check anymore

Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
2020-12-11 16:34:01 +01:00
Jan Mussler 549f71bb49
Support EBS gp2 to gp3 migration on sync for below 1tb volumes (#1242)
* initial commit for gp3 migration.

* Default volume migration done.

* Added Gomock and one test case with mock.

* Dep update.

* more changes for code gen.

* push fake package.

* Rename var.

* Changes to Makefile and return value.

* Macke mocks phony due to overlap in foldername.

* Learning as one goes. Initialize map.

* Wrong toggle.

* Expect modify call.

* Fix mapping of ids in test.

* Fix volume id.

* volume ids.

* Fixing test setup. Late night...

* create all pvs.

* Fix test case config.

* store volumes and compare.

* More logs.

* Logging of migration action.

* Ensure to log errors.

* Log warning if modify failed, e.g. due to ebs volume state.

* Add more output.

* Skip local e2e tests.

* Reflect k8s volume id in test data. Extract aws volume id from k8s value.

* Finalizing ebs migration.

* More logs. describe fails.

* Fix non existing fields in gp2 discovery.

* Remove nothing to do flag for migration.

* Final commit for migration.

* add new options to all places

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2020-12-11 15:52:32 +01:00
Igor Yanchenko b9ef88f842
replace AdditionalProperties with XPreserveUnknownFields FIXES #1206 (#1248) 2020-12-10 16:27:03 +01:00
Thunderbolt 598c05b64b
add to postgresql_type.go omitempty annotation (#1223)
* add to postgresql_type.go omitempty annotation

* add postgresql_type.go additional omitempty

* remove postgresql.go defaults
2020-12-10 14:04:03 +01:00
Rafia Sabih 5a6da7275f
avoid hard-codeed spilo-role (#1246)
Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
2020-12-09 13:00:06 +01:00
Sergey Dudoladov dc9a5b1e61
Introduce PGVERSION (#1172)
* introduce PGVERSION

Co-authored-by: Sergey Dudoladov <sergey.dudoladov@zalando.de>
2020-11-27 18:49:49 +01:00
Sergey Dudoladov 6f5751fe55
raise log level for malformed secrets (#1235)
Co-authored-by: Sergey Dudoladov <sergey.dudoladov@zalando.de>
2020-11-27 18:47:50 +01:00
Boyan Bonev 85d1a72cd6
Add scheduler name support - [Update #990] (#1226)
* Add ability to specify alternative schedulers via schedulerName.

Co-authored-by: micah.coletti@gmail.com <micah.coletti@gmail.com>
2020-11-25 10:55:05 +01:00
Felix Kunde cfd83e33c8
preserving fields only when using k8s specs (#1228)
* preserving fields when k8s specs are used with x-kubernetes-preserve-unknown-fields flag
* cleaning up merge errors in postgresql and operatorconfiguration CRD
* add operatorconfiguration CRD and sample manifests in setUpClass of e2e tests
* update generated code and go modules
2020-11-24 16:23:22 +01:00
Jan Mussler c4ae11629b
Fix connection pooler deployment selectors (#1213)
Stick with the existing pooler deployment selector labels to make it compatible with existing deployments.

Make the use of additional labels clear and avoid where not needed.

Deployment Selector and Service Selector now do not use extra labels, pod spec does.
2020-11-23 17:18:18 +01:00
Felix Kunde 3e42e8a896
CRD: preserve unknown fields and add to all category (#1212)
* CRD: preserve unknown fields and add to all category

* allow Pg13

* left over
2020-11-16 10:29:01 +01:00
Rafia Sabih 49158ecb68
Connection pooler for replica (#1127)
* Enable connection pooler for replica
* Refactor code for connection pooler
  - Move all the relevant code to a separate file
  - Move all the related tests to a separate file
  - Avoid using cluster where not required
  - Simplify the logic in sync and other methods
  - Cleanup of duplicated or unused code
* Fix labels for the replica pods
* Update deleteConnectionPooler to include role
* Adding test cases and other changes
   - Fix unit test and delete secret when required only
   - Make sure we use empty fresh cluster for every test case.
* enhance e2e test
* Disable pooler in complete manifest as this is source for e2e too an creates unnecessary pooler setups.

Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
Co-authored-by: Jan Mussler <janm81@gmail.com>
2020-11-13 14:52:21 +01:00
Felix Kunde 3fed565328
check resize mode on update events (#1194)
* check resize mode on update events

* add unit test for PVC resizing

* set resize mode to pvc in charts and manifests

* add test for quantityToGigabyte

* just one debug line for syncing volumes

* extend test and update log msg
2020-11-11 13:22:43 +01:00
Sergey Dudoladov e779eab22f
Update e2e pipeline (#1202)
* clean up after test_multi_namespace test

* see the PR description for complete list of changes

Co-authored-by: Sergey Dudoladov <sergey.dudoladov@zalando.de>
2020-11-11 10:21:46 +01:00
Felix Kunde b379db20ed
fix redundant appending of infrastructure roles (#1192) 2020-11-05 12:04:51 +01:00
Pavel Tumik db0d089e75
Fix cloning from GCS (#1176)
* Fix clone from gcs

* pass google credentials env var if using GS bucket

* remove requirement for timezone as GCS returns timestamp in local time to the region it is in

* Revert "remove requirement for timezone as GCS returns timestamp in local time to the region it is in"

This reverts commit ac4eb350d9.

* update GCS documentation

* remove sentence about logical backups

* reword pod environment configmap section

* fix documentation
2020-11-03 15:05:44 +01:00
Sergey Dudoladov 4f3bb6aa8c
Remove operator checks that prevent PG major version upgrade (#1160)
* remove checks that prevent major version upgrade

Co-authored-by: Sergey Dudoladov <sergey.dudoladov@zalando.de>
2020-11-02 16:49:29 +01:00
Felix Kunde d76419565b
move to apiextensions from v1beta1 to v1 (#746)
* move to apiextensions from v1beta1 to v1

* remove metadata from CRD validation

* some forgotten change
2020-11-02 10:49:29 +01:00
Jan Mussler c694a72352
Make failure in retry a warning not an error. (#1188) 2020-10-29 13:12:25 +01:00
Felix Kunde 9a11e85d57
disable PostgresTeam by default (#1186)
* disable PostgresTeam by default

* fix version in chart
2020-10-28 17:51:37 +01:00
Felix Kunde d658b9672e
PostgresTeam CRD for advanced team management (#1165)
* PostgresTeamCRD for advanced team management

* rework internal structure to be closer to CRD

* superusers instead of admin

* add more util functions and unit tests

* fix initHumanUsers

* check for superusers when creating normal teams

* polishing and fixes

* adding the essential missing pieces

* add documentation and update rbac

* reflect some feedback

* reflect more feedback

* fixing debug logs and raise QueueResyncPeriodTPR

* add two more flags to disable CRD and its superuser support

* fix chart

* update go modules

* move to client 1.19.3 and update codegen
2020-10-28 10:40:10 +01:00
Jan Mussler 3a86dfc8bb
End 2 End tests speedup (#1180)
* Improving end 2 end tests, especially speed of execution and error, by implementing proper eventual asserts and timeouts.
* Add documentation for running individual tests
* Fixed String encoding in Patorni state check and error case
* Printing config as multi log line entity, makes it readable and grepable on startup
* Cosmetic changes to logs. Removed quotes from diff. Move all object diffs to text diff. Enabled padding for log level.
* Mount script with tools for easy logaccess and watching objects.
* Set proper update strategy for Postgres operator deployment.
* Move long running test to end. Move pooler test to new functions.
* Remove quote from valid K8s identifiers.
2020-10-28 10:04:33 +01:00
arminfelder 7730ecfdec
fixed case where, no ready label is defined, but node is unscheduable (#1162)
* fixed case where, no ready label is defined, but node is unscheduable
2020-10-28 09:33:52 +01:00
Felix Kunde e97235aa39
update dependencies oct 2020 (#1184)
* update dependencies oct 2020

* update codegen
2020-10-27 16:59:26 +01:00
preved911 d9f5d1c9df
changed PodEnvironmentSecret location namespace (#1177)
Signed-off-by: Ildar Valiullin <preved.911@gmail.com>
2020-10-22 08:49:30 +02:00
Felix Kunde 22fa0875e2
add maxLength constraint for CRD (#1175)
* add maxLength constraint for CRD
2020-10-22 08:44:04 +02:00
刘新 a8bfe4eb87
Remove repeated initialization of Pod ServiceAccount (#1164)
Co-authored-by: xin.liu <xin.liu@woqutech.com>
2020-10-20 14:18:22 +02:00
Dmitry Dolgov 1f5d0995a5
Lookup function installation (#1171)
* Lookup function installation

Due to reusing a previous database connection without closing it, lookup
function installation process was skipping the first database in the
list, installing twice into postgres db instead. To prevent that, make
internal initDbConnWithName to overwrite a connection object, and return
the same object only from initDbConn, which is sort of public interface.

Another solution for this would be to modify initDbConnWithName to
return a connection object and then generate one temporary connection
for each db. It sound feasible but after one attempt it seems it
requires a bit more changes around (init, close connections) and
doesn't bring anything significantly better on the table. In case if
some future changes will prove this wrong, do not hesitate to refactor.

Change retry strategy to more insistive one, namely:

* retry on the next sync even if we failed to process one database and
install pooler appliance.

* perform the whole installation unconditionally on update, since the
list of target databases could be changed.

And for the sake of making it even more robust, also log the case when
operator decides to skip installation.

Extend connection pooler e2e test with verification that all dbs have
required schema installed.
2020-10-19 16:18:58 +02:00
Dmitry Dolgov d15f2d3392
Readiness probe (#1169)
Right now there are no readiness probes defined for connection pooler,
which means after a pod restart there is a short time window (between a
container start and connection pooler starting listening to a socket)
when a service can send queries to a new pod, but connection will be
refused. The pooler container is rather lightweight and it start to
listen immediately, so the time window is small, but still.

To fix this add a readiness probe for tcp socket opened by connection
pooler.
2020-10-15 10:16:42 +02:00
Alex Stockinger 692c721854
Introduce ENABLE_JSON_LOGGING env variable (#1158) 2020-10-08 15:32:15 +02:00
Felix Kunde 21475f4547
Cleanup config examples (#1151)
* post polishing for latest PRs

* update travis and go modules

* make deprecation comments in structs less confusing

* have separate pod priority class es for operator and database pods
2020-09-30 17:24:14 +02:00
Sergey Dudoladov 2a21cc4393
Compare Postgres pod priority on Sync (#1144)
* compare Postgres pod priority on Sync

Co-authored-by: Sergey Dudoladov <sergey.dudoladov@zalando.de>
2020-09-23 17:26:56 +02:00
neelasha-09 ab95eaa6ef
Fixes #1130 (#1139)
* Fixes #1130

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2020-09-22 17:16:05 +02:00
Rico Berger d09e418b56
Set user and group in security context (#1083)
* Set user and group in security context
2020-09-15 13:27:59 +02:00
Igor Yanchenko d8884a4003
Allow to overwrite default ExternalTrafficPolicy for the service (#1136)
* Allow to overwrite default ExternalTrafficPolicy for the service
2020-09-15 13:19:22 +02:00
hlihhovac e03e9f919a
add missing omitempty directive to the attributes of PostgresSpec (#1128)
Co-authored-by: Pavlo Golub <pavlo.golub@gmail.com>
2020-08-31 12:28:52 +02:00
Felix Kunde 3ddc56e5b9
allow delete only if annotations meet configured criteria (#1069)
* define annotations for delete protection

* change log level and reduce log lines for e2e tests

* reduce wait_for_pod_start even further
2020-08-13 16:36:22 +02:00
Felix Kunde dfd0dd90ed
set search_path for default roles (#1065)
* set search_path for default roles

* deployment back to 1.5.0

Co-authored-by: Felix Kunde <felix.kunde@zalando.de>
2020-08-11 10:42:31 +02:00
Felix Kunde 0508266219
Remove all secrets on delete incl. pooler (#1091)
* fix syncSecrets and remove pooler secret

* update log for deleteSecret

* use c.credentialSecretName(username)

* minor fix
2020-08-10 18:26:26 +02:00
Felix Kunde 43163cf83b
allow using both infrastructure_roles_options (#1090)
* allow using both infrastructure_roles_options

* new default values for user and role definition

* use robot_zmon as parent role

* add operator log to debug

* right name for old secret

* only extract if rolesDefs is empty

* set password1 in old infrastructure role

* fix new infra rile secret

* choose different role key for new secret

* set memberof everywhere

* reenable all tests

* reflect feedback

* remove condition for rolesDefs
2020-08-10 15:08:03 +02:00