Skip to content

Commit

Permalink
(CAT-2193): Fixed kubernetes environment setup for Debian. This allow…
Browse files Browse the repository at this point in the history
…s spec tests to run successfully for debian platform
  • Loading branch information
span786 committed Jan 9, 2025
1 parent 689d78b commit f2a4a65
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 89 deletions.
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':['rhel-8'],'collection':['puppet7-nightly', 'puppet8-nightly']}
matrix: {'platform':['rhel-8', 'debian-11'],'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':['rhel-8'],'collection':['puppet7-nightly', 'puppet8-nightly']}
matrix: {'platform':['rhel-8', 'debian-11'],'collection':['puppet7-nightly', 'puppet8-nightly']}

steps:
- name: Checkout Source
Expand Down
17 changes: 9 additions & 8 deletions manifests/repos.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@
'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://pkgs.k8s.io/core:/stable:/v1.32/deb/'),
repos => pick($kubernetes_apt_repos, ' '),
release => pick($kubernetes_apt_release, ' /'),
comment => 'Kubernetes',
key => {
'id' => pick($kubernetes_key_id, 'A362B822F6DEDC652817EA46B53DC80D13EDEF05'),
'source' => pick($kubernetes_key_source, 'https://packages.cloud.google.com/apt/doc/apt-key.gpg'),
'name' => 'kubernetes-apt-keyring.gpg',
'source' => pick($kubernetes_key_source, 'https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key'),
},
}

Expand All @@ -78,7 +79,7 @@
apt::source { 'docker':
location => pick($docker_apt_location, 'https://download.docker.com/linux/ubuntu/'),
repos => pick($docker_apt_repos, 'stable'),
release => pick($docker_apt_release,$codename),
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'),
Expand All @@ -99,8 +100,8 @@

yumrepo { 'kubernetes':
descr => 'Kubernetes',
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'),
baseurl => pick($kubernetes_yum_baseurl, 'https://pkgs.k8s.io/core:/stable:/v1.32/rpm/'),
gpgkey => pick($kubernetes_yum_gpgkey, 'https://pkgs.k8s.io/core:/stable:/v1.32/rpm/repodata/repomd.xml.key'),
gpgcheck => true,
}
}
Expand Down
20 changes: 14 additions & 6 deletions spec/acceptance/kubernetes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
class {'kubernetes':
kubernetes_version => '1.28.15',
kubernetes_package_version => '1.28.15',
kubernetes_yum_baseurl => 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/',
kubernetes_yum_gpgkey => 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key',
controller_address => "#{int_ipaddr1}:6443",
container_runtime => 'docker',
manage_docker => false,
Expand All @@ -30,12 +32,18 @@ class {'kubernetes':
}
}
/^(Debian|Ubuntu)$/: {
class {'kubernetes':
controller => true,
schedule_on_controller => true,
environment => ['HOME=/root', 'KUBECONFIG=/etc/kubernetes/admin.conf'],
ignore_preflight_errors => ['NumCPU'],
}
class {'kubernetes':
kubernetes_version => '1.28.15',
kubernetes_package_version => '1.28.15-1.1',
kubernetes_apt_location => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/',
kubernetes_apt_repos => ' ',
kubernetes_apt_release => ' /',
kubernetes_key_source => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key',
controller => true,
schedule_on_controller => true,
environment => ['HOME=/root', 'KUBECONFIG=/etc/kubernetes/admin.conf'],
ignore_preflight_errors => ['NumCPU','ExternalEtcdVersion'],
}
}
default: {
class {'kubernetes': } # any other OS are not supported
Expand Down
32 changes: 16 additions & 16 deletions spec/classes/repos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
let(:params) do
{
'container_runtime' => 'docker',
'kubernetes_apt_location' => 'http://apt.kubernetes.io',
'kubernetes_apt_release' => 'kubernetes-xenial',
'kubernetes_apt_repos' => 'main',
'kubernetes_apt_location' => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/',
'kubernetes_apt_release' => ' /',
'kubernetes_apt_repos' => ' ',
'kubernetes_key_id' => '54A647F9048D5688D7DA2ABE6A030B21BA07F4FB',
'kubernetes_key_source' => 'https://packages.cloud.google.com/apt/doc/apt-key.gpg',
'kubernetes_key_source' => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key',
'kubernetes_yum_baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64',
'kubernetes_yum_gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg',
'docker_apt_location' => 'https://download.docker.com/linux/ubuntu',
Expand All @@ -45,10 +45,10 @@
it {
expect(subject).to contain_apt__source('kubernetes').with(
ensure: 'present',
location: 'http://apt.kubernetes.io',
repos: 'main',
release: 'kubernetes-xenial',
key: { 'id' => '54A647F9048D5688D7DA2ABE6A030B21BA07F4FB', 'source' => 'https://packages.cloud.google.com/apt/doc/apt-key.gpg' },
location: 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/',
repos: ' ',
release: ' /',
key: { 'name' => 'kubernetes-apt-keyring.gpg', 'source' => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key' },
)
}

Expand Down Expand Up @@ -83,11 +83,11 @@
let(:params) do
{
'container_runtime' => 'cri_containerd',
'kubernetes_apt_location' => 'http://apt.kubernetes.io',
'kubernetes_apt_release' => 'kubernetes-xenial',
'kubernetes_apt_repos' => 'main',
'kubernetes_apt_location' => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/',
'kubernetes_apt_release' => ' /',
'kubernetes_apt_repos' => ' ',
'kubernetes_key_id' => '54A647F9048D5688D7DA2ABE6A030B21BA07F4FB',
'kubernetes_key_source' => 'https://packages.cloud.google.com/apt/doc/apt-key.gpg',
'kubernetes_key_source' => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key',
'kubernetes_yum_baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64',
'kubernetes_yum_gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg',
'docker_apt_location' => 'https://download.docker.com/linux/ubuntu',
Expand All @@ -106,10 +106,10 @@
it {
expect(subject).to contain_apt__source('kubernetes').with(
ensure: 'present',
location: 'http://apt.kubernetes.io',
repos: 'main',
release: 'kubernetes-xenial',
key: { 'id' => '54A647F9048D5688D7DA2ABE6A030B21BA07F4FB', 'source' => 'https://packages.cloud.google.com/apt/doc/apt-key.gpg' },
location: 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/',
repos: ' ',
release: ' /',
key: { 'name' => 'kubernetes-apt-keyring.gpg', 'source' => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key' },
)
}

Expand Down
Loading

0 comments on commit f2a4a65

Please sign in to comment.