Skip to content

Commit a30f780

Browse files
authored
Merge branch 'voxpupuli:master' into kubelet_labels
2 parents 98409d1 + ff86f24 commit a30f780

File tree

8 files changed

+90
-15
lines changed

8 files changed

+90
-15
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Managed by modulesync - DO NOT EDIT
3+
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
4+
5+
name: 'Prepare Release'
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Module version to be released. Must be a valid semver string without leading v. (1.2.3)'
12+
required: false
13+
14+
jobs:
15+
release_prep:
16+
uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v3'
17+
with:
18+
version: ${{ github.event.inputs.version }}
19+
allowed_owner: 'voxpupuli'
20+
secrets:
21+
# Configure secrets here:
22+
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
23+
github_pat: '${{ secrets.PCCI_PAT_RELEASE_PREP }}'

.github/workflows/release.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,3 @@ jobs:
2121
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
2222
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
2323
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}
24-
25-
create-github-release:
26-
name: Create GitHub Release
27-
runs-on: ubuntu-latest
28-
steps:
29-
- name: Create GitHub release
30-
uses: voxpupuli/gha-create-a-github-release@v1

.msync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Managed by modulesync - DO NOT EDIT
33
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
44

5-
modulesync_config_version: '9.3.0'
5+
modulesync_config_version: '9.4.0'

.vscode/extensions.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

manifests/common.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
'/opt/k8s': ;
3434
'/opt/k8s/bin': ;
3535
}
36+
['/etc/facter','/etc/facter/facts.d'].each |$path| {
37+
ensure_resource('file', $path, { ensure => directory })
38+
}
3639

3740
file { '/var/run/kubernetes':
3841
ensure => directory,

manifests/install/cni_plugins.pp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@
3333
file { $_target:
3434
ensure => stdlib::ensure($ensure, 'directory'),
3535
}
36+
if $ensure == present {
37+
# Store the cni plugin version in a static fact, to retain the plugin directory for copying from on upgrades
38+
file { '/etc/facter/facts.d/cni_plugins_version.txt':
39+
ensure => file,
40+
content => "cni_plugins_version=${version}",
41+
require => File['/opt/cni/bin'],
42+
}
43+
if fact('cni_plugins_version') and fact('cni_plugins_version') != $version {
44+
$_old_target = "/opt/k8s/cni-${fact('cni_plugins_version')}"
45+
file { $_old_target:
46+
ensure => directory,
47+
}
48+
49+
exec { 'Retain custom CNI binaries':
50+
command => "cp --no-clobber '${_old_target}'/* '${_target}'",
51+
path => fact('path'),
52+
refreshonly => true,
53+
subscribe => File['/opt/cni/bin'],
54+
}
55+
}
56+
}
3657

3758
archive { 'cni-plugins':
3859
ensure => $ensure,

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
{
2828
"name": "puppet-systemd",
29-
"version_requirement": ">= 2.0.0 < 8.0.0"
29+
"version_requirement": ">= 2.0.0 < 9.0.0"
3030
},
3131
{
3232
"name": "puppetlabs-firewall",
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
describe 'k8s::install::cni_plugins' do
6+
let(:pre_condition) do
7+
<<~PUPPET
8+
include k8s
9+
PUPPET
10+
end
11+
12+
on_supported_os.each do |os, os_facts|
13+
context "on #{os}" do
14+
let(:facts) { os_facts }
15+
16+
it { is_expected.to compile }
17+
it { is_expected.to contain_file('/opt/cni') }
18+
19+
context 'when method is tarball' do
20+
let(:params) do
21+
{
22+
method: 'tarball',
23+
version: 'v1.0.0'
24+
}
25+
end
26+
27+
it { is_expected.to contain_archive('cni-plugins').with_extract_path('/opt/k8s/cni-v1.0.0') }
28+
29+
context 'without storage fact' do
30+
it { is_expected.not_to contain_exec('Retain custom CNI binaries') }
31+
end
32+
33+
context 'with storage fact' do
34+
let(:facts) { os_facts.merge(cni_plugins_version: 'v0.0.0') }
35+
36+
it { is_expected.to contain_exec('Retain custom CNI binaries') }
37+
end
38+
end
39+
end
40+
end
41+
end

0 commit comments

Comments
 (0)