summaryrefslogtreecommitdiff
path: root/app/views/clusters/platforms/kubernetes/_form.html.haml
blob: e50c573bd908a67789884eaec0ba55e704f2a508 (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
= bootstrap_form_for cluster, url: update_cluster_url_path, html: { class: 'gl-show-field-errors' },
  as: :cluster do |field|
  - copy_name_btn = clipboard_button(text: cluster.name, title: s_('ClusterIntegration|Copy Kubernetes cluster name'),
    class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
  = field.text_field :name, class: 'js-select-on-focus cluster-name', required: true,
  title: s_('ClusterIntegration|Cluster name is required.'),
  readonly: cluster.read_only_kubernetes_platform_fields?,
  label: s_('ClusterIntegration|Kubernetes cluster name'), label_class: 'label-bold',
  input_group_class: 'gl-field-error-anchor', append: copy_name_btn

  = field.fields_for :platform_kubernetes, platform do |platform_field|
    - copy_api_url = clipboard_button(text: platform.api_url, title: s_('ClusterIntegration|Copy API URL'),
    class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
    = platform_field.text_field :api_url, class: 'js-select-on-focus', required: true,
    title: s_('ClusterIntegration|API URL should be a valid http/https url.'),
    readonly: cluster.read_only_kubernetes_platform_fields?,
    label: s_('ClusterIntegration|API URL'), label_class: 'label-bold',
    input_group_class: 'gl-field-error-anchor', append: copy_api_url

    - copy_ca_cert_btn = clipboard_button(text: platform.ca_cert, title: s_('ClusterIntegration|Copy CA Certificate'),
      class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
    = platform_field.text_area :ca_cert, class: 'js-select-on-focus', rows: '5',
    readonly: cluster.read_only_kubernetes_platform_fields?,
    placeholder: s_('ClusterIntegration|Certificate Authority bundle (PEM format)'),
    label: s_('ClusterIntegration|CA Certificate'), label_class: 'label-bold',
    input_group_class: 'gl-field-error-anchor', append: copy_ca_cert_btn

    - show_token_btn = (platform_field.button s_('ClusterIntegration|Show'),
      type: 'button', class: 'js-show-cluster-token btn btn-default')
    - copy_token_btn = clipboard_button(text: platform.token, title: s_('ClusterIntegration|Copy Service Token'),
      class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?

    = platform_field.text_field :token, type: 'password', class: 'js-select-on-focus js-cluster-token',
    required: true, title: s_('ClusterIntegration|Service token is required.'),
    readonly: cluster.read_only_kubernetes_platform_fields?,
    label: s_('ClusterIntegration|Service Token'), label_class: 'label-bold',
    input_group_class: 'gl-field-error-anchor', append: show_token_btn + copy_token_btn

    = platform_field.form_group :authorization_type do
      = platform_field.check_box :authorization_type, { disabled: true, label: s_('ClusterIntegration|RBAC-enabled cluster'),
      label_class: 'label-bold', inline: true }, 'rbac', 'abac'
      .form-text.text-muted
        = s_('ClusterIntegration|Enable this setting if using role-based access control (RBAC).')
        = s_('ClusterIntegration|This option will allow you to install applications on RBAC clusters.')

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

    - if cluster.allow_user_defined_namespace?
      = render('clusters/clusters/namespace', platform_field: platform_field)

  .form-group
    = field.submit s_('ClusterIntegration|Save changes'), class: 'btn btn-success'