diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-10-15 09:42:29 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-10-29 16:21:31 +1300 |
commit | 0e15eec86d83cbdfefe17966bf5c02e4d419a34d (patch) | |
tree | f2928be797556746f44e2689181d3cd5ba4dab79 /app/services/clusters/create_service.rb | |
parent | b868b02c626dc4f9986eb93e54cf593055121972 (diff) | |
download | gitlab-ce-0e15eec86d83cbdfefe17966bf5c02e4d419a34d.tar.gz |
Associate clusters model to groups34758-create-group-clusters
Even though we currently only should have one group for a cluster, we
allow the flexibility to associate to other groups in the future.
This also matches the runner <=> groups association.
- Adds Cluster#first_group, aliased to Cluster#group. For the
conceivable future, a cluster will have at most one group.
- Prevent mixing of group and project clusters. If project type
clusters, it should only have projects assigned. Similarly with groups.
- Default cluster_type to :project_type. As it's very small table we can
set default and null: false in one release.
Diffstat (limited to 'app/services/clusters/create_service.rb')
-rw-r--r-- | app/services/clusters/create_service.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/services/clusters/create_service.rb b/app/services/clusters/create_service.rb index c6e955800af..cd843b8ffa8 100644 --- a/app/services/clusters/create_service.rb +++ b/app/services/clusters/create_service.rb @@ -9,9 +9,9 @@ module Clusters end def execute(project:, access_token: nil) - raise ArgumentError.new(_('Instance does not support multiple Kubernetes clusters')) unless can_create_cluster?(project) + raise ArgumentError, _('Instance does not support multiple Kubernetes clusters') unless can_create_cluster?(project) - cluster_params = params.merge(user: current_user, projects: [project]) + cluster_params = params.merge(user: current_user, cluster_type: :project_type, projects: [project]) cluster_params[:provider_gcp_attributes].try do |provider| provider[:access_token] = access_token end |