Commit 5d639b2d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'helm_local_tiller_frontend' into 'master'

Hide helm application row if local tiller

See merge request gitlab-org/gitlab!24742
parents cd2a9394 6d061daa
...@@ -107,8 +107,12 @@ export default { ...@@ -107,8 +107,12 @@ export default {
isProjectCluster() { isProjectCluster() {
return this.type === CLUSTER_TYPE.PROJECT; return this.type === CLUSTER_TYPE.PROJECT;
}, },
managedAppsLocalTillerEnabled() {
return Boolean(gon.features?.managedAppsLocalTiller);
},
helmInstalled() { helmInstalled() {
return ( return (
this.managedAppsLocalTillerEnabled ||
this.applications.helm.status === APPLICATION_STATUS.INSTALLED || this.applications.helm.status === APPLICATION_STATUS.INSTALLED ||
this.applications.helm.status === APPLICATION_STATUS.UPDATED this.applications.helm.status === APPLICATION_STATUS.UPDATED
); );
...@@ -270,6 +274,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity ...@@ -270,6 +274,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
<div class="cluster-application-list prepend-top-10"> <div class="cluster-application-list prepend-top-10">
<application-row <application-row
v-if="!managedAppsLocalTillerEnabled"
id="helm" id="helm"
:logo-url="helmLogo" :logo-url="helmLogo"
:title="applications.helm.title" :title="applications.helm.title"
......
...@@ -6,6 +6,10 @@ class Clusters::BaseController < ApplicationController ...@@ -6,6 +6,10 @@ class Clusters::BaseController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
before_action :authorize_read_cluster! before_action :authorize_read_cluster!
before_action do
push_frontend_feature_flag(:managed_apps_local_tiller)
end
helper_method :clusterable helper_method :clusterable
private private
......
# frozen_string_literal: true # frozen_string_literal: true
shared_examples "installing applications on a cluster" do shared_examples "installing applications for a cluster" do |managed_apps_local_tiller|
before do before do
stub_feature_flags(managed_apps_local_tiller: managed_apps_local_tiller)
visit cluster_path visit cluster_path
end end
...@@ -26,48 +28,61 @@ shared_examples "installing applications on a cluster" do ...@@ -26,48 +28,61 @@ shared_examples "installing applications on a cluster" do
it 'user can install applications' do it 'user can install applications' do
wait_for_requests wait_for_requests
page.within('.js-cluster-application-row-helm') do application_row =
expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to be_nil if managed_apps_local_tiller
'.js-cluster-application-row-ingress'
else
'.js-cluster-application-row-helm'
end
page.within(application_row) do
expect(page).not_to have_css('.js-cluster-application-install-button[disabled]')
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Install') expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Install')
end end
end end
context 'when user installs Helm' do if managed_apps_local_tiller
before do it 'does not show the Helm application' do
allow(ClusterInstallAppWorker).to receive(:perform_async) expect(page).not_to have_selector(:css, '.js-cluster-application-row-helm')
wait_for_requests end
else
context 'when user installs Helm' do
before do
allow(ClusterInstallAppWorker).to receive(:perform_async)
wait_for_requests
page.within('.js-cluster-application-row-helm') do page.within('.js-cluster-application-row-helm') do
page.find(:css, '.js-cluster-application-install-button').click page.find(:css, '.js-cluster-application-install-button').click
end
wait_for_requests
end end
wait_for_requests it 'shows the status transition' do
end page.within('.js-cluster-application-row-helm') do
# FE sends request and gets the response, then the buttons is "Installing"
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing')
it 'shows the status transition' do Clusters::Cluster.last.application_helm.make_installing!
page.within('.js-cluster-application-row-helm') do
# FE sends request and gets the response, then the buttons is "Installing"
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing')
Clusters::Cluster.last.application_helm.make_installing! # FE starts polling and update the buttons to "Installing"
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing')
# FE starts polling and update the buttons to "Installing" Clusters::Cluster.last.application_helm.make_installed!
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing')
Clusters::Cluster.last.application_helm.make_installed! expect(page).not_to have_css('button', exact_text: 'Install', visible: :all)
expect(page).not_to have_css('button', exact_text: 'Installing', visible: :all)
expect(page).to have_css('.js-cluster-application-uninstall-button:not([disabled])', exact_text: 'Uninstall')
end
expect(page).not_to have_css('button', exact_text: 'Install', visible: :all) expect(page).to have_content('Helm Tiller was successfully installed on your Kubernetes cluster')
expect(page).not_to have_css('button', exact_text: 'Installing', visible: :all)
expect(page).to have_css('.js-cluster-application-uninstall-button:not([disabled])', exact_text: 'Uninstall')
end end
expect(page).to have_content('Helm Tiller was successfully installed on your Kubernetes cluster')
end end
end end
context 'when user installs Knative' do context 'when user installs Knative' do
before do before do
create(:clusters_applications_helm, :installed, cluster: cluster) create(:clusters_applications_helm, :installed, cluster: cluster) unless managed_apps_local_tiller
end end
context 'on an abac cluster' do context 'on an abac cluster' do
...@@ -153,7 +168,7 @@ shared_examples "installing applications on a cluster" do ...@@ -153,7 +168,7 @@ shared_examples "installing applications on a cluster" do
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in) allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async) allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
create(:clusters_applications_helm, :installed, cluster: cluster) create(:clusters_applications_helm, :installed, cluster: cluster) unless managed_apps_local_tiller
page.within('.js-cluster-application-row-cert_manager') do page.within('.js-cluster-application-row-cert_manager') do
click_button 'Install' click_button 'Install'
...@@ -189,7 +204,7 @@ shared_examples "installing applications on a cluster" do ...@@ -189,7 +204,7 @@ shared_examples "installing applications on a cluster" do
before do before do
allow(ClusterInstallAppWorker).to receive(:perform_async) allow(ClusterInstallAppWorker).to receive(:perform_async)
create(:clusters_applications_helm, :installed, cluster: cluster) create(:clusters_applications_helm, :installed, cluster: cluster) unless managed_apps_local_tiller
page.within('.js-cluster-application-row-elastic_stack') do page.within('.js-cluster-application-row-elastic_stack') do
click_button 'Install' click_button 'Install'
...@@ -221,7 +236,7 @@ shared_examples "installing applications on a cluster" do ...@@ -221,7 +236,7 @@ shared_examples "installing applications on a cluster" do
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in) allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async) allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
create(:clusters_applications_helm, :installed, cluster: cluster) create(:clusters_applications_helm, :installed, cluster: cluster) unless managed_apps_local_tiller
page.within('.js-cluster-application-row-ingress') do page.within('.js-cluster-application-row-ingress') do
expect(page).to have_css('.js-cluster-application-install-button:not([disabled])') expect(page).to have_css('.js-cluster-application-install-button:not([disabled])')
...@@ -263,3 +278,8 @@ shared_examples "installing applications on a cluster" do ...@@ -263,3 +278,8 @@ shared_examples "installing applications on a cluster" do
end end
end end
end end
shared_examples "installing applications on a cluster" do
it_behaves_like "installing applications for a cluster", false
it_behaves_like "installing applications for a cluster", true
end
...@@ -15,6 +15,9 @@ describe('Applications', () => { ...@@ -15,6 +15,9 @@ describe('Applications', () => {
beforeEach(() => { beforeEach(() => {
Applications = Vue.extend(applications); Applications = Vue.extend(applications);
gon.features = gon.features || {};
gon.features.managedAppsLocalTiller = false;
}); });
afterEach(() => { afterEach(() => {
...@@ -156,6 +159,22 @@ describe('Applications', () => { ...@@ -156,6 +159,22 @@ describe('Applications', () => {
}); });
}); });
describe('Helm application', () => {
describe('when managedAppsLocalTiller enabled', () => {
beforeEach(() => {
gon.features.managedAppsLocalTiller = true;
});
it('does not render a row for Helm Tiller', () => {
vm = mountComponent(Applications, {
applications: APPLICATIONS_MOCK_STATE,
});
expect(vm.$el.querySelector('.js-cluster-application-row-helm')).toBeNull();
});
});
});
describe('Ingress application', () => { describe('Ingress application', () => {
describe('with nested component', () => { describe('with nested component', () => {
const propsData = { const propsData = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment