11 changes: 9 additions & 2 deletions manifests/kube_addons.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$bootstrap_controller = $kubernetes::bootstrap_controller,
$cni_network_provider = $kubernetes::cni_network_provider,
$install_dashboard = $kubernetes::install_dashboard,

$kubernetes_version = $kubernetes::kubernetes_version
){

if $bootstrap_controller {
Expand Down Expand Up @@ -71,12 +71,19 @@
require => Exec['Create kube dns service account'],
}

if $install_dashboard {
if $install_dashboard and $kubernetes_version =~ /1[.]8[.]\d/ {
exec { 'Install Kubernetes dashboard':
command => 'kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml',
onlyif => 'kubectl get nodes',
unless => 'kubectl -n kube-system get pods | grep kubernetes-dashboard',
}
}
if $install_dashboard and $kubernetes_version =~ /1[.](6|7)[.]\d/ {
exec { 'Install Kubernetes dashboard':
command => 'kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.6.3/src/deploy/kubernetes-dashboard.yaml',
onlyif => 'kubectl get nodes',
unless => 'kubectl -n kube-system get pods | grep kubernetes-dashboard',
}
}
}
}
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
$front_proxy_client_key = undef
$sa_key = undef
$sa_pub = undef
$cni_network_provider = 'https://git.io/weave-kube-1.6'
$cni_network_provider = 'https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d "\n")\&env.IPALLOC_RANGE=100.32.0.0/12'
$install_dashboard = false

}
38 changes: 38 additions & 0 deletions rakelib/acceptance.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require 'rake'
require 'parallel_tests'

# We clear the Beaker rake tasks from spec_helper as they assume
# rspec-puppet and a certain filesystem layout
Rake::Task[:beaker_nodes].clear
Rake::Task[:beaker].clear

desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance => [:spec_prep]) do |t|
t.pattern = 'spec/acceptance'
end

namespace :acceptance do
{
:vagrant => [
'centos-72-x64',
'default',
'ubuntu-1604-x64',
],
:pooler => [
'centos7',
'default',
'ubuntu-1604',
]
}.each do |ns, configs|
namespace ns.to_sym do
configs.each do |config|
desc "Run acceptance tests for #{ns}:#{config}"
RSpec::Core::RakeTask.new("#{config}".to_sym => [:spec_prep]) do |t|
ENV['BEAKER_keyfile'] = '~/.ssh/id_rsa-acceptance' if ns == :pooler
ENV['BEAKER_set'] = "#{ns}/#{config}"
t.pattern = 'spec/acceptance'
end
end
end
end
end
4 changes: 2 additions & 2 deletions spec/acceptance/kubernetes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class {'kubernetes':
context 'appliction deployment' do

it 'can deploy an application into a namespace and expose it' do
shell('sleep 300')
shell('sleep 180')
shell('KUBECONFIG=/root/admin.conf kubectl create -f /tmp/nginx.yml', :acceptable_exit_codes => [0]) do |r|
expect(r.stdout).to match(/namespace "nginx" created\ndeployment "my-nginx" created\nservice "my-nginx" created\n/)
end
end

it 'can access the deployed service' do
shell('sleep 120')
shell('sleep 60')
shell('curl 10.96.188.5', :acceptable_exit_codes => [0]) do |r|
expect(r.stdout).to match (/Welcome to nginx!/)
end
Expand Down
15 changes: 15 additions & 0 deletions spec/acceptance/nodesets/pooler/centos7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOSTS:
centos7:
roles:
- default
platform: el7-x86_64
hypervisor: vmpooler
template: Delivery/Quality Assurance/Templates/vCloud/centos-7-x86_64
CONFIG:
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/Enterprise/Dynamic
resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
type: foss
15 changes: 15 additions & 0 deletions spec/acceptance/nodesets/pooler/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOSTS:
ubuntu-1604-master:
roles:
- default
platform: ubuntu-16.04-amd64
hypervisor: vmpooler
template: Delivery/Quality Assurance/Templates/vCloud/ubuntu-1604-x86_64
CONFIG:
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/Enterprise/Dynamic
resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
type: foss
15 changes: 15 additions & 0 deletions spec/acceptance/nodesets/pooler/ubuntu-1604.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOSTS:
ubuntu-1604-master:
roles:
- default
platform: ubuntu-16.04-amd64
hypervisor: vmpooler
template: Delivery/Quality Assurance/Templates/vCloud/ubuntu-1604-x86_64
CONFIG:
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/Enterprise/Dynamic
resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
type: foss
2 changes: 2 additions & 0 deletions spec/classes/kube_addons_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'bootstrap_controller' => true,
'cni_network_provider' => 'https://foo.test',
'install_dashboard' => false,
'kubernetes_version' => '1.7.3'
}
end

Expand All @@ -35,6 +36,7 @@
'bootstrap_controller' => true,
'cni_network_provider' => 'https://foo.test',
'install_dashboard' => true,
'kubernetes_version' => '1.7.3'
}
end

Expand Down
Loading