- 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 = gitlab_ui_form_for @cluster, url: clusterable.cluster_path(@cluster), as: :cluster, html: { class: 'cluster_management_form' } do |field| %h4 = s_('ClusterIntegration|Cluster management project') %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: ''.html_safe, code_close: ''.html_safe } = link_to _('More information'), help_page_path('user/clusters/management_project.md'), target: '_blank', rel: 'noopener noreferrer' = field.submit _('Save changes'), pajamas_button: true .sub-section.form-group %h4 = s_('ClusterIntegration|Clear cluster cache') %p = s_("ClusterIntegration|Clear the local cache of namespace and service accounts.") - if @cluster.managed? = s_("ClusterIntegration|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.") - else = s_("ClusterIntegration|This is necessary to clear existing environment-namespace associations from clusters previously managed by GitLab.") = render Pajamas::ButtonComponent.new(method: :delete, href: clusterable.clear_cluster_cache_path(@cluster)) do = s_('ClusterIntegration|Clear cluster cache') .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? } }