Commit 57e00e19 authored by Stan Hu's avatar Stan Hu

Merge branch '65339-follow-up-from-resolve-kubernetes-applications-uninstall-knative' into 'master'

All Kubectl command should return array by default

See merge request gitlab-org/gitlab-ce!31305
parents e14265d5 08188285
...@@ -84,7 +84,7 @@ module Clusters ...@@ -84,7 +84,7 @@ module Clusters
private private
def delete_knative_services_and_metrics def delete_knative_services_and_metrics
delete_knative_services + delete_knative_istio_metrics.to_a delete_knative_services + delete_knative_istio_metrics
end end
def delete_knative_services def delete_knative_services
...@@ -117,11 +117,15 @@ module Clusters ...@@ -117,11 +117,15 @@ module Clusters
end end
def install_knative_metrics def install_knative_metrics
["kubectl apply -f #{METRICS_CONFIG}"] if cluster.application_prometheus_available? return [] unless cluster.application_prometheus_available?
["kubectl apply -f #{METRICS_CONFIG}"]
end end
def delete_knative_istio_metrics def delete_knative_istio_metrics
["kubectl delete --ignore-not-found -f #{METRICS_CONFIG}"] if cluster.application_prometheus_available? return [] unless cluster.application_prometheus_available?
["kubectl delete --ignore-not-found -f #{METRICS_CONFIG}"]
end end
def verify_cluster? def verify_cluster?
......
...@@ -64,7 +64,7 @@ module Clusters ...@@ -64,7 +64,7 @@ module Clusters
name: name, name: name,
rbac: cluster.platform_kubernetes_rbac?, rbac: cluster.platform_kubernetes_rbac?,
files: files, files: files,
predelete: delete_knative_istio_metrics.to_a predelete: delete_knative_istio_metrics
) )
end end
...@@ -104,11 +104,15 @@ module Clusters ...@@ -104,11 +104,15 @@ module Clusters
end end
def install_knative_metrics def install_knative_metrics
["kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}"] if cluster.application_knative_available? return [] unless cluster.application_knative_available?
["kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}"]
end end
def delete_knative_istio_metrics def delete_knative_istio_metrics
["kubectl delete -f #{Clusters::Applications::Knative::METRICS_CONFIG}"] if cluster.application_knative_available? return [] unless cluster.application_knative_available?
["kubectl delete -f #{Clusters::Applications::Knative::METRICS_CONFIG}"]
end end
end end
end end
......
...@@ -91,7 +91,7 @@ describe Clusters::Applications::Knative do ...@@ -91,7 +91,7 @@ describe Clusters::Applications::Knative do
end end
it 'does not install metrics for prometheus' do it 'does not install metrics for prometheus' do
expect(subject.postinstall).to be_nil expect(subject.postinstall).to be_empty
end end
context 'with prometheus installed' do context 'with prometheus installed' do
...@@ -101,7 +101,7 @@ describe Clusters::Applications::Knative do ...@@ -101,7 +101,7 @@ describe Clusters::Applications::Knative do
subject { knative.install_command } subject { knative.install_command }
it 'installs metrics' do it 'installs metrics' do
expect(subject.postinstall).not_to be_nil expect(subject.postinstall).not_to be_empty
expect(subject.postinstall.length).to be(1) expect(subject.postinstall.length).to be(1)
expect(subject.postinstall[0]).to eql("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}") expect(subject.postinstall[0]).to eql("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}")
end end
......
...@@ -142,7 +142,7 @@ describe Clusters::Applications::Prometheus do ...@@ -142,7 +142,7 @@ describe Clusters::Applications::Prometheus do
end end
it 'does not install knative metrics' do it 'does not install knative metrics' do
expect(subject.postinstall).to be_nil expect(subject.postinstall).to be_empty
end end
context 'with knative installed' do context 'with knative installed' do
......
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