Commit Graph

160 Commits

Author SHA1 Message Date
Murat Kabilov 54defa8070 Merge branch 'fix/graceful-shutdown' into feature/diagnostic-rest-api
# Conflicts:
#	pkg/controller/controller.go
#	pkg/controller/pod.go
#	pkg/controller/postgresql.go
2017-07-25 17:09:22 +02:00
Murat Kabilov 28a63c695c Merge branch 'master' into feature/diagnostic-rest-api
# Conflicts:
#	pkg/controller/controller.go
#	pkg/controller/pod.go
2017-07-25 16:38:40 +02:00
Murat Kabilov 27e21c6ec8 fix strange argument order 2017-07-25 15:55:07 +02:00
Murat Kabilov 9bff6cff39 merge with master 2017-07-25 15:44:47 +02:00
Murat Kabilov 50aaa16574 Merge branch 'master' into fix/graceful-shutdown
# Conflicts:
#	pkg/cluster/cluster.go
#	pkg/cluster/exec.go
#	pkg/cluster/k8sres.go
#	pkg/cluster/pod.go
#	pkg/cluster/resources.go
#	pkg/cluster/util.go
#	pkg/cluster/volumes.go
#	pkg/controller/controller.go
#	pkg/controller/pod.go
#	pkg/controller/postgresql.go
#	pkg/controller/util.go
#	pkg/controller/util_test.go
#	pkg/spec/postgresql.go
#	pkg/spec/postgresql_test.go
#	pkg/util/util.go
#	pkg/util/util_test.go
2017-07-25 15:41:06 +02:00
Murat Kabilov 1f8b37f33d Make use of kubernetes client-go v4
* client-go v4.0.0-beta0
* remove unnecessary methods for tpr object
* rest client: use interface instead of structure pointer
* proper names for constants; some clean up for log messages
* remove teams api client from controller and make it per cluster
2017-07-25 15:25:17 +02:00
Murat Kabilov 848a37e94d merge with refactor-tpr 2017-07-25 10:41:14 +02:00
Murat Kabilov acebdf0122 Merge branch 'feature/refactor-tpr' into fix/graceful-shutdown
# Conflicts:
#	pkg/controller/controller.go
2017-07-25 10:38:33 +02:00
Murat Kabilov 941bfb3cc5 remove teams api client from controller and make it per cluster 2017-07-25 01:01:49 +02:00
Murat Kabilov 9c19a22a7f fix typos 2017-07-25 00:41:28 +02:00
Murat Kabilov 0ed47c7aea fix controller util test 2017-07-25 00:36:10 +02:00
Murat Kabilov 2bbcb5f627 split init controller; make controller config private 2017-07-25 00:35:52 +02:00
Murat Kabilov a30329e04a fix list cluster 2017-07-24 21:55:04 +02:00
Murat Kabilov b2a882f9fd merge with master 2017-07-24 21:42:57 +02:00
Murat Kabilov 035069137a Merge branch 'master' into feature/refactor-tpr
# Conflicts:
#	cmd/main.go
#	pkg/cluster/cluster.go
#	pkg/controller/controller.go
#	pkg/controller/util.go
2017-07-24 21:21:42 +02:00
Murat Kabilov fc8f0916a5 fix exec 2017-07-24 19:45:17 +02:00
Murat Kabilov 143eb968ea refactor 2017-07-24 19:38:08 +02:00
Oleksii Kliukin 4455f1b639 Feature/unit tests (#53)
- Avoid relying on Clientset structure to call Kubernetes API functions.
While Clientset is a convinient "catch-all" abstraction for calling
REST API related to different Kubernetes objects, it's impossible to
mock. Replacing it wih the kubernetes.Interface would be quite
straightforward, but would require an exra level of mocked interfaces,
because of the versioning. Instead, a new interface is defined, which
contains only the objects we need of the pre-defined versions.

-  Move KubernetesClient to k8sutil package.
- Add more tests.
2017-07-24 16:56:46 +02:00
Murat Kabilov d7e9142fc7 proper names for constants; some clean up for log messages 2017-07-24 12:37:06 +02:00
Murat Kabilov 2161a0816c use scheme package instead of api 2017-07-18 12:24:15 +02:00
Murat Kabilov 129bcd7bd6 rest client: use interface instead of structure pointer 2017-07-17 17:08:40 +02:00
Murat Kabilov 3165106317 use get parameter for k8s resource watch url 2017-07-17 17:07:16 +02:00
Murat Kabilov 4d936fc3a1 use proper ParameterCodec 2017-07-17 15:21:06 +02:00
Murat Kabilov 51672b9e79 Merge branch 'master' into client-go-v4 2017-07-17 12:27:27 +02:00
Murat Kabilov b70c5b3a63 Merge branch 'master' into feature/diagnostic-rest-api 2017-07-17 11:56:47 +02:00
Murat Kabilov 7206cd0cdb Merge branch 'client-go-v4' into fix/graceful-shutdown
# Conflicts:
#	pkg/controller/pod.go
2017-07-17 11:12:36 +02:00
Murat Kabilov f7774803b6 get rid of unnecessary goroutines 2017-07-17 10:37:14 +02:00
Murat Kabilov f326e58456 add waiting group in the main thread 2017-07-14 18:19:56 +02:00
Murat Kabilov 7a2643386c Merge branch 'master' into fix/graceful-shutdown 2017-07-14 18:16:36 +02:00
Murat Kabilov 4f36e447c3 Skip config params with no values (#62) 2017-07-14 17:22:25 +02:00
Murat Kabilov 17711d5087 graceful shutdown goroutines on operator exit 2017-07-14 16:00:49 +02:00
Murat Kabilov 27b485641e diagnostic rest api [WIP] 2017-07-14 15:58:59 +02:00
Murat Kabilov 820ce85d4d fix import 2017-07-12 14:04:43 +02:00
Murat Kabilov 3fbe8ed7e0 remove unused import 2017-07-12 13:59:05 +02:00
Murat Kabilov ce2648c62e client-go v4.0.0-beta0
go fmt

glide
2017-07-12 12:54:19 +02:00
Oleksii Kliukin a8ed1e25b4 Avoid re-creating master pod if it is empty during sync. (#58)
Fixes #59
2017-07-12 10:57:20 +02:00
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
Murat Kabilov 9a6b0b8c37 Tests for teams API (#46) 2017-06-12 17:29:32 +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