beaker-kubevirt 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.devcontainer/.pryrc +10 -0
- data/.devcontainer/Dockerfile +49 -0
- data/.devcontainer/devcontainer.json +53 -0
- data/.rspec +3 -0
- data/.rubocop.yml +30 -0
- data/CHANGELOG.md +55 -0
- data/History.md +48 -0
- data/LICENSE +661 -0
- data/README.md +274 -0
- data/Rakefile +41 -0
- data/examples/cloud-init.yaml +57 -0
- data/examples/hosts.yaml +91 -0
- data/examples/usage.rb +70 -0
- data/lib/beaker/hypervisor/kubevirt.rb +1121 -0
- data/lib/beaker/hypervisor/kubevirt_helper.rb +593 -0
- data/lib/beaker/hypervisor/port_forward.rb +612 -0
- data/lib/beaker/kubevirt/version.rb +5 -0
- data/tests/nodesets/default.yaml +15 -0
- data/tests/spec/beaker/hypervisor/kubevirt_spec.rb +11 -0
- metadata +188 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 42851521ceebcac0549527587051965bce3698a15ea7995f3111db7b481b5ce9
|
|
4
|
+
data.tar.gz: 4ed638d67f36721a8d656e57096f09ccd4e32c010c642625608ac830de41fea3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: aaef810b582931893e1828c4fcf7cde1d42b86f30ab030ef0937bde204eb1b8cccc4e520e0b0bbbc854c55f774514c27dc5d5f1c00cb8ea41e1d39d632bd137d
|
|
7
|
+
data.tar.gz: a56cb846fc5bb309755fca675017abd7c66f518bf266b092c26482ed64254f10e4cfae25580217b750dbb747cf2230c8bdd1cf8e8b947c7c5bf3c399bdc23187
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
if defined?(PryByebug)
|
|
2
|
+
Pry.commands.alias_command 'c', 'continue'
|
|
3
|
+
Pry.commands.alias_command 's', 'step'
|
|
4
|
+
Pry.commands.alias_command 'n', 'next'
|
|
5
|
+
Pry.commands.alias_command 'f', 'finish'
|
|
6
|
+
# Hit Enter to repeat last command
|
|
7
|
+
Pry::Commands.command(/^$/, 'repeat last command') do
|
|
8
|
+
pry_instance.run_command Pry.history.to_a.last
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
FROM mcr.microsoft.com/devcontainers/ruby:1-3.4-bullseye
|
|
2
|
+
|
|
3
|
+
RUN mkdir -p /buildtmp \
|
|
4
|
+
&& chown -R vscode:vscode /buildtmp
|
|
5
|
+
|
|
6
|
+
USER vscode
|
|
7
|
+
WORKDIR /home/vscode
|
|
8
|
+
|
|
9
|
+
RUN set -x; cd "$(mktemp -d)" && \
|
|
10
|
+
OS="$(uname | tr '[:upper:]' '[:lower:]')" && \
|
|
11
|
+
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && \
|
|
12
|
+
KREW="krew-${OS}_${ARCH}" && \
|
|
13
|
+
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && \
|
|
14
|
+
tar zxvf "${KREW}.tar.gz" && \
|
|
15
|
+
./"${KREW}" install krew
|
|
16
|
+
|
|
17
|
+
# Add krew to PATH
|
|
18
|
+
RUN cat >> /home/vscode/.bashrc <<EOF
|
|
19
|
+
# Add krew to PATH
|
|
20
|
+
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
|
21
|
+
|
|
22
|
+
# Enable shell completion for kubectl
|
|
23
|
+
source <(kubectl completion bash)
|
|
24
|
+
|
|
25
|
+
# Make kubectl completion work for the alias 'k'
|
|
26
|
+
alias k="kubectl"
|
|
27
|
+
complete -o default -F __start_kubectl k
|
|
28
|
+
|
|
29
|
+
EOF
|
|
30
|
+
|
|
31
|
+
COPY --chown=vscode:vscode .devcontainer/.pryrc ./
|
|
32
|
+
RUN mkdir -p /home/vscode/.ssh && \
|
|
33
|
+
chown -R vscode:vscode /home/vscode/.ssh && \
|
|
34
|
+
chmod 700 /home/vscode/.ssh
|
|
35
|
+
# Set the working directory in the container
|
|
36
|
+
WORKDIR /buildtmp
|
|
37
|
+
RUN bundle config path /home/vscode/.bundle
|
|
38
|
+
# 1. Copy only the files that define your dependencies.
|
|
39
|
+
# The layer cache for the next step will only be invalidated
|
|
40
|
+
# if these specific files change.
|
|
41
|
+
COPY --chown=vscode:vscode ../*.gemspec ./
|
|
42
|
+
COPY --chown=vscode:vscode ../Gemfile* ./
|
|
43
|
+
# Need the version.rb file to allow bundler to run
|
|
44
|
+
COPY --chown=vscode:vscode ../lib/beaker/kubevirt/version.rb ./lib/beaker/kubevirt/version.rb
|
|
45
|
+
|
|
46
|
+
# 2. Install all dependencies using Bundler.
|
|
47
|
+
# This is the time-consuming step that we want to cache.
|
|
48
|
+
# It will only re-run if the .gemspec or Gemfile changes.
|
|
49
|
+
RUN bundle install --jobs "$(nproc)"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
|
+
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
|
3
|
+
{
|
|
4
|
+
"name": "Ruby",
|
|
5
|
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
6
|
+
"build": {
|
|
7
|
+
// Use 'dockerfile' to specify a Dockerfile. More info: https://containers.dev/guide/dockerfile
|
|
8
|
+
"dockerfile": "Dockerfile",
|
|
9
|
+
// Use 'context' to specify the build context. More info: https://containers.dev/guide/dockerfile#build-context
|
|
10
|
+
"context": ".."
|
|
11
|
+
// Use 'args' to pass build arguments. More info: https://containers.dev/guide/dockerfile#build-args
|
|
12
|
+
// "args": {}
|
|
13
|
+
},
|
|
14
|
+
"features": {
|
|
15
|
+
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {},
|
|
16
|
+
"ghcr.io/devcontainers-extra/features/kubectx-kubens:1": {},
|
|
17
|
+
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {},
|
|
18
|
+
"ghcr.io/larsnieuwenhuizen/features/neovim:0": {},
|
|
19
|
+
"ghcr.io/devcontainers-extra/features/fzf:1": {}
|
|
20
|
+
},
|
|
21
|
+
"customizations": {
|
|
22
|
+
"vscode": {
|
|
23
|
+
"settings": {
|
|
24
|
+
"ruby.useLanguageServer": true,
|
|
25
|
+
"ruby.lsp.debug": true
|
|
26
|
+
},
|
|
27
|
+
"extensions": [
|
|
28
|
+
"Shopify.ruby-lsp",
|
|
29
|
+
"adrientoub.base64utils"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind,consistency=cached",
|
|
34
|
+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
|
35
|
+
"postCreateCommand": {
|
|
36
|
+
"Generate SSH Key": "ssh-keygen -N '' -t rsa -b 4096 -f /home/vscode/.ssh/id_rsa",
|
|
37
|
+
"Update Dependencies": "bundle install",
|
|
38
|
+
"Install Kubevirt krew plugin": "kubectl krew install virt"
|
|
39
|
+
},
|
|
40
|
+
"mounts": [
|
|
41
|
+
"type=bind,src=${localEnv:HOME}/.kube,dst=/home/vscode/.kube,consistency=cached",
|
|
42
|
+
]
|
|
43
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
44
|
+
// "features": {},
|
|
45
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
46
|
+
// "forwardPorts": [],
|
|
47
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
48
|
+
// "postCreateCommand": "ruby --version",
|
|
49
|
+
// Configure tool-specific properties.
|
|
50
|
+
// "customizations": {},
|
|
51
|
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
|
52
|
+
// "remoteUser": "root"
|
|
53
|
+
}
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
inherit_gem:
|
|
3
|
+
voxpupuli-rubocop: rubocop.yml
|
|
4
|
+
|
|
5
|
+
Layout/LineLength:
|
|
6
|
+
Enabled: false
|
|
7
|
+
|
|
8
|
+
# Increase RSpec example length limits for integration tests
|
|
9
|
+
RSpec/ExampleLength:
|
|
10
|
+
Max: 40
|
|
11
|
+
|
|
12
|
+
# Allow more expectations in integration tests
|
|
13
|
+
RSpec/MultipleExpectations:
|
|
14
|
+
Max: 5
|
|
15
|
+
|
|
16
|
+
# Allow more memoized helpers for complex test setups
|
|
17
|
+
RSpec/MultipleMemoizedHelpers:
|
|
18
|
+
Max: 10
|
|
19
|
+
|
|
20
|
+
# Allow instance variables in before blocks for reactor state tracking
|
|
21
|
+
RSpec/InstanceVariable:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
# MessageSpies style is a preference - allow both styles
|
|
25
|
+
RSpec/MessageSpies:
|
|
26
|
+
Enabled: false
|
|
27
|
+
|
|
28
|
+
# Allow non-verified doubles for flexibility in testing
|
|
29
|
+
RSpec/VerifiedDoubles:
|
|
30
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0](https://github.com/voxpupuli/beaker-kubevirt/tree/1.0.0) (2026-07-17)
|
|
6
|
+
|
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-kubevirt/compare/a388e545ac4aa46006e53f006ad5af1a243bdbbd...1.0.0)
|
|
8
|
+
|
|
9
|
+
**Closed issues:**
|
|
10
|
+
|
|
11
|
+
- Add cleanup on exit [\#10](https://github.com/voxpupuli/beaker-kubevirt/issues/10)
|
|
12
|
+
|
|
13
|
+
**Merged pull requests:**
|
|
14
|
+
|
|
15
|
+
- CI: Apply Release best practices & Set default token permission & Generate ruby matrix [\#44](https://github.com/voxpupuli/beaker-kubevirt/pull/44) ([bastelfreak](https://github.com/bastelfreak))
|
|
16
|
+
- Update voxpupuli-rubocop requirement from ~\> 5.0.0 to ~\> 5.2.0 [\#43](https://github.com/voxpupuli/beaker-kubevirt/pull/43) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
17
|
+
- CI: apply Vox Pupuli defaults [\#39](https://github.com/voxpupuli/beaker-kubevirt/pull/39) ([bastelfreak](https://github.com/bastelfreak))
|
|
18
|
+
- Use /portforward/\<port\>/tcp form for VMI WebSocket URL [\#38](https://github.com/voxpupuli/beaker-kubevirt/pull/38) ([jaevans](https://github.com/jaevans))
|
|
19
|
+
- Keep long-running SSH sessions alive past idle timeouts [\#37](https://github.com/voxpupuli/beaker-kubevirt/pull/37) ([jaevans](https://github.com/jaevans))
|
|
20
|
+
- Clean up port forwarder log levels and messages [\#36](https://github.com/voxpupuli/beaker-kubevirt/pull/36) ([jaevans](https://github.com/jaevans))
|
|
21
|
+
- Clean up DataVolumes labeled for the test group [\#35](https://github.com/voxpupuli/beaker-kubevirt/pull/35) ([jaevans](https://github.com/jaevans))
|
|
22
|
+
- Unlink kubeconfig-derived tempfiles at cleanup [\#34](https://github.com/voxpupuli/beaker-kubevirt/pull/34) ([jaevans](https://github.com/jaevans))
|
|
23
|
+
- Bound EventMachine reactor startup wait [\#33](https://github.com/voxpupuli/beaker-kubevirt/pull/33) ([jaevans](https://github.com/jaevans))
|
|
24
|
+
- Validate namespace and URL-encode WebSocket path segments [\#32](https://github.com/voxpupuli/beaker-kubevirt/pull/32) ([jaevans](https://github.com/jaevans))
|
|
25
|
+
- Sanitize hostnames before using as k8s label values [\#31](https://github.com/voxpupuli/beaker-kubevirt/pull/31) ([jaevans](https://github.com/jaevans))
|
|
26
|
+
- Normalize and validate kubeconfig path [\#30](https://github.com/voxpupuli/beaker-kubevirt/pull/30) ([jaevans](https://github.com/jaevans))
|
|
27
|
+
- Tag NodePort services with beaker/test-group for cleanup [\#29](https://github.com/voxpupuli/beaker-kubevirt/pull/29) ([jaevans](https://github.com/jaevans))
|
|
28
|
+
- Don't abort cluster cleanup when a port-forwarder gets stuck [\#28](https://github.com/voxpupuli/beaker-kubevirt/pull/28) ([jaevans](https://github.com/jaevans))
|
|
29
|
+
- Scope at\_exit cleanup suppression to this gem's own tests [\#27](https://github.com/voxpupuli/beaker-kubevirt/pull/27) ([jaevans](https://github.com/jaevans))
|
|
30
|
+
- Preserve existing host\['ssh'\]\['keys'\] when configuring kubevirt key [\#26](https://github.com/voxpupuli/beaker-kubevirt/pull/26) ([jaevans](https://github.com/jaevans))
|
|
31
|
+
- Log SSH private key basename at INFO, full path at DEBUG [\#25](https://github.com/voxpupuli/beaker-kubevirt/pull/25) ([jaevans](https://github.com/jaevans))
|
|
32
|
+
- Pvc namespace [\#22](https://github.com/voxpupuli/beaker-kubevirt/pull/22) ([jaevans](https://github.com/jaevans))
|
|
33
|
+
- Fix Windows VM OOMKills and fail fast on virt-launcher pod failure [\#21](https://github.com/voxpupuli/beaker-kubevirt/pull/21) ([jaevans](https://github.com/jaevans))
|
|
34
|
+
- Add Ruby 4.0 to CI test matrix [\#20](https://github.com/voxpupuli/beaker-kubevirt/pull/20) ([jaevans](https://github.com/jaevans))
|
|
35
|
+
- Add bug tracker URI to gemspec metadata [\#19](https://github.com/voxpupuli/beaker-kubevirt/pull/19) ([jaevans](https://github.com/jaevans))
|
|
36
|
+
- Add error handling for cloud-init YAML parsing [\#18](https://github.com/voxpupuli/beaker-kubevirt/pull/18) ([jaevans](https://github.com/jaevans))
|
|
37
|
+
- Fix SSH key path expansion [\#17](https://github.com/voxpupuli/beaker-kubevirt/pull/17) ([jaevans](https://github.com/jaevans))
|
|
38
|
+
- Add error handling to VM creation in provision [\#16](https://github.com/voxpupuli/beaker-kubevirt/pull/16) ([jaevans](https://github.com/jaevans))
|
|
39
|
+
- Remove dead code and vague TODO [\#14](https://github.com/voxpupuli/beaker-kubevirt/pull/14) ([jaevans](https://github.com/jaevans))
|
|
40
|
+
- Remove stale comment from CI workflow [\#13](https://github.com/voxpupuli/beaker-kubevirt/pull/13) ([jaevans](https://github.com/jaevans))
|
|
41
|
+
- Remove internal files and update .gitignore [\#12](https://github.com/voxpupuli/beaker-kubevirt/pull/12) ([jaevans](https://github.com/jaevans))
|
|
42
|
+
- Add cleanup on exit handler for hypervisor resources [\#11](https://github.com/voxpupuli/beaker-kubevirt/pull/11) ([Copilot](https://github.com/apps/copilot-swe-agent))
|
|
43
|
+
- Remove setting of resources on the VM spec [\#9](https://github.com/voxpupuli/beaker-kubevirt/pull/9) ([jaevans](https://github.com/jaevans))
|
|
44
|
+
- Enhance PVC reference handling [\#8](https://github.com/voxpupuli/beaker-kubevirt/pull/8) ([jaevans](https://github.com/jaevans))
|
|
45
|
+
- Prefix options with "kubevirt\_" [\#7](https://github.com/voxpupuli/beaker-kubevirt/pull/7) ([jaevans](https://github.com/jaevans))
|
|
46
|
+
- Improve-port-forward [\#6](https://github.com/voxpupuli/beaker-kubevirt/pull/6) ([jaevans](https://github.com/jaevans))
|
|
47
|
+
- Initial windows support [\#5](https://github.com/voxpupuli/beaker-kubevirt/pull/5) ([jaevans](https://github.com/jaevans))
|
|
48
|
+
- fix: Modify cleanup to correctly find the name in the resource metadata [\#4](https://github.com/voxpupuli/beaker-kubevirt/pull/4) ([jaevans](https://github.com/jaevans))
|
|
49
|
+
- Switch license from Apache-2.0 to AGPL-3.0-or-later [\#3](https://github.com/voxpupuli/beaker-kubevirt/pull/3) ([silug](https://github.com/silug))
|
|
50
|
+
- More functionality [\#2](https://github.com/voxpupuli/beaker-kubevirt/pull/2) ([jaevans](https://github.com/jaevans))
|
|
51
|
+
- Make functional [\#1](https://github.com/voxpupuli/beaker-kubevirt/pull/1) ([jaevans](https://github.com/jaevans))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/History.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `kubevirt_memory_overhead` (default `512Mi`) and `kubevirt_memory_request` options.
|
|
12
|
+
The VM spec now sets `spec.template.spec.domain.resources.requests/limits.memory`
|
|
13
|
+
explicitly (guest + overhead for the limit) so Windows guests no longer get
|
|
14
|
+
OOMKilled by KubeVirt's too-small auto-computed virt-launcher overhead.
|
|
15
|
+
- `wait_for_vm_ready` now inspects the virt-launcher pod each poll and fails
|
|
16
|
+
fast with a specific reason (OOMKilled, CrashLoopBackOff, ImagePullBackOff,
|
|
17
|
+
terminal VMI phase, ...) instead of hanging for the full timeout.
|
|
18
|
+
- TCP `readinessProbe` on the guest's SSH port is added to the VM spec by
|
|
19
|
+
default (for `port-forward` and `nodeport` network modes; skipped for
|
|
20
|
+
`multus`). `wait_for_vm_ready` now waits for the VMI's `Ready` condition to
|
|
21
|
+
flip to `True`, so provisioning only hands off to Beaker once sshd is
|
|
22
|
+
actually accepting connections — no more SSH "connection refused" retries
|
|
23
|
+
while cloud-init / Windows first-boot is still running. Tunable via
|
|
24
|
+
`kubevirt_readiness_probe` and opt-out via `kubevirt_readiness_probe_disabled`.
|
|
25
|
+
When the probe is enabled, `timeout` is auto-raised to fit the probe's
|
|
26
|
+
failure budget.
|
|
27
|
+
- Initial implementation of KubeVirt hypervisor provider for Beaker
|
|
28
|
+
- Support for VM provisioning using KubeVirt VirtualMachine objects
|
|
29
|
+
- Multiple image source support (PVC, ContainerDisk, DataVolume)
|
|
30
|
+
- Cloud-init configuration injection for VM setup
|
|
31
|
+
- Multiple networking modes:
|
|
32
|
+
- Port-forward (default, works in all environments)
|
|
33
|
+
- NodePort (requires node access)
|
|
34
|
+
- Multus (external bridge networking)
|
|
35
|
+
- Automatic VM lifecycle management (provision, test, cleanup)
|
|
36
|
+
- SSH key injection and access setup
|
|
37
|
+
- Resource configuration (CPU, memory)
|
|
38
|
+
- Kubernetes authentication support (token, client certificates)
|
|
39
|
+
- Comprehensive test suite and examples
|
|
40
|
+
|
|
41
|
+
### Security
|
|
42
|
+
- SSH public key authentication by default
|
|
43
|
+
- Secure handling of Kubernetes credentials
|
|
44
|
+
|
|
45
|
+
## [0.1.0] - 2025-07-07
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
- Initial gem structure and basic implementation
|