Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(CAT-2095): Fixed puppetlabs-kubernetes modules CI & nightly failures #693

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix: {'platform':['centos-7'],'collection':['puppet7-nightly', 'puppet8-nightly']}
matrix: {'platform':['rhel-8'],'collection':['puppet7-nightly', 'puppet8-nightly']}

steps:
- name: Checkout Source
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix: {'platform':['centos-7'],'collection':['puppet7-nightly', 'puppet8-nightly']}
matrix: {'platform':['rhel-8'],'collection':['puppet7-nightly', 'puppet8-nightly']}

steps:
- name: Checkout Source
Expand Down
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ extra_gemfiles.each do |gemfile|
end
end
# vim: syntax=ruby


# Fixed version for puppet-modulebuilder gem, as newer version of this gem does not include tooling folder.
# 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.
gem 'puppet-modulebuilder', '1.1.0'
17 changes: 10 additions & 7 deletions manifests/config/kubeadm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# When set to true, etcd will be downloaded from the specified source URL.
# Defaults to true.
# @param delegated_pki
# 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.
# 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.
# Defaults to false
# @param etcd_install_method
# The method on how to install etcd. Can be either wget (using etcd_source) or package (using $etcd_package_name)
Expand Down Expand Up @@ -96,7 +97,8 @@
# "periodic" or "revision"
# Defaults to "periodic"
# @param etcd_compaction_retention
# 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"
# 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"
# Integer or String
# Defaults to 0 (disabled)
# @param api_server_count
Expand Down Expand Up @@ -157,8 +159,9 @@
# A string array of extra arguments to be passed to scheduler.
# Defaults to []
# @param kubelet_extra_arguments
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied to both control planes and nodes.
# Use this for critical Kubelet settings such as `pod-infra-container-image` which may be problematic to configure via kubelet_extra_config
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied
# to both control planes and nodes. Use this for critical Kubelet settings such as `pod-infra-container-image`
# which may be problematic to configure via kubelet_extra_config
# Defaults to []
# @param service_cidr
# The IP assdress range for service VIPs
Expand Down Expand Up @@ -381,9 +384,9 @@
}

# to_yaml emits a complete YAML document, so we must remove the leading '---'
$kubeadm_extra_config_yaml = regsubst(to_yaml($kubeadm_extra_config), '^---\n', '')
$kubelet_extra_config_yaml = regsubst(to_yaml($kubelet_extra_config), '^---\n', '')
$kubelet_extra_config_alpha1_yaml = regsubst(to_yaml($kubelet_extra_config_alpha1), '^---\n', '')
$kubeadm_extra_config_yaml = regsubst(stdlib::to_yaml($kubeadm_extra_config), '^---\n', '')
$kubelet_extra_config_yaml = regsubst(stdlib::to_yaml($kubelet_extra_config), '^---\n', '')
$kubelet_extra_config_alpha1_yaml = regsubst(stdlib::to_yaml($kubelet_extra_config_alpha1), '^---\n', '')

$config_version = $kubernetes_version ? {
/^1\.1(0|1)/ => 'v1alpha1',
Expand Down
5 changes: 3 additions & 2 deletions manifests/config/worker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
# [{'key' => 'dedicated','value' => 'NewNode','effect' => 'NoSchedule', 'operator' => 'Equal'}]
# Defaults to undef
# @param kubelet_extra_arguments
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied to both control planes and nodes.
# Use this for critical Kubelet settings such as `pod-infra-container-image` which may be problematic to configure via kubelet_extra_config
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied
# to both control planes and nodes. Use this for critical Kubelet settings such as `pod-infra-container-image`
# which may be problematic to configure via kubelet_extra_config
# Defaults to []
# @param kubelet_extra_config
# A hash containing extra configuration data to be serialised with `to_yaml` and appended to Kubelet configuration file for the cluster.
Expand Down
11 changes: 7 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@
# Defaults to "new"
#
# [*etcd_compaction_retention*]
# 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"
# 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"
# Integer or String
# Defaults to 0 (disabled)
#
Expand Down Expand Up @@ -294,7 +295,8 @@
# Defaults to []
#
# [*delegated_pki*]
# 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.
# 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.
# Defaults to false
#
# [*kubernetes_ca_crt*]
Expand Down Expand Up @@ -388,8 +390,9 @@
# Defaults to {}
#
# [*kubelet_extra_arguments*]
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied to both control planes and nodes.
# Use this for critical Kubelet settings such as `pod-infra-container-image` which may be problematic to configure via kubelet_extra_config
# A string array to be appended to kubeletExtraArgs in the Kubelet's nodeRegistration configuration applied
# to both control planes and nodes. Use this for critical Kubelet settings such as `pod-infra-container-image`
# which may be problematic to configure via kubelet_extra_config
# Defaults to []
#
# [*proxy_mode*]
Expand Down
26 changes: 13 additions & 13 deletions manifests/repos.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@
'Debian': {
$codename = fact('os.distro.codename')
apt::source { 'kubernetes':
location => pick($kubernetes_apt_location,'https://apt.kubernetes.io'),
repos => pick($kubernetes_apt_repos,'main'),
release => pick($kubernetes_apt_release,'kubernetes-xenial'),
location => pick($kubernetes_apt_location, 'https://apt.kubernetes.io'),
repos => pick($kubernetes_apt_repos, 'main'),
release => pick($kubernetes_apt_release, 'kubernetes-xenial'),
key => {
'id' => pick($kubernetes_key_id,'A362B822F6DEDC652817EA46B53DC80D13EDEF05'),
'source' => pick($kubernetes_key_source,'https://packages.cloud.google.com/apt/doc/apt-key.gpg'),
'id' => pick($kubernetes_key_id, 'A362B822F6DEDC652817EA46B53DC80D13EDEF05'),
'source' => pick($kubernetes_key_source, 'https://packages.cloud.google.com/apt/doc/apt-key.gpg'),
},
}

if ($container_runtime == 'docker' and $manage_docker == true) or
($container_runtime == 'cri_containerd' and $containerd_install_method == 'package') {
apt::source { 'docker':
location => pick($docker_apt_location,'https://download.docker.com/linux/ubuntu/'),
repos => pick($docker_apt_repos,'stable'),
location => pick($docker_apt_location, 'https://download.docker.com/linux/ubuntu/'),
repos => pick($docker_apt_repos, 'stable'),
release => pick($docker_apt_release,$codename),
key => {
'id' => pick($docker_key_id,'9DC858229FC7DD38854AE2D88D81803C0EBFCD88'),
'source' => pick($docker_key_source,'https://download.docker.com/linux/ubuntu/gpg'),
'id' => pick($docker_key_id, '9DC858229FC7DD38854AE2D88D81803C0EBFCD88'),
'source' => pick($docker_key_source, 'https://download.docker.com/linux/ubuntu/gpg'),
},
}
}
Expand All @@ -91,16 +91,16 @@
($container_runtime == 'cri_containerd' and $containerd_install_method == 'package') {
yumrepo { 'docker':
descr => 'docker',
baseurl => pick($docker_yum_baseurl,'https://download.docker.com/linux/centos/7/x86_64/stable'),
gpgkey => pick($docker_yum_gpgkey,'https://download.docker.com/linux/centos/gpg'),
baseurl => pick($docker_yum_baseurl, 'https://download.docker.com/linux/centos/7/x86_64/stable'),
gpgkey => pick($docker_yum_gpgkey, 'https://download.docker.com/linux/centos/gpg'),
gpgcheck => true,
}
}

yumrepo { 'kubernetes':
descr => 'Kubernetes',
baseurl => pick($kubernetes_yum_baseurl,'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64'),
gpgkey => pick($kubernetes_yum_gpgkey,'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg'),
baseurl => pick($kubernetes_yum_baseurl, 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/'),
gpgkey => pick($kubernetes_yum_gpgkey, 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key'),
gpgcheck => true,
}
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"name": "puppetlabs-apt",
"version_requirement": "< 10.0.0"
"version_requirement": "<= 10.0.0"
},
{
"name": "puppet-archive",
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/integration_kubernetes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
it 'verify the k8 nodes' do
run_shell('sleep 20')
run_shell('KUBECONFIG=/etc/kubernetes/admin.conf kubectl get nodes') do |r|
expect(r.stdout).to match(%r{#{hostname1}(\s)+Ready(\s)+control-plane,master})
expect(r.stdout).to match(%r{#{hostname1}(\s)+Ready(\s)+control-plane})
expect(r.stdout).to match(%r{#{hostname2}(\s)+Ready})
expect(r.stdout).to match(%r{#{hostname3}(\s)+Ready})
end
Expand Down
12 changes: 8 additions & 4 deletions spec/acceptance/kubernetes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

pp = <<-MANIFEST
case $facts['os']['family'] {
'RedHat', 'CentOS': {
/^(RedHat|CentOS)$/: {
class {'kubernetes':
kubernetes_version => '1.22.0',
kubernetes_package_version => '1.22.0',
kubernetes_version => '1.28.15',
kubernetes_package_version => '1.28.15',
controller_address => "#{int_ipaddr1}:6443",
container_runtime => 'docker',
manage_docker => false,
Expand All @@ -26,6 +26,7 @@ class {'kubernetes':
environment => ['HOME=/root', 'KUBECONFIG=/etc/kubernetes/admin.conf'],
ignore_preflight_errors => ['NumCPU','ExternalEtcdVersion'],
cgroup_driver => 'systemd',
service_cidr => '10.138.0.0/12',
}
}
/^(Debian|Ubuntu)$/: {
Expand Down Expand Up @@ -59,6 +60,8 @@ class {'kubernetes': } # any other OS are not supported
before(:all) { change_target_host('controller') }
after(:all) { reset_target_host }

int_ipaddr1 = fetch_ip_hostname_by_role('controller')[2]

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

it 'can access the deployed service' do
run_shell('sleep 60')
run_shell('curl --retry 10 --retry-delay 15 -s 10.96.188.5') do |r|
shell_command = "curl --retry 10 --retry-delay 15 -s #{int_ipaddr1}"
run_shell(shell_command) do |r|
expect(r.stdout).to match(%r{Welcome to nginx!})
end
end
Expand Down
Loading
Loading