Compare commits

..

9 Commits

Author SHA1 Message Date
Peng Tao
e2a8815ba4 Merge pull request #5379 from bergwolf/3.0.0-branch-bump
# Kata Containers 3.0.0
2022-10-09 16:59:20 +08:00
Peng Tao
63495cf43a release: Kata Containers 3.0.0
- stable-3.0: backport agent fixes
- backport fix for 3.0.0 release

fb4430549 release: Adapt kata-deploy for 3.0.0
20c02528e agent: reduce reference count for failed mount
3eb6f5858 agent: don't exit early if signal fails due to ESRCH
8dc8565ed versions: Update gperf url to avoid libseccomp random failures
740e7e2f7 kata-sys-util: fix typo `unknow`

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2022-10-08 12:42:06 +00:00
Peng Tao
fb44305497 release: Adapt kata-deploy for 3.0.0
kata-deploy files must be adapted to a new release.  The cases where it
happens are when the release goes from -> to:
* main -> stable:
  * kata-deploy-stable / kata-cleanup-stable: are removed

* stable -> stable:
  * kata-deploy / kata-cleanup: bump the release to the new one.

There are no changes when doing an alpha release, as the files on the
"main" branch always point to the "latest" and "stable" tags.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2022-10-08 12:42:06 +00:00
Fabiano Fidêncio
cea5c29e70 Merge pull request #5377 from bergwolf/github/backport-3.0
stable-3.0: backport agent fixes
2022-10-08 11:55:19 +02:00
Feng Wang
20c02528e5 agent: reduce reference count for failed mount
The kata agent adds a reference for each storage object before mount
and skip mount again if the storage object is known. We need to
remove the object reference if mount fails.

Fixes: #5364

Signed-off-by: Feng Wang <feng.wang@databricks.com>
2022-10-08 15:13:39 +08:00
Feng Wang
3eb6f5858a agent: don't exit early if signal fails due to ESRCH
ESRCH usually means the process has exited. In this case,
the execution should continue to kill remaining container processes.

Fixes: #5366

Signed-off-by: Feng Wang <feng.wang@databricks.com>
[Fix up cargo updates]
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2022-10-08 15:13:30 +08:00
Peng Tao
8b0231bec8 Merge pull request #5372 from bergwolf/github/backport-3.0
backport fix for 3.0.0 release
2022-10-08 10:33:21 +08:00
Gabriela Cervantes
8dc8565ed5 versions: Update gperf url to avoid libseccomp random failures
This PR updates the gperf url to avoid random failures when installing
libseccomp as it seems that the mirrror url produces network random
failures in multiple CIs.

Fixes #5294

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-10-07 20:56:43 +08:00
Bin Liu
740e7e2f77 kata-sys-util: fix typo unknow
Change `unknow` to `unknown`.

Fixes: #5296

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-10-07 19:58:46 +08:00
10 changed files with 45 additions and 29 deletions

View File

@@ -1 +1 @@
3.0.0-rc1
3.0.0

2
src/agent/Cargo.lock generated
View File

