Commit Graph

583 Commits

Author SHA1 Message Date
Oleksii Kliukin fe47f9ebea
Improve the pod moving behavior during the Kubernetes cluster upgrade. (#281)
* Improve the pod moving behavior during the Kubernetes cluster upgrade.

Fix an issue of not waiting for at least one replica to become ready
(if the Statefulset indicates there are replicas) when moving the master
pod off the decomissioned node. Resolves the first part of #279.

Small fixes to error messages.

* Eliminate a race condition during the swithover.

When the operator initiates the failover (switchover) that fails and
then retries it for a second time it may happen that the previous
waitForPodChannel is still active. As a result, the operator subscribes
to the former master pod two times, causing a panic.

The problem was that the original code didn't bother to cancel the
waitForPodLalbel for the new master pod in the case when the failover
fails. This commit fixes it by adding a stop channel to that function.

Code review by @zerg-junior
2018-05-03 10:20:24 +02:00
zerg-junior ebff820fcc
Merge pull request #284 from zalando-incubator/ship-pg-daily-log-to-s3
Set up an S3 bucket for the postgres logs
2018-05-02 14:39:03 +02:00
Sergey Dudoladov 59ded0c212 Shorten bucket name 2018-05-02 14:05:57 +02:00
Sergey Dudoladov c45219bafa Set up an S3 bucket for the postgres daily logs 2018-05-02 12:52:42 +02:00
Oleksii Kliukin 4a3ccad362
Merge pull request #282 from zalando-incubator/assign_existing_service_definition_during_sync
Fix a bug with syncing services
2018-04-27 13:49:40 +02:00
Oleksii Kliukin 37caa3f60b Fix a bug with syncing services
Avoid showing "there is no service in the cluster" when syncing a
service for the cluster if the operator has been restarted after
the cluster had been created.
2018-04-27 12:35:25 +02:00
zerg-junior 8f08bef67c
Merge pull request #277 from zalando-incubator/automatically-deploy-service-account
Deploy service account for pod creation on demand
2018-04-26 14:44:37 +02:00
Sergey Dudoladov 1b718fd4c2 Minor improvemets in reporting service account creation 2018-04-26 13:47:25 +02:00
Sergey Dudoladov 4255e702bc Always empty account's namespace after parsing 2018-04-25 13:57:24 +02:00
Sergey Dudoladov d99b553ec1 Convert default account definiton into JSON 2018-04-25 12:35:16 +02:00
Sergey Dudoladov e3f7fac443 Comment on the default value for pod service account name 2018-04-24 15:41:28 +02:00
Sergey Dudoladov 3d0ab40d64 Explicitly warn on account name mismatch 2018-04-24 15:31:22 +02:00
Sergey Dudoladov 485ec4b8ea Move service account to Controller 2018-04-24 15:13:08 +02:00
zerg-junior 5d5b48fa20
Merge pull request #278 from zalando-incubator/tolerate-team-service-issues
Tolerate issues of the Teams API
2018-04-24 13:54:46 +02:00
Sergey Dudoladov bc8b950da4 Tolerate issues of the Teams API 2018-04-23 16:31:53 +02:00
Sergey Dudoladov c31c76281c Make operator unaware of its own service account 2018-04-23 14:38:20 +02:00
Sergey Dudoladov a88416e6ea Include default service account for pods into README.md 2018-04-23 14:28:00 +02:00
Sergey Dudoladov 5daf0a4172 Fix error reporting during pod service account creation 2018-04-20 14:20:38 +02:00
Sergey Dudoladov bd51d2922b Turn ServiceAccount into struct value to avoid race conditon during account creation 2018-04-20 13:05:05 +02:00
Sergey Dudoladov a5a65e93f4 Name service account consistenly 2018-04-19 16:15:52 +02:00
Sergey Dudoladov 2f3d63a663 Document desired behaviour 2018-04-19 16:11:34 +02:00
Sergey Dudoladov 23f893647c Remove sync of pod service accounts 2018-04-19 15:48:58 +02:00
Sergey Dudoladov 214ae04aa7 Deploy service account for pod creation on demand 2018-04-18 16:20:20 +02:00
Manuel Gómez 5e1d86e31e
Fix clone timestamp key in example manifest (#276)
It was set to `endTimestamp`, but it should be `timestamp`.
2018-04-16 18:23:41 +02:00
Oleksii Kliukin 0618723a61 Check rolling updates using controller revisions.
Compare pods controller revisions with the one for the statefulset
to determine whether the pod is running the latest revision and,
therefore, no rolling update is necessary. This is performed only
during the operator start, afterwards the rolling update status
that is stored locally in the cluster structure is used for all
rolling update decisions.
2018-04-09 18:07:24 +02:00
Manuel Gómez 88c68712b6
Fix statefulset label selector diffing (#273)
Otherwise, rolling updates are done unnecessarily.
2018-04-06 17:21:57 +02:00
Oleksii Kliukin 9bf80afa6b
Remove team from statefulset selector (#271)
* Remove 'team' label from the statefulset selector.

I was never supposed to be there, but implicitely statefulset
creates a selector out of meta.labels field. That is the problem
with recent Kubernetes, since statefulset cannot pick up pods
with non-matching label selectors, and we rely on statefulset
picking up old pods after statefulset replacement.

Make sure selector changes trigger replacement of the statefulset.

In the case new selector has more labels than the old one nothing
should be done with a statefulset, otherwise the new statefulset
won't see orphaned pods from the old one, as they won't match the
selector. 

See https://github.com/kubernetes/kubernetes/issues/46901#issuecomment-356418393
2018-04-06 13:58:47 +02:00
Oleksii Kliukin c44cd9e4e6
Define the operator RBAC (#234)
Note that the account here is named zalando-postgres-operator and not
the 'operator' default that is created in the serviceaccount.yaml and
also used by the operator configmap to create new postgres clusters.

This is done intentionally, as to avoid breaking those setups that
already work. Ideally, the operator should be run under the
zalando-postgres-operator service account. However, the service account
used to run Postgres clusters does not require all those privileges and
is described at
https://github.com/zalando/patroni/blob/master/kubernetes/patroni_k8s.yaml

The service account defined here acquires some privileges not really
used by the operator (i.e. we only need list and watch on configmaps),
this is also done intentionally to avoid breaking things if someone
decides to configure the same service account in the operator's
configmap to run postgres clusters.

Documentation and further testing by @zerg-junior
2018-04-05 11:24:24 +02:00
Oleksii Kliukin 26db91c53e
Improve infrastructure role definitions (#208)
Enhance definitions of infrastructure roles by allowing membership in multiple roles, role options and per-role configuration to be specified in the infrastructure role configmap, which must have the same name as the infrastructure role secret. See manifests/infrastructure-roles-configmap.yaml for the examples and updated README for the description of different types of database roles supposed by the operator and their purposes.

Change the logic of merging infrastructure roles with the manifest roles when they have the same name, to return the infrastructure role unchanged instead of merging. Previously, we used to propagate flags from the manifest role to the resulting infrastructure one, as there were no way to define flags for the infrastructure role; however, this is not the case anymore.

Code review and tests by @erthalion
2018-04-04 17:21:36 +02:00
zerg-junior d264be9faa
Merge pull request #261 from zalando-incubator/wal_bucket_scope_prefix
Fix clone for origins in non-default namespaces.
2018-04-03 17:47:18 +02:00
zerg-junior ff5793b584
Merge pull request #258 from zalando-incubator/always-create-replica-service
[WIP] Always create replica service
2018-03-29 14:42:26 +02:00
Sergey Dudoladov edf710d772 Add tests for load balancer function logic by Dmitrii Dolgov 2018-03-27 16:10:57 +02:00
erthalion 34518a4eb0 Some fixes for travis ci and cdp
remove cmd package from travis (it's complaining because
there are no tests), and add apt-get update for cdp.
2018-03-27 16:05:13 +02:00
erthalion 8967a3be2c Add tests for load balancer function logic 2018-03-27 12:11:46 +02:00
Dmitry Dolgov 5200579a89
Merge pull request #267 from zalando-incubator/scope-operator
Add scope section to readme.
2018-03-27 10:35:14 +02:00
Sergey Dudoladov 96d46252f5 Change the default values to closer match previous behaviour 2018-03-26 11:43:46 +02:00
Sergey Dudoladov ced770a827 Respond to code review 2018-03-26 11:07:32 +02:00
Sergey Dudoladov a8862aeee1 Enable backward compatibility for enable_load_balancer setting from operator configmap 2018-03-19 17:19:50 +01:00
Sergey Dudoladov 931b48fcbb Respond to code reviews 2018-03-16 15:36:42 +01:00
Sergey Dudoladov 386d7b6bdb Implement backward compatibility with older load balancer settings 2018-03-16 13:27:38 +01:00
Sergey Dudoladov 145689c950 Disable load balancer for master service by default (it may cost money) 2018-03-16 13:18:13 +01:00
Sergey Dudoladov 27837e5672 Document usage of load balancers 2018-03-14 13:09:16 +01:00
Sergey Dudoladov 20f30d3739 Update the method for deciding about load balancers 2018-03-14 12:46:58 +01:00
Sergey Dudoladov 0986e56226 Add separate params for master and replica load balancers to operator configuration 2018-03-14 12:12:28 +01:00
Sergey Dudoladov ac6c5bcf09 Explicitly name replica and master load balancer params in PostgresSpec 2018-03-14 12:03:27 +01:00
zerg-junior 6789f3740c
Merge pull request #266 from zalando-incubator/fix-replica-dns-names
Fix configuration of dns names
2018-03-13 12:48:06 +01:00
Jan M 4f782314aa Add scope section to readme. 2018-03-12 17:34:15 +01:00
Sergey Dudoladov 5bc5e70c81 Log if replica service has no load balancer 2018-03-12 16:48:44 +01:00
zerg-junior cca50122a6
Delete config file added by mistake 2018-03-12 12:54:02 +01:00
Sergey Dudoladov 6839ce0170 Fix configuration of dns names 2018-03-12 12:45:52 +01:00