Showing with 56 additions and 22 deletions.
  1. +4 −1 .travis.yml
  2. +19 −1 CHANGELOG.md
  3. +5 −5 manifests/kube_addons.pp
  4. +2 −2 manifests/repos.pp
  5. +1 −1 metadata.json
  6. +1 −1 spec/acceptance/kubernetes_spec.rb
  7. +7 −1 spec/classes/repos_spec.rb
  8. +7 −1 spec/spec_helper_acceptance.rb
  9. +10 −9 tooling/kube_tool/other_params.rb
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ sudo: false
cache: bundler
language: ruby
bundler_args: --without development acceptance
script: bundle exec rake test
script:
- bundle exec rake test
- bundle exec rubocop lib
- bundle exec puppet-lint --no-autoloader_layout-check manifests
matrix:
fast_finish: true
include:
Expand Down
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# Version 1.0.3

Change exec path for controller PR #57

Fix gpg key for docker apt repo PR #58

Fix in kubetool for weave cni provider URL PR #63


# Version 1.0.2
Hotfix for kubelet downgrading cni in the rhel family


# Version 1.0.1
Support for weave and flannel

EPEL module removed as dependency
EPEL module removed as dependency

Added `$apiserver_extra_arguments` PR #47

Expand All @@ -14,26 +24,34 @@ Added support for stdlib 4.24.0

Updated kubetool to include CNI information in hiera (see README)


# Version 1.0.0
Officially supported version of puppetlabs-kubernetes


# Version 0.2.0
Supports Kubernetes up to 1.9.x

Adds support for cri-containerd runtime

Provides additional os and runtime switches for Kubetool


# Version 0.1.3

Provide cli switches for kubetool, and add Dockerfile

# Version 0.1.2


Supports Kubernetes up to 1.8.x

# Version 0.1.1

Hotfix for kubeproxy

# Version 0.1.0

First release

