Skip to content

Commit 689d78b

Browse files
authored
Merge pull request #693 from span786/CAT-2095-fix-puppetlabs-kubernetes-nigtly-job
(CAT-2095): Fixed puppetlabs-kubernetes modules CI & nightly failures
2 parents 213b03a + 29c3139 commit 689d78b

File tree

11 files changed

+112
-55
lines changed

11 files changed

+112
-55
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-20.04
1717
strategy:
1818
fail-fast: false
19-
matrix: {'platform':['centos-7'],'collection':['puppet7-nightly', 'puppet8-nightly']}
19+
matrix: {'platform':['rhel-8'],'collection':['puppet7-nightly', 'puppet8-nightly']}
2020

2121
steps:
2222
- name: Checkout Source

.github/workflows/nightly.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-20.04
1515
strategy:
1616
fail-fast: false
17-
matrix: {'platform':['centos-7'],'collection':['puppet7-nightly', 'puppet8-nightly']}
17+
matrix: {'platform':['rhel-8'],'collection':['puppet7-nightly', 'puppet8-nightly']}
1818

1919
steps:
2020
- name: Checkout Source

Gemfile

+5
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,8 @@ extra_gemfiles.each do |gemfile|
7676
end
7777
end
7878
# vim: syntax=ruby
79+
80+
81+
# Fixed version for puppet-modulebuilder gem, as newer version of this gem does not include tooling folder.
82+
# We will keep this until we find a solution to either move the tooling folder in to some other folder or get rid of it altogether.
83+
gem 'puppet-modulebuilder', '1.1.0'

manifests/config/kubeadm.pp

+10-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
# When set to true, etcd will be downloaded from the specified source URL.
1212
# Defaults to true.
1313
# @param delegated_pki
14-
# Set to true if all required X509 certificates will be provided by external means. Setting this to true will ignore all *_crt and *_key including sa.key and sa.pub files.
14+
# Set to true if all required X509 certificates will be provided by external means.
15+
# Setting this to true will ignore all *_crt and *_key including sa.key and sa.pub files.
1516
# Defaults to false
1617
# @param etcd_install_method
1718
# The method on how to install etcd. Can be either wget (using etcd_source) or package (using $etcd_package_name)
@@ -96,7 +97,8 @@
9697
# "periodic" or "revision"
9798
# Defaults to "periodic"
9899
# @param etcd_compaction_retention
99-
# This will tell etcd how much retention to be applied. This value can change depending on `etcd_compaction_method`. An integer or time string (i.e.: "5m") can be used in case of "periodic". Only integer allowed in case of "revision"
100+
# This will tell etcd how much retention to be applied. This value can change depending on `etcd_compaction_method`.
101+
# An integer or time string (i.e.: "5m") can be used in case of "periodic". Only integer allowed in case of "revision"
100102
# Integer or String
101103
# Defaults to 0 (disabled)
102104
# @param api_server_count
@@ -157,8 +159,9 @@
157159
# A string array of extra arguments to be passed to scheduler.
158160
# Defaults to []
159161
# @param kubelet_extra_arguments
160-
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied to both control planes and nodes.
161-
# Use this for critical Kubelet settings such as `pod-infra-container-image` which may be problematic to configure via kubelet_extra_config
162+
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied
163+
# to both control planes and nodes. Use this for critical Kubelet settings such as `pod-infra-container-image`
164+
# which may be problematic to configure via kubelet_extra_config
162165
# Defaults to []
163166
# @param service_cidr
164167
# The IP assdress range for service VIPs
@@ -381,9 +384,9 @@
381384
}
382385

383386
# to_yaml emits a complete YAML document, so we must remove the leading '---'
384-
$kubeadm_extra_config_yaml = regsubst(to_yaml($kubeadm_extra_config), '^---\n', '')
385-
$kubelet_extra_config_yaml = regsubst(to_yaml($kubelet_extra_config), '^---\n', '')
386-
$kubelet_extra_config_alpha1_yaml = regsubst(to_yaml($kubelet_extra_config_alpha1), '^---\n', '')
387+
$kubeadm_extra_config_yaml = regsubst(stdlib::to_yaml($kubeadm_extra_config), '^---\n', '')
388+
$kubelet_extra_config_yaml = regsubst(stdlib::to_yaml($kubelet_extra_config), '^---\n', '')
389+
$kubelet_extra_config_alpha1_yaml = regsubst(stdlib::to_yaml($kubelet_extra_config_alpha1), '^---\n', '')
387390

