Skip to content

Commit

Permalink
libs/types: add kata-types crate under src/libs
Browse files Browse the repository at this point in the history
Add kata-types crate to host constants and data types shared by multiple
Kata Containers components.

Fixes: kata-containers#3305

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Signed-off-by: Fupan Li <lifupan@gmail.com>
Signed-off-by: Huamin Tang <huamin.thm@alibaba-inc.com>
Signed-off-by: Lei Wang <wllenyj@linux.alibaba.com>
Signed-off-by: yanlei <yl.on.the.way@gmail.com>
  • Loading branch information
jiangliu committed Jan 22, 2022
1 parent bc1fb90 commit 38a85f9
Show file tree
Hide file tree
Showing 13 changed files with 595 additions and 2 deletions.
88 changes: 88 additions & 0 deletions src/libs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/libs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"logging",
"kata-types",
]
resolver = "2"
5 changes: 3 additions & 2 deletions src/libs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ or published to [`crates.io`](https://crates.io/index.html).
Currently it provides following library crates:

| Library | Description |
|-|-|-|
| [logging](logging/) | Facilities to setup logging subsystem based slog. |
|-|-|
| [logging](logging/) | Facilities to setup logging subsystem based on slog. |
| [types](kata-types/) | Collection of constants and data types shared by multiple Kata Containers components. |
19 changes: 19 additions & 0 deletions src/libs/kata-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "kata-types"
version = "0.1.0"
description = "Constants and data types shared by Kata Containers components"
keywords = ["kata", "container", "runtime"]
authors = ["The Kata Containers community <kata-dev@lists.katacontainers.io>"]
repository = "https://github.com/kata-containers/kata-containers.git"
homepage = "https://katacontainers.io/"
readme = "README.md"
license = "Apache-2.0"
edition = "2018"

[dependencies]
serde = { version = "1.0.100", features = ["derive"] }
thiserror = "1.0"

oci = { path = "../../agent/oci" }

[dev-dependencies]
18 changes: 18 additions & 0 deletions src/libs/kata-types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# kata-types

This crate is a collection of constants and data types shared by multiple
[Kata Containers](https://github.com/kata-containers/kata-containers/) components.

It defines constants and data types used by multiple Kata Containers components. Those constants
and data types may be defined by Kata Containers or by other projects/specifications, such as:
- [Containerd](https://github.com/containerd/containerd)
- [Kubelet](https://github.com/kubernetes/kubelet)

## Support

**Operating Systems**:
- Linux

## License

This code is licensed under [Apache-2.0](../../../LICENSE).
13 changes: 13 additions & 0 deletions src/libs/kata-types/src/annotations/cri_containerd.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) 2019 Alibaba Cloud
// Copyright (c) 2019 Ant Group
//
// SPDX-License-Identifier: Apache-2.0
//

#![allow(missing_docs)]

pub const CONTAINER_TYPE_LABEL_KEY: &str = "io.kubernetes.cri.container-type";
pub const SANDBOX: &str = "sandbox";
pub const CONTAINER: &str = "container";

pub const SANDBOX_ID_LABEL_KEY: &str = "io.kubernetes.cri.sandbox-id";
13 changes: 13 additions & 0 deletions src/libs/kata-types/src/annotations/crio.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) 2019 Alibaba Cloud
// Copyright (c) 2019 Ant Group
//
// SPDX-License-Identifier: Apache-2.0
//

#![allow(missing_docs)]

pub const CONTAINER_TYPE_LABEL_KEY: &str = "io.kubernetes.cri.container-type";
pub const SANDBOX: &str = "sandbox";
pub const CONTAINER: &str = "container";

pub const SANDBOX_ID_LABEL_KEY: &str = "io.kubernetes.cri-o.SandboxID";
13 changes: 13 additions & 0 deletions src/libs/kata-types/src/annotations/dockershim.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) 2019 Alibaba Cloud
// Copyright (c) 2019 Ant Group
//
// SPDX-License-Identifier: Apache-2.0
//

#![allow(missing_docs)]

pub const CONTAINER_TYPE_LABEL_KEY: &str = "io.kubernetes.docker.type";
pub const SANDBOX: &str = "podsandbox";
pub const CONTAINER: &str = "container";

pub const SANDBOX_ID_LABEL_KEY: &str = "io.kubernetes.sandbox.id";
14 changes: 14 additions & 0 deletions src/libs/kata-types/src/annotations/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2019 Alibaba Cloud
// Copyright (c) 2019 Ant Group
//
// SPDX-License-Identifier: Apache-2.0
//

/// CRI-containerd specific annotations.
pub mod cri_containerd;

/// CRI-O specific annotations.
pub mod crio;

/// Dockershim specific annotations.
pub mod dockershim;

0 comments on commit 38a85f9

Please sign in to comment.