File tree Expand file tree Collapse file tree 8 files changed +90
-15
lines changed
Expand file tree Collapse file tree 8 files changed +90
-15
lines changed Original file line number Diff line number Diff line change 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 }}'
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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'
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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 ,
Original file line number Diff line number Diff line change 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 ,
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments