summaryrefslogtreecommitdiff
path: root/app/views/clusters/clusters/_advanced_settings.html.haml
blob: 117bdbc06a17528bfd5697bb41d86ed87c0c30e0 (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
- group_id = @cluster.group.id if @cluster.group_type?

- if @cluster.project_type?
  - group_id = @cluster.project.group.id if @cluster.project.group
  - user_id = @cluster.project.namespace.owner_id unless group_id

- if can?(current_user, :admin_cluster, @cluster)
  - unless @cluster.provided_by_user?
    .sub-section.form-group
      %h4
        = @cluster.provider_label
      %p
        - provider_link = link_to(@cluster.provider_label, @cluster.provider_management_url, target: '_blank', rel: 'noopener noreferrer')
        = html_escape(s_('ClusterIntegration|Manage your Kubernetes cluster by visiting %{provider_link}')) % { provider_link: provider_link }

  .sub-section.form-group
    = form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster, html: { class: 'cluster_management_form' } do |field|
      %h4
        = s_('ClusterIntegration|Cluster management project (alpha)')

      %p
        = project_select_tag('cluster[management_project_id]', class: 'hidden-filter-value', toggle_class: 'js-project-search js-project-filter js-filter-submit', dropdown_class: 'dropdown-menu-selectable dropdown-menu-project js-filter-submit',
            placeholder: _('Select project'), idAttribute: 'id', data: { order_by: 'last_activity_at', idattribute: 'id', simple_filter: true, allow_clear: true, include_groups: false, include_projects_in_subgroups: true, group_id: group_id, user_id: user_id }, value: @cluster.management_project_id)
        .text-muted
          = html_escape(s_('ClusterIntegration|A cluster management project can be used to run deployment jobs with Kubernetes %{code_open}cluster-admin%{code_close} privileges.')) % { code_open: '<code>'.html_safe, code_close: '</code>'.html_safe }
          = link_to _('More information'), help_page_path('user/clusters/management_project.md'), target: '_blank'
      .gl-display-flex.gl-justify-content-end
        = field.submit _('Save changes'), class: 'btn btn-success'

  - if @cluster.managed?
    .sub-section.form-group
      %h4
        = s_('ClusterIntegration|Clear cluster cache')
      %p
        = s_("ClusterIntegration|Clear the local cache of namespace and service accounts. This is necessary if your integration has become out of sync. The cache is repopulated during the next CI job that requires namespace and service accounts.")
      .gl-display-flex.gl-justify-content-end
        = link_to(s_('ClusterIntegration|Clear cluster cache'), clusterable.clear_cluster_cache_path(@cluster), method: :delete, class: 'btn btn-primary')

  .sub-section.form-group
    %h4.text-danger
      = s_('ClusterIntegration|Remove Kubernetes cluster integration')
    %p
      = s_("ClusterIntegration|Remove this Kubernetes cluster's configuration from this project. This will not delete your actual Kubernetes cluster.")

    #js-cluster-remove-actions{ data: { cluster_path: clusterable.cluster_path(@cluster),
      cluster_name: @cluster.name,
      has_management_project: @cluster.management_project_id? } }