Skip to content
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

chore(system-tests-k8s): containerDisk poc #3481

Merged
merged 7 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions rs/tests/driver/src/driver/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ use crate::driver::{
},
test_setup::InfraProvider,
};
use crate::k8s::datavolume::DataVolumeContentType;
use crate::k8s::images::*;
use crate::k8s::tnet::{TNet, TNode};
use crate::util::block_on;
use anyhow::{bail, Result};
Expand Down Expand Up @@ -286,25 +284,24 @@ pub fn setup_and_start_vms(
let conf_img_path = PathBuf::from(&node.node_path).join(CONF_IMG_FNAME);
match InfraProvider::read_attribute(&t_env) {
InfraProvider::K8s => {
let url = format!(
"{}/{}",
tnet_node.config_url.clone().expect("missing config_url"),
CONF_IMG_FNAME
let command = format!(
marko-k0 marked this conversation as resolved.
Show resolved Hide resolved
"set -xe; \
mkdir -p /var/sysimage/tnet; \
ctr=$(sudo buildah --root /var/sysimage/tnet from scratch); \
sudo buildah --root /var/sysimage/tnet copy --chown=107:107 $ctr {0} /disk/; \
sudo buildah --root /var/sysimage/tnet commit $ctr harbor-core.harbor.svc.cluster.local/tnet/config:{1}; \
sudo buildah --root /var/sysimage/tnet push --tls-verify=false --creds 'robot$tnet+tnet:TestingPOC1' harbor-core.harbor.svc.cluster.local/tnet/config:{1}",
conf_img_path.display(), tnet_node.name.clone().unwrap()
);
info!(
t_env.logger(),
"Uploading image {} to {}",
conf_img_path.clone().display().to_string(),
url.clone()
);
block_on(upload_image(conf_img_path.as_path(), &url))
.expect("Failed to upload config image");
block_on(tnet_node.deploy_config_image(
CONF_IMG_FNAME,
"config",
DataVolumeContentType::Kubevirt,
))
.expect("deploying config image failed");
let output = Command::new("bash")
.arg("-c")
.arg(command)
.output()
.expect("Failed to execute command");
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
bail!("Error building and pushing config container config image: {}", stderr);
}
block_on(tnet_node.start()).expect("starting vm failed");
}
InfraProvider::Farm => {
Expand Down
40 changes: 4 additions & 36 deletions rs/tests/driver/src/k8s/virtualmachine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
domain:
cpu:
cores: {cpus}
model: host-passthrough
firmware:
bootloader:
efi:
Expand All @@ -47,23 +48,6 @@ spec:
- name: default
binding:
name: passt
ports:
- port: 22
- port: 8100
- port: 8101
- port: 8102
- port: 8103
- port: 8104
- port: 8105
- port: 8106
- port: 8107
- port: 8108
- port: 8109
- port: 8110
- port: 8111
- port: 8332
- port: 18444
- port: 20443
resources:
overcommitGuestOverhead: true
requests:
Expand Down Expand Up @@ -133,6 +117,7 @@ spec:
domain:
cpu:
cores: {cpus}
model: host-passthrough
firmware:
bootloader:
efi:
Expand All @@ -150,23 +135,6 @@ spec:
- name: default
binding:
name: passt
ports:
- port: 22
- port: 80
- port: 443
- port: 2497
- port: 4100
protocol: UDP
- port: 4444
- port: 7070
- port: 8080
- port: 8332
- port: 9090
- port: 9091
- port: 9100
- port: 18444
- port: 19100
- port: 19531
resources:
overcommitGuestOverhead: true
requests:
Expand All @@ -180,8 +148,8 @@ spec:
- dataVolume:
name: "{name}-guestos"
name: disk0
- dataVolume:
name: "{name}-config"
- containerDisk:
image: "harbor.ln1-idx1.dfinity.network/tnet/config:{name}"
name: disk1
"#;

Expand Down
8 changes: 7 additions & 1 deletion rs/tests/system_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ def system_test(
if uses_boundary_guestos:
icos_images["ENV_DEPS__BOUNDARY_GUESTOS_DISK_IMG_TAR_ZST_CAS_URL"] = "//ic-os/boundary-guestos/envs/dev:disk-img.tar.zst"

# set "local" tag for k8s system tests due to rootful container image builds
is_k8s = select({
"//rs/tests:k8s": True,
"//conditions:default": False,
})

run_system_test(
name = name,
src = test_driver_target,
Expand All @@ -284,7 +290,7 @@ def system_test(
env = env,
icos_images = icos_images,
env_inherit = env_inherit,
tags = tags + ["requires-network", "system_test"] +
tags = tags + ["requires-network", "system_test"] + (["local"] if is_k8s else []) +
(["manual"] if "experimental_system_test_colocation" in tags else []),
target_compatible_with = ["@platforms//os:linux"],
timeout = test_timeout,
Expand Down
Loading