summaryrefslogtreecommitdiff
path: root/app/views/clusters/clusters/gcp/_form.html.haml
blob: d1ea7fec49dbe89be83842d1d594c073f91c5ac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
= javascript_include_tag 'https://apis.google.com/js/api.js'
- external_link_icon = sprite_icon('external-link')
- zones_link_url = 'https://cloud.google.com/compute/docs/regions-zones/regions-zones'
- machine_type_link_url = 'https://cloud.google.com/compute/docs/machine-types'
- pricing_link_url = 'https://cloud.google.com/compute/pricing#machinetype'
- kubernetes_integration_url = help_page_path('user/project/clusters/index')
- help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe
- help_link_end = ' %{external_link_icon}</a>'.html_safe % { external_link_icon: external_link_icon }

%p
  = s_('ClusterIntegration|Read our %{link_start}help page%{link_end} on Kubernetes cluster integration.').html_safe % { link_start: help_link_start % { url: kubernetes_integration_url }, link_end: '</a>'.html_safe }

%p= link_to('Select a different Google account', @authorize_url)

= bootstrap_form_for @gcp_cluster, html: { class: 'gl-show-field-errors js-gke-cluster-creation prepend-top-20',
  data: { token: token_in_session } }, url: clusterable.create_gcp_clusters_path, as: :cluster do |field|
  = field.text_field :name, required: true, title: s_('ClusterIntegration|Cluster name is required.'),
    label: s_('ClusterIntegration|Kubernetes cluster name'), label_class: 'label-bold'
  = field.form_group :environment_scope, label: { text: s_('ClusterIntegration|Environment scope'),
    class: 'label-bold' } do
    = field.text_field :environment_scope, required: true, class: 'form-control',
      title: 'Environment scope is required.', wrapper: false
    .form-text.text-muted= s_("ClusterIntegration|Choose which of your environments will use this cluster.")

  = field.fields_for :provider_gcp, @gcp_cluster.provider_gcp do |provider_gcp_field|
    .form-group
      = provider_gcp_field.label :gcp_project_id, s_('ClusterIntegration|Google Cloud Platform project'),
        class: 'label-bold'
      .js-gcp-project-id-dropdown-entry-point{ data: { docsUrl: 'https://console.cloud.google.com/home/dashboard' } }
        = provider_gcp_field.hidden_field :gcp_project_id
        .dropdown
          %button.dropdown-menu-toggle.dropdown-menu-full-width{ type: 'button', disabled: true }
            %span.dropdown-toggle-text
              = _('Select project')
            = icon('chevron-down')
        %span.form-text.text-muted &nbsp;

    .form-group
      = provider_gcp_field.label :zone, s_('ClusterIntegration|Zone'), class: 'label-bold'
      .js-gcp-zone-dropdown-entry-point
        = provider_gcp_field.hidden_field :zone
        .dropdown
          %button.dropdown-menu-toggle.dropdown-menu-full-width{ type: 'button', disabled: true }
            %span.dropdown-toggle-text
              = _('Select project to choose zone')
            = icon('chevron-down')
      %p.form-text.text-muted
        = s_('ClusterIntegration|Learn more about %{help_link_start}zones%{help_link_end}.').html_safe % { help_link_start: help_link_start % { url: zones_link_url }, help_link_end: help_link_end }

    = provider_gcp_field.number_field :num_nodes, required: true, placeholder: '3',
      title: s_('ClusterIntegration|Number of nodes must be a numerical value.'),
      label: s_('ClusterIntegration|Number of nodes'), label_class: 'label-bold'

    .form-group
      = provider_gcp_field.label :machine_type, s_('ClusterIntegration|Machine type'), class: 'label-bold'
      .js-gcp-machine-type-dropdown-entry-point
        = provider_gcp_field.hidden_field :machine_type
        .dropdown
          %button.dropdown-menu-toggle.dropdown-menu-full-width{ type: 'button', disabled: true }
            %span.dropdown-toggle-text
              = _('Select project and zone to choose machine type')
            = icon('chevron-down')
      %p.form-text.text-muted
        = s_('ClusterIntegration|Learn more about %{help_link_start_machine_type}machine types%{help_link_end} and %{help_link_start_pricing}pricing%{help_link_end}.').html_safe % { help_link_start_machine_type: help_link_start % { url: machine_type_link_url }, help_link_start_pricing: help_link_start % { url: pricing_link_url }, help_link_end: help_link_end }

    - if Feature.enabled?(:create_cloud_run_clusters, clusterable, default_enabled: true)
      .form-group
        = provider_gcp_field.check_box :cloud_run, { label: s_('ClusterIntegration|Enable Cloud Run for Anthos'),
          label_class: 'label-bold' }
        .form-text.text-muted
          = s_('ClusterIntegration|Uses the Cloud Run, Istio, and HTTP Load Balancing addons for this cluster.')
          = link_to _('More information'), help_page_path('user/project/clusters/add_gke_clusters.md', anchor: 'cloud-run-for-anthos'), target: '_blank'

  .form-group
    = field.check_box :managed, { label: s_('ClusterIntegration|GitLab-managed cluster'),
      label_class: 'label-bold' }
    .form-text.text-muted
      = s_('ClusterIntegration|Allow GitLab to manage namespaces and service accounts for this cluster.')
      = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'gitlab-managed-clusters'), target: '_blank'

  .form-group
    = field.check_box :namespace_per_environment, { label: s_('ClusterIntegration|Namespace per environment'), label_class: 'label-bold' }
    .form-text.text-muted
      = s_('ClusterIntegration|Deploy each environment to its own namespace. Otherwise, environments within a project share a project-wide namespace. Note that anyone who can trigger a deployment of a namespace can read its secrets. If modified, existing environments will use their current namespaces until the cluster cache is cleared.')
      = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'custom-namespace'), target: '_blank'

  .form-group.js-gke-cluster-creation-submit-container
    = field.submit s_('ClusterIntegration|Create Kubernetes cluster'),
      class: 'js-gke-cluster-creation-submit gl-button btn btn-success', disabled: true