summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-11-01 16:12:44 +0900
committerShinya Maeda <shinya@gitlab.com>2017-11-01 16:12:44 +0900
commit6571efb6c3afd568c019e7bb46aba84328a4e821 (patch)
tree24d455c614cf37dac75c6e83d4d58555247bc7b0 /app
parentef3ebed6d3d3910bdf6080d6304ee7c5d5b0cc87 (diff)
downloadgitlab-ce-6571efb6c3afd568c019e7bb46aba84328a4e821.tar.gz
Fix spec. Fix usage ping. Fix warnings by adding new models and attributes.
Diffstat (limited to 'app')
-rw-r--r--app/models/clusters/platforms/kubernetes.rb6
-rw-r--r--app/services/clusters/create_service.rb12
2 files changed, 12 insertions, 6 deletions
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb
index e30ab805f1e..52022509d49 100644
--- a/app/models/clusters/platforms/kubernetes.rb
+++ b/app/models/clusters/platforms/kubernetes.rb
@@ -30,10 +30,8 @@ module Clusters
message: Gitlab::Regex.kubernetes_namespace_regex_message
}
- # TODO: when cluster.gcp? skip validation when create a record
- # TODO: when cluster.user? validates always
- # validates :api_url, url: true, presence: true
- # validates :token, presence: true
+ validates :api_url, url: true, presence: true
+ validates :token, presence: true
after_save :clear_reactive_cache!
diff --git a/app/services/clusters/create_service.rb b/app/services/clusters/create_service.rb
index 8c30e247fdc..503118fa6b6 100644
--- a/app/services/clusters/create_service.rb
+++ b/app/services/clusters/create_service.rb
@@ -2,6 +2,9 @@ module Clusters
class CreateService < BaseService
attr_reader :access_token
+ TEMPOLARY_API_URL = 'http://tempolary_api_url'.freeze
+ TEMPOLARY_TOKEN = 'tempolary_token'.freeze
+
def execute(access_token)
@access_token = access_token
@@ -28,8 +31,13 @@ module Clusters
def cluster_params
return @cluster_params if defined?(@cluster_params)
- params[:provider_gcp_attributes].try do |h|
- h[:access_token] = access_token
+ params[:provider_gcp_attributes].try do |provider|
+ provider[:access_token] = access_token
+
+ params[:platform_kubernetes_attributes].try do |platform|
+ platform[:api_url] = TEMPOLARY_API_URL
+ platform[:token] = TEMPOLARY_TOKEN
+ end
end
@cluster_params = params.merge(user: current_user)