Commit Graph

89 Commits

Author SHA1 Message Date
Simone Gotti 0296d594b5 executor: add option to allow privileged containers
* add a config option allowPrivilegedContainers
* fail task setup if privileged containers are requested but they aren't
allowed.
* report if privileged containers are allowed to the runservice
2019-06-13 18:31:08 +02:00
Simone Gotti a53e14b4e8 runservice: check if executor is alive before scheduling tasks
Check that the last update time is less than 1 minute (currently hardcoded)
2019-06-12 18:12:37 +02:00
Simone Gotti 6e8d467c80 util: add ErrInternal
ErrInternal is an internal error that should be provided to the user (http api
will return a 500 with the error message)

It'll be used for any kind of error that are not auth or bad requests (like
errors to communicate to another service)
2019-06-11 10:59:21 +02:00
Simone Gotti 863277af2d runservice types: refactor unmarshal
* Don't use a complex UnmarshalJSON for RunConfigTask and ExecutorTask but
introduce a Steps type as a slice of Step (where Step is an empty interface)
and declare an UnmarshalJSON method on the Step type.
2019-06-08 16:30:36 +02:00
Simone Gotti 22bd181fc8 datamanager: implement data files splitting
split data files in multiple files of a max size (default 10Mib)
In this way every data snapshot will change only the datafiles that have some
changes instead of the whole single file.
2019-06-03 16:17:27 +02:00
Simone Gotti 6d095cbe50 readdb: ensure that we apply only etcd committed wals
Ensure that we apply only etcd commited wals to avoid doing an unuseful insert
when the wal becomes committed storage.
2019-06-03 18:02:09 +02:00
Simone Gotti c0a165de31 runservice: fix query when grouping by path
When grouping by group path we have to apply the filter to the group by using
HAVING and not using WHERE
2019-05-23 23:21:45 +02:00
Simone Gotti 4d7605a86b gateway: improve ErrFromRemote handling
Don't create an ErrFromRemote wrapping the returned error but
wrap the ErrFromRemote

Also use xerrors Is/As to get the underlying error to return to api clients
while maintaining context for logging
2019-05-23 12:59:11 +02:00
Simone Gotti 9b2ce717c7 *: migrate to "golang.org/x/xerrors"
Just a raw replace of "github.com/pkg/errors".

Next steps will improve errors (like remote errors, api errors, not exist errors
etc...) to leverage its functionalities
2019-05-23 11:23:14 +02:00
Simone Gotti b3867fb7ca objectstorage: add posix standard storage
rename the previous posix storage to posixflat and make it currently not user
selectable (since I'm not sure it's really worth using it).

The new posix storage uses the filesystem without any escaping so it's not a
real flat namespace.

This isn't a real issue since also minio is not a flat namespace and we are so
forced to use it like a hierarchycal filesystem.
2019-05-21 15:17:53 +02:00
Simone Gotti 0e10a406f9 *: remove server sent events from logs handlers
Just use basic http streaming and send all the data as it's available without
splitting by new lines
2019-05-19 14:35:04 +02:00
Simone Gotti bda7a3eb8b *: add run cancel action
and remove unused change phase to finished
2019-05-15 14:42:50 +02:00
Simone Gotti 81d557d785 runservice: add runEvents handler 2019-05-15 09:46:21 +02:00
Simone Gotti ac893f1c91 runservice: trigger run event in change run phase action 2019-05-15 09:41:56 +02:00
Simone Gotti b95fb98f3c runservice: move RunEvent to types 2019-05-15 09:40:32 +02:00
Simone Gotti 59e4a1f0ba runservice: update runconfig group comment 2019-05-10 11:16:57 +02:00
Simone Gotti 0c94386149 gateway: add badges endpoint
Currently we generate badges only for projects branches. In future this could be
extended to also generate badges for tags and PRs
2019-05-10 11:08:24 +02:00
Simone Gotti ce7924d7fd runservice: use the path escaped cache key
Use the path escaped cache key so we can also handle cache keys with slashes
inside.
2019-05-08 12:15:17 +02:00
Simone Gotti bec9476d6c runservice: store related runid with logs and archives
Logs and archives can be shared by multiple runs. So removing a run doesn't
imply that we could also remote the logs and archives since they could be
"referenced" by another run.

Store also the runids as specific objects along with the logs and archives so,
we'll remove them only when no runids objects exist.
2019-05-08 12:11:46 +02:00
Simone Gotti 1e34dca95d runservice: split and simplify scheduler and executor naming
Also if they are logically part of the runservice the names runserviceExecutor
and runserviceScheduler are long and quite confusing for an external user

Simplify them separating both the code parts and updating the names:

runserviceScheduler -> runservice
runserviceExecutor -> executor
2019-05-07 23:56:10 +02:00
Simone Gotti e4e7de4ad2 runservice/gateway: return run on run action 2019-05-07 23:23:58 +02:00
Simone Gotti afae185e11 *: rework run approval and annotations
* runservice: use generic task annotations instead of approval annotations
* runservice: add method to set task annotations

* gateway: when an user call the run task approval action, it will set in the
task annotations the approval users ids. The task won't be approved.

* scheduler: when the number of approvers meets the required minimum number
(currently 1) call the runservice to approve the task

