diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-09-26 20:34:49 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-26 20:34:49 +0900 |
commit | 55ac72e56e0cdf6faf2fcd93939d0dd77048a8ee (patch) | |
tree | 8f153205110ce97032b698b420137153ef7fdca8 /app | |
parent | 3823707a0bc30ffd61e9bdaf5e05ef2a4dc975e1 (diff) | |
download | gitlab-ce-55ac72e56e0cdf6faf2fcd93939d0dd77048a8ee.tar.gz |
Create cluster
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/clusters_controller.rb | 17 | ||||
-rw-r--r-- | app/views/projects/clusters/_form.html.haml | 9 | ||||
-rw-r--r-- | app/views/projects/clusters/_login.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/clusters/edit.html.haml | 6 | ||||
-rw-r--r-- | app/views/projects/clusters/new.html.haml | 17 |
5 files changed, 31 insertions, 20 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 0d9707a8ff8..bc7e23bae59 100644 --- a/app/controllers/projects/clusters_controller.rb +++ b/app/controllers/projects/clusters_controller.rb @@ -37,10 +37,11 @@ class Projects::ClustersController < Projects::ApplicationController if params['creation_type'] == 'on_gke' # Create a cluster on GKE results = api_client.projects_zones_clusters_create( - params['gcp_project_id'], - params['cluster_zone'], - params['cluster_name'], - params['cluster_size'] + project_id: params['gcp_project_id'], + zone: params['cluster_zone'], + cluster_name: params['cluster_name'], + cluster_size: params['cluster_size'], + machine_type: params['machine_type'] ) # Update service @@ -90,7 +91,15 @@ class Projects::ClustersController < Projects::ApplicationController def edit unless session[GoogleApi::CloudPlatform::Client.token_in_session] @authorize_url = api_client.authorize_url + render :edit end + + # Get cluster information + api_client.projects_zones_clusters_get( + project_id: cluster.gcp_project_id, + zone: cluster.cluster_zone, + cluster_id: cluster.cluster_name + ) end def update diff --git a/app/views/projects/clusters/_form.html.haml b/app/views/projects/clusters/_form.html.haml new file mode 100644 index 00000000000..0718fb97df2 --- /dev/null +++ b/app/views/projects/clusters/_form.html.haml @@ -0,0 +1,9 @@ +Create a new cluster +%br +Avaiable GCP project lists +%br +Avaiable zones +%br += link_to "Create on Google Container Engine", namespace_project_clusters_path(@project.namespace, @project, creation_type: 'on_gke', cluster_name: 'gke-test-creation', gcp_project_id: 'gitlab-internal-153318', cluster_zone: 'us-central1-a', cluster_size: '1', project_namespace: 'aaa', machine_type: '???'), method: :post +%br += link_to "Use existing kubernets cluster", namespace_project_clusters_path(@project.namespace, @project, creation_type: 'manual', end_point: 'xxx.xxx.xxx.xxx', ca_cert: 'xxx...xxx', token: 'xxx', project_namespace: 'aaa'), method: :post diff --git a/app/views/projects/clusters/_login.html.haml b/app/views/projects/clusters/_login.html.haml new file mode 100644 index 00000000000..ccb5d68ac4c --- /dev/null +++ b/app/views/projects/clusters/_login.html.haml @@ -0,0 +1,2 @@ +Login +%p= link_to("authenticate from here", @authorize_url) diff --git a/app/views/projects/clusters/edit.html.haml b/app/views/projects/clusters/edit.html.haml index 6445b3ee75d..83c6ad7dae6 100644 --- a/app/views/projects/clusters/edit.html.haml +++ b/app/views/projects/clusters/edit.html.haml @@ -1,2 +1,6 @@ edit/show cluster -= @cluster.inspect + +- if @authorize_url + = render "login" +- else + = @cluster.inspect
\ No newline at end of file diff --git a/app/views/projects/clusters/new.html.haml b/app/views/projects/clusters/new.html.haml index b716cc51c20..6ab22a5d351 100644 --- a/app/views/projects/clusters/new.html.haml +++ b/app/views/projects/clusters/new.html.haml @@ -1,17 +1,4 @@ -Create a new cluster - -%br - - if @authorize_url - I have not authenticated yet. I can authenticate from - = link_to("authenticate from here", @authorize_url) + = render "login" - else - I have already authenticated. - %br - Avaiable GCP project lists - %br - Avaiable zones - %br - = link_to "Create on Google Container Engine", namespace_project_clusters_path(@project.namespace, @project, creation_type: 'on_gke', cluster_name: 'new-cluster-shinya', gcp_project_id: 'gitlab-internal', cluster_zone: 'gitlab-internal', cluster_size: 'gitlab-internal', project_namespace: 'aaa'), method: :post - %br - = link_to "Use existing kubernets cluster", namespace_project_clusters_path(@project.namespace, @project, creation_type: 'manual', end_point: 'xxx.xxx.xxx.xxx', ca_cert: 'xxx...xxx', token: 'xxx', project_namespace: 'aaa'), method: :post + = render "form" |