388391
$config_version = $kubernetes_version ? {
389392
/^1\.1(0|1)/ => 'v1alpha1',

manifests/config/worker.pp

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@
4848
# [{'key' => 'dedicated','value' => 'NewNode','effect' => 'NoSchedule', 'operator' => 'Equal'}]
4949
# Defaults to undef
5050
# @param kubelet_extra_arguments
51-
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied to both control planes and nodes.
52-
# Use this for critical Kubelet settings such as `pod-infra-container-image` which may be problematic to configure via kubelet_extra_config
51+
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied
52+
# to both control planes and nodes. Use this for critical Kubelet settings such as `pod-infra-container-image`
53+
# which may be problematic to configure via kubelet_extra_config
5354
# Defaults to []
5455
# @param kubelet_extra_config
5556
# A hash containing extra configuration data to be serialised with `to_yaml` and appended to Kubelet configuration file for the cluster.

manifests/init.pp

+7-4
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@
216216
# Defaults to "new"
217217
#
218218
# [*etcd_compaction_retention*]
219-
# This will tell etcd how much retention to be applied. This value can change depending on `etcd_compaction_method`. An integer or time string (i.e.: "5m") can be used in case of "periodic". Only integer allowed in case of "revision"
219+
# This will tell etcd how much retention to be applied. This value can change depending on `etcd_compaction_method`.
220+
# An integer or time string (i.e.: "5m") can be used in case of "periodic". Only integer allowed in case of "revision"
220221
# Integer or String
221222
# Defaults to 0 (disabled)
222223
#
@@ -294,7 +295,8 @@
294295
# Defaults to []
295296
#
296297
# [*delegated_pki*]
297-
# Set to true if all required X509 certificates will be provided by external means. Setting this to true will ignore all *_crt and *_key including sa.key and sa.pub files.
298+
# Set to true if all required X509 certificates will be provided by external means.
299+
# Setting this to true will ignore all *_crt and *_key including sa.key and sa.pub files.
298300
# Defaults to false
299301
#
300302
# [*kubernetes_ca_crt*]
@@ -388,8 +390,9 @@
388390
# Defaults to {}
389391
#
390392
# [*kubelet_extra_arguments*]
391-
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied to both control planes and nodes.
392-
# Use this for critical Kubelet settings such as `pod-infra-container-image` which may be problematic to configure via kubelet_extra_config
393+
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied
394+
# to both control planes and nodes. Use this for critical Kubelet settings such as `pod-infra-container-image`
395+
# which may be problematic to configure via kubelet_extra_config
393396
# Defaults to []
394397
#
395398
# [*proxy_mode*]

manifests/repos.pp

+13-13
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,24 @@
6464
'Debian': {
6565
$codename = fact('os.distro.codename')
6666
apt::source { 'kubernetes':
67-
location => pick($kubernetes_apt_location,'https://apt.kubernetes.io'),
68-
repos => pick($kubernetes_apt_repos,'main'),
69-
release => pick($kubernetes_apt_release,'kubernetes-xenial'),
67+
location => pick($kubernetes_apt_location, 'https://apt.kubernetes.io'),
68+
repos => pick($kubernetes_apt_repos, 'main'),
69+
release => pick($kubernetes_apt_release, 'kubernetes-xenial'),
7070
key => {
71-
'id' => pick($kubernetes_key_id,'A362B822F6DEDC652817EA46B53DC80D13EDEF05'),
72-
'source' => pick($kubernetes_key_source,'https://packages.cloud.google.com/apt/doc/apt-key.gpg'),
71+
'id' => pick($kubernetes_key_id, 'A362B822F6DEDC652817EA46B53DC80D13EDEF05'),
72+
'source' => pick($kubernetes_key_source, 'https://packages.cloud.google.com/apt/doc/apt-key.gpg'),
7373
},
7474
}
7575

7676
if ($container_runtime == 'docker' and $manage_docker == true) or
7777
($container_runtime == 'cri_containerd' and $containerd_install_method == 'package') {
7878
apt::source { 'docker':
79-
location => pick($docker_apt_location,'https://download.docker.com/linux/ubuntu/'),
80-
repos => pick($docker_apt_repos,'stable'),
79+
location => pick($docker_apt_location, 'https://download.docker.com/linux/ubuntu/'),
80+
repos => pick($docker_apt_repos, 'stable'),
8181
release => pick($docker_apt_release,$codename),
8282
key => {
83-
'id' => pick($docker_key_id,'9DC858229FC7DD38854AE2D88D81803C0EBFCD88'),
84-
'source' => pick($docker_key_source,'https://download.docker.com/linux/ubuntu/gpg'),
83+
'id' => pick($docker_key_id, '9DC858229FC7DD38854AE2D88D81803C0EBFCD88'),
84+
'source' => pick($docker_key_source, 'https://download.docker.com/linux/ubuntu/gpg'),
8585
},
8686
}
8787
}
@@ -91,16 +91,16 @@
9191
($container_runtime == 'cri_containerd' and $containerd_install_method == 'package') {
9292
yumrepo { 'docker':
9393
descr => 'docker',
94-
baseurl => pick($docker_yum_baseurl,'https://download.docker.com/linux/centos/7/x86_64/stable'),
95-
gpgkey => pick($docker_yum_gpgkey,'https://download.docker.com/linux/centos/gpg'),
94+
baseurl => pick($docker_yum_baseurl, 'https://download.docker.com/linux/centos/7/x86_64/stable'),
95+
gpgkey => pick($docker_yum_gpgkey, 'https://download.docker.com/linux/centos/gpg'),
9696
gpgcheck => true,
9797
}
9898
}
9999

100100
yumrepo { 'kubernetes':
101101
descr => 'Kubernetes',
102-
baseurl => pick($kubernetes_yum_baseurl,'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64'),
103-
gpgkey => pick($kubernetes_yum_gpgkey,'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg'),
102+
baseurl => pick($kubernetes_yum_baseurl, 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/'),
103+
gpgkey => pick($kubernetes_yum_gpgkey, 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key'),
104104
gpgcheck => true,
105105
}
106106
}

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"name": "puppetlabs-apt",
17-
"version_requirement": "< 10.0.0"
17+
"version_requirement": "<= 10.0.0"
1818
},
1919
{
2020
"name": "puppet-archive",

spec/acceptance/integration_kubernetes_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
it 'verify the k8 nodes' do
5656
run_shell('sleep 20')
5757
run_shell('KUBECONFIG=/etc/kubernetes/admin.conf kubectl get nodes') do |r|
58-
expect(r.stdout).to match(%r{#{hostname1}(\s)+Ready(\s)+control-plane,master})
58+
expect(r.stdout).to match(%r{#{hostname1}(\s)+Ready(\s)+control-plane})
5959
expect(r.stdout).to match(%r{#{hostname2}(\s)+Ready})
6060
expect(r.stdout).to match(%r{#{hostname3}(\s)+Ready})
6161
end

spec/acceptance/kubernetes_spec.rb

+8-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
pp = <<-MANIFEST
1616
case $facts['os']['family'] {
17-
'RedHat', 'CentOS': {
17+
/^(RedHat|CentOS)$/: {
1818
class {'kubernetes':
19-
kubernetes_version => '1.22.0',
20-
kubernetes_package_version => '1.22.0',
19+
kubernetes_version => '1.28.15',
20+
kubernetes_package_version => '1.28.15',
2121
controller_address => "#{int_ipaddr1}:6443",
2222
container_runtime => 'docker',
2323
manage_docker => false,
@@ -26,6 +26,7 @@ class {'kubernetes':
2626
environment => ['HOME=/root', 'KUBECONFIG=/etc/kubernetes/admin.conf'],
2727
ignore_preflight_errors => ['NumCPU','ExternalEtcdVersion'],
2828
cgroup_driver => 'systemd',
29+
service_cidr => '10.138.0.0/12',
2930
}
3031
}
3132
/^(Debian|Ubuntu)$/: {
@@ -59,6 +60,8 @@ class {'kubernetes': } # any other OS are not supported
5960
before(:all) { change_target_host('controller') }
6061
after(:all) { reset_target_host }
6162

63+
int_ipaddr1 = fetch_ip_hostname_by_role('controller')[2]
64+
6265
it 'can deploy an application into a namespace and expose it' do
6366
run_shell('KUBECONFIG=/etc/kubernetes/admin.conf kubectl create -f /tmp/nginx.yml') do |r|
6467
expect(r.stdout).to match(%r{my-nginx created\nservice/my-nginx created\n})
@@ -67,7 +70,8 @@ class {'kubernetes': } # any other OS are not supported
6770

6871
it 'can access the deployed service' do
6972
run_shell('sleep 60')
70-
run_shell('curl --retry 10 --retry-delay 15 -s 10.96.188.5') do |r|
73+
shell_command = "curl --retry 10 --retry-delay 15 -s #{int_ipaddr1}"
74+
run_shell(shell_command) do |r|
7175
expect(r.stdout).to match(%r{Welcome to nginx!})
7276
end
7377
end

0 commit comments

Comments
 (0)