In this way we could easily implement some approval features like requiring a
minimum number of approvers (saved in the task annotations) before marking the
run as approved in the runservice.
2019-05-06 15:19:29 +02:00
Simone Gotti a590c21127 runservice api: get run from readdb 2019-05-06 15:18:49 +02:00
Simone Gotti 3139ef38d9 runservice readdb: get run from ost db if it's not in run db 2019-05-06 14:55:10 +02:00
Simone Gotti cb78ea48bc runservice: rename command(handler) to action(handler)
Since we're going to migrate all actions (also queries that now are implemented
in the api handlers) there
2019-05-03 23:59:21 +02:00
Simone Gotti bad18bf814 *: report objects size for objectstorage.WriteObject 2019-05-02 09:49:55 +02:00
Simone Gotti 34cfdfeb3b objectstorage: add size option to WriteObject
On s3 limit the max object size to 1GiB when the size is not provided (-1) or
the minio client will calculate a big part size since it tries to use the
maximum object size (5TiB) and will allocate a very big buffer in ram. Also
leave as commented out the previous hack that was firstly creating the file
locally to calculate the size and then put it (for future reference).
2019-05-02 09:47:38 +02:00
Simone Gotti e964aa3537 objectstorage: add persist option to WriteObject
This options is a noop on s3 but on the posix implementation it becomes useful
when there isn't the need to have a persistent file, thus avoiding some fsync
calls.
2019-05-01 15:06:47 +02:00
Simone Gotti 27f84738d6 runservice: simplify workspace restore 2019-04-30 14:00:34 +02:00
Simone Gotti da6aefa7e2 runservice readdb: also resync changegroups 2019-04-29 10:16:19 +02:00
Simone Gotti f5cf3b9fa7 runservice: check changegroup name 2019-04-29 10:12:34 +02:00
Simone Gotti 2c3e6bf9e4 wal: update and rename to datamanager
* Rename to datamanager since it handles a complete "database" backed by an
objectstorage and etcd

* Don't write every single entry as a single file but group them in a single
file. In future improve this to split the data in multiple files of a max size.
2019-04-26 16:00:03 +02:00
Simone Gotti 41e333d7ec *: rename "lts" to "ost"
`lts` was choosen to reflect a "long term storage" but currently it's just an
object storage implementation. So use this term and "ost" as its abbreviation
(to not clash with "os").
2019-04-27 15:16:48 +02:00
Simone Gotti 33c328b3f5 runservice: move all scheduler etcd data to own dir 2019-04-27 08:59:47 +02:00
Simone Gotti e1368d18d6 runservice: add etcd pinger loop 2019-04-27 08:50:25 +02:00
Simone Gotti 9c7c589bba runservice executor: use k8s client informers/listers
Use k8s client informers/listers instead of polling the api every time
2019-04-26 10:15:23 +02:00
Simone Gotti 8989bd0e8e runservice: pass arch to driver
k8s driver: use the provided arch and set the related nodeselector label
(`kubernetes.io/arch`) when not empty.
2019-04-25 13:42:34 +02:00
Simone Gotti 6f88bd3d53 runservice: handle multiple executor archs
An executor can handle multiple archs (an executor that talks with a k8s cluster
with multi arch nodes). Don't use a label for archs but a custom executor
field.
2019-04-25 13:30:46 +02:00
Simone Gotti e0d37b08f2 runservice: add k8s driver 2019-04-22 17:54:24 +02:00
Simone Gotti 07bc4a21ff runservice scheduler: automatically remove dynamic executors 2019-04-24 13:25:41 +02:00
Simone Gotti 7c9be9b57d runservice executor: remove unused GetPodByID method 2019-04-24 15:53:03 +02:00
Simone Gotti a0d69f4bc3 runservice executor: update for executor groups
* Add the concept of executor groups and siblings executors
* Add the concept of dynamic executor: an executor in an executor group that
doesn't need to be manually deleted from the scheduler since the other sibling
executors will take care of cleaning up its pods.
* Remove external labels visibility from pod.
* Add functions to return the sibling executors and the executor group
* Delete pods of disappeared sibling executors
2019-04-24 12:37:55 +02:00
Simone Gotti 4da4f48f98 runservice executor: rename pod labels
* Use a command namespaced prefix
* Add executor id label for future usage
2019-04-22 18:19:43 +02:00
Simone Gotti abf908bcad runservice executor: rename makeEnv to makeEnvSlice 2019-04-22 18:19:13 +02:00
Simone Gotti 7e9abbf529 runservice executor: add driver Setup method
Remote custom `copytoolbox` hack and use a generic `Setup` function in the
driver interface
2019-04-22 18:17:55 +02:00
Simone Gotti 7ebc436854 runservice executor: generate pod id outside driver 2019-04-22 17:53:34 +02:00
Simone Gotti 17f3dc89f2 runservice executor: remove unused CopyTo method from driver 2019-04-22 18:27:48 +02:00
Simone Gotti dfeba334f6 runservice: update docker registry auth 2019-04-22 14:38:25 +02:00
Simone Gotti 9c74b4ddc1 runservice scheduler: choose scheduler only if it has capacity 2019-04-17 20:59:28 +02:00
Simone Gotti 1ac139434e runservice scheduler: cancel unscheduled root tasks when run has result
When run has a result set, root tasks not yet scheduled must be cancelled.
2019-04-17 18:00:34 +02:00