@@ -1507,7 +1507,7 @@ dependencies = [
"lazy_static",
"libc",
"libseccomp",
"nix 0.23.1",
"nix 0.24.2",
"oci",
"path-absolutize",
"protobuf",

View File

@@ -12,7 +12,7 @@ serde_derive = "1.0.91"
oci = { path = "../../libs/oci" }
protocols = { path ="../../libs/protocols" }
caps = "0.5.0"
nix = "0.23.0"
nix = "0.24.2"
scopeguard = "1.0.0"
capctl = "0.2.0"
lazy_static = "1.3.0"

View File

@@ -6,8 +6,9 @@
use anyhow::{anyhow, Result};
use nix::errno::Errno;
use nix::pty;
use nix::sys::{socket, uio};
use nix::sys::socket;
use nix::unistd::{self, dup2};
use std::io::IoSlice;
use std::os::unix::io::{AsRawFd, RawFd};
use std::path::Path;
@@ -23,10 +24,7 @@ pub fn setup_console_socket(csocket_path: &str) -> Result<Option<RawFd>> {
None,
)?;
match socket::connect(
socket_fd,
&socket::SockAddr::Unix(socket::UnixAddr::new(Path::new(csocket_path))?),
) {
match socket::connect(socket_fd, &socket::UnixAddr::new(Path::new(csocket_path))?) {
Ok(()) => Ok(Some(socket_fd)),
Err(errno) => Err(anyhow!("failed to open console fd: {}", errno)),
}
@@ -36,11 +34,11 @@ pub fn setup_master_console(socket_fd: RawFd) -> Result<()> {
let pseudo = pty::openpty(None, None)?;
let pty_name: &[u8] = b"/dev/ptmx";
let iov = [uio::IoVec::from_slice(pty_name)];
let iov = [IoSlice::new(pty_name)];
let fds = [pseudo.master];
let cmsg = socket::ControlMessage::ScmRights(&fds);
socket::sendmsg(socket_fd, &iov, &[cmsg], socket::MsgFlags::empty(), None)?;
socket::sendmsg::<()>(socket_fd, &iov, &[cmsg], socket::MsgFlags::empty(), None)?;
unistd::setsid()?;
let ret = unsafe { libc::ioctl(pseudo.slave, libc::TIOCSCTTY) };

View File

@@ -779,16 +779,20 @@ pub async fn add_storages(
}
};
// Todo need to rollback the mounted storage if err met.
if res.is_err() {
error!(
logger,
"add_storages failed, storage: {:?}, error: {:?} ", storage, res
);
}
let mount_point = res?;
let mount_point = match res {
Err(e) => {
error!(
logger,
"add_storages failed, storage: {:?}, error: {:?} ", storage, e
);
let mut sb = sandbox.lock().await;
sb.unset_sandbox_storage(&storage.mount_point)
.map_err(|e| warn!(logger, "fail to unset sandbox storage {:?}", e))
.ok();
return Err(e);
}
Ok(m) => m,
};
if !mount_point.is_empty() {
mount_list.push(mount_point);

View File

@@ -390,8 +390,22 @@ impl AgentService {
if p.init && sig == libc::SIGTERM && !is_signal_handled(&proc_status_file, sig as u32) {
sig = libc::SIGKILL;
}
p.signal(sig)?;
}
match p.signal(sig) {
Err(Errno::ESRCH) => {
info!(
sl!(),
"signal encounter ESRCH, continue";
"container-id" => cid.clone(),
"exec-id" => eid.clone(),
"pid" => p.pid,
"signal" => sig,
);
}
Err(err) => return Err(anyhow!(err)),
Ok(()) => (),
}
};
if eid.is_empty() {
// eid is empty, signal all the remaining processes in the container cgroup

View File

@@ -10,9 +10,9 @@ use kata_types::container::ContainerType;
#[derive(thiserror::Error, Debug)]
pub enum Error {
/// unknow container type
#[error("unknow container type {0}")]
UnknowContainerType(String),
/// unknown container type
#[error("unknown container type {0}")]
UnknownContainerType(String),
/// missing sandboxID
#[error("missing sandboxID")]
MissingSandboxID,
@@ -56,7 +56,7 @@ pub fn get_contaier_type(spec: &oci::Spec) -> Result<ContainerType, Error> {
"sandbox" => return Ok(ContainerType::PodSandbox),
"podsandbox" => return Ok(ContainerType::PodSandbox),
"container" => return Ok(ContainerType::PodContainer),
_ => return Err(Error::UnknowContainerType(type_value.clone())),
_ => return Err(Error::UnknownContainerType(type_value.clone())),
}
}
}

View File

@@ -18,7 +18,7 @@ spec:
katacontainers.io/kata-runtime: cleanup
containers:
- name: kube-kata-cleanup
image: quay.io/kata-containers/kata-deploy:latest
image: quay.io/kata-containers/kata-deploy:3.0.0
imagePullPolicy: Always
command: [ "bash", "-c", "/opt/kata-artifacts/scripts/kata-deploy.sh reset" ]
env:

View File

@@ -16,7 +16,7 @@ spec:
serviceAccountName: kata-label-node
containers:
- name: kube-kata
image: quay.io/kata-containers/kata-deploy:latest
image: quay.io/kata-containers/kata-deploy:3.0.0
imagePullPolicy: Always
lifecycle:
preStop:

View File

@@ -209,7 +209,7 @@ externals:
gperf:
description: "GNU gperf is a perfect hash function generator"
url: "https://ftpmirror.gnu.org/gnu/gperf"
url: "http://ftp.gnu.org/pub/gnu/gperf/"
version: "3.1"
kubernetes: