Commit Graph

24 Commits

Author SHA1 Message Date
Jociele Padilha a5663da64f
add the pg version 16 (#2557)
* add the pg version 16

* add comma after pg16 in crds api

* change minimal_major_version to 12

* add new spilo image for pg16

* edit the registry from current and lazy spilo

* Update e2e/run.sh

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

* Update README.md

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

* add pg 11 to be compatible for the existing DBs

* update pq, pyyaml,k8s and kind version

* skip test_infrastructure_roles

* skip another test

* remove the skipping

* adjust the verification of new Patroni version states

---------

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2024-03-13 16:43:25 +01:00
Felix Kunde 29ea863faf
allow empty resources when defaults are empty (#2524)
* allow empty resources when defaults are empty
* update codegen
* add more unit tests and remove internal resources defaults
* a unit test for min limit and raising to request
* uncomment defaults in example configmap
* simplifying pooler pod generation unit test
2024-02-09 07:35:53 +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 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
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
hlihhovac 47b11f7f89
change Clone attribute of PostgresSpec to *CloneDescription (#1020)
* change Clone attribute of PostgresSpec to *ConnectionPooler

* update go.mod from master

* fix TestConnectionPoolerSynchronization()

* Update pkg/apis/acid.zalan.do/v1/postgresql_type.go

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

Co-authored-by: Pavlo Golub <pavlo.golub@gmail.com>
Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
2020-07-30 16:31:29 +02: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
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 97e0d6d388
extend docs and polish manifest examples (#762) 2019-12-12 17:55:41 +01:00
Thomas Runyon 535517cd1b Custom annotations 329 (#657)
* Add ability for custom annotations to database pods
2019-11-11 10:45:35 +01:00
Felix Kunde 3a914f9a3c
camelCasing all manifest parameters (#602)
* deprecate snake_case manifest parameters
* move backward compatible check and update test
2019-07-05 18:14:03 +02:00
Felix Kunde 36003b8264
enable shmVolume setting in OperatorConfiguration (#605)
* enable shmVolume setting in OperatorConfiguration
2019-07-05 16:48:37 +02:00
Rafia Sabih 540d58d5bd
Adding the support for standby cluster
This will set up a continuous wal streaming cluster, by adding the corresponding section in postgres manifest. Instead of having a full-fledged standby cluster as in Patroni, here we use only the wal path of the source cluster and stream from there.

Since, standby cluster is streaming from the master and does not require to create or use databases of it's own. Hence, it bypasses the creation of users or databases.

There is a separate sample manifest added to set up a standby-cluster.
2019-06-21 10:11:39 +02:00
Maxim Ivanov 3553144cda Support subPath in generated container (#452)
* mounted volumes now provide a subPath
2019-06-17 15:49:01 +02:00
teuto.net Netzdienste GmbH bbf28c4df7 Add additional S3 settings for cloning (#497) 2019-06-14 12:28:00 +02:00
Dmitry Dolgov f29bdaf96a
Override clone s3 bucket path (#487)
Override clone s3 bucket path

Add possibility to use a custom s3 bucket path for cloning a cluster
from an arbitrary bucket (e.g. from another k8s cluster). For that
a new config options is introduced `s3_wal_path`, that should point
to a location that spilo would understand.
2019-05-10 12:52:42 +02:00
Felix Kunde 0fbfbb23bb
Use /status subresource instead of plain manifest field (#534)
* turns PostgresStatus type into a struct with field PostgresClusterStatus
* setStatus patch target is now /status subresource
* unmarshalling PostgresStatus takes care of previous status field convention
* new simple bool functions status.Running(), status.Creating()
2019-05-07 12:01:45 +02:00
Dmitry Dolgov d6e6b00770
Add shm_volume option (#427)
Add possibility to mount a tmpfs volume to /dev/shm to avoid issues like
[this](https://github.com/docker-library/postgres/issues/416). To achieve that
two new options were introduced:

* `enableShmVolume` to PostgreSQL manifest, to specify whether or not mount
this volume per database cluster

* `enable_shm_volume` to operator configuration, to specify whether or not mount
per operator.

The first one, `enableShmVolume` takes precedence to allow us to be more flexible.
2018-12-21 16:22:30 +01:00
zerg-junior 45c89b3da4
[WIP] Add set_memory_request_to_limit option (#406)
* Add set_memory_request_to_limit option
2018-11-15 14:00:08 +01:00
zerg-junior 86ba92ad02
Rename 'permanent_slots' field to 'slots' (#401) 2018-10-31 16:11:28 +01:00
zerg-junior 1b4181a724
[WIP] Add the ability to configure replications slots in Patroni (#398)
* Add the ability to configure replication slots in Patroni

* Add debugging  to Makefile for CDP builds
2018-10-31 13:10:56 +01:00
Noah Kantrowitz 688d252752 Some tweaks to ensure compat with newer Go. (#383) 2018-09-17 10:13:07 +02:00
zerg-junior 1e53e22773 Improve error reporting for short cluster names (#377)
* Improve error reporting for short cluster names

* Revert to clusterName
2018-08-29 17:08:59 +02:00
Oleksii Kliukin e1ed4b847d
Use code-generation for CRD API and deepcopy methods (#369)
Client-go provides a https://github.com/kubernetes/code-generator package in order to provide the API to work with CRDs similar to the one available for built-in types, i.e. Pods, Statefulsets and so on.

Use this package to generate deepcopy methods (required for CRDs), instead of using an external deepcopy package; we also generate APIs used to manipulate both Postgres and OperatorConfiguration CRDs, as well as informers and listers for the Postgres CRD, instead of using generic informers and CRD REST API; by using generated code we can get rid of some custom and obscure CRD-related code and use a better API.

All generated code resides in /pkg/generated, with an exception of zz_deepcopy.go in apis/acid.zalan.do/v1

Rename postgres-operator-configuration CRD to OperatorConfiguration, since the former broke naming convention in the code-generator.

Moved Postgresql, PostgresqlList, OperatorConfiguration and OperatorConfigurationList and other types used by them into

Change the type of  the Error field in the Postgresql crd to a string, so that client-go could generate a deepcopy for it.

Use generated code to set status of CRD objects as well. Right now this is done with patch, however, Kubernetes 1.11 introduces the /status subresources, allowing us to set the status with
the special updateStatus call in the future. For now, we keep the code that is compatible with earlier versions of Kubernetes.

Rename postgresql.go to database.go and status.go to logs_and_api.go to reflect the purpose of each of those files.

Update client-go dependencies.

Minor reformatting and renaming.
2018-08-15 17:22:25 +02:00