diff options
author | Tiger Watson <twatson@gitlab.com> | 2019-03-26 09:59:48 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-03-26 09:59:48 +0000 |
commit | 76d281881a945518fe4565e1dc71f6a3bc28c575 (patch) | |
tree | 3bece712d331a02e52ac9735fb4f85ac70b08ef5 /app/models/clusters/applications | |
parent | c77a1978cdadc9ae3fcfe7b1b31e535af80e61c9 (diff) | |
download | gitlab-ce-76d281881a945518fe4565e1dc71f6a3bc28c575.tar.gz |
Allow runners to be installed on group clusters
A runner installed on a cluster will now use the
cluster's `cluster_type` as its `runner_type`.
Diffstat (limited to 'app/models/clusters/applications')
-rw-r--r-- | app/models/clusters/applications/runner.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb index ef9cc4bd6d6..ec8f5cc40c0 100644 --- a/app/models/clusters/applications/runner.rb +++ b/app/models/clusters/applications/runner.rb @@ -13,7 +13,7 @@ module Clusters include ::Clusters::Concerns::ApplicationData belongs_to :runner, class_name: 'Ci::Runner', foreign_key: :runner_id - delegate :project, to: :cluster + delegate :project, :group, to: :cluster default_value_for :version, VERSION @@ -55,12 +55,17 @@ module Clusters end def runner_create_params - { + attributes = { name: 'kubernetes-cluster', - runner_type: :project_type, - tag_list: %w(kubernetes cluster), - projects: [project] + runner_type: cluster.cluster_type, + tag_list: %w[kubernetes cluster] } + + if cluster.group_type? + attributes.merge(groups: [group]) + elsif cluster.project_type? + attributes.merge(projects: [project]) + end end def gitlab_url |