Commit Graph

1202 Commits

Author SHA1 Message Date
Oleksii Kliukin 00150711e4 Configure load balancer on a per-cluster and operator-wide level (#57)
* Deny all requests to the load balancer by default.
* Operator-wide toggle for the load-balancer.
* Define per-cluster useLoadBalancer option.

If useLoadBalancer is not set - then operator-wide defaults take place. If it
is true - the load balancer is created, otherwise a service type clusterIP is
created.

Internally, we have to completely replace the service if the service type
changes. We cannot patch, since some fields from the old service that will
remain after patch are incompatible with the new one, and handling them
explicitly when updating the service is ugly and error-prone. We cannot
update the service because of the immutable fields, that leaves us the only
option of deleting the old service and creating the new one. Unfortunately,
there is still an issue of unnecessary removal of endpoints associated with
the service, it will be addressed in future commits.

* Revert the unintended effect of go fmt

* Recreate endpoints on service update.

When the service type is changed, the service is deleted and then
the one with the new type is created. Unfortnately, endpoints are
deleted as well. Re-create them afterwards, preserving the original
addresses stored in them.

* Improve error messages and comments. Use generate instead of gen in names.
2017-06-30 13:38:49 +02:00
Oleksii Kliukin ba6529bec9 Avoid pushing postgres-operator image on PRs. (#52)
Do push as postgres-operator from the master branch, and as a
postgres-operator-test when evaluating pull-requests.
2017-06-14 14:56:04 +02:00
Oleksii Kliukin 2f5a349477 CDP integration (#51)
Build docker images from the master branch via CDP and push them to the registry.opensource.zalan.do
2017-06-13 18:12:04 +02:00
Oleksii Kliukin fe6c162e59 Add a few badges (#50)
#6
2017-06-12 18:10:23 +02:00
Oleksii Kliukin 0de1537c4e Travis CI (#49) 2017-06-12 17:39:41 +02:00
Murat Kabilov 9a6b0b8c37 Tests for teams API (#46) 2017-06-12 17:29:32 +02:00
Oleksii Kliukin c773a4e43d A bare bones .travis.yml (#48) 2017-06-12 16:31:25 +02:00
Oleksii Kliukin 987990fb0e Move service annotation patch template into the constants. 2017-06-12 10:24:23 +02:00
Oleksii Kliukin 17826ee434 Go fmt run. 2017-06-12 10:24:23 +02:00
Oleksii Kliukin 51d73fb172 Replace service annotations when updating services.
In case the whole annotation changes (like the external DNS) we
don't want to keep the old one hanging around. Unline specs, we
don't expect anyone except the operator to change the annotations.

Use StrategicMergePatchType in order to replace the annotations
map completely.
2017-06-12 10:24:23 +02:00
Oleksii Kliukin e0dacd0ca9 Remove an unused export. 2017-06-08 16:17:01 +02:00
Murat Kabilov a9d746878b fix golint warn 2017-06-08 15:52:01 +02:00
Murat Kabilov 1540a2ba65 fix typos;
remove unnecessary tests;
go fmt -s
2017-06-08 15:52:01 +02:00
Murat Kabilov e104a67260 Fix resync of the clusters 2017-06-08 11:51:48 +02:00
Murat Kabilov bdc2db97ac Tests for Specs and Teams API 2017-06-08 10:58:48 +02:00
Oleksii Kliukin bc0e9ab4bc Add error checks per report from errcheck-ng 2017-06-08 10:41:44 +02:00
Murat Kabilov 292a9bda05 Check for dns annotation of the service 2017-06-07 16:41:39 +02:00
Oleksii Kliukin dc36c4ca12 Implement replicaLoadBalancer boolean flag. (#38)
The flag adds a replica service with the name cluster_name-repl and
a DNS name that defaults to {cluster}-repl.{team}.{hostedzone}.

The implementation converted Service field of the cluster into a map
with one or two elements and deals with the cases when the new flag
is changed on a running cluster
(the update and the sync should create or delete the replica service).
In order to pick up master and replica service and master endpoint
when listing cluster resources.

* Update the spec when updating the cluster.
2017-06-07 13:54:17 +02:00
Oleksii Kliukin 7b0ca31bfb Implements EBS volume resizing #35.
In order to support volumes different from EBS and filesystems other than EXT2/3/4 the respective code parts were implemented as interfaces. Adding the new resize for the volume or the filesystem will require implementing the interface, but no other changes in the cluster code itself.

Volume resizing first changes the EBS and the filesystem, and only afterwards is reflected in the Kubernetes "PersistentVolume" object. This is done deliberately to be able to check if the volume needs resizing by peeking at the Size of the PersistentVolume structure. We recheck, nevertheless, in the EBSVolumeResizer, whether the actual EBS volume size doesn't match the spec, since call to the AWS ModifyVolume is counted against the resize limit of once every 6 hours, even for those calls that shouldn't result in an actual resize (i.e. when the size matches the one for the running volume).

As a collateral, split the constants into multiple files, move the volume code into a separate file and fix minor issues related to the error reporting.
2017-06-06 13:53:27 +02:00
Murat Kabilov 1fb05212a9 Refactor teams API package 2017-05-30 10:14:30 +02:00
Murat Kabilov f7aaf8863d Change maintenance window format 2017-05-30 09:56:10 +02:00
Murat Kabilov d39cfaab43 Fix password check in pguserpassword function 2017-05-29 13:44:30 +02:00
Murat Kabilov 1111964fee fix password check in pguserpassword
remove magic number
2017-05-26 18:19:12 +02:00
Murat Kabilov 009db16c7c Use queues for the pod events (#30) 2017-05-23 15:24:14 +02:00
Oleksii Kliukin 132c8425e6 Small Makefile improvements. (#31)
- Re-introduce -i flag for Mac OS
- Remove binary dependencies for builds to allow re-building w/o make
clean
2017-05-23 12:06:55 +02:00
Murat Kabilov c470bd6646 reset cluster error on successful update or sync (#29) 2017-05-22 15:45:38 +02:00
Oleksii Kliukin bc17897478 Run sync cluster when previous add failed. (#28) 2017-05-22 15:27:26 +02:00
Oleksii Kliukin afce38f6f0 Fix error messages (#27)
Use lowercase for kubernetes objects
Use %v instead of %s for errors
Start error messages with a lowercase letter.
2017-05-22 14:12:06 +02:00
Oleksii Kliukin 8beb5936b1 Don't error out at sync on existence of the object. (#26) 2017-05-22 12:58:47 +02:00
Murat Kabilov 4acaf27a5d Remove etcd requests (#25)
update glide
2017-05-19 17:18:37 +02:00
Murat Kabilov d34273543e Fix the golint, gosimple warnings 2017-05-18 17:38:54 +02:00
Murat Kabilov 233e8529c1 Return error instead of logging it 2017-05-18 17:24:44 +02:00
Murat Kabilov 95a57d1e4f Use named arguments in the DNS name format 2017-05-18 17:23:59 +02:00
Murat Kabilov 3b6454c2dc add missed return (#20) 2017-05-17 11:54:50 +02:00
Murat Kabilov f86275e60c Fix issues found by go vet 2017-05-17 11:31:28 +02:00
Oleksii Kliukin c2826b10e2 Merge branch 'master' into fix/go-vet-fixes 2017-05-17 11:30:07 +02:00
Oleksii Kliukin 4457ce4e47 Replace the statefulset if it cannot be updated. (#18)
Updates to statefulset spec for fields other than 'replicas' and
containers' are forbidden. However, it is possible to delete the old
statefulset without deleting its pods and create the new one, using the
changed specs. The new statefulset shall pick up the orphaned pods.

Change the statefulset's comparison to return the combined effect of
all checks, not just the first non-matching field.
2017-05-17 11:28:21 +02:00
Murat Kabilov 22bcae0784 skip unused variable 2017-05-17 11:15:09 +02:00
Murat Kabilov 6e5d7abcc5 pass cluster by reference 2017-05-17 11:05:15 +02:00
Murat Kabilov 356be8f0f1 skip clusters with invalid spec 2017-05-16 16:46:37 +02:00
Henning Jacobs 1d2fb0091f how to connect via psql (#15) 2017-05-15 18:09:00 +02:00
Henning Jacobs c08e83bebf #10 fix make docker (#11) 2017-05-14 22:12:48 +02:00
Henning Jacobs 946f623cf8 Fix typo & .gitignore (#9)
* add scm-source.json to .gitignore

* fix minor typo
2017-05-14 17:52:51 +02:00
Oleksii Kliukin c52d042f90 Merge pull request #5 from zalando-incubator/readme-changes
Minor style fixes.
2017-05-12 18:01:52 +02:00
Jan Mussler a8440f9ee4 Update README.md
I leave it to you, but postgres vs postgresql is a bit confusing, espacially since the resource is again postgresql
2017-05-12 17:55:50 +02:00
Oleksii Kliukin deb36f33e0 Merge pull request #4 from zalando-incubator/disable_teams_api_db_access_flags
Allow disabling access to the DB and the Teams API.

Command-line options --nodatabaseaccess and --noteamsapi disable all
teams api interaction and access to the Postgres database. This is
useful for debugging purposes when the operator runs out of cluster
(with --outofcluster flag).

The same effect can be achieved by setting enable_db_access and/or
enable_teams_api to false.
2017-05-12 17:52:34 +02:00
Oleksii Kliukin 5adceceb36 go fmt run 2017-05-12 17:48:25 +02:00
Oleksii Kliukin abd04e6f5a Avoid abbreviations in user-facing parameters. 2017-05-12 17:44:51 +02:00
Oleksii Kliukin 03064637f1 Allow disabling access to the DB and the Teams API.
Command-line options --nodatabaseaccess and --noteamsapi disable all
teams api interaction and access to the Postgres database. This is
useful for debugging purposes when the operator runs out of cluster
(with --outofcluster flag).

The same effect can be achieved by setting enable_db_access and/or
enable_teams_api to false.
2017-05-12 17:40:48 +02:00
Murat Kabilov 794ad96c88 move deploy Deploying the operator section in the end 2017-05-12 16:38:42 +02:00