Commit Graph

1092 Commits

Author SHA1 Message Date
Felix Kunde e6eb10d28a
fix TestTLS (#894) 2020-04-01 10:31:31 +02:00
ReSearchITEng 6ed1030838
TLS - add OpenShift compatibility (#885)
* solves https://github.com/zalando/postgres-operator/pull/798#issuecomment-605201260
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2020-04-01 09:39:54 +02:00
Felix Kunde 64d816c556
add short sleep before redistributing pods (#891) 2020-03-31 11:47:39 +02:00
Felix Kunde 66f2cda87f
Move operator to go 1.14 (#882)
* update go modules march 2020
* update to GO 1.14
* reflect k8s client API changes
2020-03-30 15:50:17 +02:00
Felix Kunde ba9cf68650
Change type of pod environment config map to NamespacedName (#870)
* allow PodEnvironmentConfigMap in other namespaces
* update codegen
* update docs and comments
2020-03-25 15:59:31 +01:00
Dmitry Dolgov 9dfa433363
Connection pooler (#799)
Connection pooler support

Add support for a connection pooler. The idea is to make it generic enough to
be able to switch between different implementations (e.g. pgbouncer or
odyssey). Operator needs to create a deployment with pooler and a service for
it to access.

For connection pool to work properly, a database needs to be prepared by
operator, namely a separate user have to be created with an access to an
installed lookup function (to fetch credential for other users).

This setups is supposed to be used only by robot/application users. Usually a
connection pool implementation is more CPU bounded, so it makes sense to create
several pods for connection pool with more emphasize on cpu resources. At the
moment there are no special affinity or tolerations assigned to bring those
pods closer to the database. For availability purposes minimal number of
connection pool pods is 2, ideally they have to be distributed between
different nodes/AZ, but it's not enforced in the operator itself. Available
configuration supposed to be ergonomic and in the normal case require minimum
changes to a manifest to enable connection pool. To have more control over the
configuration and functionality on the pool side one can customize the
corresponding docker image.

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2020-03-25 12:57:26 +01:00
Felix Kunde 579f78864b
pass cluster labels as JSON to Spilo (#877) 2020-03-25 09:59:54 +01:00
Felix Kunde cc1ffdc7b6
enable controllerID for chart and allow configurable pod cluster role (#876) 2020-03-25 09:31:30 +01:00
Felix Kunde 07c5da35e3
fix minor issues in docs and manifests (#866)
* fix minor issues in docs and manifests
* double retry_timeout_sec
2020-03-18 15:02:13 +01:00
Fredrik Østrem 9ddee8f302
Use cryptographically secure password generation (#854)
The current password generation algorithm is extremely deterministic, due to being based on the standard random number generator with a deterministic seed based on the current Unix timestamp (in seconds).

This can lead to a number of security issues, including:

The same passwords being used in different Kubernetes clusters if the operator is deployed in parallel. (This issue was discovered because of four deployments having the same generated passwords due to automatically being deployed in parallel.)
The passwords being easily guessable based on the time the operator pod started when the database was created. (This would typically be present in logs, metrics, etc., that may typically be accessible to more people than should have database access.)
Fix this issue by replacing the current randomness source with crypto/rand, which should produce cryptographically secure random data that is virtually unguessable. This will avoid both of the above problems as each deployment will be guaranteed to have unique, indeterministic passwords.
2020-03-18 10:28:39 +01:00
Felix Kunde cf829df1a4
define ownership between operator and clusters via annotation (#802)
* define ownership between operator and postgres clusters
* add documentation
* add unit test
2020-03-17 16:34:31 +01:00
Dmitry Dolgov d666c52172
ClusterDomain default (#863)
* add json:omitempty option to ClusterDomain

* Add default value for ClusterDomain

Unfortunately, omitempty in operator configuration CRD doesn't mean that
defauls from operator config object will be picked up automatically.
Make sure that ClusterDomain default is specified, so that even when
someone will set cluster_domain = "", it will be overwritted with a
default value.

Co-authored-by: mlu42 <mlu42pro@gmail.com>
2020-03-13 11:51:39 +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
grantlanglois 650b8daf77
add json:omitempty option to ClusterDomain (#851)
Co-authored-by: mlu42 <mlu42pro@gmail.com>
2020-03-12 12:12:53 +01:00
Felix Kunde cde61f3f0b
e2e: wait for pods after disabling anti affinity (#862) 2020-03-11 14:08:54 +01:00
Jonathan Herlin 35b2213e05
Fix typo in values file (#861)
* Fix typo

Co-authored-by: Jonathan Herlin <jonathan.herlin@elits.com>
2020-03-11 11:32:13 +01:00
Felix Kunde ae2a38d62a
add e2e test for node readiness label (#846)
* add e2e test for node readiness label
* refactoring and order tests alphabetically
* always wait for replica after failover
2020-03-06 12:55:34 +01:00
Hengchu Zhang 51909204fd
Change `logging_rest_api.api_port` to `8080` instead of `8008` (#848)
The documentation states that the default operator REST service is at port `8080`, but the current default CRD based configuration is `8008`. Changing the default config to match documentation.
2020-02-28 14:13:58 +01:00
Felix Kunde b24da3201c
bump version to 1.4.0 + some polishing (#839)
* bump version to 1.4.0 + some polishing
* align version for UI chart
* update user docs to warn for standby replicas
* minor log message changes for RBAC resources
2020-02-25 09:50:54 +01:00
Felix Kunde fb9ef11e4e
align UI pipeline with operator (#844)
* align UI pipeline with operator
2020-02-24 17:48:14 +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 7b94060d17
fix validation for S3ForcePathStyle (#841) 2020-02-21 16:36:23 +01:00
Felix Kunde e2a9b03913
bump spilo version to latest release (#836) 2020-02-20 16:21:21 +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
Felix Kunde 54796945f6
added pinned werkzeug dep to UI requirements (#835) 2020-02-19 14:19:55 +01:00
Felix Kunde d5660f65bb
[UI] add tab for monthly costs per cluster (#796)
* add tab for monthly costs per cluster
* sync run_local and update version number
* lowering resources
* some Makefile polishing and updated admin docs on UI
* extend admin docs on UI
* add api-service manifest for operator
* set min limits in UI to default min limits of operator
* reflect new UI helm charts in docs
* make cluster name label configurable
2020-02-19 12:58:24 +01:00
Felix Kunde aea9e9bd33
postgres-pod clusterrole (#832)
* define postgres-pod clusterrole and align rbac in chart
* align UI chart rbac with operator and update doc
* operator RBAC needs podsecuritypolicy to grant it to postgres-pod
2020-02-19 12:32:54 +01:00
Jonathan Juares Beber 4b440e59de
Fix test flakiness on TestSameService (#833)
The code added on #818 depends on map sorting to return a static reason
for service annotation changes. To avoid tests flakiness and map sorting
the tests include a `strings.HasPrefix` instead of comparing the whole
string. One of the test cases,
`service_removes_a_custom_annotation,_adds_a_new_one_and_change_another`,
is trying to test the whole reason string.

This commit replaces the test case reason, for only the reason prefix.
It removes the flakiness from the tests. As all the cases (annotation
adding, removing and value changing) are tested before, it's safe to
test only prefixes.

Also, it renames the test name from `TestServiceAnnotations` to
`TestSameService` and introduces a better description in case of test
failure, describing that only prefixes are tested.
2020-02-18 16:45:44 +01:00
Felix Kunde 702a194c41
switch to rbac/v1 (#829)
* switch to rbac/v1
2020-02-17 11:25:07 +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
Jonathan Juares Beber 744c71d16b
Allow services update when changing annotations (#818)
The current implementations for `pkg.util.k8sutil.SameService` considers
only service annotations change on the default annotations created by the
operator. Custom annotations are not compared and consequently not
applied after the first service creation.

This commit introduces a complete annotations comparison between the
current service created by the operator and the new one generated based on
the configs. Also, it adds tests on the above-mentioned function.
2020-02-13 10:55:30 +01:00
Fredrik Østrem 00f00af2e8
Fix MasterPodMoveTimeout field that cannot be unmarshalled (#816)
* Update operator_configuration_type.go

* Update operator_config.go
2020-02-11 17:16:38 +01:00
Felix Kunde be6c8cd573
specify cluster in e2e taint test (#823) 2020-02-10 16:41:51 +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
siku4 1ee99b8194
add first version of ui helm chart (#795)
* add first version of ui helm chart
* add postgres versions 12 and 9.5
2020-02-05 16:54:46 +01:00
siku4 8794e4f9ac
add service for exposing operator api (#794) 2020-02-03 15:30:26 +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
Jonathan Juares Beber fddaf0fb73 Change error computation on JSON Unmarshal and create subtests on table test scenarios (#801)
* Change error computation on JSON Unmarshall

The [Unmarshall function][1] on the encoding/JSON default library returns
different errors for different go versions. On Go 1.12, the version used
currently on the CI system it returns `json: cannot unmarshal number into
Go struct field PostgresSpec.teamId of type string`. On Go 1.13.5 it
returns `json: cannot unmarshal number into Go struct field
PostgresSpec.spec.teamId of type string`. The new version includes more
details of the whole structure being unmarshelled.

This commit introduces the same error but one level deeper on the JSON
structure. It creates consistency across different Go versions.

[1]: https://godoc.org/encoding/json#Unmarshal

* Create subtests on table test scenarios

The Run method of T allows defining subtests creating hierarchical tests.
It provides better visibility of tests in case of failure. More
details on https://golang.org/pkg/testing/.

This commit converts each test scenario on
pkg/apis/acid.zalan.do/v1/util_test.go to subtests, providing a better
visibility and the debugging environment when working with tests. The
following code snippet shows an error during test execution with
subtests:

```
--- FAIL: TestUnmarshalMaintenanceWindow (0.00s)
    --- FAIL: TestUnmarshalMaintenanceWindow/expect_error_as_'From'_is_later_than_'To' (0.00s)
```

It included a `about` field on test scenarios describing the test
purpose and/or it expected output. When a description was provided with
comments it was moved to the about field.
2020-01-27 14:43:32 +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 e6ce00050f
reduce tracing of dumps and include Pg12 (#791) 2020-01-13 18:23:04 +01:00
Felix Kunde 077f9af4e3
bump to v1.3.1 (#780) 2020-01-06 14:08:47 +01:00
Felix Kunde b54458ee3c
update copyright in generated code (#779)
* update year in copyright of generated code and LICENSE file
2020-01-02 17:34:49 +01:00
Felix Kunde 9d7604ecf0
use v1.3.0-dirty tag (#778) 2020-01-02 14:06:23 +01:00
Felix Kunde 59a329d77b
update operator release image (#777) 2020-01-02 13:41:58 +01:00
Felix Kunde 7af1de890c
bump operator v1.3.0 with Spilo 12 image (#770) 2019-12-17 17:13:56 +01:00
Felix Kunde 182e3bc7db
add missing fields to OperatorConfiguration CRD validation (#767) 2019-12-16 17:08:09 +01:00
Felix Kunde 629feac98f
Remove bind verb and explain privileges (#765)
Closes #256
2019-12-16 17:07:36 +01:00
Felix Kunde 97e0d6d388
extend docs and polish manifest examples (#762) 2019-12-12 17:55:41 +01:00