diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-11-02 23:19:11 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-11-02 23:19:11 +0900 |
commit | b129f06733c7994fb81cef4d0bae6d6611647a83 (patch) | |
tree | 7dc99e8583a50502218ef0f9ad0bd3f4fa305f91 /app/services | |
parent | 438591436842b34689ea2eea32c90ee8c379f391 (diff) | |
download | gitlab-ce-b129f06733c7994fb81cef4d0bae6d6611647a83.tar.gz |
Fix out of sync with KubernetesService. Remove namespace pramas from controller. Use time_with_zone in schema. Remove Gcp::Clusters from safe_model_attributes.ym
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/clusters/create_service.rb | 8 | ||||
-rw-r--r-- | app/services/clusters/gcp/finalize_creation_service.rb | 7 |
2 files changed, 5 insertions, 10 deletions
diff --git a/app/services/clusters/create_service.rb b/app/services/clusters/create_service.rb index a1c74566d7a..1d407739b21 100644 --- a/app/services/clusters/create_service.rb +++ b/app/services/clusters/create_service.rb @@ -13,11 +13,7 @@ module Clusters private def create_cluster - Clusters::Cluster.create!( - cluster_params.merge( - projects: [project])) - rescue ActiveRecord::RecordInvalid => e - e.record + Clusters::Cluster.create(cluster_params) end def cluster_params @@ -27,7 +23,7 @@ module Clusters provider[:access_token] = access_token end - @cluster_params = params.merge(user: current_user) + @cluster_params = params.merge(user: current_user, projects: [project]) end end end diff --git a/app/services/clusters/gcp/finalize_creation_service.rb b/app/services/clusters/gcp/finalize_creation_service.rb index 53b13518771..cea56f4e849 100644 --- a/app/services/clusters/gcp/finalize_creation_service.rb +++ b/app/services/clusters/gcp/finalize_creation_service.rb @@ -9,11 +9,9 @@ module Clusters configure_provider configure_kubernetes - provider.make_created! + cluster.save! rescue Google::Apis::ServerError, Google::Apis::ClientError, Google::Apis::AuthorizationError => e provider.make_errored!("Failed to request to CloudPlatform; #{e.message}") - rescue KubeException => e - provider.make_errored!("Failed to request to Kubernetes; #{e.message}") rescue ActiveRecord::RecordInvalid => e provider.make_errored!("Failed to configure GKE Cluster: #{e.message}") end @@ -22,6 +20,7 @@ module Clusters def configure_provider provider.endpoint = gke_cluster.endpoint + provider.status_event = :make_created end def configure_kubernetes @@ -39,7 +38,7 @@ module Clusters 'https://' + gke_cluster.endpoint, Base64.decode64(gke_cluster.master_auth.cluster_ca_certificate), gke_cluster.master_auth.username, - gke_cluster.master_auth.password) + gke_cluster.master_auth.password).execute end def gke_cluster |