Supports Kubernetes 1.6 - 1.7.5
Expand Down
10 changes: 5 additions & 5 deletions manifests/kube_addons.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
Boolean $taint_master = $kubernetes::taint_master,
){

if $bootstrap_controller {

$addon_dir = '/etc/kubernetes/addons'

Exec {
path => ['/usr/bin', '/bin'],
environment => [ 'HOME=/root', 'KUBECONFIG=/root/admin.conf'],
Expand All @@ -21,6 +17,10 @@
try_sleep => 5,
}

if $bootstrap_controller {

$addon_dir = '/etc/kubernetes/addons'

exec { 'Install cni network provider':
command => "kubectl apply -f ${cni_network_provider}",
onlyif => 'kubectl get nodes',
Expand Down Expand Up @@ -88,7 +88,7 @@
tries => 50,
try_sleep => 10,
logoutput => true,
onlyif => 'kubectl get deploy -n kube-system kube-dns -o yaml | tr -s " " | grep "Deployment does not have minimum availability"',
onlyif => 'kubectl get deploy -n kube-system kube-dns -o yaml | tr -s " " | grep "Deployment does not have minimum availability"', # lint:ignore:140chars
}

exec { 'Taint master node':
Expand Down
4 changes: 2 additions & 2 deletions manifests/repos.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
repos => 'main',
release => 'ubuntu-xenial',
key => {
'id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88',
'source' => 'https://download.docker.com/linux/ubuntu/gpg',
'id' => '58118E89F3A912897C070ADBF76221572C52609D',
'source' => 'https://apt.dockerproject.org/gpg',
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-kubernetes",
"version": "1.0.2",
"version": "1.0.3",
"author": "Puppet",
"summary": "The module installs and configures a Kubernetes cluster",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/kubernetes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class {'kubernetes':

it 'can access the deployed service' do
shell('sleep 60')
shell('curl 10.96.188.5', :acceptable_exit_codes => [0]) do |r|
shell('curl -s 10.96.188.5', :acceptable_exit_codes => [0]) do |r|
expect(r.stdout).to match (/Welcome to nginx!/)
end
end
Expand Down
8 changes: 7 additions & 1 deletion spec/classes/repos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
let(:params) { { 'container_runtime' => 'docker' } }

it { should contain_apt__source('kubernetes') }
it { should contain_apt__source('docker') }
it { should contain_apt__source('docker').with(
:ensure => 'present',
:location => 'https://apt.dockerproject.org/repo',
:repos => 'main',
:release => 'ubuntu-xenial',
:key => { 'id' => '58118E89F3A912897C070ADBF76221572C52609D', 'source' => 'https://apt.dockerproject.org/gpg' }
) }

end

Expand Down
8 changes: 7 additions & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
on host, puppet('module', 'install', 'puppetlabs-apt'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module', 'install', 'stahnma-epel'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module', 'install', 'puppetlabs-translate', '--version', '1.0.0' ), { :acceptable_exit_codes => [0,1] }
on host, puppet('module', 'install', 'puppet-archive'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module', 'install', 'maestrodev-wget'), { :acceptable_exit_codes => [0,1] }

# shell('echo "#{vmhostname}" > /etc/hostname')
# shell("hostname #{vmhostname}")
Expand Down Expand Up @@ -113,10 +115,14 @@
on(host, "tar -C /usr/local -xzf go.tar.gz", acceptable_exit_codes: [0]).stdout
on(host, "export PATH=$PATH:/usr/local/go/bin;go get -u github.com/cloudflare/cfssl/cmd/...", acceptable_exit_codes: [0]).stdout
# Creating certs
on(host, "source ~/.bash_profile;rbenv global 2.3.1;rbenv local 2.3.1;export PATH=$PATH:/usr/local/go/bin;export PATH=$PATH:/root/go/bin;cd /etc/puppetlabs/code/modules/kubernetes/tooling;./kube_tool.rb -o #{os} -v 1.8.5 -r docker -f kubernetes -i #{vmipaddr} -b #{vmipaddr} -e \"etcd-#{vmhostname}=http://#{vmipaddr}:2380\" -t \"#{vmipaddr}\" -a \"#{vmipaddr}\" -d true", acceptable_exit_codes: [0]).stdout
on(host, "source ~/.bash_profile;rbenv global 2.3.1;rbenv local 2.3.1;export PATH=$PATH:/usr/local/go/bin;export PATH=$PATH:/root/go/bin;cd /etc/puppetlabs/code/modules/kubernetes/tooling;./kube_tool.rb -o #{os} -v 1.9.2 -r cri_containerd -c weave -f kubernetes -i #{vmipaddr} -b #{vmipaddr} -e \"etcd-#{vmhostname}=http://#{vmipaddr}:2380\" -t \"#{vmipaddr}\" -a \"#{vmipaddr}\" -d true", acceptable_exit_codes: [0]).stdout
create_remote_file(host, "/etc/hosts", hosts_file)
create_remote_file(host, "/tmp/nginx.yml", nginx)
on(host, 'cp /etc/puppetlabs/code/modules/kubernetes/tooling/kubernetes.yaml /etc/puppetlabs/code/environments/production/hieradata/common.yaml', acceptable_exit_codes: [0]).stdout
on(host, 'sed -i /cni_network_provider/d /etc/puppetlabs/code/environments/production/hieradata/common.yaml', acceptable_exit_codes: [0]).stdout
on(host, 'echo "kubernetes::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" >> /etc/puppetlabs/code/environments/production/hieradata/common.yaml', acceptable_exit_codes: [0]).stdout
on(host, 'echo "kubernetes::taint_master: false" >> /etc/puppetlabs/code/environments/production/hieradata/common.yaml', acceptable_exit_codes: [0]).stdout

# Disable swap
on(host, 'swapoff -a')
end
Expand Down
19 changes: 10 additions & 9 deletions tooling/kube_tool/other_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@ def OtherParams.create(os, version, container_runtime, cni_provider, bootstrap_c
elsif os.downcase.match('redhat')
kubernetes_package_version = version
end

if cni_provider.match('weave')
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'
elsif
cni_network_provider = 'https://git.io/weave-kube-1.6'
elsif
cni_provider.match('flannel')
cni_network_provider = 'https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml'
cni_cluster_cidr = '- --cluster-cidr=10.244.0.0/16'
cni_node_cidr = '- --allocate-node-cidrs=true'
cni_cluster_cidr = '- --cluster-cidr=10.244.0.0/16'
cni_node_cidr = '- --allocate-node-cidrs=true'
elsif cni_provider.match('calico')
cni_network_provider = 'https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml'
cni_cluster_cidr = '- --cluster-cidr=192.168.0.0/16'
cni_node_cidr = '- --allocate-node-cidrs=true'
cni_node_cidr = '- --allocate-node-cidrs=true'
elsif cni_provider.match('romana')
cni_network_provider = 'https://raw.githubusercontent.com/romana/romana/master/containerize/specs/romana-kubeadm.yml'
cni_network_provider = 'https://raw.githubusercontent.com/romana/romana/master/containerize/specs/romana-kubeadm.yml'
end

data = Hash.new
data['kubernetes::kubernetes_version'] = version
data['kubernetes::kubernetes_package_version'] = kubernetes_package_version
data['kubernetes::container_runtime'] = container_runtime
data['kubernetes::cni_network_provider'] = cni_network_provider
data['kubernetes::cni_cluster_cidr'] = cni_cluster_cidr
data['kubernetes::cni_node_cidr'] = cni_node_cidr
data['kubernetes::cni_node_cidr'] = cni_node_cidr
data['kubernetes::kubernetes_fqdn'] = fqdn
data['kubernetes::bootstrap_controller_ip'] = bootstrap_controller_ip
data['kubernetes::etcd_initial_cluster'] = etcd_initial_cluster
Expand All @@ -44,5 +44,6 @@ def OtherParams.create(os, version, container_runtime, cni_provider, bootstrap_c
data['kubernetes::install_dashboard'] = install
File.open("kubernetes.yaml", "a") { |file| file.write(data.to_yaml) }
File.write("kubernetes.yaml",File.open("kubernetes.yaml",&:read).gsub(/^---$/," "))

end
end