Commit 192861d7 authored by Sean McGivern's avatar Sean McGivern

Merge branch '56954-improve-knative-after-installing-tiller' into 'master'

Improvements for Knative installation

Closes #56954

See merge request gitlab-org/gitlab-ce!26339
parents 1f42dd86 93b806c4
...@@ -14,4 +14,10 @@ module ClustersHelper ...@@ -14,4 +14,10 @@ module ClustersHelper
render 'clusters/clusters/gcp_signup_offer_banner' render 'clusters/clusters/gcp_signup_offer_banner'
end end
end end
def has_rbac_enabled?(cluster)
return cluster.platform_kubernetes_rbac? if cluster.platform_kubernetes
!cluster.provider.legacy_abac?
end
end end
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
install_knative_path: clusterable.install_applications_cluster_path(@cluster, :knative), install_knative_path: clusterable.install_applications_cluster_path(@cluster, :knative),
update_knative_path: clusterable.update_applications_cluster_path(@cluster, :knative), update_knative_path: clusterable.update_applications_cluster_path(@cluster, :knative),
toggle_status: @cluster.enabled? ? 'true': 'false', toggle_status: @cluster.enabled? ? 'true': 'false',
has_rbac: @cluster.platform_kubernetes_rbac? ? 'true': 'false', has_rbac: has_rbac_enabled?(@cluster) ? 'true': 'false',
cluster_type: @cluster.cluster_type, cluster_type: @cluster.cluster_type,
cluster_status: @cluster.status_name, cluster_status: @cluster.status_name,
cluster_status_reason: @cluster.status_reason, cluster_status_reason: @cluster.status_reason,
......
---
title: Improve the Knative installation on Clusters
merge_request: 26339
author:
type: added
...@@ -28,5 +28,9 @@ FactoryBot.define do ...@@ -28,5 +28,9 @@ FactoryBot.define do
gcp.make_errored('Something wrong') gcp.make_errored('Something wrong')
end end
end end
trait :abac_enabled do
legacy_abac true
end
end end
end end
# frozen_string_literal: true
require 'spec_helper'
describe ClustersHelper do
describe '#has_rbac_enabled?' do
context 'when kubernetes platform has been created' do
let(:platform_kubernetes) { build_stubbed(:cluster_platform_kubernetes) }
let(:cluster) { build_stubbed(:cluster, :provided_by_gcp, platform_kubernetes: platform_kubernetes) }
it 'returns kubernetes platform value' do
expect(helper.has_rbac_enabled?(cluster)).to be_truthy
end
end
context 'when kubernetes platform has not been created yet' do
let(:cluster) { build_stubbed(:cluster, :providing_by_gcp) }
it 'delegates to cluster provider' do
expect(helper.has_rbac_enabled?(cluster)).to be_truthy
end
context 'when ABAC cluster is created' do
let(:provider) { build_stubbed(:cluster_provider_gcp, :abac_enabled) }
let(:cluster) { build_stubbed(:cluster, :providing_by_gcp, provider_gcp: provider) }
it 'delegates to cluster provider' do
expect(helper.has_rbac_enabled?(cluster)).to be_falsy
end
end
end
end
end
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