diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a636291..d508e6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,17 +11,13 @@ jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - ruby: - - 2.7.0 - steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true + ruby-version: "3.0.2" + - name: Setup bundle + run: bundle update && bundle install - name: Run the default task run: bundle exec rake diff --git a/Gemfile b/Gemfile index edba6a2..0a92740 100644 --- a/Gemfile +++ b/Gemfile @@ -8,8 +8,6 @@ end group :plugins do gemspec - # gem "vagrant-libvirt" # gem "vagrant-reload" # gem "vagrant-timezone" - # gem "vagrant-vmware-desktop" end diff --git a/Gemfile.lock b/Gemfile.lock index 1c4dbe6..37d8fc2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -28,7 +28,7 @@ GIT PATH remote: . specs: - vagrant-k3s (0.1.4.pre.dev) + vagrant-k3s (0.1.5) GEM remote: https://rubygems.org/ @@ -36,55 +36,56 @@ GEM bcrypt_pbkdf (1.1.0) builder (3.2.4) childprocess (4.1.0) - concurrent-ruby (1.1.9) - diff-lcs (1.4.4) + concurrent-ruby (1.1.10) + diff-lcs (1.5.0) ed25519 (1.2.4) - erubi (1.10.0) - excon (0.88.0) - ffi (1.15.4) + erubi (1.11.0) + excon (0.94.0) + ffi (1.15.5) gssapi (1.3.1) ffi (>= 1.0.1) - gyoku (1.3.1) + gyoku (1.4.0) builder (>= 2.1.2) + rexml (~> 3.0) hashicorp-checkpoint (0.1.5) httpclient (2.8.3) - i18n (1.8.11) + i18n (1.12.0) concurrent-ruby (~> 1.0) - listen (3.7.0) + listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) little-plugger (1.1.4) log4r (1.1.10) - logging (2.3.0) + logging (2.3.1) little-plugger (~> 1.1) multi_json (~> 1.14) mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2021.1115) + mime-types-data (3.2022.0105) multi_json (1.15.0) net-scp (3.0.0) - net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (>= 2.6.5) net-sftp (3.0.0) net-ssh (>= 5.0.0, < 7.0.0) net-ssh (6.1.0) nori (2.6.0) rake (13.0.6) - rb-fsevent (0.11.0) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rb-kqueue (0.2.7) + rb-kqueue (0.2.8) ffi (>= 0.5.0) rexml (3.2.5) rspec (3.10.0) rspec-core (~> 3.10.0) rspec-expectations (~> 3.10.0) rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) + rspec-core (3.10.2) rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rspec-expectations (3.10.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) + rspec-mocks (3.10.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.10.0) rspec-support (3.10.3) @@ -124,4 +125,4 @@ DEPENDENCIES vagrant-k3s! BUNDLED WITH - 2.2.27 + 2.3.14 diff --git a/README.md b/README.md index 341d8e1..ed456fc 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,11 @@ Vagrant.configure("2") do |config| # k3s.args = '--config=/some/other/config.yaml' # default => `/etc/rancher/k3s/config.yaml` k3s.config_path = '/etc/rancher/k3s/config.yaml' + + # skip_start: install but don't start K3s + # type => Boolean + # default => false + k3s.skip_start = true end end @@ -76,11 +81,13 @@ end ## Development See https://www.vagrantup.com/docs/plugins/development-basics +- `gem build` +- `VAGRANT_CWD=./test/ubuntu bundle exec vagrant up` ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/dweomer/vagrant-k3s. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/dweomer/vagrant-k3s/blob/master/CODE_OF_CONDUCT.md). +Bug reports and pull requests are welcome on GitHub at https://github.com/k3s-io/vagrant-k3s. ## Code of Conduct -Everyone interacting in the Vagrant::K3s project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dweomer/vagrant-k3s/blob/master/CODE_OF_CONDUCT.md). +This project is intended to be a safe, welcoming space for collaboration. Everyone interacting in the vagrant-k3s projects codebase is expected to adhere to the [code of conduct](CODE_OF_CONDUCT.md). \ No newline at end of file diff --git a/lib/vagrant-k3s/config.rb b/lib/vagrant-k3s/config.rb index e657c40..512f4a6 100644 --- a/lib/vagrant-k3s/config.rb +++ b/lib/vagrant-k3s/config.rb @@ -53,6 +53,10 @@ class Config < Vagrant.plugin(2, :config) # @return [String] attr_accessor :installer_url + # Defaults to false + # @return [Boolean] + attr_accessor :skip_start + # # INSTALL_K3S_BIN_DIR # # @return [String] # attr_accessor :install_bin_dir @@ -104,6 +108,7 @@ def initialize @env_owner = UNSET_VALUE @env_path = UNSET_VALUE @installer_url = UNSET_VALUE + @skip_start = UNSET_VALUE end def finalize! @@ -117,6 +122,7 @@ def finalize! @env_owner = DEFAULT_ENV_OWNER if @env_owner == UNSET_VALUE @env_path = DEFAULT_ENV_PATH if @env_path == UNSET_VALUE @installer_url = DEFAULT_INSTALLER_URL if @installer_url == UNSET_VALUE + @skip_start = false if @skip_start == UNSET_VALUE if @args && args_valid? @args = @args.is_a?(Array) ? @args.map { |a| a.to_s } : @args.to_s diff --git a/lib/vagrant-k3s/provisioner.rb b/lib/vagrant-k3s/provisioner.rb index a6fdfe6..68cf22a 100644 --- a/lib/vagrant-k3s/provisioner.rb +++ b/lib/vagrant-k3s/provisioner.rb @@ -51,6 +51,11 @@ def provision end file_upload "k3s-install.env", env_file, env_text + skip_env = "" + if config.skip_start + skip_env = "INSTALL_K3S_SKIP_ENABLE=true" + end + prv_file = "/vagrant/k3s-provisioner.sh" prv_text = <<~EOF #/usr/bin/env bash @@ -62,7 +67,7 @@ def provision set -o allexport source #{config.env_path} set +o allexport - curl -fsL '#{config.installer_url}' | sh -s - #{args} + curl -fsL '#{config.installer_url}' | #{skip_env} sh -s - #{args} EOF file_upload("k3s-install.sh", prv_file, prv_text) @machine.ui.info "Invoking: #{prv_file}" diff --git a/lib/vagrant-k3s/version.rb b/lib/vagrant-k3s/version.rb index bd98903..6e3fd7e 100644 --- a/lib/vagrant-k3s/version.rb +++ b/lib/vagrant-k3s/version.rb @@ -2,6 +2,6 @@ module VagrantPlugins module K3s - VERSION = '0.1.4.dev.1' + VERSION = '0.1.5' end end diff --git a/test/focal/Vagrantfile b/test/ubuntu/Vagrantfile similarity index 95% rename from test/focal/Vagrantfile rename to test/ubuntu/Vagrantfile index 22e501b..db4f181 100644 --- a/test/focal/Vagrantfile +++ b/test/ubuntu/Vagrantfile @@ -7,7 +7,7 @@ ENV['VAGRANT_DEFAULT_PROVIDER'] ||= 'virtualbox' Vagrant.configure("2") do |config| # the vm.define mullet: business up front, party in the back (below) config.vm.define 'vagrant-k3s-test', primary: true do |node| - node.vm.box = 'ubuntu/focal64' + node.vm.box = 'generic/ubuntu2004' node.vm.hostname = 'vagrant' node.vm.provision :k3s, run: "once" do |k3s| k3s.args = %w[server] @@ -22,6 +22,7 @@ Vagrant.configure("2") do |config| :disable => %w[local-storage metrics-server servicelb traefik], 'disable-network-policy' => true, } + k3s.skip_start = true end end diff --git a/vagrant-k3s.gemspec b/vagrant-k3s.gemspec index ed2cffa..5a9a6e2 100644 --- a/vagrant-k3s.gemspec +++ b/vagrant-k3s.gemspec @@ -6,14 +6,14 @@ Gem::Specification.new do |spec| spec.name = 'vagrant-k3s' spec.version = VagrantPlugins::K3s::VERSION spec.platform = Gem::Platform::RUBY - spec.authors = ['Jacob Blain Christen'] - spec.email = ['dweomer5@gmail.com'] + spec.authors = ['Derek Nola', 'Jacob Blain Christen'] + spec.email = ['derek.nola@suse.com', 'dweomer5@gmail.com'] - spec.license = 'Apache 2.0' + spec.license = 'Apache-2.0' spec.summary = 'Manage k3s installations on Vagrant guests.' spec.description = spec.summary - spec.homepage = 'https://github.com/dweomer/vagrant-k3s' + spec.homepage = 'https://github.com/k3s-io/vagrant-k3s' spec.metadata['homepage_uri'] = spec.homepage spec.metadata['source_code_uri'] = spec.homepage