-
Notifications
You must be signed in to change notification settings - Fork 136
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
Switch to repos to maintaned pkgs.k8s.io #657
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,67 @@ | |
|
||
require 'spec_helper' | ||
describe 'kubernetes::repos', type: :class do | ||
context 'with Debian and default params' do | ||
let(:facts) do | ||
{ | ||
osfamily: 'Debian', # needed to run dependent tests from fixtures puppetlabs-apt | ||
kernel: 'Linux', | ||
os: { | ||
family: 'Debian', | ||
name: 'Ubuntu', | ||
release: { | ||
full: '16.04' | ||
}, | ||
distro: { | ||
codename: 'xenial' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should perhaps also get updated to a newer version like 22.04, as 24.04 will soon be released, 16.04 is long EOL now and it doesn't help me at all, if it works on some ancient release, but not a current one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has nothing to do with newer distributions. Google was releasing all packages under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I know that everything was released under the |
||
} | ||
} | ||
} | ||
end | ||
let(:params) do | ||
{ | ||
'container_runtime' => 'docker', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => '', | ||
'kubernetes_apt_release' => '', | ||
'kubernetes_apt_repos' => '', | ||
'kubernetes_key_id' => '', | ||
'kubernetes_key_source' => '', | ||
'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', | ||
'docker_apt_release' => 'xenial', | ||
'docker_apt_repos' => 'main', | ||
'docker_yum_baseurl' => 'https://download.docker.com/linux/centos/7/x86_64/stable', | ||
'docker_yum_gpgkey' => 'https://download.docker.com/linux/centos/gpg', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here: CentOS 7 / RHEL 7 will soon be EOL - CentOS Stream 9 / RHEL 9 have been out for almost 2 years now. For sure it would be good, if it still works on older releases, but people should be moving away from them anyway and ensuring that it works on newer versions is crucial to not hold people back and force them to stick with increasingly insecure OS versions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I've copy pasted those tests. But these test are garbage in & garbage out tests. It doesn't actually test these distributions. It only tests string getting passed to the class, that it gets propagated. Actual tests should be written in acceptance tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah sure, you take some (more or less arbitrary base os) and then test, if 1. If you don't specify a specific repository, it now correctly defaults to the new repo and 2. If you override it with something (e.g. the old repo), it still includes the specified repo as desired, to e.g. still use the old repo for whatever reason. As this could in theory be OS version dependent, this should in my opinion be tested on one recent release (Ubuntu 22.04 (as you changed it now - thank you!) or Debian 12 and CentOS Stream 9 / RHEL 9) and optionally additionally on some older version as well. https://github.com/puppetlabs/puppetlabs-kubernetes/pull/657/files#diff-6ff1ce06229c83037f537d2d0cb33aeba339e8fe801238cfb51c2f538c01c114R5-R70 does 1. as far as I understand it: when testing on (now) Ubuntu 22.04 with Kubernetes version 1.28, no additional https://github.com/puppetlabs/puppetlabs-kubernetes/pull/657/files#diff-6ff1ce06229c83037f537d2d0cb33aeba339e8fe801238cfb51c2f538c01c114R195-R246 tests 1., that on CentOS 7 the new default works. And finally https://github.com/puppetlabs/puppetlabs-kubernetes/pull/657/files#diff-6ff1ce06229c83037f537d2d0cb33aeba339e8fe801238cfb51c2f538c01c114L127-R297 does 2. again on CentOS 7, but now with packaged containerd instead of docker archives. |
||
'docker_key_id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88', | ||
'docker_key_source' => 'https://download.docker.com/linux/ubuntu/gpg', | ||
'containerd_install_method' => 'archive', | ||
'create_repos' => true, | ||
'manage_docker' => true | ||
} | ||
end | ||
|
||
it { | ||
expect(subject).to contain_apt__source('kubernetes').with( | ||
ensure: 'present', | ||
location: 'https://pkgs.k8s.io/core:/stable:/v1.28/deb', | ||
release: '/', | ||
key: { 'id' => 'DE15B14486CD377B9E876E1A234654DA9A296436', 'source' => 'https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key' }, | ||
) | ||
} | ||
|
||
it { | ||
expect(subject).to contain_apt__source('docker').with( | ||
ensure: 'present', | ||
location: 'https://download.docker.com/linux/ubuntu', | ||
repos: 'main', | ||
release: 'xenial', | ||
key: { 'id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88', 'source' => 'https://download.docker.com/linux/ubuntu/gpg' }, | ||
) | ||
} | ||
end | ||
|
||
context 'with osfamily => Ubuntu and manage_docker => true' do | ||
let(:facts) do | ||
{ | ||
|
@@ -22,6 +83,7 @@ | |
let(:params) do | ||
{ | ||
'container_runtime' => 'docker', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => 'http://apt.kubernetes.io', | ||
'kubernetes_apt_release' => 'kubernetes-xenial', | ||
'kubernetes_apt_repos' => 'main', | ||
|
@@ -83,6 +145,7 @@ | |
let(:params) do | ||
{ | ||
'container_runtime' => 'cri_containerd', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => 'http://apt.kubernetes.io', | ||
'kubernetes_apt_release' => 'kubernetes-xenial', | ||
'kubernetes_apt_repos' => 'main', | ||
|
@@ -124,6 +187,58 @@ | |
} | ||
end | ||
|
||
context 'with RedHat and default params' do | ||
let(:facts) do | ||
{ | ||
operatingsystem: 'RedHat', | ||
osfamily: 'RedHat', | ||
operatingsystemrelease: '7.0', | ||
kernel: 'Linux', | ||
os: { | ||
family: 'RedHat', | ||
name: 'RedHat', | ||
release: { | ||
full: '7.0' | ||
} | ||
} | ||
} | ||
end | ||
|
||
let(:params) do | ||
{ | ||
'container_runtime' => 'docker', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => '', | ||
'kubernetes_apt_release' => '', | ||
'kubernetes_apt_repos' => '', | ||
'kubernetes_key_id' => '', | ||
'kubernetes_key_source' => '', | ||
'kubernetes_yum_baseurl' => '', | ||
'kubernetes_yum_gpgkey' => '', | ||
'docker_apt_location' => 'https://download.docker.com/linux/ubuntu', | ||
'docker_apt_release' => 'xenial', | ||
'docker_apt_repos' => 'main', | ||
'docker_yum_baseurl' => 'https://download.docker.com/linux/centos/7/x86_64/stable', | ||
Comment on lines
+200
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above |
||
'docker_yum_gpgkey' => 'https://download.docker.com/linux/centos/gpg', | ||
'docker_key_id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88', | ||
'docker_key_source' => 'https://download.docker.com/linux/ubuntu/gpg', | ||
'containerd_install_method' => 'archive', | ||
'create_repos' => true, | ||
'manage_docker' => false | ||
} | ||
end | ||
|
||
it { is_expected.not_to contain_yumrepo('docker') } | ||
|
||
it { | ||
expect(subject).to contain_yumrepo('kubernetes').with( | ||
'enabled' => '1', | ||
'baseurl' => 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/', | ||
'gpgkey' => 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key', | ||
) | ||
} | ||
end | ||
|
||
context 'with osfamily => RedHat and manage_epel => true and manage_docker => false' do | ||
let(:facts) do | ||
{ | ||
|
@@ -144,6 +259,7 @@ | |
let(:params) do | ||
{ | ||
'container_runtime' => 'docker', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => 'http://apt.kubernetes.io', | ||
'kubernetes_apt_release' => 'kubernetes-xenial', | ||
'kubernetes_apt_repos' => 'main', | ||
|
@@ -165,7 +281,14 @@ | |
end | ||
|
||
it { is_expected.not_to contain_yumrepo('docker') } | ||
it { is_expected.to contain_yumrepo('kubernetes') } | ||
|
||
it { | ||
expect(subject).to contain_yumrepo('kubernetes').with( | ||
'enabled' => '1', | ||
'baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64', | ||
'gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg', | ||
) | ||
} | ||
end | ||
|
||
context 'with osfamily => RedHat and container_runtime => cri_containerd and containerd_install_method => package' do | ||
|
@@ -187,6 +310,7 @@ | |
|
||
let(:params) do | ||
{ | ||
'kubernetes_version' => '1.28.1', | ||
'container_runtime' => 'cri_containerd', | ||
'kubernetes_apt_location' => 'http://apt.kubernetes.io', | ||
'kubernetes_apt_release' => 'kubernetes-xenial', | ||
|
@@ -209,6 +333,13 @@ | |
end | ||
|
||
it { is_expected.to contain_yumrepo('docker') } | ||
it { is_expected.to contain_yumrepo('kubernetes') } | ||
|
||
it { | ||
expect(subject).to contain_yumrepo('kubernetes').with( | ||
'enabled' => '1', | ||
'baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64', | ||
'gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg', | ||
) | ||
} | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As 1.29.2 is already out by now this probably should get updated to that new version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, this is just version for tests. The point was to update the version, that is available in the new repos. We should definitely update the default version, because the current value is
1.10.2
.