Commit Graph

579 Commits

Author SHA1 Message Date
Oleksii Kliukin 59a214727c Fix clone for origins in non-default namespaces.
By default, spilo sets WAL_BUCKET_SCOPE_PREFIX depending on the cluster
namespace, possibly to a non-empty string. However, we won't be able to
clone those clusters, as the clone prefix is always set to an empty string.

We could go the other way around and set both WAL_BUCKET_SCOPE_PREFIX
and CLONE_WAL_BUCKET_SCOPE_PREFIX to a non-default value that depends
on the cluster's namespace, but it seems that we don't need this
feature for now (no conflict will occur even for clusters with the
same name and different namespaces because of the SCOPE_SUFFIX) and
it requires some additional testing first.
2018-03-01 12:26:09 +01:00
zerg-junior c2ca2307bc
Merge pull request #260 from zalando-incubator/set-wal-prefix-to-empty
Set WAL_BUCKET_SCOPE_PREFIX to the empty string
2018-03-01 11:22:20 +01:00
Sergey Dudoladov 35104cb72b Add CLONE_ prefix to the env var 2018-03-01 11:19:15 +01:00
Sergey Dudoladov bcb8caeddf Set WAL_BUCKET_SCOPE_PREFIX to the empty string 2018-03-01 11:16:47 +01:00
Sergey Dudoladov fb21246fcd Remove early stopping conditions that rely on the relica service being absent 2018-02-27 17:21:51 +01:00
Sergey Dudoladov 28fed26845 Do not delete an endpoint for the replica service w/o load balancer during sync 2018-02-27 17:18:30 +01:00
Sergey Dudoladov b107d781e8 Do not delete replica service w/o load balancer during sync 2018-02-27 17:16:00 +01:00
Sergey Dudoladov 2ef069ee93 Create/delete replica service regardless of load balancer setup 2018-02-27 17:10:49 +01:00
Jan Mussler cb55749c1b
Update postgres-operator.yaml (#255)
Bump operator image version.
2018-02-26 20:03:56 +01:00
zerg-junior 0f392c2007
Merge pull request #252 from zalando-incubator/label-teams
Add 'team' label to pods, stateful sets, secrets and pod disruption budgets
2018-02-26 12:57:26 +01:00
Sergey Dudoladov 071547e5bf Modify to add extra labels only during resource creation 2018-02-26 11:11:50 +01:00
Oleksii Kliukin 2bb7e98268
update individual role secrets from infrastructure roles (#206)
* Track origin of roles.

* Propagate changes on infrastructure roles to corresponding secrets.

When the password in the infrastructure role is updated, re-generate the
secret for that role.

Previously, the password for an infrastructure role was always fetched from
the secret, making any updates to such role a no-op after the corresponding
secret had been generated.
2018-02-23 17:24:04 +01:00
Sergey Dudoladov 00dc810544 Add 'team' label to pods, stateful sets, secrets and pod disruption budgets 2018-02-23 14:36:10 +01:00
Dmitry Dolgov 7b05758893
Merge pull request #251 from zalando-incubator/feature/refactor-compare-containers
Move container comparison logic to a separate function
2018-02-23 14:32:55 +01:00
Dmitrii Dolgov ef50b147c5 Use list of checks instead of a map 2018-02-23 14:24:33 +01:00
Dmitrii Dolgov 95d86c7600 Move container comparison logic to a separate function 2018-02-23 11:58:37 +01:00
Oleksii Kliukin c4aab502b3
Remove Patroni leftover objects on cluster deletion. (#244)
* Remove all endpoints and configmaps from Patroni when Patroni is running with Kubernetes support on cluster deletion.
2018-02-23 09:52:22 +01:00
zerg-junior 6a29bbbcfa
Merge pull request #250 from zalando-incubator/show_warning_on_cluster_list_unmarshal
Make errors in the cluster list function visible.
2018-02-22 20:53:25 +01:00
Oleksii Kliukin f18bb6eaaa Make errors in the cluster list function visible.
Sometimes the operator does not pick up clusters right away when
they are created. The change attempts to shed light on the
reason behind that.
2018-02-22 16:45:10 +01:00
zerg-junior 65ef1da715
Merge pull request #249 from zalando-incubator/zerg-junior-patch-2
Update README.md
2018-02-22 15:03:00 +01:00
zerg-junior 2782e948e1
Update README.md 2018-02-22 12:17:04 +01:00
zerg-junior 8262822c5f
Merge pull request #247 from zalando-incubator/doc-unaccessible-ns
Document behavior in the case of unaccessible namespaces
2018-02-22 11:55:46 +01:00
Dmitry Dolgov bf4b0f0f33
Merge pull request #240 from zalando-incubator/feature/goreport-improvements
Some improvements for golint, ineffassign and misspell
2018-02-22 11:31:08 +01:00
Sergey Dudoladov 50331bc50a Document behavior in the case of unaccessible namespaces 2018-02-22 11:31:08 +01:00
Oleksii Kliukin cca73e30b7
Make code around recreating pods and creating objects in the database less brittle (#213)
There used to be a masterLess flag that was supposed to indicate whether the cluster it belongs to runs without the acting master by design. At some point, as we didn't really have support for such clusters, the flag has been misused to indicate there is no master in the cluster. However, that was not done consistently (a cluster without all pods running would never be masterless, even when the master is not among the running pods) and it was based on the wrong assumption that the masterless cluster will remain masterless until the next attempt to change that flag, ignoring the possibility of master coming up or some node doing a successful promotion. Therefore, this PR gets rid of that flag completely.

When the cluster is running with 0 instances, there is obviously no master and it makes no sense to create any database objects inside the non-existing master. Therefore, this PR introduces an additional check for that.

recreatePods were assuming that the roles of the pods recorded when the function has stared will not change; for instance, terminated replica pods should start as replicas. Revisit that assumption by looking at the actual role of the re-spawned pods; that avoids a failover if some replica has promoted to the master role while being re-spawned. In addition, if the failover from the old master was unsuccessful, we used to stop and leave the old master running on an old pod, without recording this fact anywhere. This PR makes the failover failure emit a warning, but not stop recreating the last master pod; in the worst case, the running master will be terminated, however, this case is rather unlikely one.

As a side effect, make waitForPodLabel return the pod definition it waited for, avoiding extra API calls in recreatePods and movePodFromEndOfLifeNode
2018-02-22 10:42:05 +01:00
Oleksii Kliukin 8801e62b12 Make sure the result of /clusters is returned to the user. 2018-02-22 10:21:09 +01:00
Oleksii Kliukin 85f7c944c2 Improve the condition check. 2018-02-22 10:13:46 +01:00
Oleksii Kliukin 1f71c8d72f
Avoid reading the namespace file every time the NamespacedName value is decoded. (#243) 2018-02-20 17:41:11 +01:00
zerg-junior b0549c3c9c
Merge pull request #225 from zalando-incubator/support-many-namespaces
Support many namespaces
2018-02-20 17:39:42 +01:00
Sergey Dudoladov e048328d6a Comment on special values for watched namespace 2018-02-20 17:26:17 +01:00
Oleksii Kliukin 99c090899f
Change the suffix delimiter to slash. (#242)
This allows using S3 API in order to simplify finding all folders that are different only by a suffix, since the suffix delimiter will not occur in the suffix itself (currently being a UID).
2018-02-20 16:31:44 +01:00
Sergey Dudoladov 66a3b6830e Call fatalf if namespace to watch does not exist 2018-02-20 16:13:48 +01:00
Oleksii Kliukin c597377617
Use cluster UID as a suffix to the WAL bucket. (#211)
Avoid reusing WAL S3 buckets of the older cluster with the same name as the existing one.

For the new cluster, the S3 bucket name will include a suffix that is equal to the UID of the PostgreSQL object describing the cluster. That way, the bucket name will stay the same for all members iff  they correspond to the same PostgreSQL cluster object.

When "clone: uid:" key is present in the cluster manifest and the cluster is cloned from an S3 bucket (currently that happens if the endTimestamp is present in the clone description) the S3 bucket to clone from is suffixed with the -uid value.
2018-02-20 15:36:43 +01:00
Sergey Dudoladov c47abed6ba Document usage of multiple namespaces 2018-02-20 14:51:18 +01:00
Sergey Dudoladov dcfc9925f6 Respond to code review 2018-02-20 14:43:02 +01:00
Dmitrii Dolgov a7cd859919 Some improvements for golint, ineffassign and misspell 2018-02-19 17:46:31 +01:00
Dmitry Dolgov 0e3f941d2f
Merge pull request #239 from zalando-incubator/feature/travis-timeout
WIP: Use travis_wait to prevent timeout
2018-02-16 16:40:15 +01:00
Dmitrii Dolgov 00a405b94e Limit number of commits builded by travic 2018-02-16 16:25:50 +01:00
Dmitrii Dolgov 48ddbc67b5 Limit number of packages and add verbose mode 2018-02-16 16:21:41 +01:00
Dmitrii Dolgov fb5986a2c0 Use travis_wait to prevent timeout 2018-02-16 16:06:33 +01:00
Sergey Dudoladov b1fae716b1 Update REST API to require namespace when fetching info about particular cluster 2018-02-16 15:32:09 +01:00
Sergey Dudoladov e3d2434420 Use '*' as an alias to denote all namespaces 2018-02-16 15:20:26 +01:00
Sergey Dudoladov 088bf70e7d Merge branch 'master' into support-many-namespaces 2018-02-16 15:06:10 +01:00
zerg-junior c09968774b
Merge pull request #238 from zalando-incubator/correctly-select-deployed-ns
Make operator watch its own namespace instead of controller's one
2018-02-16 14:31:54 +01:00
Sergey Dudoladov ec7de38f9b Make operator watch its own namespace instead of controller's one 2018-02-16 14:22:38 +01:00
zerg-junior 7b74da8713
Merge pull request #236 from zalando-incubator/fix-config-map-namespace
Remove the second namespace prefix from the operator configmap name
2018-02-16 12:37:41 +01:00
Sergey Dudoladov b412a831d6 Remove the second namespace prefix from the operator configmap name 2018-02-16 12:30:07 +01:00
zerg-junior 04557922c0
Merge pull request #231 from zalando-incubator/default-to-watched-ns
Operator should default to the watched namespace
2018-02-16 11:45:32 +01:00
Sergey Dudoladov bbe2801d69 Adjust unit tests for namespace decoding 2018-02-16 11:13:08 +01:00
Sergey Dudoladov 0a9e6bd8d2 Clarify when a separate account for database pods may be needed 2018-02-15 16:40:07 +01:00