(feat) Add Promtail and Netshoot addons (#1058)
* add promtail addon * Add Netshoot addon * update common to include envList for addons * Add basic promtail and netshoot unittests
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class Test < ChartTest
|
||||
@@chart = Chart.new('charts/library/common-test')
|
||||
|
||||
describe @@chart.name do
|
||||
describe 'addon::netshoot' do
|
||||
it 'defaults to disabled' do
|
||||
deployment = chart.resources(kind: "Deployment").first
|
||||
containers = deployment["spec"]["template"]["spec"]["containers"]
|
||||
netshootContainer = containers.find{ |c| c["name"] == "netshoot" }
|
||||
|
||||
assert_nil(netshootContainer)
|
||||
end
|
||||
|
||||
it 'netshoot can be enabled' do
|
||||
values = {
|
||||
addons: {
|
||||
netshoot: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chart.value values
|
||||
deployment = chart.resources(kind: "Deployment").first
|
||||
containers = deployment["spec"]["template"]["spec"]["containers"]
|
||||
netshootContainer = containers.find{ |c| c["name"] == "netshoot" }
|
||||
|
||||
refute_nil(netshootContainer)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
# frozen_string_literal: true
|
||||
require_relative '../../test_helper'
|
||||
|
||||
class Test < ChartTest
|
||||
@@chart = Chart.new('charts/library/common-test')
|
||||
|
||||
describe @@chart.name do
|
||||
describe 'addon::promtail' do
|
||||
it 'defaults to disabled' do
|
||||
deployment = chart.resources(kind: "Deployment").first
|
||||
containers = deployment["spec"]["template"]["spec"]["containers"]
|
||||
promtailContainer = containers.find{ |c| c["name"] == "promtail" }
|
||||
|
||||
assert_nil(promtailContainer)
|
||||
end
|
||||
|
||||
it 'promtail can be enabled' do
|
||||
values = {
|
||||
addons: {
|
||||
promtail: {
|
||||
enabled: true,
|
||||
volumeMounts: [
|
||||
{
|
||||
name: "config",
|
||||
mountPath: "/tmp",
|
||||
readOnly: true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chart.value values
|
||||
deployment = chart.resources(kind: "Deployment").first
|
||||
containers = deployment["spec"]["template"]["spec"]["containers"]
|
||||
promtailContainer = containers.find{ |c| c["name"] == "promtail" }
|
||||
|
||||
refute_nil(promtailContainer)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user