diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2017-11-03 13:10:50 +0300 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2017-11-03 13:10:50 +0300 |
commit | 49210dfff12ba0fba5fdbcdc2c485fbbde43f83f (patch) | |
tree | 8207b9d670dd3f5342e07a78a114903b7dbc0e95 /app/controllers/projects | |
parent | 1ca9aaf860e09351a94331020cd43be4af5f2131 (diff) |
Schedule k8s application installation with a service
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/clusters/applications_controller.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/app/controllers/projects/clusters/applications_controller.rb b/app/controllers/projects/clusters/applications_controller.rb index cdebbdefb3f..aa36ccac804 100644 --- a/app/controllers/projects/clusters/applications_controller.rb +++ b/app/controllers/projects/clusters/applications_controller.rb @@ -5,12 +5,12 @@ class Projects::Clusters::ApplicationsController < Projects::ApplicationControll before_action :authorize_create_cluster!, only: [:create] def create - return render_404 if application - respond_to do |format| format.json do - # TODO: Do that via Service - if application_class.create(cluster: cluster).persisted? + scheduled = Clusters::Applications::ScheduleInstallationService.new(project, current_user, + application_class: @application_class, + cluster: @cluster).execute + if scheduled head :no_data else head :bad_request @@ -26,10 +26,6 @@ class Projects::Clusters::ApplicationsController < Projects::ApplicationControll end def application_class - Clusters::Cluster::APPLICATIONS[params[:application]] || render_404 - end - - def application - application_class.find_by(cluster: cluster) + @application_class ||= Clusters::Cluster::APPLICATIONS[params[:application]] || render_404 end end |