author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
350,430
25.05.2021 09:17:08
21,600
cf4b637f1281fe6a02ce8c5106c3cb5262e779e5
Add more documentation on the return values of pull_manifest and pull_manifest_and_config
[ { "change_type": "MODIFY", "old_path": "crates/oci-distribution/src/client.rs", "new_path": "crates/oci-distribution/src/client.rs", "diff": "@@ -406,6 +406,9 @@ impl Client {\n///\n/// The client will check if it's already been authenticated and if\n/// not will attempt to do.\n+ ///\n+ /// A Tuple is returned containing the [OciManifest](crate::manifest::OciManifest)\n+ /// and the manifest content digest hash.\npub async fn pull_manifest(\n&mut self,\nimage: &Reference,\n@@ -487,6 +490,10 @@ impl Client {\n///\n/// The client will check if it's already been authenticated and if\n/// not will attempt to do.\n+ ///\n+ /// A Tuple is returned containing the [OciManifest](crate::manifest::OciManifest),\n+ /// the manifest content digest hash and the contents of the manifests config layer\n+ /// as a String.\npub async fn pull_manifest_and_config(\n&mut self,\nimage: &Reference,\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Add more documentation on the return values of pull_manifest and pull_manifest_and_config
350,417
27.05.2021 11:15:36
21,600
0e0b1df1489cd16b9cb7784ab4b8b7cc46c45c8e
fix(#463): read-only configmap/secret mount directory
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/volume/configmap.rs", "new_path": "crates/kubelet/src/volume/configmap.rs", "diff": "@@ -75,6 +75,11 @@ impl ConfigMapVolume {\n.chain(data)\n.collect::<tokio::io::Result<_>>()?;\n+ // Set configmap directory to read-only.\n+ let mut perms = tokio::fs::metadata(&path).await?.permissions();\n+ perms.set_readonly(true);\n+ tokio::fs::set_permissions(&path, perms).await?;\n+\n// Update the mounted directory\nself.mounted_path = Some(path);\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/volume/secret.rs", "new_path": "crates/kubelet/src/volume/secret.rs", "diff": "@@ -62,6 +62,10 @@ impl SecretVolume {\n.await\n.into_iter()\n.collect::<tokio::io::Result<_>>()?;\n+ // Set secret directory to read-only.\n+ let mut perms = tokio::fs::metadata(&path).await?.permissions();\n+ perms.set_readonly(true);\n+ tokio::fs::set_permissions(&path, perms).await?;\nself.mounted_path = Some(path);\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
fix(#463): read-only configmap/secret mount directory
350,410
18.05.2021 14:29:43
-7,200
e57d51cf3faaafaefd95c1b126c496457c32ce70
oci-distribution: use DockerHub actual registry While using the 'docker.io' namespace, DockerHub is actually using registry-1.docker.io as registry. Docker manually overrides it when accessing the registry so do it here as well. Fix
[ { "change_type": "MODIFY", "old_path": "crates/oci-distribution/src/client.rs", "new_path": "crates/oci-distribution/src/client.rs", "diff": "@@ -180,7 +180,7 @@ impl Client {\n) -> anyhow::Result<ImageData> {\ndebug!(\"Pulling image: {:?}\", image);\n- if !self.tokens.contains_key(image.registry()) {\n+ if !self.tokens.contains_key(&self.get_registry(image)) {\nself.auth(image, auth, &RegistryOperation::Pull).await?;\n}\n@@ -230,7 +230,7 @@ impl Client {\n) -> anyhow::Result<String> {\ndebug!(\"Pushing image: {:?}\", image_ref);\n- if !self.tokens.contains_key(image_ref.registry()) {\n+ if !self.tokens.contains_key(&self.get_registry(&image_ref)) {\nself.auth(image_ref, auth, &RegistryOperation::Push).await?;\n}\n@@ -279,8 +279,8 @@ impl Client {\n// The version request will tell us where to go.\nlet url = format!(\n\"{}://{}/v2/\",\n- self.config.protocol.scheme_for(image.registry()),\n- image.registry()\n+ self.config.protocol.scheme_for(&self.get_registry(image)),\n+ self.get_registry(&image)\n);\nlet res = self.client.get(&url).send().await?;\nlet dist_hdr = match res.headers().get(reqwest::header::WWW_AUTHENTICATE) {\n@@ -331,7 +331,7 @@ impl Client {\nlet token: RegistryToken = serde_json::from_str(&text)\n.context(\"Failed to decode registry token from auth request\")?;\ndebug!(\"Succesfully authorized for image '{:?}'\", image);\n- self.tokens.insert(image.registry().to_owned(), token);\n+ self.tokens.insert(self.get_registry(image), token);\nOk(())\n}\n_ => {\n@@ -351,7 +351,7 @@ impl Client {\nimage: &Reference,\nauth: &RegistryAuth,\n) -> anyhow::Result<String> {\n- if !self.tokens.contains_key(image.registry()) {\n+ if !self.tokens.contains_key(&self.get_registry(image)) {\nself.auth(image, auth, &RegistryOperation::Pull).await?;\n}\n@@ -533,7 +533,7 @@ impl Client {\ndigest: &str,\nmut out: T,\n) -> anyhow::Result<()> {\n- let url = self.to_v2_blob_url(image.registry(), image.repository(), digest);\n+ let url = self.to_v2_blob_url(&self.get_registry(image), image.repository(), digest);\nlet mut stream = self\n.client\n.get(&url)\n@@ -704,8 +704,8 @@ impl Client {\nif lh.starts_with(\"/v2/\") {\nOk(format!(\n\"{}://{}{}\",\n- self.config.protocol.scheme_for(image.registry()),\n- image.registry(),\n+ self.config.protocol.scheme_for(&self.get_registry(image)),\n+ self.get_registry(image),\nlh\n))\n} else {\n@@ -754,16 +754,20 @@ impl Client {\nif let Some(digest) = reference.digest() {\nformat!(\n\"{}://{}/v2/{}/manifests/{}\",\n- self.config.protocol.scheme_for(reference.registry()),\n- reference.registry(),\n+ self.config\n+ .protocol\n+ .scheme_for(&self.get_registry(reference)),\n+ self.get_registry(reference),\nreference.repository(),\ndigest,\n)\n} else {\nformat!(\n\"{}://{}/v2/{}/manifests/{}\",\n- self.config.protocol.scheme_for(reference.registry()),\n- reference.registry(),\n+ self.config\n+ .protocol\n+ .scheme_for(&self.get_registry(reference)),\n+ self.get_registry(reference),\nreference.repository(),\nreference.tag().unwrap_or(\"latest\")\n)\n@@ -783,7 +787,11 @@ impl Client {\n/// Convert a Reference to a v2 blob upload URL.\nfn to_v2_blob_upload_url(&self, reference: &Reference) -> String {\n- self.to_v2_blob_url(&reference.registry(), &reference.repository(), \"uploads/\")\n+ self.to_v2_blob_url(\n+ &self.get_registry(reference),\n+ &reference.repository(),\n+ \"uploads/\",\n+ )\n}\n/// Generate the headers necessary for authentication.\n@@ -795,11 +803,23 @@ impl Client {\nlet mut headers = HeaderMap::new();\nheaders.insert(\"Accept\", \"application/vnd.docker.distribution.manifest.v2+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.oci.image.manifest.v1+json\".parse().unwrap());\n- if let Some(token) = self.tokens.get(image.registry()) {\n+ if let Some(token) = self.tokens.get(&self.get_registry(&image)) {\nheaders.insert(\"Authorization\", token.bearer_token().parse().unwrap());\n}\nheaders\n}\n+\n+ /// Get the registry address of a given `Reference`.\n+ ///\n+ /// Some registries, such as docker.io, uses a different address for the actual\n+ /// registry. This function implements such redirection.\n+ fn get_registry(&self, image: &Reference) -> String {\n+ let registry = image.registry();\n+ match registry {\n+ \"docker.io\" => \"registry-1.docker.io\".into(),\n+ _ => registry.into(),\n+ }\n+ }\n}\n/// The encoding of the certificate\n@@ -967,6 +987,7 @@ mod test {\nHELLO_IMAGE_DIGEST,\nHELLO_IMAGE_TAG_AND_DIGEST,\n];\n+ const DOCKER_IO_IMAGE: &str = \"docker.io/library/hello-world:latest\";\n#[test]\nfn test_to_v2_blob_url() {\n@@ -1639,4 +1660,19 @@ mod test {\nassert_eq!(manifest.schema_version, pulled_manifest.schema_version);\nassert_eq!(manifest.config.digest, pulled_manifest.config.digest);\n}\n+\n+ #[tokio::test]\n+ async fn test_pull_docker_io() {\n+ let reference = Reference::try_from(DOCKER_IO_IMAGE).expect(\"failed to parse reference\");\n+ let mut c = Client::default();\n+ let err = c\n+ .pull_manifest(&reference, &RegistryAuth::Anonymous)\n+ .await\n+ .unwrap_err();\n+ // we don't support manifest list so pulling failed but this error means it did downloaded it\n+ assert_eq!(\n+ format!(\"{}\", err),\n+ \"unsupported media type: application/vnd.docker.distribution.manifest.list.v2+json\"\n+ );\n+ }\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
oci-distribution: use DockerHub actual registry While using the 'docker.io' namespace, DockerHub is actually using registry-1.docker.io as registry. Docker manually overrides it when accessing the registry so do it here as well. Fix #596
350,439
11.05.2021 15:12:38
0
773b5776915ce0bfabf840b7ce41f7839ff44118
add device plugin proto file and generate code with tonic build
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/build.rs", "new_path": "crates/kubelet/build.rs", "diff": "fn main() -> Result<(), Box<dyn std::error::Error>> {\nprintln!(\"cargo:rerun-if-changed=proto/pluginregistration/v1/pluginregistration.proto\");\n+ println!(\"cargo:rerun-if-changed=proto/deviceplugin/v1beta1/deviceplugin.proto\");\nlet builder = tonic_build::configure()\n.format(true)\n@@ -11,9 +12,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {\n// #[cfg(not(test))]\n// let builder = builder.build_server(false);\n+ // Generate CSI plugin and Device Plugin code\nbuilder.compile(\n- &[\"proto/pluginregistration/v1/pluginregistration.proto\"],\n- &[\"proto/pluginregistration/v1\"],\n+ &[\"proto/pluginregistration/v1/pluginregistration.proto\", \"proto/deviceplugin/v1beta1/deviceplugin.proto\"],\n+ &[\"proto/pluginregistration/v1\", \"proto/deviceplugin/v1beta1\"],\n)?;\n+\nOk(())\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto", "diff": "+// From https://github.com/kubernetes/kubelet/blob/v0.21.0/pkg/apis/deviceplugin/v1beta1/api.proto\n+syntax = \"proto3\";\n+\n+package v1beta1;\n+\n+// Registration is the service advertised by the Kubelet\n+// Only when Kubelet answers with a success code to a Register Request\n+// may Device Plugins start their service\n+// Registration may fail when device plugin version is not supported by\n+// Kubelet or the registered resourceName is already taken by another\n+// active device plugin. Device plugin is expected to terminate upon registration failure\n+service Registration {\n+ rpc Register(RegisterRequest) returns (Empty) {}\n+}\n+\n+message DevicePluginOptions {\n+ // Indicates if PreStartContainer call is required before each container start\n+ bool pre_start_required = 1;\n+ // Indicates if GetPreferredAllocation is implemented and available for calling\n+ bool get_preferred_allocation_available = 2;\n+}\n+\n+message RegisterRequest {\n+ // Version of the API the Device Plugin was built against\n+ string version = 1;\n+ // Name of the unix socket the device plugin is listening on\n+ // PATH = path.Join(DevicePluginPath, endpoint)\n+ string endpoint = 2;\n+ // Schedulable resource name. As of now it's expected to be a DNS Label\n+ string resource_name = 3;\n+ // Options to be communicated with Device Manager\n+ DevicePluginOptions options = 4;\n+}\n+\n+message Empty {\n+}\n+\n+// DevicePlugin is the service advertised by Device Plugins\n+service DevicePlugin {\n+ // GetDevicePluginOptions returns options to be communicated with Device\n+ // Manager\n+ rpc GetDevicePluginOptions(Empty) returns (DevicePluginOptions) {}\n+\n+ // ListAndWatch returns a stream of List of Devices\n+ // Whenever a Device state change or a Device disappears, ListAndWatch\n+ // returns the new list\n+ rpc ListAndWatch(Empty) returns (stream ListAndWatchResponse) {}\n+\n+ // GetPreferredAllocation returns a preferred set of devices to allocate\n+ // from a list of available ones. The resulting preferred allocation is not\n+ // guaranteed to be the allocation ultimately performed by the\n+ // devicemanager. It is only designed to help the devicemanager make a more\n+ // informed allocation decision when possible.\n+ rpc GetPreferredAllocation(PreferredAllocationRequest) returns (PreferredAllocationResponse) {}\n+\n+ // Allocate is called during container creation so that the Device\n+ // Plugin can run device specific operations and instruct Kubelet\n+ // of the steps to make the Device available in the container\n+ rpc Allocate(AllocateRequest) returns (AllocateResponse) {}\n+\n+ // PreStartContainer is called, if indicated by Device Plugin during registeration phase,\n+ // before each container start. Device plugin can run device specific operations\n+ // such as resetting the device before making devices available to the container\n+ rpc PreStartContainer(PreStartContainerRequest) returns (PreStartContainerResponse) {}\n+}\n+\n+// ListAndWatch returns a stream of List of Devices\n+// Whenever a Device state change or a Device disappears, ListAndWatch\n+// returns the new list\n+message ListAndWatchResponse {\n+ repeated Device devices = 1;\n+}\n+\n+message TopologyInfo {\n+ repeated NUMANode nodes = 1;\n+}\n+\n+message NUMANode {\n+ int64 ID = 1;\n+}\n+\n+/* E.g:\n+* struct Device {\n+* ID: \"GPU-fef8089b-4820-abfc-e83e-94318197576e\",\n+* Health: \"Healthy\",\n+* Topology:\n+* Node:\n+* ID: 1\n+*} */\n+message Device {\n+ // A unique ID assigned by the device plugin used\n+ // to identify devices during the communication\n+ // Max length of this field is 63 characters\n+ string ID = 1;\n+ // Health of the device, can be healthy or unhealthy, see constants.go\n+ string health = 2;\n+ // Topology for device\n+ TopologyInfo topology = 3;\n+}\n+\n+// - PreStartContainer is expected to be called before each container start if indicated by plugin during registration phase.\n+// - PreStartContainer allows kubelet to pass reinitialized devices to containers.\n+// - PreStartContainer allows Device Plugin to run device specific operations on\n+// the Devices requested\n+message PreStartContainerRequest {\n+ repeated string devicesIDs = 1;\n+}\n+\n+// PreStartContainerResponse will be send by plugin in response to PreStartContainerRequest\n+message PreStartContainerResponse {\n+}\n+\n+// PreferredAllocationRequest is passed via a call to GetPreferredAllocation()\n+// at pod admission time. The device plugin should take the list of\n+// `available_deviceIDs` and calculate a preferred allocation of size\n+// 'allocation_size' from them, making sure to include the set of devices\n+// listed in 'must_include_deviceIDs'.\n+message PreferredAllocationRequest {\n+ repeated ContainerPreferredAllocationRequest container_requests = 1;\n+}\n+\n+message ContainerPreferredAllocationRequest {\n+ // List of available deviceIDs from which to choose a preferred allocation\n+ repeated string available_deviceIDs = 1;\n+ // List of deviceIDs that must be included in the preferred allocation\n+ repeated string must_include_deviceIDs = 2;\n+ // Number of devices to include in the preferred allocation\n+ int32 allocation_size = 3;\n+}\n+\n+// PreferredAllocationResponse returns a preferred allocation,\n+// resulting from a PreferredAllocationRequest.\n+message PreferredAllocationResponse {\n+ repeated ContainerPreferredAllocationResponse container_responses = 1;\n+}\n+\n+message ContainerPreferredAllocationResponse {\n+ repeated string deviceIDs = 1;\n+}\n+\n+// - Allocate is expected to be called during pod creation since allocation\n+// failures for any container would result in pod startup failure.\n+// - Allocate allows kubelet to exposes additional artifacts in a pod's\n+// environment as directed by the plugin.\n+// - Allocate allows Device Plugin to run device specific operations on\n+// the Devices requested\n+message AllocateRequest {\n+ repeated ContainerAllocateRequest container_requests = 1;\n+}\n+\n+message ContainerAllocateRequest {\n+ repeated string devicesIDs = 1;\n+}\n+\n+// AllocateResponse includes the artifacts that needs to be injected into\n+// a container for accessing 'deviceIDs' that were mentioned as part of\n+// 'AllocateRequest'.\n+// Failure Handling:\n+// if Kubelet sends an allocation request for dev1 and dev2.\n+// Allocation on dev1 succeeds but allocation on dev2 fails.\n+// The Device plugin should send a ListAndWatch update and fail the\n+// Allocation request\n+message AllocateResponse {\n+ repeated ContainerAllocateResponse container_responses = 1;\n+}\n+\n+message ContainerAllocateResponse {\n+ // List of environment variable to be set in the container to access one of more devices.\n+ map<string, string> envs = 1;\n+ // Mounts for the container.\n+ repeated Mount mounts = 2;\n+ // Devices for the container.\n+ repeated DeviceSpec devices = 3;\n+ // Container annotations to pass to the container runtime\n+ map<string, string> annotations = 4;\n+}\n+\n+// Mount specifies a host volume to mount into a container.\n+// where device library or tools are installed on host and container\n+message Mount {\n+ // Path of the mount within the container.\n+ string container_path = 1;\n+ // Path of the mount on the host.\n+ string host_path = 2;\n+ // If set, the mount is read-only.\n+ bool read_only = 3;\n+}\n+\n+// DeviceSpec specifies a host device to mount into a container.\n+message DeviceSpec {\n+ // Path of the device within the container.\n+ string container_path = 1;\n+ // Path of the device on the host.\n+ string host_path = 2;\n+ // Cgroups permissions of the device, candidates are one or more of\n+ // * r - allows container to read from the specified device.\n+ // * w - allows container to write to the specified device.\n+ // * m - allows container to create device files that do not yet exist.\n+ string permissions = 3;\n+}\n\\ No newline at end of file\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add device plugin proto file and generate code with tonic build
350,439
25.05.2021 13:58:02
25,200
0ce5c868fdac29e9559f5132ffdb054472e5c5b1
make NodePatcher a struct instead of trait
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/Cargo.toml", "new_path": "crates/kubelet/Cargo.toml", "diff": "@@ -93,7 +93,6 @@ slab = \"0.4\"\nversion-sync = \"0.5\"\n[dev-dependencies]\n-mockall = \"0.9.0\"\nreqwest = { version = \"0.11\", default-features = false }\ntempfile = \"3.1\"\ntower-test = \"0.4\"\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -7,7 +7,7 @@ use crate::device_plugin_api::v1beta1::{\n};\nuse crate::grpc_sock;\nuse super::{DeviceIdMap, DeviceMap, HEALTHY, UNHEALTHY};\n-use super::node_patcher::{listen_and_patch, NodeStatusPatcher, NodeStatusPatcherImpl};\n+use super::node_patcher::{listen_and_patch, NodeStatusPatcher};\nuse std::collections::HashMap;\nuse std::path::{Path, PathBuf};\nuse std::sync::{Arc, Mutex};\n@@ -278,13 +278,8 @@ impl Registration for DeviceManager {\n}\npub async fn serve_device_manager(device_manager: DeviceManager, update_node_status_receiver: mpsc::Receiver<()>, client: &kube::Client, node_name: &str) -> anyhow::Result<()> {\n- let node_patcher = NodeStatusPatcherImpl{ devices: device_manager.devices.clone()};\n- internal_serve_device_manager(device_manager, node_patcher, update_node_status_receiver, client, node_name).await\n-}\n-\n-/// TODO\n-pub async fn internal_serve_device_manager(device_manager: DeviceManager, node_patcher: impl NodeStatusPatcher, update_node_status_receiver: mpsc::Receiver<()>, client: &kube::Client, node_name: &str) -> anyhow::Result<()> {\n- // TODO determin if need to create socket (and delete any previous ones)\n+ let node_patcher = NodeStatusPatcher{ devices: device_manager.devices.clone()};\n+ // TODO determine if need to create socket (and delete any previous ones)\nlet manager_socket = device_manager.plugin_dir.join(PLUGIN_MANGER_SOCKET_NAME);\nlet socket = grpc_sock::server::Socket::new(&manager_socket).expect(\"couldn't make manager socket\");\n@@ -307,25 +302,22 @@ pub async fn internal_serve_device_manager(device_manager: DeviceManager, node_p\nOk(())\n}\n-\n#[cfg(test)]\n-mod manager_tests {\n- use super::super::node_patcher::MockNodeStatusPatcher;\n+pub mod manager_tests {\nuse super::*;\nuse crate::device_plugin_api::v1beta1::{\ndevice_plugin_server::{DevicePlugin, DevicePluginServer}, AllocateRequest, AllocateResponse, DevicePluginOptions,\n- DeviceSpec, Empty, ListAndWatchResponse, Mount, PreStartContainerRequest, PreferredAllocationRequest, PreferredAllocationResponse,\n+ Empty, ListAndWatchResponse, PreStartContainerRequest, PreferredAllocationRequest, PreferredAllocationResponse,\nPreStartContainerResponse, registration_client,\n};\n- use futures::{pin_mut, Stream, StreamExt};\n+ use futures::{pin_mut, Stream};\nuse http::{Request as HttpRequest, Response as HttpResponse};\nuse hyper::Body;\nuse kube::{Client, Service};\nuse std::pin::Pin;\nuse tokio::sync::watch;\n- use tempfile::Builder;\n- use tonic::{Code, Request, Response, Status};\n- use tower_test::{mock, mock::Handle};\n+ use tonic::{Request, Response, Status};\n+ use tower_test::mock;\n/// Mock Device Plugin for testing the DeviceManager\n/// Sends a new list of devices to the DeviceManager whenever it's `devices_receiver`\n@@ -426,7 +418,7 @@ mod manager_tests {\n/// It verifies the request and always returns a fake Node.\n/// Returns a client that will reference this mock service and the task the service is running on.\n/// TODO: Decide whether to test node status\n- async fn create_mock_kube_service(node_name: &str) -> (Client, tokio::task::JoinHandle<()>) {\n+ pub async fn create_mock_kube_service(node_name: &str) -> (Client, tokio::task::JoinHandle<()>) {\n// Mock client as inspired by this thread on kube-rs crate: https://github.com/clux/kube-rs/issues/429\nlet (mock_service, handle) = mock::pair::<HttpRequest<Body>, HttpResponse<Body>>();\nlet service = Service::new(mock_service);\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "diff": "@@ -3,39 +3,20 @@ use super::{DeviceMap, HEALTHY, UNHEALTHY};\nuse kube::api::{Api, PatchParams};\nuse k8s_openapi::api::core::v1::{Node, NodeStatus};\nuse k8s_openapi::apimachinery::pkg::api::resource::Quantity;\n-#[cfg(test)]\n-use mockall::{automock, predicate::*};\nuse std::collections::BTreeMap;\nuse std::sync::{Arc, Mutex};\nuse tokio::sync::mpsc;\nuse tracing::{error, info, warn};\n-#[cfg_attr(test, automock)]\n-#[async_trait::async_trait]\n-pub trait NodeStatusPatcher: Send + Sync + 'static {\n- async fn get_node_status_patch(\n- &self,\n- ) -> NodeStatus;\n-\n- async fn do_node_status_patch(\n- &self,\n- status: NodeStatus,\n- node_name: &str,\n- client: &kube::Client,\n- ) -> anyhow::Result<()>;\n-}\n-\n/// NodePatcher updates the Node status with the latest device information.\n#[derive(Clone)]\n-pub struct NodeStatusPatcherImpl {\n+pub struct NodeStatusPatcher {\npub devices: Arc<Mutex<DeviceMap>>,\n}\n-#[async_trait::async_trait]\n-impl NodeStatusPatcher for NodeStatusPatcherImpl {\n+impl NodeStatusPatcher {\nasync fn get_node_status_patch(\n&self,\n- // devices: Arc<Mutex<DeviceMap>>,\n) -> NodeStatus {\nlet devices = self.devices.lock().unwrap();\nlet capacity: BTreeMap<String, Quantity> = devices.iter().map(|(resource_name, resource_devices)| (resource_name.clone(), Quantity(resource_devices.len().to_string()))).collect();\n@@ -43,8 +24,6 @@ impl NodeStatusPatcher for NodeStatusPatcherImpl {\nlet healthy_count: usize = resource_devices.iter().filter(|(_, dev)| dev.health == HEALTHY).map(|(_, _)| 1).sum();\n(resource_name.clone(), Quantity(healthy_count.to_string()))\n}).collect();\n- // let allocated: BTreeMap<String, Quantity> = self.allocated_device_ids.lock().unwrap().iter().map(|(resource_name, ids)| (resource_name.clone(), Quantity(ids.len().to_string()))).collect();\n- // Update Node status\nNodeStatus {\ncapacity: Some(capacity),\nallocatable: Some(allocatable),\n@@ -75,7 +54,7 @@ pub async fn listen_and_patch(\nupdate_node_status_receiver: mpsc::Receiver<()>,\nnode_name: String,\nclient: kube::Client,\n- node_status_patcher: impl NodeStatusPatcher,\n+ node_status_patcher: NodeStatusPatcher,\n) -> anyhow::Result<()> {\nlet mut receiver = update_node_status_receiver;\nprintln!(\"entered listen_and_patch\");\n@@ -104,38 +83,11 @@ pub async fn listen_and_patch(\n#[cfg(test)]\nmod node_patcher_tests {\nuse super::super::{EndpointDevicesMap, UNHEALTHY};\n+ use super::super::manager::manager_tests::create_mock_kube_service;\nuse super::*;\nuse crate::device_plugin_api::v1beta1::Device;\n- // #[tokio::test]\n- // async fn test_listen_and_patch() {\n- // println!(\"running test_get_node_status_patch\");\n- // let r1d1 = Device{id: \"r1-id1\".to_string(), health: HEALTHY.to_string(), topology: None};\n- // let r1d2 = Device{id: \"r1-id2\".to_string(), health: HEALTHY.to_string(), topology: None};\n- // let r1_devices: EndpointDevicesMap = [\n- // (\"r1-id1\".to_string(), Device{id: \"r1-id1\".to_string(), health: HEALTHY.to_string(), topology: None}),\n- // (\"r1-id2\".to_string(), Device{id: \"r1-id2\".to_string(), health: HEALTHY.to_string(), topology: None}),\n- // (\"r1-id3\".to_string(), Device{id: \"r1-id3\".to_string(), health: UNHEALTHY.to_string(), topology: None})\n- // ].iter().map(|(k, v)| (k.clone(), v.clone())).collect();\n- // let r2_devices: EndpointDevicesMap = [\n- // (\"r2-id1\".to_string(), Device{id: \"r2-id1\".to_string(), health: HEALTHY.to_string(), topology: None}),\n- // (\"r2-id2\".to_string(), Device{id: \"r2-id2\".to_string(), health: HEALTHY.to_string(), topology: None})\n- // ].iter().map(|(k, v)| (k.clone(), v.clone())).collect();\n- // let r1_name = \"r1\".to_string();\n- // let r2_name = \"r2\".to_string();\n- // let device_map: DeviceMap = [(r1_name.clone(), r1_devices), (r2_name.clone(), r2_devices)].iter().map(|(k, v)| (k.clone(), v.clone())).collect();\n- // let devices = Arc::new(Mutex::new(device_map));\n- // let (update_node_status_sender, update_node_status_receiver) = mpsc::channel(2);\n-\n- // let node_status_patcher = NodeStatusPatcher { devices, update_node_status_receiver};\n- // update_node_status_sender.send(()).await.unwrap();\n- // node_status_patcher.listen_and_patch().await.unwrap();\n- // // ...\n- // }\n-\n- #[tokio::test]\n- async fn test_get_node_status_patch() {\n- println!(\"running test_get_node_status_patch\");\n+ fn create_mock_devices(r1_name: &str, r2_name: &str) -> Arc<Mutex<DeviceMap>> {\nlet r1_devices: EndpointDevicesMap = [\n(\"r1-id1\".to_string(), Device{id: \"r1-id1\".to_string(), health: HEALTHY.to_string(), topology: None}),\n(\"r1-id2\".to_string(), Device{id: \"r1-id2\".to_string(), health: HEALTHY.to_string(), topology: None}),\n@@ -145,23 +97,42 @@ mod node_patcher_tests {\n(\"r2-id1\".to_string(), Device{id: \"r2-id1\".to_string(), health: HEALTHY.to_string(), topology: None}),\n(\"r2-id2\".to_string(), Device{id: \"r2-id2\".to_string(), health: HEALTHY.to_string(), topology: None})\n].iter().map(|(k, v)| (k.clone(), v.clone())).collect();\n- let r1_name = \"r1\".to_string();\n- let r2_name = \"r2\".to_string();\n- let device_map: DeviceMap = [(r1_name.clone(), r1_devices), (r2_name.clone(), r2_devices)].iter().map(|(k, v)| (k.clone(), v.clone())).collect();\n- let devices = Arc::new(Mutex::new(device_map));\n- let node_status_patcher = NodeStatusPatcherImpl { devices};\n+ let device_map: DeviceMap = [(r1_name.to_string(), r1_devices), (r2_name.to_string(), r2_devices)].iter().map(|(k, v)| (k.clone(), v.clone())).collect();\n+ Arc::new(Mutex::new(device_map))\n+ }\n+\n+ #[tokio::test]\n+ async fn test_do_node_status_patch() {\n+ let devices = create_mock_devices(\"r1\", \"r2\");\n+ let empty_node_status = NodeStatus {\n+ capacity: None,\n+ allocatable: None,\n+ ..Default::default()\n+ };\n+ let node_status_patcher = NodeStatusPatcher {devices};\n+ let node_name = \"test_node\";\n+ let (client, _) = create_mock_kube_service(node_name).await;\n+ node_status_patcher.do_node_status_patch(empty_node_status, node_name, &client).await.unwrap();\n+ }\n+\n+ #[tokio::test]\n+ async fn test_get_node_status_patch() {\n+ let r1_name = \"r1\";\n+ let r2_name = \"r2\";\n+ let devices = create_mock_devices(r1_name, r2_name);\n+ let node_status_patcher = NodeStatusPatcher{devices};\nlet status = node_status_patcher.get_node_status_patch().await;\n// Check that both resources listed under allocatable and only healthy devices are counted\nlet allocatable = status.allocatable.unwrap();\nassert_eq!(allocatable.len(), 2);\n- assert_eq!(allocatable.get(&r1_name).unwrap(), &Quantity(\"2\".to_string()));\n- assert_eq!(allocatable.get(&r2_name).unwrap(), &Quantity(\"2\".to_string()));\n+ assert_eq!(allocatable.get(r1_name).unwrap(), &Quantity(\"2\".to_string()));\n+ assert_eq!(allocatable.get(r2_name).unwrap(), &Quantity(\"2\".to_string()));\n// Check that both resources listed under capacity and both healthy and unhealthy devices are counted\nlet capacity = status.capacity.unwrap();\nassert_eq!(capacity.len(), 2);\n- assert_eq!(capacity.get(&r1_name).unwrap(), &Quantity(\"3\".to_string()));\n- assert_eq!(capacity.get(&r2_name).unwrap(), &Quantity(\"2\".to_string()));\n+ assert_eq!(capacity.get(r1_name).unwrap(), &Quantity(\"3\".to_string()));\n+ assert_eq!(capacity.get(r2_name).unwrap(), &Quantity(\"2\".to_string()));\n}\n}\n\\ No newline at end of file\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
make NodePatcher a struct instead of trait
350,439
25.05.2021 17:01:54
25,200
bdebf251f7f9733b2c640a2ceb465024858db264
add device manager to Provider and ProviderState interfaces
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -687,12 +687,6 @@ version = \"0.1.12\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499\"\n-[[package]]\n-name = \"difference\"\n-version = \"2.0.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198\"\n-\n[[package]]\nname = \"digest\"\nversion = \"0.8.1\"\n@@ -748,12 +742,6 @@ version = \"0.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10\"\n-[[package]]\n-name = \"downcast\"\n-version = \"0.10.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d\"\n-\n[[package]]\nname = \"dtoa\"\nversion = \"0.4.7\"\n@@ -864,15 +852,6 @@ version = \"0.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d\"\n-[[package]]\n-name = \"float-cmp\"\n-version = \"0.8.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4\"\n-dependencies = [\n- \"num-traits\",\n-]\n-\n[[package]]\nname = \"fnv\"\nversion = \"1.0.7\"\n@@ -904,12 +883,6 @@ dependencies = [\n\"percent-encoding 2.1.0\",\n]\n-[[package]]\n-name = \"fragile\"\n-version = \"1.0.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"69a039c3498dc930fe810151a34ba0c1c70b02b8625035592e74432f678591f2\"\n-\n[[package]]\nname = \"fs-set-times\"\nversion = \"0.3.1\"\n@@ -1737,7 +1710,6 @@ dependencies = [\n\"lazycell\",\n\"mio 0.6.23\",\n\"miow 0.2.2\",\n- \"mockall\",\n\"notify\",\n\"oci-distribution\",\n\"prost\",\n@@ -1978,33 +1950,6 @@ dependencies = [\n\"winapi 0.3.9\",\n]\n-[[package]]\n-name = \"mockall\"\n-version = \"0.9.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"18d614ad23f9bb59119b8b5670a85c7ba92c5e9adf4385c81ea00c51c8be33d5\"\n-dependencies = [\n- \"cfg-if 1.0.0\",\n- \"downcast\",\n- \"fragile\",\n- \"lazy_static\",\n- \"mockall_derive\",\n- \"predicates\",\n- \"predicates-tree\",\n-]\n-\n-[[package]]\n-name = \"mockall_derive\"\n-version = \"0.9.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5dd4234635bca06fc96c7368d038061e0aae1b00a764dc817e900dc974e3deea\"\n-dependencies = [\n- \"cfg-if 1.0.0\",\n- \"proc-macro2\",\n- \"quote 1.0.9\",\n- \"syn 1.0.60\",\n-]\n-\n[[package]]\nname = \"more-asserts\"\nversion = \"0.2.1\"\n@@ -2077,12 +2022,6 @@ dependencies = [\n\"version_check 0.9.2\",\n]\n-[[package]]\n-name = \"normalize-line-endings\"\n-version = \"0.3.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be\"\n-\n[[package]]\nname = \"notify\"\nversion = \"5.0.0-pre.6\"\n@@ -2419,35 +2358,6 @@ version = \"0.2.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857\"\n-[[package]]\n-name = \"predicates\"\n-version = \"1.0.8\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f49cfaf7fdaa3bfacc6fa3e7054e65148878354a5cfddcf661df4c851f8021df\"\n-dependencies = [\n- \"difference\",\n- \"float-cmp\",\n- \"normalize-line-endings\",\n- \"predicates-core\",\n- \"regex\",\n-]\n-\n-[[package]]\n-name = \"predicates-core\"\n-version = \"1.0.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"57e35a3326b75e49aa85f5dc6ec15b41108cf5aee58eabb1f274dd18b73c2451\"\n-\n-[[package]]\n-name = \"predicates-tree\"\n-version = \"1.0.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"15f553275e5721409451eb85e15fd9a860a6e5ab4496eb215987502b5f5391f2\"\n-dependencies = [\n- \"predicates-core\",\n- \"treeline\",\n-]\n-\n[[package]]\nname = \"proc-macro-error\"\nversion = \"1.0.4\"\n@@ -3910,12 +3820,6 @@ dependencies = [\n\"serde_json\",\n]\n-[[package]]\n-name = \"treeline\"\n-version = \"0.1.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41\"\n-\n[[package]]\nname = \"try-lock\"\nversion = \"0.2.3\"\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -7,12 +7,12 @@ use crate::device_plugin_api::v1beta1::{\n};\nuse crate::grpc_sock;\nuse super::{DeviceIdMap, DeviceMap, HEALTHY, UNHEALTHY};\n-use super::node_patcher::{listen_and_patch, NodeStatusPatcher};\n+use super::node_patcher::NodeStatusPatcher;\nuse std::collections::HashMap;\nuse std::path::{Path, PathBuf};\nuse std::sync::{Arc, Mutex};\n-use tokio::sync::{mpsc, watch};\n+use tokio::sync::broadcast;\nuse tokio::task;\nuse tonic::{transport::Server, Request};\n#[cfg(target_family = \"windows\")]\n@@ -26,6 +26,9 @@ pub const DEFAULT_PLUGIN_PATH: &str = \"c:\\\\ProgramData\\\\kubelet\\\\device_plugins\"\nconst PLUGIN_MANGER_SOCKET_NAME: &str = \"kubelet.sock\";\n+/// TODO\n+const UPDATE_NODE_STATUS_CHANNEL_SIZE: usize = 15;\n+\n/// Endpoint that maps to a single registered device plugin.\n/// It is responsible for managing gRPC communications with the device plugin and caching\n/// device states reported by the device plugin\n@@ -34,14 +37,15 @@ pub struct Endpoint {\npub register_request: RegisterRequest,\n}\n-type PluginMap = Arc<Mutex<HashMap<String,Endpoint>>>;\n+pub type DevicePluginMap = HashMap<String,Endpoint>;\n/// An internal storage plugin registry that implements most the same functionality as the [plugin\n/// manager](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/pluginmanager)\n/// in kubelet\n+#[derive(Clone)]\npub struct DeviceManager {\n/// Registered plugins\n- pub plugins: PluginMap,\n+ pub plugins: Arc<Mutex<DevicePluginMap>>,\n/// Directory where the plugin sockets live\npub plugin_dir: PathBuf,\n/// Device map\n@@ -52,29 +56,39 @@ pub struct DeviceManager {\n// pub healthy_device_ids: Arc<Mutex<DeviceIdMap>>,\n// pub unhealthy_device_ids: Arc<Mutex<DeviceIdMap>>,\n/// update_node_status_sender notifies the Node patcher to update node status with latest values\n- update_node_status_sender: mpsc::Sender<()>,\n+ update_node_status_sender: broadcast::Sender<()>,\n+ node_status_patcher: NodeStatusPatcher,\n}\nimpl DeviceManager {\n/// Returns a new device manager configured with the given device plugin directory path\n- pub fn new<P: AsRef<Path>>(plugin_dir: P, update_node_status_sender: mpsc::Sender<()>) -> Self {\n+ pub fn new<P: AsRef<Path>>(plugin_dir: P) -> Self {\n+ let devices = Arc::new(Mutex::new(HashMap::new()));\n+ let (update_node_status_sender, _) = broadcast::channel(UPDATE_NODE_STATUS_CHANNEL_SIZE);\n+ let node_status_patcher = NodeStatusPatcher::new(devices.clone(), update_node_status_sender.clone());\nDeviceManager {\nplugin_dir: PathBuf::from(plugin_dir.as_ref()),\nplugins: Arc::new(Mutex::new(HashMap::new())),\n- devices: Arc::new(Mutex::new(HashMap::new())),\n+ devices,\nallocated_device_ids: Arc::new(Mutex::new(HashMap::new())),\n- update_node_status_sender\n+ update_node_status_sender,\n+ node_status_patcher\n}\n}\n+\n/// Returns a new device manager configured with the default `/var/lib/kubelet/device_plugins/` device plugin directory path\n- pub fn default(update_node_status_sender: mpsc::Sender<()>) -> Self {\n+ pub fn default() -> Self {\n+ let devices = Arc::new(Mutex::new(HashMap::new()));\n+ let (update_node_status_sender, _) = broadcast::channel(UPDATE_NODE_STATUS_CHANNEL_SIZE);\n+ let node_status_patcher = NodeStatusPatcher::new(devices.clone(), update_node_status_sender.clone());\nDeviceManager {\nplugin_dir: PathBuf::from(DEFAULT_PLUGIN_PATH),\nplugins: Arc::new(Mutex::new(HashMap::new())),\ndevices: Arc::new(Mutex::new(HashMap::new())),\nallocated_device_ids: Arc::new(Mutex::new(HashMap::new())),\n// healthy_device_ids,\n- update_node_status_sender\n+ update_node_status_sender,\n+ node_status_patcher\n// unhealthy_device_ids: Arc::new(Mutex::new(HashMap::new()))\n}\n}\n@@ -82,11 +96,6 @@ impl DeviceManager {\n/// Adds the plugin to our HashMap\nfn add_plugin(&self, endpoint: Endpoint) {\nlet mut lock = self.plugins.lock().unwrap();\n- // let (connection_directive_sender, _) = watch::channel(ConnectionDirective::CONTINUE);\n- // let plugin_entry = PluginEntry {\n- // endpoint,\n- // connection_directive_sender\n- // };\nlock.insert(\nendpoint.register_request.resource_name.clone(),\nendpoint,\n@@ -238,7 +247,7 @@ impl DeviceManager {\nif update_node_status {\n// TODO handle error -- maybe channel is full\n- update_node_status_sender.send(()).await.unwrap();\n+ update_node_status_sender.send(()).unwrap();\n}\n}\n}\n@@ -259,40 +268,52 @@ impl DeviceManager {\n}\n+#[derive(Clone)]\n+pub struct DeviceRegistry {\n+ device_manager: Arc<DeviceManager>\n+}\n+impl DeviceRegistry {\n+ pub fn new(device_manager: Arc<DeviceManager>) -> Self {\n+ DeviceRegistry{device_manager}\n+ }\n+}\n#[async_trait::async_trait]\n-impl Registration for DeviceManager {\n+\n+impl Registration for DeviceRegistry {\nasync fn register(\n&self,\nrequest: tonic::Request<RegisterRequest>,\n) -> Result<tonic::Response<Empty>, tonic::Status> {\nlet register_request = request.get_ref();\n// Validate\n- self.validate(register_request).await.map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!(\"{}\", e)))?;\n+ self.device_manager.validate(register_request).await.map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!(\"{}\", e)))?;\n// Create a list and watch connection with the device plugin\n// TODO: should the manager keep track of threads?\n- self.create_endpoint(register_request).await.map_err(|e| tonic::Status::new(tonic::Code::NotFound, format!(\"{}\", e)))?;\n+ self.device_manager.create_endpoint(register_request).await.map_err(|e| tonic::Status::new(tonic::Code::NotFound, format!(\"{}\", e)))?;\nOk(tonic::Response::new(Empty {}))\n}\n}\n-pub async fn serve_device_manager(device_manager: DeviceManager, update_node_status_receiver: mpsc::Receiver<()>, client: &kube::Client, node_name: &str) -> anyhow::Result<()> {\n- let node_patcher = NodeStatusPatcher{ devices: device_manager.devices.clone()};\n+pub async fn serve_device_registry(device_registry: DeviceRegistry, client: &kube::Client, node_name: &str) -> anyhow::Result<()> {\n// TODO determine if need to create socket (and delete any previous ones)\n- let manager_socket = device_manager.plugin_dir.join(PLUGIN_MANGER_SOCKET_NAME);\n+ let manager_socket = device_registry.device_manager.plugin_dir.join(PLUGIN_MANGER_SOCKET_NAME);\nlet socket = grpc_sock::server::Socket::new(&manager_socket).expect(\"couldn't make manager socket\");\n// Clone arguments for listen_and_patch thread\nlet node_patcher_task_client = client.clone();\nlet node_patcher_task_node_name = node_name.to_string();\n+ let node_status_patcher = device_registry.device_manager.node_status_patcher.clone();\nlet node_patcher_task = task::spawn(async move {\n- listen_and_patch(update_node_status_receiver, node_patcher_task_node_name, node_patcher_task_client, node_patcher).await.unwrap();\n+ node_status_patcher.listen_and_patch(node_patcher_task_node_name, node_patcher_task_client).await.unwrap();\n});\n+ // TODO: There may be a slight race case here. If the DeviceManager tries to send device info to the NodeStatusPatcher before the NodeStatusPatcher has created a receiver\n+ // it will error because there are no active receivers.\nprintln!(\"before serve\");\nlet device_manager_task = task::spawn(async {\nlet serv = Server::builder()\n- .add_service(RegistrationServer::new(device_manager))\n+ .add_service(RegistrationServer::new(device_registry))\n.serve_with_incoming(socket);\n#[cfg(target_family = \"windows\")]\nlet serv = serv.compat();\n@@ -359,14 +380,14 @@ pub mod manager_tests {\nasync fn get_preferred_allocation(\n&self,\n- request: Request<PreferredAllocationRequest>,\n+ _request: Request<PreferredAllocationRequest>,\n) -> Result<Response<PreferredAllocationResponse>, Status> {\nunimplemented!();\n}\nasync fn allocate(\n&self,\n- requests: Request<AllocateRequest>,\n+ _request: Request<AllocateRequest>,\n) -> Result<Response<AllocateResponse>, Status> {\nunimplemented!();\n}\n@@ -502,11 +523,10 @@ pub mod manager_tests {\nlet (client, mock_service_task) = create_mock_kube_service(test_node_name).await;\n// Create and serve a DeviceManager\n- let (update_node_status_sender, update_node_status_receiver) = mpsc::channel(2);\n- let manager = DeviceManager::new(manager_temp_dir.path().clone(), update_node_status_sender);\n- let devices = manager.devices.clone();\n+ let device_manager = Arc::new(DeviceManager::new(manager_temp_dir.path().clone()));\n+ let devices = device_manager.devices.clone();\nlet manager_task = task::spawn( async move {\n- serve_device_manager(manager, update_node_status_receiver, &client, test_node_name).await.unwrap();\n+ serve_device_registry(DeviceRegistry::new(device_manager), &client, test_node_name).await.unwrap();\n});\ntokio::time::sleep(std::time::Duration::from_secs(1)).await;\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "diff": "@@ -5,16 +5,22 @@ use k8s_openapi::api::core::v1::{Node, NodeStatus};\nuse k8s_openapi::apimachinery::pkg::api::resource::Quantity;\nuse std::collections::BTreeMap;\nuse std::sync::{Arc, Mutex};\n-use tokio::sync::mpsc;\n+use tokio::sync::broadcast;\nuse tracing::{error, info, warn};\n/// NodePatcher updates the Node status with the latest device information.\n#[derive(Clone)]\npub struct NodeStatusPatcher {\n- pub devices: Arc<Mutex<DeviceMap>>,\n+ devices: Arc<Mutex<DeviceMap>>,\n+ // Broadcast sender so clonable\n+ update_node_status_sender: broadcast::Sender<()>,\n}\nimpl NodeStatusPatcher {\n+ pub fn new(devices: Arc<Mutex<DeviceMap>>, update_node_status_sender: broadcast::Sender<()>) -> Self {\n+ NodeStatusPatcher {devices, update_node_status_sender}\n+ }\n+\nasync fn get_node_status_patch(\n&self,\n) -> NodeStatus {\n@@ -48,36 +54,34 @@ impl NodeStatusPatcher {\n.map_err(|e| anyhow::anyhow!(\"Unable to patch node status: {}\", e))?;\nOk(())\n}\n-}\npub async fn listen_and_patch(\n- update_node_status_receiver: mpsc::Receiver<()>,\n+ self,\nnode_name: String,\nclient: kube::Client,\n- node_status_patcher: NodeStatusPatcher,\n) -> anyhow::Result<()> {\n- let mut receiver = update_node_status_receiver;\n+ // Forever hold lock on the status update receiver\n+ let mut receiver = self.update_node_status_sender.subscribe();\nprintln!(\"entered listen_and_patch\");\nloop {\nprintln!(\"listen_and_patch loop\");\nmatch receiver.recv().await {\n- None => {\n+ Err(e) => {\nerror!(\"Channel closed by senders\");\n// TODO: bubble up error\n},\n- Some(_) => {\n+ Ok(_) => {\n// Grab status values\n- let status_patch = node_status_patcher.get_node_status_patch().await;\n+ let status_patch = self.get_node_status_patch().await;\n// Do patch\n- node_status_patcher.do_node_status_patch(status_patch, &node_name, &client).await?;\n+ self.do_node_status_patch(status_patch, &node_name, &client).await?;\n}\n}\n}\n// TODO add channel for termination?\nOk(())\n}\n-\n-\n+}\n#[cfg(test)]\n@@ -109,7 +113,8 @@ mod node_patcher_tests {\nallocatable: None,\n..Default::default()\n};\n- let node_status_patcher = NodeStatusPatcher {devices};\n+ let (update_node_status_sender, _rx) = broadcast::channel(2);\n+ let node_status_patcher = NodeStatusPatcher {devices, update_node_status_sender};\nlet node_name = \"test_node\";\nlet (client, _) = create_mock_kube_service(node_name).await;\nnode_status_patcher.do_node_status_patch(empty_node_status, node_name, &client).await.unwrap();\n@@ -120,7 +125,8 @@ mod node_patcher_tests {\nlet r1_name = \"r1\";\nlet r2_name = \"r2\";\nlet devices = create_mock_devices(r1_name, r2_name);\n- let node_status_patcher = NodeStatusPatcher{devices};\n+ let (update_node_status_sender, _rx) = broadcast::channel(2);\n+ let node_status_patcher = NodeStatusPatcher {devices, update_node_status_sender};\nlet status = node_status_patcher.get_node_status_patch().await;\n// Check that both resources listed under allocatable and only healthy devices are counted\nlet allocatable = status.allocatable.unwrap();\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/kubelet.rs", "new_path": "crates/kubelet/src/kubelet.rs", "diff": "@@ -5,7 +5,7 @@ use crate::device_plugin_manager::manager;\nuse crate::node;\nuse crate::operator::PodOperator;\nuse crate::plugin_watcher::PluginRegistry;\n-use crate::provider::{PluginSupport, Provider};\n+use crate::provider::{DevicePluginSupport, PluginSupport, Provider};\nuse crate::webserver::start as start_webserver;\nuse futures::future::{FutureExt, TryFutureExt};\n@@ -14,15 +14,11 @@ use std::convert::TryFrom;\nuse std::sync::atomic::{AtomicBool, Ordering};\nuse std::sync::Arc;\nuse tokio::signal::ctrl_c;\n-use tokio::sync::mpsc;\nuse tokio::task;\nuse tracing::{error, info, warn};\nuse krator::{ControllerBuilder, Manager};\n-/// TODO\n-const UPDATE_NODE_STATUS_CHANNEL_SIZE: usize = 15;\n-\n/// A Kubelet server backed by a given `Provider`.\n///\n/// A Kubelet is a special kind of server that handles Kubernetes requests\n@@ -82,10 +78,9 @@ impl<P: Provider> Kubelet<P> {\n.fuse()\n.boxed();\n- let (update_node_status_sender, update_node_status_receiver) = mpsc::channel(UPDATE_NODE_STATUS_CHANNEL_SIZE);\n- let manager = manager::DeviceManager::default(update_node_status_sender);\n- // TODO: add provider function for configuring device manager use and path\n- let device_manager = start_device_manager(Some(manager), Some(update_node_status_receiver), &client, &self.config.node_name).fuse().boxed();\n+ let device_manager = start_device_manager(self.provider.provider_state()\n+ .read()\n+ .await.device_plugin_manager(), &client, &self.config.node_name).fuse().boxed();\n// Start the webserver\nlet webserver = start_webserver(self.provider.clone(), &self.config.server_config)\n@@ -197,11 +192,10 @@ async fn start_plugin_registry(registrar: Option<Arc<PluginRegistry>>) -> anyhow\n}\n/// Starts a DeviceManager\n-async fn start_device_manager(device_manager: Option<manager::DeviceManager>, update_node_status_receiver: Option<mpsc::Receiver<()>>, client: &kube::Client, node_name: &str) -> anyhow::Result<()> {\n+async fn start_device_manager(device_manager: Option<Arc<manager::DeviceManager>>, client: &kube::Client, node_name: &str) -> anyhow::Result<()> {\nmatch device_manager {\n- Some(m) => {\n- let update_node_status_receiver = update_node_status_receiver.ok_or_else(|| anyhow::Error::msg(\"Provider provided some DeviceManager but no receiver for triggering node status updates\"))?;\n- manager::serve_device_manager(m, update_node_status_receiver, client, node_name).await\n+ Some(dm) => {\n+ manager::serve_device_registry(manager::DeviceRegistry::new(dm), client, node_name).await\n},\n// Do nothing; just poll forever and \"pretend\" that a DeviceManager is running\nNone => {\n@@ -277,6 +271,13 @@ mod test {\nSome(Arc::new(PluginRegistry::default()))\n}\n}\n+\n+ impl DevicePluginSupport for ProviderState {\n+ fn device_plugin_manager(&self) -> Option<Arc<DeviceManager>> {\n+ Some(Arc::new(DeviceManager::default()))\n+ }\n+ }\n+\nstruct PodState;\n#[async_trait::async_trait]\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/lib.rs", "new_path": "crates/kubelet/src/lib.rs", "diff": "//! ```rust,no_run\n//! use kubelet::Kubelet;\n//! use kubelet::config::Config;\n+//! use kubelet::device_plugin_manager::manager::DeviceManager;\n//! use kubelet::plugin_watcher::PluginRegistry;\n//! use kubelet::pod::Pod;\n-//! use kubelet::provider::{Provider, PluginSupport};\n+//! use kubelet::provider::{DevicePluginSupport, Provider, PluginSupport};\n//! use std::sync::Arc;\n//! use tokio::sync::RwLock;\n//! use kubelet::pod::state::prelude::*;\n//! }\n//! }\n//!\n+//! impl DevicePluginSupport for ProviderState {\n+//! fn device_plugin_manager(&self) -> Option<Arc<DeviceManager>> {\n+//! None\n+//! }\n+//! }\n+//!\n//! async {\n//! // Instantiate your provider type\n//! let provider = MyProvider;\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/provider/mod.rs", "new_path": "crates/kubelet/src/provider/mod.rs", "diff": "@@ -9,6 +9,7 @@ use thiserror::Error;\nuse tracing::{debug, error, info};\nuse crate::container::Container;\n+use crate::device_plugin_manager::manager::DeviceManager;\nuse crate::log::Sender;\nuse crate::node::Builder;\nuse crate::plugin_watcher::PluginRegistry;\n@@ -32,9 +33,10 @@ use krator::{ObjectState, State};\n/// # Example\n/// ```rust\n/// use async_trait::async_trait;\n+/// use kubelet::device_plugin_manager::manager::DeviceManager;\n/// use kubelet::plugin_watcher::PluginRegistry;\n/// use kubelet::pod::{Pod, Status};\n-/// use kubelet::provider::{Provider, PluginSupport};\n+/// use kubelet::provider::{DevicePluginSupport, Provider, PluginSupport};\n/// use kubelet::pod::state::Stub;\n/// use kubelet::pod::state::prelude::*;\n/// use std::sync::Arc;\n@@ -78,11 +80,17 @@ use krator::{ObjectState, State};\n/// None\n/// }\n/// }\n+///\n+/// impl DevicePluginSupport for ProviderState {\n+/// fn device_plugin_manager(&self) -> Option<Arc<DeviceManager>> {\n+/// None\n+/// }\n+/// }\n/// ```\n#[async_trait]\npub trait Provider: Sized + Send + Sync + 'static {\n/// The state of the provider itself.\n- type ProviderState: 'static + Send + Sync + PluginSupport;\n+ type ProviderState: 'static + Send + Sync + PluginSupport + DevicePluginSupport;\n/// The state that is passed between Pod state handlers.\ntype PodState: ObjectState<\n@@ -201,6 +209,15 @@ pub trait PluginSupport {\nNone\n}\n}\n+\n+/// A trait for specifying whether device plugins are supported. Defaults to `None`\n+pub trait DevicePluginSupport {\n+ /// Fetch the device plugin manager to register and use device plugins\n+ fn device_plugin_manager(&self) -> Option<Arc<DeviceManager>> {\n+ None\n+ }\n+}\n+\n/// Resolve the environment variables for a container.\n///\n/// This generally should not be overwritten unless you need to handle\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/mod.rs", "new_path": "crates/kubelet/src/state/common/mod.rs", "diff": "use crate::pod::state::prelude::PodStatus;\nuse crate::pod::Pod;\n-use crate::provider::{PluginSupport, VolumeSupport};\n+use crate::provider::{DevicePluginSupport, PluginSupport, VolumeSupport};\nuse krator::{ObjectState, State};\nuse std::collections::HashMap;\n+use std::sync::Arc;\npub mod crash_loop_backoff;\npub mod error;\n@@ -71,7 +72,7 @@ pub trait GenericPodState: ObjectState<Manifest = Pod, Status = PodStatus> {\n/// module.\npub trait GenericProvider: 'static + Send + Sync {\n/// The state of the provider itself.\n- type ProviderState: GenericProviderState + VolumeSupport + PluginSupport;\n+ type ProviderState: GenericProviderState + VolumeSupport + PluginSupport + DevicePluginSupport;\n/// The state that is passed between Pod state handlers.\ntype PodState: GenericPodState + ObjectState<SharedState = Self::ProviderState>;\n/// The state to which pods should transition after they have completed\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/lib.rs", "new_path": "crates/wasi-provider/src/lib.rs", "diff": "@@ -40,11 +40,12 @@ use std::path::{Path, PathBuf};\nuse std::sync::Arc;\nuse async_trait::async_trait;\n+use kubelet::device_plugin_manager::manager::DeviceManager;\nuse kubelet::node::Builder;\nuse kubelet::plugin_watcher::PluginRegistry;\nuse kubelet::pod::state::prelude::SharedState;\nuse kubelet::pod::{Handle, Pod, PodKey};\n-use kubelet::provider::{PluginSupport, Provider, ProviderError, VolumeSupport};\n+use kubelet::provider::{DevicePluginSupport, PluginSupport, Provider, ProviderError, VolumeSupport};\nuse kubelet::state::common::registered::Registered;\nuse kubelet::state::common::terminated::Terminated;\nuse kubelet::state::common::{GenericProvider, GenericProviderState};\n@@ -79,6 +80,7 @@ pub struct ProviderState {\nclient: kube::Client,\nvolume_path: PathBuf,\nplugin_registry: Arc<PluginRegistry>,\n+ device_plugin_manager: Arc<DeviceManager>,\n}\n#[async_trait]\n@@ -112,6 +114,12 @@ impl PluginSupport for ProviderState {\n}\n}\n+impl DevicePluginSupport for ProviderState {\n+ fn device_plugin_manager(&self) -> Option<Arc<DeviceManager>> {\n+ Some(self.device_plugin_manager.clone())\n+ }\n+}\n+\nimpl WasiProvider {\n/// Create a new wasi provider from a module store and a kubelet config\npub async fn new(\n@@ -122,6 +130,7 @@ impl WasiProvider {\n) -> anyhow::Result<Self> {\nlet log_path = config.data_dir.join(LOG_DIR_NAME);\nlet volume_path = config.data_dir.join(VOLUME_DIR);\n+ let device_plugin_manager = Arc::new(DeviceManager::default());\ntokio::fs::create_dir_all(&log_path).await?;\ntokio::fs::create_dir_all(&volume_path).await?;\nlet client = kube::Client::try_from(kubeconfig)?;\n@@ -133,6 +142,7 @@ impl WasiProvider {\nvolume_path,\nclient,\nplugin_registry,\n+ device_plugin_manager,\n},\n})\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add device manager to Provider and ProviderState interfaces
350,448
03.06.2021 11:35:40
25,200
d99346e16f111f3d8d6b6eb9f7c4483d8b237a75
fix docs reference to old device_plugin_manager module layout
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/lib.rs", "new_path": "crates/kubelet/src/lib.rs", "diff": "//! ```rust,no_run\n//! use kubelet::Kubelet;\n//! use kubelet::config::Config;\n-//! use kubelet::device_plugin_manager::manager::DeviceManager;\n+//! use kubelet::device_plugin_manager::DeviceManager;\n//! use kubelet::plugin_watcher::PluginRegistry;\n//! use kubelet::pod::Pod;\n//! use kubelet::provider::{DevicePluginSupport, Provider, PluginSupport};\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/provider/mod.rs", "new_path": "crates/kubelet/src/provider/mod.rs", "diff": "@@ -33,7 +33,7 @@ use krator::{ObjectState, State};\n/// # Example\n/// ```rust\n/// use async_trait::async_trait;\n-/// use kubelet::device_plugin_manager::manager::DeviceManager;\n+/// use kubelet::device_plugin_manager::DeviceManager;\n/// use kubelet::plugin_watcher::PluginRegistry;\n/// use kubelet::pod::{Pod, Status};\n/// use kubelet::provider::{DevicePluginSupport, Provider, PluginSupport};\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
fix docs reference to old device_plugin_manager module layout
350,448
04.06.2021 09:38:01
25,200
aed687292efb5c917199320d2142e5b3601f470a
add more inline docs, fix clippy errors, remove printlns
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "@@ -31,16 +31,18 @@ const DEFAULT_PLUGIN_PATH: &str = \"c:\\\\ProgramData\\\\kubelet\\\\device_plugins\";\nconst PLUGIN_MANGER_SOCKET_NAME: &str = \"kubelet.sock\";\nconst UPDATE_NODE_STATUS_CHANNEL_SIZE: usize = 15;\n-/// `DeviceIdMap` contains ... TODO\n+\n+/// `DeviceIdMap` contains the device Ids of all the devices advertised by device plugins.\n+/// Key is resource name.\ntype DeviceIdMap = HashMap<String, EndpointDeviceIds>;\n-/// EndpointDeviceIds contains the IDs of all the devices advertised by a single device plugin\n+/// `EndpointDeviceIds` contains the IDs of all the devices advertised by a single device plugin\ntype EndpointDeviceIds = HashSet<String>;\n/// `DeviceMap` contains all the devices advertised by all device plugins. Key is resource name.\ntype DeviceMap = HashMap<String, EndpointDevicesMap>;\n-/// EndpointDevicesMap contains all of the devices advertised by a single device plugin. Key is device ID.\n+/// `EndpointDevicesMap` contains all of the devices advertised by a single device plugin. Key is device ID.\ntype EndpointDevicesMap = HashMap<String, Device>;\n/// Healthy means the device is allocatable (whether already allocated or not)\n@@ -187,6 +189,7 @@ impl DeviceManager {\n/// Validates if the plugin is unique (meaning it doesn't exist in the `plugins` map).\n/// If there is an active plugin registered with this name, returns error.\n+ /// TODO: Might be best to always accept: https://sourcegraph.com/github.com/kubernetes/kubernetes@9d6e5049bb719abf41b69c91437d25e273829746/-/blob/pkg/kubelet/cm/devicemanager/manager.go?subtree=true#L439\nasync fn validate_is_unique(\n&self,\nregister_request: &RegisterRequest,\n@@ -727,14 +730,14 @@ pub mod tests {\n&self,\n_request: Request<Empty>,\n) -> Result<Response<Self::ListAndWatchStream>, Status> {\n- println!(\"list_and_watch entered\");\n+ trace!(\"list_and_watch entered\");\n// Create a channel that list_and_watch can periodically send updates to kubelet on\nlet (kubelet_update_sender, kubelet_update_receiver) = mpsc::channel(3);\nlet mut devices_receiver = self.devices_receiver.clone();\ntokio::spawn(async move {\nwhile devices_receiver.changed().await.is_ok() {\nlet devices = devices_receiver.borrow().clone();\n- println!(\n+ trace!(\n\"list_and_watch received new devices [{:?}] to send\",\ndevices\n);\n@@ -778,7 +781,6 @@ pub mod tests {\n) -> anyhow::Result<()> {\nlet device_plugin = MockDevicePlugin { devices_receiver };\nlet socket = grpc_sock::server::Socket::new(&socket_path).expect(\"couldnt make dp socket\");\n- println!(\"after creating DP socket\");\nlet serv = Server::builder()\n.add_service(DevicePluginServer::new(device_plugin))\n.serve_with_incoming(socket);\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "diff": "@@ -77,9 +77,7 @@ impl NodeStatusPatcher {\npub async fn listen_and_patch(self) -> anyhow::Result<()> {\n// Forever hold lock on the status update receiver\nlet mut receiver = self.update_node_status_sender.subscribe();\n- println!(\"entered listen_and_patch\");\nloop {\n- println!(\"listen_and_patch loop\");\nmatch receiver.recv().await {\nErr(_e) => {\nerror!(\"Channel closed by senders\");\n@@ -93,8 +91,6 @@ impl NodeStatusPatcher {\n}\n}\n}\n- // TODO add channel for termination?\n- Ok(())\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "new_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "diff": "@@ -101,15 +101,10 @@ impl PodDevices {\ncontainer_devs\n.iter()\n.for_each(|(resource_name, device_allocate_info)| {\n- if let Some(device_ids) = res.get(resource_name) {\n- res.insert(\n- resource_name.clone(),\n- device_ids\n- .union(&device_allocate_info.device_ids)\n- .into_iter()\n- .cloned()\n- .collect(),\n- );\n+ if let Some(device_ids) = res.get_mut(resource_name) {\n+ device_allocate_info.device_ids.iter().for_each(|id| {\n+ device_ids.insert(id.clone());\n+ });\n} else {\nres.insert(\nresource_name.clone(),\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add more inline docs, fix clippy errors, remove printlns
350,448
04.06.2021 10:00:36
25,200
62d54371e1613299f3d01487f5bd95d9a5802bc2
make fields and structs private where possible and change DeviceManager default constructor
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "@@ -46,29 +46,30 @@ type DeviceMap = HashMap<String, EndpointDevicesMap>;\ntype EndpointDevicesMap = HashMap<String, Device>;\n/// Healthy means the device is allocatable (whether already allocated or not)\n-pub const HEALTHY: &str = \"Healthy\";\n+const HEALTHY: &str = \"Healthy\";\n/// Unhealthy means the device is not allocatable\n-pub const UNHEALTHY: &str = \"Unhealthy\";\n+/// TODO: use when device plugins go offline\n+const UNHEALTHY: &str = \"Unhealthy\";\n/// Endpoint that maps to a single registered device plugin.\n/// It is responsible for managing gRPC communications with the device plugin and caching\n/// device states reported by the device plugin\n#[derive(Clone)]\n-pub struct Endpoint {\n+struct Endpoint {\n/// Client that is connected to the device plugin\n- pub client: DevicePluginClient<tonic::transport::Channel>,\n+ client: DevicePluginClient<tonic::transport::Channel>,\n/// `RegisterRequest` received when the device plugin registered with the DeviceRegistry\n- pub register_request: RegisterRequest,\n+ register_request: RegisterRequest,\n}\n/// ContainerAllocateInfo pairs an allocate request to with the requesting container\n#[derive(Clone)]\npub struct ContainerAllocateInfo {\n/// The name of the container\n- pub container_name: String,\n+ container_name: String,\n/// The `ContainerAllocateRequest` sent to the device plugin for this container\n- pub container_allocate_request: ContainerAllocateRequest,\n+ container_allocate_request: ContainerAllocateRequest,\n}\n/// An implementation of the Kubernetes Device Plugin Manager (https://github.com/kubernetes/kubernetes/tree/v1.21.1/pkg/kubelet/cm/devicemanager).\n@@ -80,16 +81,16 @@ pub struct ContainerAllocateInfo {\n#[derive(Clone)]\npub struct DeviceManager {\n/// Map of registered device plugins, keyed by resource name\n- pub plugins: Arc<Mutex<HashMap<String, Endpoint>>>,\n+ plugins: Arc<Mutex<HashMap<String, Endpoint>>>,\n/// Directory where the device plugin sockets live\n- pub plugin_dir: PathBuf,\n+ plugin_dir: PathBuf,\n/// Contains all the devices advertised by all device plugins. Key is resource name.\n/// Shared with the NodePatcher.\n- pub devices: Arc<Mutex<DeviceMap>>,\n+ devices: Arc<Mutex<DeviceMap>>,\n/// Structure containing map with Pod to currently allocated devices mapping\npub pod_devices: PodDevices,\n/// Devices that have been allocated to Pods, keyed by resource name.\n- pub allocated_device_ids: Arc<Mutex<DeviceIdMap>>,\n+ allocated_device_ids: Arc<Mutex<DeviceIdMap>>,\n/// Sender to notify the NodePatcher to update NodeStatus with latest resource values.\nupdate_node_status_sender: broadcast::Sender<()>,\n/// Struture that patches the Node with the latest resource values when signaled.\n@@ -120,26 +121,8 @@ impl DeviceManager {\n}\n/// Returns a new device manager configured with the default `/var/lib/kubelet/device_plugins/` device plugin directory path\n- pub fn default(client: kube::Client, node_name: &str) -> Self {\n- let devices = Arc::new(Mutex::new(HashMap::new()));\n- let (update_node_status_sender, _) = broadcast::channel(UPDATE_NODE_STATUS_CHANNEL_SIZE);\n- let node_status_patcher = NodeStatusPatcher::new(\n- node_name,\n- devices,\n- update_node_status_sender.clone(),\n- client.clone(),\n- );\n- let pod_devices = PodDevices::new(client);\n- DeviceManager {\n- plugin_dir: PathBuf::from(DEFAULT_PLUGIN_PATH),\n- plugins: Arc::new(Mutex::new(HashMap::new())),\n- devices: Arc::new(Mutex::new(HashMap::new())),\n- pod_devices,\n- allocated_device_ids: Arc::new(Mutex::new(HashMap::new())),\n- // healthy_device_ids,\n- update_node_status_sender,\n- node_status_patcher, // unhealthy_device_ids: Arc::new(Mutex::new(HashMap::new()))\n- }\n+ pub fn new_with_default_path(client: kube::Client, node_name: &str) -> Self {\n+ DeviceManager::new(DEFAULT_PLUGIN_PATH, client, node_name)\n}\n/// Adds the plugin to our HashMap\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "new_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "diff": "@@ -15,7 +15,7 @@ pub struct DeviceAllocateInfo {\npub allocate_response: ContainerAllocateResponse,\n}\n/// Map of devices allocated to the container, keyed by resource name\n-pub type ResourceAllocateInfo = HashMap<String, DeviceAllocateInfo>;\n+type ResourceAllocateInfo = HashMap<String, DeviceAllocateInfo>;\n/// Map of container device information, keyed by container name\npub type ContainerDevices = HashMap<String, ResourceAllocateInfo>;\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/kubelet.rs", "new_path": "crates/kubelet/src/kubelet.rs", "diff": "@@ -281,7 +281,9 @@ mod test {\nfn device_plugin_manager(&self) -> Option<Arc<DeviceManager>> {\nlet client = mock_client();\nlet node_name = \"test_node\";\n- Some(Arc::new(DeviceManager::default(client, node_name)))\n+ Some(Arc::new(DeviceManager::new_with_default_path(\n+ client, node_name,\n+ )))\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/lib.rs", "new_path": "crates/wasi-provider/src/lib.rs", "diff": "@@ -133,7 +133,7 @@ impl WasiProvider {\nlet log_path = config.data_dir.join(LOG_DIR_NAME);\nlet volume_path = config.data_dir.join(VOLUME_DIR);\nlet client = kube::Client::try_from(kubeconfig.clone())?;\n- let device_plugin_manager = Arc::new(DeviceManager::default(client, &config.node_name));\n+ let device_plugin_manager = Arc::new(DeviceManager::new_with_default_path(client, &config.node_name));\ntokio::fs::create_dir_all(&log_path).await?;\ntokio::fs::create_dir_all(&volume_path).await?;\nlet client = kube::Client::try_from(kubeconfig)?;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
make fields and structs private where possible and change DeviceManager default constructor
350,448
04.06.2021 10:53:57
25,200
facb2ad67d21c3cf55cc3a8fc54ee511459dd443
clean up create_endpoint function
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "@@ -72,6 +72,13 @@ pub struct ContainerAllocateInfo {\ncontainer_allocate_request: ContainerAllocateRequest,\n}\n+/// Enum for reporting a whether a connection was made with a device plugin's ListAndWatch service\n+#[derive(Debug)]\n+enum EndpointConnectionMessage {\n+ Success,\n+ Error,\n+}\n+\n/// An implementation of the Kubernetes Device Plugin Manager (https://github.com/kubernetes/kubernetes/tree/v1.21.1/pkg/kubelet/cm/devicemanager).\n/// It implements the device plugin framework's `Registration` gRPC service. A device plugin (DP) can register itself with the kubelet through this gRPC\n/// service. This allows the DP to advertise a resource like system hardware kubelet. The `DeviceManager` contains a `NodePatcher` that patches the Node\n@@ -193,11 +200,8 @@ impl DeviceManager {\nOk(())\n}\n- /// This creates a connection to a Device Plugin by calling its ListAndWatch function.\n+ /// This creates a connection to a device plugin by calling it's ListAndWatch function.\n/// Upon a successful connection, an `Endpoint` is added to the `plugins` map.\n- /// The device plugin updates the kubelet periodically about the capacity and health of its resource.\n- /// Upon updates, this propagates any changes into the `plugins` map and triggers the `NodePatcher` to\n- /// patch the node with the latest values.\nasync fn create_endpoint(&self, register_request: &RegisterRequest) -> anyhow::Result<()> {\ntrace!(\n\"Connecting to plugin at {:?} for ListAndWatch\",\n@@ -212,26 +216,63 @@ impl DeviceManager {\nlet all_devices = self.devices.clone();\nlet update_node_status_sender = self.update_node_status_sender.clone();\n- // TODO: make options an enum?\n- let success: i8 = 0;\n- let error: i8 = 1;\n- let (successful_connection_sender, successful_connection_receiver): (\n- tokio::sync::oneshot::Sender<i8>,\n- tokio::sync::oneshot::Receiver<i8>,\n- ) = tokio::sync::oneshot::channel();\n+ let (successful_connection_sender, successful_connection_receiver) =\n+ tokio::sync::oneshot::channel();\n- // TODO: decide whether to join all spawned ListAndWatch threads\n+ // TODO: decide whether to join/store all spawned ListAndWatch threads\ntokio::spawn(async move {\n- match list_and_watch_client\n- .list_and_watch(Request::new(Empty {}))\n- .await\n- {\n+ DeviceManager::call_list_and_watch(\n+ all_devices,\n+ update_node_status_sender,\n+ &mut list_and_watch_client,\n+ successful_connection_sender,\n+ list_and_watch_resource_name,\n+ )\n+ .await;\n+ });\n+\n+ // Only add device plugin to map if successful ListAndWatch call\n+ match successful_connection_receiver.await.unwrap() {\n+ EndpointConnectionMessage::Success => {\n+ let endpoint = Endpoint {\n+ client,\n+ register_request: register_request.clone(),\n+ };\n+ self.add_plugin(endpoint);\n+ }\n+ EndpointConnectionMessage::Error => {\n+ return Err(anyhow::Error::msg(format!(\n+ \"Could not call ListAndWatch on device plugin at socket {:?}\",\n+ register_request.endpoint\n+ )));\n+ }\n+ }\n+\n+ Ok(())\n+ }\n+\n+ /// Connects to a device plugin's ListAndWatch service.\n+ /// The device plugin updates this client periodically about changes in the capacity and health of its resource.\n+ /// Upon updates, this propagates any changes into the `plugins` map and triggers the `NodePatcher` to\n+ /// patch the node with the latest values.\n+ async fn call_list_and_watch(\n+ devices: Arc<Mutex<DeviceMap>>,\n+ update_node_status_sender: broadcast::Sender<()>,\n+ client: &mut DevicePluginClient<tonic::transport::Channel>,\n+ successful_connection_sender: tokio::sync::oneshot::Sender<EndpointConnectionMessage>,\n+ resource_name: String,\n+ ) {\n+ match client.list_and_watch(Request::new(Empty {})).await {\nErr(e) => {\n- error!(\"could not call ListAndWatch on device plugin with resource name {:?} with error {}\", list_and_watch_resource_name, e);\n- successful_connection_sender.send(error).unwrap();\n+ error!(error = %e, resource = %resource_name, \"Could not call ListAndWatch on the device plugin for this resource\");\n+ successful_connection_sender\n+ .send(EndpointConnectionMessage::Error)\n+ .unwrap();\n}\nOk(stream_wrapped) => {\n- successful_connection_sender.send(success).unwrap();\n+ successful_connection_sender\n+ .send(EndpointConnectionMessage::Success)\n+ .unwrap();\nlet mut stream = stream_wrapped.into_inner();\nlet mut previous_endpoint_devices: HashMap<String, Device> = HashMap::new();\nwhile let Some(response) = stream.message().await.unwrap() {\n@@ -247,36 +288,31 @@ impl DeviceManager {\n// (3) Device removed: DP is no longer advertising a device\ncurrent_devices.iter().for_each(|(_, device)| {\n// (1) Device modified or already registered\n- if let Some(previous_device) = previous_endpoint_devices.get(&device.id)\n- {\n+ if let Some(previous_device) = previous_endpoint_devices.get(&device.id) {\nif previous_device.health != device.health {\n- all_devices\n+ devices\n.lock()\n.unwrap()\n- .get_mut(&list_and_watch_resource_name)\n+ .get_mut(&resource_name)\n.unwrap()\n.insert(device.id.clone(), device.clone());\nupdate_node_status = true;\n} else if previous_device.topology != device.topology {\n- // TODO: how to handle this\n- error!(\"device topology changed\");\n+ // Currently not using/handling device topology. Simply log the change.\n+ trace!(\"Topology of device {} from resource {} changed from {:?} to {:?}\", device.id, resource_name, previous_device.topology, device.topology);\n}\n// (2) Device added\n} else {\n- let mut all_devices_map = all_devices.lock().unwrap();\n- match all_devices_map.get_mut(&list_and_watch_resource_name) {\n+ let mut all_devices_map = devices.lock().unwrap();\n+ match all_devices_map.get_mut(&resource_name) {\nSome(resource_devices_map) => {\n- resource_devices_map\n- .insert(device.id.clone(), device.clone());\n+ resource_devices_map.insert(device.id.clone(), device.clone());\n}\nNone => {\nlet mut resource_devices_map = HashMap::new();\n- resource_devices_map\n- .insert(device.id.clone(), device.clone());\n- all_devices_map.insert(\n- list_and_watch_resource_name.clone(),\n- resource_devices_map,\n- );\n+ resource_devices_map.insert(device.id.clone(), device.clone());\n+ all_devices_map\n+ .insert(resource_name.clone(), resource_devices_map);\n}\n}\nupdate_node_status = true;\n@@ -289,10 +325,10 @@ impl DeviceManager {\n.for_each(|(_, previous_device)| {\nif !response.devices.contains(previous_device) {\n// TODO: how to handle already allocated devices? Pretty sure K8s lets them keep running but what about the allocated_device map?\n- all_devices\n+ devices\n.lock()\n.unwrap()\n- .get_mut(&list_and_watch_resource_name)\n+ .get_mut(&resource_name)\n.unwrap()\n.remove(&previous_device.id);\nupdate_node_status = true;\n@@ -310,23 +346,6 @@ impl DeviceManager {\n// TODO: remove endpoint from map\n}\n}\n- });\n-\n- // Only add device plugin to map if successful ListAndWatch call\n- if successful_connection_receiver.await.unwrap() == success {\n- let endpoint = Endpoint {\n- client,\n- register_request: register_request.clone(),\n- };\n- self.add_plugin(endpoint);\n- } else {\n- return Err(anyhow::Error::msg(format!(\n- \"could not call ListAndWatch on device plugin at socket {:?}\",\n- register_request.endpoint\n- )));\n- }\n-\n- Ok(())\n}\n/// This is the call that you can use to allocate a set of devices\n@@ -884,7 +903,7 @@ pub mod tests {\nlet (devices_sender, devices_receiver) = watch::channel(devices);\n// Run the mock device plugin\n- let device_plugin_task = task::spawn(async move {\n+ let _device_plugin_task = task::spawn(async move {\nrun_mock_device_plugin(\ndevice_plugin_temp_dir.path().join(socket_name),\ndevices_receiver,\n@@ -896,7 +915,7 @@ pub mod tests {\n// Name of \"this node\" that should be patched with Device Plugin resources\nlet test_node_name = \"test_node\";\n// Create and run a mock Kubernetes API service and get a Kubernetes client\n- let (client, mock_service_task) = create_mock_kube_service(test_node_name).await;\n+ let (client, _mock_service_task) = create_mock_kube_service(test_node_name).await;\n// Create and serve a DeviceManager\nlet device_manager = Arc::new(DeviceManager::new(\n@@ -905,7 +924,7 @@ pub mod tests {\ntest_node_name,\n));\nlet devices = device_manager.devices.clone();\n- let manager_task = task::spawn(async move {\n+ let _manager_task = task::spawn(async move {\nserve_device_registry(device_manager).await.unwrap();\n});\ntokio::time::sleep(std::time::Duration::from_secs(1)).await;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
clean up create_endpoint function
350,448
07.06.2021 06:53:58
25,200
b1f3a819d19f4ade35506c74d2198c21eb85b724
add node filter for PodDevices, iterator optimizations, and nits
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "@@ -45,6 +45,12 @@ type DeviceMap = HashMap<String, EndpointDevicesMap>;\n/// `EndpointDevicesMap` contains all of the devices advertised by a single device plugin. Key is device ID.\ntype EndpointDevicesMap = HashMap<String, Device>;\n+/// Map of resources requested by a Container. Key is resource name and value is requested quantity of the resource\n+type ContainerResourceRequests = HashMap<String, Quantity>;\n+\n+/// Map of resources requested by the Containers of a Pod. Key is container name and value is the Container's resource requests\n+pub type PodResourceRequests = HashMap<String, ContainerResourceRequests>;\n+\n/// Healthy means the device is allocatable (whether already allocated or not)\nconst HEALTHY: &str = \"Healthy\";\n@@ -115,7 +121,7 @@ impl DeviceManager {\nupdate_node_status_sender.clone(),\nclient.clone(),\n);\n- let pod_devices = PodDevices::new(client);\n+ let pod_devices = PodDevices::new(node_name, client);\nDeviceManager {\nplugin_dir: PathBuf::from(plugin_dir.as_ref()),\nplugins: Arc::new(Mutex::new(HashMap::new())),\n@@ -278,8 +284,8 @@ impl DeviceManager {\nwhile let Some(response) = stream.message().await.unwrap() {\nlet current_devices = response\n.devices\n- .iter()\n- .map(|device| (device.id.clone(), device.clone()))\n+ .into_iter()\n+ .map(|device| (device.id.clone(), device))\n.collect::<HashMap<String, Device>>();\nlet mut update_node_status = false;\n// Iterate through the list of devices, updating the Node status if\n@@ -322,15 +328,15 @@ impl DeviceManager {\n// (3) Check if Device removed\nprevious_endpoint_devices\n.iter()\n- .for_each(|(_, previous_device)| {\n- if !response.devices.contains(previous_device) {\n+ .for_each(|(previous_dev_id, _)| {\n+ if !current_devices.contains_key(previous_dev_id) {\n// TODO: how to handle already allocated devices? Pretty sure K8s lets them keep running but what about the allocated_device map?\ndevices\n.lock()\n.unwrap()\n.get_mut(&resource_name)\n.unwrap()\n- .remove(&previous_device.id);\n+ .remove(previous_dev_id);\nupdate_node_status = true;\n}\n});\n@@ -354,16 +360,23 @@ impl DeviceManager {\npub async fn do_allocate(\n&self,\npod: &Pod,\n- container_devices: HashMap<String, HashMap<String, Quantity>>,\n+ container_devices: PodResourceRequests,\n) -> anyhow::Result<()> {\nlet mut all_allocate_requests: HashMap<String, Vec<ContainerAllocateInfo>> = HashMap::new();\nlet mut updated_allocated_devices = false;\nfor (container_name, requested_resources) in container_devices {\nfor (resource_name, quantity) in requested_resources {\n- let num_requested: usize =\n- serde_json::to_string(&quantity).unwrap().parse().unwrap();\n+ if !self.is_device_plugin_resource(&resource_name).await {\n+ continue;\n+ }\n+\n+ // Device plugin resources should be request in numerical amounts.\n+ // Return error if requested quantity cannot be parsed.\n+ let num_requested: usize = serde_json::to_string(&quantity)?.parse()?;\n+\n+ // Check that the resource has enough healthy devices\nif !self\n- .is_device_plugin_resource(&resource_name, num_requested)\n+ .is_healthy_resource(&resource_name, num_requested)\n.await\n{\ncontinue;\n@@ -390,12 +403,10 @@ impl DeviceManager {\ncontainer_name: container_name.clone(),\ncontainer_allocate_request,\n}];\n- if let Some(all_container_requests) = all_allocate_requests.get_mut(&resource_name)\n- {\n- all_container_requests.append(&mut container_requests);\n- } else {\n- all_allocate_requests.insert(resource_name.clone(), container_requests);\n- }\n+ all_allocate_requests\n+ .entry(resource_name)\n+ .and_modify(|v| v.append(&mut container_requests))\n+ .or_insert(container_requests);\n}\n}\n@@ -450,31 +461,30 @@ impl DeviceManager {\n.client\n.allocate(Request::new(allocate_request))\n.await?;\n- let mut container_index = 0;\nallocate_response\n.into_inner()\n.container_responses\n.into_iter()\n- .for_each(|container_resp| {\n+ .enumerate()\n+ .for_each(|(i, container_resp)| {\nlet device_allocate_info = DeviceAllocateInfo {\n- device_ids: container_requests[container_index]\n+ device_ids: container_requests[i]\n.devices_i_ds\n.clone()\n.into_iter()\n.collect::<HashSet<String>>(),\nallocate_response: container_resp,\n};\n- let container_name = container_names[container_index];\n- if let Some(resource_allocate_info) = container_devices.get_mut(container_name)\n- {\n- resource_allocate_info.insert(resource_name.clone(), device_allocate_info);\n- } else {\n- let mut resource_allocate_info: HashMap<String, DeviceAllocateInfo> =\n- HashMap::new();\n- resource_allocate_info.insert(resource_name.clone(), device_allocate_info);\n- container_devices.insert(container_name.clone(), resource_allocate_info);\n- }\n- container_index += 1;\n+ container_devices\n+ .entry(container_names[i].clone())\n+ .and_modify(|m| {\n+ m.insert(resource_name.clone(), device_allocate_info.clone());\n+ })\n+ .or_insert_with(|| {\n+ let mut m = HashMap::new();\n+ m.insert(resource_name.clone(), device_allocate_info);\n+ m\n+ });\n});\n}\nself.pod_devices\n@@ -482,10 +492,14 @@ impl DeviceManager {\nOk(())\n}\n- /// Asserts that the resource is in the device map and has at least one healthy device.\n- /// Asserts that enough healthy devices are available.\n+ /// Checks that a resource with the given name exists in the device plugin map\n+ async fn is_device_plugin_resource(&self, resource_name: &str) -> bool {\n+ self.devices.lock().unwrap().get(resource_name).is_some()\n+ }\n+\n+ /// Asserts that the resource is in the device map and has at least `quantity` healthy devices.\n/// Later a check is made to make sure enough have not been allocated yet.\n- async fn is_device_plugin_resource(&self, resource_name: &str, quantity: usize) -> bool {\n+ async fn is_healthy_resource(&self, resource_name: &str, quantity: usize) -> bool {\nif let Some(resource_devices) = self.devices.lock().unwrap().get(resource_name) {\nif resource_devices\n.iter()\n@@ -593,8 +607,6 @@ impl DeviceManager {\n// TODO: support preferred allocation\n// For now, reserve first N devices where N = quantity by adding them to allocated map\nlet devices_to_allocate: Vec<String> = available_devices[..quantity].to_vec();\n- // ??: is there a cleaner way to map `allocated_devices.insert(dev.clone())` from bool to\n- // () so can remove {} block:\ndevices_to_allocate.iter().for_each(|dev| {\nallocated_devices.insert(dev.clone());\n});\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "new_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "diff": "@@ -22,14 +22,18 @@ pub type ContainerDevices = HashMap<String, ResourceAllocateInfo>;\n/// PodDevices contains the map of Pods to allocated devices\n#[derive(Clone)]\npub struct PodDevices {\n+ /// Name of the node this kubelet is running on\n+ node_name: String,\n/// Map of devices allocated to the Pod keyed by Pod UID\nallocated_devices: Arc<Mutex<HashMap<String, ContainerDevices>>>,\n+ /// Kubernetes API client for making Node status patches\nclient: kube::Client,\n}\nimpl PodDevices {\n- pub fn new(client: kube::Client) -> Self {\n+ pub fn new(node_name: &str, client: kube::Client) -> Self {\nPodDevices {\n+ node_name: node_name.to_string(),\nallocated_devices: Arc::new(Mutex::new(HashMap::new())),\nclient,\n}\n@@ -41,7 +45,9 @@ impl PodDevices {\npub async fn get_active_pods(&self) -> anyhow::Result<HashSet<String>> {\n// TODO: should this be namespaced?\nlet pod_client: Api<Pod> = Api::all(self.client.clone());\n- let pods = pod_client.list(&ListParams::default()).await?;\n+ let pods = pod_client\n+ .list(&ListParams::default().fields(&format!(\"spec.nodeName={}\", self.node_name)))\n+ .await?;\nOk(pods\n.iter()\n.map(|pod| {\n@@ -58,9 +64,9 @@ impl PodDevices {\nself.allocated_devices\n.lock()\n.unwrap()\n- .iter()\n- .map(|(p_uid, _container_map)| p_uid.clone())\n- .collect::<HashSet<String>>()\n+ .keys()\n+ .cloned()\n+ .collect()\n}\npub fn remove_pods(&self, pods_to_remove: HashSet<String>) -> anyhow::Result<()> {\n@@ -118,12 +124,12 @@ impl PodDevices {\n}\npub fn add_allocated_devices(&self, pod_uid: &str, container_devices: ContainerDevices) {\n- let mut allocated_devices = self.allocated_devices.lock().unwrap();\n- if let Some(pod_container_devices) = allocated_devices.get_mut(pod_uid) {\n- pod_container_devices.extend(container_devices);\n- } else {\n- allocated_devices.insert(pod_uid.to_string(), container_devices);\n- }\n+ self.allocated_devices\n+ .lock()\n+ .unwrap()\n+ .entry(pod_uid.to_string())\n+ .and_modify(|m| m.extend(container_devices.clone()))\n+ .or_insert(container_devices);\n}\n/// Returns all of the allocate responses for a Pod. Used to set mounts, env vars, annotations, and device specs for Pod.\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/allocated.rs", "new_path": "crates/kubelet/src/state/common/allocated.rs", "diff": "//! Resources can be successfully allocated to the Pod.\n-use crate::device_plugin_manager::resources;\n+use crate::device_plugin_manager::{resources, PodResourceRequests};\nuse crate::pod::state::prelude::*;\nuse crate::provider::DevicePluginSupport;\nuse crate::volume::{HostPathVolume, VolumeRef};\n@@ -41,16 +41,13 @@ impl<P: GenericProvider> State<P::PodState> for Allocated<P> {\npod: Manifest<Pod>,\n) -> Transition<P::PodState> {\nlet pod = pod.latest();\n- debug!(\n- \"Preparing to allocate resources for the pod: {}\",\n- pod.name()\n- );\n+ debug!(pod = %pod.name(), \"Preparing to allocate resources for this pod\");\nlet device_plugin_manager = provider_state.read().await.device_plugin_manager();\n// Only check for allocatable resources if a device plugin manager was provided.\nif let Some(device_plugin_manager) = device_plugin_manager {\n// Create a map of devices requested by this Pod's containers, keyed by container name\n- let mut container_devices: HashMap<String, HashMap<String, Quantity>> = HashMap::new();\n+ let mut container_devices: PodResourceRequests = HashMap::new();\nfor container in pod.all_containers() {\nif let Some(resources) = container.resources() {\nif let Some(requests) = &resources.requests {\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/lib.rs", "new_path": "crates/wasi-provider/src/lib.rs", "diff": "@@ -133,7 +133,10 @@ impl WasiProvider {\nlet log_path = config.data_dir.join(LOG_DIR_NAME);\nlet volume_path = config.data_dir.join(VOLUME_DIR);\nlet client = kube::Client::try_from(kubeconfig.clone())?;\n- let device_plugin_manager = Arc::new(DeviceManager::new_with_default_path(client, &config.node_name));\n+ let device_plugin_manager = Arc::new(DeviceManager::new_with_default_path(\n+ client,\n+ &config.node_name,\n+ ));\ntokio::fs::create_dir_all(&log_path).await?;\ntokio::fs::create_dir_all(&volume_path).await?;\nlet client = kube::Client::try_from(kubeconfig)?;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add node filter for PodDevices, iterator optimizations, and nits
350,448
07.06.2021 07:59:50
25,200
232413c45f4673c8a4c68044290dd5bb565bc500
upon registration, validate that device plugin has proper extended resource name
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "@@ -155,7 +155,8 @@ impl DeviceManager {\n/// answer YES to all of these):\n/// 1. Does this manager support the device plugin version? Currently only accepting `API_VERSION`.\n/// TODO: determine whether can support all versions prior to current `API_VERSION`.\n- /// 2. Is the plugin name available? 2a. If the name is already registered, is the endpoint the\n+ /// 2. Does the plugin have a valid extended resource name?\n+ /// 3. Is the plugin name available? 2a. If the name is already registered, is the endpoint the\n/// exact same? If it is, we allow it to reregister\nasync fn validate(&self, register_request: &RegisterRequest) -> Result<(), tonic::Status> {\ntrace!(\n@@ -163,6 +164,7 @@ impl DeviceManager {\nregister_request.resource_name,\nregister_request.endpoint\n);\n+\n// Validate that version matches the Device Plugin API version\nif register_request.version != API_VERSION {\nreturn Err(tonic::Status::new(\n@@ -174,9 +176,14 @@ impl DeviceManager {\n));\n};\n- // TODO: validate that plugin has proper extended resource name\n- // https://github.com/kubernetes/kubernetes/blob/ea0764452222146c47ec826977f49d7001b0ea8c/pkg/kubelet/cm/devicemanager/manager.go#L309\n- // TODO: validate that endpoint is in proper directory\n+ // Validate that plugin has proper extended resource name\n+ if !resources::is_extended_resource_name(&register_request.resource_name) {\n+ return Err(tonic::Status::new(\n+ tonic::Code::Unimplemented,\n+ format!(\n+ \"resource name {} is not properly formatted. See https://github.com/kubernetes/community/blob/master/contributors/design-proposals/scheduling/resources.md#resource-types\", register_request.resource_name)\n+ ));\n+ }\nself.validate_is_unique(register_request).await?;\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/resources.rs", "new_path": "crates/kubelet/src/device_plugin_manager/resources.rs", "diff": "//! explained in [this Kubernetes proposal](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/scheduling/resources.md#the-kubernetes-resource-model).\n// TODO: decide whether this should go under container or some container manager folder\nuse regex::{Regex, RegexBuilder};\n+use tracing::trace;\nconst QUALIFIED_NAME_MAX_LENGTH: usize = 63;\n// const QUALIFIED_NAME_CHAR_FMT: &str = \"[A-Za-z0-9]\";\n@@ -51,7 +52,7 @@ pub fn is_extended_resource_name(name: &str) -> bool {\nmatch is_qualified_name(&quota_resource_name) {\nOk(_) => true,\nErr(e) => {\n- println!(\n+ trace!(\n\"name {} does not qualify as an extended resource name due to {}\",\nname, e\n);\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
upon registration, validate that device plugin has proper extended resource name
350,448
07.06.2021 08:44:30
25,200
c349cf49cd4e8adeaa5e14456ff558ababeebe74
rename allocated state to be resources state and add transition from registered
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/resources.rs", "new_path": "crates/kubelet/src/device_plugin_manager/resources.rs", "diff": "@@ -54,7 +54,8 @@ pub fn is_extended_resource_name(name: &str) -> bool {\nErr(e) => {\ntrace!(\n\"name {} does not qualify as an extended resource name due to {}\",\n- name, e\n+ name,\n+ e\n);\nfalse\n}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/mod.rs", "new_path": "crates/kubelet/src/state/common/mod.rs", "diff": "@@ -9,12 +9,12 @@ use crate::provider::{DevicePluginSupport, PluginSupport, VolumeSupport};\nuse krator::{ObjectState, State};\nuse std::collections::HashMap;\n-pub mod allocated;\npub mod crash_loop_backoff;\npub mod error;\npub mod image_pull;\npub mod image_pull_backoff;\npub mod registered;\n+pub mod resources;\npub mod terminated;\npub mod volume_mount;\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/registered.rs", "new_path": "crates/kubelet/src/state/common/registered.rs", "diff": "@@ -4,7 +4,7 @@ use crate::pod::state::prelude::*;\nuse tracing::{debug, error, info, instrument};\nuse super::error::Error;\n-use super::image_pull::ImagePull;\n+use super::resources::Resources;\nuse super::GenericProvider;\n/// The Kubelet is aware of the Pod.\n@@ -53,7 +53,7 @@ impl<P: GenericProvider> State<P::PodState> for Registered<P> {\n}\n}\ninfo!(\"Pod registered\");\n- let next = ImagePull::<P>::default();\n+ let next = Resources::<P>::default();\nTransition::next(self, next)\n}\n@@ -63,4 +63,4 @@ impl<P: GenericProvider> State<P::PodState> for Registered<P> {\n}\nimpl<P: GenericProvider> TransitionTo<Error<P>> for Registered<P> {}\n-impl<P: GenericProvider> TransitionTo<ImagePull<P>> for Registered<P> {}\n+impl<P: GenericProvider> TransitionTo<Resources<P>> for Registered<P> {}\n" }, { "change_type": "RENAME", "old_path": "crates/kubelet/src/state/common/allocated.rs", "new_path": "crates/kubelet/src/state/common/resources.rs", "diff": "@@ -14,17 +14,17 @@ use super::image_pull::ImagePull;\nuse super::{GenericPodState, GenericProvider};\n/// Resources can be successfully allocated to the Pod\n-pub struct Allocated<P: GenericProvider> {\n+pub struct Resources<P: GenericProvider> {\nphantom: std::marker::PhantomData<P>,\n}\n-impl<P: GenericProvider> std::fmt::Debug for Allocated<P> {\n+impl<P: GenericProvider> std::fmt::Debug for Resources<P> {\nfn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n- \"Allocated\".fmt(formatter)\n+ \"Resources\".fmt(formatter)\n}\n}\n-impl<P: GenericProvider> Default for Allocated<P> {\n+impl<P: GenericProvider> Default for Resources<P> {\nfn default() -> Self {\nSelf {\nphantom: std::marker::PhantomData,\n@@ -33,7 +33,7 @@ impl<P: GenericProvider> Default for Allocated<P> {\n}\n#[async_trait::async_trait]\n-impl<P: GenericProvider> State<P::PodState> for Allocated<P> {\n+impl<P: GenericProvider> State<P::PodState> for Resources<P> {\nasync fn next(\nself: Box<Self>,\nprovider_state: SharedState<P::ProviderState>,\n@@ -107,7 +107,7 @@ impl<P: GenericProvider> State<P::PodState> for Allocated<P> {\npod_state.set_volumes(volumes).await;\n}\n- info!(\"Resources allocated to Pod: {}\", pod.name());\n+ info!(\"Resources resources to Pod: {}\", pod.name());\n}\nlet next = ImagePull::<P>::default();\n@@ -115,9 +115,9 @@ impl<P: GenericProvider> State<P::PodState> for Allocated<P> {\n}\nasync fn status(&self, _pod_state: &mut P::PodState, _pod: &Pod) -> anyhow::Result<PodStatus> {\n- Ok(make_status(Phase::Pending, \"Allocated\"))\n+ Ok(make_status(Phase::Pending, \"Resources\"))\n}\n}\n-impl<P: GenericProvider> TransitionTo<Error<P>> for Allocated<P> {}\n-impl<P: GenericProvider> TransitionTo<ImagePull<P>> for Allocated<P> {}\n+impl<P: GenericProvider> TransitionTo<Error<P>> for Resources<P> {}\n+impl<P: GenericProvider> TransitionTo<ImagePull<P>> for Resources<P> {}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
rename allocated state to be resources state and add transition from registered
350,448
08.06.2021 08:57:43
25,200
32a4267e8de80b8b3e94b52800fc2fcc3e0aacd5
create directory for device plugin manager if DNE
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "@@ -582,7 +582,8 @@ impl Registration for DeviceRegistry {\n/// specified in the `DeviceManager`.\n/// Returns an error if either the `NodePatcher` or `DeviceRegistry` error.\npub async fn serve_device_registry(device_manager: Arc<DeviceManager>) -> anyhow::Result<()> {\n- // TODO determine if need to create socket (and delete any previous ones)\n+ // Create plugin manager if it doesn't exist\n+ tokio::fs::create_dir_all(&device_manager.plugin_dir).await?;\nlet manager_socket = device_manager.plugin_dir.join(PLUGIN_MANGER_SOCKET_NAME);\nlet socket =\ngrpc_sock::server::Socket::new(&manager_socket).expect(\"couldn't make manager socket\");\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
create directory for device plugin manager if DNE
350,448
08.06.2021 15:43:55
25,200
0fdee2b81bf67e49a01c75dd176959dfa90b7b9a
rename Endpoint to PluginConnection
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -6,10 +6,10 @@ use crate::device_plugin_api::v1beta1::{\nuse crate::grpc_sock;\nuse crate::pod::Pod;\n-use super::endpoint::Endpoint;\nuse super::node_patcher::NodeStatusPatcher;\n+use super::plugin_connection::PluginConnection;\nuse super::pod_devices::{ContainerDevices, DeviceAllocateInfo, PodDevices};\n-use super::{DeviceIdMap, DeviceMap, EndpointDevicesMap, PodResourceRequests, HEALTHY};\n+use super::{DeviceIdMap, DeviceMap, PluginDevicesMap, PodResourceRequests, HEALTHY};\nuse std::collections::{HashMap, HashSet};\nuse std::path::{Path, PathBuf};\nuse std::sync::{Arc, Mutex};\n@@ -44,7 +44,7 @@ pub struct ContainerAllocateInfo {\n#[derive(Clone)]\npub struct DeviceManager {\n/// Map of registered device plugins, keyed by resource name\n- plugins: Arc<Mutex<HashMap<String, Arc<Endpoint>>>>,\n+ plugins: Arc<Mutex<HashMap<String, Arc<PluginConnection>>>>,\n/// Directory where the device plugin sockets live\npub(crate) plugin_dir: PathBuf,\n/// Contains all the devices advertised by all device plugins. Key is resource name.\n@@ -89,23 +89,23 @@ impl DeviceManager {\n}\n/// Adds the plugin to our HashMap\n- fn add_plugin(&self, endpoint: Arc<Endpoint>, resource_name: &str) {\n+ fn add_plugin(&self, plugin_connection: Arc<PluginConnection>, resource_name: &str) {\nlet mut lock = self.plugins.lock().unwrap();\n- lock.insert(resource_name.to_string(), endpoint);\n+ lock.insert(resource_name.to_string(), plugin_connection);\n}\n- /// Removes the Endpoint from our HashMap so long as it is the same as the one currently\n+ /// Removes the PluginConnection from our HashMap so long as it is the same as the one currently\n/// stored under the given resource name.\nfn remove_plugin(\n- plugins: Arc<Mutex<HashMap<String, Arc<Endpoint>>>>,\n+ plugins: Arc<Mutex<HashMap<String, Arc<PluginConnection>>>>,\nresource_name: &str,\n- endpoint: Arc<Endpoint>,\n+ plugin_connection: Arc<PluginConnection>,\n) {\nlet mut lock = plugins.lock().unwrap();\n- if let Some(old_endpoint) = lock.get(resource_name) {\n+ if let Some(old_plugin_connection) = lock.get(resource_name) {\n// TODO: partialEq only checks that reg requests are identical. May also want\n// to check match of other fields.\n- if *old_endpoint == endpoint {\n+ if *old_plugin_connection == plugin_connection {\nlock.remove(resource_name);\n}\n}\n@@ -117,7 +117,7 @@ impl DeviceManager {\n/// 1. Does this manager support the device plugin version? Currently only accepting `API_VERSION`.\n/// TODO: determine whether can support all versions prior to current `API_VERSION`.\n/// 2. Does the plugin have a valid extended resource name?\n- /// 3. Is the plugin name available? 2a. If the name is already registered, is the endpoint the\n+ /// 3. Is the plugin name available? 2a. If the name is already registered, is the plugin_connection the\n/// exact same? If it is, we allow it to reregister\npub(crate) async fn validate(\n&self,\n@@ -178,8 +178,8 @@ impl DeviceManager {\n}\n/// This creates a connection to a device plugin by calling it's ListAndWatch function.\n- /// Upon a successful connection, an `Endpoint` is added to the `plugins` map.\n- pub(crate) async fn create_endpoint(\n+ /// Upon a successful connection, an `PluginConnection` is added to the `plugins` map.\n+ pub(crate) async fn create_plugin_connection(\n&self,\nregister_request: RegisterRequest,\n) -> anyhow::Result<()> {\n@@ -190,24 +190,24 @@ impl DeviceManager {\nlet chan = grpc_sock::client::socket_channel(register_request.endpoint.clone()).await?;\nlet client = DevicePluginClient::new(chan);\n- // Clone structures for Endpoint thread\n+ // Clone structures for PluginConnection thread\nlet all_devices = self.devices.clone();\nlet update_node_status_sender = self.update_node_status_sender.clone();\nlet resource_name = register_request.resource_name.clone();\n- let endpoint = Arc::new(Endpoint::new(client, register_request));\n+ let plugin_connection = Arc::new(PluginConnection::new(client, register_request));\nlet plugins = self.plugins.clone();\nlet devices = self.devices.clone();\n- self.add_plugin(endpoint.clone(), &resource_name);\n+ self.add_plugin(plugin_connection.clone(), &resource_name);\n// TODO: decide whether to join/store all spawned ListAndWatch threads\ntokio::spawn(async move {\n- endpoint\n+ plugin_connection\n.start(all_devices, update_node_status_sender.clone())\n.await;\n- endpoint.stop().await;\n+ plugin_connection.stop().await;\n- DeviceManager::remove_plugin(plugins, &resource_name, endpoint);\n+ DeviceManager::remove_plugin(plugins, &resource_name, plugin_connection);\n// ?? Should devices be marked unhealthy first?\nDeviceManager::remove_resource(devices, &resource_name);\n@@ -316,7 +316,7 @@ impl DeviceManager {\n) -> anyhow::Result<()> {\nlet mut container_devices: ContainerDevices = HashMap::new();\nfor (resource_name, container_allocate_info) in all_allocate_requests {\n- let endpoint = self\n+ let plugin_connection = self\n.plugins\n.lock()\n.unwrap()\n@@ -336,7 +336,7 @@ impl DeviceManager {\nlet allocate_request = AllocateRequest {\ncontainer_requests: container_requests.clone(),\n};\n- let allocate_response = endpoint.allocate(allocate_request).await?;\n+ let allocate_response = plugin_connection.allocate(allocate_request).await?;\nallocate_response\n.into_inner()\n.container_responses\n@@ -478,8 +478,8 @@ impl DeviceManager {\n));\n}\n- // let endpoint = self.plugins.lock().unwrap().get(resource_name).unwrap().clone();\n- // let get_preferred_allocation_available = match &endpoint.register_request.options {\n+ // let plugin_connection = self.plugins.lock().unwrap().get(resource_name).unwrap().clone();\n+ // let get_preferred_allocation_available = match &plugin_connection.register_request.options {\n// None => false,\n// Some(options) => options.get_preferred_allocation_available,\n// };\n@@ -502,7 +502,7 @@ impl DeviceManager {\n/// Returns the device IDs of all healthy devices that have yet to be allocated.\nfn get_available_devices(\n- devices: &EndpointDevicesMap,\n+ devices: &PluginDevicesMap,\nallocated_devices: &HashSet<String>,\n) -> Vec<String> {\nlet healthy_devices = devices\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "//! The Kubelet device plugin manager. Consists of a `DeviceRegistry` that hosts a registration service for device plugins, a `DeviceManager` that maintains a device plugin client for each registered device plugin, a `NodePatcher` that patches the Node status with the extended resources advertised by device plugins, and a `PodDevices` that maintains a list of Pods that are actively using allocated resources.\n-pub(crate) mod endpoint;\npub mod manager;\npub(crate) mod node_patcher;\n+pub(crate) mod plugin_connection;\npub(crate) mod pod_devices;\npub mod resources;\nuse crate::device_plugin_api::v1beta1::{\n@@ -22,16 +22,16 @@ const PLUGIN_MANGER_SOCKET_NAME: &str = \"kubelet.sock\";\n/// `DeviceIdMap` contains the device Ids of all the devices advertised by device plugins.\n/// Key is resource name.\n-type DeviceIdMap = HashMap<String, EndpointDeviceIds>;\n+type DeviceIdMap = HashMap<String, PluginDeviceIds>;\n-/// `EndpointDeviceIds` contains the IDs of all the devices advertised by a single device plugin\n-type EndpointDeviceIds = HashSet<String>;\n+/// `PluginDeviceIds` contains the IDs of all the devices advertised by a single device plugin\n+type PluginDeviceIds = HashSet<String>;\n/// `DeviceMap` contains all the devices advertised by all device plugins. Key is resource name.\n-type DeviceMap = HashMap<String, EndpointDevicesMap>;\n+type DeviceMap = HashMap<String, PluginDevicesMap>;\n-/// `EndpointDevicesMap` contains all of the devices advertised by a single device plugin. Key is device ID.\n-type EndpointDevicesMap = HashMap<String, Device>;\n+/// `PluginDevicesMap` contains all of the devices advertised by a single device plugin. Key is device ID.\n+type PluginDevicesMap = HashMap<String, Device>;\n/// Map of resources requested by a Container. Key is resource name and value is requested quantity of the resource\ntype ContainerResourceRequests = HashMap<String, Quantity>;\n@@ -75,7 +75,7 @@ impl Registration for DeviceRegistry {\n// Create a list and watch connection with the device plugin\n// TODO: should the manager keep track of threads?\nself.device_manager\n- .create_endpoint(register_request)\n+ .create_plugin_connection(register_request)\n.await\n.map_err(|e| tonic::Status::new(tonic::Code::NotFound, format!(\"{}\", e)))?;\nOk(tonic::Response::new(Empty {}))\n@@ -159,7 +159,7 @@ pub mod test_utils {\n}\npub fn create_mock_healthy_devices(r1_name: &str, r2_name: &str) -> Arc<Mutex<DeviceMap>> {\n- let r1_devices: EndpointDevicesMap = (0..3)\n+ let r1_devices: PluginDevicesMap = (0..3)\n.map(|x| Device {\nid: format!(\"{}-id{}\", r1_name, x),\nhealth: HEALTHY.to_string(),\n@@ -168,7 +168,7 @@ pub mod test_utils {\n.map(|d| (d.id.clone(), d))\n.collect();\n- let r2_devices: EndpointDevicesMap = (0..2)\n+ let r2_devices: PluginDevicesMap = (0..2)\n.map(|x| Device {\nid: format!(\"{}-id{}\", r2_name, x),\nhealth: HEALTHY.to_string(),\n" }, { "change_type": "RENAME", "old_path": "crates/kubelet/src/device_plugin_manager/endpoint.rs", "new_path": "crates/kubelet/src/device_plugin_manager/plugin_connection.rs", "diff": "@@ -10,10 +10,10 @@ use tokio::sync::Mutex as AsyncMutex;\nuse tonic::Request;\nuse tracing::{error, trace};\n-/// Endpoint that maps to a single registered device plugin.\n+/// PluginConnection that maps to a single registered device plugin.\n/// It is responsible for managing gRPC communications with the device plugin and caching\n/// device states reported by the device plugin\n-pub struct Endpoint {\n+pub struct PluginConnection {\n/// Client that is connected to the device plugin\nclient: DevicePluginClient<tonic::transport::Channel>,\n/// `RegisterRequest` received when the device plugin registered with the DeviceRegistry\n@@ -22,12 +22,12 @@ pub struct Endpoint {\nstop_connection: Arc<AsyncMutex<bool>>,\n}\n-impl Endpoint {\n+impl PluginConnection {\npub fn new(\nclient: DevicePluginClient<tonic::transport::Channel>,\nregister_request: RegisterRequest,\n) -> Self {\n- Endpoint {\n+ PluginConnection {\nclient,\nregister_request,\nstop_connection: Arc::new(AsyncMutex::new(false)),\n@@ -74,7 +74,7 @@ impl Endpoint {\n.into_inner();\nlet mut previous_law_devices: HashMap<String, Device> = HashMap::new();\nwhile let Some(response) = stream.message().await? {\n- if Endpoint::update_devices_map(\n+ if update_devices_map(\n&self.register_request.resource_name,\ndevices.clone(),\n&mut previous_law_devices,\n@@ -91,6 +91,17 @@ impl Endpoint {\nOk(())\n}\n+ pub async fn allocate(\n+ &self,\n+ allocate_request: AllocateRequest,\n+ ) -> Result<tonic::Response<AllocateResponse>, tonic::Status> {\n+ self.client\n+ .clone()\n+ .allocate(Request::new(allocate_request))\n+ .await\n+ }\n+}\n+\n/// This updates the shared device map with the new devices reported by the device plugin.\n/// This iterates through the latest devices, comparing them with the previously reported devices and\n/// updates the shared device map if:\n@@ -172,18 +183,7 @@ impl Endpoint {\nupdate_node_status\n}\n- pub async fn allocate(\n- &self,\n- allocate_request: AllocateRequest,\n- ) -> Result<tonic::Response<AllocateResponse>, tonic::Status> {\n- self.client\n- .clone()\n- .allocate(Request::new(allocate_request))\n- .await\n- }\n-}\n-\n-impl PartialEq for Endpoint {\n+impl PartialEq for PluginConnection {\nfn eq(&self, other: &Self) -> bool {\nself.register_request == other.register_request\n}\n@@ -208,7 +208,7 @@ pub mod tests {\ndevices: devices_vec.clone(),\n};\nlet new_previous_law_devices = devices_vec.into_iter().map(|d| (d.id.clone(), d)).collect();\n- assert!(Endpoint::update_devices_map(\n+ assert!(update_devices_map(\nr1_name,\ndevices_map.clone(),\n&mut previous_law_devices,\n@@ -245,7 +245,7 @@ pub mod tests {\ndevices: devices_vec.clone(),\n};\nlet new_previous_law_devices = devices_vec.into_iter().map(|d| (d.id.clone(), d)).collect();\n- assert!(Endpoint::update_devices_map(\n+ assert!(update_devices_map(\nr1_name,\ndevices_map.clone(),\n&mut previous_law_devices,\n@@ -277,7 +277,7 @@ pub mod tests {\ndevices: devices_vec.clone(),\n};\nlet new_previous_law_devices = devices_vec.into_iter().map(|d| (d.id.clone(), d)).collect();\n- assert!(Endpoint::update_devices_map(\n+ assert!(update_devices_map(\nr1_name,\ndevices_map.clone(),\n&mut previous_law_devices,\n@@ -304,7 +304,7 @@ pub mod tests {\nlet response = ListAndWatchResponse {\ndevices: devices_vec,\n};\n- assert!(!Endpoint::update_devices_map(\n+ assert!(!update_devices_map(\nr1_name,\ndevices_map.clone(),\n&mut previous_law_devices,\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
rename Endpoint to PluginConnection
350,448
08.06.2021 20:36:14
25,200
e06c083e0ef0b76bb1c178fd8b4a86c556dc9a2e
remove associated functions from DeviceManager
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -94,23 +94,6 @@ impl DeviceManager {\nlock.insert(resource_name.to_string(), plugin_connection);\n}\n- /// Removes the PluginConnection from our HashMap so long as it is the same as the one currently\n- /// stored under the given resource name.\n- fn remove_plugin(\n- plugins: Arc<Mutex<HashMap<String, Arc<PluginConnection>>>>,\n- resource_name: &str,\n- plugin_connection: Arc<PluginConnection>,\n- ) {\n- let mut lock = plugins.lock().unwrap();\n- if let Some(old_plugin_connection) = lock.get(resource_name) {\n- // TODO: partialEq only checks that reg requests are identical. May also want\n- // to check match of other fields.\n- if *old_plugin_connection == plugin_connection {\n- lock.remove(resource_name);\n- }\n- }\n- }\n-\n/// Validates the given plugin info gathered from a discovered plugin, returning an error with\n/// additional information if it is not valid. This will validate 3 specific things (should\n/// answer YES to all of these):\n@@ -205,12 +188,10 @@ impl DeviceManager {\n.start(all_devices, update_node_status_sender.clone())\n.await;\n- plugin_connection.stop().await;\n-\n- DeviceManager::remove_plugin(plugins, &resource_name, plugin_connection);\n+ remove_plugin(plugins, &resource_name, plugin_connection);\n// ?? Should devices be marked unhealthy first?\n- DeviceManager::remove_resource(devices, &resource_name);\n+ remove_resource(devices, &resource_name);\n// Update nodes status with devices removed\nupdate_node_status_sender.send(()).unwrap();\n@@ -219,20 +200,6 @@ impl DeviceManager {\nOk(())\n}\n- /// Removed all devices of a resource from our shared device map.\n- fn remove_resource(devices: Arc<Mutex<DeviceMap>>, resource_name: &str) {\n- match devices.lock().unwrap().remove(resource_name) {\n- Some(_) => trace!(\n- \"All devices of resource {} have been removed\",\n- resource_name\n- ),\n- None => trace!(\n- \"All devices of resource {} were already removed\",\n- resource_name\n- ),\n- }\n- }\n-\n/// This is the call that you can use to allocate a set of devices\n/// from the registered device plugins.\n/// Takes in a map of devices requested by containers, keyed by container name.\n@@ -521,3 +488,34 @@ fn get_available_devices(\n.cloned()\n.collect::<Vec<String>>()\n}\n+\n+/// Removes the PluginConnection from our HashMap so long as it is the same as the one currently\n+/// stored under the given resource name.\n+fn remove_plugin(\n+ plugins: Arc<Mutex<HashMap<String, Arc<PluginConnection>>>>,\n+ resource_name: &str,\n+ plugin_connection: Arc<PluginConnection>,\n+) {\n+ let mut lock = plugins.lock().unwrap();\n+ if let Some(old_plugin_connection) = lock.get(resource_name) {\n+ // TODO: partialEq only checks that reg requests are identical. May also want\n+ // to check match of other fields.\n+ if *old_plugin_connection == plugin_connection {\n+ lock.remove(resource_name);\n+ }\n+ }\n+}\n+\n+/// Removed all devices of a resource from our shared device map.\n+fn remove_resource(devices: Arc<Mutex<DeviceMap>>, resource_name: &str) {\n+ match devices.lock().unwrap().remove(resource_name) {\n+ Some(_) => trace!(\n+ \"All devices of resource {} have been removed\",\n+ resource_name\n+ ),\n+ None => trace!(\n+ \"All devices of resource {} were already removed\",\n+ resource_name\n+ ),\n+ }\n+}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
remove associated functions from DeviceManager
350,448
08.06.2021 20:38:47
25,200
48807d8c72226f9ad0dadc64c712511db9c87d3a
remove termination case from PluginConnection
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/plugin_connection.rs", "new_path": "crates/kubelet/src/device_plugin_manager/plugin_connection.rs", "diff": "@@ -6,7 +6,6 @@ use crate::device_plugin_api::v1beta1::{\nuse std::collections::HashMap;\nuse std::sync::{Arc, Mutex};\nuse tokio::sync::broadcast;\n-use tokio::sync::Mutex as AsyncMutex;\nuse tonic::Request;\nuse tracing::{error, trace};\n@@ -18,8 +17,6 @@ pub struct PluginConnection {\nclient: DevicePluginClient<tonic::transport::Channel>,\n/// `RegisterRequest` received when the device plugin registered with the DeviceRegistry\nregister_request: RegisterRequest,\n- /// Boolean for signaling that the ListAndWatch connection with the channel should be closed\n- stop_connection: Arc<AsyncMutex<bool>>,\n}\nimpl PluginConnection {\n@@ -30,7 +27,6 @@ impl PluginConnection {\nPluginConnection {\nclient,\nregister_request,\n- stop_connection: Arc::new(AsyncMutex::new(false)),\n}\n}\n@@ -52,10 +48,6 @@ impl PluginConnection {\n}\n}\n- pub async fn stop(&self) {\n- *self.stop_connection.lock().await = true;\n- }\n-\n/// Connects to a device plugin's ListAndWatch service.\n/// The device plugin updates this client periodically about changes in the capacity and health of its resource.\n/// Upon updates, this propagates any changes into the `plugins` map and triggers the `NodePatcher` to\n@@ -83,9 +75,6 @@ impl PluginConnection {\n// TODO handle error -- maybe channel is full\nupdate_node_status_sender.send(()).unwrap();\n}\n- if *self.stop_connection.lock().await {\n- break;\n- }\n}\nOk(())\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
remove termination case from PluginConnection
350,448
09.06.2021 09:51:43
25,200
716fa458cb8bb8cf1248fa95ce2c00a1426a98ab
add additional in line comments, manager allocate tests
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -275,7 +275,7 @@ impl DeviceManager {\n///\n/// Note, say DP1 and DP2 are registered for R1 and R2 respectively. If the allocate call to DP1 for R1 succeeds\n/// but the allocate call to DP2 for R2 fails, DP1 will have completed any allocation steps it performs despite the fact that the\n- /// Pod will not be scheduled due to R2 not being an available resource.\n+ /// Pod will not be scheduled due to R2 not being an available resource. This is expected behavior with the device plugin interface.\nasync fn do_allocate_for_pod(\n&self,\npod_uid: &str,\n@@ -303,10 +303,21 @@ impl DeviceManager {\nlet allocate_request = AllocateRequest {\ncontainer_requests: container_requests.clone(),\n};\n- let allocate_response = plugin_connection.allocate(allocate_request).await?;\n- allocate_response\n+ let container_responses = plugin_connection\n+ .allocate(allocate_request)\n+ .await?\n.into_inner()\n- .container_responses\n+ .container_responses;\n+\n+ // By doing one allocate call per Pod, an assumption is being made that the container requests array (sent to a DP)\n+ // and container responses array returned are the same length. This is not documented in the DP API. However Kubernetes has a\n+ // TODO (https://github.com/kubernetes/kubernetes/blob/d849d9d057369121fc43aa3359059471e1ca9d1c/pkg/kubelet/cm/devicemanager/manager.go#L916)\n+ // to use the same one call implementation.\n+ if container_requests.len() != container_responses.len() {\n+ return Err(anyhow::anyhow!(\"Container responses returned from allocate are not the same length as container requests\"));\n+ }\n+\n+ container_responses\n.into_iter()\n.enumerate()\n.for_each(|(i, container_resp)| {\n@@ -519,3 +530,286 @@ fn remove_resource(devices: Arc<Mutex<DeviceMap>>, resource_name: &str) {\n),\n}\n}\n+\n+#[cfg(test)]\n+mod tests {\n+ use super::super::{test_utils, PLUGIN_MANGER_SOCKET_NAME, UNHEALTHY};\n+ use super::*;\n+ use crate::device_plugin_api::v1beta1::{\n+ device_plugin_server::{DevicePlugin, DevicePluginServer},\n+ registration_client, AllocateRequest, AllocateResponse, Device, DevicePluginOptions, Empty,\n+ ListAndWatchResponse, PreStartContainerRequest, PreStartContainerResponse,\n+ PreferredAllocationRequest, PreferredAllocationResponse, API_VERSION,\n+ };\n+ use futures::Stream;\n+ use std::pin::Pin;\n+ use tokio::sync::{mpsc, watch};\n+ use tonic::{Request, Response, Status};\n+\n+ /// Mock Device Plugin for testing the DeviceManager\n+ /// Sends a new list of devices to the DeviceManager whenever it's `devices_receiver`\n+ /// is notified of them on a channel.\n+ struct MockDevicePlugin {\n+ // Using watch so the receiver can be cloned and be moved into a spawned thread in ListAndWatch\n+ devices_receiver: watch::Receiver<Vec<Device>>,\n+ }\n+\n+ #[async_trait::async_trait]\n+ impl DevicePlugin for MockDevicePlugin {\n+ async fn get_device_plugin_options(\n+ &self,\n+ _request: Request<Empty>,\n+ ) -> Result<Response<DevicePluginOptions>, Status> {\n+ unimplemented!();\n+ }\n+\n+ type ListAndWatchStream = Pin<\n+ Box<dyn Stream<Item = Result<ListAndWatchResponse, Status>> + Send + Sync + 'static>,\n+ >;\n+ async fn list_and_watch(\n+ &self,\n+ _request: Request<Empty>,\n+ ) -> Result<Response<Self::ListAndWatchStream>, Status> {\n+ println!(\"list_and_watch entered\");\n+ // Create a channel that list_and_watch can periodically send updates to kubelet on\n+ let (kubelet_update_sender, kubelet_update_receiver) = mpsc::channel(3);\n+ let mut devices_receiver = self.devices_receiver.clone();\n+ tokio::spawn(async move {\n+ while devices_receiver.changed().await.is_ok() {\n+ let devices = devices_receiver.borrow().clone();\n+ println!(\n+ \"list_and_watch received new devices [{:?}] to send\",\n+ devices\n+ );\n+ kubelet_update_sender\n+ .send(Ok(ListAndWatchResponse { devices }))\n+ .await\n+ .unwrap();\n+ }\n+ });\n+ Ok(Response::new(Box::pin(\n+ tokio_stream::wrappers::ReceiverStream::new(kubelet_update_receiver),\n+ )))\n+ }\n+\n+ async fn get_preferred_allocation(\n+ &self,\n+ _request: Request<PreferredAllocationRequest>,\n+ ) -> Result<Response<PreferredAllocationResponse>, Status> {\n+ unimplemented!();\n+ }\n+\n+ async fn allocate(\n+ &self,\n+ request: Request<AllocateRequest>,\n+ ) -> Result<Response<AllocateResponse>, Status> {\n+ let allocate_request = request.into_inner();\n+ let container_responses: Vec<ContainerAllocateResponse> = allocate_request\n+ .container_requests\n+ .into_iter()\n+ .map(|_| ContainerAllocateResponse {\n+ ..Default::default()\n+ })\n+ .collect();\n+ Ok(Response::new(AllocateResponse {\n+ container_responses,\n+ }))\n+ }\n+\n+ async fn pre_start_container(\n+ &self,\n+ _request: Request<PreStartContainerRequest>,\n+ ) -> Result<Response<PreStartContainerResponse>, Status> {\n+ Ok(Response::new(PreStartContainerResponse {}))\n+ }\n+ }\n+\n+ /// Serves the mock DP and returns its socket path\n+ async fn run_mock_device_plugin(\n+ devices_receiver: watch::Receiver<Vec<Device>>,\n+ ) -> anyhow::Result<String> {\n+ // Device plugin temp socket deleted when it goes out of scope\n+ // so create it in thread and return with a channel\n+ let (tx, rx) = tokio::sync::oneshot::channel();\n+ tokio::task::spawn(async move {\n+ let device_plugin_temp_dir =\n+ tempfile::tempdir().expect(\"should be able to create tempdir\");\n+ let socket_name = \"gpu-device-plugin.sock\";\n+ let dp_socket = device_plugin_temp_dir\n+ .path()\n+ .join(socket_name)\n+ .to_str()\n+ .unwrap()\n+ .to_string();\n+ tx.send(dp_socket.clone()).unwrap();\n+ let device_plugin = MockDevicePlugin { devices_receiver };\n+ let socket =\n+ grpc_sock::server::Socket::new(&dp_socket).expect(\"couldnt make dp socket\");\n+ let serv = tonic::transport::Server::builder()\n+ .add_service(DevicePluginServer::new(device_plugin))\n+ .serve_with_incoming(socket);\n+ #[cfg(target_family = \"windows\")]\n+ let serv = serv.compat();\n+ serv.await.expect(\"Unable to serve mock device plugin\");\n+ });\n+ Ok(rx.await.unwrap())\n+ }\n+\n+ /// Registers the mock DP with the DeviceManager's registration service\n+ async fn register_mock_device_plugin(\n+ kubelet_socket: String,\n+ dp_socket: &str,\n+ dp_resource_name: &str,\n+ ) -> anyhow::Result<()> {\n+ let op = DevicePluginOptions {\n+ get_preferred_allocation_available: false,\n+ pre_start_required: false,\n+ };\n+ let channel = grpc_sock::client::socket_channel(kubelet_socket).await?;\n+ let mut registration_client = registration_client::RegistrationClient::new(channel);\n+ let register_request = tonic::Request::new(RegisterRequest {\n+ version: API_VERSION.into(),\n+ endpoint: dp_socket.to_string(),\n+ resource_name: dp_resource_name.to_string(),\n+ options: Some(op),\n+ });\n+ registration_client\n+ .register(register_request)\n+ .await\n+ .unwrap();\n+ Ok(())\n+ }\n+\n+ /// Tests e2e flow of kicked off by a mock DP registering with the DeviceManager\n+ /// DeviceManager should call ListAndWatch on the DP, update it's devices registry with the DP's\n+ /// devices, and instruct it's NodePatcher to patch the node status with the new DP resources.\n+ #[tokio::test]\n+ async fn do_device_manager_test() {\n+ // There doesn't seem to be a way to use the same temp dir for manager and mock dp due to being able to\n+ // pass the temp dir reference to multiple threads\n+ // Instead, create a temp dir for the DP manager and the mock DP\n+ let manager_temp_dir = tempfile::tempdir().expect(\"should be able to create tempdir\");\n+\n+ // Capture the DP and DP manager socket paths\n+ let manager_socket = manager_temp_dir\n+ .path()\n+ .join(PLUGIN_MANGER_SOCKET_NAME)\n+ .to_str()\n+ .unwrap()\n+ .to_string();\n+\n+ // Make 3 mock devices\n+ let d1 = Device {\n+ id: \"d1\".to_string(),\n+ health: HEALTHY.to_string(),\n+ topology: None,\n+ };\n+ let d2 = Device {\n+ id: \"d2\".to_string(),\n+ health: HEALTHY.to_string(),\n+ topology: None,\n+ };\n+ let d3 = Device {\n+ id: \"d3\".to_string(),\n+ health: UNHEALTHY.to_string(),\n+ topology: None,\n+ };\n+\n+ // Start the mock device plugin without any devices\n+ let devices: Vec<Device> = Vec::new();\n+ let (devices_sender, devices_receiver) = watch::channel(devices);\n+\n+ // Run the mock device plugin\n+ let dp_socket = run_mock_device_plugin(devices_receiver).await.unwrap();\n+\n+ // Name of \"this node\" that should be patched with Device Plugin resources\n+ let test_node_name = \"test_node\";\n+ // Create and run a mock Kubernetes API service and get a Kubernetes client\n+ let (client, _mock_service_task) =\n+ test_utils::create_mock_kube_service(test_node_name).await;\n+\n+ // Create and serve a DeviceManager\n+ let device_manager = Arc::new(DeviceManager::new(\n+ manager_temp_dir.path(),\n+ client,\n+ test_node_name,\n+ ));\n+ let devices = device_manager.devices.clone();\n+ let _manager_task = tokio::task::spawn(async move {\n+ super::super::serve_device_registry(device_manager)\n+ .await\n+ .unwrap();\n+ });\n+ tokio::time::sleep(std::time::Duration::from_secs(1)).await;\n+\n+ // Register the mock device plugin with the DeviceManager's Registration service\n+ let dp_resource_name = \"example.com/mock-device-plugin\";\n+ register_mock_device_plugin(manager_socket.to_string(), &dp_socket, dp_resource_name)\n+ .await\n+ .unwrap();\n+\n+ // Make DP report 2 healthy and 1 unhealthy device\n+ devices_sender.send(vec![d1, d2, d3]).unwrap();\n+\n+ let mut x: i8 = 0;\n+ let mut num_devices: i8 = 0;\n+ while x < 3 {\n+ tokio::time::sleep(std::time::Duration::from_secs(1)).await;\n+ // Assert that there are 3 devices in the map now\n+ if let Some(resource_devices_map) = devices.lock().unwrap().get(dp_resource_name) {\n+ if resource_devices_map.len() == 3 {\n+ num_devices = 3;\n+ break;\n+ }\n+ }\n+ x += 1;\n+ }\n+ assert_eq!(num_devices, 3);\n+ }\n+\n+ fn build_container_allocate_info(\n+ devices_i_ds: Vec<String>,\n+ container_name: &str,\n+ ) -> ContainerAllocateInfo {\n+ let container_allocate_request = ContainerAllocateRequest { devices_i_ds };\n+ ContainerAllocateInfo {\n+ container_allocate_request,\n+ container_name: container_name.to_string(),\n+ }\n+ }\n+\n+ fn create_device_manager(node_name: &str) -> DeviceManager {\n+ let client = test_utils::mock_client();\n+ DeviceManager::new_with_default_path(client, node_name)\n+ }\n+\n+ // Pod with 2 Containers each requesting 2 devices of the same resource\n+ #[tokio::test]\n+ async fn test_do_allocate_for_pod() {\n+ let resource_name = \"resource_name\";\n+ let cont_a_device_ids = vec![\"id1\".to_string(), \"id2\".to_string()];\n+ let cont_a_alloc_info = build_container_allocate_info(cont_a_device_ids, \"containerA\");\n+ let cont_b_device_ids = vec![\"id3\".to_string(), \"id4\".to_string()];\n+ let cont_b_alloc_info = build_container_allocate_info(cont_b_device_ids, \"containerB\");\n+ let mut all_reqs = HashMap::new();\n+ all_reqs.insert(\n+ resource_name.to_string(),\n+ vec![cont_a_alloc_info, cont_b_alloc_info],\n+ );\n+ let (_devices_sender, devices_receiver) = watch::channel(Vec::new());\n+\n+ let dp_socket = run_mock_device_plugin(devices_receiver).await.unwrap();\n+ tokio::time::sleep(std::time::Duration::from_secs(1)).await;\n+ let dm = create_device_manager(\"some_node\");\n+ dm.create_plugin_connection(RegisterRequest {\n+ endpoint: dp_socket,\n+ resource_name: resource_name.to_string(),\n+ ..Default::default()\n+ })\n+ .await\n+ .unwrap();\n+ dm.do_allocate_for_pod(\"pod_uid\", all_reqs).await.unwrap();\n+ // Assert that two responses were stored in `PodDevices`, one for each ContainerAllocateRequest\n+ assert_eq!(dm.get_pod_allocate_responses(\"pod_uid\").unwrap().len(), 2);\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "@@ -18,7 +18,7 @@ use tokio::task;\nuse tokio_compat_02::FutureExt;\nuse tonic::transport::Server;\n-const PLUGIN_MANGER_SOCKET_NAME: &str = \"kubelet.sock\";\n+pub(crate) const PLUGIN_MANGER_SOCKET_NAME: &str = \"kubelet.sock\";\n/// `DeviceIdMap` contains the device Ids of all the devices advertised by device plugins.\n/// Key is resource name.\n@@ -43,7 +43,7 @@ pub type PodResourceRequests = HashMap<String, ContainerResourceRequests>;\nconst HEALTHY: &str = \"Healthy\";\n/// Unhealthy means the device is not allocatable\n-const UNHEALTHY: &str = \"Unhealthy\";\n+pub(crate) const UNHEALTHY: &str = \"Unhealthy\";\n/// Hosts the device plugin `Registration` service (defined in the device plugin API) for a `DeviceManager`.\n/// Upon device plugin registration, reaches out to its `DeviceManager` to validate the device plugin\n@@ -117,9 +117,17 @@ pub mod test_utils {\nuse http::{Request as HttpRequest, Response as HttpResponse};\nuse hyper::Body;\nuse kube::Client;\n+ use std::convert::TryFrom;\nuse std::sync::Mutex;\nuse tower_test::mock;\n+ pub fn mock_client() -> kube::Client {\n+ kube::Client::try_from(kube::Config::new(\n+ reqwest::Url::parse(\"http://127.0.0.1:8080\").unwrap(),\n+ ))\n+ .unwrap()\n+ }\n+\n/// Creates a mock kubernetes API service that the NodePatcher calls to when device plugin resources\n/// need to be updated in the Node status.\n/// It verifies the request and always returns a fake Node.\n@@ -188,229 +196,3 @@ pub mod test_utils {\nArc::new(Mutex::new(device_map))\n}\n}\n-\n-#[cfg(test)]\n-mod tests {\n- use super::*;\n- use crate::device_plugin_api::v1beta1::{\n- device_plugin_server::{DevicePlugin, DevicePluginServer},\n- registration_client, AllocateRequest, AllocateResponse, DevicePluginOptions, Empty,\n- ListAndWatchResponse, PreStartContainerRequest, PreStartContainerResponse,\n- PreferredAllocationRequest, PreferredAllocationResponse, API_VERSION,\n- };\n- use futures::Stream;\n- use std::pin::Pin;\n- use tokio::sync::{mpsc, watch};\n- use tonic::{Request, Response, Status};\n-\n- /// Mock Device Plugin for testing the DeviceManager\n- /// Sends a new list of devices to the DeviceManager whenever it's `devices_receiver`\n- /// is notified of them on a channel.\n- struct MockDevicePlugin {\n- // Using watch so the receiver can be cloned and be moved into a spawned thread in ListAndWatch\n- devices_receiver: watch::Receiver<Vec<Device>>,\n- }\n-\n- #[async_trait::async_trait]\n- impl DevicePlugin for MockDevicePlugin {\n- async fn get_device_plugin_options(\n- &self,\n- _request: Request<Empty>,\n- ) -> Result<Response<DevicePluginOptions>, Status> {\n- unimplemented!();\n- }\n-\n- type ListAndWatchStream = Pin<\n- Box<dyn Stream<Item = Result<ListAndWatchResponse, Status>> + Send + Sync + 'static>,\n- >;\n- async fn list_and_watch(\n- &self,\n- _request: Request<Empty>,\n- ) -> Result<Response<Self::ListAndWatchStream>, Status> {\n- println!(\"list_and_watch entered\");\n- // Create a channel that list_and_watch can periodically send updates to kubelet on\n- let (kubelet_update_sender, kubelet_update_receiver) = mpsc::channel(3);\n- let mut devices_receiver = self.devices_receiver.clone();\n- tokio::spawn(async move {\n- while devices_receiver.changed().await.is_ok() {\n- let devices = devices_receiver.borrow().clone();\n- println!(\n- \"list_and_watch received new devices [{:?}] to send\",\n- devices\n- );\n- kubelet_update_sender\n- .send(Ok(ListAndWatchResponse { devices }))\n- .await\n- .unwrap();\n- }\n- });\n- Ok(Response::new(Box::pin(\n- tokio_stream::wrappers::ReceiverStream::new(kubelet_update_receiver),\n- )))\n- }\n-\n- async fn get_preferred_allocation(\n- &self,\n- _request: Request<PreferredAllocationRequest>,\n- ) -> Result<Response<PreferredAllocationResponse>, Status> {\n- unimplemented!();\n- }\n-\n- async fn allocate(\n- &self,\n- _request: Request<AllocateRequest>,\n- ) -> Result<Response<AllocateResponse>, Status> {\n- unimplemented!();\n- }\n-\n- async fn pre_start_container(\n- &self,\n- _request: Request<PreStartContainerRequest>,\n- ) -> Result<Response<PreStartContainerResponse>, Status> {\n- Ok(Response::new(PreStartContainerResponse {}))\n- }\n- }\n-\n- /// Serves the mock DP\n- async fn run_mock_device_plugin(\n- socket_path: impl AsRef<std::path::Path>,\n- devices_receiver: watch::Receiver<Vec<Device>>,\n- ) -> anyhow::Result<()> {\n- let device_plugin = MockDevicePlugin { devices_receiver };\n- let socket = grpc_sock::server::Socket::new(&socket_path).expect(\"couldnt make dp socket\");\n- let serv = Server::builder()\n- .add_service(DevicePluginServer::new(device_plugin))\n- .serve_with_incoming(socket);\n- #[cfg(target_family = \"windows\")]\n- let serv = serv.compat();\n- serv.await.expect(\"Unable to serve mock device plugin\");\n- Ok(())\n- }\n-\n- /// Registers the mock DP with the DeviceManager's registration service\n- async fn register_mock_device_plugin(\n- kubelet_socket: String,\n- dp_socket: &str,\n- dp_resource_name: &str,\n- ) -> anyhow::Result<()> {\n- let op = DevicePluginOptions {\n- get_preferred_allocation_available: false,\n- pre_start_required: false,\n- };\n- let channel = grpc_sock::client::socket_channel(kubelet_socket).await?;\n- let mut registration_client = registration_client::RegistrationClient::new(channel);\n- let register_request = tonic::Request::new(RegisterRequest {\n- version: API_VERSION.into(),\n- endpoint: dp_socket.to_string(),\n- resource_name: dp_resource_name.to_string(),\n- options: Some(op),\n- });\n- registration_client\n- .register(register_request)\n- .await\n- .unwrap();\n- Ok(())\n- }\n-\n- /// Tests e2e flow of kicked off by a mock DP registering with the DeviceManager\n- /// DeviceManager should call ListAndWatch on the DP, update it's devices registry with the DP's\n- /// devices, and instruct it's NodePatcher to patch the node status with the new DP resources.\n- #[tokio::test]\n- async fn do_device_manager_test() {\n- // There doesn't seem to be a way to use the same temp dir for manager and mock dp due to being able to\n- // pass the temp dir reference to multiple threads\n- // Instead, create a temp dir for the DP manager and the mock DP\n- let device_plugin_temp_dir = tempfile::tempdir().expect(\"should be able to create tempdir\");\n- let manager_temp_dir = tempfile::tempdir().expect(\"should be able to create tempdir\");\n-\n- // Capture the DP and DP manager socket paths\n- let socket_name = \"gpu-device-plugin.sock\";\n- let dp_socket = device_plugin_temp_dir\n- .path()\n- .join(socket_name)\n- .to_str()\n- .unwrap()\n- .to_string();\n- let manager_socket = manager_temp_dir\n- .path()\n- .join(PLUGIN_MANGER_SOCKET_NAME)\n- .to_str()\n- .unwrap()\n- .to_string();\n-\n- // Make 3 mock devices\n- let d1 = Device {\n- id: \"d1\".to_string(),\n- health: HEALTHY.to_string(),\n- topology: None,\n- };\n- let d2 = Device {\n- id: \"d2\".to_string(),\n- health: HEALTHY.to_string(),\n- topology: None,\n- };\n- let d3 = Device {\n- id: \"d3\".to_string(),\n- health: UNHEALTHY.to_string(),\n- topology: None,\n- };\n-\n- // Start the mock device plugin without any devices\n- let devices: Vec<Device> = Vec::new();\n- let (devices_sender, devices_receiver) = watch::channel(devices);\n-\n- // Run the mock device plugin\n- let _device_plugin_task = tokio::task::spawn(async move {\n- run_mock_device_plugin(\n- device_plugin_temp_dir.path().join(socket_name),\n- devices_receiver,\n- )\n- .await\n- .unwrap();\n- });\n-\n- // Name of \"this node\" that should be patched with Device Plugin resources\n- let test_node_name = \"test_node\";\n- // Create and run a mock Kubernetes API service and get a Kubernetes client\n- let (client, _mock_service_task) =\n- test_utils::create_mock_kube_service(test_node_name).await;\n-\n- // Create and serve a DeviceManager\n- let device_manager = Arc::new(DeviceManager::new(\n- manager_temp_dir.path(),\n- client,\n- test_node_name,\n- ));\n- let devices = device_manager.devices.clone();\n- let _manager_task = task::spawn(async move {\n- serve_device_registry(device_manager).await.unwrap();\n- });\n- tokio::time::sleep(std::time::Duration::from_secs(1)).await;\n-\n- // Register the mock device plugin with the DeviceManager's Registration service\n- let dp_resource_name = \"example.com/mock-device-plugin\";\n- register_mock_device_plugin(manager_socket.to_string(), &dp_socket, dp_resource_name)\n- .await\n- .unwrap();\n-\n- // Make DP report 2 healthy and 1 unhealthy device\n- devices_sender.send(vec![d1, d2, d3]).unwrap();\n-\n- let mut x: i8 = 0;\n- let mut num_devices: i8 = 0;\n- while x < 3 {\n- tokio::time::sleep(std::time::Duration::from_secs(1)).await;\n- // Assert that there are 3 devices in the map now\n- if let Some(resource_devices_map) = devices.lock().unwrap().get(dp_resource_name) {\n- if resource_devices_map.len() == 3 {\n- num_devices = 3;\n- break;\n- }\n- }\n- x += 1;\n- }\n- assert_eq!(num_devices, 3);\n-\n- // tokio::join!(device_plugin_task, mock_service_task, manager_task);\n- }\n-}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "diff": "@@ -75,7 +75,6 @@ impl NodeStatusPatcher {\n}\npub async fn listen_and_patch(self) -> anyhow::Result<()> {\n- // Forever hold lock on the status update receiver\nlet mut receiver = self.update_node_status_sender.subscribe();\nloop {\nmatch receiver.recv().await {\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "new_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "diff": "@@ -5,13 +5,14 @@ use kube::api::{Api, ListParams};\nuse std::collections::{HashMap, HashSet};\nuse std::sync::{Arc, Mutex};\n-/// DeviceAllocateInfo contains the device ids reserved to a container for a specific\n+/// `DeviceAllocateInfo` contains the device ids reserved to a container for a specific\n/// resource and the ContainerAllocateResponse which contains information about what\n/// to mount into the container\n-#[derive(Clone)]\n+#[derive(Clone, Debug)]\npub struct DeviceAllocateInfo {\n- /// device_ids contains the device Ids allocated to this container for the given resource name\n- pub device_ids: HashSet<String>, // ContainerAllocateRequest.devices_i_ds\n+ /// Contains the device Ids allocated to this container for the given resource name\n+ pub device_ids: HashSet<String>,\n+ /// Contains the RPC ContainerAllocateResponse for the device_ids\npub allocate_response: ContainerAllocateResponse,\n}\n/// Map of devices allocated to the container, keyed by resource name\n@@ -20,6 +21,9 @@ type ResourceAllocateInfo = HashMap<String, DeviceAllocateInfo>;\npub type ContainerDevices = HashMap<String, ResourceAllocateInfo>;\n/// PodDevices contains the map of Pods to allocated devices\n+/// This is a very nested structure modeled after Kubernetes\n+/// (see https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/cm/devicemanager/pod_devices.go).\n+/// This could potentially be simplified by use of an in memory database.\n#[derive(Clone)]\npub struct PodDevices {\n/// Name of the node this kubelet is running on\n@@ -39,7 +43,7 @@ impl PodDevices {\n}\n}\n- /// get_active_pods activePods is a method for listing active pods on the node so the\n+ /// A method for listing active pods on the node so the\n/// amount of device plugin resources requested by existing pods could be counted\n/// when updating allocated devices\npub async fn get_active_pods(&self) -> anyhow::Result<HashSet<String>> {\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/resources.rs", "new_path": "crates/kubelet/src/state/common/resources.rs", "diff": "@@ -67,7 +67,7 @@ impl<P: GenericProvider> State<P::PodState> for Resources<P> {\n.do_allocate(&pod, container_devices)\n.await\n{\n- error!(\"{:?}\", e);\n+ error!(error = %e);\nlet next = Error::<P>::new(e.to_string());\nreturn Transition::next(self, next);\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add additional in line comments, manager allocate tests
350,448
09.06.2021 22:56:07
25,200
a56289a27a80499020fe7af63422e13888fb9e05
use RwLock instead of Mutex
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -12,7 +12,8 @@ use super::pod_devices::{ContainerDevices, DeviceAllocateInfo, PodDevices};\nuse super::{DeviceIdMap, DeviceMap, PluginDevicesMap, PodResourceRequests, HEALTHY};\nuse std::collections::{HashMap, HashSet};\nuse std::path::{Path, PathBuf};\n-use std::sync::{Arc, Mutex};\n+use std::sync::Arc;\n+use tokio::sync::RwLock;\nuse tokio::sync::broadcast;\n#[cfg(target_family = \"windows\")]\n@@ -44,16 +45,16 @@ pub struct ContainerAllocateInfo {\n#[derive(Clone)]\npub struct DeviceManager {\n/// Map of registered device plugins, keyed by resource name\n- plugins: Arc<Mutex<HashMap<String, Arc<PluginConnection>>>>,\n+ plugins: Arc<RwLock<HashMap<String, Arc<PluginConnection>>>>,\n/// Directory where the device plugin sockets live\npub(crate) plugin_dir: PathBuf,\n/// Contains all the devices advertised by all device plugins. Key is resource name.\n/// Shared with the NodePatcher.\n- pub(crate) devices: Arc<Mutex<DeviceMap>>,\n+ pub(crate) devices: Arc<RwLock<DeviceMap>>,\n/// Structure containing map with Pod to currently allocated devices mapping\npod_devices: PodDevices,\n/// Devices that have been allocated to Pods, keyed by resource name.\n- allocated_device_ids: Arc<Mutex<DeviceIdMap>>,\n+ allocated_device_ids: Arc<RwLock<DeviceIdMap>>,\n/// Sender to notify the NodePatcher to update NodeStatus with latest resource values.\nupdate_node_status_sender: broadcast::Sender<()>,\n/// Struture that patches the Node with the latest resource values when signaled.\n@@ -63,7 +64,7 @@ pub struct DeviceManager {\nimpl DeviceManager {\n/// Returns a new device manager configured with the given device plugin directory path\npub fn new<P: AsRef<Path>>(plugin_dir: P, client: kube::Client, node_name: &str) -> Self {\n- let devices = Arc::new(Mutex::new(HashMap::new()));\n+ let devices = Arc::new(RwLock::new(HashMap::new()));\nlet (update_node_status_sender, _) = broadcast::channel(UPDATE_NODE_STATUS_CHANNEL_SIZE);\nlet node_status_patcher = NodeStatusPatcher::new(\nnode_name,\n@@ -74,10 +75,10 @@ impl DeviceManager {\nlet pod_devices = PodDevices::new(node_name, client);\nDeviceManager {\nplugin_dir: PathBuf::from(plugin_dir.as_ref()),\n- plugins: Arc::new(Mutex::new(HashMap::new())),\n+ plugins: Arc::new(RwLock::new(HashMap::new())),\ndevices,\npod_devices,\n- allocated_device_ids: Arc::new(Mutex::new(HashMap::new())),\n+ allocated_device_ids: Arc::new(RwLock::new(HashMap::new())),\nupdate_node_status_sender,\nnode_status_patcher,\n}\n@@ -89,8 +90,8 @@ impl DeviceManager {\n}\n/// Adds the plugin to our HashMap\n- fn add_plugin(&self, plugin_connection: Arc<PluginConnection>, resource_name: &str) {\n- let mut lock = self.plugins.lock().unwrap();\n+ async fn add_plugin(&self, plugin_connection: Arc<PluginConnection>, resource_name: &str) {\n+ let mut lock = self.plugins.write().await;\nlock.insert(resource_name.to_string(), plugin_connection);\n}\n@@ -144,7 +145,7 @@ impl DeviceManager {\n&self,\nregister_request: &RegisterRequest,\n) -> Result<(), tonic::Status> {\n- let plugins = self.plugins.lock().unwrap();\n+ let plugins = self.plugins.read().await;\nif let Some(_previous_plugin_entry) = plugins.get(&register_request.resource_name) {\n// TODO: check if plugin is active\n@@ -180,7 +181,8 @@ impl DeviceManager {\nlet plugin_connection = Arc::new(PluginConnection::new(client, register_request));\nlet plugins = self.plugins.clone();\nlet devices = self.devices.clone();\n- self.add_plugin(plugin_connection.clone(), &resource_name);\n+ self.add_plugin(plugin_connection.clone(), &resource_name)\n+ .await;\n// TODO: decide whether to join/store all spawned ListAndWatch threads\ntokio::spawn(async move {\n@@ -188,10 +190,10 @@ impl DeviceManager {\n.start(all_devices, update_node_status_sender.clone())\n.await;\n- remove_plugin(plugins, &resource_name, plugin_connection);\n+ remove_plugin(plugins, &resource_name, plugin_connection).await;\n// ?? Should devices be marked unhealthy first?\n- remove_resource(devices, &resource_name);\n+ remove_resource(devices, &resource_name).await;\n// Update nodes status with devices removed\nupdate_node_status_sender.send(()).unwrap();\n@@ -261,8 +263,7 @@ impl DeviceManager {\n.do_allocate_for_pod(&pod.pod_uid(), all_allocate_requests)\n.await\n{\n- let mut allocated_device_ids = self.allocated_device_ids.lock().unwrap();\n- *allocated_device_ids = self.pod_devices.get_allocated_devices();\n+ *self.allocated_device_ids.write().await = self.pod_devices.get_allocated_devices();\nErr(e)\n} else {\nOk(())\n@@ -285,8 +286,8 @@ impl DeviceManager {\nfor (resource_name, container_allocate_info) in all_allocate_requests {\nlet plugin_connection = self\n.plugins\n- .lock()\n- .unwrap()\n+ .read()\n+ .await\n.get(&resource_name)\n.unwrap()\n.clone();\n@@ -348,13 +349,13 @@ impl DeviceManager {\n/// Checks that a resource with the given name exists in the device plugin map\nasync fn is_device_plugin_resource(&self, resource_name: &str) -> bool {\n- self.devices.lock().unwrap().get(resource_name).is_some()\n+ self.devices.read().await.get(resource_name).is_some()\n}\n/// Asserts that the resource is in the device map and has at least `quantity` healthy devices.\n/// Later a check is made to make sure enough have not been allocated yet.\nasync fn is_healthy_resource(&self, resource_name: &str, quantity: usize) -> bool {\n- if let Some(resource_devices) = self.devices.lock().unwrap().get(resource_name) {\n+ if let Some(resource_devices) = self.devices.read().await.get(resource_name) {\nif resource_devices\n.iter()\n.filter_map(\n@@ -391,7 +392,7 @@ impl DeviceManager {\nself.pod_devices.remove_pods(pods_to_be_removed.clone())?;\n// TODO: should `allocated_device_ids` be replaced with `self.pod_devices.get_allocated_devices` instead?\n- let mut allocated_device_ids = self.allocated_device_ids.lock().unwrap();\n+ let mut allocated_device_ids = self.allocated_device_ids.write().await;\npods_to_be_removed.iter().for_each(|p_uid| {\nallocated_device_ids.remove(p_uid);\n});\n@@ -430,14 +431,14 @@ impl DeviceManager {\n}\n}\n// Grab lock on devices and allocated devices\n- let resource_devices_map = self.devices.lock().unwrap();\n+ let resource_devices_map = self.devices.write().await;\nlet resource_devices = resource_devices_map.get(resource_name).ok_or_else(|| {\nanyhow::format_err!(\n\"Device plugin does not exist for resource {}\",\nresource_name\n)\n})?;\n- let mut allocated_devices_map = self.allocated_device_ids.lock().unwrap();\n+ let mut allocated_devices_map = self.allocated_device_ids.write().await;\nlet mut allocated_devices = allocated_devices_map\n.get(resource_name)\n.unwrap_or(&HashSet::new())\n@@ -502,12 +503,12 @@ fn get_available_devices(\n/// Removes the PluginConnection from our HashMap so long as it is the same as the one currently\n/// stored under the given resource name.\n-fn remove_plugin(\n- plugins: Arc<Mutex<HashMap<String, Arc<PluginConnection>>>>,\n+async fn remove_plugin(\n+ plugins: Arc<RwLock<HashMap<String, Arc<PluginConnection>>>>,\nresource_name: &str,\nplugin_connection: Arc<PluginConnection>,\n) {\n- let mut lock = plugins.lock().unwrap();\n+ let mut lock = plugins.write().await;\nif let Some(old_plugin_connection) = lock.get(resource_name) {\n// TODO: partialEq only checks that reg requests are identical. May also want\n// to check match of other fields.\n@@ -518,8 +519,8 @@ fn remove_plugin(\n}\n/// Removed all devices of a resource from our shared device map.\n-fn remove_resource(devices: Arc<Mutex<DeviceMap>>, resource_name: &str) {\n- match devices.lock().unwrap().remove(resource_name) {\n+async fn remove_resource(devices: Arc<RwLock<DeviceMap>>, resource_name: &str) {\n+ match devices.write().await.remove(resource_name) {\nSome(_) => trace!(\n\"All devices of resource {} have been removed\",\nresource_name\n@@ -756,7 +757,7 @@ mod tests {\nwhile x < 3 {\ntokio::time::sleep(std::time::Duration::from_secs(1)).await;\n// Assert that there are 3 devices in the map now\n- if let Some(resource_devices_map) = devices.lock().unwrap().get(dp_resource_name) {\n+ if let Some(resource_devices_map) = devices.read().await.get(dp_resource_name) {\nif resource_devices_map.len() == 3 {\nnum_devices = 3;\nbreak;\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "diff": "@@ -118,7 +118,7 @@ pub mod test_utils {\nuse hyper::Body;\nuse kube::Client;\nuse std::convert::TryFrom;\n- use std::sync::Mutex;\n+ use tokio::sync::RwLock;\nuse tower_test::mock;\npub fn mock_client() -> kube::Client {\n@@ -166,7 +166,7 @@ pub mod test_utils {\n(client, spawned)\n}\n- pub fn create_mock_healthy_devices(r1_name: &str, r2_name: &str) -> Arc<Mutex<DeviceMap>> {\n+ pub fn create_mock_healthy_devices(r1_name: &str, r2_name: &str) -> Arc<RwLock<DeviceMap>> {\nlet r1_devices: PluginDevicesMap = (0..3)\n.map(|x| Device {\nid: format!(\"{}-id{}\", r1_name, x),\n@@ -193,6 +193,6 @@ pub mod test_utils {\n.cloned()\n.collect();\n- Arc::new(Mutex::new(device_map))\n+ Arc::new(RwLock::new(device_map))\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "diff": "@@ -3,15 +3,15 @@ use k8s_openapi::api::core::v1::{Node, NodeStatus};\nuse k8s_openapi::apimachinery::pkg::api::resource::Quantity;\nuse kube::api::{Api, PatchParams};\nuse std::collections::BTreeMap;\n-use std::sync::{Arc, Mutex};\n-use tokio::sync::broadcast;\n+use std::sync::Arc;\n+use tokio::sync::{broadcast, RwLock};\nuse tracing::error;\n/// NodePatcher updates the Node status with the latest device information.\n#[derive(Clone)]\npub struct NodeStatusPatcher {\nnode_name: String,\n- devices: Arc<Mutex<DeviceMap>>,\n+ devices: Arc<RwLock<DeviceMap>>,\n// Broadcast sender so clonable\nupdate_node_status_sender: broadcast::Sender<()>,\nclient: kube::Client,\n@@ -20,7 +20,7 @@ pub struct NodeStatusPatcher {\nimpl NodeStatusPatcher {\npub fn new(\nnode_name: &str,\n- devices: Arc<Mutex<DeviceMap>>,\n+ devices: Arc<RwLock<DeviceMap>>,\nupdate_node_status_sender: broadcast::Sender<()>,\nclient: kube::Client,\n) -> Self {\n@@ -33,7 +33,7 @@ impl NodeStatusPatcher {\n}\nasync fn get_node_status_patch(&self) -> NodeStatus {\n- let devices = self.devices.lock().unwrap();\n+ let devices = self.devices.read().await;\nlet capacity: BTreeMap<String, Quantity> = devices\n.iter()\n.map(|(resource_name, resource_devices)| {\n@@ -103,8 +103,8 @@ mod tests {\nasync fn test_do_node_status_patch() {\nlet devices = create_mock_healthy_devices(\"r1\", \"r2\");\ndevices\n- .lock()\n- .unwrap()\n+ .write()\n+ .await\n.get_mut(\"r1\")\n.unwrap()\n.get_mut(\"r1-id1\")\n@@ -134,8 +134,8 @@ mod tests {\nlet r2_name = \"r2\";\nlet devices = create_mock_healthy_devices(r1_name, r2_name);\ndevices\n- .lock()\n- .unwrap()\n+ .write()\n+ .await\n.get_mut(\"r1\")\n.unwrap()\n.get_mut(\"r1-id1\")\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/plugin_connection.rs", "new_path": "crates/kubelet/src/device_plugin_manager/plugin_connection.rs", "diff": "@@ -4,8 +4,8 @@ use crate::device_plugin_api::v1beta1::{\nListAndWatchResponse, RegisterRequest,\n};\nuse std::collections::HashMap;\n-use std::sync::{Arc, Mutex};\n-use tokio::sync::broadcast;\n+use std::sync::Arc;\n+use tokio::sync::{broadcast, RwLock};\nuse tonic::Request;\nuse tracing::{error, trace};\n@@ -32,7 +32,7 @@ impl PluginConnection {\npub async fn start(\n&self,\n- devices: Arc<Mutex<DeviceMap>>,\n+ devices: Arc<RwLock<DeviceMap>>,\nupdate_node_status_sender: broadcast::Sender<()>,\n) {\nmatch self\n@@ -55,7 +55,7 @@ impl PluginConnection {\n/// TODO: return error\nasync fn list_and_watch(\n&self,\n- devices: Arc<Mutex<DeviceMap>>,\n+ devices: Arc<RwLock<DeviceMap>>,\nupdate_node_status_sender: broadcast::Sender<()>,\n) -> anyhow::Result<()> {\nlet mut stream = self\n@@ -71,7 +71,9 @@ impl PluginConnection {\ndevices.clone(),\n&mut previous_law_devices,\nresponse,\n- ) {\n+ )\n+ .await\n+ {\n// TODO handle error -- maybe channel is full\nupdate_node_status_sender.send(()).unwrap();\n}\n@@ -99,9 +101,9 @@ impl PluginConnection {\n/// (3) Device removed: DP is no longer advertising a device\n/// If any of the 3 cases occurs, this returns true, signaling that the `NodePatcher` needs to update the\n/// Node status with new devices.\n-fn update_devices_map(\n+async fn update_devices_map(\nresource_name: &str,\n- devices: Arc<Mutex<DeviceMap>>,\n+ devices: Arc<RwLock<DeviceMap>>,\nprevious_law_devices: &mut HashMap<String, Device>,\nresponse: ListAndWatchResponse,\n) -> bool {\n@@ -112,30 +114,28 @@ fn update_devices_map(\n.collect::<HashMap<String, Device>>();\nlet mut update_node_status = false;\n- current_devices.iter().for_each(|(_, device)| {\n+ for (_, device) in &current_devices {\n// (1) Device modified or already registered\nif let Some(previous_device) = previous_law_devices.get(&device.id) {\nif previous_device.health != device.health {\ndevices\n- .lock()\n- .unwrap()\n+ .write()\n+ .await\n.get_mut(resource_name)\n.unwrap()\n.insert(device.id.clone(), device.clone());\nupdate_node_status = true;\n} else if previous_device.topology != device.topology {\n// Currently not using/handling device topology. Simply log the change.\n- trace!(\n- \"Topology of device {} from resource {} changed from {:?} to {:?}\",\n- device.id,\n- resource_name,\n+ trace!(resource = %resource_name,\n+ \"Topology of device changed from {:?} to {:?}\",\nprevious_device.topology,\ndevice.topology\n);\n}\n// (2) Device added\n} else {\n- let mut all_devices_map = devices.lock().unwrap();\n+ let mut all_devices_map = devices.write().await;\nmatch all_devices_map.get_mut(resource_name) {\nSome(resource_devices_map) => {\nresource_devices_map.insert(device.id.clone(), device.clone());\n@@ -148,23 +148,23 @@ fn update_devices_map(\n}\nupdate_node_status = true;\n}\n- });\n+ }\n// (3) Check if Device removed\n- previous_law_devices\n+ let removed_device_ids: Vec<String> = previous_law_devices\n.iter()\n- .for_each(|(previous_dev_id, _)| {\n- if !current_devices.contains_key(previous_dev_id) {\n- // TODO: how to handle already allocated devices? Pretty sure K8s lets them keep running but what about the allocated_device map?\n- devices\n- .lock()\n- .unwrap()\n- .get_mut(resource_name)\n- .unwrap()\n- .remove(previous_dev_id);\n+ .map(|(prev_id, _)| prev_id)\n+ .filter(|prev_id| !current_devices.contains_key(*prev_id))\n+ .cloned()\n+ .collect();\n+ if removed_device_ids.len() > 0 {\nupdate_node_status = true;\n- }\n+ let mut lock = devices.write().await;\n+ let map = lock.get_mut(resource_name).unwrap();\n+ removed_device_ids.into_iter().for_each(|id| {\n+ map.remove(&id);\n});\n+ }\n// Replace previous devices with current devices\n*previous_law_devices = current_devices;\n@@ -184,11 +184,11 @@ pub mod tests {\nuse super::super::{HEALTHY, UNHEALTHY};\nuse super::*;\n- #[test]\n- fn test_update_devices_map_modified() {\n+ #[tokio::test]\n+ async fn test_update_devices_map_modified() {\nlet (r1_name, r2_name) = (\"r1\", \"r2\");\nlet devices_map = create_mock_healthy_devices(r1_name, r2_name);\n- let mut previous_law_devices = devices_map.lock().unwrap().get(r1_name).unwrap().clone();\n+ let mut previous_law_devices = devices_map.read().await.get(r1_name).unwrap().clone();\nlet mut devices_vec: Vec<Device> = previous_law_devices.values().cloned().collect();\n// Mark the device offline\ndevices_vec[0].health = UNHEALTHY.to_string();\n@@ -197,17 +197,20 @@ pub mod tests {\ndevices: devices_vec.clone(),\n};\nlet new_previous_law_devices = devices_vec.into_iter().map(|d| (d.id.clone(), d)).collect();\n- assert!(update_devices_map(\n+ assert!(\n+ update_devices_map(\nr1_name,\ndevices_map.clone(),\n&mut previous_law_devices,\nresponse\n- ));\n+ )\n+ .await\n+ );\nassert_eq!(previous_law_devices, new_previous_law_devices);\nassert_eq!(\ndevices_map\n- .lock()\n- .unwrap()\n+ .read()\n+ .await\n.get(r1_name)\n.unwrap()\n.get(&unhealthy_id)\n@@ -217,11 +220,11 @@ pub mod tests {\n);\n}\n- #[test]\n- fn test_update_devices_map_added() {\n+ #[tokio::test]\n+ async fn test_update_devices_map_added() {\nlet (r1_name, r2_name) = (\"r1\", \"r2\");\nlet devices_map = create_mock_healthy_devices(r1_name, r2_name);\n- let mut previous_law_devices = devices_map.lock().unwrap().get(r1_name).unwrap().clone();\n+ let mut previous_law_devices = devices_map.read().await.get(r1_name).unwrap().clone();\nlet mut devices_vec: Vec<Device> = previous_law_devices.values().cloned().collect();\n// Add another device\nlet added_id = format!(\"{}-id{}\", r1_name, 10);\n@@ -234,17 +237,20 @@ pub mod tests {\ndevices: devices_vec.clone(),\n};\nlet new_previous_law_devices = devices_vec.into_iter().map(|d| (d.id.clone(), d)).collect();\n- assert!(update_devices_map(\n+ assert!(\n+ update_devices_map(\nr1_name,\ndevices_map.clone(),\n&mut previous_law_devices,\nresponse\n- ));\n+ )\n+ .await\n+ );\nassert_eq!(previous_law_devices, new_previous_law_devices);\nassert_eq!(\ndevices_map\n- .lock()\n- .unwrap()\n+ .read()\n+ .await\n.get(r1_name)\n.unwrap()\n.get(&added_id)\n@@ -254,11 +260,11 @@ pub mod tests {\n);\n}\n- #[test]\n- fn test_update_devices_map_removed() {\n+ #[tokio::test]\n+ async fn test_update_devices_map_removed() {\nlet (r1_name, r2_name) = (\"r1\", \"r2\");\nlet devices_map = create_mock_healthy_devices(r1_name, r2_name);\n- let mut previous_law_devices = devices_map.lock().unwrap().get(r1_name).unwrap().clone();\n+ let mut previous_law_devices = devices_map.read().await.get(r1_name).unwrap().clone();\nlet mut devices_vec: Vec<Device> = previous_law_devices.values().cloned().collect();\n// Remove a device\nlet removed_id = devices_vec.pop().unwrap().id;\n@@ -266,17 +272,20 @@ pub mod tests {\ndevices: devices_vec.clone(),\n};\nlet new_previous_law_devices = devices_vec.into_iter().map(|d| (d.id.clone(), d)).collect();\n- assert!(update_devices_map(\n+ assert!(\n+ update_devices_map(\nr1_name,\ndevices_map.clone(),\n&mut previous_law_devices,\nresponse\n- ));\n+ )\n+ .await\n+ );\nassert_eq!(previous_law_devices, new_previous_law_devices);\nassert_eq!(\ndevices_map\n- .lock()\n- .unwrap()\n+ .read()\n+ .await\n.get(r1_name)\n.unwrap()\n.get(&removed_id),\n@@ -284,23 +293,26 @@ pub mod tests {\n);\n}\n- #[test]\n- fn test_update_devices_map_no_change() {\n+ #[tokio::test]\n+ async fn test_update_devices_map_no_change() {\nlet (r1_name, r2_name) = (\"r1\", \"r2\");\nlet devices_map = create_mock_healthy_devices(r1_name, r2_name);\n- let mut previous_law_devices = devices_map.lock().unwrap().get(r1_name).unwrap().clone();\n+ let mut previous_law_devices = devices_map.read().await.get(r1_name).unwrap().clone();\nlet devices_vec: Vec<Device> = previous_law_devices.values().cloned().collect();\nlet response = ListAndWatchResponse {\ndevices: devices_vec,\n};\n- assert!(!update_devices_map(\n+ assert!(\n+ !update_devices_map(\nr1_name,\ndevices_map.clone(),\n&mut previous_law_devices,\nresponse\n- ));\n+ )\n+ .await\n+ );\nassert_eq!(\n- devices_map.lock().unwrap().get(r1_name).unwrap(),\n+ devices_map.read().await.get(r1_name).unwrap(),\n&previous_law_devices\n);\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
use RwLock instead of Mutex
350,448
15.06.2021 11:37:31
25,200
1696b068d29b79c925ddeb22cc5ee34ab6f5ec4f
missing device_plugins_dir references
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/config_interpreter.rs", "new_path": "crates/kubelet/src/config_interpreter.rs", "diff": "@@ -33,6 +33,7 @@ mod test {\nhostname: \"nope\".to_owned(),\ninsecure_registries: None,\nplugins_dir: std::path::PathBuf::from(\"/nope\"),\n+ device_plugins_dir: std::path::PathBuf::from(\"/nope\"),\nmax_pods: 0,\nnode_ip: IpAddr::V4(Ipv4Addr::LOCALHOST),\nnode_labels: std::collections::HashMap::new(),\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/plugin_connection.rs", "new_path": "crates/kubelet/src/device_plugin_manager/plugin_connection.rs", "diff": "@@ -114,7 +114,7 @@ async fn update_devices_map(\n.collect::<HashMap<String, Device>>();\nlet mut update_node_status = false;\n- for (_, device) in &current_devices {\n+ for device in current_devices.values() {\n// (1) Device modified or already registered\nif let Some(previous_device) = previous_law_devices.get(&device.id) {\nif previous_device.health != device.health {\n@@ -157,7 +157,7 @@ async fn update_devices_map(\n.filter(|prev_id| !current_devices.contains_key(*prev_id))\n.cloned()\n.collect();\n- if removed_device_ids.len() > 0 {\n+ if !removed_device_ids.is_empty() {\nupdate_node_status = true;\nlet mut lock = devices.write().await;\nlet map = lock.get_mut(resource_name).unwrap();\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/node/mod.rs", "new_path": "crates/kubelet/src/node/mod.rs", "diff": "@@ -767,6 +767,7 @@ mod test {\ninsecure_registries: None,\ndata_dir: PathBuf::new(),\nplugins_dir: PathBuf::new(),\n+ device_plugins_dir: PathBuf::new(),\nnode_labels,\nmax_pods: 110,\n};\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
missing device_plugins_dir references
350,448
15.06.2021 13:53:23
25,200
2ee76f0f43f9d8022bd3c417b14fd3687a26c3a4
use json patch for node status
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "diff": "use super::{DeviceMap, HEALTHY};\n-use k8s_openapi::api::core::v1::{Node, NodeStatus};\n-use k8s_openapi::apimachinery::pkg::api::resource::Quantity;\n+use k8s_openapi::api::core::v1::Node;\nuse kube::api::{Api, PatchParams};\n-use std::collections::BTreeMap;\nuse std::sync::Arc;\nuse tokio::sync::{broadcast, RwLock};\n-use tracing::error;\n+use tracing::{debug, error};\n/// NodePatcher updates the Node status with the latest device information.\n#[derive(Clone)]\n@@ -32,47 +30,61 @@ impl NodeStatusPatcher {\n}\n}\n- async fn get_node_status_patch(&self) -> NodeStatus {\n+ async fn get_node_status_patch(&self) -> json_patch::Patch {\n+ let mut patches = Vec::new();\nlet devices = self.devices.read().await;\n- let capacity: BTreeMap<String, Quantity> = devices\n- .iter()\n- .map(|(resource_name, resource_devices)| {\n- (\n- resource_name.clone(),\n- Quantity(resource_devices.len().to_string()),\n- )\n- })\n- .collect();\n- let allocatable: BTreeMap<String, Quantity> = devices\n+ devices\n.iter()\n- .map(|(resource_name, resource_devices)| {\n+ .for_each(|(resource_name, resource_devices)| {\n+ let adjusted_name = adjust_name(resource_name);\n+ let capacity_patch = serde_json::json!(\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/{}\", adjusted_name),\n+ \"value\": resource_devices.len().to_string()\n+ }\n+ );\nlet healthy_count: usize = resource_devices\n.iter()\n.filter(|(_, dev)| dev.health == HEALTHY)\n.map(|(_, _)| 1)\n.sum();\n- (resource_name.clone(), Quantity(healthy_count.to_string()))\n- })\n- .collect();\n- NodeStatus {\n- capacity: Some(capacity),\n- allocatable: Some(allocatable),\n- ..Default::default()\n+ let allocated_patch = serde_json::json!(\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/allocatable/{}\", adjusted_name),\n+ \"value\": healthy_count.to_string()\n}\n+ );\n+ patches.push(capacity_patch);\n+ patches.push(allocated_patch);\n+ });\n+ let patches_value = serde_json::value::Value::Array(patches);\n+ json_patch::from_value(patches_value).unwrap()\n}\n- async fn do_node_status_patch(&self, status: NodeStatus) -> anyhow::Result<()> {\n+ async fn do_node_status_patch(&self, patch: json_patch::Patch) -> anyhow::Result<()> {\n+ debug!(\n+ \"Patching {} node status with patch {:?}\",\n+ self.node_name, patch\n+ );\nlet node_client: Api<Node> = Api::all(self.client.clone());\n- let _node = node_client\n+\n+ match node_client\n.patch_status(\n&self.node_name,\n&PatchParams::default(),\n- &kube::api::Patch::Strategic(status),\n+ &kube::api::Patch::Json::<()>(patch),\n)\n.await\n- .map_err(|e| anyhow::anyhow!(\"Unable to patch node status: {}\", e))?;\n+ {\n+ Err(e) => Err(anyhow::anyhow!(\"Unable to patch node status: {}\", e)),\n+ Ok(s) => {\n+ debug!(\"Node status patch returned {:?}\", s);\nOk(())\n}\n+ }\n+ }\npub async fn listen_and_patch(self) -> anyhow::Result<()> {\nlet mut receiver = self.update_node_status_sender.subscribe();\n@@ -83,6 +95,7 @@ impl NodeStatusPatcher {\n// TODO: bubble up error\n}\nOk(_) => {\n+ debug!(\"Received notification that Node status should be patched\");\n// Grab status values\nlet status_patch = self.get_node_status_patch().await;\n// Do patch\n@@ -93,12 +106,21 @@ impl NodeStatusPatcher {\n}\n}\n+fn adjust_name(name: &str) -> String {\n+ name.replace(\"/\", \"~1\")\n+}\n+\n#[cfg(test)]\nmod tests {\nuse super::super::test_utils::{create_mock_healthy_devices, create_mock_kube_service};\nuse super::super::UNHEALTHY;\nuse super::*;\n+ #[test]\n+ fn test_adjust_name() {\n+ assert_eq!(adjust_name(\"example.com/r1\"), \"example.com~1r1\");\n+ }\n+\n#[tokio::test]\nasync fn test_do_node_status_patch() {\nlet devices = create_mock_healthy_devices(\"r1\", \"r2\");\n@@ -110,11 +132,14 @@ mod tests {\n.get_mut(\"r1-id1\")\n.unwrap()\n.health = UNHEALTHY.to_string();\n- let empty_node_status = NodeStatus {\n- capacity: None,\n- allocatable: None,\n- ..Default::default()\n- };\n+ let patch_value = serde_json::json!([\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/example.com~1foo\"),\n+ \"value\": \"2\"\n+ }\n+ ]);\n+ let patch = json_patch::from_value(patch_value).unwrap();\nlet (update_node_status_sender, _rx) = broadcast::channel(2);\n// Create and run a mock Kubernetes API service and get a Kubernetes client\n@@ -123,22 +148,22 @@ mod tests {\nlet node_status_patcher =\nNodeStatusPatcher::new(node_name, devices, update_node_status_sender, client);\nnode_status_patcher\n- .do_node_status_patch(empty_node_status)\n+ .do_node_status_patch(patch)\n.await\n.unwrap();\n}\n#[tokio::test]\nasync fn test_get_node_status_patch() {\n- let r1_name = \"r1\";\n- let r2_name = \"r2\";\n+ let r1_name = \"example.com/r1\";\n+ let r2_name = \"something.net/r2\";\nlet devices = create_mock_healthy_devices(r1_name, r2_name);\ndevices\n.write()\n.await\n- .get_mut(\"r1\")\n+ .get_mut(r1_name)\n.unwrap()\n- .get_mut(\"r1-id1\")\n+ .get_mut(&format!(\"{}-id1\", r1_name))\n.unwrap()\n.health = UNHEALTHY.to_string();\nlet (update_node_status_sender, _rx) = broadcast::channel(2);\n@@ -147,23 +172,32 @@ mod tests {\nlet (client, _mock_service_task) = create_mock_kube_service(node_name).await;\nlet node_status_patcher =\nNodeStatusPatcher::new(node_name, devices, update_node_status_sender, client);\n- let status = node_status_patcher.get_node_status_patch().await;\n+ let patch = node_status_patcher.get_node_status_patch().await;\n+ let expected_patch_value = serde_json::json!([\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/example.com~1r1\"),\n+ \"value\": \"3\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/allocatable/example.com~1r1\"),\n+ \"value\": \"2\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/something.net~1r2\"),\n+ \"value\": \"2\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/allocatable/something.net~1r2\"),\n+ \"value\": \"2\"\n+ }\n+ ]);\n+ let expected_patch = json_patch::from_value(expected_patch_value).unwrap();\n// Check that both resources listed under allocatable and only healthy devices are counted\n- let allocatable = status.allocatable.unwrap();\n- assert_eq!(allocatable.len(), 2);\n- assert_eq!(\n- allocatable.get(r1_name).unwrap(),\n- &Quantity(\"2\".to_string())\n- );\n- assert_eq!(\n- allocatable.get(r2_name).unwrap(),\n- &Quantity(\"2\".to_string())\n- );\n-\n// Check that both resources listed under capacity and both healthy and unhealthy devices are counted\n- let capacity = status.capacity.unwrap();\n- assert_eq!(capacity.len(), 2);\n- assert_eq!(capacity.get(r1_name).unwrap(), &Quantity(\"3\".to_string()));\n- assert_eq!(capacity.get(r2_name).unwrap(), &Quantity(\"2\".to_string()));\n+ assert_eq!(patch, expected_patch);\n}\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
use json patch for node status
350,448
15.06.2021 14:45:45
25,200
8af4e548bbde7f18d6d6a390fb12278e06c37f5b
use json patch for node status patches
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -184,7 +184,6 @@ impl DeviceManager {\nself.add_plugin(plugin_connection.clone(), &resource_name)\n.await;\n- // TODO: decide whether to join/store all spawned ListAndWatch threads\ntokio::spawn(async move {\nplugin_connection\n.start(all_devices, update_node_status_sender.clone())\n@@ -192,8 +191,8 @@ impl DeviceManager {\nremove_plugin(plugins, &resource_name, plugin_connection).await;\n- // ?? Should devices be marked unhealthy first?\n- remove_resource(devices, &resource_name).await;\n+ // This clears the map of devices for a resource.\n+ remove_resource_devices(devices, &resource_name).await;\n// Update nodes status with devices removed\nupdate_node_status_sender.send(()).unwrap();\n@@ -519,15 +518,15 @@ async fn remove_plugin(\n}\n/// Removed all devices of a resource from our shared device map.\n-async fn remove_resource(devices: Arc<RwLock<DeviceMap>>, resource_name: &str) {\n- match devices.write().await.remove(resource_name) {\n- Some(_) => trace!(\n- \"All devices of resource {} have been removed\",\n- resource_name\n- ),\n+async fn remove_resource_devices(devices: Arc<RwLock<DeviceMap>>, resource_name: &str) {\n+ match devices.write().await.get_mut(resource_name) {\n+ Some(map) => {\n+ map.clear();\n+ trace!(resource = %resource_name,\n+ \"All devices of this resource have been cleared\");\n+ }\nNone => trace!(\n- \"All devices of resource {} were already removed\",\n- resource_name\n+ resource = %resource_name ,\"All devices of this resource were already removed\"\n),\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "diff": "use super::{DeviceMap, HEALTHY};\n-use k8s_openapi::api::core::v1::{Node, NodeStatus};\n-use k8s_openapi::apimachinery::pkg::api::resource::Quantity;\n+use k8s_openapi::api::core::v1::Node;\nuse kube::api::{Api, PatchParams};\n-use std::collections::BTreeMap;\nuse std::sync::Arc;\nuse tokio::sync::{broadcast, RwLock};\n-use tracing::error;\n+use tracing::{debug, error};\n/// NodePatcher updates the Node status with the latest device information.\n#[derive(Clone)]\n@@ -32,47 +30,66 @@ impl NodeStatusPatcher {\n}\n}\n- async fn get_node_status_patch(&self) -> NodeStatus {\n+ // TODO: Decide whether `NodePatcher` should do `remove` patches when there are no\n+ // devices under a resource. When a device plugin drops, the `DeviceManager` clears\n+ // out the resource's device map. Currently, this just sets the resource's\n+ // `allocatable` and `capacity` count to 0, which appears to be the same implementation\n+ // in Kubernetes.\n+ async fn get_node_status_patch(&self) -> json_patch::Patch {\n+ let mut patches = Vec::new();\nlet devices = self.devices.read().await;\n- let capacity: BTreeMap<String, Quantity> = devices\n- .iter()\n- .map(|(resource_name, resource_devices)| {\n- (\n- resource_name.clone(),\n- Quantity(resource_devices.len().to_string()),\n- )\n- })\n- .collect();\n- let allocatable: BTreeMap<String, Quantity> = devices\n+ devices\n.iter()\n- .map(|(resource_name, resource_devices)| {\n+ .for_each(|(resource_name, resource_devices)| {\n+ let adjusted_name = adjust_name(resource_name);\n+ let capacity_patch = serde_json::json!(\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/{}\", adjusted_name),\n+ \"value\": resource_devices.len().to_string()\n+ }\n+ );\nlet healthy_count: usize = resource_devices\n.iter()\n.filter(|(_, dev)| dev.health == HEALTHY)\n.map(|(_, _)| 1)\n.sum();\n- (resource_name.clone(), Quantity(healthy_count.to_string()))\n- })\n- .collect();\n- NodeStatus {\n- capacity: Some(capacity),\n- allocatable: Some(allocatable),\n- ..Default::default()\n+ let allocated_patch = serde_json::json!(\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/allocatable/{}\", adjusted_name),\n+ \"value\": healthy_count.to_string()\n}\n+ );\n+ patches.push(capacity_patch);\n+ patches.push(allocated_patch);\n+ });\n+ let patches_value = serde_json::value::Value::Array(patches);\n+ json_patch::from_value(patches_value).unwrap()\n}\n- async fn do_node_status_patch(&self, status: NodeStatus) -> anyhow::Result<()> {\n+ async fn do_node_status_patch(&self, patch: json_patch::Patch) -> anyhow::Result<()> {\n+ debug!(\n+ \"Patching {} node status with patch {:?}\",\n+ self.node_name, patch\n+ );\nlet node_client: Api<Node> = Api::all(self.client.clone());\n- let _node = node_client\n+\n+ match node_client\n.patch_status(\n&self.node_name,\n&PatchParams::default(),\n- &kube::api::Patch::Strategic(status),\n+ &kube::api::Patch::Json::<()>(patch),\n)\n.await\n- .map_err(|e| anyhow::anyhow!(\"Unable to patch node status: {}\", e))?;\n+ {\n+ Err(e) => Err(anyhow::anyhow!(\"Unable to patch node status: {}\", e)),\n+ Ok(s) => {\n+ debug!(\"Node status patch returned {:?}\", s);\nOk(())\n}\n+ }\n+ }\npub async fn listen_and_patch(self) -> anyhow::Result<()> {\nlet mut receiver = self.update_node_status_sender.subscribe();\n@@ -83,6 +100,7 @@ impl NodeStatusPatcher {\n// TODO: bubble up error\n}\nOk(_) => {\n+ debug!(\"Received notification that Node status should be patched\");\n// Grab status values\nlet status_patch = self.get_node_status_patch().await;\n// Do patch\n@@ -93,12 +111,21 @@ impl NodeStatusPatcher {\n}\n}\n+fn adjust_name(name: &str) -> String {\n+ name.replace(\"/\", \"~1\")\n+}\n+\n#[cfg(test)]\nmod tests {\nuse super::super::test_utils::{create_mock_healthy_devices, create_mock_kube_service};\nuse super::super::UNHEALTHY;\nuse super::*;\n+ #[test]\n+ fn test_adjust_name() {\n+ assert_eq!(adjust_name(\"example.com/r1\"), \"example.com~1r1\");\n+ }\n+\n#[tokio::test]\nasync fn test_do_node_status_patch() {\nlet devices = create_mock_healthy_devices(\"r1\", \"r2\");\n@@ -110,11 +137,14 @@ mod tests {\n.get_mut(\"r1-id1\")\n.unwrap()\n.health = UNHEALTHY.to_string();\n- let empty_node_status = NodeStatus {\n- capacity: None,\n- allocatable: None,\n- ..Default::default()\n- };\n+ let patch_value = serde_json::json!([\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/example.com~1foo\"),\n+ \"value\": \"2\"\n+ }\n+ ]);\n+ let patch = json_patch::from_value(patch_value).unwrap();\nlet (update_node_status_sender, _rx) = broadcast::channel(2);\n// Create and run a mock Kubernetes API service and get a Kubernetes client\n@@ -123,22 +153,22 @@ mod tests {\nlet node_status_patcher =\nNodeStatusPatcher::new(node_name, devices, update_node_status_sender, client);\nnode_status_patcher\n- .do_node_status_patch(empty_node_status)\n+ .do_node_status_patch(patch)\n.await\n.unwrap();\n}\n#[tokio::test]\nasync fn test_get_node_status_patch() {\n- let r1_name = \"r1\";\n- let r2_name = \"r2\";\n+ let r1_name = \"example.com/r1\";\n+ let r2_name = \"something.net/r2\";\nlet devices = create_mock_healthy_devices(r1_name, r2_name);\ndevices\n.write()\n.await\n- .get_mut(\"r1\")\n+ .get_mut(r1_name)\n.unwrap()\n- .get_mut(\"r1-id1\")\n+ .get_mut(&format!(\"{}-id1\", r1_name))\n.unwrap()\n.health = UNHEALTHY.to_string();\nlet (update_node_status_sender, _rx) = broadcast::channel(2);\n@@ -147,23 +177,76 @@ mod tests {\nlet (client, _mock_service_task) = create_mock_kube_service(node_name).await;\nlet node_status_patcher =\nNodeStatusPatcher::new(node_name, devices, update_node_status_sender, client);\n- let status = node_status_patcher.get_node_status_patch().await;\n+ let patch = node_status_patcher.get_node_status_patch().await;\n+ let expected_patch_value = serde_json::json!([\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/example.com~1r1\"),\n+ \"value\": \"3\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/allocatable/example.com~1r1\"),\n+ \"value\": \"2\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/something.net~1r2\"),\n+ \"value\": \"2\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/allocatable/something.net~1r2\"),\n+ \"value\": \"2\"\n+ }\n+ ]);\n+ let expected_patch = json_patch::from_value(expected_patch_value).unwrap();\n// Check that both resources listed under allocatable and only healthy devices are counted\n- let allocatable = status.allocatable.unwrap();\n- assert_eq!(allocatable.len(), 2);\n- assert_eq!(\n- allocatable.get(r1_name).unwrap(),\n- &Quantity(\"2\".to_string())\n- );\n- assert_eq!(\n- allocatable.get(r2_name).unwrap(),\n- &Quantity(\"2\".to_string())\n- );\n+ // Check that both resources listed under capacity and both healthy and unhealthy devices are counted\n+ assert_eq!(patch, expected_patch);\n+ }\n+ #[tokio::test]\n+ async fn test_get_node_status_patch_remove() {\n+ use std::collections::HashMap;\n+ let r1_name = \"example.com/r1\";\n+ let r2_name = \"something.net/r2\";\n+ let mut devices_map = HashMap::new();\n+ devices_map.insert(r1_name.to_string(), HashMap::new());\n+ devices_map.insert(r2_name.to_string(), HashMap::new());\n+ let devices = Arc::new(RwLock::new(devices_map));\n+ let (update_node_status_sender, _rx) = broadcast::channel(2);\n+ let node_name = \"test_node\";\n+ // Create and run a mock Kubernetes API service and get a Kubernetes client\n+ let (client, _mock_service_task) = create_mock_kube_service(node_name).await;\n+ let node_status_patcher =\n+ NodeStatusPatcher::new(node_name, devices, update_node_status_sender, client);\n+ let patch = node_status_patcher.get_node_status_patch().await;\n+ let expected_patch_value = serde_json::json!([\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/example.com~1r1\"),\n+ \"value\": \"0\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/allocatable/example.com~1r1\"),\n+ \"value\": \"0\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/capacity/something.net~1r2\"),\n+ \"value\": \"0\"\n+ },\n+ {\n+ \"op\": \"add\",\n+ \"path\": format!(\"/status/allocatable/something.net~1r2\"),\n+ \"value\": \"0\"\n+ }\n+ ]);\n+ let expected_patch = json_patch::from_value(expected_patch_value).unwrap();\n+ // Check that both resources listed under allocatable and only healthy devices are counted\n// Check that both resources listed under capacity and both healthy and unhealthy devices are counted\n- let capacity = status.capacity.unwrap();\n- assert_eq!(capacity.len(), 2);\n- assert_eq!(capacity.get(r1_name).unwrap(), &Quantity(\"3\".to_string()));\n- assert_eq!(capacity.get(r2_name).unwrap(), &Quantity(\"2\".to_string()));\n+ assert_eq!(patch, expected_patch);\n}\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
use json patch for node status patches Co-authored-by: Taylor Thomas <[email protected]>
350,448
16.06.2021 13:15:55
25,200
7c78427b6057568f44b831f43f11363be67573b7
fix resource quantity parsing and more allocate tests
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -4,12 +4,12 @@ use crate::device_plugin_api::v1beta1::{\nContainerAllocateResponse, RegisterRequest, API_VERSION,\n};\nuse crate::grpc_sock;\n-use crate::pod::Pod;\nuse super::node_patcher::NodeStatusPatcher;\nuse super::plugin_connection::PluginConnection;\nuse super::pod_devices::{ContainerDevices, DeviceAllocateInfo, PodDevices};\nuse super::{DeviceIdMap, DeviceMap, PluginDevicesMap, PodResourceRequests, HEALTHY};\n+use k8s_openapi::apimachinery::pkg::api::resource::Quantity;\nuse std::collections::{HashMap, HashSet};\nuse std::path::{Path, PathBuf};\nuse std::sync::Arc;\n@@ -206,7 +206,7 @@ impl DeviceManager {\n/// Takes in a map of devices requested by containers, keyed by container name.\npub async fn do_allocate(\n&self,\n- pod: &Pod,\n+ pod_uid: &str,\ncontainer_devices: PodResourceRequests,\n) -> anyhow::Result<()> {\nlet mut all_allocate_requests: HashMap<String, Vec<ContainerAllocateInfo>> = HashMap::new();\n@@ -219,7 +219,7 @@ impl DeviceManager {\n// Device plugin resources should be request in numerical amounts.\n// Return error if requested quantity cannot be parsed.\n- let num_requested: usize = serde_json::to_string(&quantity)?.parse()?;\n+ let num_requested: usize = get_num_from_quantity(quantity)?;\n// Check that the resource has enough healthy devices\nif !self\n@@ -236,12 +236,7 @@ impl DeviceManager {\n}\nlet devices_to_allocate = self\n- .devices_to_allocate(\n- &resource_name,\n- &pod.pod_uid(),\n- &container_name,\n- num_requested,\n- )\n+ .devices_to_allocate(&resource_name, pod_uid, &container_name, num_requested)\n.await?;\nlet container_allocate_request = ContainerAllocateRequest {\ndevices_i_ds: devices_to_allocate,\n@@ -259,7 +254,7 @@ impl DeviceManager {\n// Reset allocated_device_ids if allocation fails\nif let Err(e) = self\n- .do_allocate_for_pod(&pod.pod_uid(), all_allocate_requests)\n+ .do_allocate_for_pod(pod_uid, all_allocate_requests)\n.await\n{\n*self.allocated_device_ids.write().await = self.pod_devices.get_allocated_devices();\n@@ -531,6 +526,13 @@ async fn remove_resource_devices(devices: Arc<RwLock<DeviceMap>>, resource_name:\n}\n}\n+fn get_num_from_quantity(q: Quantity) -> anyhow::Result<usize> {\n+ match q.0.parse::<usize>() {\n+ Err(e) => Err(anyhow::anyhow!(e)),\n+ Ok(v) => Ok(v),\n+ }\n+}\n+\n#[cfg(test)]\nmod tests {\nuse super::super::{test_utils, PLUGIN_MANGER_SOCKET_NAME, UNHEALTHY};\n@@ -783,6 +785,28 @@ mod tests {\nDeviceManager::new_with_default_path(client, node_name)\n}\n+ #[test]\n+ fn test_get_num_from_quantity() {\n+ assert_eq!(get_num_from_quantity(Quantity(\"2\".to_string())).unwrap(), 2);\n+ }\n+\n+ // Test that when a pod requests resources that are not device plugins that no allocate calls are made\n+ #[tokio::test]\n+ async fn test_do_allocate_dne() {\n+ let resource_name = \"example.com/other-extended-resource\";\n+ let container_name = \"containerA\";\n+ let mut cont_resource_reqs = HashMap::new();\n+ cont_resource_reqs.insert(resource_name.to_string(), Quantity(\"2\".to_string()));\n+ let mut pod_resource_req = HashMap::new();\n+ pod_resource_req.insert(container_name.to_string(), cont_resource_reqs);\n+ let dm = create_device_manager(\"some_node\");\n+ // Note: device manager is initialized with an empty devices map, so no resource\n+ // \"example.com/other-extended-resource\" will be found\n+ dm.do_allocate(\"pod_uid\", pod_resource_req).await.unwrap();\n+ // Allocate should not be called\n+ assert_eq!(dm.get_pod_allocate_responses(\"pod_uid\").unwrap().len(), 0);\n+ }\n+\n// Pod with 2 Containers each requesting 2 devices of the same resource\n#[tokio::test]\nasync fn test_do_allocate_for_pod() {\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/resources.rs", "new_path": "crates/kubelet/src/state/common/resources.rs", "diff": "@@ -64,7 +64,7 @@ impl<P: GenericProvider> State<P::PodState> for Resources<P> {\n}\n// Do allocate for this Pod\nif let Err(e) = device_plugin_manager\n- .do_allocate(&pod, container_devices)\n+ .do_allocate(&pod.pod_uid(), container_devices)\n.await\n{\nerror!(error = %e);\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
fix resource quantity parsing and more allocate tests
350,448
16.06.2021 13:16:28
25,200
3f1b7b6719e07327535193b30ac59d93eb1bad26
fix device plugin default directory
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "diff": "@@ -21,9 +21,9 @@ use tokio_compat_02::FutureExt;\nuse tracing::trace;\n#[cfg(target_family = \"unix\")]\n-const DEFAULT_PLUGIN_PATH: &str = \"/var/lib/kubelet/device_plugins/\";\n+const DEFAULT_PLUGIN_PATH: &str = \"/var/lib/kubelet/device-plugins/\";\n#[cfg(target_family = \"windows\")]\n-const DEFAULT_PLUGIN_PATH: &str = \"c:\\\\ProgramData\\\\kubelet\\\\device_plugins\";\n+const DEFAULT_PLUGIN_PATH: &str = \"c:\\\\ProgramData\\\\kubelet\\\\device-plugins\";\nconst UPDATE_NODE_STATUS_CHANNEL_SIZE: usize = 15;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
fix device plugin default directory
350,439
16.06.2021 22:27:06
0
24b83b1388db61694def74012a72211b1bc72312
move device plugin manager into resources module
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/kubelet.rs", "new_path": "crates/kubelet/src/kubelet.rs", "diff": "///! This library contains code for running a kubelet. Use this to create a new\n///! Kubelet with a specific handler (called a `Provider`)\nuse crate::config::Config;\n-use crate::device_plugin_manager::{serve_device_registry, DeviceManager};\nuse crate::node;\nuse crate::operator::PodOperator;\nuse crate::plugin_watcher::PluginRegistry;\nuse crate::provider::{DevicePluginSupport, PluginSupport, Provider};\n+use crate::resources::device_plugin_manager::{serve_device_registry, DeviceManager};\nuse crate::webserver::start as start_webserver;\nuse futures::future::{FutureExt, TryFutureExt};\n@@ -242,9 +242,9 @@ async fn start_signal_handler(signal: Arc<AtomicBool>) -> anyhow::Result<()> {\n#[cfg(test)]\nmod test {\nuse super::*;\n- use crate::device_plugin_manager::DeviceManager;\nuse crate::plugin_watcher::PluginRegistry;\nuse crate::pod::{Pod, Status};\n+ use crate::resources::DeviceManager;\nuse crate::{\ncontainer::Container,\nprovider::{PluginSupport, VolumeSupport},\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/lib.rs", "new_path": "crates/kubelet/src/lib.rs", "diff": "@@ -113,13 +113,13 @@ pub(crate) mod mio_uds_windows;\npub mod backoff;\npub mod config;\npub mod container;\n-pub mod device_plugin_manager;\npub mod handle;\npub mod log;\npub mod node;\npub mod plugin_watcher;\npub mod pod;\npub mod provider;\n+pub mod resources;\npub mod secret;\npub mod state;\npub mod store;\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/provider/mod.rs", "new_path": "crates/kubelet/src/provider/mod.rs", "diff": "@@ -9,12 +9,12 @@ use thiserror::Error;\nuse tracing::{debug, error, info};\nuse crate::container::Container;\n-use crate::device_plugin_manager::DeviceManager;\nuse crate::log::Sender;\nuse crate::node::Builder;\nuse crate::plugin_watcher::PluginRegistry;\nuse crate::pod::Pod;\nuse crate::pod::Status as PodStatus;\n+use crate::resources::DeviceManager;\nuse krator::{ObjectState, State};\n/// A back-end for a Kubelet.\n" }, { "change_type": "RENAME", "old_path": "crates/kubelet/src/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "diff": "//! The Kubelet device plugin manager. Consists of a `DeviceRegistry` that hosts a registration service for device plugins, a `DeviceManager` that maintains a device plugin client for each registered device plugin, a `NodePatcher` that patches the Node status with the extended resources advertised by device plugins, and a `PodDevices` that maintains a list of Pods that are actively using allocated resources.\n+use super::super::util;\n+use super::node_patcher::NodeStatusPatcher;\n+use super::plugin_connection::PluginConnection;\n+use super::pod_devices::{ContainerDevices, DeviceAllocateInfo, PodDevices};\n+use super::{DeviceIdMap, DeviceMap, PluginDevicesMap, PodResourceRequests, HEALTHY};\nuse crate::device_plugin_api::v1beta1::{\ndevice_plugin_client::DevicePluginClient, AllocateRequest, ContainerAllocateRequest,\nContainerAllocateResponse, RegisterRequest, API_VERSION,\n};\nuse crate::grpc_sock;\n-\n-use super::node_patcher::NodeStatusPatcher;\n-use super::plugin_connection::PluginConnection;\n-use super::pod_devices::{ContainerDevices, DeviceAllocateInfo, PodDevices};\n-use super::{DeviceIdMap, DeviceMap, PluginDevicesMap, PodResourceRequests, HEALTHY};\nuse k8s_openapi::apimachinery::pkg::api::resource::Quantity;\nuse std::collections::{HashMap, HashSet};\nuse std::path::{Path, PathBuf};\n@@ -125,7 +125,7 @@ impl DeviceManager {\n};\n// Validate that plugin has proper extended resource name\n- if !super::resources::is_extended_resource_name(&register_request.resource_name) {\n+ if !util::is_extended_resource_name(&register_request.resource_name) {\nreturn Err(tonic::Status::new(\ntonic::Code::Unimplemented,\nformat!(\n" }, { "change_type": "RENAME", "old_path": "crates/kubelet/src/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/mod.rs", "diff": "@@ -3,7 +3,6 @@ pub mod manager;\npub(crate) mod node_patcher;\npub(crate) mod plugin_connection;\npub(crate) mod pod_devices;\n-pub mod resources;\nuse crate::device_plugin_api::v1beta1::{\nregistration_server::{Registration, RegistrationServer},\nDevice, Empty, RegisterRequest,\n" }, { "change_type": "RENAME", "old_path": "crates/kubelet/src/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/node_patcher.rs", "diff": "" }, { "change_type": "RENAME", "old_path": "crates/kubelet/src/device_plugin_manager/plugin_connection.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/plugin_connection.rs", "diff": "" }, { "change_type": "RENAME", "old_path": "crates/kubelet/src/device_plugin_manager/pod_devices.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/pod_devices.rs", "diff": "" }, { "change_type": "ADD", "old_path": null, "new_path": "crates/kubelet/src/resources/mod.rs", "diff": "+//! `resources` contains utilities and managers for container resources.\n+\n+pub(crate) mod device_plugin_manager;\n+pub use device_plugin_manager::manager::DeviceManager;\n+pub mod util;\n" }, { "change_type": "RENAME", "old_path": "crates/kubelet/src/device_plugin_manager/resources.rs", "new_path": "crates/kubelet/src/resources/util/mod.rs", "diff": "" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/resources.rs", "new_path": "crates/kubelet/src/state/common/resources.rs", "diff": "//! Resources can be successfully allocated to the Pod.\n-use crate::device_plugin_manager::{resources, PodResourceRequests};\nuse crate::pod::state::prelude::*;\nuse crate::provider::DevicePluginSupport;\n+use crate::resources::device_plugin_manager::PodResourceRequests;\n+use crate::resources::util;\nuse crate::volume::{HostPathVolume, VolumeRef};\nuse k8s_openapi::api::core::v1::HostPathVolumeSource;\nuse k8s_openapi::api::core::v1::Volume as KubeVolume;\n@@ -55,7 +56,7 @@ impl<P: GenericProvider> State<P::PodState> for Resources<P> {\n.clone()\n.into_iter()\n.filter(|(resource_name, _)| {\n- resources::is_extended_resource_name(resource_name)\n+ util::is_extended_resource_name(resource_name)\n})\n.collect();\ncontainer_devices.insert(container.name().to_string(), extended_resources);\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
move device plugin manager into resources module
350,437
18.06.2021 19:56:11
25,200
0d3905e84ad6636cfa93b4b70fc611584ae773ac
Update Wasmtime to v0.28
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -6,7 +6,16 @@ version = \"0.14.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7\"\ndependencies = [\n- \"gimli\",\n+ \"gimli 0.23.0\",\n+]\n+\n+[[package]]\n+name = \"addr2line\"\n+version = \"0.15.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a\"\n+dependencies = [\n+ \"gimli 0.24.0\",\n]\n[[package]]\n@@ -115,11 +124,11 @@ version = \"0.3.56\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc\"\ndependencies = [\n- \"addr2line\",\n+ \"addr2line 0.14.1\",\n\"cfg-if 1.0.0\",\n\"libc\",\n\"miniz_oxide\",\n- \"object\",\n+ \"object 0.23.0\",\n\"rustc-demangle\",\n]\n@@ -248,9 +257,9 @@ checksum = \"b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040\"\n[[package]]\nname = \"cap-fs-ext\"\n-version = \"0.13.7\"\n+version = \"0.13.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dee87a3a916d6f051fc6809c39c4627f0c3a73b2a803bcfbb5fdf2bdfa1da0cb\"\n+checksum = \"ff3a1e32332db9ad29d6da34693ce9a7ac26a9edf96abb5c1788d193410031ab\"\ndependencies = [\n\"cap-primitives\",\n\"cap-std\",\n@@ -261,9 +270,9 @@ dependencies = [\n[[package]]\nname = \"cap-primitives\"\n-version = \"0.13.7\"\n+version = \"0.13.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3c3e3ea29994a34f3bc67b5396a43c87597d302d9e2e5e3b3d5ba952d86c7b41\"\n+checksum = \"2d253b74de50b097594462618e7dd17b93b3e3bef19f32d2e512996f9095661f\"\ndependencies = [\n\"errno\",\n\"fs-set-times\",\n@@ -281,18 +290,18 @@ dependencies = [\n[[package]]\nname = \"cap-rand\"\n-version = \"0.13.7\"\n+version = \"0.13.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a0418058b38db7efc6021c5ce012e3a39c57e1a4d7bf2ddcd3789771de505d2f\"\n+checksum = \"458e98ed00e4276d0ac60da888d80957a177dfa7efa8dbb3be59f1e2b0e02ae5\"\ndependencies = [\n\"rand 0.8.3\",\n]\n[[package]]\nname = \"cap-std\"\n-version = \"0.13.7\"\n+version = \"0.13.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f5f20cbb3055e9c72b16ba45913fe9f92836d2aa7a880e1ffacb8d244f454319\"\n+checksum = \"7019d48ea53c5f378e0fdab0fe5f627fc00e76d65e75dffd6fb1cbc0c9b382ee\"\ndependencies = [\n\"cap-primitives\",\n\"posish\",\n@@ -302,9 +311,9 @@ dependencies = [\n[[package]]\nname = \"cap-time-ext\"\n-version = \"0.13.7\"\n+version = \"0.13.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6b684f9db089b0558520076b4eeda2b719a5c4c06f329be96c9497f2b48c3944\"\n+checksum = \"90585adeada7f804e6dcf71b8ff74217ad8742188fc870b9da5deab4722baa04\"\ndependencies = [\n\"cap-primitives\",\n\"once_cell\",\n@@ -419,38 +428,36 @@ checksum = \"8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634\"\n[[package]]\nname = \"cranelift-bforest\"\n-version = \"0.72.0\"\n+version = \"0.75.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"841476ab6d3530136b5162b64a2c6969d68141843ad2fd59126e5ea84fd9b5fe\"\n+checksum = \"df3f8dd4f920a422c96c53fb6a91cc7932b865fdb60066ae9df7c329342d303f\"\ndependencies = [\n\"cranelift-entity\",\n]\n[[package]]\nname = \"cranelift-codegen\"\n-version = \"0.72.0\"\n+version = \"0.75.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2b5619cef8d19530298301f91e9a0390d369260799a3d8dd01e28fc88e53637a\"\n+checksum = \"ebe85f9a8dbf3c9dfa47ecb89828a7dc17c0b62015b84b5505fd4beba61c542c\"\ndependencies = [\n- \"byteorder\",\n\"cranelift-bforest\",\n\"cranelift-codegen-meta\",\n\"cranelift-codegen-shared\",\n\"cranelift-entity\",\n- \"gimli\",\n+ \"gimli 0.24.0\",\n\"log 0.4.14\",\n\"regalloc\",\n\"serde\",\n\"smallvec\",\n\"target-lexicon\",\n- \"thiserror\",\n]\n[[package]]\nname = \"cranelift-codegen-meta\"\n-version = \"0.72.0\"\n+version = \"0.75.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2a319709b8267939155924114ea83f2a5b5af65ece3ac6f703d4735f3c66bb0d\"\n+checksum = \"12bc4be68da214a56bf9beea4212eb3b9eac16ca9f0b47762f907c4cd4684073\"\ndependencies = [\n\"cranelift-codegen-shared\",\n\"cranelift-entity\",\n@@ -458,27 +465,27 @@ dependencies = [\n[[package]]\nname = \"cranelift-codegen-shared\"\n-version = \"0.72.0\"\n+version = \"0.75.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"15925b23cd3a448443f289d85a8f53f3cf7a80f0137aa53c8e3b01ae8aefaef7\"\n+checksum = \"a0c87b69923825cfbc3efde17d929a68cd5b50a4016b2bd0eb8c3933cc5bd8cd\"\ndependencies = [\n\"serde\",\n]\n[[package]]\nname = \"cranelift-entity\"\n-version = \"0.72.0\"\n+version = \"0.75.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"610cf464396c89af0f9f7c64b5aa90aa9e8812ac84084098f1565b40051bc415\"\n+checksum = \"fe683e7ec6e627facf44b2eab4b263507be4e7ef7ea06eb8cee5283d9b45370e\"\ndependencies = [\n\"serde\",\n]\n[[package]]\nname = \"cranelift-frontend\"\n-version = \"0.72.0\"\n+version = \"0.75.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4d20c8bd4a1c41ded051734f0e33ad1d843a0adc98b9bd975ee6657e2c70cdc9\"\n+checksum = \"5da80025ca214f0118273f8b94c4790add3b776f0dc97afba6b711757497743b\"\ndependencies = [\n\"cranelift-codegen\",\n\"log 0.4.14\",\n@@ -488,9 +495,9 @@ dependencies = [\n[[package]]\nname = \"cranelift-native\"\n-version = \"0.72.0\"\n+version = \"0.75.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"304e100df41f34a5a15291b37bfe0fd7abd0427a2c84195cc69578b4137f9099\"\n+checksum = \"e1c0e8c56f9a63f352a64aaa9c9eef7c205008b03593af7b128a3fbc46eae7e9\"\ndependencies = [\n\"cranelift-codegen\",\n\"target-lexicon\",\n@@ -498,9 +505,9 @@ dependencies = [\n[[package]]\nname = \"cranelift-wasm\"\n-version = \"0.72.0\"\n+version = \"0.75.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4efd473b2917303957e0bfaea6ea9d08b8c93695bee015a611a2514ce5254abc\"\n+checksum = \"d10ddafc5f1230d2190eb55018fcdecfcce728c9c2b975f2690ef13691d18eb5\"\ndependencies = [\n\"cranelift-codegen\",\n\"cranelift-entity\",\n@@ -992,6 +999,12 @@ name = \"gimli\"\nversion = \"0.23.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce\"\n+\n+[[package]]\n+name = \"gimli\"\n+version = \"0.24.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189\"\ndependencies = [\n\"fallible-iterator\",\n\"indexmap\",\n@@ -1693,9 +1706,9 @@ checksum = \"4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4\"\n[[package]]\nname = \"memchr\"\n-version = \"2.3.4\"\n+version = \"2.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525\"\n+checksum = \"b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc\"\n[[package]]\nname = \"memoffset\"\n@@ -1918,9 +1931,16 @@ name = \"object\"\nversion = \"0.23.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4\"\n+\n+[[package]]\n+name = \"object\"\n+version = \"0.25.3\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7\"\ndependencies = [\n\"crc32fast\",\n\"indexmap\",\n+ \"memchr\",\n]\n[[package]]\n@@ -3007,9 +3027,9 @@ dependencies = [\n[[package]]\nname = \"system-interface\"\n-version = \"0.6.3\"\n+version = \"0.6.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1fd411f50bd848d1efefd5957d494eddc80979380e3c4f80b4ba2ebd26d1b673\"\n+checksum = \"97a6aa8a77b9b8b533ec5a178ce0ea749c3a6cc6a79d0d38c89cd257dc4e34eb\"\ndependencies = [\n\"atty\",\n\"bitflags 1.2.1\",\n@@ -3024,9 +3044,9 @@ dependencies = [\n[[package]]\nname = \"target-lexicon\"\n-version = \"0.11.2\"\n+version = \"0.12.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95\"\n+checksum = \"64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834\"\n[[package]]\nname = \"tempfile\"\n@@ -3592,9 +3612,9 @@ checksum = \"f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564\"\n[[package]]\nname = \"unsafe-io\"\n-version = \"0.6.2\"\n+version = \"0.6.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0301dd0f2c21baed606faa2717fbfbb1a68b7e289ea29b40bc21a16f5ae9f5aa\"\n+checksum = \"f372ce89b46cb10aace91021ff03f26cf97594f7515c0a8c1c2839c13814665d\"\ndependencies = [\n\"rustc_version 0.3.3\",\n\"winapi 0.3.9\",\n@@ -3748,11 +3768,12 @@ checksum = \"1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f\"\n[[package]]\nname = \"wasi-cap-std-sync\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b935979b43ace1ed03b14bb90598114822583c77b7616b39f62b0a91952bdc34\"\n+checksum = \"54ed414ed6ff3b95653ea07b237cf03c513015d94169aac159755e05a2eaa80f\"\ndependencies = [\n\"anyhow\",\n+ \"async-trait\",\n\"bitflags 1.2.1\",\n\"cap-fs-ext\",\n\"cap-rand\",\n@@ -3770,9 +3791,9 @@ dependencies = [\n[[package]]\nname = \"wasi-common\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"40b42cc1c6e2f8485b2a3d9f70f13d734225f99e748ef33d88f2ae78592072cc\"\n+checksum = \"6c67b1e49ae6d9bcab37a6f13594aed98d8ab8f5c2117b3bed543d8019688733\"\ndependencies = [\n\"anyhow\",\n\"bitflags 1.2.1\",\n@@ -3882,15 +3903,15 @@ checksum = \"7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1\"\n[[package]]\nname = \"wasmparser\"\n-version = \"0.76.0\"\n+version = \"0.78.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"755a9a4afe3f6cccbbe6d7e965eef44cf260b001f93e547eba84255c1d0187d8\"\n+checksum = \"52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65\"\n[[package]]\nname = \"wasmtime\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"26ea2ad49bb047e10ca292f55cd67040bef14b676d07e7b04ed65fd312d52ece\"\n+checksum = \"56828b11cd743a0e9b4207d1c7a8c1a66cb32d14601df10422072802a6aee86c\"\ndependencies = [\n\"anyhow\",\n\"backtrace\",\n@@ -3898,9 +3919,11 @@ dependencies = [\n\"cfg-if 1.0.0\",\n\"cpp_demangle\",\n\"indexmap\",\n+ \"lazy_static\",\n\"libc\",\n\"log 0.4.14\",\n\"paste\",\n+ \"psm\",\n\"region\",\n\"rustc-demangle\",\n\"serde\",\n@@ -3919,9 +3942,9 @@ dependencies = [\n[[package]]\nname = \"wasmtime-cache\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9353a705eb98838d885a4d0186c087167fd5ea087ef3511bdbdf1a79420a1d2d\"\n+checksum = \"99aca6335ad194d795342137a92afaec9338a2bfcf4caa4c667b5ece16c2bfa9\"\ndependencies = [\n\"anyhow\",\n\"base64 0.13.0\",\n@@ -3940,28 +3963,29 @@ dependencies = [\n[[package]]\nname = \"wasmtime-cranelift\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5e769b80abbb89255926f69ba37085f7dd6608c980134838c3c89d7bf6e776bc\"\n+checksum = \"519fa80abe29dc46fc43177cbe391e38c8613c59229c8d1d90d7f226c3c7cede\"\ndependencies = [\n\"cranelift-codegen\",\n\"cranelift-entity\",\n\"cranelift-frontend\",\n\"cranelift-wasm\",\n+ \"target-lexicon\",\n\"wasmparser\",\n\"wasmtime-environ\",\n]\n[[package]]\nname = \"wasmtime-debug\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"38501788c936a4932b0ddf61135963a4b7d1f549f63a6908ae56a1c86d74fc7b\"\n+checksum = \"6ddf6e9bca2f3bc1dd499db2a93d35c735176cff0de7daacdc18c3794f7082e0\"\ndependencies = [\n\"anyhow\",\n- \"gimli\",\n+ \"gimli 0.24.0\",\n\"more-asserts\",\n- \"object\",\n+ \"object 0.25.3\",\n\"target-lexicon\",\n\"thiserror\",\n\"wasmparser\",\n@@ -3970,20 +3994,18 @@ dependencies = [\n[[package]]\nname = \"wasmtime-environ\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fae793ea1387b2fede277d209bb27285366df58f0a3ae9d59e58a7941dce60fa\"\n+checksum = \"0a991635b1cf1d1336fbea7a5f2c0e1dafaa54cb21c632d8414885278fa5d1b1\"\ndependencies = [\n- \"anyhow\",\n\"cfg-if 1.0.0\",\n\"cranelift-codegen\",\n\"cranelift-entity\",\n\"cranelift-wasm\",\n- \"gimli\",\n+ \"gimli 0.24.0\",\n\"indexmap\",\n\"log 0.4.14\",\n\"more-asserts\",\n- \"region\",\n\"serde\",\n\"thiserror\",\n\"wasmparser\",\n@@ -3991,9 +4013,9 @@ dependencies = [\n[[package]]\nname = \"wasmtime-fiber\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c479ba281bc54236209f43a954fc2a874ca3e5fa90116576b1ae23782948783f\"\n+checksum = \"7ab6bb95303636d1eba6f7fd2b67c1cd583f73303c73b1a3259b46bb1c2eb299\"\ndependencies = [\n\"cc\",\n\"libc\",\n@@ -4002,11 +4024,11 @@ dependencies = [\n[[package]]\nname = \"wasmtime-jit\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9b3bd0fae8396473a68a1491559d61776127bb9bea75c9a6a6c038ae4a656eb2\"\n+checksum = \"5f33a0ae79b7c8d050156b22e10fdc49dfb09cc482c251d12bf10e8a833498fb\"\ndependencies = [\n- \"addr2line\",\n+ \"addr2line 0.15.2\",\n\"anyhow\",\n\"cfg-if 1.0.0\",\n\"cranelift-codegen\",\n@@ -4014,10 +4036,10 @@ dependencies = [\n\"cranelift-frontend\",\n\"cranelift-native\",\n\"cranelift-wasm\",\n- \"gimli\",\n+ \"gimli 0.24.0\",\n\"log 0.4.14\",\n\"more-asserts\",\n- \"object\",\n+ \"object 0.25.3\",\n\"rayon\",\n\"region\",\n\"serde\",\n@@ -4035,13 +4057,13 @@ dependencies = [\n[[package]]\nname = \"wasmtime-obj\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a79fa098a3be8fabc50f5be60f8e47694d569afdc255de37850fc80295485012\"\n+checksum = \"4a879f03d416615f322dcb3aa5cb4cbc47b64b12be6aa235a64ab63a4281d50a\"\ndependencies = [\n\"anyhow\",\n\"more-asserts\",\n- \"object\",\n+ \"object 0.25.3\",\n\"target-lexicon\",\n\"wasmtime-debug\",\n\"wasmtime-environ\",\n@@ -4049,16 +4071,16 @@ dependencies = [\n[[package]]\nname = \"wasmtime-profiling\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d81e2106efeef4c01917fd16956a91d39bb78c07cf97027abdba9ca98da3f258\"\n+checksum = \"171ae3107e8502667b16d336a1dd03e370aa6630a1ce26559aba572ade1031d1\"\ndependencies = [\n\"anyhow\",\n\"cfg-if 1.0.0\",\n- \"gimli\",\n+ \"gimli 0.24.0\",\n\"lazy_static\",\n\"libc\",\n- \"object\",\n+ \"object 0.25.3\",\n\"scroll\",\n\"serde\",\n\"target-lexicon\",\n@@ -4068,9 +4090,9 @@ dependencies = [\n[[package]]\nname = \"wasmtime-runtime\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f747c656ca4680cad7846ae91c57d03f2dd4f4170da77a700df4e21f0d805378\"\n+checksum = \"0404e10f8b07f940be42aa4b8785b4ab42e96d7167ccc92e35d36eee040309c2\"\ndependencies = [\n\"anyhow\",\n\"backtrace\",\n@@ -4080,52 +4102,28 @@ dependencies = [\n\"lazy_static\",\n\"libc\",\n\"log 0.4.14\",\n+ \"mach\",\n\"memoffset\",\n\"more-asserts\",\n- \"psm\",\n- \"rand 0.7.3\",\n+ \"rand 0.8.3\",\n\"region\",\n\"thiserror\",\n\"wasmtime-environ\",\n+ \"wasmtime-fiber\",\n\"winapi 0.3.9\",\n]\n[[package]]\nname = \"wasmtime-wasi\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"af5ebd3cfc82606e0332437cb370a9a018e8e2e8480c1bdcc10da93620ffad9e\"\n+checksum = \"39d75f21122ec134c8bfc8840a8742c0d406a65560fb9716b23800bd7cfd6ae5\"\ndependencies = [\n\"anyhow\",\n+ \"wasi-cap-std-sync\",\n\"wasi-common\",\n\"wasmtime\",\n- \"wasmtime-wiggle\",\n- \"wiggle\",\n-]\n-\n-[[package]]\n-name = \"wasmtime-wiggle\"\n-version = \"0.25.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"aa44fba6a1709e2f8d59535796e38332121ba86823ce78cc4d3c8e7b3ed531da\"\n-dependencies = [\n- \"wasmtime\",\n- \"wasmtime-wiggle-macro\",\n\"wiggle\",\n- \"wiggle-borrow\",\n-]\n-\n-[[package]]\n-name = \"wasmtime-wiggle-macro\"\n-version = \"0.25.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8505a6f708e4db716f6c8936cee36e7d869448b38961b1b788be0e1852da8ad9\"\n-dependencies = [\n- \"proc-macro2\",\n- \"quote 1.0.9\",\n- \"syn 1.0.60\",\n- \"wiggle-generate\",\n- \"witx\",\n]\n[[package]]\n@@ -4139,20 +4137,20 @@ dependencies = [\n[[package]]\nname = \"wast\"\n-version = \"35.0.0\"\n+version = \"36.0.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"db5ae96da18bb5926341516fd409b5a8ce4e4714da7f0a1063d3b20ac9f9a1e1\"\n+checksum = \"8b5d7ba374a364571da1cb0a379a3dc302582a2d9937a183bfe35b68ad5bb9c4\"\ndependencies = [\n\"leb128\",\n]\n[[package]]\nname = \"wat\"\n-version = \"1.0.36\"\n+version = \"1.0.38\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0b0fa059022c5dabe129f02b429d67086400deb8277f89c975555dacc1dadbcc\"\n+checksum = \"16383df7f0e3901484c2dda6294ed6895caa3627ce4f6584141dcf30a33a23e6\"\ndependencies = [\n- \"wast 35.0.0\",\n+ \"wast 36.0.0\",\n]\n[[package]]\n@@ -4196,32 +4194,24 @@ dependencies = [\n[[package]]\nname = \"wiggle\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d80697b8479b8aea64dfa454d593a35d46c2530c30d3e54f1c9c3bf934b52f9b\"\n+checksum = \"79ca01f1388a549eb3eaa221a072c3cfd3e383618ec6b423e82f2734ee28dd40\"\ndependencies = [\n+ \"anyhow\",\n\"async-trait\",\n\"bitflags 1.2.1\",\n\"thiserror\",\n\"tracing\",\n+ \"wasmtime\",\n\"wiggle-macro\",\n- \"witx\",\n-]\n-\n-[[package]]\n-name = \"wiggle-borrow\"\n-version = \"0.25.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"df677e1a757a4d3bd4b4ff632a23059cd8570dd93b73962dc96a6eb64e824228\"\n-dependencies = [\n- \"wiggle\",\n]\n[[package]]\nname = \"wiggle-generate\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b6a47a1cf5407c9e45c2b0144dae3780bb9812093fd59d69e517239b229173a8\"\n+checksum = \"544fd41029c33b179656ab1674cd813db7cd473f38f1976ae6e08effb46dd269\"\ndependencies = [\n\"anyhow\",\n\"heck\",\n@@ -4234,10 +4224,11 @@ dependencies = [\n[[package]]\nname = \"wiggle-macro\"\n-version = \"0.25.0\"\n+version = \"0.28.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"91f4d7ee3dac8c22934a18b52269b63e1cfe75b75575821d756f5f34a2a4ca78\"\n+checksum = \"9e31ae77a274c9800e6f1342fa4a6dde5e2d72eb9d9b2e0418781be6efc35b58\"\ndependencies = [\n+ \"proc-macro2\",\n\"quote 1.0.9\",\n\"syn 1.0.60\",\n\"wiggle-generate\",\n@@ -4298,9 +4289,9 @@ dependencies = [\n[[package]]\nname = \"winx\"\n-version = \"0.23.0\"\n+version = \"0.25.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a316462681accd062e32c37f9d78128691a4690764917d13bd8ea041baf2913e\"\n+checksum = \"2bdb79e12a5ac98f09e863b99c38c72f942a41f643ae0bb05d4d6d2633481341\"\ndependencies = [\n\"bitflags 1.2.1\",\n\"winapi 0.3.9\",\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/Cargo.toml", "new_path": "crates/wasi-provider/Cargo.toml", "diff": "@@ -24,10 +24,10 @@ anyhow = \"1.0\"\nasync-trait = \"0.1\"\nbacktrace = \"0.3\"\nkube = { version = \"0.55\", default-features = false }\n-wasmtime = \"0.25\"\n-wasmtime-wasi = \"0.25\"\n-wasi-common = \"0.25\"\n-wasi-cap-std-sync = \"0.25\"\n+wasmtime = { version = \"0.28\", default-features = true }\n+wasmtime-wasi = \"0.28\"\n+wasi-common = \"0.28\"\n+wasi-cap-std-sync = \"0.28\"\ncap-std = \"0.13\"\ntempfile = \"3.1\"\nserde = \"1.0\"\n@@ -35,7 +35,7 @@ serde_derive = \"1.0\"\nserde_json = \"1.0\"\nkubelet = { path = \"../kubelet\", version = \"0.7\", default-features = false, features = [\"derive\"] }\nkrator = { version = \"0.3\", default-features = false, features = [\"derive\"] }\n-wat = \"1.0\"\n+wat = \"1.0.38\"\ntokio = { version = \"1.0\", features = [\"fs\", \"macros\", \"io-util\", \"sync\"] }\nchrono = { version = \"0.4\", features = [\"serde\"] }\nfutures = \"0.3\"\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/wasi_runtime.rs", "new_path": "crates/wasi-provider/src/wasi_runtime.rs", "diff": "-use anyhow::bail;\nuse std::collections::HashMap;\nuse std::path::{Path, PathBuf};\nuse std::sync::Arc;\n@@ -9,9 +8,7 @@ use tokio::sync::mpsc::Sender;\nuse tokio::sync::oneshot;\nuse tokio::task::JoinHandle;\nuse wasi_cap_std_sync::WasiCtxBuilder;\n-use wasmtime::InterruptHandle;\n-use wasmtime_wasi::snapshots::preview_0::Wasi as WasiUnstable;\n-use wasmtime_wasi::snapshots::preview_1::Wasi;\n+use wasmtime::{InterruptHandle, Linker};\nuse kubelet::container::Handle as ContainerHandle;\nuse kubelet::container::Status;\n@@ -165,31 +162,22 @@ impl WasiRuntime {\n.iter()\n.map(|(k, v)| (k.to_string(), v.to_string()))\n.collect();\n- let stdout = unsafe { cap_std::fs::File::from_std(output_write.try_clone()?) };\n- let stdout = wasi_cap_std_sync::file::File::from_cap_std(stdout);\n- let stderr = unsafe { cap_std::fs::File::from_std(output_write.try_clone()?) };\n- let stderr = wasi_cap_std_sync::file::File::from_cap_std(stderr);\n-\n- // Build the WASI instance and then generate a list of WASI modules\n- let ctx_builder_snapshot = WasiCtxBuilder::new();\n- let mut ctx_builder_snapshot = ctx_builder_snapshot\n- .args(&data.args)?\n- .envs(&env)?\n- .stdout(Box::new(stdout))\n- .stderr(Box::new(stderr));\n-\n- let stdout = unsafe { cap_std::fs::File::from_std(output_write.try_clone()?) };\n- let stdout = wasi_cap_std_sync::file::File::from_cap_std(stdout);\n- let stderr = unsafe { cap_std::fs::File::from_std(output_write.try_clone()?) };\n- let stderr = wasi_cap_std_sync::file::File::from_cap_std(stderr);\n+ let stdout = wasi_cap_std_sync::file::File::from_cap_std(unsafe {\n+ cap_std::fs::File::from_std(output_write.try_clone()?)\n+ });\n+ let stderr = wasi_cap_std_sync::file::File::from_cap_std(unsafe {\n+ cap_std::fs::File::from_std(output_write.try_clone()?)\n+ });\n- let ctx_builder_unstable = WasiCtxBuilder::new();\n- let mut ctx_builder_unstable = ctx_builder_unstable\n+ // Create the WASI context builder and pass arguments, environment,\n+ // and standard output and error.\n+ let mut builder = WasiCtxBuilder::new()\n.args(&data.args)?\n.envs(&env)?\n.stdout(Box::new(stdout))\n.stderr(Box::new(stderr));\n+ // Add preopen dirs.\nfor (key, value) in data.dirs.iter() {\nlet guest_dir = value.as_ref().unwrap_or(key);\ndebug!(\n@@ -198,30 +186,22 @@ impl WasiRuntime {\n\"mounting hostpath in modules\"\n);\nlet preopen_dir = unsafe { cap_std::fs::Dir::open_ambient_dir(key) }?;\n- ctx_builder_snapshot =\n- ctx_builder_snapshot.preopened_dir(preopen_dir, guest_dir)?;\n- let preopen_dir = unsafe { cap_std::fs::Dir::open_ambient_dir(key) }?;\n- ctx_builder_unstable =\n- ctx_builder_unstable.preopened_dir(preopen_dir, guest_dir)?;\n+\n+ builder = builder.preopened_dir(preopen_dir, guest_dir)?;\n}\n- let wasi_ctx_snapshot = ctx_builder_snapshot.build()?;\n- let wasi_ctx_unstable = ctx_builder_unstable.build()?;\n+\n+ let ctx = builder.build();\n+\nlet mut config = wasmtime::Config::new();\nconfig.interruptable(true);\nlet engine = wasmtime::Engine::new(&config)?;\n- let store = wasmtime::Store::new(&engine);\n+ let mut store = wasmtime::Store::new(&engine, ctx);\nlet interrupt = store.interrupt_handle()?;\ntx.send(interrupt)\n.map_err(|_| anyhow::anyhow!(\"Unable to send interrupt back to main thread\"))?;\n- let wasi_snapshot = Wasi::new(\n- &store,\n- std::rc::Rc::new(std::cell::RefCell::new(wasi_ctx_snapshot)),\n- );\n- let wasi_unstable = WasiUnstable::new(\n- &store,\n- std::rc::Rc::new(std::cell::RefCell::new(wasi_ctx_unstable)),\n- );\n+ let mut linker = Linker::new(&engine);\n+\nlet module = match wasmtime::Module::new(&engine, &data.module_data) {\n// We can't map errors here or it moves the send channel, so we\n// do it in a match\n@@ -242,48 +222,12 @@ impl WasiRuntime {\nreturn Err(anyhow::anyhow!(\"{}: {}\", message, e));\n}\n};\n- // Iterate through the module includes and resolve imports\n- let imports = module\n- .imports()\n- .map(|i| {\n- let name = i.name().unwrap();\n- // This is super funky logic, but it matches what is in 0.12.0\n- let export = match i.module() {\n- \"wasi_snapshot_preview1\" => wasi_snapshot.get_export(name),\n- \"wasi_unstable\" => wasi_unstable.get_export(name),\n- other => bail!(\"import module `{}` was not found\", other),\n- };\n- match export {\n- Some(export) => Ok(export.clone().into()),\n- None => bail!(\"import `{}` was not found in module `{}`\", name, i.module()),\n- }\n- })\n- .collect::<Result<Vec<_>, _>>();\n- let imports = match imports {\n- // We can't map errors here or it moves the send channel, so we\n- // do it in a match\n- Ok(m) => m,\n- Err(e) => {\n- let message = \"unable to load module\";\n- error!(error = %e, \"{}\", message);\n- send(\n- &status_sender,\n- &name,\n- Status::Terminated {\n- failed: true,\n- message: message.into(),\n- timestamp: chrono::Utc::now(),\n- },\n- );\n- return Err(e);\n- }\n- };\n-\n- let instance = match wasmtime::Instance::new(&store, &module, &imports) {\n+ wasmtime_wasi::add_to_linker(&mut linker, |cx| cx)?;\n+ let instance = match linker.instantiate(&mut store, &module) {\n// We can't map errors here or it moves the send channel, so we\n// do it in a match\n- Ok(m) => m,\n+ Ok(i) => i,\nErr(e) => {\nlet message = \"unable to instantiate module\";\nerror!(error = %e, \"{}\", message);\n@@ -314,7 +258,7 @@ impl WasiRuntime {\n);\nlet export = instance\n- .get_export(\"_start\")\n+ .get_export(&mut store, \"_start\")\n.ok_or_else(|| anyhow::anyhow!(\"_start import doesn't exist in wasm module\"))?;\nlet func = match export {\nwasmtime::Extern::Func(f) => f,\n@@ -334,7 +278,7 @@ impl WasiRuntime {\nreturn Err(anyhow::anyhow!(message));\n}\n};\n- match func.call(&[]) {\n+ match func.call(&mut store, &[]) {\n// We can't map errors here or it moves the send channel, so we\n// do it in a match\nOk(_) => {}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Update Wasmtime to v0.28 Signed-off-by: Radu M <[email protected]>
350,448
21.06.2021 15:02:48
25,200
e017df36b29e3fe8dd4d48175138494003674184
import from correct resources module
[ { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/lib.rs", "new_path": "crates/wasi-provider/src/lib.rs", "diff": "@@ -40,7 +40,6 @@ use std::path::{Path, PathBuf};\nuse std::sync::Arc;\nuse async_trait::async_trait;\n-use kubelet::device_plugin_manager::DeviceManager;\nuse kubelet::node::Builder;\nuse kubelet::plugin_watcher::PluginRegistry;\nuse kubelet::pod::state::prelude::SharedState;\n@@ -48,6 +47,7 @@ use kubelet::pod::{Handle, Pod, PodKey};\nuse kubelet::provider::{\nDevicePluginSupport, PluginSupport, Provider, ProviderError, VolumeSupport,\n};\n+use kubelet::resources::DeviceManager;\nuse kubelet::state::common::registered::Registered;\nuse kubelet::state::common::terminated::Terminated;\nuse kubelet::state::common::{GenericProvider, GenericProviderState};\n" }, { "change_type": "MODIFY", "old_path": "src/krustlet-wasi.rs", "new_path": "src/krustlet-wasi.rs", "diff": "use kubelet::config::Config;\n-use kubelet::device_plugin_manager::DeviceManager;\nuse kubelet::plugin_watcher::PluginRegistry;\n+use kubelet::resources::DeviceManager;\nuse kubelet::store::composite::ComposableStore;\nuse kubelet::store::oci::FileStore;\nuse kubelet::Kubelet;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
import from correct resources module
350,448
22.06.2021 11:43:32
25,200
5dfc26b8eb07ce0a77b95f85ae374d004981cd02
use device manager directory for plugin endpoints
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "diff": "@@ -171,7 +171,10 @@ impl DeviceManager {\nresource = %register_request.resource_name, \"Connecting to plugin at {:?} for ListAndWatch\",\nregister_request.endpoint\n);\n- let chan = grpc_sock::client::socket_channel(register_request.endpoint.clone()).await?;\n+ let chan = grpc_sock::client::socket_channel(\n+ self.plugin_dir.join(register_request.endpoint.clone()),\n+ )\n+ .await?;\nlet client = DevicePluginClient::new(chan);\n// Clone structures for PluginConnection thread\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
use device manager directory for plugin endpoints
350,449
23.06.2021 13:45:18
25,200
05cbf8bf3bad41a119d892cf236e566f873fa450
Updated default aks version to 1.20.7
[ { "change_type": "MODIFY", "old_path": "contrib/azure/azuredeploy.parameters.json", "new_path": "contrib/azure/azuredeploy.parameters.json", "diff": "\"value\": null\n},\n\"kubernetesVersion\": {\n- \"value\": \"1.18.10\"\n+ \"value\": \"1.20.7\"\n},\n\"krustletURL\": {\n\"value\": \"https://krustlet.blob.core.windows.net/releases/krustlet-v0.6.0-linux-amd64.tar.gz\"\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Updated default aks version to 1.20.7
350,448
23.06.2021 14:49:12
25,200
4e3bfac4476f7ef54caa3c9b929183ea79b01144
add device plugin documentation
[ { "change_type": "MODIFY", "old_path": "docs/topics/plugin_system.md", "new_path": "docs/topics/plugin_system.md", "diff": "# Plugin System Overview\n+Krustlet partially implements support for CSI and device plugins. For CSI plugins support,\nKrustlet partially implements the plugin discovery system used by the mainline\n-Kubelet for purposes of supporting CSI. The CSI documentation points at the\n-[device plugin documentation](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration),\n-but upon further investigation/reverse engineering, we determined that CSI\n-plugins use the auto plugin discovery method implemented\n+Kubelet. Upon investigation/ reverse engineering, we determined that CSI and device plugins use different APIs, the [plugin registration](../../crates/kubelet/proto/pluginregistration/v1/pluginregistration.proto) and [device plugin](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto) APIs, respectively.\n+CSI plugins use the auto plugin discovery method implemented\n[here](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/pluginmanager).\n-You can also see other evidence of this in the\n+You can see other evidence of this in the\n[csi-common code](https://github.com/kubernetes-csi/drivers/blob/master/pkg/csi-common/nodeserver-default.go)\nand the [Node Driver Registrar\ndocumentation](https://github.com/kubernetes-csi/node-driver-registrar/blob/be7678e75e23b5419624ae3983b66957c0991073/README.md).\n+Instead of watching for plugins as done by the CSI [`pluginwatcher` package](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/pluginmanager/pluginwatcher) in the kubelet, the kubelet [`devicemanager`](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/cm/devicemanager) hosts a registration service for device plugins, as described in the\n+[device plugin documentation](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).\n-## What is not supported?\n-Currently we do not support the `DevicePlugin` type or the aforementioned newer\n-device plugin system. Currently we do not have plans to implement it, but that\n-could change in the future as needs/uses evolve\n-\n-## How does it work?\n+## CSI Plugins\n+### Registration: How does it work?\nThe plugin registration system has an event driven loop for discovering and\nregistering plugins:\n@@ -38,8 +35,27 @@ registering plugins:\n### Additional information\n-In normal Kubernetes land, most CSI plugins register themselves with the Kubelet\n+In normal Kubernetes land, most CSI plugins register themselves with the kubelet\nusing the [Node Driver\nRegistrar](https://github.com/kubernetes-csi/node-driver-registrar) sidecar\n-container that runs with the actual CSI driver. It has the responsibilty for\n-creating the socket that Kubelet discovers.\n+container that runs with the actual CSI driver. It has the responsibility for\n+creating the socket that the kubelet discovers.\n+\n+## Device Plugins\n+\n+Krustlet supports Kubernetes [device plugins](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/), which enable Kubernetes workloads to request extended resources, such as hardware, advertised by device plugins. Krustlet implements the [Kubernetes device manager](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/cm/devicemanager) in the kubelet's [`resources` module](../../crates/kubelet/src/resources). It implements the [device plugin framework's `Registration` gRPC service](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).\n+\n+Flow from registering device plugin (DP) to running a Pod requesting an DP extended resource:\n+1. The kubelet's `DeviceManager` hosts the [device plugin framework's `Registration` gRPC service](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration) on the Kubernetes default `/var/lib/kubelet/device-plugins/kubelet.sock`.\n+1. DP registers itself with the kubelet through this gRPC service. This allows the DP to advertise a resource such as system hardware to kubelet.\n+1. The kubelet creates a `PluginConnection` for marshalling requests to the DP. It calls the DP's `ListAndWatch` service, creating a bi-directional streaming connection. The device plugin updates the kubelet about the device health across this connection.\n+1. Each time the `PluginConnection` receives device updates across the `ListAndWatch` connection. It updates the map of all devices (`DeviceMap`) shared between the `DeviceManager`, `PluginConnections` and `NodePatcher` and notifies the `NodePatcher` to update the `NodeStatus` of the node with appropriate `allocatable` and `capacity` entries.\n+1. Once a Pod is applied that requests the resource advertized by the DP (say `example.com/mock-plugin`). Then the K8s scheduler can schedule the Pod to this node, since the requested resource is `allocatable` in the `NodeSpec`. During the `Resources` state, if a DP resource is requested, the `PluginConnection` calls `Allocate` on the DP, requesting use of the resource.\n+1. If the Pod is terminated, in order to free up the DP resource, the `DeviceManager` contains a `PodDevices` structure that queries K8s Api for currently running Pods before each allocate call. It then will update it's map of allocated devices to remove terminated Pods.\n+1. If the DP dies and the connection is dropped, the devices are removed from the `DeviceMap` and the `NodePatcher` zeros `capacity` and `allocatable` for the resource in the NodeSpec.\n+\n+### What is not supported?\n+The current implementation does not support the following:\n+1. Calls to a device plugin's `GetPreferredAllocation` endpoint in order to make more informed `Allocate` calls.\n+2. Each [`ContainerAllocateResponse`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L181) contains environment variables, mounts, device specs, and annotations that should be set in Pods that request the resource. Currently, Krustlet only supports a subset of `Mounts`, namely `host_path` mounts as volumes.\n+1. Does not consider [`Device::TopologyInfo`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L98), as the [Topology Manager](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-integration-with-the-topology-manager) has not been implemented in Krustlet.\n\\ No newline at end of file\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add device plugin documentation
350,448
23.06.2021 14:59:27
25,200
5c3ec45b33d78db559c05800c4e1fd0b02862ed5
wrap documentation text
[ { "change_type": "MODIFY", "old_path": "docs/topics/plugin_system.md", "new_path": "docs/topics/plugin_system.md", "diff": "# Plugin System Overview\n-Krustlet partially implements support for CSI and device plugins. For CSI plugins support,\n-Krustlet partially implements the plugin discovery system used by the mainline\n-Kubelet. Upon investigation/ reverse engineering, we determined that CSI and device plugins use different APIs, the [plugin registration](../../crates/kubelet/proto/pluginregistration/v1/pluginregistration.proto) and [device plugin](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto) APIs, respectively.\n-CSI plugins use the auto plugin discovery method implemented\n+Krustlet partially implements support for CSI and device plugins. For CSI\n+plugins support, Krustlet partially implements the plugin discovery system used\n+by the mainline Kubelet. Upon investigation/ reverse engineering, we determined\n+that CSI and device plugins use different APIs, the [plugin\n+registration](../../crates/kubelet/proto/pluginregistration/v1/pluginregistration.proto)\n+and [device\n+plugin](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto)\n+APIs, respectively. CSI plugins use the auto plugin discovery method implemented\n[here](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/pluginmanager).\n-You can see other evidence of this in the\n-[csi-common code](https://github.com/kubernetes-csi/drivers/blob/master/pkg/csi-common/nodeserver-default.go)\n+You can see other evidence of this in the [csi-common\n+code](https://github.com/kubernetes-csi/drivers/blob/master/pkg/csi-common/nodeserver-default.go)\nand the [Node Driver Registrar\ndocumentation](https://github.com/kubernetes-csi/node-driver-registrar/blob/be7678e75e23b5419624ae3983b66957c0991073/README.md).\n-Instead of watching for plugins as done by the CSI [`pluginwatcher` package](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/pluginmanager/pluginwatcher) in the kubelet, the kubelet [`devicemanager`](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/cm/devicemanager) hosts a registration service for device plugins, as described in the\n-[device plugin documentation](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).\n+Instead of watching for plugins as done by the CSI [`pluginwatcher`\n+package](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/pluginmanager/pluginwatcher)\n+in the kubelet, the kubelet\n+[`devicemanager`](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/cm/devicemanager)\n+hosts a registration service for device plugins, as described in the [device\n+plugin\n+documentation](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).\n## CSI Plugins\n@@ -43,19 +52,59 @@ creating the socket that the kubelet discovers.\n## Device Plugins\n-Krustlet supports Kubernetes [device plugins](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/), which enable Kubernetes workloads to request extended resources, such as hardware, advertised by device plugins. Krustlet implements the [Kubernetes device manager](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/cm/devicemanager) in the kubelet's [`resources` module](../../crates/kubelet/src/resources). It implements the [device plugin framework's `Registration` gRPC service](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).\n+Krustlet supports Kubernetes [device\n+plugins](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/),\n+which enable Kubernetes workloads to request extended resources, such as\n+hardware, advertised by device plugins. Krustlet implements the [Kubernetes\n+device\n+manager](https://github.com/kubernetes/kubernetes/tree/fd74333a971e2048b5fb2b692a9e043483d63fba/pkg/kubelet/cm/devicemanager)\n+in the kubelet's [`resources` module](../../crates/kubelet/src/resources). It\n+implements the [device plugin framework's `Registration` gRPC\n+service](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).\n-Flow from registering device plugin (DP) to running a Pod requesting an DP extended resource:\n-1. The kubelet's `DeviceManager` hosts the [device plugin framework's `Registration` gRPC service](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration) on the Kubernetes default `/var/lib/kubelet/device-plugins/kubelet.sock`.\n-1. DP registers itself with the kubelet through this gRPC service. This allows the DP to advertise a resource such as system hardware to kubelet.\n-1. The kubelet creates a `PluginConnection` for marshalling requests to the DP. It calls the DP's `ListAndWatch` service, creating a bi-directional streaming connection. The device plugin updates the kubelet about the device health across this connection.\n-1. Each time the `PluginConnection` receives device updates across the `ListAndWatch` connection. It updates the map of all devices (`DeviceMap`) shared between the `DeviceManager`, `PluginConnections` and `NodePatcher` and notifies the `NodePatcher` to update the `NodeStatus` of the node with appropriate `allocatable` and `capacity` entries.\n-1. Once a Pod is applied that requests the resource advertized by the DP (say `example.com/mock-plugin`). Then the K8s scheduler can schedule the Pod to this node, since the requested resource is `allocatable` in the `NodeSpec`. During the `Resources` state, if a DP resource is requested, the `PluginConnection` calls `Allocate` on the DP, requesting use of the resource.\n-1. If the Pod is terminated, in order to free up the DP resource, the `DeviceManager` contains a `PodDevices` structure that queries K8s Api for currently running Pods before each allocate call. It then will update it's map of allocated devices to remove terminated Pods.\n-1. If the DP dies and the connection is dropped, the devices are removed from the `DeviceMap` and the `NodePatcher` zeros `capacity` and `allocatable` for the resource in the NodeSpec.\n+\n+Flow from registering device plugin (DP) to running a Pod requesting an DP\n+extended resource:\n+1. The kubelet's `DeviceManager` hosts the [device plugin framework's\n+ `Registration` gRPC\n+ service](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration)\n+ on the Kubernetes default `/var/lib/kubelet/device-plugins/kubelet.sock`.\n+1. DP registers itself with the kubelet through this gRPC service. This allows\n+ the DP to advertise a resource such as system hardware to kubelet.\n+1. The kubelet creates a `PluginConnection` for marshalling requests to the DP.\n+ It calls the DP's `ListAndWatch` service, creating a bi-directional streaming\n+ connection. The device plugin updates the kubelet about the device health\n+ across this connection.\n+1. Each time the `PluginConnection` receives device updates across the\n+ `ListAndWatch` connection. It updates the map of all devices (`DeviceMap`)\n+ shared between the `DeviceManager`, `PluginConnections` and `NodePatcher` and\n+ notifies the `NodePatcher` to update the `NodeStatus` of the node with\n+ appropriate `allocatable` and `capacity` entries.\n+1. Once a Pod is applied that requests the resource advertized by the DP (say\n+ `example.com/mock-plugin`). Then the K8s scheduler can schedule the Pod to\n+ this node, since the requested resource is `allocatable` in the `NodeSpec`.\n+ During the `Resources` state, if a DP resource is requested, the\n+ `PluginConnection` calls `Allocate` on the DP, requesting use of the\n+ resource.\n+1. If the Pod is terminated, in order to free up the DP resource, the\n+ `DeviceManager` contains a `PodDevices` structure that queries K8s Api for\n+ currently running Pods before each allocate call. It then will update it's\n+ map of allocated devices to remove terminated Pods.\n+1. If the DP dies and the connection is dropped, the devices are removed from\n+ the `DeviceMap` and the `NodePatcher` zeros `capacity` and `allocatable` for\n+ the resource in the NodeSpec.\n### What is not supported?\nThe current implementation does not support the following:\n-1. Calls to a device plugin's `GetPreferredAllocation` endpoint in order to make more informed `Allocate` calls.\n-2. Each [`ContainerAllocateResponse`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L181) contains environment variables, mounts, device specs, and annotations that should be set in Pods that request the resource. Currently, Krustlet only supports a subset of `Mounts`, namely `host_path` mounts as volumes.\n-1. Does not consider [`Device::TopologyInfo`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L98), as the [Topology Manager](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-integration-with-the-topology-manager) has not been implemented in Krustlet.\n\\ No newline at end of file\n+1. Calls to a device plugin's `GetPreferredAllocation` endpoint in order to make\n+ more informed `Allocate` calls.\n+2. Each\n+ [`ContainerAllocateResponse`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L181)\n+ contains environment variables, mounts, device specs, and annotations that\n+ should be set in Pods that request the resource. Currently, Krustlet only\n+ supports a subset of `Mounts`, namely `host_path` mounts as volumes.\n+1. Does not consider\n+ [`Device::TopologyInfo`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L98),\n+ as the [Topology\n+ Manager](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-integration-with-the-topology-manager)\n+ has not been implemented in Krustlet.\n\\ No newline at end of file\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
wrap documentation text
350,448
23.06.2021 15:11:15
25,200
3123b6ecbfdbbe7968a37392b1a67e143a6d658f
lint documentation with markdownlint 'docs/topics/plugin_system.md' -c .markdownlint.json --fix
[ { "change_type": "MODIFY", "old_path": "docs/topics/plugin_system.md", "new_path": "docs/topics/plugin_system.md", "diff": "@@ -21,8 +21,8 @@ hosts a registration service for device plugins, as described in the [device\nplugin\ndocumentation](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).\n-\n## CSI Plugins\n+\n### Registration: How does it work?\nThe plugin registration system has an event driven loop for discovering and\n@@ -62,9 +62,9 @@ in the kubelet's [`resources` module](../../crates/kubelet/src/resources). It\nimplements the [device plugin framework's `Registration` gRPC\nservice](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration).\n-\nFlow from registering device plugin (DP) to running a Pod requesting an DP\nextended resource:\n+\n1. The kubelet's `DeviceManager` hosts the [device plugin framework's\n`Registration` gRPC\nservice](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#device-plugin-registration)\n@@ -95,7 +95,9 @@ extended resource:\nthe resource in the NodeSpec.\n### What is not supported?\n+\nThe current implementation does not support the following:\n+\n1. Calls to a device plugin's `GetPreferredAllocation` endpoint in order to make\nmore informed `Allocate` calls.\n2. Each\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
lint documentation with markdownlint 'docs/topics/plugin_system.md' -c .markdownlint.json --fix
350,448
23.06.2021 15:13:58
25,200
76a457e206e5538f07796193708e3d2203e76852
fix md list ordering
[ { "change_type": "MODIFY", "old_path": "docs/topics/plugin_system.md", "new_path": "docs/topics/plugin_system.md", "diff": "@@ -100,7 +100,7 @@ The current implementation does not support the following:\n1. Calls to a device plugin's `GetPreferredAllocation` endpoint in order to make\nmore informed `Allocate` calls.\n-2. Each\n+1. Each\n[`ContainerAllocateResponse`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L181)\ncontains environment variables, mounts, device specs, and annotations that\nshould be set in Pods that request the resource. Currently, Krustlet only\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
fix md list ordering
350,448
24.06.2021 11:04:30
25,200
6d21cd70838dc8e9c6180ec195b7ecdf4be6adc0
add support for env vars and update docs
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "diff": "@@ -397,11 +397,11 @@ impl DeviceManager {\nOk(())\n}\n- /// Returns all of the allocate responses for a Pod. Used to set mounts, env vars, annotations, and device specs for Pod.\n+ /// Returns a map all of the allocate responses for a Pod, keyed by Container name. Used to set mounts, env vars, annotations, and device specs for Pod.\npub fn get_pod_allocate_responses(\n&self,\npod_uid: &str,\n- ) -> Option<Vec<ContainerAllocateResponse>> {\n+ ) -> Option<HashMap<String, Vec<ContainerAllocateResponse>>> {\nself.pod_devices.get_pod_allocate_responses(pod_uid)\n}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/pod_devices.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/pod_devices.rs", "diff": "@@ -140,19 +140,21 @@ impl PodDevices {\npub fn get_pod_allocate_responses(\n&self,\npod_uid: &str,\n- ) -> Option<Vec<ContainerAllocateResponse>> {\n+ ) -> Option<HashMap<String, Vec<ContainerAllocateResponse>>> {\nmatch self.allocated_devices.lock().unwrap().get(pod_uid) {\nSome(container_devices) => {\n- let mut container_allocate_responses = Vec::new();\n+ let mut container_allocate_responses = HashMap::new();\ncontainer_devices\n.iter()\n- .for_each(|(_container_name, resource_allocate_info)| {\n+ .for_each(|(container_name, resource_allocate_info)| {\n+ container_allocate_responses.insert(\n+ container_name.clone(),\nresource_allocate_info\n- .iter()\n- .for_each(|(_resource_name, dev_info)| {\n- container_allocate_responses\n- .push(dev_info.allocate_response.clone());\n- });\n+ .values()\n+ .cloned()\n+ .map(|dev_info| dev_info.allocate_response)\n+ .collect(),\n+ );\n});\nSome(container_allocate_responses)\n}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/mod.rs", "new_path": "crates/kubelet/src/state/common/mod.rs", "diff": "@@ -52,6 +52,9 @@ pub trait GenericProviderState: 'static + Send + Sync {\n/// the generic states.\n#[async_trait::async_trait]\npub trait GenericPodState: ObjectState<Manifest = Pod, Status = PodStatus> {\n+ /// Stores the environment variables that are added through state conditions\n+ /// rather than being from PodSpecs.\n+ async fn set_env_vars(&mut self, env_vars: HashMap<String, HashMap<String, String>>);\n/// Stores the pod module binaries for future execution. Typically your\n/// implementation can just move the modules map into a member field.\nasync fn set_modules(&mut self, modules: HashMap<String, Vec<u8>>);\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/resources.rs", "new_path": "crates/kubelet/src/state/common/resources.rs", "diff": "@@ -73,19 +73,22 @@ impl<P: GenericProvider> State<P::PodState> for Resources<P> {\nreturn Transition::next(self, next);\n}\n- // In Pod, set mounts, env vars, annotations, and device specs specified in the device plugins' `ContainerAllocateResponse`s.\n- // TODO: add support for setting environment variables, annotations, device mounts (with permissions), and container path mounts.\n- // For now, just set HostPath volumes for each `ContainerAllocateResponse::Mount`.\n+ // In Pod, set env vars and set HostPath volumes for each `ContainerAllocateResponse`.\n+ // TODO: add support for setting container path mounts, env vars, annotations, and device specs (with permissions) specified in the device plugins' `ContainerAllocateResponse`s.\nif let Some(container_allocate_responses) =\ndevice_plugin_manager.get_pod_allocate_responses(pod.pod_uid())\n{\nlet mut host_paths: Vec<String> = Vec::new();\n- container_allocate_responses.iter().for_each(|alloc_resp| {\n- alloc_resp\n- .mounts\n+ let mut env_vars: HashMap<String, HashMap<String, String>> = HashMap::new();\n+ // Get host paths, env vars, and annotations from allocate responses.\n+ container_allocate_responses.iter().for_each(|(c, rs)| {\n+ rs.iter().for_each(|r| {\n+ env_vars.insert(c.clone(), r.envs.clone());\n+ r.mounts\n.iter()\n.for_each(|m| host_paths.push(m.host_path.clone()))\n});\n+ });\nlet volumes: HashMap<String, VolumeRef> = host_paths\n.iter_mut()\n.map(|p| HostPathVolumeSource {\n@@ -105,6 +108,7 @@ impl<P: GenericProvider> State<P::PodState> for Resources<P> {\n})\n.collect();\npod_state.set_volumes(volumes).await;\n+ pod_state.set_env_vars(env_vars).await;\n}\ninfo!(\"Resources allocated to Pod: {}\", pod.name());\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/lib.rs", "new_path": "crates/wasi-provider/src/lib.rs", "diff": "@@ -156,6 +156,7 @@ impl WasiProvider {\nstruct ModuleRunContext {\nmodules: HashMap<String, Vec<u8>>,\nvolumes: HashMap<String, VolumeRef>,\n+ env_vars: HashMap<String, HashMap<String, String>>,\n}\n#[async_trait::async_trait]\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/states/container/waiting.rs", "new_path": "crates/wasi-provider/src/states/container/waiting.rs", "diff": "@@ -79,7 +79,7 @@ impl State<ContainerState> for Waiting {\n(provider_state.client(), provider_state.log_path.clone())\n};\n- let (module_data, container_volumes) = {\n+ let (module_data, container_volumes, container_envs) = {\nlet mut run_context = state.run_context.write().await;\nlet module_data = match run_context.modules.remove(container.name()) {\nSome(data) => data,\n@@ -114,10 +114,18 @@ impl State<ContainerState> for Waiting {\n)\n}\n};\n- (module_data, container_volumes)\n+ (\n+ module_data,\n+ container_volumes,\n+ run_context\n+ .env_vars\n+ .remove(container.name())\n+ .unwrap_or_default(),\n+ )\n};\n- let env = kubelet::provider::env_vars(&container, &state.pod, &client).await;\n+ let mut env = kubelet::provider::env_vars(&container, &state.pod, &client).await;\n+ env.extend(container_envs);\nlet args = container.args().clone().unwrap_or_default();\n// TODO: ~magic~ number\n@@ -129,6 +137,7 @@ impl State<ContainerState> for Waiting {\nstate.pod.name(),\ncontainer.name()\n);\n+ // TODO: decide how/what it means to propagate annotations (from run_context) into WASM modules.\nlet runtime = match WasiRuntime::new(\nname,\nmodule_data,\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/states/pod.rs", "new_path": "crates/wasi-provider/src/states/pod.rs", "diff": "@@ -57,6 +57,7 @@ impl PodState {\nlet run_context = ModuleRunContext {\nmodules: Default::default(),\nvolumes: Default::default(),\n+ env_vars: Default::default(),\n};\nlet key = PodKey::from(pod);\nPodState {\n@@ -71,6 +72,10 @@ impl PodState {\n#[async_trait]\nimpl GenericPodState for PodState {\n+ async fn set_env_vars(&mut self, env_vars: HashMap<String, HashMap<String, String>>) {\n+ let mut run_context = self.run_context.write().await;\n+ run_context.env_vars = env_vars;\n+ }\nasync fn set_modules(&mut self, modules: HashMap<String, Vec<u8>>) {\nlet mut run_context = self.run_context.write().await;\nrun_context.modules = modules;\n" }, { "change_type": "MODIFY", "old_path": "docs/topics/plugin_system.md", "new_path": "docs/topics/plugin_system.md", "diff": "@@ -104,7 +104,8 @@ The current implementation does not support the following:\n[`ContainerAllocateResponse`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L181)\ncontains environment variables, mounts, device specs, and annotations that\nshould be set in Pods that request the resource. Currently, Krustlet only\n- supports a subset of `Mounts`, namely `host_path` mounts as volumes.\n+ supports environment variables and a subset of `Mounts`, namely `host_path`\n+ mounts as volumes.\n1. Does not consider\n[`Device::TopologyInfo`](../../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto#L98),\nas the [Topology\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add support for env vars and update docs
350,448
24.06.2021 12:07:57
25,200
1f93ffe71afff89e8284919c7f7da9528092792a
delete any existing manager socket before creating a new one
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/mod.rs", "diff": "@@ -95,8 +95,9 @@ pub async fn serve_device_registry(device_manager: Arc<DeviceManager>) -> anyhow\n\"Serving device plugin manager on socket {:?}\",\nmanager_socket\n);\n- let socket =\n- grpc_sock::server::Socket::new(&manager_socket).expect(\"couldn't make manager socket\");\n+ // Delete any existing manager socket\n+ let _ = tokio::fs::remove_file(&manager_socket).await;\n+ let socket = grpc_sock::server::Socket::new(&manager_socket)?;\nlet node_status_patcher = device_manager.node_status_patcher.clone();\nlet node_patcher_task = task::spawn(async move {\nnode_status_patcher.listen_and_patch().await.unwrap();\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
delete any existing manager socket before creating a new one
350,437
28.06.2021 11:17:28
25,200
cc2de7ac47651e2c78598883b8ac3d68a41769c2
Move Wasmtime module instantiation out of spawn_blocking
[ { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/wasi_runtime.rs", "new_path": "crates/wasi-provider/src/wasi_runtime.rs", "diff": "@@ -5,7 +5,6 @@ use tracing::{debug, error, info, instrument, trace, warn};\nuse tempfile::NamedTempFile;\nuse tokio::sync::mpsc::Sender;\n-use tokio::sync::oneshot;\nuse tokio::task::JoinHandle;\nuse wasi_cap_std_sync::WasiCtxBuilder;\nuse wasmtime::{InterruptHandle, Linker};\n@@ -124,7 +123,9 @@ impl WasiRuntime {\n})\n.await??;\n- let (interrupt_handle, handle) = self.spawn_wasmtime(output_write).await?;\n+ let (interrupt_handle, handle) = self\n+ .spawn_wasmtime(tokio::fs::File::from_std(output_write))\n+ .await?;\nlet log_handle_factory = HandleFactory {\ntemp: self.output.clone(),\n@@ -140,21 +141,16 @@ impl WasiRuntime {\n}\n// Spawns a running wasmtime instance with the given context and status\n- // channel. Due to the Instance type not being Send safe, all of the logic\n- // needs to be done within the spawned task\n+ // channel.\n+ #[instrument(level = \"info\", skip(self, output_write), fields(name = %self.name))]\nasync fn spawn_wasmtime(\n&self,\n- output_write: std::fs::File,\n+ output_write: tokio::fs::File,\n) -> anyhow::Result<(InterruptHandle, JoinHandle<anyhow::Result<()>>)> {\n// Clone the module data Arc so it can be moved\nlet data = self.data.clone();\nlet status_sender = self.status_sender.clone();\n- let (tx, rx) = oneshot::channel();\n- let name = self.name.clone();\n- let handle = tokio::task::spawn_blocking(move || -> anyhow::Result<_> {\n- let span = tracing::info_span!(\"wasmtime_module_run\", %name);\n- let _enter = span.enter();\n// Log this info here so it isn't on _every_ log line\ntrace!(env = ?data.env, args = ?data.args, dirs = ?data.dirs, \"Starting setup of wasmtime module\");\nlet env: Vec<(String, String)> = data\n@@ -163,10 +159,10 @@ impl WasiRuntime {\n.map(|(k, v)| (k.to_string(), v.to_string()))\n.collect();\nlet stdout = wasi_cap_std_sync::file::File::from_cap_std(unsafe {\n- cap_std::fs::File::from_std(output_write.try_clone()?)\n+ cap_std::fs::File::from_std(output_write.try_clone().await?.into_std().await)\n});\nlet stderr = wasi_cap_std_sync::file::File::from_cap_std(unsafe {\n- cap_std::fs::File::from_std(output_write.try_clone()?)\n+ cap_std::fs::File::from_std(output_write.try_clone().await?.into_std().await)\n});\n// Create the WASI context builder and pass arguments, environment,\n@@ -197,8 +193,6 @@ impl WasiRuntime {\nlet engine = wasmtime::Engine::new(&config)?;\nlet mut store = wasmtime::Store::new(&engine, ctx);\nlet interrupt = store.interrupt_handle()?;\n- tx.send(interrupt)\n- .map_err(|_| anyhow::anyhow!(\"Unable to send interrupt back to main thread\"))?;\nlet mut linker = Linker::new(&engine);\n@@ -209,15 +203,13 @@ impl WasiRuntime {\nErr(e) => {\nlet message = \"unable to create module\";\nerror!(error = %e, \"{}\", message);\n- send(\n- &status_sender,\n- &name,\n- Status::Terminated {\n+ status_sender\n+ .send(Status::Terminated {\nfailed: true,\nmessage: message.into(),\ntimestamp: chrono::Utc::now(),\n- },\n- );\n+ })\n+ .await?;\nreturn Err(anyhow::anyhow!(\"{}: {}\", message, e));\n}\n@@ -231,53 +223,57 @@ impl WasiRuntime {\nErr(e) => {\nlet message = \"unable to instantiate module\";\nerror!(error = %e, \"{}\", message);\n- send(\n- &status_sender,\n- &name,\n- Status::Terminated {\n+ status_sender\n+ .send(Status::Terminated {\nfailed: true,\nmessage: message.into(),\ntimestamp: chrono::Utc::now(),\n- },\n- );\n-\n+ })\n+ .await?;\n// Converting from anyhow\nreturn Err(anyhow::anyhow!(\"{}: {}\", message, e));\n}\n};\n- // NOTE(taylor): In the future, if we want to pass args directly, we'll\n- // need to do a bit more to pass them in here.\ninfo!(\"starting run of module\");\n- send(\n- &status_sender,\n- &name,\n- Status::Running {\n+ status_sender\n+ .send(Status::Running {\ntimestamp: chrono::Utc::now(),\n- },\n- );\n+ })\n+ .await?;\n+ // NOTE(thomastaylor312): In the future, if we want to pass args directly, we'll\n+ // need to do a bit more to pass them in here.\nlet export = instance\n.get_export(&mut store, \"_start\")\n.ok_or_else(|| anyhow::anyhow!(\"_start import doesn't exist in wasm module\"))?;\n+\n+ // NOTE(thomastaylor312): In the future (pun intended) we might be able to use something\n+ // like `func.call(...).await`. We should check every once and a while when upgraing\n+ // wasmtime\nlet func = match export {\nwasmtime::Extern::Func(f) => f,\n_ => {\n- let message = \"_start import was not a function. This is likely a problem with the module\";\n+ let message =\n+ \"_start import was not a function. This is likely a problem with the module\";\nerror!(error = message);\n- send(\n- &status_sender,\n- &name,\n- Status::Terminated {\n+ status_sender\n+ .send(Status::Terminated {\nfailed: true,\nmessage: message.into(),\ntimestamp: chrono::Utc::now(),\n- },\n- );\n+ })\n+ .await?;\nreturn Err(anyhow::anyhow!(message));\n}\n};\n+\n+ let name = self.name.clone();\n+ let handle = tokio::task::spawn_blocking(move || -> anyhow::Result<_> {\n+ let span = tracing::info_span!(\"wasmtime_module_run\", %name);\n+ let _enter = span.enter();\n+\nmatch func.call(&mut store, &[]) {\n// We can't map errors here or it moves the send channel, so we\n// do it in a match\n@@ -312,7 +308,6 @@ impl WasiRuntime {\nOk(())\n});\n// Wait for the interrupt to be sent back to us\n- let interrupt = rx.await?;\nOk((interrupt, handle))\n}\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Move Wasmtime module instantiation out of spawn_blocking Signed-off-by: Radu M <[email protected]> Co-authored-by: Taylor Thomas <[email protected]> Co-authored-by: Brian Hardock <[email protected]>
350,437
28.06.2021 11:37:54
25,200
f23a04ab1dab8df2dd67bf9e11ad1b36ff13b31c
Run apt update on aarch64 and remove default features
[ { "change_type": "MODIFY", "old_path": ".github/workflows/build.yml", "new_path": ".github/workflows/build.yml", "diff": "@@ -68,6 +68,7 @@ jobs:\n- name: setup for cross-compile builds\nif: matrix.config.arch == 'aarch64'\nrun: |\n+ sudo apt update\nsudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu\ncd /tmp\ngit clone https://github.com/openssl/openssl\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/Cargo.toml", "new_path": "crates/wasi-provider/Cargo.toml", "diff": "@@ -24,7 +24,7 @@ anyhow = \"1.0\"\nasync-trait = \"0.1\"\nbacktrace = \"0.3\"\nkube = { version = \"0.55\", default-features = false }\n-wasmtime = { version = \"0.28\", default-features = true }\n+wasmtime = \"0.28\"\nwasmtime-wasi = \"0.28\"\nwasi-common = \"0.28\"\nwasi-cap-std-sync = \"0.28\"\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Run apt update on aarch64 and remove default features Signed-off-by: Radu M <[email protected]> Co-authored-by: Taylor Thomas <[email protected]> Co-authored-by: Brian Hardock <[email protected]>
350,448
29.06.2021 11:44:07
25,200
54ea0fdaa1c61899f557e86679670d19fb9d207b
address todos, nits, etc
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/kubelet.rs", "new_path": "crates/kubelet/src/kubelet.rs", "diff": "@@ -112,7 +112,7 @@ impl<P: Provider> Kubelet<P> {\nerror!(error = %e, \"Plugin registrar task completed with error\");\n},\nres = device_manager => if let Err(e) = res {\n- error!(\"Device manager task completed with error {:?}\", &e);\n+ error!(error = %e, \"Device manager task completed with error\");\n}\n};\n// Use relaxed ordering because we just need other tasks to eventually catch the signal.\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "diff": "@@ -108,9 +108,7 @@ impl DeviceManager {\nregister_request: &RegisterRequest,\n) -> Result<(), tonic::Status> {\ntrace!(\n- \"Starting validation for plugin {:?} discovered at path {}\",\n- register_request.resource_name,\n- register_request.endpoint\n+ resource = %register_request.resource_name, endpoint = %register_request.endpoint, \"Starting validation for plugin discovered at path\",\n);\n// Validate that version matches the Device Plugin API version\n@@ -168,8 +166,7 @@ impl DeviceManager {\nregister_request: RegisterRequest,\n) -> anyhow::Result<()> {\ndebug!(\n- resource = %register_request.resource_name, \"Connecting to plugin at {:?} for ListAndWatch\",\n- register_request.endpoint\n+ resource = %register_request.resource_name, endpoint = %register_request.endpoint, \"Connecting to plugin's ListAndWatch service\"\n);\nlet chan = grpc_sock::client::socket_channel(\nself.plugin_dir.join(register_request.endpoint.clone()),\n@@ -387,13 +384,8 @@ impl DeviceManager {\nreturn Ok(());\n}\n- self.pod_devices.remove_pods(pods_to_be_removed.clone())?;\n+ self.pod_devices.remove_pods(pods_to_be_removed)?;\n- // TODO: should `allocated_device_ids` be replaced with `self.pod_devices.get_allocated_devices` instead?\n- let mut allocated_device_ids = self.allocated_device_ids.write().await;\n- pods_to_be_removed.iter().for_each(|p_uid| {\n- allocated_device_ids.remove(p_uid);\n- });\nOk(())\n}\n@@ -425,7 +417,7 @@ impl DeviceManager {\nreturn Err(anyhow::format_err!(\"Pod {} with container named {} changed requested quantity for resource {} from {} to {}\", pod_uid, container_name, resource_name, device_ids.len(), quantity));\n} else {\n// No change, so no new work\n- return Ok(Vec::new());\n+ return Ok(Vec::with_capacity(0));\n}\n}\n// Grab lock on devices and allocated devices\n@@ -540,7 +532,7 @@ fn get_num_from_quantity(q: Quantity) -> anyhow::Result<usize> {\n#[cfg(test)]\nmod tests {\n- use super::super::{test_utils, PLUGIN_MANGER_SOCKET_NAME, UNHEALTHY};\n+ use super::super::{test_utils, PLUGIN_MANGER_SOCKET_NAME};\nuse super::*;\nuse crate::device_plugin_api::v1beta1::{\ndevice_plugin_server::{DevicePlugin, DevicePluginServer},\n@@ -664,7 +656,7 @@ mod tests {\n/// Registers the mock DP with the DeviceManager's registration service\nasync fn register_mock_device_plugin(\n- kubelet_socket: String,\n+ kubelet_socket: impl AsRef<Path>,\ndp_socket: &str,\ndp_resource_name: &str,\n) -> anyhow::Result<()> {\n@@ -697,14 +689,6 @@ mod tests {\n// Instead, create a temp dir for the DP manager and the mock DP\nlet manager_temp_dir = tempfile::tempdir().expect(\"should be able to create tempdir\");\n- // Capture the DP and DP manager socket paths\n- let manager_socket = manager_temp_dir\n- .path()\n- .join(PLUGIN_MANGER_SOCKET_NAME)\n- .to_str()\n- .unwrap()\n- .to_string();\n-\n// Make 3 mock devices\nlet d1 = Device {\nid: \"d1\".to_string(),\n@@ -718,7 +702,7 @@ mod tests {\n};\nlet d3 = Device {\nid: \"d3\".to_string(),\n- health: UNHEALTHY.to_string(),\n+ health: test_utils::UNHEALTHY.to_string(),\ntopology: None,\n};\n@@ -751,7 +735,11 @@ mod tests {\n// Register the mock device plugin with the DeviceManager's Registration service\nlet dp_resource_name = \"example.com/mock-device-plugin\";\n- register_mock_device_plugin(manager_socket.to_string(), &dp_socket, dp_resource_name)\n+ register_mock_device_plugin(\n+ manager_temp_dir.path().join(PLUGIN_MANGER_SOCKET_NAME),\n+ &dp_socket,\n+ dp_resource_name,\n+ )\n.await\n.unwrap();\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/mod.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/mod.rs", "diff": "@@ -42,10 +42,6 @@ pub type PodResourceRequests = HashMap<String, ContainerResourceRequests>;\n/// Healthy means the device is allocatable (whether already allocated or not)\nconst HEALTHY: &str = \"Healthy\";\n-/// Unhealthy means the device is not allocatable\n-#[cfg(test)]\n-pub(crate) const UNHEALTHY: &str = \"Unhealthy\";\n-\n/// Hosts the device plugin `Registration` service (defined in the device plugin API) for a `DeviceManager`.\n/// Upon device plugin registration, reaches out to its `DeviceManager` to validate the device plugin\n/// and establish a connection with it.\n@@ -75,7 +71,6 @@ impl Registration for DeviceRegistry {\n.await\n.map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, format!(\"{}\", e)))?;\n// Create a list and watch connection with the device plugin\n- // TODO: should the manager keep track of threads?\nself.device_manager\n.create_plugin_connection(register_request)\n.await\n@@ -96,15 +91,22 @@ pub async fn serve_device_registry(device_manager: Arc<DeviceManager>) -> anyhow\nmanager_socket\n);\n// Delete any existing manager socket\n- let _ = tokio::fs::remove_file(&manager_socket).await;\n+ match tokio::fs::remove_file(&manager_socket).await {\n+ Ok(_) => (),\n+ Err(e) if matches!(e.kind(), std::io::ErrorKind::NotFound) => (),\n+ Err(e) => return Err(e.into()),\n+ }\nlet socket = grpc_sock::server::Socket::new(&manager_socket)?;\nlet node_status_patcher = device_manager.node_status_patcher.clone();\n+ let (tx, rx) = tokio::sync::oneshot::channel();\nlet node_patcher_task = task::spawn(async move {\n- node_status_patcher.listen_and_patch().await.unwrap();\n+ node_status_patcher.listen_and_patch(tx).await.unwrap();\n});\n+ // Have NodePatcher notify when it has created a receiver to avoid race case of the DeviceManager trying\n+ // to send device info to the NodeStatusPatcher before the NodeStatusPatcher has created a receiver.\n+ // Sender would error due to no active receivers.\n+ rx.await?;\nlet device_registry = DeviceRegistry::new(device_manager);\n- // TODO: There may be a slight race case here. If the DeviceManager tries to send device info to the NodeStatusPatcher before the NodeStatusPatcher has created a receiver\n- // it will error because there are no active receivers.\nlet device_manager_task = task::spawn(async {\nlet serv = Server::builder()\n.add_service(RegistrationServer::new(device_registry))\n@@ -128,6 +130,9 @@ pub mod test_utils {\nuse tokio::sync::RwLock;\nuse tower_test::mock;\n+ /// Unhealthy means the device is not allocatable\n+ pub const UNHEALTHY: &str = \"Unhealthy\";\n+\npub fn mock_client() -> kube::Client {\nkube::Client::try_from(kube::Config::new(\nreqwest::Url::parse(\"http://127.0.0.1:8080\").unwrap(),\n@@ -139,7 +144,6 @@ pub mod test_utils {\n/// need to be updated in the Node status.\n/// It verifies the request and always returns a fake Node.\n/// Returns a client that will reference this mock service and the task the service is running on.\n- /// TODO: Decide whether to test node status\npub async fn create_mock_kube_service(\nnode_name: &str,\n) -> (Client, tokio::task::JoinHandle<()>) {\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/node_patcher.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/node_patcher.rs", "diff": "@@ -3,7 +3,7 @@ use k8s_openapi::api::core::v1::Node;\nuse kube::api::{Api, PatchParams};\nuse std::sync::Arc;\nuse tokio::sync::{broadcast, RwLock};\n-use tracing::{debug, error};\n+use tracing::debug;\n/// NodePatcher updates the Node status with the latest device information.\n#[derive(Clone)]\n@@ -30,18 +30,16 @@ impl NodeStatusPatcher {\n}\n}\n- // TODO: Decide whether `NodePatcher` should do `remove` patches when there are no\n- // devices under a resource. When a device plugin drops, the `DeviceManager` clears\n- // out the resource's device map. Currently, this just sets the resource's\n- // `allocatable` and `capacity` count to 0, which appears to be the same implementation\n- // in Kubernetes.\n+ // When a device plugin drops, the `DeviceManager` clears out the resource's device map.\n+ //This sets the resource's `allocatable` and `capacity` count to 0,\n+ // which appears to be the same implementation in Kubernetes.\nasync fn get_node_status_patch(&self) -> json_patch::Patch {\nlet mut patches = Vec::new();\nlet devices = self.devices.read().await;\ndevices\n.iter()\n.for_each(|(resource_name, resource_devices)| {\n- let adjusted_name = adjust_name(resource_name);\n+ let adjusted_name = escape_json_pointer(resource_name);\nlet capacity_patch = serde_json::json!(\n{\n\"op\": \"add\",\n@@ -91,15 +89,16 @@ impl NodeStatusPatcher {\n}\n}\n- pub async fn listen_and_patch(self) -> anyhow::Result<()> {\n+ pub async fn listen_and_patch(\n+ self,\n+ ready_tx: tokio::sync::oneshot::Sender<()>,\n+ ) -> anyhow::Result<()> {\nlet mut receiver = self.update_node_status_sender.subscribe();\n+ ready_tx\n+ .send(())\n+ .map_err(|e| anyhow::Error::msg(format!(\"{:?}\", e)))?;\nloop {\n- match receiver.recv().await {\n- Err(_e) => {\n- error!(\"Channel closed by senders\");\n- // TODO: bubble up error\n- }\n- Ok(_) => {\n+ receiver.recv().await?;\ndebug!(\"Received notification that Node status should be patched\");\n// Grab status values\nlet status_patch = self.get_node_status_patch().await;\n@@ -108,22 +107,21 @@ impl NodeStatusPatcher {\n}\n}\n}\n- }\n-}\n-fn adjust_name(name: &str) -> String {\n+fn escape_json_pointer(name: &str) -> String {\nname.replace(\"/\", \"~1\")\n}\n#[cfg(test)]\nmod tests {\n- use super::super::test_utils::{create_mock_healthy_devices, create_mock_kube_service};\n- use super::super::UNHEALTHY;\n+ use super::super::test_utils::{\n+ create_mock_healthy_devices, create_mock_kube_service, UNHEALTHY,\n+ };\nuse super::*;\n#[test]\n- fn test_adjust_name() {\n- assert_eq!(adjust_name(\"example.com/r1\"), \"example.com~1r1\");\n+ fn test_escape_json_pointer() {\n+ assert_eq!(escape_json_pointer(\"example.com/r1\"), \"example.com~1r1\");\n}\n#[tokio::test]\n@@ -140,7 +138,7 @@ mod tests {\nlet patch_value = serde_json::json!([\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/capacity/example.com~1foo\"),\n+ \"path\": \"/status/capacity/example.com~1foo\".to_string(),\n\"value\": \"2\"\n}\n]);\n@@ -182,22 +180,22 @@ mod tests {\nlet expected_patch_values = serde_json::json!([\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/capacity/example.com~1r1\"),\n+ \"path\": \"/status/capacity/example.com~1r1\".to_string(),\n\"value\": \"3\"\n},\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/allocatable/example.com~1r1\"),\n+ \"path\": \"/status/allocatable/example.com~1r1\".to_string(),\n\"value\": \"2\"\n},\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/capacity/something.net~1r2\"),\n+ \"path\": \"/status/capacity/something.net~1r2\".to_string(),\n\"value\": \"2\"\n},\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/allocatable/something.net~1r2\"),\n+ \"path\": \"/status/allocatable/something.net~1r2\".to_string(),\n\"value\": \"2\"\n}\n]);\n@@ -231,22 +229,22 @@ mod tests {\nlet expected_patch_values = serde_json::json!([\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/capacity/example.com~1r1\"),\n+ \"path\": \"/status/capacity/example.com~1r1\".to_string(),\n\"value\": \"0\"\n},\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/allocatable/example.com~1r1\"),\n+ \"path\": \"/status/allocatable/example.com~1r1\".to_string(),\n\"value\": \"0\"\n},\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/capacity/something.net~1r2\"),\n+ \"path\": \"/status/capacity/something.net~1r2\".to_string(),\n\"value\": \"0\"\n},\n{\n\"op\": \"add\",\n- \"path\": format!(\"/status/allocatable/something.net~1r2\"),\n+ \"path\": \"/status/allocatable/something.net~1r2\".to_string(),\n\"value\": \"0\"\n}\n]);\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/plugin_connection.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/plugin_connection.rs", "diff": "@@ -52,7 +52,6 @@ impl PluginConnection {\n/// The device plugin updates this client periodically about changes in the capacity and health of its resource.\n/// Upon updates, this propagates any changes into the `plugins` map and triggers the `NodePatcher` to\n/// patch the node with the latest values.\n- /// TODO: return error\nasync fn list_and_watch(\n&self,\ndevices: Arc<RwLock<DeviceMap>>,\n@@ -75,8 +74,9 @@ impl PluginConnection {\n)\n.await\n{\n- // TODO handle error -- maybe channel is full\n- update_node_status_sender.send(()).unwrap();\n+ if let Err(e) = update_node_status_sender.send(()) {\n+ error!(error = %e, \"Node status update channel is full\");\n+ }\n}\n}\n@@ -152,18 +152,17 @@ async fn update_devices_map(\n}\n// (3) Check if Device removed\n- let removed_device_ids: Vec<String> = previous_law_devices\n+ let removed_device_ids: Vec<&String> = previous_law_devices\n.iter()\n.map(|(prev_id, _)| prev_id)\n.filter(|prev_id| !current_devices.contains_key(*prev_id))\n- .cloned()\n.collect();\nif !removed_device_ids.is_empty() {\nupdate_node_status = true;\nlet mut lock = devices.write().await;\nlet map = lock.get_mut(resource_name).unwrap();\n- removed_device_ids.into_iter().for_each(|id| {\n- map.remove(&id);\n+ removed_device_ids.iter().for_each(|id| {\n+ map.remove(*id);\n});\n}\n@@ -181,8 +180,8 @@ impl PartialEq for PluginConnection {\n#[cfg(test)]\npub mod tests {\n- use super::super::test_utils::create_mock_healthy_devices;\n- use super::super::{HEALTHY, UNHEALTHY};\n+ use super::super::test_utils::{create_mock_healthy_devices, UNHEALTHY};\n+ use super::super::HEALTHY;\nuse super::*;\n#[tokio::test]\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/pod_devices.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/pod_devices.rs", "diff": "@@ -47,7 +47,6 @@ impl PodDevices {\n/// amount of device plugin resources requested by existing pods could be counted\n/// when updating allocated devices\npub async fn get_active_pods(&self) -> anyhow::Result<HashSet<String>> {\n- // TODO: should this be namespaced?\nlet pod_client: Api<Pod> = Api::all(self.client.clone());\nlet pods = pod_client\n.list(&ListParams::default().fields(&format!(\"spec.nodeName={}\", self.node_name)))\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/util/mod.rs", "new_path": "crates/kubelet/src/resources/util/mod.rs", "diff": "//! Helpers for parsing resource names and types. Checks that they follow the expected resource formatting\n//! explained in [this Kubernetes proposal](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/scheduling/resources.md#the-kubernetes-resource-model).\n-// TODO: decide whether this should go under container or some container manager folder\nuse regex::{Regex, RegexBuilder};\nuse tracing::trace;\nconst QUALIFIED_NAME_MAX_LENGTH: usize = 63;\n-// const QUALIFIED_NAME_CHAR_FMT: &str = \"[A-Za-z0-9]\";\n-// const QUALIFIED_NAME_EXT_CHAR_FMT: &str = \"[-A-Za-z0-9_.]\";\n+// QUALIFIED_NAME_FMT = \"(\"\" + QUALIFIED_NAME_CHAR_FMT + \"*)?\"\" + QUALIFIED_NAME_EXT_CHAR_FMT + QUALIFIED_NAME_CHAR_FMT\nconst QUALIFIED_NAME_FMT: &str =\nconcat!(\"(\", \"[A-Za-z0-9]\", \"[-A-Za-z0-9_.]\", \"*)?\", \"[A-Za-z0-9]\");\nconst QUALIFIED_NAME_ERR_MSG: &str = \"must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character\";\n// DNS1123SubdomainMaxLength is a subdomain's max length in DNS (RFC 1123)\nconst DNS_1123_SUBDOMAIN_MAX_LEN: usize = 253;\n-// const DNS_1123_LABEL_FMT: &str = \"[a-z0-9]([-a-z0-9]*[a-z0-9])?\";\nconst DNS_1123_LABEL_ERR_MSG: &str = \"a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character\";\n+// DNS_1123_SUBDOMAIN_FMT = DNS_1123_LABEL_FMT + \"(\\\\.\" + DNS_1123_LABEL_FMT + \")*\"\nconst DNS_1123_SUBDOMAIN_FMT: &str = concat!(\n\"[a-z0-9]([-a-z0-9]*[a-z0-9])?\",\n\"(\\\\.\",\n\"[a-z0-9]([-a-z0-9]*[a-z0-9])?\",\n\")*\"\n-); // DNS_1123_LABEL_FMT + \"(\\\\.\" + DNS_1123_LABEL_FMT + \")*\"\n- // const DNS_1123_SUBDOMAIN_ERR_MSG: &str = \"a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character\";\n+);\n/// RESOURCE_DEFAULT_NAMESPACE_PREFIX is the default namespace prefix.\nconst RESOURCE_DEFAULT_NAMESPACE_PREFIX: &str = \"kubernetes.io/\";\n@@ -120,8 +117,6 @@ fn is_dns_1123_subdomain(value: &str) -> anyhow::Result<()> {\nDNS_1123_SUBDOMAIN_MAX_LEN\n))\n} else if !must_compile(&format!(\"^{}$\", DNS_1123_SUBDOMAIN_FMT)).is_match(value) {\n- // TODO: give more verbose error message?\n- // https://sourcegraph.com/github.com/kubernetes/kubernetes@b496238dd65d86c65183ac7ffa128c5de46705b4/-/blob/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go?subtree=true#L214:3\nErr(anyhow::format_err!(\n\"dns subdomain not properly formatted ... {}\",\nDNS_1123_LABEL_ERR_MSG\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/state/common/resources.rs", "new_path": "crates/kubelet/src/state/common/resources.rs", "diff": "@@ -90,9 +90,9 @@ impl<P: GenericProvider> State<P::PodState> for Resources<P> {\n});\n});\nlet volumes: HashMap<String, VolumeRef> = host_paths\n- .iter_mut()\n+ .into_iter()\n.map(|p| HostPathVolumeSource {\n- path: p.clone(),\n+ path: p,\n..Default::default()\n})\n.map(|h| KubeVolume {\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
address todos, nits, etc
350,448
29.06.2021 12:53:38
25,200
b27c7ca282111f9a596a3cafd436bf8f07f5d359
fix update_devices_map comment fmt
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/plugin_connection.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/plugin_connection.rs", "diff": "@@ -96,9 +96,11 @@ impl PluginConnection {\n/// This updates the shared device map with the new devices reported by the device plugin. This\n/// iterates through the latest devices, comparing them with the previously reported devices and\n-/// updates the shared device map if: (1) Device modified: DP reporting a previous device with a\n-/// different health status (2) Device added: DP reporting a new device (3) Device removed: DP is no\n-/// longer advertising a device If any of the 3 cases occurs, this returns true, signaling that the\n+/// updates the shared device map if:\n+/// (1) Device modified: DP reporting a previous device with a different health status\n+/// (2) Device added: DP reporting a new device\n+/// (3) Device removed: DP is no longer advertising a device\n+/// If any of the 3 cases occurs, this returns true, signaling that the\n/// `NodePatcher` needs to update the Node status with new devices.\nasync fn update_devices_map(\nresource_name: &str,\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
fix update_devices_map comment fmt
350,448
30.06.2021 11:07:37
25,200
ae2098b8b107d9d1156f3cf8d1ed097fec276141
document not allowing a plugin with existing plugin name to register
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/manager.rs", "diff": "-//! The `DeviceManager` maintains a device plugin client for each\n-//! registered device plugin. It ensures that the Node's `NodeStatus` contains the\n-//! the resources advertised by device plugins and performs allocate calls\n-//! on device plugins when Pods are scheduled that request device plugin resources.\n+//! The `DeviceManager` maintains a device plugin client for each registered device plugin. It\n+//! ensures that the Node's `NodeStatus` contains the the resources advertised by device plugins and\n+//! performs allocate calls on device plugins when Pods are scheduled that request device plugin\n+//! resources.\nuse super::super::util;\nuse super::node_patcher::NodeStatusPatcher;\nuse super::plugin_connection::PluginConnection;\n@@ -110,8 +110,8 @@ impl DeviceManager {\n/// `API_VERSION`. TODO: determine whether can support all versions prior to current\n/// `API_VERSION`.\n/// 2. Does the plugin have a valid extended resource name?\n- /// 3. Is the plugin name available? 2a. If the name is already registered, is the\n- /// plugin_connection the exact same? If it is, we allow it to register again\n+ /// 3. Is the plugin name available? If the name is already registered, return an error that the\n+ /// plugin already exists.\npub(crate) async fn validate(\n&self,\nregister_request: &RegisterRequest,\n@@ -145,10 +145,8 @@ impl DeviceManager {\nOk(())\n}\n- /// Validates if the plugin is unique (meaning it doesn't exist in the `plugins` map). If there\n- /// is an active plugin registered with this name, returns error. TODO: Might be best to always\n- /// accept:\n- /// https://sourcegraph.com/github.com/kubernetes/kubernetes@9d6e5049bb719abf41b69c91437d25e273829746/-/blob/pkg/kubelet/cm/devicemanager/manager.go?subtree=true#L439\n+ /// Validates that the plugin is unique (meaning it doesn't exist in the `plugins` map). If\n+ /// there is an active plugin registered with this name, returns error.\nasync fn validate_is_unique(\n&self,\nregister_request: &RegisterRequest,\n@@ -156,7 +154,6 @@ impl DeviceManager {\nlet plugins = self.plugins.read().await;\nif let Some(_previous_plugin_entry) = plugins.get(&register_request.resource_name) {\n- // TODO: check if plugin is active\nreturn Err(tonic::Status::new(\ntonic::Code::AlreadyExists,\nformat!(\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
document not allowing a plugin with existing plugin name to register
350,448
30.06.2021 11:35:58
25,200
f96089d1052b306628fb1cfd4b0b9f47fedaaed5
check that resource is in map before adding device
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/resources/device_plugin_manager/plugin_connection.rs", "new_path": "crates/kubelet/src/resources/device_plugin_manager/plugin_connection.rs", "diff": "@@ -119,12 +119,7 @@ async fn update_devices_map(\n// (1) Device modified or already registered\nif let Some(previous_device) = previous_law_devices.get(&device.id) {\nif previous_device.health != device.health {\n- devices\n- .write()\n- .await\n- .get_mut(resource_name)\n- .unwrap()\n- .insert(device.id.clone(), device.clone());\n+ add_device_to_map(&mut devices.write().await, resource_name, device);\nupdate_node_status = true;\n} else if previous_device.topology != device.topology {\n// Currently not using/handling device topology. Simply log the change.\n@@ -136,17 +131,7 @@ async fn update_devices_map(\n}\n// (2) Device added\n} else {\n- let mut all_devices_map = devices.write().await;\n- match all_devices_map.get_mut(resource_name) {\n- Some(resource_devices_map) => {\n- resource_devices_map.insert(device.id.clone(), device.clone());\n- }\n- None => {\n- let mut resource_devices_map = HashMap::new();\n- resource_devices_map.insert(device.id.clone(), device.clone());\n- all_devices_map.insert(resource_name.to_string(), resource_devices_map);\n- }\n- }\n+ add_device_to_map(&mut devices.write().await, resource_name, device);\nupdate_node_status = true;\n}\n}\n@@ -172,6 +157,24 @@ async fn update_devices_map(\nupdate_node_status\n}\n+// Adds device to the shared devices map\n+fn add_device_to_map(\n+ devices: &mut tokio::sync::RwLockWriteGuard<DeviceMap>,\n+ resource_name: &str,\n+ device: &Device,\n+) {\n+ match devices.get_mut(resource_name) {\n+ Some(resource_devices_map) => {\n+ resource_devices_map.insert(device.id.clone(), device.clone());\n+ }\n+ None => {\n+ let mut resource_devices_map = HashMap::new();\n+ resource_devices_map.insert(device.id.clone(), device.clone());\n+ devices.insert(resource_name.to_string(), resource_devices_map);\n+ }\n+ }\n+}\n+\nimpl PartialEq for PluginConnection {\nfn eq(&self, other: &Self) -> bool {\nself.register_request == other.register_request\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
check that resource is in map before adding device
350,440
22.07.2021 09:08:23
-7,200
d6fd025c6ccab77cf726b0f427e0e5c6e97714c1
Restrict permissions of private key file On Unix file systems the mode of the private key file is set to 0o600. On other file systems the permissions remain unchanged.
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/bootstrapping/mod.rs", "new_path": "crates/kubelet/src/bootstrapping/mod.rs", "diff": "-use std::{convert::TryFrom, env, path::Path, str};\n+use std::{convert::TryFrom, env, io, path::Path, str};\nuse futures::{StreamExt, TryStreamExt};\nuse k8s_openapi::api::certificates::v1beta1::CertificateSigningRequest;\n@@ -10,7 +10,8 @@ use rcgen::{\nCertificate, CertificateParams, DistinguishedName, DnType, KeyPair, SanType,\nPKCS_ECDSA_P256_SHA256,\n};\n-use tokio::fs::{read, write};\n+use tokio::fs::{read, write, File};\n+use tokio::io::AsyncWriteExt;\nuse tracing::{debug, info, instrument, trace};\nuse crate::config::Config as KubeletConfig;\n@@ -272,7 +273,9 @@ async fn bootstrap_tls(\ntokio::fs::create_dir_all(p).await?;\n}\nwrite(&config.server_config.cert_file, &certificate).await?;\n- write(&config.server_config.private_key_file, &private_key).await?;\n+ let mut private_key_file = File::create(&config.server_config.private_key_file).await?;\n+ private_key_file.write_all(private_key.as_ref()).await?;\n+ restrict_permissions_of_private_file(&private_key_file).await?;\nnotify(completed_csr_approval(\"TLS\"));\n@@ -392,3 +395,14 @@ async fn read_from<P: AsRef<Path>>(path: P) -> anyhow::Result<Kubeconfig> {\nOk(config)\n}\n+\n+#[cfg(target_family = \"unix\")]\n+async fn restrict_permissions_of_private_file(file: &File) -> io::Result<()> {\n+ let permissions = std::os::unix::fs::PermissionsExt::from_mode(0o600);\n+ file.set_permissions(permissions).await\n+}\n+\n+#[cfg(not(target_family = \"unix\"))]\n+async fn restrict_permissions_of_private_file(_file: &File) -> io::Result<()> {\n+ Ok(())\n+}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Restrict permissions of private key file On Unix file systems the mode of the private key file is set to 0o600. On other file systems the permissions remain unchanged. Signed-off-by: Siegfried Weber <[email protected]>
350,417
22.07.2021 09:59:07
21,600
c4a628ae63f2f11a88d9c2def609da99e2a60a13
Add experimental WASI HTTP support
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "# This file is automatically @generated by Cargo.\n# It is not intended for manual editing.\n-version = 3\n-\n[[package]]\nname = \"addr2line\"\nversion = \"0.15.2\"\n@@ -46,9 +44,9 @@ dependencies = [\n[[package]]\nname = \"anyhow\"\n-version = \"1.0.41\"\n+version = \"1.0.42\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61\"\n+checksum = \"595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486\"\n[[package]]\nname = \"async-recursion\"\n@@ -58,7 +56,7 @@ checksum = \"d7d78656ba01f1b93024b7c3a0467f1608e4be67d725749fdcd7d2c7678fd7a2\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -79,7 +77,7 @@ checksum = \"648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -90,7 +88,7 @@ checksum = \"0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -288,9 +286,9 @@ dependencies = [\n[[package]]\nname = \"cc\"\n-version = \"1.0.68\"\n+version = \"1.0.69\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787\"\n+checksum = \"e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2\"\ndependencies = [\n\"jobserver\",\n]\n@@ -377,12 +375,11 @@ checksum = \"ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b\"\n[[package]]\nname = \"cpp_demangle\"\n-version = \"0.3.2\"\n+version = \"0.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"44919ecaf6f99e8e737bc239408931c9a01e9a6c74814fee8242dd2506b65390\"\n+checksum = \"8ea47428dc9d2237f3c6bc134472edfd63ebba0af932e783506dcfd66f10d18a\"\ndependencies = [\n\"cfg-if 1.0.0\",\n- \"glob\",\n]\n[[package]]\n@@ -568,7 +565,7 @@ checksum = \"fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -846,7 +843,7 @@ dependencies = [\n\"proc-macro-hack\",\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -940,12 +937,6 @@ dependencies = [\n\"stable_deref_trait\",\n]\n-[[package]]\n-name = \"glob\"\n-version = \"0.3.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574\"\n-\n[[package]]\nname = \"h2\"\nversion = \"0.3.3\"\n@@ -960,7 +951,7 @@ dependencies = [\n\"http 0.2.4\",\n\"indexmap\",\n\"slab\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-util\",\n\"tracing\",\n]\n@@ -1081,9 +1072,9 @@ dependencies = [\n[[package]]\nname = \"hyper\"\n-version = \"0.14.10\"\n+version = \"0.14.11\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7728a72c4c7d72665fde02204bcbd93b247721025b222ef78606f14513e0fd03\"\n+checksum = \"0b61cf2d1aebcf6e6352c97b81dc2244ca29194be1b276f5d8ad5c6330fffb11\"\ndependencies = [\n\"bytes 1.0.1\",\n\"futures-channel\",\n@@ -1097,7 +1088,7 @@ dependencies = [\n\"itoa\",\n\"pin-project-lite 0.2.7\",\n\"socket2\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tower-service\",\n\"tracing\",\n\"want\",\n@@ -1115,7 +1106,7 @@ dependencies = [\n\"log 0.4.14\",\n\"rustls\",\n\"rustls-native-certs\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-rustls\",\n\"webpki\",\n]\n@@ -1128,7 +1119,7 @@ checksum = \"bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1\"\ndependencies = [\n\"hyper\",\n\"pin-project-lite 0.2.7\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-io-timeout\",\n]\n@@ -1141,7 +1132,7 @@ dependencies = [\n\"bytes 1.0.1\",\n\"hyper\",\n\"native-tls\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-native-tls\",\n]\n@@ -1225,6 +1216,15 @@ dependencies = [\n\"bytes 1.0.1\",\n]\n+[[package]]\n+name = \"instant\"\n+version = \"0.1.10\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d\"\n+dependencies = [\n+ \"cfg-if 1.0.0\",\n+]\n+\n[[package]]\nname = \"io-lifetimes\"\nversion = \"0.1.1\"\n@@ -1379,7 +1379,7 @@ dependencies = [\n\"kube-runtime\",\n\"serde\",\n\"serde_json\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-stream\",\n\"tracing\",\n\"tracing-futures\",\n@@ -1393,7 +1393,7 @@ checksum = \"40288f982cf9b76b3784d652f509557a22fa454a070fd4e79fd9c13673a11066\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -1419,7 +1419,7 @@ dependencies = [\n\"serde_derive\",\n\"serde_json\",\n\"tempfile\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tonic\",\n\"tracing-subscriber\",\n\"wasi-provider\",\n@@ -1448,14 +1448,14 @@ dependencies = [\n\"kube-core\",\n\"openssl\",\n\"pem\",\n- \"pin-project 1.0.7\",\n+ \"pin-project 1.0.8\",\n\"rustls\",\n\"rustls-pemfile\",\n\"serde\",\n\"serde_json\",\n\"serde_yaml\",\n\"thiserror\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-native-tls\",\n\"tokio-util\",\n\"tower\",\n@@ -1491,12 +1491,12 @@ dependencies = [\n\"json-patch\",\n\"k8s-openapi\",\n\"kube\",\n- \"pin-project 1.0.7\",\n+ \"pin-project 1.0.8\",\n\"serde\",\n\"serde_json\",\n\"smallvec\",\n\"snafu\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-util\",\n\"tracing\",\n]\n@@ -1547,7 +1547,7 @@ dependencies = [\n\"tempfile\",\n\"thiserror\",\n\"tokio 0.2.25\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-compat-02\",\n\"tokio-stream\",\n\"tonic\",\n@@ -1600,6 +1600,15 @@ version = \"0.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3\"\n+[[package]]\n+name = \"lock_api\"\n+version = \"0.4.4\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb\"\n+dependencies = [\n+ \"scopeguard\",\n+]\n+\n[[package]]\nname = \"log\"\nversion = \"0.3.9\"\n@@ -1898,7 +1907,7 @@ dependencies = [\n\"serde\",\n\"serde_json\",\n\"sha2\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tracing\",\n\"www-authenticate\",\n]\n@@ -1950,13 +1959,38 @@ dependencies = [\n[[package]]\nname = \"ordered-float\"\n-version = \"2.6.0\"\n+version = \"2.7.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6dea6388d3d5498ec651701f14edbaf463c924b5d8829fb2848ccf0bcc7b3c69\"\n+checksum = \"039f02eb0f69271f26abe3202189275d7aa2258b903cb0281b5de710a2570ff3\"\ndependencies = [\n\"num-traits\",\n]\n+[[package]]\n+name = \"parking_lot\"\n+version = \"0.11.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb\"\n+dependencies = [\n+ \"instant\",\n+ \"lock_api\",\n+ \"parking_lot_core\",\n+]\n+\n+[[package]]\n+name = \"parking_lot_core\"\n+version = \"0.8.3\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018\"\n+dependencies = [\n+ \"cfg-if 1.0.0\",\n+ \"instant\",\n+ \"libc\",\n+ \"redox_syscall\",\n+ \"smallvec\",\n+ \"winapi 0.3.9\",\n+]\n+\n[[package]]\nname = \"paste\"\nversion = \"1.0.5\"\n@@ -2016,11 +2050,11 @@ dependencies = [\n[[package]]\nname = \"pin-project\"\n-version = \"1.0.7\"\n+version = \"1.0.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4\"\n+checksum = \"576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08\"\ndependencies = [\n- \"pin-project-internal 1.0.7\",\n+ \"pin-project-internal 1.0.8\",\n]\n[[package]]\n@@ -2031,18 +2065,18 @@ checksum = \"3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\nname = \"pin-project-internal\"\n-version = \"1.0.7\"\n+version = \"1.0.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f\"\n+checksum = \"6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -2098,7 +2132,7 @@ dependencies = [\n\"proc-macro-error-attr\",\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n\"version_check 0.9.3\",\n]\n@@ -2172,7 +2206,7 @@ dependencies = [\n\"itertools 0.9.0\",\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -2461,7 +2495,7 @@ dependencies = [\n\"serde\",\n\"serde_json\",\n\"serde_urlencoded\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-native-tls\",\n\"tokio-rustls\",\n\"url 2.2.2\",\n@@ -2497,7 +2531,7 @@ dependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n\"rustc_version 0.2.3\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -2651,7 +2685,7 @@ checksum = \"aaaae8f38bb311444cfb7f1979af0bc9240d95795f75f9ceddf6a59b79ceffa0\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -2753,7 +2787,7 @@ checksum = \"963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -2794,9 +2828,9 @@ dependencies = [\n[[package]]\nname = \"sha-1\"\n-version = \"0.9.6\"\n+version = \"0.9.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16\"\n+checksum = \"1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81\"\ndependencies = [\n\"block-buffer\",\n\"cfg-if 1.0.0\",\n@@ -2877,7 +2911,7 @@ checksum = \"1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -2929,7 +2963,7 @@ dependencies = [\n\"proc-macro-error\",\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -2945,9 +2979,9 @@ dependencies = [\n[[package]]\nname = \"syn\"\n-version = \"1.0.73\"\n+version = \"1.0.74\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7\"\n+checksum = \"1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n@@ -2982,9 +3016,9 @@ dependencies = [\n[[package]]\nname = \"target-lexicon\"\n-version = \"0.12.0\"\n+version = \"0.12.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834\"\n+checksum = \"b0652da4c4121005e9ed22b79f6c5f2d9e2752906b53a33e9490489ba421a6fb\"\n[[package]]\nname = \"tempfile\"\n@@ -3070,7 +3104,7 @@ checksum = \"060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -3095,9 +3129,9 @@ dependencies = [\n[[package]]\nname = \"tinyvec\"\n-version = \"1.2.0\"\n+version = \"1.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342\"\n+checksum = \"848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338\"\ndependencies = [\n\"tinyvec_macros\",\n]\n@@ -3131,9 +3165,9 @@ dependencies = [\n[[package]]\nname = \"tokio\"\n-version = \"1.8.1\"\n+version = \"1.9.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"98c8b05dc14c75ea83d63dd391100353789f5f24b8b3866542a5e85c8be8e985\"\n+checksum = \"4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c\"\ndependencies = [\n\"autocfg\",\n\"bytes 1.0.1\",\n@@ -3142,6 +3176,7 @@ dependencies = [\n\"mio 0.7.13\",\n\"num_cpus\",\n\"once_cell\",\n+ \"parking_lot\",\n\"pin-project-lite 0.2.7\",\n\"signal-hook-registry\",\n\"tokio-macros 1.3.0\",\n@@ -3158,7 +3193,7 @@ dependencies = [\n\"once_cell\",\n\"pin-project-lite 0.2.7\",\n\"tokio 0.2.25\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-stream\",\n]\n@@ -3169,7 +3204,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9\"\ndependencies = [\n\"pin-project-lite 0.2.7\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n]\n[[package]]\n@@ -3180,7 +3215,7 @@ checksum = \"e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -3191,7 +3226,7 @@ checksum = \"54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -3201,7 +3236,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b\"\ndependencies = [\n\"native-tls\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n]\n[[package]]\n@@ -3211,7 +3246,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6\"\ndependencies = [\n\"rustls\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"webpki\",\n]\n@@ -3223,7 +3258,7 @@ checksum = \"7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f\"\ndependencies = [\n\"futures-core\",\n\"pin-project-lite 0.2.7\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-util\",\n]\n@@ -3236,7 +3271,7 @@ dependencies = [\n\"async-stream\",\n\"bytes 1.0.1\",\n\"futures-core\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-stream\",\n]\n@@ -3248,8 +3283,8 @@ checksum = \"e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b\"\ndependencies = [\n\"futures-util\",\n\"log 0.4.14\",\n- \"pin-project 1.0.7\",\n- \"tokio 1.8.1\",\n+ \"pin-project 1.0.8\",\n+ \"tokio 1.9.0\",\n\"tungstenite\",\n]\n@@ -3265,7 +3300,7 @@ dependencies = [\n\"log 0.4.14\",\n\"pin-project-lite 0.2.7\",\n\"slab\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n]\n[[package]]\n@@ -3303,10 +3338,10 @@ dependencies = [\n\"http-body\",\n\"hyper\",\n\"percent-encoding 2.1.0\",\n- \"pin-project 1.0.7\",\n+ \"pin-project 1.0.8\",\n\"prost\",\n\"prost-derive\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-rustls\",\n\"tokio-stream\",\n\"tokio-util\",\n@@ -3325,7 +3360,7 @@ dependencies = [\n\"proc-macro2\",\n\"prost-build\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -3337,10 +3372,10 @@ dependencies = [\n\"futures-core\",\n\"futures-util\",\n\"indexmap\",\n- \"pin-project 1.0.7\",\n+ \"pin-project 1.0.8\",\n\"rand 0.8.4\",\n\"slab\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-stream\",\n\"tokio-util\",\n\"tower-layer\",\n@@ -3360,7 +3395,7 @@ dependencies = [\n\"futures-util\",\n\"http 0.2.4\",\n\"http-body\",\n- \"pin-project 1.0.7\",\n+ \"pin-project 1.0.8\",\n\"tower-layer\",\n\"tower-service\",\n\"tracing\",\n@@ -3385,8 +3420,8 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a4546773ffeab9e4ea02b8872faa49bb616a80a7da66afc2f32688943f97efa7\"\ndependencies = [\n\"futures-util\",\n- \"pin-project 1.0.7\",\n- \"tokio 1.8.1\",\n+ \"pin-project 1.0.8\",\n+ \"tokio 1.9.0\",\n\"tokio-test\",\n\"tower-layer\",\n\"tower-service\",\n@@ -3413,7 +3448,7 @@ checksum = \"c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n]\n[[package]]\n@@ -3431,7 +3466,7 @@ version = \"0.2.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2\"\ndependencies = [\n- \"pin-project 1.0.7\",\n+ \"pin-project 1.0.8\",\n\"tracing\",\n]\n@@ -3723,12 +3758,12 @@ dependencies = [\n\"mime_guess\",\n\"multipart\",\n\"percent-encoding 2.1.0\",\n- \"pin-project 1.0.7\",\n+ \"pin-project 1.0.8\",\n\"scoped-tls\",\n\"serde\",\n\"serde_json\",\n\"serde_urlencoded\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tokio-rustls\",\n\"tokio-stream\",\n\"tokio-tungstenite\",\n@@ -3789,6 +3824,26 @@ dependencies = [\n\"winapi 0.3.9\",\n]\n+[[package]]\n+name = \"wasi-experimental-http-wasmtime\"\n+version = \"0.5.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"5b207e13b7c228fd4626ee0bc1eb1d6cfb81473207c3b9521930404d2ee35790\"\n+dependencies = [\n+ \"anyhow\",\n+ \"bytes 1.0.1\",\n+ \"futures\",\n+ \"http 0.2.4\",\n+ \"reqwest\",\n+ \"thiserror\",\n+ \"tokio 1.9.0\",\n+ \"tracing\",\n+ \"url 2.2.2\",\n+ \"wasi-common\",\n+ \"wasmtime\",\n+ \"wasmtime-wasi\",\n+]\n+\n[[package]]\nname = \"wasi-provider\"\nversion = \"0.7.0\"\n@@ -3807,10 +3862,11 @@ dependencies = [\n\"serde_derive\",\n\"serde_json\",\n\"tempfile\",\n- \"tokio 1.8.1\",\n+ \"tokio 1.9.0\",\n\"tracing\",\n\"wasi-cap-std-sync\",\n\"wasi-common\",\n+ \"wasi-experimental-http-wasmtime\",\n\"wasmtime\",\n\"wasmtime-wasi\",\n\"wat\",\n@@ -3839,7 +3895,7 @@ dependencies = [\n\"log 0.4.14\",\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n\"wasm-bindgen-shared\",\n]\n@@ -3873,7 +3929,7 @@ checksum = \"be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n\"wasm-bindgen-backend\",\n\"wasm-bindgen-shared\",\n]\n@@ -4201,7 +4257,7 @@ dependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n\"shellexpand\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n\"witx\",\n]\n@@ -4213,7 +4269,7 @@ checksum = \"9e31ae77a274c9800e6f1342fa4a6dde5e2d72eb9d9b2e0418781be6efc35b58\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"syn 1.0.73\",\n+ \"syn 1.0.74\",\n\"wiggle-generate\",\n\"witx\",\n]\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/Cargo.toml", "new_path": "crates/wasi-provider/Cargo.toml", "diff": "@@ -40,6 +40,7 @@ wasi-common = \"0.28\"\nwasmtime = \"0.28\"\nwasmtime-wasi = \"0.28\"\nwat = \"1.0.38\"\n+wasi-experimental-http-wasmtime = \"0.5.0\"\n[dev-dependencies]\noci-distribution = {path = \"../oci-distribution\", version = \"0.6\"}\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/states/container/waiting.rs", "new_path": "crates/wasi-provider/src/states/container/waiting.rs", "diff": "@@ -10,13 +10,17 @@ use kubelet::pod::{Handle as PodHandle, PodKey};\nuse kubelet::state::common::GenericProviderState;\nuse kubelet::volume::VolumeRef;\n-use crate::wasi_runtime::WasiRuntime;\n+use crate::wasi_runtime::{WasiHttpConfig, WasiRuntime};\nuse crate::ProviderState;\nuse super::running::Running;\nuse super::terminated::Terminated;\nuse super::ContainerState;\n+pub const MAX_CONNCURRENT_REQUESTS_ANNOTATION_KEY: &str =\n+ \"alpha.wasi.krustlet.dev/max-concurrent-requests\";\n+pub const ALLOWED_DOMAINS_ANNOTATION_KEY: &str = \"alpha.wasi.krustlet.dev/allowed-domains\";\n+\nfn volume_path_map(\ncontainer: &Container,\nvolumes: &HashMap<String, VolumeRef>,\n@@ -135,6 +139,52 @@ impl State<ContainerState> for Waiting {\nstate.pod.name(),\ncontainer.name()\n);\n+\n+ let mut wasi_http_config = WasiHttpConfig::default();\n+ let annotations = state.pod.annotations();\n+\n+ // Parse allowed domains from annotation key\n+ if let Some(annotation) = annotations.get(ALLOWED_DOMAINS_ANNOTATION_KEY) {\n+ match serde_json::from_str(&annotation) {\n+ Ok(allowed_domains) => {\n+ wasi_http_config.allowed_domains = Some(allowed_domains);\n+ }\n+ Err(parse_err) => {\n+ return Transition::next(\n+ self,\n+ Terminated::new(\n+ format!(\n+ \"Error parsing annotation from key {:?}: {}\",\n+ ALLOWED_DOMAINS_ANNOTATION_KEY, parse_err,\n+ ),\n+ true,\n+ ),\n+ );\n+ }\n+ }\n+ }\n+\n+ // Parse allowed domains from annotation key\n+ if let Some(annotation) = annotations.get(MAX_CONNCURRENT_REQUESTS_ANNOTATION_KEY) {\n+ match annotation.parse() {\n+ Ok(max_concurrent_requests) => {\n+ wasi_http_config.max_concurrent_requests = Some(max_concurrent_requests);\n+ }\n+ Err(parse_err) => {\n+ return Transition::next(\n+ self,\n+ Terminated::new(\n+ format!(\n+ \"Error parsing annotation from key {:?}: {}\",\n+ MAX_CONNCURRENT_REQUESTS_ANNOTATION_KEY, parse_err,\n+ ),\n+ true,\n+ ),\n+ );\n+ }\n+ }\n+ }\n+\n// TODO: decide how/what it means to propagate annotations (from run_context) into WASM modules.\nlet runtime = match WasiRuntime::new(\nname,\n@@ -144,6 +194,7 @@ impl State<ContainerState> for Waiting {\ncontainer_volumes,\nlog_path,\ntx,\n+ wasi_http_config,\n)\n.await\n{\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/wasi_runtime.rs", "new_path": "crates/wasi-provider/src/wasi_runtime.rs", "diff": "@@ -13,6 +13,8 @@ use kubelet::container::Handle as ContainerHandle;\nuse kubelet::container::Status;\nuse kubelet::handle::StopHandler;\n+use wasi_experimental_http_wasmtime::HttpCtx as WasiHttpCtx;\n+\npub struct Runtime {\nhandle: JoinHandle<anyhow::Result<()>>,\ninterrupt_handle: InterruptHandle,\n@@ -34,7 +36,7 @@ impl StopHandler for Runtime {\n/// WasiRuntime provides a WASI compatible runtime. A runtime should be used for\n/// each \"instance\" of a process and can be passed to a thread pool for running\npub struct WasiRuntime {\n- // name of the process\n+ /// name of the process\nname: String,\n/// Data needed for the runtime\ndata: Arc<Data>,\n@@ -42,6 +44,15 @@ pub struct WasiRuntime {\noutput: Arc<NamedTempFile>,\n/// A channel to send status updates on the runtime\nstatus_sender: Sender<Status>,\n+ /// Configuration for the WASI http\n+ http_config: WasiHttpConfig,\n+}\n+\n+// Configuration for WASI http.\n+#[derive(Clone, Default)]\n+pub struct WasiHttpConfig {\n+ pub allowed_domains: Option<Vec<String>>,\n+ pub max_concurrent_requests: Option<u32>,\n}\nstruct Data {\n@@ -89,6 +100,7 @@ impl WasiRuntime {\ndirs: HashMap<PathBuf, Option<PathBuf>>,\nlog_dir: L,\nstatus_sender: Sender<Status>,\n+ http_config: WasiHttpConfig,\n) -> anyhow::Result<Self> {\nlet temp = tokio::task::spawn_blocking(move || -> anyhow::Result<NamedTempFile> {\nOk(NamedTempFile::new_in(log_dir)?)\n@@ -111,6 +123,7 @@ impl WasiRuntime {\n}),\noutput: Arc::new(temp),\nstatus_sender,\n+ http_config,\n})\n}\n@@ -216,6 +229,15 @@ impl WasiRuntime {\n};\nwasmtime_wasi::add_to_linker(&mut linker, |cx| cx)?;\n+\n+ // Link WASI HTTP\n+ let WasiHttpConfig {\n+ allowed_domains,\n+ max_concurrent_requests,\n+ } = self.http_config.clone();\n+ let wasi_http = WasiHttpCtx::new(allowed_domains, max_concurrent_requests)?;\n+ wasi_http.add_to_linker(&mut linker)?;\n+\nlet instance = match linker.instantiate(&mut store, &module) {\n// We can't map errors here or it moves the send channel, so we\n// do it in a match\n" }, { "change_type": "ADD", "old_path": null, "new_path": "demos/wasi/postman-echo/.gitignore", "diff": "+/target\n" }, { "change_type": "ADD", "old_path": null, "new_path": "demos/wasi/postman-echo/Cargo.lock", "diff": "+# This file is automatically @generated by Cargo.\n+# It is not intended for manual editing.\n+version = 3\n+\n+[[package]]\n+name = \"anyhow\"\n+version = \"1.0.42\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486\"\n+\n+[[package]]\n+name = \"bytes\"\n+version = \"1.0.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040\"\n+\n+[[package]]\n+name = \"cfg-if\"\n+version = \"1.0.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd\"\n+\n+[[package]]\n+name = \"fnv\"\n+version = \"1.0.7\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1\"\n+\n+[[package]]\n+name = \"http\"\n+version = \"0.2.4\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11\"\n+dependencies = [\n+ \"bytes\",\n+ \"fnv\",\n+ \"itoa\",\n+]\n+\n+[[package]]\n+name = \"itoa\"\n+version = \"0.4.7\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736\"\n+\n+[[package]]\n+name = \"lazy_static\"\n+version = \"1.4.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646\"\n+\n+[[package]]\n+name = \"log\"\n+version = \"0.4.14\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710\"\n+dependencies = [\n+ \"cfg-if\",\n+]\n+\n+[[package]]\n+name = \"pin-project-lite\"\n+version = \"0.2.7\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443\"\n+\n+[[package]]\n+name = \"postman-echo\"\n+version = \"0.1.0\"\n+dependencies = [\n+ \"bytes\",\n+ \"http\",\n+ \"wasi-experimental-http\",\n+]\n+\n+[[package]]\n+name = \"proc-macro2\"\n+version = \"1.0.27\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038\"\n+dependencies = [\n+ \"unicode-xid\",\n+]\n+\n+[[package]]\n+name = \"quote\"\n+version = \"1.0.9\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7\"\n+dependencies = [\n+ \"proc-macro2\",\n+]\n+\n+[[package]]\n+name = \"syn\"\n+version = \"1.0.74\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c\"\n+dependencies = [\n+ \"proc-macro2\",\n+ \"quote\",\n+ \"unicode-xid\",\n+]\n+\n+[[package]]\n+name = \"thiserror\"\n+version = \"1.0.26\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2\"\n+dependencies = [\n+ \"thiserror-impl\",\n+]\n+\n+[[package]]\n+name = \"thiserror-impl\"\n+version = \"1.0.26\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745\"\n+dependencies = [\n+ \"proc-macro2\",\n+ \"quote\",\n+ \"syn\",\n+]\n+\n+[[package]]\n+name = \"tracing\"\n+version = \"0.1.26\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d\"\n+dependencies = [\n+ \"cfg-if\",\n+ \"log\",\n+ \"pin-project-lite\",\n+ \"tracing-attributes\",\n+ \"tracing-core\",\n+]\n+\n+[[package]]\n+name = \"tracing-attributes\"\n+version = \"0.1.15\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2\"\n+dependencies = [\n+ \"proc-macro2\",\n+ \"quote\",\n+ \"syn\",\n+]\n+\n+[[package]]\n+name = \"tracing-core\"\n+version = \"0.1.18\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052\"\n+dependencies = [\n+ \"lazy_static\",\n+]\n+\n+[[package]]\n+name = \"unicode-xid\"\n+version = \"0.2.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3\"\n+\n+[[package]]\n+name = \"wasi-experimental-http\"\n+version = \"0.5.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"8644178fe5afcaefb2b8339bff3f7bd7368243258030ac69bff4beda685c2902\"\n+dependencies = [\n+ \"anyhow\",\n+ \"bytes\",\n+ \"http\",\n+ \"thiserror\",\n+ \"tracing\",\n+]\n" }, { "change_type": "ADD", "old_path": null, "new_path": "demos/wasi/postman-echo/Cargo.toml", "diff": "+[package]\n+name = \"postman-echo\"\n+version = \"0.1.0\"\n+authors = [\"Brian Hardock <[email protected]>\"]\n+edition = \"2018\"\n+\n+[dependencies]\n+wasi-experimental-http = \"0.5.0\"\n+bytes = \"1.0.1\"\n+http = \"0.2.4\"\n+\n+[workspace]\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "demos/wasi/postman-echo/README.md", "diff": "+# Experimental WASI HTTP\n+\n+This example demonstrates how to build a WASM module that makes an HTTP request using the `wasi-experimental-http` crate.\n+\n+## Build and Install\n+\n+This assumes that you have read the documentation on Krustlet and installed the\n+`wasm32-wasi` Rust environment as well as `wasm-to-oci`.\n+\n+> NOTE: In most cases you will want to copy the `postman-echo` directory out of\n+> the Krustlet codebase to get it to build quickly and correctly.\n+> `cp -a postman-echo ../../../`\n+\n+### To build\n+\n+Run in this directory.\n+\n+```shell\n+$ cargo wasi build --release\n+```\n+\n+The WASM binary will be written to `target/wasm32-wasi/release/postman-echo.wasm`.\n+\n+### To Upload\n+\n+Use `wasm-to-oci` to write this to an OCI registry.\n+\n+```console\n+$ wasm-to-oci push target/wasm32-wasi/release/postman-echo.wasm MY_REGISTRY/postman-echo:v1.0.0\n+```\n+\n+You will need to log into your container registry to do this. At this time,\n+DockerHub does not have a whitelist entry for WASM files, so you can't store\n+them in DockerHub.\n+\n+### To Install\n+\n+Update the `k8s.yaml` to point to the image that you pushed in the\n+previous step.\n+\n+Use `kubectl apply -f k8s.yaml`\n+\n+Check the logs of the `postman-echo` pod:\n+\n+```shell\n+$ kubectl logs --tail=1 postman-echo | python -m json.tool\n+```\n+\n+Should print the echoed HTTP body similar to:\n+\n+```json\n+{\n+ \"args\": {},\n+ \"data\": \"I'm not superstitious, but I am a little stitious.\",\n+ \"files\": {},\n+ \"form\": {},\n+ \"headers\": {\n+ \"accept\": \"*/*\",\n+ \"content-length\": \"50\",\n+ \"content-type\": \"text/plain\",\n+ \"host\": \"postman-echo.com\",\n+ \"x-amzn-trace-id\": \"Root=1-60f9e64c-36256b4878dc640c5af75f7d\",\n+ \"x-forwarded-port\": \"443\",\n+ \"x-forwarded-proto\": \"https\"\n+ },\n+ \"json\": null,\n+ \"url\": \"https://postman-echo.com/post\"\n+}\n+```\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "demos/wasi/postman-echo/k8s.yaml", "diff": "+apiVersion: v1\n+kind: Pod\n+metadata:\n+ name: postman-echo\n+ labels:\n+ app: postman-echo\n+ annotations:\n+ alpha.wasi.krustlet.dev/allowed-domains: '[\"https://postman-echo.com\"]'\n+ alpha.wasi.krustlet.dev/max-concurrent-requests: \"42\"\n+spec:\n+ containers:\n+ - image: webassembly.azurecr.io/postman-echo:v1.0.0\n+ imagePullPolicy: Always\n+ name: postman-echo\n+ tolerations:\n+ - key: \"node.kubernetes.io/network-unavailable\"\n+ operator: \"Exists\"\n+ effect: \"NoSchedule\"\n+ - key: \"kubernetes.io/arch\"\n+ operator: \"Equal\"\n+ value: \"wasm32-wasi\"\n+ effect: \"NoExecute\"\n+ - key: \"kubernetes.io/arch\"\n+ operator: \"Equal\"\n+ value: \"wasm32-wasi\"\n+ effect: \"NoSchedule\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "demos/wasi/postman-echo/src/main.rs", "diff": "+use wasi_experimental_http;\n+use bytes::Bytes;\n+use http;\n+\n+fn main() {\n+ const POSTMAN_ECHO_PAYLOAD: &[u8] = b\"I'm not superstitious, but I am a little stitious.\";\n+ const POSTMAN_ECHO_POST_URL: &str = \"https://postman-echo.com/post\";\n+\n+ let request_body = Bytes::from(POSTMAN_ECHO_PAYLOAD);\n+\n+ let request = http::request::Builder::new()\n+ .method(http::Method::POST)\n+ .uri(POSTMAN_ECHO_POST_URL)\n+ .header(\"Content-Type\", \"text/plain\")\n+ .body(Some(request_body))\n+ .expect(\"cannot construct request\");\n+\n+ let mut response = wasi_experimental_http::request(request).expect(\"cannot make request\");\n+ let response_body = response.body_read_all().unwrap();\n+ let response_text = std::str::from_utf8(&response_body).unwrap().to_string();\n+\n+ println!(\"{}\", response.status_code);\n+ println!(\"{}\", response_text);\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "@@ -78,6 +78,7 @@ async fn verify_wasi_node(node: Node) {\n);\n}\n+const EXPERIMENTAL_WASI_HTTP_POD: &str = \"experimental-wasi-http\";\nconst SIMPLE_WASI_POD: &str = \"hello-wasi\";\nconst VERBOSE_WASI_POD: &str = \"hello-world-verbose\";\nconst FAILY_POD: &str = \"faily-pod\";\n@@ -182,6 +183,63 @@ async fn create_wasi_pod(\n.await\n}\n+async fn create_experimental_wasi_http_pod(\n+ client: kube::Client,\n+ pods: &Api<Pod>,\n+ resource_manager: &mut TestResourceManager,\n+) -> anyhow::Result<()> {\n+ let pod_name = EXPERIMENTAL_WASI_HTTP_POD;\n+ let p = serde_json::from_value(json!({\n+ \"apiVersion\": \"v1\",\n+ \"kind\": \"Pod\",\n+ \"metadata\": {\n+ \"name\": pod_name,\n+ \"annotations\": {\n+ \"alpha.wasi.krustlet.dev/allowed-domains\": r#\"[\"https://postman-echo.com\"]\"#,\n+ \"alpha.wasi.krustlet.dev/max-concurrent-requests\": \"42\"\n+ }\n+ },\n+ \"spec\": {\n+ \"containers\": [\n+ {\n+ \"name\": pod_name,\n+ \"image\": \"webassembly.azurecr.io/postman-echo:v1.0.0\",\n+ },\n+ ],\n+ \"tolerations\": [\n+ {\n+ \"effect\": \"NoExecute\",\n+ \"key\": \"kubernetes.io/arch\",\n+ \"operator\": \"Equal\",\n+ \"value\": \"wasm32-wasi\"\n+ },\n+ {\n+ \"effect\": \"NoSchedule\",\n+ \"key\": \"kubernetes.io/arch\",\n+ \"operator\": \"Equal\",\n+ \"value\": \"wasm32-wasi\"\n+ },\n+ ],\n+ \"nodeSelector\": {\n+ \"kubernetes.io/arch\": \"wasm32-wasi\"\n+ }\n+ }\n+ }))?;\n+\n+ let pod = pods.create(&PostParams::default(), &p).await?;\n+ resource_manager.push(TestResource::Pod(pod_name.to_owned()));\n+\n+ assert_eq!(pod.status.unwrap().phase.unwrap(), \"Pending\");\n+\n+ wait_for_pod_complete(\n+ client,\n+ pod_name,\n+ resource_manager.namespace(),\n+ OnFailure::Panic,\n+ )\n+ .await\n+}\n+\nasync fn create_fancy_schmancy_wasi_pod(\nclient: kube::Client,\npods: &Api<Pod>,\n@@ -531,6 +589,22 @@ async fn test_wasi_node_should_verify() -> anyhow::Result<()> {\nOk(())\n}\n+#[tokio::test]\n+async fn test_experimental_wasi_http_pod() -> anyhow::Result<()> {\n+ const EXPECTED_POD_LOG: &str = \"200 OK\";\n+\n+ let test_ns = \"wasi-e2e-experimental-http\";\n+ let (client, pods, mut resource_manager) = set_up_test(test_ns).await?;\n+\n+ create_experimental_wasi_http_pod(client.clone(), &pods, &mut resource_manager).await?;\n+\n+ assert::pod_log_contains(&pods, EXPERIMENTAL_WASI_HTTP_POD, EXPECTED_POD_LOG).await?;\n+\n+ assert::pod_exited_successfully(&pods, EXPERIMENTAL_WASI_HTTP_POD).await?;\n+\n+ Ok(())\n+}\n+\n#[tokio::test]\nasync fn test_pod_logs_and_mounts() -> anyhow::Result<()> {\nlet test_ns = \"wasi-e2e-pod-logs-and-mounts\";\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Add experimental WASI HTTP support Signed-off-by: Brian Hardock <[email protected]>
350,424
27.07.2021 20:22:45
-7,200
66ffd700766fac5df5522b536cdb12cbd82a1085
deprecate oci errors add deprecation notice for ManifestUnverified and TagInvalid. both error codes have been removed from the OCI dist spec. ref: https://github.com/opencontainers/distribution-spec/blob/main/spec.md\#error-codes
[ { "change_type": "MODIFY", "old_path": "crates/oci-distribution/src/errors.rs", "new_path": "crates/oci-distribution/src/errors.rs", "diff": "@@ -66,6 +66,8 @@ pub enum OciErrorCode {\n/// This error is returned when the manifest, identified by name and tag is unknown to the repository.\nManifestUnknown,\n/// Manifest failed signature validation\n+ ///\n+ /// DEPRECATED: This error code has been removed from the OCI spec.\nManifestUnverified,\n/// Invalid repository name\nNameInvalid,\n@@ -74,6 +76,8 @@ pub enum OciErrorCode {\n/// Provided length did not match content length\nSizeInvalid,\n/// Manifest tag did not match URI\n+ ///\n+ /// DEPRECATED: This error code has been removed from the OCI spec.\nTagInvalid,\n/// Authentication required.\nUnauthorized,\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
deprecate oci errors add deprecation notice for ManifestUnverified and TagInvalid. both error codes have been removed from the OCI dist spec. ref: https://github.com/opencontainers/distribution-spec/blob/main/spec.md\#error-codes Signed-off-by: jwhb <[email protected]>
350,424
28.07.2021 13:57:48
-7,200
689f02a3039f1508b3bab963308b209e9140001f
add deserialization test for toomanyrequests error
[ { "change_type": "MODIFY", "old_path": "crates/oci-distribution/src/errors.rs", "new_path": "crates/oci-distribution/src/errors.rs", "diff": "@@ -106,6 +106,19 @@ mod test {\nassert_ne!(serde_json::value::Value::Null, e.detail);\n}\n+ const EXAMPLE_ERROR_TOOMANYREQUESTS: &str = r#\"\n+ {\"errors\":[{\"code\":\"TOOMANYREQUESTS\",\"message\":\"pull request limit exceeded\",\"detail\":\"You have reached your pull rate limit.\"}]}\n+ \"#;\n+ #[test]\n+ fn test_deserialize_toomanyrequests() {\n+ let envelope: OciEnvelope =\n+ serde_json::from_str(EXAMPLE_ERROR_TOOMANYREQUESTS).expect(\"parse example error\");\n+ let e = &envelope.errors[0];\n+ assert_eq!(OciErrorCode::Toomanyrequests, e.code);\n+ assert_eq!(\"pull request limit exceeded\", e.message);\n+ assert_ne!(serde_json::value::Value::Null, e.detail);\n+ }\n+\nconst EXAMPLE_ERROR_MISSING_MESSAGE: &str = r#\"\n{\"errors\":[{\"code\":\"UNAUTHORIZED\",\"detail\":[{\"Type\":\"repository\",\"Name\":\"hello-wasm\",\"Action\":\"pull\"}]}]}\n\"#;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add deserialization test for toomanyrequests error Signed-off-by: jwhb <[email protected]>
350,406
09.08.2021 20:38:31
-19,080
0fac34ff76a57d8e8f1c9dd065bcad6fb8b30a40
added steps to support bootstrapping by loading filepath to CA
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/bootstrapping/mod.rs", "new_path": "crates/kubelet/src/bootstrapping/mod.rs", "diff": "@@ -10,11 +10,11 @@ use rcgen::{\nCertificate, CertificateParams, DistinguishedName, DnType, KeyPair, SanType,\nPKCS_ECDSA_P256_SHA256,\n};\n-use tokio::fs::{read, write, File};\n+use tokio::fs::{read, read_to_string, write, File};\nuse tokio::io::AsyncWriteExt;\nuse tracing::{debug, info, instrument, trace};\n-use crate::config::Config as KubeletConfig;\n+use crate::config::{self, Config as KubeletConfig};\nuse crate::kubeconfig::exists as kubeconfig_exists;\nuse crate::kubeconfig::KUBECONFIG;\n@@ -66,14 +66,23 @@ async fn bootstrap_auth<K: AsRef<Path>>(\n})?;\nlet server = named_cluster.cluster.server;\ntrace!(%server, \"Identified server information from bootstrap config\");\n- let ca_data = named_cluster\n- .cluster\n- .certificate_authority_data\n- .ok_or_else(|| {\n- anyhow::anyhow!(\n+\n+ let ca_data = match named_cluster.cluster.certificate_authority {\n+ Some(certificate_authority) => {\n+ read_to_string(certificate_authority).await.map_err(|e| {\n+ anyhow::anyhow!(format!(\"Error loading certificate_authority file: {}\", e))\n+ })?\n+ }\n+ None => match named_cluster.cluster.certificate_authority_data {\n+ Some(certificate_authority_data) => certificate_authority_data,\n+ None => {\n+ return Err(anyhow::anyhow!(\n\"Unable to find certificate authority information in bootstrap config\"\n- )\n- })?;\n+ ))\n+ }\n+ },\n+ };\n+\ntrace!(csr_name = %config.node_name, \"Generating and sending CSR to Kubernetes API\");\nlet csrs: Api<CertificateSigningRequest> = Api::all(client);\nlet csr_json = serde_json::json!({\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
added steps to support bootstrapping by loading filepath to CA Signed-off-by: VishnuJin <[email protected]>
350,406
14.08.2021 00:28:24
-19,080
dd8effbc6dfc502df846ef52ffa65ded9769d430
add steps to base64 encode ca file
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/bootstrapping/mod.rs", "new_path": "crates/kubelet/src/bootstrapping/mod.rs", "diff": "@@ -68,11 +68,14 @@ async fn bootstrap_auth<K: AsRef<Path>>(\ntrace!(%server, \"Identified server information from bootstrap config\");\nlet ca_data = match named_cluster.cluster.certificate_authority {\n- Some(certificate_authority) => {\n- read_to_string(certificate_authority).await.map_err(|e| {\n+ Some(certificate_authority) => base64::encode(\n+ read_to_string(certificate_authority)\n+ .await\n+ .map_err(|e| {\nanyhow::anyhow!(format!(\"Error loading certificate_authority file: {}\", e))\n})?\n- }\n+ .as_bytes(),\n+ ),\nNone => match named_cluster.cluster.certificate_authority_data {\nSome(certificate_authority_data) => certificate_authority_data,\nNone => {\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add steps to base64 encode ca file Signed-off-by: VishnuJin <[email protected]>
350,406
14.08.2021 01:16:26
-19,080
f3510efd844322a31518bf853ff1bb8f0528bafd
simple commit to change the read_to_string() to read() to avoid string conversion handling
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/bootstrapping/mod.rs", "new_path": "crates/kubelet/src/bootstrapping/mod.rs", "diff": "@@ -10,7 +10,7 @@ use rcgen::{\nCertificate, CertificateParams, DistinguishedName, DnType, KeyPair, SanType,\nPKCS_ECDSA_P256_SHA256,\n};\n-use tokio::fs::{read, read_to_string, write, File};\n+use tokio::fs::{read, write, File};\nuse tokio::io::AsyncWriteExt;\nuse tracing::{debug, info, instrument, trace};\n@@ -68,14 +68,11 @@ async fn bootstrap_auth<K: AsRef<Path>>(\ntrace!(%server, \"Identified server information from bootstrap config\");\nlet ca_data = match named_cluster.cluster.certificate_authority {\n- Some(certificate_authority) => base64::encode(\n- read_to_string(certificate_authority)\n- .await\n- .map_err(|e| {\n+ Some(certificate_authority) => {\n+ base64::encode(read(certificate_authority).await.map_err(|e| {\nanyhow::anyhow!(format!(\"Error loading certificate_authority file: {}\", e))\n- })?\n- .as_bytes(),\n- ),\n+ })?)\n+ }\nNone => match named_cluster.cluster.certificate_authority_data {\nSome(certificate_authority_data) => certificate_authority_data,\nNone => {\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
simple commit to change the read_to_string() to read() to avoid string conversion handling Signed-off-by: VishnuJin <[email protected]>
350,440
30.08.2021 11:15:58
-7,200
ca839906edf0168e84cb1a36b1e7ff11fd896791
Migrate to certificates.k8s.io/v1 The certificates.k8s.io/v1beta1 API version of CertificateSigningRequest is no longer served as of v1.22. The certificates.k8s.io/v1 API version is used instead which is available since v1.19.
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/bootstrapping/mod.rs", "new_path": "crates/kubelet/src/bootstrapping/mod.rs", "diff": "use std::{convert::TryFrom, env, io, path::Path, str};\nuse futures::{StreamExt, TryStreamExt};\n-use k8s_openapi::api::certificates::v1beta1::CertificateSigningRequest;\n+use k8s_openapi::api::certificates::v1::CertificateSigningRequest;\nuse kube::api::{Api, ListParams, PostParams};\nuse kube::config::Kubeconfig;\nuse kube::Config;\n@@ -86,7 +86,7 @@ async fn bootstrap_auth<K: AsRef<Path>>(\ntrace!(csr_name = %config.node_name, \"Generating and sending CSR to Kubernetes API\");\nlet csrs: Api<CertificateSigningRequest> = Api::all(client);\nlet csr_json = serde_json::json!({\n- \"apiVersion\": \"certificates.k8s.io/v1beta1\",\n+ \"apiVersion\": \"certificates.k8s.io/v1\",\n\"kind\": \"CertificateSigningRequest\",\n\"metadata\": {\n\"name\": config.node_name,\n@@ -201,7 +201,7 @@ async fn bootstrap_tls(\nlet client = kube::Client::try_from(kubeconfig)?;\nlet csrs: Api<CertificateSigningRequest> = Api::all(client);\nlet csr_json = serde_json::json!({\n- \"apiVersion\": \"certificates.k8s.io/v1beta1\",\n+ \"apiVersion\": \"certificates.k8s.io/v1\",\n\"kind\": \"CertificateSigningRequest\",\n\"metadata\": {\n\"name\": csr_name,\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Migrate to certificates.k8s.io/v1 The certificates.k8s.io/v1beta1 API version of CertificateSigningRequest is no longer served as of v1.22. The certificates.k8s.io/v1 API version is used instead which is available since v1.19. Signed-off-by: Siegfried Weber <[email protected]>
350,448
22.07.2021 08:20:24
25,200
882fdb67ddea1526181e56f25c47fc9412050d3f
Add grpc sock utils to tests Add mock device plugin struct to test Build plugin api for tests
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -1262,6 +1262,15 @@ dependencies = [\n\"either\",\n]\n+[[package]]\n+name = \"itertools\"\n+version = \"0.9.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b\"\n+dependencies = [\n+ \"either\",\n+]\n+\n[[package]]\nname = \"itertools\"\nversion = \"0.10.1\"\n@@ -1323,11 +1332,11 @@ version = \"0.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5494bb53430a090bdcfa2677b0c5f19989a3c0cc43e2660f2e0f7d099218ade7\"\ndependencies = [\n- \"prost\",\n- \"prost-build\",\n- \"prost-types\",\n+ \"prost 0.8.0\",\n+ \"prost-build 0.8.0\",\n+ \"prost-types 0.8.0\",\n\"tonic\",\n- \"tonic-build\",\n+ \"tonic-build 0.5.1\",\n]\n[[package]]\n@@ -1406,6 +1415,7 @@ dependencies = [\n\"kube-runtime\",\n\"kubelet\",\n\"oci-distribution\",\n+ \"prost 0.8.0\",\n\"regex\",\n\"reqwest\",\n\"serde\",\n@@ -1413,8 +1423,10 @@ dependencies = [\n\"serde_json\",\n\"tempfile\",\n\"tokio 1.9.0\",\n+ \"tokio-stream\",\n\"tonic\",\n- \"tonic-build\",\n+ \"tonic-build 0.4.2\",\n+ \"tower\",\n\"tracing-subscriber\",\n\"wasi-provider\",\n]\n@@ -1527,8 +1539,8 @@ dependencies = [\n\"miow 0.2.2\",\n\"notify\",\n\"oci-distribution\",\n- \"prost\",\n- \"prost-types\",\n+ \"prost 0.8.0\",\n+ \"prost-types 0.8.0\",\n\"rcgen\",\n\"regex\",\n\"remove_dir_all 0.7.0\",\n@@ -1545,7 +1557,7 @@ dependencies = [\n\"tokio-compat-02\",\n\"tokio-stream\",\n\"tonic\",\n- \"tonic-build\",\n+ \"tonic-build 0.5.1\",\n\"tower\",\n\"tower-test\",\n\"tracing\",\n@@ -2162,6 +2174,16 @@ dependencies = [\n\"unicode-xid 0.2.2\",\n]\n+[[package]]\n+name = \"prost\"\n+version = \"0.7.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2\"\n+dependencies = [\n+ \"bytes 1.0.1\",\n+ \"prost-derive 0.7.0\",\n+]\n+\n[[package]]\nname = \"prost\"\nversion = \"0.8.0\"\n@@ -2169,7 +2191,25 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020\"\ndependencies = [\n\"bytes 1.0.1\",\n- \"prost-derive\",\n+ \"prost-derive 0.8.0\",\n+]\n+\n+[[package]]\n+name = \"prost-build\"\n+version = \"0.7.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3\"\n+dependencies = [\n+ \"bytes 1.0.1\",\n+ \"heck\",\n+ \"itertools 0.9.0\",\n+ \"log 0.4.14\",\n+ \"multimap\",\n+ \"petgraph\",\n+ \"prost 0.7.0\",\n+ \"prost-types 0.7.0\",\n+ \"tempfile\",\n+ \"which\",\n]\n[[package]]\n@@ -2184,12 +2224,25 @@ dependencies = [\n\"log 0.4.14\",\n\"multimap\",\n\"petgraph\",\n- \"prost\",\n- \"prost-types\",\n+ \"prost 0.8.0\",\n+ \"prost-types 0.8.0\",\n\"tempfile\",\n\"which\",\n]\n+[[package]]\n+name = \"prost-derive\"\n+version = \"0.7.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4\"\n+dependencies = [\n+ \"anyhow\",\n+ \"itertools 0.9.0\",\n+ \"proc-macro2\",\n+ \"quote 1.0.9\",\n+ \"syn 1.0.74\",\n+]\n+\n[[package]]\nname = \"prost-derive\"\nversion = \"0.8.0\"\n@@ -2203,6 +2256,16 @@ dependencies = [\n\"syn 1.0.74\",\n]\n+[[package]]\n+name = \"prost-types\"\n+version = \"0.7.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb\"\n+dependencies = [\n+ \"bytes 1.0.1\",\n+ \"prost 0.7.0\",\n+]\n+\n[[package]]\nname = \"prost-types\"\nversion = \"0.8.0\"\n@@ -2210,7 +2273,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b\"\ndependencies = [\n\"bytes 1.0.1\",\n- \"prost\",\n+ \"prost 0.8.0\",\n]\n[[package]]\n@@ -3316,8 +3379,8 @@ dependencies = [\n\"hyper-timeout\",\n\"percent-encoding 2.1.0\",\n\"pin-project 1.0.8\",\n- \"prost\",\n- \"prost-derive\",\n+ \"prost 0.8.0\",\n+ \"prost-derive 0.8.0\",\n\"tokio 1.9.0\",\n\"tokio-rustls\",\n\"tokio-stream\",\n@@ -3329,6 +3392,18 @@ dependencies = [\n\"tracing-futures\",\n]\n+[[package]]\n+name = \"tonic-build\"\n+version = \"0.4.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"c695de27302f4697191dda1c7178131a8cb805463dda02864acb80fe1322fdcf\"\n+dependencies = [\n+ \"proc-macro2\",\n+ \"prost-build 0.7.0\",\n+ \"quote 1.0.9\",\n+ \"syn 1.0.74\",\n+]\n+\n[[package]]\nname = \"tonic-build\"\nversion = \"0.5.1\"\n@@ -3336,7 +3411,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d12faebbe071b06f486be82cc9318350814fdd07fcb28f3690840cd770599283\"\ndependencies = [\n\"proc-macro2\",\n- \"prost-build\",\n+ \"prost-build 0.8.0\",\n\"quote 1.0.9\",\n\"syn 1.0.74\",\n]\n" }, { "change_type": "MODIFY", "old_path": "Cargo.toml", "new_path": "Cargo.toml", "diff": "@@ -68,6 +68,10 @@ serde_json = \"1.0\"\ntempfile = \"3.2\"\ntokio = {version = \"1.0\", features = [\"macros\", \"rt-multi-thread\", \"time\", \"process\"]}\ntonic = \"0.5\"\n+tokio-stream = { version=\"0.1\", features = [\"fs\", \"net\"] }\n+tower = { version = \"0.4.2\", features = [\"util\"] }\n+# prost is needed for the files built by the protobuf\n+prost = \"0.8\"\n[build-dependencies]\ntonic-build = \"0.4\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "build.rs", "diff": "+fn main() -> Result<(), Box<dyn std::error::Error>> {\n+ // We need to build the proto files so that we can use them in the tests\n+ println!(\"cargo:rerun-if-changed=crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto\");\n+\n+ let builder = tonic_build::configure()\n+ .format(true)\n+ .build_client(true)\n+ .build_server(true);\n+\n+ println!(\"cargo:warning=Build file ran\");\n+\n+ // Generate Device Plugin code\n+ builder.compile(\n+ &[\"crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto\"],\n+ &[\n+ \"crates/kubelet/proto/pluginregistration/v1\",\n+ \"crates/kubelet/proto/deviceplugin/v1beta1\",\n+ ],\n+ )?;\n+\n+ Ok(())\n+}\n" }, { "change_type": "DELETE", "old_path": "tests/build.rs", "new_path": null, "diff": "-fn main() -> Result<(), Box<dyn std::error::Error>> {\n- println!(\"cargo:rerun-if-changed=../crates/kubelet/proto/pluginregistration/v1/pluginregistration.proto\");\n- println!(\"cargo:rerun-if-changed=../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto\");\n-\n- let builder = tonic_build::configure()\n- .format(true)\n- .build_client(true)\n- .build_server(true);\n-\n- std::fs::write(\"./foo.bar\", b\"hello world\")?;\n-\n- // Generate CSI plugin and Device Plugin code\n- builder.compile(\n- &[\n- \"../crates/kubelet/proto/pluginregistration/v1/pluginregistration.proto\",\n- \"../crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto\",\n- ],\n- &[\"../crates/kubelet/proto/pluginregistration/v1\", \"../crates/kubelet/proto/deviceplugin/v1beta1\"],\n- )?;\n-\n- Ok(())\n-}\n" }, { "change_type": "MODIFY", "old_path": "tests/csi/mod.rs", "new_path": "tests/csi/mod.rs", "diff": "+#[path = \"../grpc_sock/mod.rs\"]\n+pub mod grpc_sock;\npub mod setup;\n-#[path = \"../socket_server.rs\"]\n-pub mod socket_server;\nuse std::collections::HashSet;\nuse std::sync::Arc;\n" }, { "change_type": "MODIFY", "old_path": "tests/csi/setup.rs", "new_path": "tests/csi/setup.rs", "diff": "@@ -58,7 +58,7 @@ async fn driver_start(\nErr(e) if matches!(e.kind(), std::io::ErrorKind::NotFound) => (),\nErr(e) => return Err(e.into()),\n};\n- let socket = super::socket_server::Socket::new(SOCKET_PATH)\n+ let socket = super::grpc_sock::server::Socket::new(SOCKET_PATH)\n.expect(\"unable to setup server listening on socket\");\nlet (tx, rx) = tokio::sync::oneshot::channel::<Option<String>>();\n" }, { "change_type": "MODIFY", "old_path": "tests/device_plugin/mod.rs", "new_path": "tests/device_plugin/mod.rs", "diff": "-#[path = \"../socket_server.rs\"]\n-pub mod socket_server;\npub(crate) mod v1beta1 {\npub const API_VERSION: &str = \"v1beta1\";\ntonic::include_proto!(\"v1beta1\");\n}\n-use v1beta1::{\n- device_plugin_server::{DevicePlugin, DevicePluginServer},\n- registration_client, AllocateRequest, AllocateResponse, Device, DevicePluginOptions, Empty,\n- ListAndWatchResponse, PreStartContainerRequest, PreStartContainerResponse,\n- PreferredAllocationRequest, PreferredAllocationResponse, API_VERSION,\n-};\n+#[path = \"../grpc_sock/mod.rs\"]\n+pub mod grpc_sock;\nuse futures::Stream;\n+use std::path::{Path, PathBuf};\nuse std::pin::Pin;\nuse tokio::sync::{mpsc, watch};\nuse tonic::{Request, Response, Status};\n+use v1beta1::{\n+ device_plugin_server::{DevicePlugin, DevicePluginServer},\n+ registration_client, AllocateRequest, AllocateResponse, ContainerAllocateResponse, Device,\n+ DevicePluginOptions, Empty, ListAndWatchResponse, PreStartContainerRequest,\n+ PreStartContainerResponse, PreferredAllocationRequest, PreferredAllocationResponse,\n+ RegisterRequest, API_VERSION,\n+};\n/// Mock Device Plugin for testing the DeviceManager Sends a new list of devices to the\n/// DeviceManager whenever it's `devices_receiver` is notified of them on a channel.\n@@ -32,9 +34,8 @@ impl DevicePlugin for MockDevicePlugin {\nunimplemented!();\n}\n- type ListAndWatchStream = Pin<\n- Box<dyn Stream<Item = Result<ListAndWatchResponse, Status>> + Send + Sync + 'static>,\n- >;\n+ type ListAndWatchStream =\n+ Pin<Box<dyn Stream<Item = Result<ListAndWatchResponse, Status>> + Send + Sync + 'static>>;\nasync fn list_and_watch(\n&self,\n_request: Request<Empty>,\n@@ -101,8 +102,7 @@ async fn run_mock_device_plugin(\n// return with a channel\nlet (tx, rx) = tokio::sync::oneshot::channel();\ntokio::task::spawn(async move {\n- let device_plugin_temp_dir =\n- tempfile::tempdir().expect(\"should be able to create tempdir\");\n+ let device_plugin_temp_dir = tempfile::tempdir().expect(\"should be able to create tempdir\");\nlet socket_name = \"gpu-device-plugin.sock\";\nlet dp_socket = device_plugin_temp_dir\n.path()\n@@ -112,8 +112,7 @@ async fn run_mock_device_plugin(\n.to_string();\ntx.send(dp_socket.clone()).unwrap();\nlet device_plugin = MockDevicePlugin { devices_receiver };\n- let socket =\n- grpc_sock::server::Socket::new(&dp_socket).expect(\"couldn't make dp socket\");\n+ let socket = grpc_sock::server::Socket::new(&dp_socket).expect(\"couldn't make dp socket\");\nlet serv = tonic::transport::Server::builder()\n.add_service(DevicePluginServer::new(device_plugin))\n.serve_with_incoming(socket);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "tests/grpc_sock/client.rs", "diff": "+// This is heavily adapted from https://github.com/hyperium/tonic/blob/f1275b611e38ec5fe992b2f10552bf95e8448b17/examples/src/uds/client.rs\n+\n+#[cfg_attr(target_family = \"windows\", path = \"windows/mod.rs\")]\n+#[cfg(target_family = \"windows\")]\n+pub mod windows;\n+\n+use std::path::Path;\n+\n+#[cfg(target_family = \"windows\")]\n+use crate::mio_uds_windows::UnixStream;\n+#[cfg(target_family = \"unix\")]\n+use tokio::net::UnixStream;\n+use tonic::transport::{Channel, Endpoint, Uri};\n+use tower::service_fn;\n+\n+/// Returns a new UNIX socket channel suitable for use with tonic generated gRPC clients. Instead of\n+/// using `YourClient::connect`, you'll need to pass the returned channel to `YourClient::new`\n+pub async fn socket_channel<P: AsRef<Path>>(path: P) -> Result<Channel, tonic::transport::Error> {\n+ // Get an owned copy of the path so we can use it in the FnMut closure\n+ let p = path.as_ref().to_owned();\n+\n+ // This is a dummy http endpoint needed for the Endpoint constructors, it is ignored by the\n+ // connector\n+ #[cfg(target_family = \"unix\")]\n+ let res = Endpoint::from_static(\"http://[::]:50051\")\n+ .connect_with_connector(service_fn(move |_: Uri| {\n+ // Connect to a Uds socket\n+ UnixStream::connect(p.clone())\n+ }))\n+ .await;\n+\n+ #[cfg(target_family = \"windows\")]\n+ let res = Endpoint::from_static(\"http://[::]:50051\")\n+ .connect_with_connector(service_fn(move |_: Uri| {\n+ // Need to copy the path here again so this can be FnMut\n+ let path_copy = p.to_owned();\n+ // Connect to a Uds socket\n+ async move {\n+ tokio::task::spawn_blocking(move || {\n+ let stream = UnixStream::connect(path_copy)?;\n+ windows::UnixStream::new(stream)\n+ })\n+ .await?\n+ }\n+ }))\n+ .await;\n+\n+ res\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "tests/grpc_sock/mod.rs", "diff": "+//! Copied from kubelet crate\n+//! A client/server implementation using UNIX sockets for gRPC, meant for use with tonic. Socket\n+//! support is not built in to tonic and support for UNIX sockets on Windows requires its own crate\n+//! (as it isn't in standard due to backwards compatibility guarantees). This is our own package for\n+//! now, but if it is useful we could publish it as its own crate\n+\n+#[cfg_attr(target_family = \"unix\", path = \"unix/mod.rs\")]\n+#[cfg_attr(target_family = \"windows\", path = \"windows/mod.rs\")]\n+pub mod server;\n+\n+pub mod client;\n" }, { "change_type": "RENAME", "old_path": "tests/socket_server.rs", "new_path": "tests/grpc_sock/unix/mod.rs", "diff": "-// Copied from the grpc_sock module in the Kubelet crate. The windows stuff is pretty hacky so it\n-// shouldn't be exported from there. Before we make this cross platform in the future, we'll need to\n-// make sure the server part works well on Windows\n+// This is a modified version of: https://github.com/hyperium/tonic/blob/f1275b611e38ec5fe992b2f10552bf95e8448b17/examples/src/uds/server.rs\nuse std::{\n- path::{Path, PathBuf},\n+ path::Path,\npin::Pin,\ntask::{Context, Poll},\n};\n@@ -15,37 +13,14 @@ use tonic::transport::server::Connected;\n#[derive(Debug)]\npub struct UnixStream(tokio::net::UnixStream);\n-/// A `PathBuf` that will get deleted on drop\n-struct OwnedPathBuf {\n- inner: PathBuf,\n-}\n-\n-impl Drop for OwnedPathBuf {\n- fn drop(&mut self) {\n- if let Err(e) = std::fs::remove_file(&self.inner) {\n- eprintln!(\n- \"cleanup of file {} failed, manual cleanup needed: {}\",\n- self.inner.display(),\n- e\n- );\n- }\n- }\n-}\n-\npub struct Socket {\nlistener: tokio::net::UnixListener,\n- _socket_path: OwnedPathBuf,\n}\nimpl Socket {\n- pub fn new<P: AsRef<Path> + ?Sized>(path: &P) -> anyhow::Result<Self> {\n+ pub fn new<P: AsRef<Path>>(path: &P) -> anyhow::Result<Self> {\nlet listener = tokio::net::UnixListener::bind(path)?;\n- Ok(Socket {\n- listener,\n- _socket_path: OwnedPathBuf {\n- inner: path.as_ref().to_owned(),\n- },\n- })\n+ Ok(Socket { listener })\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "tests/grpc_sock/windows/mod.rs", "diff": "+// This is a modified version of: https://github.com/hyperium/tonic/blob/f1275b611e38ec5fe992b2f10552bf95e8448b17/examples/src/uds/server.rs\n+\n+use std::{\n+ path::Path,\n+ pin::Pin,\n+ task::{Context, Poll},\n+};\n+\n+use futures::{FutureExt, Stream};\n+use mio::Ready;\n+use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};\n+use tokio_compat_02::FutureExt as CompatFutureExt;\n+use tonic::transport::server::Connected;\n+\n+pub struct UnixStream {\n+ inner: tokio_compat_02::IoCompat<tokio_02::io::PollEvented<crate::mio_uds_windows::UnixStream>>,\n+}\n+\n+impl UnixStream {\n+ pub fn new(stream: crate::mio_uds_windows::UnixStream) -> Result<UnixStream, std::io::Error> {\n+ let inner = match async {\n+ Ok::<_, std::io::Error>(tokio_compat_02::IoCompat::new(\n+ tokio_02::io::PollEvented::new(stream)?,\n+ ))\n+ }\n+ .compat()\n+ .now_or_never()\n+ {\n+ Some(res) => res?,\n+ None => {\n+ return Err(std::io::Error::new(\n+ std::io::ErrorKind::Other,\n+ \"Unable to start IO poll\",\n+ ))\n+ }\n+ };\n+ Ok(UnixStream { inner })\n+ }\n+}\n+\n+pub struct Socket {\n+ listener: tokio_02::io::PollEvented<crate::mio_uds_windows::UnixListener>,\n+}\n+\n+impl Socket {\n+ #[allow(dead_code)]\n+ pub fn new<P: AsRef<Path>>(path: &P) -> anyhow::Result<Self> {\n+ let p = path.as_ref().to_owned();\n+ let listener = crate::mio_uds_windows::UnixListener::bind(p)?;\n+ let listener = match async { tokio_02::io::PollEvented::new(listener) }\n+ .compat()\n+ .now_or_never()\n+ {\n+ Some(res) => res?,\n+ None => return Err(anyhow::anyhow!(\"Unable to poll IO\")),\n+ };\n+ Ok(Socket { listener })\n+ }\n+}\n+\n+impl Stream for Socket {\n+ type Item = Result<UnixStream, std::io::Error>;\n+\n+ fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {\n+ futures::ready!(self.listener.poll_read_ready(cx, Ready::readable()))?;\n+\n+ let stream = match self.listener.get_ref().accept() {\n+ Ok(None) => {\n+ self.listener.clear_read_ready(cx, Ready::readable())?;\n+ return Poll::Pending;\n+ }\n+ Ok(Some((stream, _))) => stream,\n+ // Not much error handling we can do here, so just return Pending so\n+ // it'll try again\n+ Err(_) => {\n+ self.listener.clear_read_ready(cx, Ready::readable())?;\n+ return Poll::Pending;\n+ }\n+ };\n+ Poll::Ready(Some(UnixStream::new(stream)))\n+ }\n+}\n+\n+impl Connected for UnixStream {}\n+\n+impl AsyncRead for UnixStream {\n+ fn poll_read(\n+ mut self: Pin<&mut Self>,\n+ cx: &mut Context<'_>,\n+ buf: &mut ReadBuf<'_>,\n+ ) -> Poll<std::io::Result<()>> {\n+ Pin::new(&mut self.inner).poll_read(cx, buf)\n+ }\n+}\n+\n+impl AsyncWrite for UnixStream {\n+ fn poll_write(\n+ mut self: Pin<&mut Self>,\n+ cx: &mut Context<'_>,\n+ buf: &[u8],\n+ ) -> Poll<std::io::Result<usize>> {\n+ Pin::new(&mut self.inner).poll_write(cx, buf)\n+ }\n+\n+ fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<std::io::Result<()>> {\n+ Pin::new(&mut self.inner).poll_flush(cx)\n+ }\n+\n+ fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<std::io::Result<()>> {\n+ Pin::new(&mut self.inner).poll_shutdown(cx)\n+ }\n+}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Add grpc sock utils to tests Add mock device plugin struct to test Build plugin api for tests Co-authored-by: Taylor Thomas <[email protected]> Signed-off-by: Kate Goldenring <[email protected]>
350,448
22.07.2021 17:18:00
25,200
b0fe3636d0ba2ceb8c61c2a93c0101b375696d91
Integration test to check env vars and mount of a device plugin resource are set
[ { "change_type": "MODIFY", "old_path": "tests/csi/setup.rs", "new_path": "tests/csi/setup.rs", "diff": "@@ -58,7 +58,8 @@ async fn driver_start(\nErr(e) if matches!(e.kind(), std::io::ErrorKind::NotFound) => (),\nErr(e) => return Err(e.into()),\n};\n- let socket = super::grpc_sock::server::Socket::new(SOCKET_PATH)\n+ // TODO handle SOCKET_PATH\n+ let socket = super::grpc_sock::server::Socket::new(&SOCKET_PATH.to_string())\n.expect(\"unable to setup server listening on socket\");\nlet (tx, rx) = tokio::sync::oneshot::channel::<Option<String>>();\n" }, { "change_type": "MODIFY", "old_path": "tests/device_plugin/mod.rs", "new_path": "tests/device_plugin/mod.rs", "diff": "@@ -5,14 +5,14 @@ pub(crate) mod v1beta1 {\n#[path = \"../grpc_sock/mod.rs\"]\npub mod grpc_sock;\nuse futures::Stream;\n-use std::path::{Path, PathBuf};\n+use std::path::Path;\nuse std::pin::Pin;\nuse tokio::sync::{mpsc, watch};\nuse tonic::{Request, Response, Status};\nuse v1beta1::{\ndevice_plugin_server::{DevicePlugin, DevicePluginServer},\nregistration_client, AllocateRequest, AllocateResponse, ContainerAllocateResponse, Device,\n- DevicePluginOptions, Empty, ListAndWatchResponse, PreStartContainerRequest,\n+ DevicePluginOptions, Empty, ListAndWatchResponse, Mount, PreStartContainerRequest,\nPreStartContainerResponse, PreferredAllocationRequest, PreferredAllocationResponse,\nRegisterRequest, API_VERSION,\n};\n@@ -74,10 +74,20 @@ impl DevicePlugin for MockDevicePlugin {\nrequest: Request<AllocateRequest>,\n) -> Result<Response<AllocateResponse>, Status> {\nlet allocate_request = request.into_inner();\n+ let path = \"/brb/general.txt\";\n+ let mut envs = std::collections::HashMap::new();\n+ envs.insert(\"DEVICE_PLUGIN_VAR\".to_string(), \"foo\".to_string());\n+ let mounts = vec![Mount {\n+ container_path: path.to_string(),\n+ host_path: path.to_string(),\n+ read_only: false,\n+ }];\nlet container_responses: Vec<ContainerAllocateResponse> = allocate_request\n.container_requests\n.into_iter()\n.map(|_| ContainerAllocateResponse {\n+ envs: envs.clone(),\n+ mounts: mounts.clone(),\n..Default::default()\n})\n.collect();\n@@ -97,37 +107,24 @@ impl DevicePlugin for MockDevicePlugin {\n/// Serves the mock DP and returns its socket path\nasync fn run_mock_device_plugin(\ndevices_receiver: watch::Receiver<Vec<Device>>,\n-) -> anyhow::Result<String> {\n- // Device plugin temp socket deleted when it goes out of scope so create it in thread and\n- // return with a channel\n- let (tx, rx) = tokio::sync::oneshot::channel();\n- tokio::task::spawn(async move {\n- let device_plugin_temp_dir = tempfile::tempdir().expect(\"should be able to create tempdir\");\n- let socket_name = \"gpu-device-plugin.sock\";\n- let dp_socket = device_plugin_temp_dir\n- .path()\n- .join(socket_name)\n- .to_str()\n- .unwrap()\n- .to_string();\n- tx.send(dp_socket.clone()).unwrap();\n+ plugin_socket: std::path::PathBuf,\n+) -> anyhow::Result<()> {\nlet device_plugin = MockDevicePlugin { devices_receiver };\n- let socket = grpc_sock::server::Socket::new(&dp_socket).expect(\"couldn't make dp socket\");\n+ let socket = grpc_sock::server::Socket::new(&plugin_socket)?;\nlet serv = tonic::transport::Server::builder()\n.add_service(DevicePluginServer::new(device_plugin))\n.serve_with_incoming(socket);\n#[cfg(target_family = \"windows\")]\nlet serv = serv.compat();\n- serv.await.expect(\"Unable to serve mock device plugin\");\n- });\n- Ok(rx.await.unwrap())\n+ serv.await?;\n+ Ok(())\n}\n/// Registers the mock DP with the DeviceManager's registration service\nasync fn register_mock_device_plugin(\nkubelet_socket: impl AsRef<Path>,\n- dp_socket: &str,\n- dp_resource_name: &str,\n+ plugin_socket: &str,\n+ resource_name: &str,\n) -> anyhow::Result<()> {\nlet op = DevicePluginOptions {\nget_preferred_allocation_available: false,\n@@ -137,13 +134,64 @@ async fn register_mock_device_plugin(\nlet mut registration_client = registration_client::RegistrationClient::new(channel);\nlet register_request = tonic::Request::new(RegisterRequest {\nversion: API_VERSION.into(),\n- endpoint: dp_socket.to_string(),\n- resource_name: dp_resource_name.to_string(),\n+ endpoint: plugin_socket.to_string(),\n+ resource_name: resource_name.to_string(),\noptions: Some(op),\n});\n- registration_client\n- .register(register_request)\n+ registration_client.register(register_request).await?;\n+ Ok(())\n+}\n+\n+fn get_mock_devices() -> Vec<Device> {\n+ // Make 3 mock devices\n+ let d1 = Device {\n+ id: \"d1\".to_string(),\n+ health: \"Healthy\".to_string(),\n+ topology: None,\n+ };\n+ let d2 = Device {\n+ id: \"d2\".to_string(),\n+ health: \"Healthy\".to_string(),\n+ topology: None,\n+ };\n+\n+ vec![d1, d2]\n+}\n+\n+pub async fn launch_device_plugin(resource_name: &str) -> anyhow::Result<()> {\n+ // Create socket for device plugin in the default $HOME/.krustlet/device_plugins directory\n+ let krustlet_dir = dirs::home_dir()\n+ .ok_or_else(|| anyhow::anyhow!(\"Unable to get home directory\"))?\n+ .join(\".krustlet\");\n+ let kubelet_socket = krustlet_dir.join(\"device_plugins\").join(\"kubelet.sock\");\n+ let dp_socket = krustlet_dir.join(\"device_plugins\").join(resource_name);\n+ let dp_socket_clone = dp_socket.clone();\n+ let (_devices_sender, devices_receiver) = watch::channel(get_mock_devices());\n+ tokio::spawn(async move {\n+ run_mock_device_plugin(devices_receiver, dp_socket)\n.await\n.unwrap();\n+ });\n+ // Wait for device plugin to be served\n+ let time = std::time::Instant::now();\n+ loop {\n+ if time.elapsed().as_secs() > 1 {\n+ return Err(anyhow::anyhow!(\"Could not connect to device plugin\"));\n+ }\n+ if grpc_sock::client::socket_channel(dp_socket_clone.clone())\n+ .await\n+ .is_ok()\n+ {\n+ break;\n+ }\n+ tokio::time::sleep(std::time::Duration::from_millis(200)).await;\n+ }\n+\n+ register_mock_device_plugin(\n+ kubelet_socket,\n+ dp_socket_clone.to_str().unwrap(),\n+ resource_name,\n+ )\n+ .await?;\nOk(())\n}\n" }, { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "-use k8s_openapi::api::core::v1::{Node, Pod, Taint};\n+use k8s_openapi::api::core::v1::{Node, Pod, ResourceRequirements, Taint};\n#[cfg(target_os = \"linux\")]\nuse kube::api::DeleteParams;\nuse kube::api::{Api, PostParams};\n@@ -7,7 +7,7 @@ use serde_json::json;\nmod assert;\n#[cfg(target_os = \"linux\")]\nmod csi;\n-#[cfg(target_os = \"linux\")]\n+// #[cfg(target_os = \"linux\")]\nmod device_plugin;\nmod expectations;\nmod pod_builder;\n@@ -93,6 +93,7 @@ const PRIVATE_REGISTRY_POD: &str = \"private-registry-pod\";\nconst PROJECTED_VOLUME_POD: &str = \"projected-volume-pod\";\n#[cfg(target_os = \"linux\")]\nconst PVC_MOUNT_POD: &str = \"pvc-mount-pod\";\n+const DEVICE_PLUGIN_RESOURCE_POD: &str = \"device-plugin-resource-pod\";\n#[cfg(target_os = \"linux\")]\nconst HOSTPATH_PROVISIONER: &str = \"mock.csi.krustlet.dev\";\n@@ -340,6 +341,7 @@ async fn create_multi_mount_pod(\nvec![],\ncontainers,\nvolumes,\n+ None,\nOnFailure::Panic,\nresource_manager,\n)\n@@ -396,6 +398,7 @@ async fn create_multi_items_mount_pod(\nvec![],\ncontainers,\nvolumes,\n+ None,\nOnFailure::Panic,\nresource_manager,\n)\n@@ -421,6 +424,7 @@ async fn create_loggy_pod(\nvec![],\ncontainers,\nvec![],\n+ None,\nOnFailure::Panic,\nresource_manager,\n)\n@@ -444,6 +448,7 @@ async fn create_faily_pod(\nvec![],\ncontainers,\nvec![],\n+ None,\nOnFailure::Accept,\nresource_manager,\n)\n@@ -458,10 +463,18 @@ async fn wasmercise_wasi<'a>(\ninits: Vec<WasmerciserContainerSpec<'a>>,\ncontainers: Vec<WasmerciserContainerSpec<'a>>,\ntest_volumes: Vec<WasmerciserVolumeSpec<'a>>,\n+ test_resources: Option<ResourceRequirements>,\non_failure: OnFailure,\nresource_manager: &mut TestResourceManager,\n) -> anyhow::Result<()> {\n- let p = wasmerciser_pod(pod_name, inits, containers, test_volumes, \"wasm32-wasi\")?;\n+ let p = wasmerciser_pod(\n+ pod_name,\n+ inits,\n+ containers,\n+ test_volumes,\n+ None,\n+ \"wasm32-wasi\",\n+ )?;\nlet pod = pods.create(&PostParams::default(), &p.pod).await?;\nresource_manager.push(TestResource::Pod(pod_name.to_owned()));\n@@ -506,6 +519,7 @@ async fn create_pod_with_init_containers(\ninits,\ncontainers,\nvolumes,\n+ None,\nOnFailure::Panic,\nresource_manager,\n)\n@@ -536,6 +550,7 @@ async fn create_pod_with_failing_init_container(\ninits,\ncontainers,\nvec![],\n+ None,\nOnFailure::Accept,\nresource_manager,\n)\n@@ -565,6 +580,7 @@ async fn create_private_registry_pod(\nvec![],\ncontainers,\nvec![],\n+ None,\nOnFailure::Panic,\nresource_manager,\n)\n@@ -950,6 +966,7 @@ async fn create_pvc_mount_pod(\nvec![],\ncontainers,\nvolumes,\n+ None,\nOnFailure::Panic,\nresource_manager,\n)\n@@ -1014,3 +1031,65 @@ async fn test_pod_mounts_with_pvc() -> anyhow::Result<()> {\nOk(())\n}\n+\n+const RESOURCE_NAME: &str = \"example.com/gpu\";\n+\n+async fn create_device_plugin_resource_pod(\n+ client: kube::Client,\n+ pods: &Api<Pod>,\n+ resource_manager: &mut TestResourceManager,\n+) -> anyhow::Result<()> {\n+ use k8s_openapi::apimachinery::pkg::api::resource::Quantity;\n+ let containers = vec![\n+ WasmerciserContainerSpec::named(\"device-plugin-test\").with_args(&[\n+ \"write(lit:watermelon)to(file:/brb/general.txt)\",\n+ \"read(file:/brb/general.txt)to(var:myfile)\",\n+ \"write(var:myfile)to(stm:stdout)\",\n+ \"assert_exists(env:DEVICE_PLUGIN_VAR)\",\n+ ]),\n+ ];\n+ let mut requests = std::collections::BTreeMap::new();\n+ requests.insert(RESOURCE_NAME.to_string(), Quantity(\"1\".to_string()));\n+ let resources = ResourceRequirements {\n+ limits: None,\n+ requests: Some(requests),\n+ };\n+\n+ wasmercise_wasi(\n+ DEVICE_PLUGIN_RESOURCE_POD,\n+ client,\n+ pods,\n+ vec![],\n+ containers,\n+ vec![],\n+ Some(resources),\n+ OnFailure::Panic,\n+ resource_manager,\n+ )\n+ .await\n+}\n+\n+#[tokio::test(flavor = \"multi_thread\")]\n+async fn test_pod_with_device_plugin_resource() -> anyhow::Result<()> {\n+ let test_ns = \"wasi-e2e-pod-with-device-plugin-resource\";\n+ let (client, pods, mut resource_manager) = set_up_test(test_ns).await?;\n+\n+ device_plugin::launch_device_plugin(RESOURCE_NAME).await?;\n+\n+ // Create a Pod that requests the DP's resource\n+ create_device_plugin_resource_pod(client.clone(), &pods, &mut resource_manager).await?;\n+\n+ assert::pod_exited_successfully(&pods, DEVICE_PLUGIN_RESOURCE_POD).await?;\n+\n+ // This is just a sanity check that the device plugin requested volume get attached\n+ // properly as all it is doing is just writing to a local directory\n+ assert::pod_container_log_contains(\n+ &pods,\n+ DEVICE_PLUGIN_RESOURCE_POD,\n+ \"device-plugin-test\",\n+ r#\"watermelon\"#,\n+ )\n+ .await?;\n+\n+ Ok(())\n+}\n" }, { "change_type": "MODIFY", "old_path": "tests/pod_builder.rs", "new_path": "tests/pod_builder.rs", "diff": "-use k8s_openapi::api::core::v1::{Container, LocalObjectReference, Pod, Volume, VolumeMount};\n+use k8s_openapi::api::core::v1::{\n+ Container, LocalObjectReference, Pod, ResourceRequirements, Volume, VolumeMount,\n+};\nuse serde_json::json;\nuse std::sync::Arc;\n@@ -52,12 +54,18 @@ pub enum WasmerciserVolumeSource<'a> {\nPvc(&'a str),\n}\n+// pub type Quantity = String;\n+// pub struct WasmerciserResources {\n+// requests: std::collections::BTreeMap<String, Quantity>,\n+// }\n+\nconst DEFAULT_TEST_REGISTRY: &str = \"webassembly\";\nconst PRIVATE_TEST_REGISTRY: &str = \"krustletintegrationtestprivate\";\nfn wasmerciser_container(\nspec: &WasmerciserContainerSpec,\nvolumes: &[WasmerciserVolumeSpec],\n+ resources: &Option<ResourceRequirements>,\n) -> anyhow::Result<Container> {\nlet volume_mounts: Vec<_> = volumes\n.iter()\n@@ -68,12 +76,21 @@ fn wasmerciser_container(\n} else {\nDEFAULT_TEST_REGISTRY\n};\n- let container: Container = serde_json::from_value(json!({\n+ let container: Container = match resources {\n+ Some(r) => serde_json::from_value(json!({\n\"name\": spec.name,\n\"image\": format!(\"{}.azurecr.io/wasmerciser:v0.3.0\", registry),\n\"args\": spec.args,\n\"volumeMounts\": volume_mounts,\n- }))?;\n+ \"resources\": r,\n+ }))?,\n+ None => serde_json::from_value(json!({\n+ \"name\": spec.name,\n+ \"image\": format!(\"{}.azurecr.io/wasmerciser:v0.3.0\", registry),\n+ \"args\": spec.args,\n+ \"volumeMounts\": volume_mounts,\n+ }))?,\n+ };\nOk(container)\n}\n@@ -172,15 +189,16 @@ pub fn wasmerciser_pod(\ninits: Vec<WasmerciserContainerSpec>,\ncontainers: Vec<WasmerciserContainerSpec>,\ntest_volumes: Vec<WasmerciserVolumeSpec>,\n+ test_resources: Option<ResourceRequirements>,\narchitecture: &str,\n) -> anyhow::Result<PodLifetimeOwner> {\nlet init_container_specs: Vec<_> = inits\n.iter()\n- .map(|spec| wasmerciser_container(spec, &test_volumes).unwrap())\n+ .map(|spec| wasmerciser_container(spec, &test_volumes, &test_resources).unwrap())\n.collect();\nlet app_container_specs: Vec<_> = containers\n.iter()\n- .map(|spec| wasmerciser_container(spec, &test_volumes).unwrap())\n+ .map(|spec| wasmerciser_container(spec, &test_volumes, &test_resources).unwrap())\n.collect();\nlet volume_maps: Vec<_> = test_volumes\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Integration test to check env vars and mount of a device plugin resource are set Signed-off-by: Kate Goldenring <[email protected]>
350,439
30.07.2021 16:27:19
0
67ff888c75d3f8cb56c28bf584ace989db75d418
DP socket connecting, remove file mounting, and fix list_and_watch
[ { "change_type": "MODIFY", "old_path": "tests/device_plugin/mod.rs", "new_path": "tests/device_plugin/mod.rs", "diff": "@@ -7,7 +7,7 @@ pub mod grpc_sock;\nuse futures::Stream;\nuse std::path::Path;\nuse std::pin::Pin;\n-use tokio::sync::{mpsc, watch};\n+use tokio::sync::mpsc;\nuse tonic::{Request, Response, Status};\nuse v1beta1::{\ndevice_plugin_server::{DevicePlugin, DevicePluginServer},\n@@ -17,12 +17,10 @@ use v1beta1::{\nRegisterRequest, API_VERSION,\n};\n-/// Mock Device Plugin for testing the DeviceManager Sends a new list of devices to the\n-/// DeviceManager whenever it's `devices_receiver` is notified of them on a channel.\n+/// Mock Device Plugin for testing the DeviceManager. Reports its list of devices.\nstruct MockDevicePlugin {\n- // Using watch so the receiver can be cloned and be moved into a spawned thread in\n- // ListAndWatch\n- devices_receiver: watch::Receiver<Vec<Device>>,\n+ // Devices that are advertised\n+ devices: Vec<Device>,\n}\n#[async_trait::async_trait]\n@@ -41,20 +39,16 @@ impl DevicePlugin for MockDevicePlugin {\n_request: Request<Empty>,\n) -> Result<Response<Self::ListAndWatchStream>, Status> {\nprintln!(\"list_and_watch entered\");\n- // Create a channel that list_and_watch can periodically send updates to kubelet on\nlet (kubelet_update_sender, kubelet_update_receiver) = mpsc::channel(3);\n- let mut devices_receiver = self.devices_receiver.clone();\n+ let devices = self.devices.clone();\ntokio::spawn(async move {\n- while devices_receiver.changed().await.is_ok() {\n- let devices = devices_receiver.borrow().clone();\n- println!(\n- \"list_and_watch received new devices [{:?}] to send\",\n- devices\n- );\nkubelet_update_sender\n.send(Ok(ListAndWatchResponse { devices }))\n.await\n.unwrap();\n+ loop {\n+ // List and watch should not end\n+ tokio::time::sleep(std::time::Duration::from_secs(5)).await;\n}\n});\nOk(Response::new(Box::pin(\n@@ -106,11 +100,10 @@ impl DevicePlugin for MockDevicePlugin {\n/// Serves the mock DP and returns its socket path\nasync fn run_mock_device_plugin(\n- devices_receiver: watch::Receiver<Vec<Device>>,\n+ devices: Vec<Device>,\nplugin_socket: std::path::PathBuf,\n) -> anyhow::Result<()> {\n- println!(\"run_mock_device_plugin\");\n- let device_plugin = MockDevicePlugin { devices_receiver };\n+ let device_plugin = MockDevicePlugin { devices };\nlet socket = grpc_sock::server::Socket::new(&plugin_socket)?;\nlet serv = tonic::transport::Server::builder()\n.add_service(DevicePluginServer::new(device_plugin))\n@@ -144,7 +137,6 @@ async fn register_mock_device_plugin(\n}\nfn get_mock_devices() -> Vec<Device> {\n- // Make 3 mock devices\nlet d1 = Device {\nid: \"d1\".to_string(),\nhealth: \"Healthy\".to_string(),\n@@ -159,7 +151,10 @@ fn get_mock_devices() -> Vec<Device> {\nvec![d1, d2]\n}\n-pub async fn launch_device_plugin(resource_name: &str, resource_endpoint: &str) -> anyhow::Result<()> {\n+pub async fn launch_device_plugin(\n+ resource_name: &str,\n+ resource_endpoint: &str,\n+) -> anyhow::Result<()> {\nprintln!(\"launching DP test\");\n// Create socket for device plugin in the default $HOME/.krustlet/device_plugins directory\nlet krustlet_dir = dirs::home_dir()\n@@ -167,30 +162,28 @@ pub async fn launch_device_plugin(resource_name: &str, resource_endpoint: &str)\n.join(\".krustlet\");\nlet kubelet_socket = krustlet_dir.join(\"device_plugins\").join(\"kubelet.sock\");\nlet dp_socket = krustlet_dir.join(\"device_plugins\").join(resource_endpoint);\n- // tokio::fs::remove_file(&dp_socket);\n- tokio::fs::create_dir_all(&dp_socket).await.expect(\"cant create dir\");\n+ tokio::fs::remove_file(&dp_socket).await.ok();\nlet dp_socket_clone = dp_socket.clone();\n- let (_devices_sender, devices_receiver) = watch::channel(get_mock_devices());\ntokio::spawn(async move {\n- run_mock_device_plugin(devices_receiver, dp_socket)\n+ run_mock_device_plugin(get_mock_devices(), dp_socket)\n.await\n.unwrap();\n});\n+\n// Wait for device plugin to be served\n- tokio::time::sleep(std::time::Duration::from_secs(1)).await;\n- // let time = std::time::Instant::now();\n- // loop {\n- // if time.elapsed().as_secs() > 1 {\n- // return Err(anyhow::anyhow!(\"Could not connect to device plugin\"));\n- // }\n- // if grpc_sock::client::socket_channel(dp_socket_clone.clone())\n- // .await\n- // .is_ok()\n- // {\n- // break;\n- // }\n- // tokio::time::sleep(std::time::Duration::from_millis(200)).await;\n- // }\n+ let time = std::time::Instant::now();\n+ loop {\n+ if time.elapsed().as_secs() > 1 {\n+ return Err(anyhow::anyhow!(\"Could not connect to device plugin\"));\n+ }\n+ if grpc_sock::client::socket_channel(dp_socket_clone.clone())\n+ .await\n+ .is_ok()\n+ {\n+ break;\n+ }\n+ tokio::time::sleep(std::time::Duration::from_millis(200)).await;\n+ }\nregister_mock_device_plugin(\nkubelet_socket,\n" }, { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "@@ -1044,16 +1044,15 @@ async fn create_device_plugin_resource_pod(\nuse k8s_openapi::apimachinery::pkg::api::resource::Quantity;\nlet containers = vec![\nWasmerciserContainerSpec::named(\"device-plugin-test\").with_args(&[\n- \"write(lit:watermelon)to(file:/brb/general.txt)\",\n- \"read(file:/brb/general.txt)to(var:myfile)\",\n- \"write(var:myfile)to(stm:stdout)\",\n+ \"write(lit:watermelon)to(stm:stdout)\",\n\"assert_exists(env:DEVICE_PLUGIN_VAR)\",\n]),\n];\n+\nlet mut requests = std::collections::BTreeMap::new();\nrequests.insert(RESOURCE_NAME.to_string(), Quantity(\"1\".to_string()));\nlet resources = ResourceRequirements {\n- limits: None,\n+ limits: Some(requests.clone()),\nrequests: Some(requests),\n};\n@@ -1081,11 +1080,7 @@ async fn test_pod_with_device_plugin_resource() -> anyhow::Result<()> {\n// Create a Pod that requests the DP's resource\ncreate_device_plugin_resource_pod(client.clone(), &pods, &mut resource_manager).await?;\n-\nassert::pod_exited_successfully(&pods, DEVICE_PLUGIN_RESOURCE_POD).await?;\n-\n- // This is just a sanity check that the device plugin requested volume get attached\n- // properly as all it is doing is just writing to a local directory\nassert::pod_container_log_contains(\n&pods,\nDEVICE_PLUGIN_RESOURCE_POD,\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
DP socket connecting, remove file mounting, and fix list_and_watch Signed-off-by: Kate Goldenring <[email protected]>
350,439
30.07.2021 18:29:56
0
5cd2e56904af6ff37f5ab937933db134a4933c9a
nits to fix rebasing
[ { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "@@ -913,6 +913,7 @@ async fn create_projected_pod(\nvec![],\ncontainers,\nvolumes,\n+ None,\nOnFailure::Panic,\nresource_manager,\n)\n@@ -1052,8 +1053,8 @@ async fn create_device_plugin_resource_pod(\nlet mut requests = std::collections::BTreeMap::new();\nrequests.insert(RESOURCE_NAME.to_string(), Quantity(\"1\".to_string()));\nlet resources = ResourceRequirements {\n- limits: Some(requests.clone()),\n- requests: Some(requests),\n+ limits: requests.clone(),\n+ requests: requests,\n};\nwasmercise_wasi(\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
nits to fix rebasing Signed-off-by: Kate Goldenring <[email protected]>
350,439
30.07.2021 18:52:21
0
d71f900d5e7be9359eee0fd78138299623db5839
remove added logging
[ { "change_type": "MODIFY", "old_path": "tests/csi/setup.rs", "new_path": "tests/csi/setup.rs", "diff": "@@ -16,7 +16,6 @@ pub(crate) struct CsiRunner {\n}\npub(crate) async fn launch_csi_things(node_name: &str) -> anyhow::Result<CsiRunner> {\n- println!(\"CSI TESTS STARTED\");\nlet bin_root = std::path::PathBuf::from(env!(\"CARGO_MANIFEST_DIR\")).join(\"csi-test-binaries\");\nlet mut processes = Vec::with_capacity(3);\n@@ -59,7 +58,6 @@ async fn driver_start(\nErr(e) if matches!(e.kind(), std::io::ErrorKind::NotFound) => (),\nErr(e) => return Err(e.into()),\n};\n- // TODO handle SOCKET_PATH\nlet socket = super::grpc_sock::server::Socket::new(&SOCKET_PATH.to_string())\n.expect(\"unable to setup server listening on socket\");\n" }, { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "@@ -744,7 +744,6 @@ async fn test_can_mount_individual_values() -> anyhow::Result<()> {\n#[tokio::test]\nasync fn test_container_args() -> anyhow::Result<()> {\n- println!(\"TEST CONTAINER ARGS STARTED\");\nlet test_ns = \"wasi-e2e-container-args\";\nlet (client, pods, mut resource_manager) = set_up_test(test_ns).await?;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
remove added logging Signed-off-by: Kate Goldenring <[email protected]>
350,439
03.08.2021 18:13:00
0
c8af9be045d4a220e9e1abe7e0ae071ebb3a1463
remove log check
[ { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "@@ -1042,12 +1042,8 @@ async fn create_device_plugin_resource_pod(\nresource_manager: &mut TestResourceManager,\n) -> anyhow::Result<()> {\nuse k8s_openapi::apimachinery::pkg::api::resource::Quantity;\n- let containers = vec![\n- WasmerciserContainerSpec::named(\"device-plugin-test\").with_args(&[\n- \"write(lit:watermelon)to(stm:stdout)\",\n- \"assert_exists(env:DEVICE_PLUGIN_VAR)\",\n- ]),\n- ];\n+ let containers = vec![WasmerciserContainerSpec::named(\"device-plugin-test\")\n+ .with_args(&[\"assert_exists(env:DEVICE_PLUGIN_VAR)\"])];\nlet mut requests = std::collections::BTreeMap::new();\nrequests.insert(RESOURCE_NAME.to_string(), Quantity(\"1\".to_string()));\n@@ -1081,13 +1077,6 @@ async fn test_pod_with_device_plugin_resource() -> anyhow::Result<()> {\n// Create a Pod that requests the DP's resource\ncreate_device_plugin_resource_pod(client.clone(), &pods, &mut resource_manager).await?;\nassert::pod_exited_successfully(&pods, DEVICE_PLUGIN_RESOURCE_POD).await?;\n- assert::pod_container_log_contains(\n- &pods,\n- DEVICE_PLUGIN_RESOURCE_POD,\n- \"device-plugin-test\",\n- r#\"watermelon\"#,\n- )\n- .await?;\nOk(())\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
remove log check Signed-off-by: Kate Goldenring <[email protected]>
350,439
03.08.2021 18:18:52
0
1b19b11e96f65505e880937ec11e99589aab1494
remove debug print statement and sleep for max time
[ { "change_type": "MODIFY", "old_path": "build.rs", "new_path": "build.rs", "diff": "@@ -7,8 +7,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {\n.build_client(true)\n.build_server(true);\n- println!(\"cargo:warning=Build file ran\");\n-\n// Generate Device Plugin code\nbuilder.compile(\n&[\"crates/kubelet/proto/deviceplugin/v1beta1/deviceplugin.proto\"],\n" }, { "change_type": "MODIFY", "old_path": "tests/device_plugin/mod.rs", "new_path": "tests/device_plugin/mod.rs", "diff": "@@ -47,8 +47,8 @@ impl DevicePlugin for MockDevicePlugin {\n.await\n.unwrap();\nloop {\n- // List and watch should not end\n- tokio::time::sleep(std::time::Duration::from_secs(5)).await;\n+ // ListAndWatch should not end\n+ tokio::time::sleep(tokio::time::Duration::from_secs(std::u64::MAX)).await;\n}\n});\nOk(Response::new(Box::pin(\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
remove debug print statement and sleep for max time Signed-off-by: Kate Goldenring <[email protected]>
350,439
03.08.2021 18:32:19
0
de38aac7947c1d1e15bb6360760897520a6989aa
increase prost and tonic versions for rust security
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -1262,15 +1262,6 @@ dependencies = [\n\"either\",\n]\n-[[package]]\n-name = \"itertools\"\n-version = \"0.9.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b\"\n-dependencies = [\n- \"either\",\n-]\n-\n[[package]]\nname = \"itertools\"\nversion = \"0.10.1\"\n@@ -1332,11 +1323,11 @@ version = \"0.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5494bb53430a090bdcfa2677b0c5f19989a3c0cc43e2660f2e0f7d099218ade7\"\ndependencies = [\n- \"prost 0.8.0\",\n- \"prost-build 0.8.0\",\n- \"prost-types 0.8.0\",\n+ \"prost\",\n+ \"prost-build\",\n+ \"prost-types\",\n\"tonic\",\n- \"tonic-build 0.5.1\",\n+ \"tonic-build\",\n]\n[[package]]\n@@ -1415,7 +1406,7 @@ dependencies = [\n\"kube-runtime\",\n\"kubelet\",\n\"oci-distribution\",\n- \"prost 0.8.0\",\n+ \"prost\",\n\"regex\",\n\"reqwest\",\n\"serde\",\n@@ -1425,7 +1416,7 @@ dependencies = [\n\"tokio 1.9.0\",\n\"tokio-stream\",\n\"tonic\",\n- \"tonic-build 0.4.2\",\n+ \"tonic-build\",\n\"tower\",\n\"tracing-subscriber\",\n\"wasi-provider\",\n@@ -1539,8 +1530,8 @@ dependencies = [\n\"miow 0.2.2\",\n\"notify\",\n\"oci-distribution\",\n- \"prost 0.8.0\",\n- \"prost-types 0.8.0\",\n+ \"prost\",\n+ \"prost-types\",\n\"rcgen\",\n\"regex\",\n\"remove_dir_all 0.7.0\",\n@@ -1557,7 +1548,7 @@ dependencies = [\n\"tokio-compat-02\",\n\"tokio-stream\",\n\"tonic\",\n- \"tonic-build 0.5.1\",\n+ \"tonic-build\",\n\"tower\",\n\"tower-test\",\n\"tracing\",\n@@ -2174,16 +2165,6 @@ dependencies = [\n\"unicode-xid 0.2.2\",\n]\n-[[package]]\n-name = \"prost\"\n-version = \"0.7.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2\"\n-dependencies = [\n- \"bytes 1.0.1\",\n- \"prost-derive 0.7.0\",\n-]\n-\n[[package]]\nname = \"prost\"\nversion = \"0.8.0\"\n@@ -2191,25 +2172,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020\"\ndependencies = [\n\"bytes 1.0.1\",\n- \"prost-derive 0.8.0\",\n-]\n-\n-[[package]]\n-name = \"prost-build\"\n-version = \"0.7.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3\"\n-dependencies = [\n- \"bytes 1.0.1\",\n- \"heck\",\n- \"itertools 0.9.0\",\n- \"log 0.4.14\",\n- \"multimap\",\n- \"petgraph\",\n- \"prost 0.7.0\",\n- \"prost-types 0.7.0\",\n- \"tempfile\",\n- \"which\",\n+ \"prost-derive\",\n]\n[[package]]\n@@ -2224,25 +2187,12 @@ dependencies = [\n\"log 0.4.14\",\n\"multimap\",\n\"petgraph\",\n- \"prost 0.8.0\",\n- \"prost-types 0.8.0\",\n+ \"prost\",\n+ \"prost-types\",\n\"tempfile\",\n\"which\",\n]\n-[[package]]\n-name = \"prost-derive\"\n-version = \"0.7.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4\"\n-dependencies = [\n- \"anyhow\",\n- \"itertools 0.9.0\",\n- \"proc-macro2\",\n- \"quote 1.0.9\",\n- \"syn 1.0.74\",\n-]\n-\n[[package]]\nname = \"prost-derive\"\nversion = \"0.8.0\"\n@@ -2256,16 +2206,6 @@ dependencies = [\n\"syn 1.0.74\",\n]\n-[[package]]\n-name = \"prost-types\"\n-version = \"0.7.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb\"\n-dependencies = [\n- \"bytes 1.0.1\",\n- \"prost 0.7.0\",\n-]\n-\n[[package]]\nname = \"prost-types\"\nversion = \"0.8.0\"\n@@ -2273,7 +2213,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b\"\ndependencies = [\n\"bytes 1.0.1\",\n- \"prost 0.8.0\",\n+ \"prost\",\n]\n[[package]]\n@@ -3379,8 +3319,8 @@ dependencies = [\n\"hyper-timeout\",\n\"percent-encoding 2.1.0\",\n\"pin-project 1.0.8\",\n- \"prost 0.8.0\",\n- \"prost-derive 0.8.0\",\n+ \"prost\",\n+ \"prost-derive\",\n\"tokio 1.9.0\",\n\"tokio-rustls\",\n\"tokio-stream\",\n@@ -3392,18 +3332,6 @@ dependencies = [\n\"tracing-futures\",\n]\n-[[package]]\n-name = \"tonic-build\"\n-version = \"0.4.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c695de27302f4697191dda1c7178131a8cb805463dda02864acb80fe1322fdcf\"\n-dependencies = [\n- \"proc-macro2\",\n- \"prost-build 0.7.0\",\n- \"quote 1.0.9\",\n- \"syn 1.0.74\",\n-]\n-\n[[package]]\nname = \"tonic-build\"\nversion = \"0.5.1\"\n@@ -3411,7 +3339,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d12faebbe071b06f486be82cc9318350814fdd07fcb28f3690840cd770599283\"\ndependencies = [\n\"proc-macro2\",\n- \"prost-build 0.8.0\",\n+ \"prost-build\",\n\"quote 1.0.9\",\n\"syn 1.0.74\",\n]\n" }, { "change_type": "MODIFY", "old_path": "Cargo.toml", "new_path": "Cargo.toml", "diff": "@@ -74,7 +74,7 @@ tower = { version = \"0.4.2\", features = [\"util\"] }\nprost = \"0.8\"\n[build-dependencies]\n-tonic-build = \"0.4\"\n+tonic-build = \"0.5\"\n[workspace]\nmembers = [\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
increase prost and tonic versions for rust security Signed-off-by: Kate Goldenring <[email protected]>
350,439
04.08.2021 15:35:38
0
71f70df151988401bd6c4e6203a2b9ffaf4d1e4e
fix csi test compilation during windows build
[ { "change_type": "MODIFY", "old_path": "tests/csi/mod.rs", "new_path": "tests/csi/mod.rs", "diff": "-#[path = \"../grpc_sock/mod.rs\"]\n-pub mod grpc_sock;\npub mod setup;\n+#[cfg_attr(target_family = \"unix\", path = \"../grpc_sock/unix/mod.rs\")]\n+pub mod socket_server;\nuse std::collections::HashSet;\nuse std::sync::Arc;\n" }, { "change_type": "MODIFY", "old_path": "tests/csi/setup.rs", "new_path": "tests/csi/setup.rs", "diff": "@@ -58,7 +58,7 @@ async fn driver_start(\nErr(e) if matches!(e.kind(), std::io::ErrorKind::NotFound) => (),\nErr(e) => return Err(e.into()),\n};\n- let socket = super::grpc_sock::server::Socket::new(&SOCKET_PATH.to_string())\n+ let socket = super::socket_server::Socket::new(&SOCKET_PATH.to_string())\n.expect(\"unable to setup server listening on socket\");\nlet (tx, rx) = tokio::sync::oneshot::channel::<Option<String>>();\n" }, { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "@@ -7,7 +7,6 @@ use serde_json::json;\nmod assert;\n#[cfg(target_os = \"linux\")]\nmod csi;\n-// #[cfg(target_os = \"linux\")]\nmod device_plugin;\nmod expectations;\nmod pod_builder;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
fix csi test compilation during windows build Signed-off-by: Kate Goldenring <[email protected]>
350,439
01.09.2021 16:24:22
0
583d2854279b6c1996fed40da95f2269afccc535
make device plugin tests unix only
[ { "change_type": "MODIFY", "old_path": "tests/csi/mod.rs", "new_path": "tests/csi/mod.rs", "diff": "pub mod setup;\n-#[cfg_attr(target_family = \"unix\", path = \"../grpc_sock/unix/mod.rs\")]\n-pub mod socket_server;\n-\n+use crate::grpc_sock;\nuse std::collections::HashSet;\nuse std::sync::Arc;\n" }, { "change_type": "MODIFY", "old_path": "tests/csi/setup.rs", "new_path": "tests/csi/setup.rs", "diff": "@@ -58,7 +58,7 @@ async fn driver_start(\nErr(e) if matches!(e.kind(), std::io::ErrorKind::NotFound) => (),\nErr(e) => return Err(e.into()),\n};\n- let socket = super::socket_server::Socket::new(&SOCKET_PATH.to_string())\n+ let socket = super::grpc_sock::server::Socket::new(&SOCKET_PATH.to_string())\n.expect(\"unable to setup server listening on socket\");\nlet (tx, rx) = tokio::sync::oneshot::channel::<Option<String>>();\n" }, { "change_type": "MODIFY", "old_path": "tests/grpc_sock/client.rs", "new_path": "tests/grpc_sock/client.rs", "diff": "// This is heavily adapted from https://github.com/hyperium/tonic/blob/f1275b611e38ec5fe992b2f10552bf95e8448b17/examples/src/uds/client.rs\n-\n-#[cfg_attr(target_family = \"windows\", path = \"windows/mod.rs\")]\n-#[cfg(target_family = \"windows\")]\n-pub mod windows;\n-\nuse std::path::Path;\n-\n-#[cfg(target_family = \"windows\")]\n-use crate::mio_uds_windows::UnixStream;\n-#[cfg(target_family = \"unix\")]\nuse tokio::net::UnixStream;\nuse tonic::transport::{Channel, Endpoint, Uri};\nuse tower::service_fn;\n@@ -29,21 +20,5 @@ pub async fn socket_channel<P: AsRef<Path>>(path: P) -> Result<Channel, tonic::t\n}))\n.await;\n- #[cfg(target_family = \"windows\")]\n- let res = Endpoint::from_static(\"http://[::]:50051\")\n- .connect_with_connector(service_fn(move |_: Uri| {\n- // Need to copy the path here again so this can be FnMut\n- let path_copy = p.to_owned();\n- // Connect to a Uds socket\n- async move {\n- tokio::task::spawn_blocking(move || {\n- let stream = UnixStream::connect(path_copy)?;\n- windows::UnixStream::new(stream)\n- })\n- .await?\n- }\n- }))\n- .await;\n-\nres\n}\n" }, { "change_type": "MODIFY", "old_path": "tests/grpc_sock/mod.rs", "new_path": "tests/grpc_sock/mod.rs", "diff": "-//! Copied from kubelet crate\n-//! A client/server implementation using UNIX sockets for gRPC, meant for use with tonic. Socket\n-//! support is not built in to tonic and support for UNIX sockets on Windows requires its own crate\n-//! (as it isn't in standard due to backwards compatibility guarantees). This is our own package for\n-//! now, but if it is useful we could publish it as its own crate\n-\n-#[cfg_attr(target_family = \"unix\", path = \"unix/mod.rs\")]\n-#[cfg_attr(target_family = \"windows\", path = \"windows/mod.rs\")]\n-pub mod server;\n-\n+// Copied from the grpc_sock module in the Kubelet crate. The windows stuff is pretty hacky so it\n+// shouldn't be exported from there. Before we make this cross platform in the future, we'll need to\n+// make sure the server part works well on Windows\npub mod client;\n+pub mod server;\n" }, { "change_type": "RENAME", "old_path": "tests/grpc_sock/unix/mod.rs", "new_path": "tests/grpc_sock/server.rs", "diff": "-// This is a modified version of: https://github.com/hyperium/tonic/blob/f1275b611e38ec5fe992b2f10552bf95e8448b17/examples/src/uds/server.rs\n-\nuse std::{\n- path::Path,\n+ path::{Path, PathBuf},\npin::Pin,\ntask::{Context, Poll},\n};\n@@ -13,14 +11,37 @@ use tonic::transport::server::Connected;\n#[derive(Debug)]\npub struct UnixStream(tokio::net::UnixStream);\n+/// A `PathBuf` that will get deleted on drop\n+struct OwnedPathBuf {\n+ inner: PathBuf,\n+}\n+\n+impl Drop for OwnedPathBuf {\n+ fn drop(&mut self) {\n+ if let Err(e) = std::fs::remove_file(&self.inner) {\n+ eprintln!(\n+ \"cleanup of file {} failed, manual cleanup needed: {}\",\n+ self.inner.display(),\n+ e\n+ );\n+ }\n+ }\n+}\n+\npub struct Socket {\nlistener: tokio::net::UnixListener,\n+ _socket_path: OwnedPathBuf,\n}\nimpl Socket {\n- pub fn new<P: AsRef<Path>>(path: &P) -> anyhow::Result<Self> {\n+ pub fn new<P: AsRef<Path> + ?Sized>(path: &P) -> anyhow::Result<Self> {\nlet listener = tokio::net::UnixListener::bind(path)?;\n- Ok(Socket { listener })\n+ Ok(Socket {\n+ listener,\n+ _socket_path: OwnedPathBuf {\n+ inner: path.as_ref().to_owned(),\n+ },\n+ })\n}\n}\n" }, { "change_type": "DELETE", "old_path": "tests/grpc_sock/windows/mod.rs", "new_path": null, "diff": "-// This is a modified version of: https://github.com/hyperium/tonic/blob/f1275b611e38ec5fe992b2f10552bf95e8448b17/examples/src/uds/server.rs\n-\n-use std::{\n- path::Path,\n- pin::Pin,\n- task::{Context, Poll},\n-};\n-\n-use futures::{FutureExt, Stream};\n-use mio::Ready;\n-use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};\n-use tokio_compat_02::FutureExt as CompatFutureExt;\n-use tonic::transport::server::Connected;\n-\n-pub struct UnixStream {\n- inner: tokio_compat_02::IoCompat<tokio_02::io::PollEvented<crate::mio_uds_windows::UnixStream>>,\n-}\n-\n-impl UnixStream {\n- pub fn new(stream: crate::mio_uds_windows::UnixStream) -> Result<UnixStream, std::io::Error> {\n- let inner = match async {\n- Ok::<_, std::io::Error>(tokio_compat_02::IoCompat::new(\n- tokio_02::io::PollEvented::new(stream)?,\n- ))\n- }\n- .compat()\n- .now_or_never()\n- {\n- Some(res) => res?,\n- None => {\n- return Err(std::io::Error::new(\n- std::io::ErrorKind::Other,\n- \"Unable to start IO poll\",\n- ))\n- }\n- };\n- Ok(UnixStream { inner })\n- }\n-}\n-\n-pub struct Socket {\n- listener: tokio_02::io::PollEvented<crate::mio_uds_windows::UnixListener>,\n-}\n-\n-impl Socket {\n- #[allow(dead_code)]\n- pub fn new<P: AsRef<Path>>(path: &P) -> anyhow::Result<Self> {\n- let p = path.as_ref().to_owned();\n- let listener = crate::mio_uds_windows::UnixListener::bind(p)?;\n- let listener = match async { tokio_02::io::PollEvented::new(listener) }\n- .compat()\n- .now_or_never()\n- {\n- Some(res) => res?,\n- None => return Err(anyhow::anyhow!(\"Unable to poll IO\")),\n- };\n- Ok(Socket { listener })\n- }\n-}\n-\n-impl Stream for Socket {\n- type Item = Result<UnixStream, std::io::Error>;\n-\n- fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {\n- futures::ready!(self.listener.poll_read_ready(cx, Ready::readable()))?;\n-\n- let stream = match self.listener.get_ref().accept() {\n- Ok(None) => {\n- self.listener.clear_read_ready(cx, Ready::readable())?;\n- return Poll::Pending;\n- }\n- Ok(Some((stream, _))) => stream,\n- // Not much error handling we can do here, so just return Pending so\n- // it'll try again\n- Err(_) => {\n- self.listener.clear_read_ready(cx, Ready::readable())?;\n- return Poll::Pending;\n- }\n- };\n- Poll::Ready(Some(UnixStream::new(stream)))\n- }\n-}\n-\n-impl Connected for UnixStream {}\n-\n-impl AsyncRead for UnixStream {\n- fn poll_read(\n- mut self: Pin<&mut Self>,\n- cx: &mut Context<'_>,\n- buf: &mut ReadBuf<'_>,\n- ) -> Poll<std::io::Result<()>> {\n- Pin::new(&mut self.inner).poll_read(cx, buf)\n- }\n-}\n-\n-impl AsyncWrite for UnixStream {\n- fn poll_write(\n- mut self: Pin<&mut Self>,\n- cx: &mut Context<'_>,\n- buf: &[u8],\n- ) -> Poll<std::io::Result<usize>> {\n- Pin::new(&mut self.inner).poll_write(cx, buf)\n- }\n-\n- fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<std::io::Result<()>> {\n- Pin::new(&mut self.inner).poll_flush(cx)\n- }\n-\n- fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<std::io::Result<()>> {\n- Pin::new(&mut self.inner).poll_shutdown(cx)\n- }\n-}\n" }, { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "@@ -7,8 +7,11 @@ use serde_json::json;\nmod assert;\n#[cfg(target_os = \"linux\")]\nmod csi;\n+#[cfg(target_os = \"linux\")]\nmod device_plugin;\nmod expectations;\n+#[cfg(target_os = \"linux\")]\n+pub mod grpc_sock;\nmod pod_builder;\nmod pod_setup;\nmod test_resource_manager;\n@@ -92,6 +95,7 @@ const PRIVATE_REGISTRY_POD: &str = \"private-registry-pod\";\nconst PROJECTED_VOLUME_POD: &str = \"projected-volume-pod\";\n#[cfg(target_os = \"linux\")]\nconst PVC_MOUNT_POD: &str = \"pvc-mount-pod\";\n+#[cfg(target_os = \"linux\")]\nconst DEVICE_PLUGIN_RESOURCE_POD: &str = \"device-plugin-resource-pod\";\n#[cfg(target_os = \"linux\")]\nconst HOSTPATH_PROVISIONER: &str = \"mock.csi.krustlet.dev\";\n@@ -1032,9 +1036,12 @@ async fn test_pod_mounts_with_pvc() -> anyhow::Result<()> {\nOk(())\n}\n+#[cfg(target_os = \"linux\")]\nconst RESOURCE_NAME: &str = \"example.com/gpu\";\n+#[cfg(target_os = \"linux\")]\nconst RESOURCE_ENDPOINT: &str = \"gpu-device-plugin.sock\";\n+#[cfg(target_os = \"linux\")]\nasync fn create_device_plugin_resource_pod(\nclient: kube::Client,\npods: &Api<Pod>,\n@@ -1065,6 +1072,7 @@ async fn create_device_plugin_resource_pod(\n.await\n}\n+#[cfg(target_os = \"linux\")]\n#[tokio::test(flavor = \"multi_thread\")]\nasync fn test_pod_with_device_plugin_resource() -> anyhow::Result<()> {\nprintln!(\"Starting DP test\");\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
make device plugin tests unix only Signed-off-by: Kate Goldenring <[email protected]>
350,439
01.09.2021 20:18:01
0
39ed799ba73fc8ef6853ba04c438107f6e8d07f5
add linux only flags
[ { "change_type": "MODIFY", "old_path": "tests/csi/mod.rs", "new_path": "tests/csi/mod.rs", "diff": "pub mod setup;\n+#[cfg(target_os = \"linux\")]\nuse crate::grpc_sock;\nuse std::collections::HashSet;\nuse std::sync::Arc;\n" }, { "change_type": "MODIFY", "old_path": "tests/device_plugin/mod.rs", "new_path": "tests/device_plugin/mod.rs", "diff": "@@ -2,8 +2,8 @@ pub(crate) mod v1beta1 {\npub const API_VERSION: &str = \"v1beta1\";\ntonic::include_proto!(\"v1beta1\");\n}\n-#[path = \"../grpc_sock/mod.rs\"]\n-pub mod grpc_sock;\n+#[cfg(target_os = \"linux\")]\n+use crate::grpc_sock;\nuse futures::Stream;\nuse std::path::Path;\nuse std::pin::Pin;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
add linux only flags Signed-off-by: Kate Goldenring <[email protected]>
350,439
02.09.2021 23:51:11
0
4de3da431370d091b2cbb5eea9905763fbb75a0f
Add in volume mount test
[ { "change_type": "MODIFY", "old_path": "tests/device_plugin/mod.rs", "new_path": "tests/device_plugin/mod.rs", "diff": "@@ -3,6 +3,8 @@ pub(crate) mod v1beta1 {\ntonic::include_proto!(\"v1beta1\");\n}\n#[cfg(target_os = \"linux\")]\n+use super::CONTAINER_PATH;\n+#[cfg(target_os = \"linux\")]\nuse crate::grpc_sock;\nuse futures::Stream;\nuse std::path::Path;\n@@ -21,6 +23,8 @@ use v1beta1::{\nstruct MockDevicePlugin {\n// Devices that are advertised\ndevices: Vec<Device>,\n+ // Mount to set on all devices\n+ volume_mount: String,\n}\n#[async_trait::async_trait]\n@@ -68,12 +72,11 @@ impl DevicePlugin for MockDevicePlugin {\nrequest: Request<AllocateRequest>,\n) -> Result<Response<AllocateResponse>, Status> {\nlet allocate_request = request.into_inner();\n- let path = \"/brb/general.txt\";\nlet mut envs = std::collections::HashMap::new();\nenvs.insert(\"DEVICE_PLUGIN_VAR\".to_string(), \"foo\".to_string());\nlet mounts = vec![Mount {\n- container_path: path.to_string(),\n- host_path: path.to_string(),\n+ container_path: CONTAINER_PATH.to_string(),\n+ host_path: self.volume_mount.clone(),\nread_only: false,\n}];\nlet container_responses: Vec<ContainerAllocateResponse> = allocate_request\n@@ -102,8 +105,12 @@ impl DevicePlugin for MockDevicePlugin {\nasync fn run_mock_device_plugin(\ndevices: Vec<Device>,\nplugin_socket: std::path::PathBuf,\n+ volume_mount: std::path::PathBuf,\n) -> anyhow::Result<()> {\n- let device_plugin = MockDevicePlugin { devices };\n+ let device_plugin = MockDevicePlugin {\n+ devices,\n+ volume_mount: volume_mount.to_str().unwrap().to_owned(),\n+ };\nlet socket = grpc_sock::server::Socket::new(&plugin_socket)?;\nlet serv = tonic::transport::Server::builder()\n.add_service(DevicePluginServer::new(device_plugin))\n@@ -154,6 +161,7 @@ fn get_mock_devices() -> Vec<Device> {\npub async fn launch_device_plugin(\nresource_name: &str,\nresource_endpoint: &str,\n+ volume_mount: impl AsRef<Path>,\n) -> anyhow::Result<()> {\nprintln!(\"launching DP test\");\n// Create socket for device plugin in the default $HOME/.krustlet/device_plugins directory\n@@ -164,8 +172,9 @@ pub async fn launch_device_plugin(\nlet dp_socket = krustlet_dir.join(\"device_plugins\").join(resource_endpoint);\ntokio::fs::remove_file(&dp_socket).await.ok();\nlet dp_socket_clone = dp_socket.clone();\n+ let volume_mount_string = volume_mount.as_ref().to_owned();\ntokio::spawn(async move {\n- run_mock_device_plugin(get_mock_devices(), dp_socket)\n+ run_mock_device_plugin(get_mock_devices(), dp_socket, volume_mount_string)\n.await\n.unwrap();\n});\n" }, { "change_type": "MODIFY", "old_path": "tests/integration_tests.rs", "new_path": "tests/integration_tests.rs", "diff": "@@ -1040,6 +1040,8 @@ async fn test_pod_mounts_with_pvc() -> anyhow::Result<()> {\nconst RESOURCE_NAME: &str = \"example.com/gpu\";\n#[cfg(target_os = \"linux\")]\nconst RESOURCE_ENDPOINT: &str = \"gpu-device-plugin.sock\";\n+#[cfg(target_os = \"linux\")]\n+pub const CONTAINER_PATH: &str = \"/gpu/dir\";\n#[cfg(target_os = \"linux\")]\nasync fn create_device_plugin_resource_pod(\n@@ -1048,8 +1050,17 @@ async fn create_device_plugin_resource_pod(\nresource_manager: &mut TestResourceManager,\n) -> anyhow::Result<()> {\nuse k8s_openapi::apimachinery::pkg::api::resource::Quantity;\n- let containers = vec![WasmerciserContainerSpec::named(\"device-plugin-test\")\n- .with_args(&[\"assert_exists(env:DEVICE_PLUGIN_VAR)\"])];\n+ let container_mount = std::path::PathBuf::from(CONTAINER_PATH).join(\"foo.txt\");\n+ let args = [\n+ &format!(\n+ \"write(lit:watermelon)to(file:{})\",\n+ container_mount.display(),\n+ ),\n+ &format!(\"read(file:{})to(var:myfile)\", container_mount.display()),\n+ \"write(var:myfile)to(stm:stdout)\",\n+ \"assert_exists(env:DEVICE_PLUGIN_VAR)\",\n+ ];\n+ let containers = vec![WasmerciserContainerSpec::named(\"device-plugin-test\").with_args(&args)];\nlet mut requests = std::collections::BTreeMap::new();\nrequests.insert(RESOURCE_NAME.to_string(), Quantity(\"1\".to_string()));\n@@ -1078,8 +1089,8 @@ async fn test_pod_with_device_plugin_resource() -> anyhow::Result<()> {\nprintln!(\"Starting DP test\");\nlet test_ns = \"wasi-e2e-pod-with-device-plugin-resource\";\nlet (client, pods, mut resource_manager) = set_up_test(test_ns).await?;\n-\n- device_plugin::launch_device_plugin(RESOURCE_NAME, RESOURCE_ENDPOINT).await?;\n+ let temp = tempfile::tempdir()?;\n+ device_plugin::launch_device_plugin(RESOURCE_NAME, RESOURCE_ENDPOINT, &temp.path()).await?;\n// Create a Pod that requests the DP's resource\ncreate_device_plugin_resource_pod(client.clone(), &pods, &mut resource_manager).await?;\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Add in volume mount test Signed-off-by: Kate Goldenring <[email protected]>
350,437
20.09.2021 11:03:36
25,200
0f9744b1489b3f1dd41e89facbdc2382ba67a6ba
Update Wasmtime to v.030
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -4,9 +4,9 @@ version = 3\n[[package]]\nname = \"addr2line\"\n-version = \"0.15.2\"\n+version = \"0.16.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a\"\n+checksum = \"3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd\"\ndependencies = [\n\"gimli\",\n]\n@@ -26,6 +26,12 @@ dependencies = [\n\"memchr\",\n]\n+[[package]]\n+name = \"ambient-authority\"\n+version = \"0.0.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"ec8ad6edb4840b78c5c3d88de606b22252d552b55f3a4699fbb10fc070ec3049\"\n+\n[[package]]\nname = \"ansi_term\"\nversion = \"0.11.0\"\n@@ -112,9 +118,9 @@ checksum = \"cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a\"\n[[package]]\nname = \"backtrace\"\n-version = \"0.3.60\"\n+version = \"0.3.61\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b7815ea54e4d821e791162e078acbebfd6d8c8939cd559c9335dceb1c8ca7282\"\n+checksum = \"e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01\"\ndependencies = [\n\"addr2line\",\n\"cc\",\n@@ -157,9 +163,9 @@ checksum = \"4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5\"\n[[package]]\nname = \"bitflags\"\n-version = \"1.2.1\"\n+version = \"1.3.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693\"\n+checksum = \"bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a\"\n[[package]]\nname = \"block-buffer\"\n@@ -222,31 +228,32 @@ checksum = \"b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040\"\n[[package]]\nname = \"cap-fs-ext\"\n-version = \"0.13.10\"\n+version = \"0.19.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ff3a1e32332db9ad29d6da34693ce9a7ac26a9edf96abb5c1788d193410031ab\"\n+checksum = \"1bf5c3b436b94a1adac74032ff35d8aa5bae6ec2a7900e76432c9ae8dac4d673\"\ndependencies = [\n\"cap-primitives\",\n\"cap-std\",\n- \"rustc_version 0.3.3\",\n- \"unsafe-io\",\n+ \"io-lifetimes\",\n+ \"rustc_version\",\n\"winapi 0.3.9\",\n]\n[[package]]\nname = \"cap-primitives\"\n-version = \"0.13.10\"\n+version = \"0.19.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2d253b74de50b097594462618e7dd17b93b3e3bef19f32d2e512996f9095661f\"\n+checksum = \"b51bd736eec54ae6552d18b0c958885b01d88c84c5fe6985e28c2b57ff385e94\"\ndependencies = [\n+ \"ambient-authority\",\n\"errno\",\n- \"fs-set-times\",\n+ \"fs-set-times 0.12.0\",\n+ \"io-lifetimes\",\n\"ipnet\",\n- \"libc\",\n\"maybe-owned\",\n\"once_cell\",\n- \"posish\",\n- \"rustc_version 0.3.3\",\n+ \"rsix 0.23.4\",\n+ \"rustc_version\",\n\"unsafe-io\",\n\"winapi 0.3.9\",\n\"winapi-util\",\n@@ -255,34 +262,37 @@ dependencies = [\n[[package]]\nname = \"cap-rand\"\n-version = \"0.13.10\"\n+version = \"0.19.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"458e98ed00e4276d0ac60da888d80957a177dfa7efa8dbb3be59f1e2b0e02ae5\"\n+checksum = \"6e6e89d00b0cebeb6da7a459b81e6a49cf2092cc4afe03f28eb99b8f0e889344\"\ndependencies = [\n+ \"ambient-authority\",\n\"rand 0.8.4\",\n]\n[[package]]\nname = \"cap-std\"\n-version = \"0.13.10\"\n+version = \"0.19.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7019d48ea53c5f378e0fdab0fe5f627fc00e76d65e75dffd6fb1cbc0c9b382ee\"\n+checksum = \"037334fe2f30ec71bcc51af1e8cbb8a9f9ac6a6b8cbd657d58dfef2ad5b9f19a\"\ndependencies = [\n\"cap-primitives\",\n- \"posish\",\n- \"rustc_version 0.3.3\",\n+ \"io-lifetimes\",\n+ \"ipnet\",\n+ \"rsix 0.23.4\",\n+ \"rustc_version\",\n\"unsafe-io\",\n]\n[[package]]\nname = \"cap-time-ext\"\n-version = \"0.13.10\"\n+version = \"0.19.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"90585adeada7f804e6dcf71b8ff74217ad8742188fc870b9da5deab4722baa04\"\n+checksum = \"aea5319ada3a9517fc70eafe9cf3275f04da795c53770ebc5d91f4a33f4dd2b5\"\ndependencies = [\n\"cap-primitives\",\n\"once_cell\",\n- \"posish\",\n+ \"rsix 0.23.4\",\n\"winx\",\n]\n@@ -329,7 +339,7 @@ checksum = \"37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002\"\ndependencies = [\n\"ansi_term 0.11.0\",\n\"atty\",\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"strsim\",\n\"term_size\",\n\"textwrap\",\n@@ -395,18 +405,18 @@ dependencies = [\n[[package]]\nname = \"cranelift-bforest\"\n-version = \"0.75.0\"\n+version = \"0.77.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"df3f8dd4f920a422c96c53fb6a91cc7932b865fdb60066ae9df7c329342d303f\"\n+checksum = \"15013642ddda44eebcf61365b2052a23fd8b7314f90ba44aa059ec02643c5139\"\ndependencies = [\n\"cranelift-entity\",\n]\n[[package]]\nname = \"cranelift-codegen\"\n-version = \"0.75.0\"\n+version = \"0.77.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ebe85f9a8dbf3c9dfa47ecb89828a7dc17c0b62015b84b5505fd4beba61c542c\"\n+checksum = \"298f2a7ed5fdcb062d8e78b7496b0f4b95265d20245f2d0ca88f846dd192a3a3\"\ndependencies = [\n\"cranelift-bforest\",\n\"cranelift-codegen-meta\",\n@@ -415,16 +425,15 @@ dependencies = [\n\"gimli\",\n\"log 0.4.14\",\n\"regalloc\",\n- \"serde\",\n\"smallvec\",\n\"target-lexicon\",\n]\n[[package]]\nname = \"cranelift-codegen-meta\"\n-version = \"0.75.0\"\n+version = \"0.77.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"12bc4be68da214a56bf9beea4212eb3b9eac16ca9f0b47762f907c4cd4684073\"\n+checksum = \"5cf504261ac62dfaf4ffb3f41d88fd885e81aba947c1241275043885bc5f0bac\"\ndependencies = [\n\"cranelift-codegen-shared\",\n\"cranelift-entity\",\n@@ -432,27 +441,24 @@ dependencies = [\n[[package]]\nname = \"cranelift-codegen-shared\"\n-version = \"0.75.0\"\n+version = \"0.77.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a0c87b69923825cfbc3efde17d929a68cd5b50a4016b2bd0eb8c3933cc5bd8cd\"\n-dependencies = [\n- \"serde\",\n-]\n+checksum = \"1cd2a72db4301dbe7e5a4499035eedc1e82720009fb60603e20504d8691fa9cd\"\n[[package]]\nname = \"cranelift-entity\"\n-version = \"0.75.0\"\n+version = \"0.77.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fe683e7ec6e627facf44b2eab4b263507be4e7ef7ea06eb8cee5283d9b45370e\"\n+checksum = \"48868faa07cacf948dc4a1773648813c0e453ff9467e800ff10f6a78c021b546\"\ndependencies = [\n\"serde\",\n]\n[[package]]\nname = \"cranelift-frontend\"\n-version = \"0.75.0\"\n+version = \"0.77.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5da80025ca214f0118273f8b94c4790add3b776f0dc97afba6b711757497743b\"\n+checksum = \"351c9d13b4ecd1a536215ec2fd1c3ee9ee8bc31af172abf1e45ed0adb7a931df\"\ndependencies = [\n\"cranelift-codegen\",\n\"log 0.4.14\",\n@@ -462,29 +468,29 @@ dependencies = [\n[[package]]\nname = \"cranelift-native\"\n-version = \"0.75.0\"\n+version = \"0.77.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e1c0e8c56f9a63f352a64aaa9c9eef7c205008b03593af7b128a3fbc46eae7e9\"\n+checksum = \"6df8b556663d7611b137b24db7f6c8d9a8a27d7f29c7ea7835795152c94c1b75\"\ndependencies = [\n\"cranelift-codegen\",\n+ \"libc\",\n\"target-lexicon\",\n]\n[[package]]\nname = \"cranelift-wasm\"\n-version = \"0.75.0\"\n+version = \"0.77.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d10ddafc5f1230d2190eb55018fcdecfcce728c9c2b975f2690ef13691d18eb5\"\n+checksum = \"7a69816d90db694fa79aa39b89dda7208a4ac74b6f2b8f3c4da26ee1c8bdfc5e\"\ndependencies = [\n\"cranelift-codegen\",\n\"cranelift-entity\",\n\"cranelift-frontend\",\n\"itertools 0.10.1\",\n\"log 0.4.14\",\n- \"serde\",\n\"smallvec\",\n- \"thiserror\",\n\"wasmparser\",\n+ \"wasmtime-types\",\n]\n[[package]]\n@@ -753,12 +759,23 @@ dependencies = [\n[[package]]\nname = \"fs-set-times\"\n-version = \"0.3.1\"\n+version = \"0.11.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"28f1ca01f517bba5770c067dc6c466d290b962e08214c8f2598db98d66087e55\"\n+checksum = \"b05f9ac4aceff7d9f3cd1701217aa72f87a0bf7c6592886efe819727292a4c7f\"\ndependencies = [\n- \"posish\",\n- \"unsafe-io\",\n+ \"io-lifetimes\",\n+ \"rsix 0.22.4\",\n+ \"winapi 0.3.9\",\n+]\n+\n+[[package]]\n+name = \"fs-set-times\"\n+version = \"0.12.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"807e3ef0de04fbe498bebd560ae041e006d97bf9f726dc0b485a86316be0ebc8\"\n+dependencies = [\n+ \"io-lifetimes\",\n+ \"rsix 0.23.4\",\n\"winapi 0.3.9\",\n]\n@@ -777,7 +794,7 @@ version = \"0.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82\"\ndependencies = [\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"fuchsia-zircon-sys\",\n]\n@@ -930,9 +947,9 @@ dependencies = [\n[[package]]\nname = \"gimli\"\n-version = \"0.24.0\"\n+version = \"0.25.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189\"\n+checksum = \"f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7\"\ndependencies = [\n\"fallible-iterator\",\n\"indexmap\",\n@@ -971,7 +988,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855\"\ndependencies = [\n\"base64 0.13.0\",\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"bytes 1.0.1\",\n\"headers-core\",\n\"http 0.2.4\",\n@@ -1195,7 +1212,7 @@ version = \"0.9.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b031475cb1b103ee221afb806a23d35e0570bf7271d7588762ceba8127ed43b3\"\ndependencies = [\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"inotify-sys\",\n\"libc\",\n]\n@@ -1229,12 +1246,11 @@ dependencies = [\n[[package]]\nname = \"io-lifetimes\"\n-version = \"0.1.1\"\n+version = \"0.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"609c23089c52d7edcf39d6cfd2cf581dcea7e059f80f1d91130887dceac77c1f\"\n+checksum = \"47f5ce4afb9bf504b9f496a3307676bc232122f91a93c4da6d540aa99a0a0e0b\"\ndependencies = [\n- \"libc\",\n- \"rustc_version 0.4.0\",\n+ \"rustc_version\",\n\"winapi 0.3.9\",\n]\n@@ -1597,6 +1613,18 @@ version = \"0.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3\"\n+[[package]]\n+name = \"linux-raw-sys\"\n+version = \"0.0.23\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"5802c30e8a573a9af97d504e9e66a076e0b881112222a67a8e037a79658447d6\"\n+\n+[[package]]\n+name = \"linux-raw-sys\"\n+version = \"0.0.28\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"687387ff42ec7ea4f2149035a5675fedb675d26f98db90a1846ac63d3addb5f5\"\n+\n[[package]]\nname = \"lock_api\"\nversion = \"0.4.4\"\n@@ -1662,9 +1690,9 @@ checksum = \"4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4\"\n[[package]]\nname = \"memchr\"\n-version = \"2.4.0\"\n+version = \"2.4.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc\"\n+checksum = \"308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a\"\n[[package]]\nname = \"memoffset\"\n@@ -1830,7 +1858,7 @@ version = \"5.0.0-pre.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"51f18203a26893ca1d3526cf58084025d5639f91c44f8b70ab3b724f60e819a0\"\ndependencies = [\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"crossbeam-channel\",\n\"filetime\",\n\"fsevent-sys\",\n@@ -1881,9 +1909,9 @@ dependencies = [\n[[package]]\nname = \"object\"\n-version = \"0.25.3\"\n+version = \"0.26.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7\"\n+checksum = \"39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2\"\ndependencies = [\n\"crc32fast\",\n\"indexmap\",\n@@ -1927,7 +1955,7 @@ version = \"0.10.35\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885\"\ndependencies = [\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"cfg-if 1.0.0\",\n\"foreign-types\",\n\"libc\",\n@@ -2017,15 +2045,6 @@ version = \"2.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e\"\n-[[package]]\n-name = \"pest\"\n-version = \"2.1.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53\"\n-dependencies = [\n- \"ucd-trie\",\n-]\n-\n[[package]]\nname = \"petgraph\"\nversion = \"0.5.1\"\n@@ -2100,20 +2119,6 @@ version = \"0.3.19\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c\"\n-[[package]]\n-name = \"posish\"\n-version = \"0.6.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"89cfd94d463bd7f94d4dc43af1117881afdc654d389a1917b41fc0326e3b0806\"\n-dependencies = [\n- \"bitflags 1.2.1\",\n- \"cfg-if 1.0.0\",\n- \"errno\",\n- \"itoa\",\n- \"libc\",\n- \"unsafe-io\",\n-]\n-\n[[package]]\nname = \"ppv-lite86\"\nversion = \"0.2.10\"\n@@ -2379,7 +2384,7 @@ version = \"0.2.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee\"\ndependencies = [\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n]\n[[package]]\n@@ -2400,7 +2405,6 @@ checksum = \"571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5\"\ndependencies = [\n\"log 0.4.14\",\n\"rustc-hash\",\n- \"serde\",\n\"smallvec\",\n]\n@@ -2436,7 +2440,7 @@ version = \"2.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0\"\ndependencies = [\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"libc\",\n\"mach\",\n\"winapi 0.3.9\",\n@@ -2518,6 +2522,40 @@ dependencies = [\n\"winapi 0.3.9\",\n]\n+[[package]]\n+name = \"rsix\"\n+version = \"0.22.4\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"19dc84e006a7522c44207fcd9c1f504f7c9a503093070840105930a685e299a0\"\n+dependencies = [\n+ \"bitflags 1.3.2\",\n+ \"cc\",\n+ \"errno\",\n+ \"io-lifetimes\",\n+ \"itoa\",\n+ \"libc\",\n+ \"linux-raw-sys 0.0.23\",\n+ \"once_cell\",\n+ \"rustc_version\",\n+]\n+\n+[[package]]\n+name = \"rsix\"\n+version = \"0.23.4\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"f462ec1eef15fd630e35be4e1dbbce9c7858e096045946ec0d0e97099561c90d\"\n+dependencies = [\n+ \"bitflags 1.3.2\",\n+ \"cc\",\n+ \"errno\",\n+ \"io-lifetimes\",\n+ \"itoa\",\n+ \"libc\",\n+ \"linux-raw-sys 0.0.28\",\n+ \"once_cell\",\n+ \"rustc_version\",\n+]\n+\n[[package]]\nname = \"rstest\"\nversion = \"0.11.0\"\n@@ -2527,7 +2565,7 @@ dependencies = [\n\"cfg-if 1.0.0\",\n\"proc-macro2\",\n\"quote 1.0.9\",\n- \"rustc_version 0.4.0\",\n+ \"rustc_version\",\n\"syn 1.0.74\",\n]\n@@ -2543,22 +2581,13 @@ version = \"1.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2\"\n-[[package]]\n-name = \"rustc_version\"\n-version = \"0.3.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee\"\n-dependencies = [\n- \"semver 0.11.0\",\n-]\n-\n[[package]]\nname = \"rustc_version\"\nversion = \"0.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366\"\ndependencies = [\n- \"semver 1.0.3\",\n+ \"semver\",\n]\n[[package]]\n@@ -2656,26 +2685,6 @@ version = \"1.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd\"\n-[[package]]\n-name = \"scroll\"\n-version = \"0.10.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fda28d4b4830b807a8b43f7b0e6b5df875311b3e7621d84577188c175b6ec1ec\"\n-dependencies = [\n- \"scroll_derive\",\n-]\n-\n-[[package]]\n-name = \"scroll_derive\"\n-version = \"0.10.5\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"aaaae8f38bb311444cfb7f1979af0bc9240d95795f75f9ceddf6a59b79ceffa0\"\n-dependencies = [\n- \"proc-macro2\",\n- \"quote 1.0.9\",\n- \"syn 1.0.74\",\n-]\n-\n[[package]]\nname = \"sct\"\nversion = \"0.6.1\"\n@@ -2692,7 +2701,7 @@ version = \"2.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467\"\ndependencies = [\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"core-foundation\",\n\"core-foundation-sys\",\n\"libc\",\n@@ -2709,15 +2718,6 @@ dependencies = [\n\"libc\",\n]\n-[[package]]\n-name = \"semver\"\n-version = \"0.11.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6\"\n-dependencies = [\n- \"semver-parser 0.10.2\",\n-]\n-\n[[package]]\nname = \"semver\"\nversion = \"1.0.3\"\n@@ -2730,15 +2730,6 @@ version = \"0.7.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3\"\n-[[package]]\n-name = \"semver-parser\"\n-version = \"0.10.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7\"\n-dependencies = [\n- \"pest\",\n-]\n-\n[[package]]\nname = \"serde\"\nversion = \"1.0.126\"\n@@ -2978,17 +2969,17 @@ dependencies = [\n[[package]]\nname = \"system-interface\"\n-version = \"0.6.6\"\n+version = \"0.14.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ef194146527a71113b76650b19c509b6537aa20b91f6702f1933e7b96b347736\"\n+checksum = \"024bceeab03feb74fb78395d5628df5664a7b6b849155f5e5db05e7e7b962128\"\ndependencies = [\n\"atty\",\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"cap-fs-ext\",\n\"cap-std\",\n- \"posish\",\n- \"rustc_version 0.4.0\",\n- \"unsafe-io\",\n+ \"io-lifetimes\",\n+ \"rsix 0.23.4\",\n+ \"rustc_version\",\n\"winapi 0.3.9\",\n\"winx\",\n]\n@@ -3543,12 +3534,6 @@ version = \"1.13.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06\"\n-[[package]]\n-name = \"ucd-trie\"\n-version = \"0.1.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c\"\n-\n[[package]]\nname = \"unicase\"\nversion = \"1.4.2\"\n@@ -3611,12 +3596,12 @@ checksum = \"8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3\"\n[[package]]\nname = \"unsafe-io\"\n-version = \"0.6.12\"\n+version = \"0.9.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1598c579f79cdd11e677b3942b7bed5cb3369464cfd240f4c4a308ffaed6f5e4\"\n+checksum = \"11e8cceed59fe60bd092be347343917cbc14b9239536980f09fe34e22c8efbc7\"\ndependencies = [\n\"io-lifetimes\",\n- \"rustc_version 0.3.3\",\n+ \"rustc_version\",\n\"winapi 0.3.9\",\n]\n@@ -3684,7 +3669,7 @@ checksum = \"354371c00a614a78c2f44daec85e13b4bdeeddfe00766c02746cceef57562d7b\"\ndependencies = [\n\"itertools 0.7.11\",\n\"pulldown-cmark\",\n- \"semver-parser 0.7.0\",\n+ \"semver-parser\",\n\"syn 0.11.11\",\n\"toml 0.4.10\",\n\"url 1.7.2\",\n@@ -3767,38 +3752,39 @@ checksum = \"1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f\"\n[[package]]\nname = \"wasi-cap-std-sync\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"54ed414ed6ff3b95653ea07b237cf03c513015d94169aac159755e05a2eaa80f\"\n+checksum = \"f9d864043ca88090ab06a24318b6447c7558eb797390ff312f4cc8d36348622f\"\ndependencies = [\n\"anyhow\",\n\"async-trait\",\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"cap-fs-ext\",\n\"cap-rand\",\n\"cap-std\",\n\"cap-time-ext\",\n- \"fs-set-times\",\n+ \"fs-set-times 0.11.0\",\n+ \"io-lifetimes\",\n\"lazy_static\",\n- \"libc\",\n+ \"rsix 0.22.4\",\n\"system-interface\",\n\"tracing\",\n- \"unsafe-io\",\n\"wasi-common\",\n\"winapi 0.3.9\",\n]\n[[package]]\nname = \"wasi-common\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6c67b1e49ae6d9bcab37a6f13594aed98d8ab8f5c2117b3bed543d8019688733\"\n+checksum = \"f782e345db0464507cff47673c18b2765c020e8086e16a008a2bfffe0c78c819\"\ndependencies = [\n\"anyhow\",\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"cap-rand\",\n\"cap-std\",\n- \"libc\",\n+ \"io-lifetimes\",\n+ \"rsix 0.22.4\",\n\"thiserror\",\n\"tracing\",\n\"wiggle\",\n@@ -3808,8 +3794,7 @@ dependencies = [\n[[package]]\nname = \"wasi-experimental-http-wasmtime\"\nversion = \"0.5.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5b207e13b7c228fd4626ee0bc1eb1d6cfb81473207c3b9521930404d2ee35790\"\n+source = \"git+https://github.com/radu-matei/wasi-experimental-http?branch=wasmtime-v030#936cf4dd0d1855f1c0a960a2e050c266befb1c3b\"\ndependencies = [\n\"anyhow\",\n\"bytes 1.0.1\",\n@@ -3924,15 +3909,15 @@ checksum = \"d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f\"\n[[package]]\nname = \"wasmparser\"\n-version = \"0.78.2\"\n+version = \"0.80.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65\"\n+checksum = \"be92b6dcaa5af4b2a176b29be3bf1402fab9e69d313141185099c7d1684f2dca\"\n[[package]]\nname = \"wasmtime\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"56828b11cd743a0e9b4207d1c7a8c1a66cb32d14601df10422072802a6aee86c\"\n+checksum = \"899b1e5261e3d3420860dacfb952871ace9d7ba9f953b314f67aaf9f8e2a4d89\"\ndependencies = [\n\"anyhow\",\n\"backtrace\",\n@@ -3943,19 +3928,20 @@ dependencies = [\n\"lazy_static\",\n\"libc\",\n\"log 0.4.14\",\n+ \"object\",\n\"paste\",\n\"psm\",\n+ \"rayon\",\n\"region\",\n\"rustc-demangle\",\n\"serde\",\n- \"smallvec\",\n\"target-lexicon\",\n\"wasmparser\",\n\"wasmtime-cache\",\n+ \"wasmtime-cranelift\",\n\"wasmtime-environ\",\n\"wasmtime-fiber\",\n\"wasmtime-jit\",\n- \"wasmtime-profiling\",\n\"wasmtime-runtime\",\n\"wat\",\n\"winapi 0.3.9\",\n@@ -3963,9 +3949,9 @@ dependencies = [\n[[package]]\nname = \"wasmtime-cache\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"99aca6335ad194d795342137a92afaec9338a2bfcf4caa4c667b5ece16c2bfa9\"\n+checksum = \"e2493b81d7a9935f7af15e06beec806f256bc974a90a843685f3d61f2fc97058\"\ndependencies = [\n\"anyhow\",\n\"base64 0.13.0\",\n@@ -3984,26 +3970,16 @@ dependencies = [\n[[package]]\nname = \"wasmtime-cranelift\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"519fa80abe29dc46fc43177cbe391e38c8613c59229c8d1d90d7f226c3c7cede\"\n+checksum = \"99706bacdf5143f7f967d417f0437cce83a724cf4518cb1a3ff40e519d793021\"\ndependencies = [\n+ \"anyhow\",\n\"cranelift-codegen\",\n\"cranelift-entity\",\n\"cranelift-frontend\",\n+ \"cranelift-native\",\n\"cranelift-wasm\",\n- \"target-lexicon\",\n- \"wasmparser\",\n- \"wasmtime-environ\",\n-]\n-\n-[[package]]\n-name = \"wasmtime-debug\"\n-version = \"0.28.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6ddf6e9bca2f3bc1dd499db2a93d35c735176cff0de7daacdc18c3794f7082e0\"\n-dependencies = [\n- \"anyhow\",\n\"gimli\",\n\"more-asserts\",\n\"object\",\n@@ -4015,28 +3991,30 @@ dependencies = [\n[[package]]\nname = \"wasmtime-environ\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0a991635b1cf1d1336fbea7a5f2c0e1dafaa54cb21c632d8414885278fa5d1b1\"\n+checksum = \"ac42cb562a2f98163857605f02581d719a410c5abe93606128c59a10e84de85b\"\ndependencies = [\n+ \"anyhow\",\n\"cfg-if 1.0.0\",\n- \"cranelift-codegen\",\n\"cranelift-entity\",\n- \"cranelift-wasm\",\n\"gimli\",\n\"indexmap\",\n\"log 0.4.14\",\n\"more-asserts\",\n+ \"object\",\n\"serde\",\n+ \"target-lexicon\",\n\"thiserror\",\n\"wasmparser\",\n+ \"wasmtime-types\",\n]\n[[package]]\nname = \"wasmtime-fiber\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7ab6bb95303636d1eba6f7fd2b67c1cd583f73303c73b1a3259b46bb1c2eb299\"\n+checksum = \"8779dd78755a248512233df4f6eaa6ba075c41bea2085fec750ed2926897bf95\"\ndependencies = [\n\"cc\",\n\"libc\",\n@@ -4045,75 +4023,34 @@ dependencies = [\n[[package]]\nname = \"wasmtime-jit\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5f33a0ae79b7c8d050156b22e10fdc49dfb09cc482c251d12bf10e8a833498fb\"\n+checksum = \"24f46dd757225f29a419be415ea6fb8558df9b0194f07e3a6a9c99d0e14dd534\"\ndependencies = [\n\"addr2line\",\n\"anyhow\",\n+ \"bincode\",\n\"cfg-if 1.0.0\",\n- \"cranelift-codegen\",\n- \"cranelift-entity\",\n- \"cranelift-frontend\",\n- \"cranelift-native\",\n- \"cranelift-wasm\",\n\"gimli\",\n+ \"libc\",\n\"log 0.4.14\",\n\"more-asserts\",\n\"object\",\n- \"rayon\",\n\"region\",\n\"serde\",\n\"target-lexicon\",\n\"thiserror\",\n\"wasmparser\",\n- \"wasmtime-cranelift\",\n- \"wasmtime-debug\",\n\"wasmtime-environ\",\n- \"wasmtime-obj\",\n- \"wasmtime-profiling\",\n\"wasmtime-runtime\",\n\"winapi 0.3.9\",\n]\n-[[package]]\n-name = \"wasmtime-obj\"\n-version = \"0.28.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4a879f03d416615f322dcb3aa5cb4cbc47b64b12be6aa235a64ab63a4281d50a\"\n-dependencies = [\n- \"anyhow\",\n- \"more-asserts\",\n- \"object\",\n- \"target-lexicon\",\n- \"wasmtime-debug\",\n- \"wasmtime-environ\",\n-]\n-\n-[[package]]\n-name = \"wasmtime-profiling\"\n-version = \"0.28.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"171ae3107e8502667b16d336a1dd03e370aa6630a1ce26559aba572ade1031d1\"\n-dependencies = [\n- \"anyhow\",\n- \"cfg-if 1.0.0\",\n- \"gimli\",\n- \"lazy_static\",\n- \"libc\",\n- \"object\",\n- \"scroll\",\n- \"serde\",\n- \"target-lexicon\",\n- \"wasmtime-environ\",\n- \"wasmtime-runtime\",\n-]\n-\n[[package]]\nname = \"wasmtime-runtime\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0404e10f8b07f940be42aa4b8785b4ab42e96d7167ccc92e35d36eee040309c2\"\n+checksum = \"0122215a44923f395487048cb0a1d60b5b32c73aab15cf9364b798dbaff0996f\"\ndependencies = [\n\"anyhow\",\n\"backtrace\",\n@@ -4134,11 +4071,23 @@ dependencies = [\n\"winapi 0.3.9\",\n]\n+[[package]]\n+name = \"wasmtime-types\"\n+version = \"0.30.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"f9b01caf8a204ef634ebac99700e77ba716d3ebbb68a1abbc2ceb6b16dbec9e4\"\n+dependencies = [\n+ \"cranelift-entity\",\n+ \"serde\",\n+ \"thiserror\",\n+ \"wasmparser\",\n+]\n+\n[[package]]\nname = \"wasmtime-wasi\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"39d75f21122ec134c8bfc8840a8742c0d406a65560fb9716b23800bd7cfd6ae5\"\n+checksum = \"12b0e75c044aa4afba7f274a625a43260390fbdd8ca79e4aeed6827f7760fba2\"\ndependencies = [\n\"anyhow\",\n\"wasi-cap-std-sync\",\n@@ -4215,13 +4164,13 @@ dependencies = [\n[[package]]\nname = \"wiggle\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"79ca01f1388a549eb3eaa221a072c3cfd3e383618ec6b423e82f2734ee28dd40\"\n+checksum = \"cbd408c06047cf3aa2d0408a34817da7863bcfc1e7d16c154ef92864b5fa456a\"\ndependencies = [\n\"anyhow\",\n\"async-trait\",\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n\"thiserror\",\n\"tracing\",\n\"wasmtime\",\n@@ -4230,9 +4179,9 @@ dependencies = [\n[[package]]\nname = \"wiggle-generate\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"544fd41029c33b179656ab1674cd813db7cd473f38f1976ae6e08effb46dd269\"\n+checksum = \"02575a1580353bd15a0bce308887ff6c9dae13fb3c60d49caf2e6dabf944b14d\"\ndependencies = [\n\"anyhow\",\n\"heck\",\n@@ -4245,9 +4194,9 @@ dependencies = [\n[[package]]\nname = \"wiggle-macro\"\n-version = \"0.28.0\"\n+version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9e31ae77a274c9800e6f1342fa4a6dde5e2d72eb9d9b2e0418781be6efc35b58\"\n+checksum = \"74b91f637729488f0318db544b24493788a3228fed1e1ccd24abbe4fc4f92663\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.9\",\n@@ -4310,11 +4259,12 @@ dependencies = [\n[[package]]\nname = \"winx\"\n-version = \"0.25.0\"\n+version = \"0.29.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2bdb79e12a5ac98f09e863b99c38c72f942a41f643ae0bb05d4d6d2633481341\"\n+checksum = \"4ecd175b4077107a91bb6bbb34aa9a691d8b45314791776f78b63a1cb8a08928\"\ndependencies = [\n- \"bitflags 1.2.1\",\n+ \"bitflags 1.3.2\",\n+ \"io-lifetimes\",\n\"winapi 0.3.9\",\n]\n@@ -4371,18 +4321,18 @@ dependencies = [\n[[package]]\nname = \"zstd\"\n-version = \"0.6.1+zstd.1.4.9\"\n+version = \"0.9.0+zstd.1.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5de55e77f798f205d8561b8fe2ef57abfb6e0ff2abe7fd3c089e119cdb5631a3\"\n+checksum = \"07749a5dc2cb6b36661290245e350f15ec3bbb304e493db54a1d354480522ccd\"\ndependencies = [\n\"zstd-safe\",\n]\n[[package]]\nname = \"zstd-safe\"\n-version = \"3.0.1+zstd.1.4.9\"\n+version = \"4.1.1+zstd.1.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1387cabcd938127b30ce78c4bf00b30387dddf704e3f0881dbc4ff62b5566f8c\"\n+checksum = \"c91c90f2c593b003603e5e0493c837088df4469da25aafff8bce42ba48caf079\"\ndependencies = [\n\"libc\",\n\"zstd-sys\",\n@@ -4390,9 +4340,9 @@ dependencies = [\n[[package]]\nname = \"zstd-sys\"\n-version = \"1.4.20+zstd.1.4.9\"\n+version = \"1.6.1+zstd.1.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ebd5b733d7cf2d9447e2c3e76a5589b4f5e5ae065c22a2bc0b023cbc331b6c8e\"\n+checksum = \"615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33\"\ndependencies = [\n\"cc\",\n\"libc\",\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/Cargo.toml", "new_path": "crates/wasi-provider/Cargo.toml", "diff": "@@ -24,7 +24,7 @@ rustls-tls = [\"kube/rustls-tls\", \"kubelet/rustls-tls\", \"krator/rustls-tls\"]\nanyhow = \"1.0\"\nasync-trait = \"0.1\"\nbacktrace = \"0.3\"\n-cap-std = \"0.13\"\n+cap-std = \"0.19\"\nchrono = {version = \"0.4\", features = [\"serde\"]}\nfutures = \"0.3\"\nkrator = {version = \"0.4\", default-features = false}\n@@ -36,12 +36,12 @@ serde_json = \"1.0\"\ntempfile = \"3.1\"\ntokio = {version = \"1.0\", features = [\"fs\", \"macros\", \"io-util\", \"sync\"]}\ntracing = {version = \"0.1\", features = ['log']}\n-wasi-cap-std-sync = \"0.28\"\n-wasi-common = \"0.28\"\n-wasmtime = \"0.28\"\n-wasmtime-wasi = \"0.28\"\n+wasi-cap-std-sync = \"0.30\"\n+wasi-common = \"0.30\"\n+wasmtime = \"0.30\"\n+wasmtime-wasi = \"0.30\"\nwat = \"1.0.38\"\n-wasi-experimental-http-wasmtime = \"0.5.0\"\n+wasi-experimental-http-wasmtime = { git = \"https://github.com/radu-matei/wasi-experimental-http\", branch = \"wasmtime-v030\" }\n[dev-dependencies]\nk8s-openapi = {version = \"0.12\", default-features = false, features = [\"v1_21\", \"api\"]}\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/wasi_runtime.rs", "new_path": "crates/wasi-provider/src/wasi_runtime.rs", "diff": "@@ -3,6 +3,7 @@ use std::path::{Path, PathBuf};\nuse std::sync::Arc;\nuse tracing::{debug, error, info, instrument, trace, warn};\n+use cap_std::ambient_authority;\nuse tempfile::NamedTempFile;\nuse tokio::sync::mpsc::Sender;\nuse tokio::task::JoinHandle;\n@@ -172,12 +173,14 @@ impl WasiRuntime {\n.iter()\n.map(|(k, v)| (k.to_string(), v.to_string()))\n.collect();\n- let stdout = wasi_cap_std_sync::file::File::from_cap_std(unsafe {\n- cap_std::fs::File::from_std(output_write.try_clone().await?.into_std().await)\n- });\n- let stderr = wasi_cap_std_sync::file::File::from_cap_std(unsafe {\n- cap_std::fs::File::from_std(output_write.try_clone().await?.into_std().await)\n- });\n+ let stdout = wasi_cap_std_sync::file::File::from_cap_std(cap_std::fs::File::from_std(\n+ output_write.try_clone().await?.into_std().await,\n+ ambient_authority(),\n+ ));\n+ let stderr = wasi_cap_std_sync::file::File::from_cap_std(cap_std::fs::File::from_std(\n+ output_write.try_clone().await?.into_std().await,\n+ ambient_authority(),\n+ ));\n// Create the WASI context builder and pass arguments, environment,\n// and standard output and error.\n@@ -195,7 +198,7 @@ impl WasiRuntime {\nguestpath = %guest_dir.display(),\n\"mounting hostpath in modules\"\n);\n- let preopen_dir = unsafe { cap_std::fs::Dir::open_ambient_dir(key) }?;\n+ let preopen_dir = cap_std::fs::Dir::open_ambient_dir(key, ambient_authority())?;\nbuilder = builder.preopened_dir(preopen_dir, guest_dir)?;\n}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Update Wasmtime to v.030 Signed-off-by: Radu M <[email protected]>
350,437
20.09.2021 11:55:54
25,200
1eaa8eaa2c1ddc22123b3462575c3d6cc4695075
Update wasi-experimental-http-wasmtime crate to latest published version
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3793,8 +3793,9 @@ dependencies = [\n[[package]]\nname = \"wasi-experimental-http-wasmtime\"\n-version = \"0.5.0\"\n-source = \"git+https://github.com/radu-matei/wasi-experimental-http?branch=wasmtime-v030#936cf4dd0d1855f1c0a960a2e050c266befb1c3b\"\n+version = \"0.6.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"5fda70dc1b97799c0772db2445202a21e21f7a2e5e0424784bb1beda6956abfc\"\ndependencies = [\n\"anyhow\",\n\"bytes 1.0.1\",\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/Cargo.toml", "new_path": "crates/wasi-provider/Cargo.toml", "diff": "@@ -41,7 +41,7 @@ wasi-common = \"0.30\"\nwasmtime = \"0.30\"\nwasmtime-wasi = \"0.30\"\nwat = \"1.0.38\"\n-wasi-experimental-http-wasmtime = { git = \"https://github.com/radu-matei/wasi-experimental-http\", branch = \"wasmtime-v030\" }\n+wasi-experimental-http-wasmtime = \"0.6.0\"\n[dev-dependencies]\nk8s-openapi = {version = \"0.12\", default-features = false, features = [\"v1_21\", \"api\"]}\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Update wasi-experimental-http-wasmtime crate to latest published version Signed-off-by: Radu M <[email protected]>
350,437
20.09.2021 12:02:35
25,200
cf7658f210f074092e0ef140a2ae095ea461ca96
Update crossbeam-dequeue to v0.8.1
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -514,9 +514,9 @@ dependencies = [\n[[package]]\nname = \"crossbeam-deque\"\n-version = \"0.8.0\"\n+version = \"0.8.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9\"\n+checksum = \"6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e\"\ndependencies = [\n\"cfg-if 1.0.0\",\n\"crossbeam-epoch\",\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Update crossbeam-dequeue to v0.8.1 Signed-off-by: Radu M <[email protected]>
350,413
30.09.2021 00:57:21
-7,200
10871b064857f7a8c540430298acb4a9c160543d
kubelet/container: use borrowed inner types
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/container/mod.rs", "new_path": "crates/kubelet/src/container/mod.rs", "diff": "@@ -138,23 +138,23 @@ impl Container {\n}\n/// Get arguments of container.\n- pub fn args(&self) -> &Option<Vec<String>> {\n- &self.0.args\n+ pub fn args(&self) -> Option<&Vec<String>> {\n+ self.0.args.as_ref()\n}\n/// Get command of container.\n- pub fn command(&self) -> &Option<Vec<String>> {\n- &self.0.command\n+ pub fn command(&self) -> Option<&Vec<String>> {\n+ self.0.command.as_ref()\n}\n/// Get environment of container.\n- pub fn env(&self) -> &Option<Vec<k8s_openapi::api::core::v1::EnvVar>> {\n- &self.0.env\n+ pub fn env(&self) -> Option<&Vec<k8s_openapi::api::core::v1::EnvVar>> {\n+ self.0.env.as_ref()\n}\n/// Get environment of container.\n- pub fn env_from(&self) -> &Option<Vec<k8s_openapi::api::core::v1::EnvFromSource>> {\n- &self.0.env_from\n+ pub fn env_from(&self) -> Option<&Vec<k8s_openapi::api::core::v1::EnvFromSource>> {\n+ self.0.env_from.as_ref()\n}\n/// Get image of container as `oci_distribution::Reference`.\n@@ -186,8 +186,8 @@ impl Container {\n}\n/// Get ports of container.\n- pub fn ports(&self) -> &Option<Vec<k8s_openapi::api::core::v1::ContainerPort>> {\n- &self.0.ports\n+ pub fn ports(&self) -> Option<&Vec<k8s_openapi::api::core::v1::ContainerPort>> {\n+ self.0.ports.as_ref()\n}\n/// Get readiness probe of container.\n@@ -236,13 +236,13 @@ impl Container {\n}\n/// Get volume devices of container.\n- pub fn volume_devices(&self) -> &Option<Vec<k8s_openapi::api::core::v1::VolumeDevice>> {\n- &self.0.volume_devices\n+ pub fn volume_devices(&self) -> Option<&Vec<k8s_openapi::api::core::v1::VolumeDevice>> {\n+ self.0.volume_devices.as_ref()\n}\n/// Get volume mounts of container.\n- pub fn volume_mounts(&self) -> &Option<Vec<k8s_openapi::api::core::v1::VolumeMount>> {\n- &self.0.volume_mounts\n+ pub fn volume_mounts(&self) -> Option<&Vec<k8s_openapi::api::core::v1::VolumeMount>> {\n+ self.0.volume_mounts.as_ref()\n}\n/// Get working directory of container.\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/src/provider/mod.rs", "new_path": "crates/kubelet/src/provider/mod.rs", "diff": "@@ -169,7 +169,7 @@ pub trait Provider: Sized + Send + Sync + 'static {\nclient: &kube::Client,\n) -> HashMap<String, String> {\nlet mut env = HashMap::new();\n- let vars = match container.env().as_ref() {\n+ let vars = match container.env() {\nSome(e) => e,\nNone => return env,\n};\n@@ -231,7 +231,7 @@ pub async fn env_vars(\nclient: &kube::Client,\n) -> HashMap<String, String> {\nlet mut env = HashMap::new();\n- let vars = match container.env().as_ref() {\n+ let vars = match container.env() {\nSome(e) => e,\nNone => return env,\n};\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/src/states/container/waiting.rs", "new_path": "crates/wasi-provider/src/states/container/waiting.rs", "diff": "@@ -158,7 +158,7 @@ impl State<ContainerState> for Waiting {\nlet mut env = kubelet::provider::env_vars(&container, &state.pod, &client).await;\nenv.extend(container_envs);\n- let args = container.args().clone().unwrap_or_default();\n+ let args: Vec<String> = container.args().map(|t| t.clone()).unwrap_or_default();\n// TODO: ~magic~ number\nlet (tx, rx) = mpsc::channel(8);\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
kubelet/container: use borrowed inner types Signed-off-by: Olivier Lemasle <[email protected]>
350,414
20.10.2021 09:10:05
25,200
1330e6311ede707bd05efe9239224d2d14fcaede
bump github actions dependencies
[ { "change_type": "MODIFY", "old_path": ".github/workflows/build.yml", "new_path": ".github/workflows/build.yml", "diff": "@@ -16,7 +16,7 @@ jobs:\nos: \"ubuntu-latest\",\narch: \"amd64\",\nargs: \"\",\n- url: \"https://github.com/casey/just/releases/download/v0.5.11/just-v0.5.11-x86_64-unknown-linux-musl.tar.gz\",\n+ url: \"https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-unknown-linux-musl.tar.gz\",\nname: \"just\",\npathInArchive: \"just\",\nenv: {},\n@@ -25,7 +25,7 @@ jobs:\nos: \"ubuntu-latest\",\narch: \"aarch64\",\nargs: \"--target aarch64-unknown-linux-gnu\",\n- url: \"https://github.com/casey/just/releases/download/v0.5.11/just-v0.5.11-x86_64-unknown-linux-musl.tar.gz\",\n+ url: \"https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-unknown-linux-musl.tar.gz\",\nname: \"just\",\npathInArchive: \"just\",\nenv: { OPENSSL_DIR: \"/usr/local/openssl-aarch64\" },\n@@ -34,7 +34,7 @@ jobs:\nos: \"macos-latest\",\narch: \"amd64\",\nargs: \"\",\n- url: \"https://github.com/casey/just/releases/download/v0.5.11/just-v0.5.11-x86_64-apple-darwin.tar.gz\",\n+ url: \"https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-apple-darwin.tar.gz\",\nname: \"just\",\npathInArchive: \"just\",\nenv: {},\n@@ -47,7 +47,7 @@ jobs:\ntoolchain: stable\ndefault: true\ncomponents: clippy, rustfmt\n- - uses: engineerd/[email protected]\n+ - uses: engineerd/[email protected]\nwith:\nname: ${{ matrix.config.name }}\nurl: ${{ matrix.config.url }}\n@@ -60,7 +60,7 @@ jobs:\ncd /tmp\ngit clone https://github.com/openssl/openssl\ncd openssl\n- git checkout OpenSSL_1_1_1h\n+ git checkout OpenSSL_1_1_1l\nsudo mkdir -p $OPENSSL_DIR\n./Configure linux-aarch64 --prefix=$OPENSSL_DIR --openssldir=$OPENSSL_DIR shared\nmake CC=aarch64-linux-gnu-gcc\n@@ -88,7 +88,7 @@ jobs:\n- uses: engineerd/[email protected]\nwith:\nname: just\n- url: \"https://github.com/casey/just/releases/download/v0.5.11/just-v0.5.11-x86_64-pc-windows-msvc.zip\"\n+ url: \"https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-pc-windows-msvc.zip\"\npathInArchive: just.exe\n- name: Build\nrun: |\n@@ -108,12 +108,12 @@ jobs:\ntoolchain: stable\ndefault: true\ncomponents: clippy, rustfmt\n- - uses: engineerd/[email protected]\n+ - uses: engineerd/[email protected]\nwith:\nname: just.exe\nurl: \"https://github.com/casey/just/releases/download/v0.9.4/just-v0.9.4-x86_64-pc-windows-msvc.zip\"\npathInArchive: just.exe\n- - uses: engineerd/[email protected]\n+ - uses: engineerd/[email protected]\nwith:\nname: kind.exe\nurl: \"https://kind.sigs.k8s.io/dl/v0.11.1/kind-windows-amd64\"\n@@ -161,10 +161,10 @@ jobs:\n- uses: engineerd/[email protected]\nwith:\nversion: \"v0.11.1\"\n- - uses: engineerd/[email protected]\n+ - uses: engineerd/[email protected]\nwith:\nname: just\n- url: https://github.com/casey/just/releases/download/v0.5.11/just-v0.5.11-x86_64-unknown-linux-musl.tar.gz\n+ url: https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-unknown-linux-musl.tar.gz\npathInArchive: just\n- name: Get NODE_IP\nrun: echo \"KRUSTLET_NODE_IP=$(ip addr ls eth0 | awk '/inet / {split($2, ary, /\\//); print ary[1]}')\" >> $GITHUB_ENV\n" }, { "change_type": "MODIFY", "old_path": ".github/workflows/release.yml", "new_path": ".github/workflows/release.yml", "diff": "@@ -78,7 +78,7 @@ jobs:\ncd /tmp\ngit clone https://github.com/openssl/openssl\ncd openssl\n- git checkout OpenSSL_1_1_1h\n+ git checkout OpenSSL_1_1_1l\nsudo mkdir -p $OPENSSL_DIR\n./Configure linux-aarch64 --prefix=$OPENSSL_DIR --openssldir=$OPENSSL_DIR shared\nmake CC=aarch64-linux-gnu-gcc\n" }, { "change_type": "MODIFY", "old_path": ".github/workflows/test_binaries.yaml", "new_path": ".github/workflows/test_binaries.yaml", "diff": "@@ -5,11 +5,11 @@ on:\nregistrar-version:\ndescription: \"Git tag you wish to build for the Node Driver Registrar\"\nrequired: true\n- default: \"v2.2.0\"\n+ default: \"v2.3.0\"\nprovisioner-version:\ndescription: \"Git tag you wish to build for the External Provisioner\"\nrequired: true\n- default: \"v2.2.1\"\n+ default: \"v2.2.2\"\njobs:\n# TODO: Once support is added for all distros (see\n# https://github.com/kubernetes-csi/node-driver-registrar/pull/133). We should\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
bump github actions dependencies Signed-off-by: Matthew Fisher <[email protected]>
350,414
18.11.2021 10:03:30
28,800
86f8742eefd7078d92ff6670f54445e1488c6197
cargo update/oci-distribution v0.8.0
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -8,7 +8,16 @@ version = \"0.16.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd\"\ndependencies = [\n- \"gimli\",\n+ \"gimli 0.25.0\",\n+]\n+\n+[[package]]\n+name = \"addr2line\"\n+version = \"0.17.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b\"\n+dependencies = [\n+ \"gimli 0.26.1\",\n]\n[[package]]\n@@ -52,9 +61,9 @@ dependencies = [\n[[package]]\nname = \"anyhow\"\n-version = \"1.0.44\"\n+version = \"1.0.45\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1\"\n+checksum = \"ee10e43ae4a853c0a3591d4e2ada1719e553be18199d9da9d4a83f5927c2f5c7\"\n[[package]]\nname = \"async-recursion\"\n@@ -64,7 +73,7 @@ checksum = \"d7d78656ba01f1b93024b7c3a0467f1608e4be67d725749fdcd7d2c7678fd7a2\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -85,7 +94,7 @@ checksum = \"648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -96,7 +105,7 @@ checksum = \"44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -118,11 +127,11 @@ checksum = \"cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a\"\n[[package]]\nname = \"backtrace\"\n-version = \"0.3.62\"\n+version = \"0.3.63\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"091bcdf2da9950f96aa522681ce805e6857f6ca8df73833d35736ab2dc78e152\"\n+checksum = \"321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6\"\ndependencies = [\n- \"addr2line\",\n+ \"addr2line 0.17.0\",\n\"cc\",\n\"cfg-if 1.0.0\",\n\"libc\",\n@@ -131,15 +140,6 @@ dependencies = [\n\"rustc-demangle\",\n]\n-[[package]]\n-name = \"base64\"\n-version = \"0.10.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e\"\n-dependencies = [\n- \"byteorder\",\n-]\n-\n[[package]]\nname = \"base64\"\nversion = \"0.13.0\"\n@@ -204,16 +204,6 @@ version = \"0.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27\"\n-[[package]]\n-name = \"bytes\"\n-version = \"0.4.12\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c\"\n-dependencies = [\n- \"byteorder\",\n- \"iovec\",\n-]\n-\n[[package]]\nname = \"bytes\"\nversion = \"0.5.6\"\n@@ -247,7 +237,7 @@ checksum = \"b51bd736eec54ae6552d18b0c958885b01d88c84c5fe6985e28c2b57ff385e94\"\ndependencies = [\n\"ambient-authority\",\n\"errno\",\n- \"fs-set-times 0.12.1\",\n+ \"fs-set-times 0.12.2\",\n\"io-lifetimes\",\n\"ipnet\",\n\"maybe-owned\",\n@@ -267,7 +257,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"6e6e89d00b0cebeb6da7a459b81e6a49cf2092cc4afe03f28eb99b8f0e889344\"\ndependencies = [\n\"ambient-authority\",\n- \"rand 0.8.4\",\n+ \"rand\",\n]\n[[package]]\n@@ -298,9 +288,9 @@ dependencies = [\n[[package]]\nname = \"cc\"\n-version = \"1.0.71\"\n+version = \"1.0.72\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd\"\n+checksum = \"22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee\"\ndependencies = [\n\"jobserver\",\n]\n@@ -422,7 +412,7 @@ dependencies = [\n\"cranelift-codegen-meta\",\n\"cranelift-codegen-shared\",\n\"cranelift-entity\",\n- \"gimli\",\n+ \"gimli 0.25.0\",\n\"log 0.4.14\",\n\"regalloc\",\n\"smallvec\",\n@@ -546,6 +536,16 @@ dependencies = [\n\"lazy_static\",\n]\n+[[package]]\n+name = \"crypto-mac\"\n+version = \"0.11.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714\"\n+dependencies = [\n+ \"generic-array\",\n+ \"subtle\",\n+]\n+\n[[package]]\nname = \"ct-logs\"\nversion = \"0.8.0\"\n@@ -573,7 +573,7 @@ checksum = \"fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -673,9 +673,9 @@ dependencies = [\n[[package]]\nname = \"errno\"\n-version = \"0.2.7\"\n+version = \"0.2.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe\"\n+checksum = \"f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1\"\ndependencies = [\n\"errno-dragonfly\",\n\"libc\",\n@@ -770,12 +770,12 @@ dependencies = [\n[[package]]\nname = \"fs-set-times\"\n-version = \"0.12.1\"\n+version = \"0.12.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a7b9ea8f5ff96d007af6b31fbd9aa560cf4a45e544ae1d550d8f72829c5119e1\"\n+checksum = \"d9a6902d89feff48dc1cb9529bf2972cb98100310987b7a0ff9ac4c51adb0aff\"\ndependencies = [\n\"io-lifetimes\",\n- \"rsix 0.24.1\",\n+ \"rsix 0.25.1\",\n\"winapi 0.3.9\",\n]\n@@ -862,7 +862,7 @@ dependencies = [\n\"proc-macro-hack\",\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -917,17 +917,6 @@ dependencies = [\n\"unicode-width\",\n]\n-[[package]]\n-name = \"getrandom\"\n-version = \"0.1.16\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce\"\n-dependencies = [\n- \"cfg-if 1.0.0\",\n- \"libc\",\n- \"wasi 0.9.0+wasi-snapshot-preview1\",\n-]\n-\n[[package]]\nname = \"getrandom\"\nversion = \"0.2.3\"\n@@ -936,7 +925,7 @@ checksum = \"7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753\"\ndependencies = [\n\"cfg-if 1.0.0\",\n\"libc\",\n- \"wasi 0.10.0+wasi-snapshot-preview1\",\n+ \"wasi\",\n]\n[[package]]\n@@ -950,6 +939,12 @@ dependencies = [\n\"stable_deref_trait\",\n]\n+[[package]]\n+name = \"gimli\"\n+version = \"0.26.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4\"\n+\n[[package]]\nname = \"h2\"\nversion = \"0.3.7\"\n@@ -961,10 +956,10 @@ dependencies = [\n\"futures-core\",\n\"futures-sink\",\n\"futures-util\",\n- \"http 0.2.5\",\n+ \"http\",\n\"indexmap\",\n\"slab\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-util\",\n\"tracing\",\n]\n@@ -981,11 +976,11 @@ version = \"0.3.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a4c4eb0471fcb85846d8b0690695ef354f9afb11cb03cac2e1d7c9253351afb0\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"bitflags 1.3.2\",\n\"bytes 1.1.0\",\n\"headers-core\",\n- \"http 0.2.5\",\n+ \"http\",\n\"httpdate\",\n\"mime\",\n\"sha-1\",\n@@ -997,7 +992,7 @@ version = \"0.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429\"\ndependencies = [\n- \"http 0.2.5\",\n+ \"http\",\n]\n[[package]]\n@@ -1018,6 +1013,16 @@ dependencies = [\n\"libc\",\n]\n+[[package]]\n+name = \"hmac\"\n+version = \"0.11.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b\"\n+dependencies = [\n+ \"crypto-mac\",\n+ \"digest\",\n+]\n+\n[[package]]\nname = \"hostname\"\nversion = \"0.3.1\"\n@@ -1029,17 +1034,6 @@ dependencies = [\n\"winapi 0.3.9\",\n]\n-[[package]]\n-name = \"http\"\n-version = \"0.1.21\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0\"\n-dependencies = [\n- \"bytes 0.4.12\",\n- \"fnv\",\n- \"itoa\",\n-]\n-\n[[package]]\nname = \"http\"\nversion = \"0.2.5\"\n@@ -1058,7 +1052,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6\"\ndependencies = [\n\"bytes 1.1.0\",\n- \"http 0.2.5\",\n+ \"http\",\n\"pin-project-lite 0.2.7\",\n]\n@@ -1070,9 +1064,9 @@ checksum = \"acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503\"\n[[package]]\nname = \"httpdate\"\n-version = \"1.0.1\"\n+version = \"1.0.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440\"\n+checksum = \"c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421\"\n[[package]]\nname = \"humantime\"\n@@ -1085,23 +1079,23 @@ dependencies = [\n[[package]]\nname = \"hyper\"\n-version = \"0.14.14\"\n+version = \"0.14.15\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2b91bb1f221b6ea1f1e4371216b70f40748774c2fb5971b450c07773fb92d26b\"\n+checksum = \"436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c\"\ndependencies = [\n\"bytes 1.1.0\",\n\"futures-channel\",\n\"futures-core\",\n\"futures-util\",\n\"h2\",\n- \"http 0.2.5\",\n+ \"http\",\n\"http-body\",\n\"httparse\",\n\"httpdate\",\n\"itoa\",\n\"pin-project-lite 0.2.7\",\n\"socket2\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tower-service\",\n\"tracing\",\n\"want\",\n@@ -1119,7 +1113,7 @@ dependencies = [\n\"log 0.4.14\",\n\"rustls\",\n\"rustls-native-certs\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-rustls\",\n\"webpki\",\n]\n@@ -1132,7 +1126,7 @@ checksum = \"bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1\"\ndependencies = [\n\"hyper\",\n\"pin-project-lite 0.2.7\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-io-timeout\",\n]\n@@ -1145,25 +1139,23 @@ dependencies = [\n\"bytes 1.1.0\",\n\"hyper\",\n\"native-tls\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-native-tls\",\n]\n[[package]]\nname = \"hyperx\"\n-version = \"0.13.2\"\n+version = \"1.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e4a94cbc2c6f63028e5736ca4e811ae36d3990059c384cbe68298c66728a9776\"\n+checksum = \"5617e92fc2f2501c3e2bc6ce547cad841adba2bae5b921c7e52510beca6d084c\"\ndependencies = [\n- \"base64 0.10.1\",\n- \"bytes 0.4.12\",\n- \"http 0.1.21\",\n- \"httparse\",\n+ \"base64\",\n+ \"bytes 1.1.0\",\n+ \"http\",\n+ \"httpdate\",\n\"language-tags\",\n- \"log 0.4.14\",\n\"mime\",\n- \"percent-encoding 1.0.1\",\n- \"time\",\n+ \"percent-encoding 2.1.0\",\n\"unicase 2.6.0\",\n]\n@@ -1202,9 +1194,9 @@ dependencies = [\n[[package]]\nname = \"inotify\"\n-version = \"0.9.5\"\n+version = \"0.9.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9e5fc8f41dbaa9c8492a96c8afffda4f76896ee041d6a57606e70581b80c901f\"\n+checksum = \"f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff\"\ndependencies = [\n\"bitflags 1.3.2\",\n\"inotify-sys\",\n@@ -1220,15 +1212,6 @@ dependencies = [\n\"libc\",\n]\n-[[package]]\n-name = \"input_buffer\"\n-version = \"0.4.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413\"\n-dependencies = [\n- \"bytes 1.1.0\",\n-]\n-\n[[package]]\nname = \"instant\"\nversion = \"0.1.12\"\n@@ -1240,9 +1223,9 @@ dependencies = [\n[[package]]\nname = \"io-lifetimes\"\n-version = \"0.3.1\"\n+version = \"0.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"47f5ce4afb9bf504b9f496a3307676bc232122f91a93c4da6d540aa99a0a0e0b\"\n+checksum = \"278e90d6f8a6c76a8334b336e306efa3c5f2b604048cbfd486d6f49878e3af14\"\ndependencies = [\n\"rustc_version\",\n\"winapi 0.3.9\",\n@@ -1327,6 +1310,21 @@ dependencies = [\n\"serde_json\",\n]\n+[[package]]\n+name = \"jwt\"\n+version = \"0.15.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"98328bb4f360e6b2ceb1f95645602c7014000ef0c3809963df8ad3a3a09f8d99\"\n+dependencies = [\n+ \"base64\",\n+ \"crypto-mac\",\n+ \"digest\",\n+ \"hmac\",\n+ \"serde\",\n+ \"serde_json\",\n+ \"sha2\",\n+]\n+\n[[package]]\nname = \"k8s-csi\"\nversion = \"0.4.0\"\n@@ -1346,10 +1344,10 @@ version = \"0.13.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"4f8de9873b904e74b3533f77493731ee26742418077503683db44e1b3c54aa5c\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"bytes 1.1.0\",\n\"chrono\",\n- \"http 0.2.5\",\n+ \"http\",\n\"percent-encoding 2.1.0\",\n\"serde\",\n\"serde-value\",\n@@ -1402,7 +1400,7 @@ dependencies = [\n\"kube-runtime\",\n\"serde\",\n\"serde_json\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-stream\",\n\"tracing\",\n\"tracing-futures\",\n@@ -1416,7 +1414,7 @@ checksum = \"4fa674a23c40b90b24a035eef7db57622b8012a6d22725f7f777c28ce91106d7\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -1443,7 +1441,7 @@ dependencies = [\n\"serde_derive\",\n\"serde_json\",\n\"tempfile\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-stream\",\n\"tonic\",\n\"tonic-build\",\n@@ -1458,13 +1456,13 @@ version = \"0.60.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a0ae4dcb1a65182551922303a2d292b463513a6727db5ad980afbd32df7f3c16\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"bytes 1.1.0\",\n\"chrono\",\n\"dirs-next\",\n\"either\",\n\"futures\",\n- \"http 0.2.5\",\n+ \"http\",\n\"http-body\",\n\"hyper\",\n\"hyper-rustls\",\n@@ -1482,7 +1480,7 @@ dependencies = [\n\"serde_json\",\n\"serde_yaml\",\n\"thiserror\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-native-tls\",\n\"tokio-util\",\n\"tower\",\n@@ -1498,7 +1496,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"04ccd59635e9b21353da8d4a394bb5d3473b5965ed44496c8f857281b0625ffe\"\ndependencies = [\n\"form_urlencoded\",\n- \"http 0.2.5\",\n+ \"http\",\n\"json-patch\",\n\"k8s-openapi\",\n\"once_cell\",\n@@ -1524,7 +1522,7 @@ dependencies = [\n\"serde_json\",\n\"smallvec\",\n\"snafu\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-util\",\n\"tracing\",\n]\n@@ -1537,7 +1535,7 @@ dependencies = [\n\"async-recursion\",\n\"async-stream\",\n\"async-trait\",\n- \"base64 0.13.0\",\n+ \"base64\",\n\"bytes 0.3.0\",\n\"chrono\",\n\"dirs-next\",\n@@ -1545,7 +1543,7 @@ dependencies = [\n\"env_logger 0.4.3\",\n\"futures\",\n\"hostname\",\n- \"http 0.2.5\",\n+ \"http\",\n\"hyper\",\n\"iovec\",\n\"json-patch\",\n@@ -1575,7 +1573,7 @@ dependencies = [\n\"tempfile\",\n\"thiserror\",\n\"tokio 0.2.25\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-compat-02\",\n\"tokio-stream\",\n\"tonic\",\n@@ -1594,9 +1592,9 @@ dependencies = [\n[[package]]\nname = \"language-tags\"\n-version = \"0.2.2\"\n+version = \"0.3.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a\"\n+checksum = \"d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388\"\n[[package]]\nname = \"lazy_static\"\n@@ -1618,9 +1616,9 @@ checksum = \"884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67\"\n[[package]]\nname = \"libc\"\n-version = \"0.2.104\"\n+version = \"0.2.107\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce\"\n+checksum = \"fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219\"\n[[package]]\nname = \"linked-hash-map\"\n@@ -1816,9 +1814,9 @@ dependencies = [\n[[package]]\nname = \"more-asserts\"\n-version = \"0.2.1\"\n+version = \"0.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238\"\n+checksum = \"7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389\"\n[[package]]\nname = \"multimap\"\n@@ -1828,9 +1826,9 @@ checksum = \"e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a\"\n[[package]]\nname = \"multipart\"\n-version = \"0.17.1\"\n+version = \"0.18.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d050aeedc89243f5347c3e237e3e13dc76fbe4ae3742a57b94dc14f69acf76d4\"\n+checksum = \"00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182\"\ndependencies = [\n\"buf_redux\",\n\"httparse\",\n@@ -1838,7 +1836,7 @@ dependencies = [\n\"mime\",\n\"mime_guess\",\n\"quick-error\",\n- \"rand 0.7.3\",\n+ \"rand\",\n\"safemem\",\n\"tempfile\",\n\"twoway\",\n@@ -1951,22 +1949,24 @@ dependencies = [\n[[package]]\nname = \"oci-distribution\"\n-version = \"0.7.0\"\n+version = \"0.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5c9f50cb73141efc685844c84c98c361429c3a7db550d8d9888af037d93358a7\"\n+checksum = \"516f2995191019e8c88845d27f749f372de90078236672af7e16565837221abc\"\ndependencies = [\n\"anyhow\",\n\"futures-util\",\n\"hyperx\",\n+ \"jwt\",\n\"lazy_static\",\n\"regex\",\n\"reqwest\",\n\"serde\",\n\"serde_json\",\n\"sha2\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tracing\",\n- \"www-authenticate\",\n+ \"unicase 1.4.2\",\n+ \"url 1.7.2\",\n]\n[[package]]\n@@ -1983,9 +1983,9 @@ checksum = \"624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5\"\n[[package]]\nname = \"openssl\"\n-version = \"0.10.36\"\n+version = \"0.10.38\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a\"\n+checksum = \"0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95\"\ndependencies = [\n\"bitflags 1.3.2\",\n\"cfg-if 1.0.0\",\n@@ -2003,9 +2003,9 @@ checksum = \"28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a\"\n[[package]]\nname = \"openssl-sys\"\n-version = \"0.9.67\"\n+version = \"0.9.71\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058\"\n+checksum = \"7df13d165e607909b363a4757a6f133f8a818a74e9d3a98d09c6128e15fa4c73\"\ndependencies = [\n\"autocfg\",\n\"cc\",\n@@ -2050,9 +2050,9 @@ dependencies = [\n[[package]]\nname = \"paste\"\n-version = \"1.0.5\"\n+version = \"1.0.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58\"\n+checksum = \"0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5\"\n[[package]]\nname = \"pem\"\n@@ -2060,18 +2060,18 @@ version = \"0.8.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"once_cell\",\n\"regex\",\n]\n[[package]]\nname = \"pem\"\n-version = \"1.0.0\"\n+version = \"1.0.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3f2373df5233932a893d3bc2c78a0bf3f6d12590a1edd546b4fbefcac32c5c0f\"\n+checksum = \"06673860db84d02a63942fa69cd9543f2624a5df3aea7f33173048fa7ad5cf1a\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"once_cell\",\n\"regex\",\n]\n@@ -2124,7 +2124,7 @@ checksum = \"3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -2135,7 +2135,7 @@ checksum = \"6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -2158,15 +2158,15 @@ checksum = \"8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184\"\n[[package]]\nname = \"pkg-config\"\n-version = \"0.3.20\"\n+version = \"0.3.22\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb\"\n+checksum = \"12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f\"\n[[package]]\nname = \"ppv-lite86\"\n-version = \"0.2.14\"\n+version = \"0.2.15\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741\"\n+checksum = \"ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba\"\n[[package]]\nname = \"proc-macro-error\"\n@@ -2177,7 +2177,7 @@ dependencies = [\n\"proc-macro-error-attr\",\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n\"version_check 0.9.3\",\n]\n@@ -2206,9 +2206,9 @@ checksum = \"bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086\"\n[[package]]\nname = \"proc-macro2\"\n-version = \"1.0.30\"\n+version = \"1.0.32\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70\"\n+checksum = \"ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43\"\ndependencies = [\n\"unicode-xid 0.2.2\",\n]\n@@ -2251,7 +2251,7 @@ dependencies = [\n\"itertools 0.10.1\",\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -2303,19 +2303,6 @@ dependencies = [\n\"proc-macro2\",\n]\n-[[package]]\n-name = \"rand\"\n-version = \"0.7.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03\"\n-dependencies = [\n- \"getrandom 0.1.16\",\n- \"libc\",\n- \"rand_chacha 0.2.2\",\n- \"rand_core 0.5.1\",\n- \"rand_hc 0.2.0\",\n-]\n-\n[[package]]\nname = \"rand\"\nversion = \"0.8.4\"\n@@ -2323,19 +2310,9 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8\"\ndependencies = [\n\"libc\",\n- \"rand_chacha 0.3.1\",\n- \"rand_core 0.6.3\",\n- \"rand_hc 0.3.1\",\n-]\n-\n-[[package]]\n-name = \"rand_chacha\"\n-version = \"0.2.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402\"\n-dependencies = [\n- \"ppv-lite86\",\n- \"rand_core 0.5.1\",\n+ \"rand_chacha\",\n+ \"rand_core\",\n+ \"rand_hc\",\n]\n[[package]]\n@@ -2345,16 +2322,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88\"\ndependencies = [\n\"ppv-lite86\",\n- \"rand_core 0.6.3\",\n-]\n-\n-[[package]]\n-name = \"rand_core\"\n-version = \"0.5.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19\"\n-dependencies = [\n- \"getrandom 0.1.16\",\n+ \"rand_core\",\n]\n[[package]]\n@@ -2363,16 +2331,7 @@ version = \"0.6.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7\"\ndependencies = [\n- \"getrandom 0.2.3\",\n-]\n-\n-[[package]]\n-name = \"rand_hc\"\n-version = \"0.2.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c\"\n-dependencies = [\n- \"rand_core 0.5.1\",\n+ \"getrandom\",\n]\n[[package]]\n@@ -2381,7 +2340,7 @@ version = \"0.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7\"\ndependencies = [\n- \"rand_core 0.6.3\",\n+ \"rand_core\",\n]\n[[package]]\n@@ -2416,7 +2375,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5911d1403f4143c9d56a702069d593e8d0f3fab880a85e103604d0893ea31ba7\"\ndependencies = [\n\"chrono\",\n- \"pem 1.0.0\",\n+ \"pem 1.0.1\",\n\"ring\",\n\"yasna\",\n]\n@@ -2436,7 +2395,7 @@ version = \"0.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64\"\ndependencies = [\n- \"getrandom 0.2.3\",\n+ \"getrandom\",\n\"redox_syscall\",\n]\n@@ -2517,12 +2476,12 @@ version = \"0.11.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"66d2927ca2f685faf0fc620ac4834690d29e7abb153add10f5812eef20b5e280\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"bytes 1.1.0\",\n\"encoding_rs\",\n\"futures-core\",\n\"futures-util\",\n- \"http 0.2.5\",\n+ \"http\",\n\"http-body\",\n\"hyper\",\n\"hyper-rustls\",\n@@ -2539,7 +2498,7 @@ dependencies = [\n\"serde\",\n\"serde_json\",\n\"serde_urlencoded\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-native-tls\",\n\"tokio-rustls\",\n\"url 2.2.2\",\n@@ -2601,9 +2560,9 @@ dependencies = [\n[[package]]\nname = \"rsix\"\n-version = \"0.24.1\"\n+version = \"0.25.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8e268eabe3c80f980a3dd21ca34a813cf506f4f2ce3a5ccdc493259f3f382889\"\n+checksum = \"af4da272ce5ef18de07bd84edb77769ce16da0a4ca8f84d4389efafaf0850f9f\"\ndependencies = [\n\"bitflags 1.3.2\",\n\"errno\",\n@@ -2652,7 +2611,7 @@ version = \"0.19.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"log 0.4.14\",\n\"ring\",\n\"sct\",\n@@ -2677,7 +2636,7 @@ version = \"0.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n]\n[[package]]\n@@ -2801,14 +2760,14 @@ checksum = \"d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\nname = \"serde_json\"\n-version = \"1.0.68\"\n+version = \"1.0.71\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8\"\n+checksum = \"063bf466a64011ac24040a49009724ee60a57da1b437617ceb32e53ad61bfb19\"\ndependencies = [\n\"indexmap\",\n\"itoa\",\n@@ -2925,7 +2884,7 @@ checksum = \"1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -2977,9 +2936,15 @@ dependencies = [\n\"proc-macro-error\",\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n+[[package]]\n+name = \"subtle\"\n+version = \"2.4.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601\"\n+\n[[package]]\nname = \"syn\"\nversion = \"0.11.11\"\n@@ -2993,9 +2958,9 @@ dependencies = [\n[[package]]\nname = \"syn\"\n-version = \"1.0.80\"\n+version = \"1.0.81\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194\"\n+checksum = \"f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n@@ -3042,7 +3007,7 @@ checksum = \"dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22\"\ndependencies = [\n\"cfg-if 1.0.0\",\n\"libc\",\n- \"rand 0.8.4\",\n+ \"rand\",\n\"redox_syscall\",\n\"remove_dir_all 0.5.3\",\n\"winapi 0.3.9\",\n@@ -3118,7 +3083,7 @@ checksum = \"aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -3137,15 +3102,15 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255\"\ndependencies = [\n\"libc\",\n- \"wasi 0.10.0+wasi-snapshot-preview1\",\n+ \"wasi\",\n\"winapi 0.3.9\",\n]\n[[package]]\nname = \"tinyvec\"\n-version = \"1.5.0\"\n+version = \"1.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7\"\n+checksum = \"2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2\"\ndependencies = [\n\"tinyvec_macros\",\n]\n@@ -3179,9 +3144,9 @@ dependencies = [\n[[package]]\nname = \"tokio\"\n-version = \"1.12.0\"\n+version = \"1.14.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc\"\n+checksum = \"70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144\"\ndependencies = [\n\"autocfg\",\n\"bytes 1.1.0\",\n@@ -3193,7 +3158,7 @@ dependencies = [\n\"parking_lot\",\n\"pin-project-lite 0.2.7\",\n\"signal-hook-registry\",\n- \"tokio-macros 1.5.0\",\n+ \"tokio-macros 1.6.0\",\n\"winapi 0.3.9\",\n]\n@@ -3207,7 +3172,7 @@ dependencies = [\n\"once_cell\",\n\"pin-project-lite 0.2.7\",\n\"tokio 0.2.25\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-stream\",\n]\n@@ -3218,7 +3183,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9\"\ndependencies = [\n\"pin-project-lite 0.2.7\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n]\n[[package]]\n@@ -3229,18 +3194,18 @@ checksum = \"e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\nname = \"tokio-macros\"\n-version = \"1.5.0\"\n+version = \"1.6.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b2dd85aeaba7b68df939bd357c6afb36c87951be9e80bf9c859f2fc3e9fca0fd\"\n+checksum = \"c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -3250,7 +3215,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b\"\ndependencies = [\n\"native-tls\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n]\n[[package]]\n@@ -3260,19 +3225,19 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6\"\ndependencies = [\n\"rustls\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"webpki\",\n]\n[[package]]\nname = \"tokio-stream\"\n-version = \"0.1.7\"\n+version = \"0.1.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f\"\n+checksum = \"50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3\"\ndependencies = [\n\"futures-core\",\n\"pin-project-lite 0.2.7\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-util\",\n]\n@@ -3285,28 +3250,28 @@ dependencies = [\n\"async-stream\",\n\"bytes 1.1.0\",\n\"futures-core\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-stream\",\n]\n[[package]]\nname = \"tokio-tungstenite\"\n-version = \"0.13.0\"\n+version = \"0.15.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b\"\n+checksum = \"511de3f85caf1c98983545490c3d09685fa8eb634e57eec22bb4db271f46cbd8\"\ndependencies = [\n\"futures-util\",\n\"log 0.4.14\",\n\"pin-project 1.0.8\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tungstenite\",\n]\n[[package]]\nname = \"tokio-util\"\n-version = \"0.6.8\"\n+version = \"0.6.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd\"\n+checksum = \"9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0\"\ndependencies = [\n\"bytes 1.1.0\",\n\"futures-core\",\n@@ -3314,7 +3279,7 @@ dependencies = [\n\"log 0.4.14\",\n\"pin-project-lite 0.2.7\",\n\"slab\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n]\n[[package]]\n@@ -3343,12 +3308,12 @@ checksum = \"796c5e1cd49905e65dd8e700d4cb1dffcbfdb4fc9d017de08c1a537afd83627c\"\ndependencies = [\n\"async-stream\",\n\"async-trait\",\n- \"base64 0.13.0\",\n+ \"base64\",\n\"bytes 1.1.0\",\n\"futures-core\",\n\"futures-util\",\n\"h2\",\n- \"http 0.2.5\",\n+ \"http\",\n\"http-body\",\n\"hyper\",\n\"hyper-timeout\",\n@@ -3356,7 +3321,7 @@ dependencies = [\n\"pin-project 1.0.8\",\n\"prost\",\n\"prost-derive\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-rustls\",\n\"tokio-stream\",\n\"tokio-util\",\n@@ -3376,7 +3341,7 @@ dependencies = [\n\"proc-macro2\",\n\"prost-build\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -3390,9 +3355,9 @@ dependencies = [\n\"indexmap\",\n\"pin-project 1.0.8\",\n\"pin-project-lite 0.2.7\",\n- \"rand 0.8.4\",\n+ \"rand\",\n\"slab\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-stream\",\n\"tokio-util\",\n\"tower-layer\",\n@@ -3402,15 +3367,15 @@ dependencies = [\n[[package]]\nname = \"tower-http\"\n-version = \"0.1.1\"\n+version = \"0.1.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0b7b56efe69aa0ad2b5da6b942e57ea9f6fe683b7a314d4ff48662e2c8838de1\"\n+checksum = \"6f70061b0592867f0a60e67a6e699da5fe000c88a360a5b92ebdba9d73b2238c\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"bytes 1.1.0\",\n\"futures-core\",\n\"futures-util\",\n- \"http 0.2.5\",\n+ \"http\",\n\"http-body\",\n\"pin-project 1.0.8\",\n\"tower-layer\",\n@@ -3438,7 +3403,7 @@ checksum = \"a4546773ffeab9e4ea02b8872faa49bb616a80a7da66afc2f32688943f97efa7\"\ndependencies = [\n\"futures-util\",\n\"pin-project 1.0.8\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-test\",\n\"tower-layer\",\n\"tower-service\",\n@@ -3465,7 +3430,7 @@ checksum = \"f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n]\n[[package]]\n@@ -3547,19 +3512,19 @@ checksum = \"59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642\"\n[[package]]\nname = \"tungstenite\"\n-version = \"0.12.0\"\n+version = \"0.14.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24\"\n+checksum = \"a0b2d8558abd2e276b0a8df5c05a2ec762609344191e5fd23e292c910e9165b5\"\ndependencies = [\n- \"base64 0.13.0\",\n+ \"base64\",\n\"byteorder\",\n\"bytes 1.1.0\",\n- \"http 0.2.5\",\n+ \"http\",\n\"httparse\",\n- \"input_buffer\",\n\"log 0.4.14\",\n- \"rand 0.8.4\",\n+ \"rand\",\n\"sha-1\",\n+ \"thiserror\",\n\"url 2.2.2\",\n\"utf-8\",\n]\n@@ -3688,7 +3653,7 @@ version = \"0.8.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7\"\ndependencies = [\n- \"getrandom 0.2.3\",\n+ \"getrandom\",\n]\n[[package]]\n@@ -3752,14 +3717,15 @@ dependencies = [\n[[package]]\nname = \"warp\"\n-version = \"0.3.1\"\n+version = \"0.3.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054\"\n+checksum = \"3cef4e1e9114a4b7f1ac799f16ce71c14de5778500c5450ec6b7b920c55b587e\"\ndependencies = [\n\"bytes 1.1.0\",\n- \"futures\",\n+ \"futures-channel\",\n+ \"futures-util\",\n\"headers\",\n- \"http 0.2.5\",\n+ \"http\",\n\"hyper\",\n\"log 0.4.14\",\n\"mime\",\n@@ -3771,7 +3737,7 @@ dependencies = [\n\"serde\",\n\"serde_json\",\n\"serde_urlencoded\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tokio-rustls\",\n\"tokio-stream\",\n\"tokio-tungstenite\",\n@@ -3780,12 +3746,6 @@ dependencies = [\n\"tracing\",\n]\n-[[package]]\n-name = \"wasi\"\n-version = \"0.9.0+wasi-snapshot-preview1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519\"\n-\n[[package]]\nname = \"wasi\"\nversion = \"0.10.0+wasi-snapshot-preview1\"\n@@ -3842,10 +3802,10 @@ dependencies = [\n\"anyhow\",\n\"bytes 1.1.0\",\n\"futures\",\n- \"http 0.2.5\",\n+ \"http\",\n\"reqwest\",\n\"thiserror\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tracing\",\n\"url 2.2.2\",\n\"wasi-common\",\n@@ -3872,7 +3832,7 @@ dependencies = [\n\"serde_derive\",\n\"serde_json\",\n\"tempfile\",\n- \"tokio 1.12.0\",\n+ \"tokio 1.14.0\",\n\"tracing\",\n\"wasi-cap-std-sync\",\n\"wasi-common\",\n@@ -3903,7 +3863,7 @@ dependencies = [\n\"log 0.4.14\",\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n\"wasm-bindgen-shared\",\n]\n@@ -3937,7 +3897,7 @@ checksum = \"7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n\"wasm-bindgen-backend\",\n\"wasm-bindgen-shared\",\n]\n@@ -3995,7 +3955,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"e2493b81d7a9935f7af15e06beec806f256bc974a90a843685f3d61f2fc97058\"\ndependencies = [\n\"anyhow\",\n- \"base64 0.13.0\",\n+ \"base64\",\n\"bincode\",\n\"directories-next\",\n\"errno\",\n@@ -4021,7 +3981,7 @@ dependencies = [\n\"cranelift-frontend\",\n\"cranelift-native\",\n\"cranelift-wasm\",\n- \"gimli\",\n+ \"gimli 0.25.0\",\n\"more-asserts\",\n\"object 0.26.2\",\n\"target-lexicon\",\n@@ -4039,7 +3999,7 @@ dependencies = [\n\"anyhow\",\n\"cfg-if 1.0.0\",\n\"cranelift-entity\",\n- \"gimli\",\n+ \"gimli 0.25.0\",\n\"indexmap\",\n\"log 0.4.14\",\n\"more-asserts\",\n@@ -4068,11 +4028,11 @@ version = \"0.30.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"24f46dd757225f29a419be415ea6fb8558df9b0194f07e3a6a9c99d0e14dd534\"\ndependencies = [\n- \"addr2line\",\n+ \"addr2line 0.16.0\",\n\"anyhow\",\n\"bincode\",\n\"cfg-if 1.0.0\",\n- \"gimli\",\n+ \"gimli 0.25.0\",\n\"libc\",\n\"log 0.4.14\",\n\"more-asserts\",\n@@ -4104,7 +4064,7 @@ dependencies = [\n\"mach\",\n\"memoffset\",\n\"more-asserts\",\n- \"rand 0.8.4\",\n+ \"rand\",\n\"region\",\n\"thiserror\",\n\"wasmtime-environ\",\n@@ -4230,7 +4190,7 @@ dependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n\"shellexpand\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n\"witx\",\n]\n@@ -4242,7 +4202,7 @@ checksum = \"74b91f637729488f0318db544b24493788a3228fed1e1ccd24abbe4fc4f92663\"\ndependencies = [\n\"proc-macro2\",\n\"quote 1.0.10\",\n- \"syn 1.0.80\",\n+ \"syn 1.0.81\",\n\"wiggle-generate\",\n\"witx\",\n]\n@@ -4332,17 +4292,6 @@ dependencies = [\n\"winapi-build\",\n]\n-[[package]]\n-name = \"www-authenticate\"\n-version = \"0.3.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8c62efb8259cda4e4c732287397701237b78daa4c43edcf3e613c8503a6c07dd\"\n-dependencies = [\n- \"hyperx\",\n- \"unicase 1.4.2\",\n- \"url 1.7.2\",\n-]\n-\n[[package]]\nname = \"yaml-rust\"\nversion = \"0.4.5\"\n" }, { "change_type": "MODIFY", "old_path": "Cargo.toml", "new_path": "Cargo.toml", "diff": "@@ -50,7 +50,7 @@ k8s-openapi = {version = \"0.13\", default-features = false, features = [\"v1_22\"]}\nkrator = {version = \"0.5\", default-features = false}\nkube = {version = \"0.60\", default-features = false}\nkubelet = {path = \"./crates/kubelet\", version = \"1.0.0-alpha.1\", default-features = false, features = [\"cli\"]}\n-oci-distribution = \"0.7\"\n+oci-distribution = \"0.8\"\nregex = \"1.3\"\nserde = \"1.0\"\ntokio = {version = \"1.0\", features = [\"macros\", \"rt-multi-thread\", \"time\"]}\n" }, { "change_type": "MODIFY", "old_path": "crates/kubelet/Cargo.toml", "new_path": "crates/kubelet/Cargo.toml", "diff": "@@ -55,7 +55,7 @@ kube = {version = \"0.60\", default-features = false, features = [\"jsonpatch\"]}\nkube-runtime = {version = \"0.60\", default-features = false}\nlazy_static = \"1.4\"\nnotify = \"5.0.0-pre.3\"\n-oci-distribution = \"0.7\"\n+oci-distribution = \"0.8\"\nprost = \"0.8\"\nprost-types = \"0.8\"\nrcgen = \"0.8\"\n" }, { "change_type": "MODIFY", "old_path": "crates/wasi-provider/Cargo.toml", "new_path": "crates/wasi-provider/Cargo.toml", "diff": "@@ -45,4 +45,4 @@ wasi-experimental-http-wasmtime = \"0.6.0\"\n[dev-dependencies]\nk8s-openapi = {version = \"0.13\", default-features = false, features = [\"v1_22\", \"api\"]}\n-oci-distribution = \"0.7\"\n+oci-distribution = \"0.8\"\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
cargo update/oci-distribution v0.8.0 Signed-off-by: Matthew Fisher <[email protected]>
350,446
09.02.2022 14:45:06
-28,800
de8e6f498c9b98b12d9016c83b34242a19716d18
Modify 'std::u64::MAX' to 'u64::MAX' 'u64::MAX' is the recommended way to represent the largest number of u64 type(reference: https://doc.rust-lang.org/std/u64/constant.MAX.html) and 'std::u64::MAX' is now deprecated in a future Rust version.
[ { "change_type": "MODIFY", "old_path": "crates/kubelet/src/kubelet.rs", "new_path": "crates/kubelet/src/kubelet.rs", "diff": "@@ -188,7 +188,7 @@ async fn start_plugin_registry(registrar: Option<Arc<PluginRegistry>>) -> anyhow\ntask::spawn(async {\nloop {\n// We run a delay here so we don't waste time on NOOP CPU cycles\n- tokio::time::sleep(tokio::time::Duration::from_secs(std::u64::MAX)).await;\n+ tokio::time::sleep(tokio::time::Duration::from_secs(u64::MAX)).await;\n}\n})\n.map_err(anyhow::Error::from)\n@@ -206,7 +206,7 @@ async fn start_device_manager(device_manager: Option<Arc<DeviceManager>>) -> any\ntask::spawn(async {\nloop {\n// We run a delay here so we don't waste time on NOOP CPU cycles\n- tokio::time::sleep(tokio::time::Duration::from_secs(std::u64::MAX)).await;\n+ tokio::time::sleep(tokio::time::Duration::from_secs(u64::MAX)).await;\n}\n})\n.map_err(anyhow::Error::from)\n" }, { "change_type": "MODIFY", "old_path": "tests/device_plugin/mod.rs", "new_path": "tests/device_plugin/mod.rs", "diff": "@@ -52,7 +52,7 @@ impl DevicePlugin for MockDevicePlugin {\n.unwrap();\nloop {\n// ListAndWatch should not end\n- tokio::time::sleep(tokio::time::Duration::from_secs(std::u64::MAX)).await;\n+ tokio::time::sleep(tokio::time::Duration::from_secs(u64::MAX)).await;\n}\n});\nOk(Response::new(Box::pin(\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Modify 'std::u64::MAX' to 'u64::MAX' 'u64::MAX' is the recommended way to represent the largest number of u64 type(reference: https://doc.rust-lang.org/std/u64/constant.MAX.html) and 'std::u64::MAX' is now deprecated in a future Rust version. Signed-off-by: zyy17 <[email protected]>
350,446
24.02.2022 19:10:29
-28,800
9d9a30b85fdee3732cdcb6f6b33911481668f0a1
Refractor: refine naming from 'Kubelet' to 'Krustlet'
[ { "change_type": "MODIFY", "old_path": ".vscode/launch.json", "new_path": ".vscode/launch.json", "diff": "\"configurations\": [{\n\"type\": \"lldb\",\n\"request\": \"launch\",\n- \"name\": \"Kubelet\",\n+ \"name\": \"Krustlet\",\n\"args\": [],\n\"program\": \"${workspaceFolder}/target/debug/krustlet\",\n\"windows\": {\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
Refractor: refine naming from 'Kubelet' to 'Krustlet' Signed-off-by: zyy17 <[email protected]>
350,414
02.03.2022 10:30:35
28,800
393f4b3bac304e726cf3871c7c692ca7ede507ba
azure-blob-storage-upload 2.0.0
[ { "change_type": "MODIFY", "old_path": ".github/workflows/release.yml", "new_path": ".github/workflows/release.yml", "diff": "@@ -123,12 +123,11 @@ jobs:\ncd krustlet\nsha256sum * > checksums-${{ env.RELEASE_VERSION }}.txt\n- name: upload to azure\n- uses: bacongobbler/azure-blob-storage-upload@main\n+ uses: bacongobbler/[email protected]\nwith:\nsource_dir: krustlet\ncontainer_name: releases\nconnection_string: ${{ secrets.AzureStorageConnectionString }}\n- sync: false\ncrates:\nname: publish to crates.io\nruns-on: ubuntu-latest\n" } ]
Rust
Apache License 2.0
krustlet/krustlet
azure-blob-storage-upload 2.0.0 Signed-off-by: Matthew Fisher <[email protected]>
488,262
03.01.2017 13:30:45
18,000
d19df28b4fad717188b877e06d15857357ce8dbd
fix syntax errors in labels.py
[ { "change_type": "MODIFY", "old_path": "sahara/plugins/labels.py", "new_path": "sahara/plugins/labels.py", "diff": "@@ -210,8 +210,8 @@ class LabelHandler(object):\n_(\"Plugin %s is not enabled\") % plugin_name)\nif plb.get('deprecated', {}).get('status', False):\n- LOG.warning(_LW(\"Plugin %s is deprecated and can removed in next \"\n- \"release\") % plugin_name)\n+ LOG.warning(_LW(\"Plugin %s is deprecated and can be removed in \"\n+ \"the next release\") % plugin_name)\nvlb = details.get(VERSION_LABELS_SCOPE, {}).get(version, {})\nif not vlb.get('enabled', {}).get('status'):\n" } ]
Python
Apache License 2.0
openstack/sahara
fix syntax errors in labels.py Change-Id: I3ef0a2d5c86c26434c2440da7d6e4d55562052ef
488,262
04.01.2017 20:10:43
18,000
a352d95889546a671144fcb75015ed39260dcc1d
Fixing test_cluster_create_list_update_delete() Adding update test to test_cluster_create_list_update_delete()
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/conductor/manager/test_clusters.py", "new_path": "sahara/tests/unit/conductor/manager/test_clusters.py", "diff": "@@ -86,6 +86,11 @@ class ClusterTest(test_base.ConductorManagerTestCase):\nself.assertEqual(1, len(lst))\ncl_id = lst[0][\"id\"]\n+ updated_cl = self.api.cluster_update(\n+ ctx, cl_id, {\"is_public\": True})\n+ self.assertIsInstance(updated_cl, dict)\n+ self.assertEqual(True, updated_cl[\"is_public\"])\n+\nself.api.cluster_destroy(ctx, cl_id)\nlst = self.api.cluster_get_all(ctx)\nself.assertEqual(0, len(lst))\n" } ]
Python
Apache License 2.0
openstack/sahara
Fixing test_cluster_create_list_update_delete() Adding update test to test_cluster_create_list_update_delete() Change-Id: Ia56ba7759b816394c4322f65866cdc3d1656c761
488,262
05.01.2017 14:41:44
18,000
2d02eccedbce78b2ba63b3340366921a733632f4
Add test_update_plugin() There are get_plugin() and update_plugin() in service/api/v10.py, but just test get_plugin,so I add test_update_plugin().
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/service/api/test_v10.py", "new_path": "sahara/tests/unit/service/api/test_v10.py", "diff": "@@ -303,3 +303,21 @@ class TestApi(base.SaharaWithDbTestCase):\n'title': 'Fake plugin',\n'versions': ['0.1', '0.2']}, data)\nself.assertIsNone(api.get_plugin('name1', '0.1'))\n+\n+ def test_update_plugin(self):\n+ data = api.get_plugin('fake', '0.1').dict\n+ self.assertIsNotNone(data)\n+\n+ updated = api.update_plugin('fake', values={\n+ 'plugin_labels': {'enabled': {'status': False}}}).dict\n+ self.assertFalse(updated['plugin_labels']['enabled']['status'])\n+\n+ updated = api.update_plugin('fake', values={\n+ 'plugin_labels': {'enabled': {'status': True}}}).dict\n+ self.assertTrue(updated['plugin_labels']['enabled']['status'])\n+\n+ # restore to original status\n+ updated = api.update_plugin('fake', values={\n+ 'plugin_labels': data['plugin_labels']}).dict\n+ self.assertEqual(data['plugin_labels']['enabled']['status'],\n+ updated['plugin_labels']['enabled']['status'])\n" } ]
Python
Apache License 2.0
openstack/sahara
Add test_update_plugin() There are get_plugin() and update_plugin() in service/api/v10.py, but just test get_plugin,so I add test_update_plugin(). Change-Id: I10055fd3716c69e7681eb23651fb967f6ff15ff0
488,286
10.01.2017 16:49:27
18,000
6067bb7c97760538fcff7af548b0c6bbc27d5d90
Add test_natural_sort_key() Unit tests for general.py is not completed. natural_sort_key() has not been tested.
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/utils/test_general.py", "new_path": "sahara/tests/unit/utils/test_general.py", "diff": "@@ -65,3 +65,11 @@ class UtilsGeneralTest(base.SaharaWithDbTestCase):\nself.assertIsNone(general.get_by_id(lst, 9))\nself.assertEqual(lst[0], general.get_by_id(lst, 5))\nself.assertEqual(lst[1], general.get_by_id(lst, 7))\n+\n+ def test_natural_sort_key(self):\n+ str_test = \"ABC123efg345DD\"\n+ str_list = ['abc', 123, 'efg', 345, 'dd']\n+ str_sort = general.natural_sort_key(str_test)\n+ self.assertEqual(len(str_list), len(str_sort))\n+\n+ self.assertEqual(str_list, str_sort)\n" } ]
Python
Apache License 2.0
openstack/sahara
Add test_natural_sort_key() Unit tests for general.py is not completed. natural_sort_key() has not been tested. Change-Id: Iaaea7436752155a23290c87328f23077a311df23
488,279
16.01.2017 16:49:17
-3,600
3d63bdc9b4cf1e305044d8f63047b47004188297
Add HBASE MASTER processes number validation Because of the missing HBASE MASTER process number validation during cluster creation, it takes too long for sahara to raise the error too many HBASE MASTER processes. Closes-Bug:
[ { "change_type": "MODIFY", "old_path": "sahara/plugins/cdh/validation.py", "new_path": "sahara/plugins/cdh/validation.py", "diff": "@@ -159,13 +159,16 @@ class Validator(object):\nhbr_count = cls._get_inst_count(cluster, 'HBASE_REGIONSERVER')\nzk_count = cls._get_inst_count(cluster, 'ZOOKEEPER_SERVER')\n- if hbm_count >= 1:\n+ if hbm_count == 1:\nif zk_count < 1:\nraise ex.RequiredServiceMissingException(\n'ZOOKEEPER', required_by='HBASE')\nif hbr_count < 1:\nraise ex.InvalidComponentCountException(\n'HBASE_REGIONSERVER', _('at least 1'), hbr_count)\n+ elif hbm_count > 1:\n+ raise ex.InvalidComponentCountException('HBASE_MASTER',\n+ _('0 or 1'), hbm_count)\nelif hbr_count >= 1:\nraise ex.InvalidComponentCountException('HBASE_MASTER',\n_('at least 1'), hbm_count)\n" } ]
Python
Apache License 2.0
openstack/sahara
Add HBASE MASTER processes number validation Because of the missing HBASE MASTER process number validation during cluster creation, it takes too long for sahara to raise the error too many HBASE MASTER processes. Closes-Bug: #1656869 Change-Id: Id143eb2360366443a630f65fc6261231b562417c
488,281
20.01.2017 14:30:04
-7,200
21730e525ed298e697a7927d1e88591bebe642a9
Change link to mysql-connector for Oozie in MapR plugin mysql-connector from /opt/mapr/lib/ is recommended for all MapR services
[ { "change_type": "MODIFY", "old_path": "sahara/plugins/mapr/services/oozie/oozie.py", "new_path": "sahara/plugins/mapr/services/oozie/oozie.py", "diff": "@@ -103,7 +103,7 @@ class Oozie(s.Service):\nif oozie_service:\nsymlink_cmd = (\n- 'cp /usr/share/java/mysql-connector-java.jar %s' %\n+ 'cp /opt/mapr/lib/mysql-connector-*.jar %s' %\nself.libext_path())\nwith oozie_inst.remote() as r:\nLOG.debug('Installing MySQL connector for Oozie')\n" } ]
Python
Apache License 2.0
openstack/sahara
Change link to mysql-connector for Oozie in MapR plugin mysql-connector from /opt/mapr/lib/ is recommended for all MapR services Change-Id: I51d6e440a4e8350004644e5750dfa182674510ab
488,281
20.01.2017 12:41:01
-7,200
488633b0851c6017895d333013745928b766d786
Fix Maria-DB installation for centos7 Closes-Bug:
[ { "change_type": "MODIFY", "old_path": "sahara/plugins/mapr/base/base_cluster_configurer.py", "new_path": "sahara/plugins/mapr/base/base_cluster_configurer.py", "diff": "@@ -218,7 +218,9 @@ class BaseConfigurer(ac.AbstractConfigurer):\nname=_(\"Configure database\"))\ndef decorated():\ndistro_name = cluster_context.distro.name\n- mysql.MySQL.install_mysql(mysql_instance, distro_name)\n+ distro_version = cluster_context.distro_version\n+ mysql.MySQL.install_mysql(mysql_instance, distro_name,\n+ distro_version)\nmysql.MySQL.start_mysql_server(cluster_context)\nmysql.MySQL.create_databases(cluster_context, instances)\n" }, { "change_type": "MODIFY", "old_path": "sahara/plugins/mapr/resources/install_mysql.sh", "new_path": "sahara/plugins/mapr/resources/install_mysql.sh", "diff": "@@ -15,8 +15,11 @@ if [ ! -f /etc/init.d/mysql* ]; then\nsudo service mysql restart\nelif [[ $1 == *\"CentOS\"* ]] || \\\n[[ $1 == \"RedHatEnterpriseServer\" ]]; then\n+ if [[ $2 == \"7\" ]]; then\n+ sudo yum install -y mariadb-server\n+ else\nsudo yum install -y mysql-server\n- sudo yum install -y mysql-connector-java\n+ fi\nelif [[ $1 == *\"SUSE\"* ]]; then\nsudo zypper mysql-server\nelse\n" }, { "change_type": "MODIFY", "old_path": "sahara/plugins/mapr/resources/install_mysql_client.sh", "new_path": "sahara/plugins/mapr/resources/install_mysql_client.sh", "diff": "if [[ $1 == *\"Ubuntu\"* ]]; then\nsudo apt-get install --force-yes -y mysql-client libmysql-java\nelif [[ $1 == *\"CentOS\"* ]] || [[ $1 == \"RedHatEnterpriseServer\" ]]; then\n- sudo yum install -y mysql mysql-connector-java\n+ sudo yum install -y mysql\nelif [[ $1 == *\"SUSE\"* ]]; then\nsudo zypper install mysql-community-server-client mysql-connector-java\nelse\n" }, { "change_type": "MODIFY", "old_path": "sahara/plugins/mapr/services/mysql/mysql.py", "new_path": "sahara/plugins/mapr/services/mysql/mysql.py", "diff": "@@ -202,5 +202,6 @@ class MySQL(s.Service):\nMySQL._execute_script(instance, script.remote_path, script.render())\n@staticmethod\n- def install_mysql(instance, distro_name):\n- g.run_script(instance, MySQL.MYSQL_INSTALL_SCRIPT, 'root', distro_name)\n+ def install_mysql(instance, distro_name, distro_version):\n+ g.run_script(instance, MySQL.MYSQL_INSTALL_SCRIPT, 'root', distro_name,\n+ distro_version.split('.')[0])\n" } ]
Python
Apache License 2.0
openstack/sahara
Fix Maria-DB installation for centos7 Closes-Bug: #1658703 Change-Id: If13a2008c1b349b22f2247479f9128987c8fe45b
488,281
20.01.2017 12:50:24
-7,200
793c269925d1a2685ae57cf7288c72b7eb37167d
Add Kafka to MapR plugin Implements: blueprint add-mapr-kafka
[ { "change_type": "ADD", "old_path": null, "new_path": "releasenotes/notes/add-mapr-kafka-3a808bbc1aa21055.yaml", "diff": "+---\n+features:\n+ - Add Kafka to MapR plugin\n" }, { "change_type": "ADD", "old_path": "sahara/plugins/mapr/services/kafka/__init__.py", "new_path": "sahara/plugins/mapr/services/kafka/__init__.py", "diff": "" }, { "change_type": "ADD", "old_path": null, "new_path": "sahara/plugins/mapr/services/kafka/kafka.py", "diff": "+# Copyright (c) 2015, MapR Technologies\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+# not use this file except in compliance with the License. You may obtain\n+# a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+# License for the specific language governing permissions and limitations\n+# under the License.\n+\n+\n+import sahara.plugins.mapr.domain.node_process as np\n+import sahara.plugins.mapr.domain.service as s\n+import sahara.plugins.mapr.util.validation_utils as vu\n+\n+KAFKA = np.NodeProcess(\n+ name='kafka',\n+ ui_name='Kafka',\n+ package='mapr-kafka',\n+ open_ports=[9092]\n+)\n+\n+KAFKA_REST = np.NodeProcess(\n+ name='kafka',\n+ ui_name='Kafka Rest',\n+ package='mapr-kafka-rest',\n+ open_ports=[8082]\n+)\n+\n+KAFKA_CONNECT_HDFS = np.NodeProcess(\n+ name='kafka',\n+ ui_name='Kafka Connect HDFS',\n+ package='mapr-kafka-connect-hdfs'\n+)\n+\n+KAFKA_CONNECT_JDBC = np.NodeProcess(\n+ name='kafka',\n+ ui_name='Kafka Connect JDBC',\n+ package='mapr-kafka-connect-jdbc'\n+)\n+\n+\n+class Kafka(s.Service):\n+ def __init__(self):\n+ super(Kafka, self).__init__()\n+ self._version = '0.9.0'\n+ self._name = 'kafka'\n+ self._ui_name = 'Kafka'\n+ self._node_processes = [KAFKA]\n+\n+\n+class KafkaRest(s.Service):\n+ def __init__(self):\n+ super(KafkaRest, self).__init__()\n+ self._version = '2.0.1'\n+ self._name = 'kafka-eco'\n+ self._ui_name = 'Kafka Rest'\n+ self._node_processes = [KAFKA_REST]\n+ self._validation_rules = [vu.at_least(1, KAFKA)]\n+\n+\n+class KafkaConnect(s.Service):\n+ def __init__(self):\n+ super(KafkaConnect, self).__init__()\n+ self._version = '2.0.1'\n+ self._name = 'kafka-connect'\n+ self._ui_name = 'Kafka Connect'\n+ self._node_processes = [KAFKA_CONNECT_HDFS, KAFKA_CONNECT_JDBC]\n+ self._validation_rules = [vu.at_least(1, KAFKA)]\n" }, { "change_type": "MODIFY", "old_path": "sahara/plugins/mapr/versions/v5_2_0_mrv2/version_handler.py", "new_path": "sahara/plugins/mapr/versions/v5_2_0_mrv2/version_handler.py", "diff": "@@ -21,6 +21,7 @@ from sahara.plugins.mapr.services.hive import hive\nfrom sahara.plugins.mapr.services.httpfs import httpfs\nfrom sahara.plugins.mapr.services.hue import hue\nfrom sahara.plugins.mapr.services.impala import impala\n+from sahara.plugins.mapr.services.kafka import kafka\nfrom sahara.plugins.mapr.services.mahout import mahout\nfrom sahara.plugins.mapr.services.management import management as mng\nfrom sahara.plugins.mapr.services.maprfs import maprfs\n@@ -65,6 +66,9 @@ class VersionHandler(bvh.BaseVersionHandler):\nswift.Swift(),\nsentry.SentryV16(),\nspark.SparkOnYarnV201(),\n+ kafka.Kafka(),\n+ kafka.KafkaConnect(),\n+ kafka.KafkaRest(),\n]\ndef get_context(self, cluster, added=None, removed=None):\n" } ]
Python
Apache License 2.0
openstack/sahara
Add Kafka to MapR plugin Implements: blueprint add-mapr-kafka Change-Id: I2b88cb053f0ff51c2a72bea7acdcfdeacd3df343
488,281
20.01.2017 14:22:55
-7,200
1571ffe60a62a6d08c4f210419f1149cf7cba06a
Remove MapR v5.0.0 Implements: blueprint remove-mapr-500
[ { "change_type": "ADD", "old_path": null, "new_path": "releasenotes/notes/remove-mapr-500-3df3041be99a864c.yaml", "diff": "+---\n+deprecations:\n+ - Removed support for the MapR 5.0.0 plugin.\n" }, { "change_type": "MODIFY", "old_path": "sahara/plugins/mapr/plugin.py", "new_path": "sahara/plugins/mapr/plugin.py", "diff": "@@ -39,10 +39,7 @@ class MapRPlugin(p.ProvisioningPluginBase):\n'plugin_labels': {'enabled': {'status': True}},\n'version_labels': {\n'5.2.0.mrv2': {'enabled': {'status': True}},\n- '5.1.0.mrv2': {'enabled': {'status': True},\n- 'deprecated': {'status': True}},\n- '5.0.0.mrv2': {'enabled': {'status': False},\n- 'deprecated': {'status': True}}\n+ '5.1.0.mrv2': {'enabled': {'status': False}},\n}\n}\n" }, { "change_type": "DELETE", "old_path": "sahara/plugins/mapr/versions/v5_0_0_mrv2/__init__.py", "new_path": "sahara/plugins/mapr/versions/v5_0_0_mrv2/__init__.py", "diff": "" }, { "change_type": "DELETE", "old_path": "sahara/plugins/mapr/versions/v5_0_0_mrv2/context.py", "new_path": null, "diff": "-# Copyright (c) 2015, MapR Technologies\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n-# not use this file except in compliance with the License. You may obtain\n-# a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n-# License for the specific language governing permissions and limitations\n-# under the License.\n-\n-\n-import sahara.plugins.mapr.base.base_cluster_context as bc\n-import sahara.plugins.mapr.services.yarn.yarn as yarn\n-\n-\n-class Context(bc.BaseClusterContext):\n- def __init__(self, cluster, version_handler, added=None, removed=None):\n- super(Context, self).__init__(cluster, version_handler, added, removed)\n- self._hadoop_version = yarn.YARNv270().version\n- self._hadoop_lib = None\n- self._hadoop_conf = None\n- self._cluster_mode = yarn.YARNv270.cluster_mode\n- self._node_aware = True\n- self._resource_manager_uri = \"maprfs:///\"\n- self._mapr_version = \"5.0.0\"\n- self._ubuntu_ecosystem_repo = (\n- \"http://package.mapr.com/releases/ecosystem-5.x/ubuntu binary/\")\n- self._centos_ecosystem_repo = (\n- \"http://package.mapr.com/releases/ecosystem-5.x/redhat\")\n-\n- @property\n- def hadoop_lib(self):\n- if not self._hadoop_lib:\n- self._hadoop_lib = \"%s/share/hadoop/common\" % self.hadoop_home\n- return self._hadoop_lib\n-\n- @property\n- def hadoop_conf(self):\n- if not self._hadoop_conf:\n- self._hadoop_conf = \"%s/etc/hadoop\" % self.hadoop_home\n- return self._hadoop_conf\n-\n- @property\n- def resource_manager_uri(self):\n- return self._resource_manager_uri\n-\n- @property\n- def configure_sh(self):\n- if not self._configure_sh:\n- configure_sh_template = \"%(base)s -HS %(history_server)s\"\n- args = {\n- \"base\": super(Context, self).configure_sh,\n- \"history_server\": self.get_historyserver_ip(),\n- }\n- self._configure_sh = configure_sh_template % args\n- return self._configure_sh\n" }, { "change_type": "DELETE", "old_path": "sahara/plugins/mapr/versions/v5_0_0_mrv2/version_handler.py", "new_path": null, "diff": "-# Copyright (c) 2015, MapR Technologies\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n-# not use this file except in compliance with the License. You may obtain\n-# a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n-# License for the specific language governing permissions and limitations\n-# under the License.\n-\n-\n-import sahara.plugins.mapr.base.base_version_handler as bvh\n-from sahara.plugins.mapr.services.drill import drill\n-from sahara.plugins.mapr.services.flume import flume\n-from sahara.plugins.mapr.services.hbase import hbase\n-from sahara.plugins.mapr.services.hive import hive\n-from sahara.plugins.mapr.services.httpfs import httpfs\n-from sahara.plugins.mapr.services.hue import hue\n-from sahara.plugins.mapr.services.impala import impala\n-from sahara.plugins.mapr.services.mahout import mahout\n-from sahara.plugins.mapr.services.management import management as mng\n-from sahara.plugins.mapr.services.maprfs import maprfs\n-from sahara.plugins.mapr.services.oozie import oozie\n-from sahara.plugins.mapr.services.pig import pig\n-from sahara.plugins.mapr.services.spark import spark\n-from sahara.plugins.mapr.services.sqoop import sqoop2\n-from sahara.plugins.mapr.services.swift import swift\n-from sahara.plugins.mapr.services.yarn import yarn\n-import sahara.plugins.mapr.versions.v5_0_0_mrv2.context as c\n-\n-\n-version = \"5.0.0.mrv2\"\n-\n-\n-class VersionHandler(bvh.BaseVersionHandler):\n- def __init__(self):\n- super(VersionHandler, self).__init__()\n- self._version = version\n- self._required_services = [\n- yarn.YARNv270(),\n- maprfs.MapRFS(),\n- mng.Management(),\n- oozie.Oozie(),\n- ]\n- self._services = [\n- hive.HiveV013(),\n- hive.HiveV10(),\n- hive.HiveV12(),\n- impala.ImpalaV141(),\n- pig.PigV014(),\n- pig.PigV015(),\n- flume.FlumeV15(),\n- flume.FlumeV16(),\n- spark.SparkOnYarn(),\n- sqoop2.Sqoop2(),\n- mahout.MahoutV010(),\n- oozie.OozieV410(),\n- oozie.OozieV420(),\n- hue.HueV370(),\n- hue.HueV381(),\n- hue.HueV390(),\n- hbase.HBaseV0989(),\n- hbase.HBaseV09812(),\n- drill.DrillV11(),\n- drill.DrillV14(),\n- yarn.YARNv270(),\n- maprfs.MapRFS(),\n- mng.Management(),\n- httpfs.HttpFS(),\n- swift.Swift(),\n- ]\n-\n- def get_context(self, cluster, added=None, removed=None):\n- return c.Context(cluster, self, added, removed)\n" }, { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/mapr/test_base_handler.py", "new_path": "sahara/tests/unit/plugins/mapr/test_base_handler.py", "diff": "@@ -20,7 +20,7 @@ from sahara.plugins.mapr.services.management import management\nfrom sahara.plugins.mapr.services.maprfs import maprfs\nfrom sahara.plugins.mapr.services.oozie import oozie\nfrom sahara.plugins.mapr.services.yarn import yarn\n-import sahara.plugins.mapr.versions.v5_0_0_mrv2.version_handler as handler\n+import sahara.plugins.mapr.versions.v5_2_0_mrv2.version_handler as handler\nfrom sahara.plugins import provisioning as p\nfrom sahara.tests.unit import base as b\nfrom sahara.tests.unit import testutils as tu\n@@ -56,7 +56,7 @@ class TestHandler(b.SaharaTestCase):\nname='test_cluster',\ntenant='large',\nplugin='mapr',\n- version='5.0.0.mrv2',\n+ version='5.2.0.mrv2',\nnode_groups=[master_ng],\ncluster_configs=cluster_configs,\n)\n@@ -94,7 +94,6 @@ class TestHandler(b.SaharaTestCase):\nfor conf in version_configs:\nself.assertIsInstance(conf, p.Config)\nself.assertNotEqual(0, len(conf.config_values))\n- self.assertNotEqual(1, len(conf.config_values))\nself.assertEqual('dropdown', conf.config_type)\ndef test_get_configs_dict(self):\n" }, { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/mapr/test_cluster_context.py", "new_path": "sahara/tests/unit/plugins/mapr/test_cluster_context.py", "diff": "@@ -21,8 +21,8 @@ from sahara.plugins.mapr.services.maprfs import maprfs\nfrom sahara.plugins.mapr.services.oozie import oozie\nfrom sahara.plugins.mapr.services.swift import swift\nfrom sahara.plugins.mapr.services.yarn import yarn\n-import sahara.plugins.mapr.versions.v5_0_0_mrv2.context as cc\n-import sahara.plugins.mapr.versions.v5_0_0_mrv2.version_handler as handler\n+import sahara.plugins.mapr.versions.v5_2_0_mrv2.context as cc\n+import sahara.plugins.mapr.versions.v5_2_0_mrv2.version_handler as handler\nfrom sahara.plugins import provisioning as p\nfrom sahara.tests.unit import base as b\nfrom sahara.tests.unit import testutils as tu\n@@ -56,14 +56,14 @@ class TestClusterContext(b.SaharaTestCase):\n'Service Version': '1.1',\n},\n'Oozie': {\n- 'Oozie Version': '4.1.0',\n+ 'Oozie Version': '4.2.0',\n}\n}\ncluster = tu.create_cluster(\nname='test_cluster',\ntenant='large',\nplugin='mapr',\n- version='5.0.0.mrv2',\n+ version='5.2.0.mrv2',\nnode_groups=[master_ng],\ncluster_configs=cluster_configs,\n)\n@@ -281,4 +281,4 @@ class TestClusterContext(b.SaharaTestCase):\nself.assertTrue(cluster_context.is_present(oozie.Oozie()))\nself.assertFalse(cluster_context.is_present(oozie.OozieV401()))\n- self.assertTrue(cluster_context.is_present(oozie.OozieV410()))\n+ self.assertTrue(cluster_context.is_present(oozie.OozieV420()))\n" } ]
Python
Apache License 2.0
openstack/sahara
Remove MapR v5.0.0 Implements: blueprint remove-mapr-500 Change-Id: If45c3cd3639bb9184ea09bfd9aa96187aed8f9f4
488,281
01.02.2017 22:00:51
-7,200
26d6939518edc0a7168b10bf085d7f8a4cd7100c
Fix unexpected removing of deprecating flag for MapR 5.1
[ { "change_type": "MODIFY", "old_path": "sahara/plugins/mapr/plugin.py", "new_path": "sahara/plugins/mapr/plugin.py", "diff": "@@ -39,7 +39,8 @@ class MapRPlugin(p.ProvisioningPluginBase):\n'plugin_labels': {'enabled': {'status': True}},\n'version_labels': {\n'5.2.0.mrv2': {'enabled': {'status': True}},\n- '5.1.0.mrv2': {'enabled': {'status': False}},\n+ '5.1.0.mrv2': {'enabled': {'status': False},\n+ 'deprecated': {'status': True}},\n}\n}\n" } ]
Python
Apache License 2.0
openstack/sahara
Fix unexpected removing of deprecating flag for MapR 5.1 Change-Id: I1623b6c3fbc847cf66fbfdacf2c8efa584e56063
488,275
31.01.2017 10:29:08
0
c9681132a78267d017d175fa7386c13bcea1a63d
Replacement of project name in api-ref. The keystone resource was renamed from 'tenant' to 'project', this patch replaces 'tenant' with 'project' in api-ref documents of sahara. Closes-Bug:
[ { "change_type": "MODIFY", "old_path": "api-ref/source/cluster-templates.inc", "new_path": "api-ref/source/cluster-templates.inc", "diff": "@@ -13,7 +13,7 @@ template.\nShow cluster template details\n=============================\n-.. rest_method:: GET /v1.1/{tenant_id}/cluster-templates/{cluster_template_id}\n+.. rest_method:: GET /v1.1/{project_id}/cluster-templates/{cluster_template_id}\nShows details for a cluster template.\n@@ -26,7 +26,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_template_id: cluster_template_id\n@@ -67,7 +67,7 @@ Response Example\nUpdate cluster templates\n========================\n-.. rest_method:: PUT /v1.1/{tenant_id}/cluster-templates/{cluster_template_id}\n+.. rest_method:: PUT /v1.1/{project_id}/cluster-templates/{cluster_template_id}\nUpdates a cluster template.\n@@ -79,7 +79,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_template_id: cluster_template_id\nRequest Example\n@@ -120,7 +120,7 @@ Response Parameters\nDelete cluster template\n=======================\n-.. rest_method:: DELETE /v1.1/{tenant_id}/cluster-templates/{cluster_template_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/cluster-templates/{cluster_template_id}\nDeletes a cluster template.\n@@ -132,7 +132,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_template_id: cluster_template_id\n@@ -143,7 +143,7 @@ Request\nList cluster templates\n======================\n-.. rest_method:: GET /v1.1/{tenant_id}/cluster-templates\n+.. rest_method:: GET /v1.1/{project_id}/cluster-templates\nLists available cluster templates.\n@@ -156,7 +156,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- limit: limit\n- marker: marker\n- sort_by: sort_by_cluster_templates\n@@ -191,7 +191,7 @@ Response Parameters\nResponse Example\n----------------\n-.. rest_method:: GET /v1.1/{tenant_id}/cluster-templates?limit=2\n+.. rest_method:: GET /v1.1/{project_id}/cluster-templates?limit=2\n.. literalinclude:: samples/cluster-templates/cluster-templates-list-response.json\n:language: javascript\n@@ -202,7 +202,7 @@ Response Example\nCreate cluster templates\n========================\n-.. rest_method:: POST /v1.1/{tenant_id}/cluster-templates\n+.. rest_method:: POST /v1.1/{project_id}/cluster-templates\nCreates a cluster template.\n@@ -214,7 +214,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: tenant_id\n+ - project_id: project_id\nRequest Example\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/clusters.inc", "new_path": "api-ref/source/clusters.inc", "diff": "@@ -10,7 +10,7 @@ A cluster is a group of nodes with the same configuration.\nList available clusters\n=======================\n-.. rest_method:: GET /v1.1/{tenant_id}/clusters\n+.. rest_method:: GET /v1.1/{project_id}/clusters\nLists available clusters.\n@@ -23,7 +23,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- limit: limit\n- marker: marker\n- sort_by: sort_by_clusters\n@@ -55,7 +55,7 @@ Response Parameters\nResponse Example\n----------------\n-.. rest_method:: GET /v1.1/{tenant_id}/clusters\n+.. rest_method:: GET /v1.1/{project_id}/clusters\n.. literalinclude:: samples/clusters/clusters-list-response.json\n:language: javascript\n@@ -66,7 +66,7 @@ Response Example\nCreate cluster\n==============\n-.. rest_method:: POST /v1.1/{tenant_id}/clusters\n+.. rest_method:: POST /v1.1/{project_id}/clusters\nCreates a cluster.\n@@ -78,7 +78,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\nRequest Example\n@@ -113,7 +113,7 @@ Response Parameters\nCreate multiple clusters\n========================\n-.. rest_method:: POST /v1.1/{tenant_id}/clusters/multiple\n+.. rest_method:: POST /v1.1/{project_id}/clusters/multiple\nCreates multiple clusters.\n@@ -125,7 +125,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\nRequest Example\n@@ -143,7 +143,7 @@ Request Example\nShow details of a cluster\n=========================\n-.. rest_method:: GET /v1.1/{tenant_id}/clusters/{cluster_id}\n+.. rest_method:: GET /v1.1/{project_id}/clusters/{cluster_id}\nShows details for a cluster, by ID.\n@@ -156,7 +156,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_id: cluster_id\n@@ -191,7 +191,7 @@ Response Example\nDelete a cluster\n================\n-.. rest_method:: DELETE /v1.1/{tenant_id}/clusters/{cluster_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/clusters/{cluster_id}\nDeletes a cluster.\n@@ -203,7 +203,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_id: cluster_id\n@@ -214,7 +214,7 @@ Request\nScale cluster\n=============\n-.. rest_method:: PUT /v1.1/{tenant_id}/clusters/{cluster_id}\n+.. rest_method:: PUT /v1.1/{project_id}/clusters/{cluster_id}\nScales a cluster.\n@@ -226,7 +226,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_id: cluster_id\nRequest Example\n@@ -260,7 +260,7 @@ Response Parameters\nUpdate cluster\n==============\n-.. rest_method:: PATCH /v1.1/{tenant_id}/clusters/{cluster_id}\n+.. rest_method:: PATCH /v1.1/{project_id}/clusters/{cluster_id}\nUpdates a cluster.\n@@ -272,7 +272,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_id: cluster_id\nRequest Example\n@@ -306,7 +306,7 @@ Response Parameters\nShow progress\n=============\n-.. rest_method:: GET /v1.1/{tenant_id}/clusters/{cluster_id}\n+.. rest_method:: GET /v1.1/{project_id}/clusters/{cluster_id}\nShows provisioning progress for a cluster.\n@@ -319,7 +319,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_id: cluster_id\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/data-sources.inc", "new_path": "api-ref/source/data-sources.inc", "diff": "@@ -14,7 +14,7 @@ locations.\nShow data source details\n========================\n-.. rest_method:: GET /v1.1/{tenant_id}/data-sources/{data_source_id}\n+.. rest_method:: GET /v1.1/{project_id}/data-sources/{data_source_id}\nShows details for a data source.\n@@ -27,7 +27,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- data_source_id: data_source_id\n@@ -61,7 +61,7 @@ Response Example\nDelete data source\n==================\n-.. rest_method:: DELETE /v1.1/{tenant_id}/data-sources/{data_source_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/data-sources/{data_source_id}\nDeletes a data source.\n@@ -73,7 +73,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- data_source_id: data_source_id\n@@ -84,7 +84,7 @@ Request\nUpdate data source\n==================\n-.. rest_method:: PUT /v1.1/{tenant_id}/data-sources/{data_source_id}\n+.. rest_method:: PUT /v1.1/{project_id}/data-sources/{data_source_id}\nUpdates a data source.\n@@ -96,7 +96,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- data_source_id: data_source_id\nRequest Example\n@@ -114,7 +114,7 @@ Request Example\nList data sources\n=================\n-.. rest_method:: GET /v1.1/{tenant_id}/data-sources\n+.. rest_method:: GET /v1.1/{project_id}/data-sources\nLists all data sources.\n@@ -127,7 +127,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- limit: limit\n- marker: marker\n- sort_by: sort_by_data_sources\n@@ -157,7 +157,7 @@ Response Parameters\nResponse Example\n----------------\n-.. rest_method:: GET /v1.1/{tenant-id}/data-sourses?sort_by=-name\n+.. rest_method:: GET /v1.1/{project_id}/data-sourses?sort_by=-name\n.. literalinclude:: samples/data-sources/data-sources-list-response.json\n:language: javascript\n@@ -168,7 +168,7 @@ Response Example\nCreate data source\n==================\n-.. rest_method:: POST /v1.1/{tenant_id}/data-sources\n+.. rest_method:: POST /v1.1/{project_id}/data-sources\nCreates a data source.\n@@ -180,7 +180,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\nRequest Example\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/event-log.inc", "new_path": "api-ref/source/event-log.inc", "diff": "@@ -12,7 +12,7 @@ reason for the failure.\nShow progress\n=============\n-.. rest_method:: GET /v1.1/{tenant_id}/clusters/{cluster_id}\n+.. rest_method:: GET /v1.1/{project_id}/clusters/{cluster_id}\nShows provisioning progress of cluster.\n@@ -26,7 +26,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- cluster_id: cluster_id\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/image-registry.inc", "new_path": "api-ref/source/image-registry.inc", "diff": "@@ -14,7 +14,7 @@ name with which to log in to the operating system for an instance.\nAdd tags to image\n=================\n-.. rest_method:: POST /v1.1/{tenant_id}/images/{image_id}/tag\n+.. rest_method:: POST /v1.1/{project_id}/images/{image_id}/tag\nAdds tags to an image.\n@@ -26,7 +26,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- tags: tags\n- image_id: image_id\n@@ -45,7 +45,7 @@ Request Example\nShow image details\n==================\n-.. rest_method:: GET /v1.1/{tenant_id}/images/{image_id}\n+.. rest_method:: GET /v1.1/{project_id}/images/{image_id}\nShows details for an image.\n@@ -58,7 +58,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- image_id: image_id\n@@ -95,7 +95,7 @@ Response Example\nRegister image\n==============\n-.. rest_method:: POST /v1.1/{tenant_id}/images/{image_id}\n+.. rest_method:: POST /v1.1/{project_id}/images/{image_id}\nRegisters an image in the registry.\n@@ -107,7 +107,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- username: username\n- description: description\n- image_id: image_id\n@@ -146,7 +146,7 @@ Response Parameters\nUnregister image\n================\n-.. rest_method:: DELETE /v1.1/{tenant_id}/images/{image_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/images/{image_id}\nRemoves an image from the registry.\n@@ -158,7 +158,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- image_id: image_id\n@@ -169,7 +169,7 @@ Request\nRemove tags from image\n======================\n-.. rest_method:: POST /v1.1/{tenant_id}/images/{image_id}/untag\n+.. rest_method:: POST /v1.1/{project_id}/images/{image_id}/untag\nRemoves tags from an image.\n@@ -181,7 +181,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- tags: tags\n- image_id: image_id\n@@ -200,7 +200,7 @@ Request Example\nList images\n===========\n-.. rest_method:: GET /v1.1/{tenant_id}/images\n+.. rest_method:: GET /v1.1/{project_id}/images\nLists all images registered in the registry.\n@@ -213,7 +213,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- tags: tags\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/job-binaries.inc", "new_path": "api-ref/source/job-binaries.inc", "diff": "@@ -12,7 +12,7 @@ Object Storage service.\nList job binaries\n=================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-binaries\n+.. rest_method:: GET /v1.1/{project_id}/job-binaries\nLists the available job binaries.\n@@ -25,7 +25,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- limit: limit\n- marker: marker\n- sort_by: sort_by_job_binary\n@@ -55,7 +55,7 @@ Response Parameters\nResponse Example\n----------------\n-.. rest_method:: GET /v1.1/{tenant_id}/job-binaries?sort_by=created_at\n+.. rest_method:: GET /v1.1/{project_id}/job-binaries?sort_by=created_at\n.. literalinclude:: samples/job-binaries/list-response.json\n:language: javascript\n@@ -66,7 +66,7 @@ Response Example\nCreate job binary\n=================\n-.. rest_method:: POST /v1.1/{tenant_id}/job-binaries\n+.. rest_method:: POST /v1.1/{project_id}/job-binaries\nCreates a job binary.\n@@ -78,7 +78,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\nRequest Example\n@@ -111,7 +111,7 @@ Response Parameters\nShow job binary details\n=======================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-binaries/{job_binary_id}\n+.. rest_method:: GET /v1.1/{project_id}/job-binaries/{job_binary_id}\nShows details for a job binary.\n@@ -124,7 +124,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n@@ -157,7 +157,7 @@ Response Example\nDelete job binary\n=================\n-.. rest_method:: DELETE /v1.1/{tenant_id}/job-binaries/{job_binary_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/job-binaries/{job_binary_id}\nDeletes a job binary.\n@@ -170,7 +170,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n@@ -180,7 +180,7 @@ Request\nUpdate job binary\n=================\n-.. rest_method:: PUT /v1.1/{tenant_id}/job-binaries/{job_binary_id}\n+.. rest_method:: PUT /v1.1/{project_id}/job-binaries/{job_binary_id}\nUpdates a job binary.\n@@ -193,7 +193,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\nRequest Example\n@@ -211,7 +211,7 @@ Request Example\nShow job binary data\n====================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-binaries/{job_binary_id}/data\n+.. rest_method:: GET /v1.1/{project_id}/job-binaries/{job_binary_id}/data\nShows data for a job binary.\n@@ -240,7 +240,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_binary_id: job_binary_id\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/job-binary-internals.inc", "new_path": "api-ref/source/job-binary-internals.inc", "diff": "@@ -11,7 +11,7 @@ and libraries that are stored in the internal database.\nCreate job binary internal\n==========================\n-.. rest_method:: PUT /v1.1/{tenant_id}/job-binary-internals/{name}\n+.. rest_method:: PUT /v1.1/{project_id}/job-binary-internals/{name}\nCreates a job binary internal.\n@@ -30,7 +30,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- name: name\n@@ -55,7 +55,7 @@ Response Parameters\nShow job binary internal data\n=============================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-binary-internals/{job_binary_internals_id}/data\n+.. rest_method:: GET /v1.1/{project_id}/job-binary-internals/{job_binary_internals_id}/data\nShows data for a job binary internal.\n@@ -84,7 +84,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_binary_internals_id: job_binary_internals_id\n@@ -109,7 +109,7 @@ Response Example\nShow job binary internal details\n================================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-binary-internals/{job_binary_internals_id}\n+.. rest_method:: GET /v1.1/{project_id}/job-binary-internals/{job_binary_internals_id}\nShows details for a job binary internal.\n@@ -122,7 +122,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_binary_internals_id: job_binary_internals_id\n@@ -154,7 +154,7 @@ Response Example\nDelete job binary internal\n==========================\n-.. rest_method:: DELETE /v1.1/{tenant_id}/job-binary-internals/{job_binary_internals_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/job-binary-internals/{job_binary_internals_id}\nDeletes a job binary internal.\n@@ -166,7 +166,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_binary_internals_id: job_binary_internals_id\n@@ -177,7 +177,7 @@ Request\nUpdate job binary internal\n==========================\n-.. rest_method:: PATCH /v1.1/{tenant_id}/job-binary-internals/{job_binary_internals_id}\n+.. rest_method:: PATCH /v1.1/{project_id}/job-binary-internals/{job_binary_internals_id}\nUpdates a job binary internal.\n@@ -189,7 +189,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_binary_internals_id: job_binary_internals_id\nRequest Example\n@@ -207,7 +207,7 @@ Request Example\nList job binary internals\n=========================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-binary-internals\n+.. rest_method:: GET /v1.1/{project_id}/job-binary-internals\nLists the available job binary internals.\n@@ -220,7 +220,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- limit: limit\n- marker: marker\n- sort_by: sort_by_job_binary_internals\n@@ -249,7 +249,7 @@ Response Parameters\nResponse Example\n----------------\n-.. rest_method:: GET /v1.1/{tenant_id}/job-binary-internals\n+.. rest_method:: GET /v1.1/{project_id}/job-binary-internals\n.. literalinclude:: samples/job-binary-internals/list-response.json\n:language: javascript\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/job-executions.inc", "new_path": "api-ref/source/job-executions.inc", "diff": "@@ -12,7 +12,7 @@ reports it to the user. Also a user can cancel a running job.\nRefresh job execution status\n============================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-executions/{job_execution_id}/refresh-status\n+.. rest_method:: GET /v1.1/{project_id}/job-executions/{job_execution_id}/refresh-status\nRefreshes the status of and shows information for a job execution.\n@@ -25,7 +25,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_execution_id: job_execution_id\n@@ -69,7 +69,7 @@ Response Example\nList job executions\n===================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-executions\n+.. rest_method:: GET /v1.1/{project_id}/job-executions\nLists available job executions.\n@@ -82,7 +82,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- limit: limit\n- marker: marker\n- sort_by: sort_by_job_execution\n@@ -123,7 +123,7 @@ Response Parameters\nResponse Example\n----------------\n-.. rest_method:: /v1.1/{tenant_id}/job-executions\n+.. rest_method:: /v1.1/{project_id}/job-executions\n.. literalinclude:: samples/job-executions/list-response.json\n:language: javascript\n@@ -134,7 +134,7 @@ Response Example\nShow job execution details\n==========================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-executions/{job_execution_id}\n+.. rest_method:: GET /v1.1/{project_id}/job-executions/{job_execution_id}\nShows details for a job execution, by ID.\n@@ -147,7 +147,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_execution_id: job_execution_id\n@@ -191,7 +191,7 @@ Response Example\nDelete job execution\n====================\n-.. rest_method:: DELETE /v1.1/{tenant_id}/job-executions/{job_execution_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/job-executions/{job_execution_id}\nDeletes a job execution.\n@@ -203,7 +203,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_execution_id: job_execution_id\n@@ -214,7 +214,7 @@ Request\nUpdate job execution\n====================\n-.. rest_method:: PATCH /v1.1/{tenant_id}/job-executions/{job_execution_id}\n+.. rest_method:: PATCH /v1.1/{project_id}/job-executions/{job_execution_id}\nUpdates a job execution.\n@@ -226,7 +226,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_execution_id: job_execution_id\nRequest Example\n@@ -270,7 +270,7 @@ Response Parameters\nCancel job execution\n====================\n-.. rest_method:: GET /v1.1/{tenant_id}/job-executions/{job_execution_id}/cancel\n+.. rest_method:: GET /v1.1/{project_id}/job-executions/{job_execution_id}/cancel\nCancels a job execution.\n@@ -283,7 +283,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_execution_id: job_execution_id\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/job-types.inc", "new_path": "api-ref/source/job-types.inc", "diff": "@@ -15,7 +15,7 @@ job types and how to configure the job types.\nList job types\n==============\n-.. rest_method:: GET /v1.1/{tenant_id}/job-types\n+.. rest_method:: GET /v1.1/{project_id}/job-types\nLists all job types.\n@@ -31,7 +31,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- plugin: plugin\n- version: version\n- type: type\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/jobs.inc", "new_path": "api-ref/source/jobs.inc", "diff": "@@ -13,7 +13,7 @@ You can run a job on an existing or new transient cluster.\nRun job\n=======\n-.. rest_method:: POST /v1.1/{tenant_id}/jobs/{job_id}/execute\n+.. rest_method:: POST /v1.1/{project_id}/jobs/{job_id}/execute\nRuns a job.\n@@ -25,7 +25,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_id: job_id\nRequest Example\n@@ -43,7 +43,7 @@ Request Example\nList jobs\n=========\n-.. rest_method:: GET /v1.1/{tenant_id}/jobs\n+.. rest_method:: GET /v1.1/{project_id}/jobs\nLists all jobs.\n@@ -56,7 +56,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- limit: limit\n- marker: marker\n- sort_by: sort_by_jobs\n@@ -88,7 +88,7 @@ Response Parameters\nResponse Example\n----------------\n-..rest_method:: GET /v1.1/{tenant_id}/jobs?limit=2\n+..rest_method:: GET /v1.1/{project_id}/jobs?limit=2\n.. literalinclude:: samples/jobs/jobs-list-response.json\n:language: javascript\n@@ -99,7 +99,7 @@ Response Example\nCreate job\n==========\n-.. rest_method:: POST /v1.1/{tenant_id}/jobs\n+.. rest_method:: POST /v1.1/{project_id}/jobs\nCreates a job object.\n@@ -111,7 +111,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\nRequest Example\n@@ -147,7 +147,7 @@ Response Parameters\nShow job details\n================\n-.. rest_method:: GET /v1.1/{tenant_id}/jobs/{job_id}\n+.. rest_method:: GET /v1.1/{project_id}/jobs/{job_id}\nShows details for a job.\n@@ -160,7 +160,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_id: job_id\n@@ -196,7 +196,7 @@ Response Example\nRemove job\n==========\n-.. rest_method:: DELETE /v1.1/{tenant_id}/jobs/{job_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/jobs/{job_id}\nRemoves a job.\n@@ -208,7 +208,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_id: job_id\n@@ -219,7 +219,7 @@ Request\nUpdate job object\n=================\n-.. rest_method:: PATCH /v1.1/{tenant_id}/jobs/{job_id}\n+.. rest_method:: PATCH /v1.1/{project_id}/jobs/{job_id}\nUpdates a job object.\n@@ -231,7 +231,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- job_id: job_id\nRequest Example\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/node-group-templates.inc", "new_path": "api-ref/source/node-group-templates.inc", "diff": "@@ -16,7 +16,7 @@ characteristics through an OpenStack flavor.\nList node group templates\n=========================\n-.. rest_method:: GET /v1.1/{tenant_id}/node-group-templates\n+.. rest_method:: GET /v1.1/{project_id}/node-group-templates\nLists available node group templates.\n@@ -29,7 +29,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- limit: limit\n- marker: marker\n- sort_by: sort_by_node_groups\n@@ -77,7 +77,7 @@ Response Parameters\nResponse Example\n----------------\n-.. rest_method:: GET /v1.1/{tenant_id}/node-group-templates?limit=2&marker=38b4e146-1d39-4822-bad2-fef1bf304a52&sort_by=name\n+.. rest_method:: GET /v1.1/{project_id}/node-group-templates?limit=2&marker=38b4e146-1d39-4822-bad2-fef1bf304a52&sort_by=name\n.. literalinclude:: samples/node-group-templates/node-group-templates-list-response.json\n:language: javascript\n@@ -88,7 +88,7 @@ Response Example\nCreate node group template\n==========================\n-.. rest_method:: POST /v1.1/{tenant_id}/node-group-templates\n+.. rest_method:: POST /v1.1/{project_id}/node-group-templates\nCreates a node group template.\n@@ -100,7 +100,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\nRequest Example\n@@ -152,7 +152,7 @@ Response Parameters\nShow node group template details\n================================\n-.. rest_method:: GET /v1.1/{tenant_id}/node-group-templates/{node_group_template_id}\n+.. rest_method:: GET /v1.1/{project_id}/node-group-templates/{node_group_template_id}\nShows a node group template, by ID.\n@@ -165,7 +165,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- node_group_template_id: node_group_template_id\n@@ -218,7 +218,7 @@ Response Example\nDelete node group template\n==========================\n-.. rest_method:: DELETE /v1.1/{tenant_id}/node-group-templates/{node_group_template_id}\n+.. rest_method:: DELETE /v1.1/{project_id}/node-group-templates/{node_group_template_id}\nDeletes a node group template.\n@@ -230,7 +230,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- node_group_template_id: node_group_template_id\n@@ -241,7 +241,7 @@ Request\nUpdate node group template\n==========================\n-.. rest_method:: PUT /v1.1/{tenant_id}/node-group-templates/{node_group_template_id}\n+.. rest_method:: PUT /v1.1/{project_id}/node-group-templates/{node_group_template_id}\nUpdates a node group template.\n@@ -253,7 +253,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- node_group_template_id: node_group_template_id\nRequest Example\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/parameters.yaml", "new_path": "api-ref/source/parameters.yaml", "diff": "@@ -215,9 +215,9 @@ sort_by_node_group_templates:\nrequired: false\ntype: string\n-url_tenant_id:\n+url_project_id:\ndescription: |\n- UUID of the tenant.\n+ UUID of the project.\nin: path\nrequired: true\ntype: string\n@@ -829,6 +829,12 @@ progress:\nin: body\nrequired: true\ntype: integer\n+project_id:\n+ description: |\n+ The UUID of the project.\n+ in: body\n+ required: true\n+ type: string\nprovision_progress:\ndescription: |\nA list of the cluster progresses.\n" }, { "change_type": "MODIFY", "old_path": "api-ref/source/plugins.inc", "new_path": "api-ref/source/plugins.inc", "diff": "@@ -11,7 +11,7 @@ install and which configurations can be set for the cluster.\nShow plugin details\n===================\n-.. rest_method:: GET /v1.1/{tenant_id}/plugins/{plugin_name}\n+.. rest_method:: GET /v1.1/{project_id}/plugins/{plugin_name}\nShows details for a plugin.\n@@ -25,7 +25,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- plugin_name: plugin_name\n@@ -53,7 +53,7 @@ Response Example\nList plugins\n============\n-.. rest_method:: GET /v1.1/{tenant_id}/plugins\n+.. rest_method:: GET /v1.1/{project_id}/plugins\nLists all registered plugins.\n@@ -67,7 +67,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n@@ -96,7 +96,7 @@ Response Example\nShow plugin version details\n===========================\n-.. rest_method:: GET /v1.1/{tenant_id}/plugins/{plugin_name}/{version}\n+.. rest_method:: GET /v1.1/{project_id}/plugins/{plugin_name}/{version}\nShows details for a plugin version.\n@@ -110,7 +110,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- plugin_name: plugin_name\n- version: version\n@@ -139,7 +139,7 @@ Response Example\nUpdate plugin details\n=====================\n-.. rest_method:: PATCH /v1.1/{tenant_id}/plugins/{plugin_name}\n+.. rest_method:: PATCH /v1.1/{project_id}/plugins/{plugin_name}\nUpdates details for a plugin.\n@@ -153,7 +153,7 @@ Request\n.. rest_parameters:: parameters.yaml\n- - tenant_id: url_tenant_id\n+ - project_id: url_project_id\n- plugin_name: plugin_name\n" } ]
Python
Apache License 2.0
openstack/sahara
Replacement of project name in api-ref. The keystone resource was renamed from 'tenant' to 'project', this patch replaces 'tenant' with 'project' in api-ref documents of sahara. Change-Id: I1f41757b3ec90f88926681d4a0b7767764c37c4a Closes-Bug: #1626678
488,286
19.01.2017 15:06:54
-28,800
49c3623ba173e1e32a2fbcb9e1d74e8ded0cde5f
add test_parse_xml_with_name_and_value() Unit tests for utils/xmlutils.py is not completed. parse_xml_with_name_and_value() has not been tested.
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/utils/test_xml_utils.py", "new_path": "sahara/tests/unit/utils/test_xml_utils.py", "diff": "import xml.dom.minidom as xml\n+import pkg_resources as pkg\nimport testtools\nfrom sahara.utils import patches as p\nfrom sahara.utils import xmlutils as x\n+from sahara import version\nclass XMLUtilsTestCase(testtools.TestCase):\n@@ -37,6 +39,21 @@ class XMLUtilsTestCase(testtools.TestCase):\nx.load_hadoop_xml_defaults(\n'tests/unit/resources/test-default.xml'))\n+ def test_parse_xml_with_name_and_value(self):\n+ file_name = 'tests/unit/resources/test-default.xml'\n+ fname = pkg.resource_filename(\n+ version.version_info.package, file_name)\n+ with open(fname, \"r\") as f:\n+ doc = \"\".join(line.strip() for line in f)\n+ self.assertEqual(\n+ [{'name': u'name1', 'value': u'value1'},\n+ {'name': u'name2', 'value': u'value2'},\n+ {'name': u'name3', 'value': ''},\n+ {'name': u'name4', 'value': ''},\n+ {'name': u'name5', 'value': u'value5'}],\n+ x.parse_hadoop_xml_with_name_and_value(doc)\n+ )\n+\ndef test_adjust_description(self):\nself.assertEqual(\"\", x._adjust_field(\"\\n\"))\nself.assertEqual(\"\", x._adjust_field(\"\\n \"))\n" } ]
Python
Apache License 2.0
openstack/sahara
add test_parse_xml_with_name_and_value() Unit tests for utils/xmlutils.py is not completed. parse_xml_with_name_and_value() has not been tested. Change-Id: I57bd1c0ce3fb9a7cdf4756900325626e1a33410d
488,286
07.02.2017 16:26:39
-28,800
6754b1c6f4280103ffb7fc5c7ef22df4ba09a7d8
Add test_move_from_local() Unit tests for service/edp/hdfs_helper.py is not completed. The function move_from_local() has not been tested.
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/service/edp/test_hdfs_helper.py", "new_path": "sahara/tests/unit/service/edp/test_hdfs_helper.py", "diff": "@@ -61,6 +61,12 @@ class HDFSHelperTestCase(base.SaharaTestCase):\nself.cluster.execute_command.assert_called_once_with(\n'sudo su - -c \"hadoop dfs -copyFromLocal Galaxy Earth\" BigBang')\n+ def test_move_from_local(self):\n+ helper.move_from_local(self.cluster, 'Galaxy', 'Earth', 'BigBang')\n+ self.cluster.execute_command.assert_called_once_with(\n+ 'sudo su - -c \"hadoop dfs -copyFromLocal Galaxy Earth\" BigBang '\n+ '&& sudo rm -f Galaxy')\n+\ndef test_create_dir_hadoop1(self):\nhelper.create_dir_hadoop1(self.cluster, 'Earth', 'BigBang')\nself.cluster.execute_command.assert_called_once_with(\n" } ]
Python
Apache License 2.0
openstack/sahara
Add test_move_from_local() Unit tests for service/edp/hdfs_helper.py is not completed. The function move_from_local() has not been tested. Change-Id: I257601f1d3be02e96140a21f282e0ec551cc88db
488,286
08.02.2017 01:09:23
-28,800
65d6c16c3badde9e3d69fdb01aee9b25703aab25
Add test_get_port_from_address() The unit test for plugins/utils.py is not completed. The function get_port_from_address() has not been tested.
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/general/test_utils.py", "new_path": "sahara/tests/unit/plugins/general/test_utils.py", "diff": "@@ -68,6 +68,11 @@ class GeneralUtilsTest(testtools.TestCase):\nu.generate_host_names(self.ng2.instances))\nself.assertEqual(\"\", u.generate_host_names([]))\n+ def test_get_port_from_address(self):\n+ self.assertEqual(8000, u.get_port_from_address(\"0.0.0.0:8000\"))\n+ self.assertEqual(8000,\n+ u.get_port_from_address(\"http://localhost:8000\"))\n+\nclass GetPortUtilsTest(testtools.TestCase):\ndef setUp(self):\n" } ]
Python
Apache License 2.0
openstack/sahara
Add test_get_port_from_address() The unit test for plugins/utils.py is not completed. The function get_port_from_address() has not been tested. Change-Id: Ia951df06b770ae9b655e7d0eb50535ce98611a07
488,286
08.02.2017 14:34:18
-28,800
ef32ecdfa23264c439efb61095c69c68045f4bbe
Add test_add_host_to_cluster() The unit test for plugins/ambari/client.py is not completed. The function add_host_to_cluster() has not been tested.
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/ambari/test_client.py", "new_path": "sahara/tests/unit/plugins/ambari/test_client.py", "diff": "@@ -180,6 +180,22 @@ class AmbariClientTestCase(base.SaharaTestCase):\ndata=jsonutils.dumps({\"some\": \"data\"}), verify=False,\nauth=client._auth, headers=self.headers)\n+ def test_add_host_to_cluster(self):\n+ client = ambari_client.AmbariClient(self.instance)\n+ resp = mock.Mock()\n+ resp.text = \"\"\n+ resp.status_code = 200\n+ self.http_client.post.return_value = resp\n+\n+ instance = mock.MagicMock()\n+ instance.fqdn.return_value = \"i1\"\n+ instance.cluster.name = \"cl\"\n+\n+ client.add_host_to_cluster(instance)\n+ self.http_client.post.assert_called_with(\n+ \"http://1.2.3.4:8080/api/v1/clusters/cl/hosts/i1\",\n+ verify=False, auth=client._auth, headers=self.headers)\n+\ndef test_start_process_on_host(self):\nclient = ambari_client.AmbariClient(self.instance)\nself.http_client.put.return_value = self.good_pending_resp\n" } ]
Python
Apache License 2.0
openstack/sahara
Add test_add_host_to_cluster() The unit test for plugins/ambari/client.py is not completed. The function add_host_to_cluster() has not been tested. Change-Id: I5c29ea9b250c09596cc2b52f3edf516bce5b037a
488,286
10.02.2017 15:08:36
-28,800
a9471e78f29464d464d80b9506f32627003d695c
Add test_get_config_value() Unit test for plugins/cdh/base_plugin_utils.py is not completed. get_config_value() has not been tested. I fix that "cluster_configs" instead of "cluster_config". Because some function actually use "cluster_configs".
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/cdh/base_plugin_utils_test.py", "new_path": "sahara/tests/unit/plugins/cdh/base_plugin_utils_test.py", "diff": "@@ -58,7 +58,7 @@ def get_concrete_cluster():\n\"KS_INDEXER\": {}, \"SPARK_ON_YARN\": {}, \"SENTRY\": {}, \"YARN\": {},\n\"ZOOKEEPER\": {}, \"OOZIE\": {}, \"HBASE\": {}, \"IMPALA\": {}}\n# cluster is immutable, a work around\n- dict.__setitem__(cluster, \"cluster_config\", configs)\n+ dict.__setitem__(cluster, \"cluster_configs\", configs)\n# add fake remotes to instances\ninstances = [i for ng in cluster.node_groups for i in ng.instances]\n@@ -144,7 +144,7 @@ class TestPluginUtils(b.SaharaTestCase):\ndef test_configure_swift(self, log_cfg):\ncluster = get_concrete_cluster()\n- cluster.cluster_config['general']['Enable Swift'] = True\n+ cluster.cluster_configs['general']['Enable Swift'] = True\ninstances = [i for ng in cluster.node_groups for i in ng.instances]\nself.plug_utils.configure_swift(cluster)\n@@ -280,6 +280,15 @@ class TestPluginUtils(b.SaharaTestCase):\n2, {'manager': manager}]\nplugin_option_poll.assert_called_once_with(*call)\n+ def test_get_config_value(self):\n+ cluster = get_concrete_cluster()\n+ dfs_replication = self.plug_utils.get_config_value(\n+ 'HDFS', 'dfs_replication', cluster)\n+ self.assertEqual(1, dfs_replication)\n+ dfs_replication_default = self.plug_utils.get_config_value(\n+ 'HDFS', 'dfs_replication')\n+ self.assertEqual(3, dfs_replication_default)\n+\nclass TestPluginUtilsHigherThanV5(TestPluginUtils):\n" } ]
Python
Apache License 2.0
openstack/sahara
Add test_get_config_value() Unit test for plugins/cdh/base_plugin_utils.py is not completed. get_config_value() has not been tested. I fix that "cluster_configs" instead of "cluster_config". Because some function actually use "cluster_configs". Change-Id: I76003e3a87b5953f1d8c562f2911bb6e7eb3d20e
488,286
10.02.2017 19:11:48
-28,800
988a27652a8cb8fe3548332faf870b2a1212adf0
Add test_get_nodemanagers() The unittest for plugins/vanilla/test_utils.py isn't completed. The function get_nodemanagers() hasn't been tested.
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/vanilla/test_utils.py", "new_path": "sahara/tests/unit/plugins/vanilla/test_utils.py", "diff": "@@ -61,6 +61,18 @@ class TestUtils(base.SaharaWithDbTestCase):\n[self.ng_manager])\nself.assertIsNone(u.get_namenode(cl))\n+ def test_get_nodemanagers(self):\n+ cl = tu.create_cluster('cl1', 't1', 'vanilla', '2.7.1',\n+ [self.ng_manager, self.ng_nodemanager])\n+ nodemanagers = u.get_nodemanagers(cl)\n+ self.assertEqual(2, len(nodemanagers))\n+ self.assertEqual(set(['tt1', 'tt2']),\n+ set([nodemanagers[0].instance_id,\n+ nodemanagers[1].instance_id]))\n+ cl = tu.create_cluster('cl1', 't1', 'vanilla', '2.7.1',\n+ [self.ng_namenode])\n+ self.assertEqual([], u.get_nodemanagers(cl))\n+\ndef test_get_oozie(self):\ncl = tu.create_cluster('cl1', 't1', 'vanilla', '2.7.1',\n[self.ng_manager, self.ng_oozie])\n" } ]
Python
Apache License 2.0
openstack/sahara
Add test_get_nodemanagers() The unittest for plugins/vanilla/test_utils.py isn't completed. The function get_nodemanagers() hasn't been tested. Change-Id: Ib7a9300785025d502ee7bb3d0bb706dbc21f81cb
488,278
10.02.2017 20:15:02
10,800
a3b5f2931208a471a4545f919a1fde3cefc27df1
Improving tests for plugin utils plugins/test_utils.py only tested instances_with_services, now it tests every function from plugins/utils.py. Also, there were two different files testing this utils file: plugins/test_utils.py and plugins/general/test_utils.py, so the general folder was removed in order to keep test folder hierarchy consistent.
[ { "change_type": "DELETE", "old_path": "sahara/tests/unit/plugins/general/__init__.py", "new_path": "sahara/tests/unit/plugins/general/__init__.py", "diff": "" }, { "change_type": "DELETE", "old_path": "sahara/tests/unit/plugins/general/test_utils.py", "new_path": null, "diff": "-# Copyright (c) 2013 Mirantis Inc.\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n-# implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-import testtools\n-\n-from sahara.plugins import exceptions as ex\n-from sahara.plugins import utils as u\n-from sahara.tests.unit import testutils as tu\n-\n-\n-class GeneralUtilsTest(testtools.TestCase):\n- def setUp(self):\n- super(GeneralUtilsTest, self).setUp()\n- i1 = tu.make_inst_dict('i1', 'master')\n- i2 = tu.make_inst_dict('i2', 'worker1')\n- i3 = tu.make_inst_dict('i3', 'worker2')\n- i4 = tu.make_inst_dict('i4', 'worker3')\n- i5 = tu.make_inst_dict('i5', 'sn')\n-\n- ng1 = tu.make_ng_dict(\"master\", \"f1\", [\"jt\", \"nn\"], 1, [i1])\n- ng2 = tu.make_ng_dict(\"workers\", \"f1\", [\"tt\", \"dn\"], 3,\n- [i2, i3, i4])\n- ng3 = tu.make_ng_dict(\"sn\", \"f1\", [\"dn\"], 1, [i5])\n-\n- self.c1 = tu.create_cluster(\"cluster1\", \"tenant1\", \"general\", \"2.6.0\",\n- [ng1, ng2, ng3])\n-\n- self.ng1 = self.c1.node_groups[0]\n- self.ng2 = self.c1.node_groups[1]\n- self.ng3 = self.c1.node_groups[2]\n-\n- def test_get_node_groups(self):\n- self.assertEqual(self.c1.node_groups, u.get_node_groups(self.c1))\n- self.assertEqual([], u.get_node_groups(self.c1, \"wrong-process\"))\n- self.assertEqual([self.ng2, self.ng3],\n- u.get_node_groups(self.c1, 'dn'))\n-\n- def test_get_instances(self):\n- self.assertEqual(5, len(u.get_instances(self.c1)))\n- self.assertEqual([], u.get_instances(self.c1, 'wrong-process'))\n- self.assertEqual(self.ng1.instances,\n- u.get_instances(self.c1, 'nn'))\n- instances = list(self.ng2.instances)\n- instances += self.ng3.instances\n- self.assertEqual(instances, u.get_instances(self.c1, 'dn'))\n-\n- def test_get_instance(self):\n- self.assertIsNone(u.get_instance(self.c1, 'wrong-process'))\n- self.assertEqual(self.ng1.instances[0],\n- u.get_instance(self.c1, 'nn'))\n- with testtools.ExpectedException(ex.InvalidComponentCountException):\n- u.get_instance(self.c1, 'dn')\n-\n- def test_generate_lines_from_list(self):\n- self.assertEqual(\"worker1\\nworker2\\nworker3\",\n- u.generate_host_names(self.ng2.instances))\n- self.assertEqual(\"\", u.generate_host_names([]))\n-\n- def test_get_port_from_address(self):\n- self.assertEqual(8000, u.get_port_from_address(\"0.0.0.0:8000\"))\n- self.assertEqual(8000,\n- u.get_port_from_address(\"http://localhost:8000\"))\n-\n-\n-class GetPortUtilsTest(testtools.TestCase):\n- def setUp(self):\n- super(GetPortUtilsTest, self).setUp()\n- self.test_values = [\n- ('127.0.0.1:11000', 11000),\n- ('http://somehost.com:8080/resource', 8080),\n- ('http://192.168.1.101:10000', 10000),\n- ('mydomain', None),\n- ('domain:5000', 5000)\n- ]\n-\n- def test_get_port_from_address(self):\n- for address, port in self.test_values:\n- self.assertEqual(port, u.get_port_from_address(address))\n" }, { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/test_utils.py", "new_path": "sahara/tests/unit/plugins/test_utils.py", "diff": "# See the License for the specific language governing permissions and\n# limitations under the License.\n+import mock\n+\n+from sahara.plugins import exceptions as ex\nfrom sahara.plugins import utils as pu\nfrom sahara.tests.unit import base as b\n-class FakeInstace(object):\n- def __init__(self, node_processes):\n- self.node_processes = node_processes\n+class FakeInstance(object):\n+ def __init__(self, _id, node_processes=None):\n+ self.id = _id\n+ self.node_processes = node_processes or []\n@property\ndef node_group(self):\nreturn self\n+ def __eq__(self, other):\n+ return self.id == other.id\n+\n+\n+class FakeNodeGroup(object):\n+\n+ def __init__(self, node_processes, instances=None):\n+ self.node_processes = node_processes\n+ self.instances = instances or []\n+ self.count = len(self.instances)\n+\n+ def __eq__(self, other):\n+ return self.node_processes == other.node_processes\n+\nclass TestPluginUtils(b.SaharaTestCase):\n+\n+ def setUp(self):\n+ super(TestPluginUtils, self).setUp()\n+ self.cluster = mock.Mock()\n+ self.cluster.node_groups = [\n+ FakeNodeGroup([\"node_process1\"], [FakeInstance(\"1\")]),\n+ FakeNodeGroup([\"node_process2\"], [FakeInstance(\"2\")]),\n+ FakeNodeGroup([\"node_process3\"], [FakeInstance(\"3\")]),\n+ ]\n+\n+ def test_get_node_groups(self):\n+ res = pu.get_node_groups(self.cluster)\n+ self.assertEqual([\n+ FakeNodeGroup([\"node_process1\"]),\n+ FakeNodeGroup([\"node_process2\"]),\n+ FakeNodeGroup([\"node_process3\"]),\n+ ], res)\n+\n+ res = pu.get_node_groups(self.cluster, \"node_process1\")\n+ self.assertEqual([\n+ FakeNodeGroup([\"node_process1\"])\n+ ], res)\n+\n+ res = pu.get_node_groups(self.cluster, \"node_process\")\n+ self.assertEqual([], res)\n+\n+ def test_get_instances_count(self):\n+ res = pu.get_instances_count(self.cluster)\n+ self.assertEqual(3, res)\n+\n+ res = pu.get_instances_count(self.cluster, \"node_process1\")\n+ self.assertEqual(1, res)\n+\n+ def test_get_instances(self):\n+ res = pu.get_instances(self.cluster)\n+ self.assertEqual([\n+ FakeInstance(\"1\"), FakeInstance(\"2\"), FakeInstance(\"3\")], res)\n+\n+ res = pu.get_instances(self.cluster, \"node_process1\")\n+ self.assertEqual([FakeInstance(\"1\")], res)\n+\n+ def test_get_instance(self):\n+ self.assertRaises(ex.InvalidComponentCountException,\n+ pu.get_instance, self.cluster, None)\n+\n+ res = pu.get_instance(self.cluster, \"node_process\")\n+ self.assertIsNone(res)\n+\n+ res = pu.get_instance(self.cluster, \"node_process1\")\n+ self.assertEqual(FakeInstance(\"1\"), res)\n+\n+ def test_generate_host_names(self):\n+ node = mock.Mock()\n+ node.hostname = mock.Mock(return_value=\"host_name\")\n+\n+ res = pu.generate_host_names([node, node])\n+ self.assertEqual(\"host_name\\nhost_name\", res)\n+\n+ def test_generate_fqdn_host_names(self):\n+ node = mock.Mock()\n+ node.fqdn = mock.Mock(return_value=\"fqdn\")\n+\n+ res = pu.generate_fqdn_host_names([node, node])\n+ self.assertEqual(\"fqdn\\nfqdn\", res)\n+\n+ def test_get_port_from_address(self):\n+\n+ res = pu.get_port_from_address(\"0.0.0.0:8000\")\n+ self.assertEqual(8000, res)\n+\n+ res = pu.get_port_from_address(\"http://localhost:8000/resource\")\n+ self.assertEqual(8000, res)\n+\n+ res = pu.get_port_from_address(\"http://192.168.1.101:10000\")\n+ self.assertEqual(10000, res)\n+\n+ res = pu.get_port_from_address(\"mydomain\")\n+ self.assertIsNone(res)\n+\ndef test_instances_with_services(self):\n- inst = [FakeInstace([\"1\", \"2\", \"3\"]), FakeInstace([\"1\", \"3\"]),\n- FakeInstace([\"1\"]), FakeInstace([\"3\"])]\n+ inst = [FakeInstance(\"1\", [\"nodeprocess1\"]),\n+ FakeInstance(\"2\", [\"nodeprocess2\"])]\n+\n+ node_processes = [\"nodeprocess\"]\n+ res = pu.instances_with_services(inst, node_processes)\n+ self.assertEqual([], res)\n+\n+ node_processes = [\"nodeprocess1\"]\n+ res = pu.instances_with_services(inst, node_processes)\n+ self.assertEqual([FakeInstance(\"1\", [\"nodeprocess1\"])], res)\n+\n+ @mock.patch(\"sahara.plugins.utils.plugins_base\")\n+ def test_get_config_value_or_default(self, mock_plugins_base):\n+ # no config\n+ self.assertRaises(RuntimeError,\n+ pu.get_config_value_or_default)\n+\n+ config = mock.Mock()\n+ config.applicable_target = \"service\"\n+ config.name = \"name\"\n+ config.default_value = \"default_value\"\n+\n+ # cluster has the config\n+ cluster = mock.Mock()\n+ cluster.cluster_configs = {\"service\": {\"name\": \"name\"}}\n+ cluster.plugin_name = \"plugin_name\"\n+ cluster.hadoop_version = \"hadoop_version\"\n+\n+ res = pu.get_config_value_or_default(cluster=cluster,\n+ config=config)\n+ self.assertEqual(\"name\", res)\n+\n+ # node group has the config\n+ cluster.cluster_configs = {}\n+\n+ node_group1 = mock.Mock()\n+ node_group2 = mock.Mock()\n+\n+ node_group1.configuration = mock.Mock(return_value={\"service\": {}})\n+\n+ node_group2.configuration = mock.Mock(\n+ return_value={\"service\": {\"name\": \"name\"}})\n+\n+ cluster.node_groups = [node_group1, node_group2]\n+\n+ res = pu.get_config_value_or_default(cluster=cluster,\n+ config=config)\n+ self.assertEqual(\"name\", res)\n+\n+ # cluster doesn't have the config, neither the node groups\n+ # so it returns the default value\n+ cluster.node_groups = []\n+ res = pu.get_config_value_or_default(cluster=cluster,\n+ config=config)\n+ self.assertEqual(\"default_value\", res)\n+\n+ # no config specified, but there's a config for the plugin\n+ # with this service and name\n+ mock_get_all_configs = mock.Mock(return_value=[config])\n+ mock_plugin = mock.Mock()\n+ mock_plugin.get_all_configs = mock_get_all_configs\n+ mock_get_plugin = mock.Mock(return_value=mock_plugin)\n+ mock_PLUGINS = mock.Mock()\n+ mock_PLUGINS.get_plugin = mock_get_plugin\n+ mock_plugins_base.PLUGINS = mock_PLUGINS\n+\n+ res = pu.get_config_value_or_default(cluster=cluster,\n+ service=\"service\", name=\"name\")\n+ self.assertEqual(\"default_value\", res)\n+\n+ mock_get_plugin.assert_called_once_with(\"plugin_name\")\n+ mock_get_all_configs.assert_called_once_with(\"hadoop_version\")\n+\n+ # no config especified and no existing config for this plugin\n+ # with this service or name\n+ cluster.plugin_name = \"plugin_name2\"\n+ cluster.hadoop_version = \"hadoop_version2\"\n+ self.assertRaises(RuntimeError,\n+ pu.get_config_value_or_default, cluster=cluster,\n+ service=\"newService\", name=\"name\")\n+\n+ mock_get_plugin.assert_called_with(\"plugin_name2\")\n+ self.assertEqual(2, mock_get_plugin.call_count)\n- self.assertEqual(4, len(pu.instances_with_services(inst, [\"1\", \"3\"])))\n- self.assertEqual(1, len(pu.instances_with_services(inst, [\"2\"])))\n- self.assertEqual(3, len(pu.instances_with_services(inst, [\"3\"])))\n- self.assertEqual(0, len(pu.instances_with_services(inst, [\"5\"])))\n+ mock_get_all_configs.assert_called_with(\"hadoop_version2\")\n+ self.assertEqual(2, mock_get_all_configs.call_count)\n" } ]
Python
Apache License 2.0
openstack/sahara
Improving tests for plugin utils plugins/test_utils.py only tested instances_with_services, now it tests every function from plugins/utils.py. Also, there were two different files testing this utils file: plugins/test_utils.py and plugins/general/test_utils.py, so the general folder was removed in order to keep test folder hierarchy consistent. Change-Id: I02f98177b3207dc884c34f160c1edfb77ca57e15
488,278
13.02.2017 21:40:34
10,800
126b3fe7fd46b61f0993f75395a6465d5c5d6162
Adding test_validate() to storm plugin test
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/storm/test_plugin.py", "new_path": "sahara/tests/unit/plugins/storm/test_plugin.py", "diff": "@@ -85,6 +85,61 @@ class StormPluginTest(base.SaharaWithDbTestCase):\nplugin._validate_existing_ng_scaling(cluster,\nsupervisor_id))\n+ @mock.patch(\"sahara.plugins.storm.plugin.utils\")\n+ def test_validate(self, mock_utils):\n+\n+ cluster_data = self._get_cluster('cluster', '0.9.2')\n+ cluster = conductor.cluster_create(context.ctx(), cluster_data)\n+ plugin = pb.PLUGINS.get_plugin(cluster.plugin_name)\n+\n+ # number of nimbus nodes != 1 should raise an exception\n+ fake_ng = mock.Mock()\n+ fake_ng.count = 0\n+ mock_ng = mock.Mock(return_value=[fake_ng])\n+ mock_utils.get_node_groups = mock_ng\n+\n+ self.assertRaises(ex.RequiredServiceMissingException,\n+ plugin.validate, cluster)\n+\n+ mock_ng.assert_called_once_with(cluster, \"nimbus\")\n+\n+ fake_ng.count = 2\n+ self.assertRaises(ex.RequiredServiceMissingException, plugin.validate,\n+ cluster)\n+\n+ mock_ng.assert_called_with(cluster, \"nimbus\")\n+ self.assertEqual(2, mock_ng.call_count)\n+\n+ # no supervisor should raise an exception\n+ fake_nimbus = mock.Mock()\n+ fake_nimbus.count = 1\n+\n+ fake_supervisor = mock.Mock()\n+ fake_supervisor.count = 0\n+\n+ mock_ng = mock.Mock(side_effect=[[fake_nimbus], [fake_supervisor]])\n+ mock_utils.get_node_groups = mock_ng\n+\n+ self.assertRaises(ex.InvalidComponentCountException, plugin.validate,\n+ cluster)\n+\n+ mock_ng.assert_any_call(cluster, \"nimbus\")\n+ mock_ng.assert_any_call(cluster, \"supervisor\")\n+ self.assertEqual(2, mock_ng.call_count)\n+\n+ # one nimbus and one or more supervisors should not raise an exception\n+ fake_nimbus.count = 1\n+ fake_supervisor.count = 2\n+\n+ mock_ng = mock.Mock(side_effect=[[fake_nimbus], [fake_supervisor]])\n+ mock_utils.get_node_groups = mock_ng\n+\n+ plugin.validate(cluster)\n+\n+ mock_ng.assert_any_call(cluster, \"nimbus\")\n+ mock_ng.assert_any_call(cluster, \"supervisor\")\n+ self.assertEqual(2, mock_ng.call_count)\n+\ndef test_validate_additional_ng_scaling(self):\ndata = [\n{'name': 'master',\n" } ]
Python
Apache License 2.0
openstack/sahara
Adding test_validate() to storm plugin test Change-Id: I6fdcfc9f1a67836b267ce2c04c935d26875b9c8d
488,286
14.02.2017 16:45:34
-28,800
a3a551216cb35b0f0e151fa187fc913b08ddb9a9
add test to plugins/ambari/client.py Add missing test for plugins/ambari/client.py. *test_import_credential
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/ambari/test_client.py", "new_path": "sahara/tests/unit/plugins/ambari/test_client.py", "diff": "@@ -95,6 +95,20 @@ class AmbariClientTestCase(base.SaharaTestCase):\n\"http://spam\", verify=False, auth=client._auth,\nheaders=self.headers)\n+ def test_import_credential(self):\n+ resp = mock.Mock()\n+ resp.text = \"\"\n+ resp.status_code = 200\n+ self.http_client.post.return_value = resp\n+ client = ambari_client.AmbariClient(self.instance)\n+\n+ client.import_credential(\"test\", alias=\"credential\",\n+ data={\"some\": \"data\"})\n+ self.http_client.post.assert_called_once_with(\n+ \"http://1.2.3.4:8080/api/v1/clusters/test/credentials/credential\",\n+ verify=False, data=jsonutils.dumps({\"some\": \"data\"}),\n+ auth=client._auth, headers=self.headers)\n+\ndef test_get_registered_hosts(self):\nclient = ambari_client.AmbariClient(self.instance)\nresp_data = \"\"\"{\n" } ]
Python
Apache License 2.0
openstack/sahara
add test to plugins/ambari/client.py Add missing test for plugins/ambari/client.py. *test_import_credential Change-Id: I4ef47bbbf0d8af83d1b9f3f5ff7e9e6bb0d4696d
488,286
16.02.2017 20:29:31
-28,800
f2022ec955574e94e4a5103acb6bb76473b50403
Add missing test to api/middleware/auth_valid.py The class AuthValidatorV2 is not tested. Add: *class AuthValidatorV2Test
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/api/middleware/test_auth_valid.py", "new_path": "sahara/tests/unit/api/middleware/test_auth_valid.py", "diff": "@@ -61,3 +61,50 @@ class AuthValidatorTest(test_base.SaharaTestCase):\nenviron={\"HTTP_X_TENANT_ID\": \"tid2\"})\nres = req.get_response(self.app)\nself.assertEqual(401, res.status_code)\n+\n+\n+class AuthValidatorV2Test(test_base.SaharaTestCase):\n+\n+ @staticmethod\n+ @webob.dec.wsgify\n+ def application(req):\n+ return \"Banana\"\n+\n+ def setUp(self):\n+ super(AuthValidatorV2Test, self).setUp()\n+ self.app = auth_valid.AuthValidatorV2(self.application)\n+\n+ def test_auth_ok(self):\n+ req = webob.Request.blank(\"/v2/tid/clusters\", accept=\"text/plain\",\n+ method=\"GET\",\n+ environ={\"HTTP_X_TENANT_ID\": \"tid\"},\n+ headers={\"OpenStack-Project-ID\": \"tid\"})\n+ res = req.get_response(self.app)\n+ self.assertEqual(200, res.status_code)\n+\n+ def test_auth_ok_without_path(self):\n+ req = webob.Request.blank(\"/\", accept=\"text/plain\", method=\"GET\",\n+ environ={\"HTTP_X_TENANT_ID\": \"tid\"},\n+ headers={\"OpenStack-Project-ID\": \"tid\"})\n+ res = req.get_response(self.app)\n+ self.assertEqual(200, res.status_code)\n+\n+ def test_auth_without_header(self):\n+ req = webob.Request.blank(\"/v2/tid/clusters\", accept=\"text/plain\",\n+ method=\"GET\")\n+ res = req.get_response(self.app)\n+ self.assertEqual(503, res.status_code)\n+\n+ def test_auth_with_wrong_url(self):\n+ req = webob.Request.blank(\"/v2\", accept=\"text/plain\", method=\"GET\",\n+ environ={\"HTTP_X_TENANT_ID\": \"tid\"})\n+ res = req.get_response(self.app)\n+ self.assertEqual(404, res.status_code)\n+\n+ def test_auth_different_tenant(self):\n+ req = webob.Request.blank(\"/v2/tid1/clusters\", accept=\"text/plain\",\n+ method=\"GET\",\n+ environ={\"HTTP_X_TENANT_ID\": \"tid2\"},\n+ headers={\"OpenStack-Project-ID\": \"tid\"})\n+ res = req.get_response(self.app)\n+ self.assertEqual(401, res.status_code)\n" } ]
Python
Apache License 2.0
openstack/sahara
Add missing test to api/middleware/auth_valid.py The class AuthValidatorV2 is not tested. Add: *class AuthValidatorV2Test Change-Id: I48f76a4055ae8627aa6411a0ddc9d1c3d5a1fc73
488,278
10.02.2017 09:17:47
10,800
edea05fd5051acb040e2df0150a245ac688b23b4
Adding missing tests to ambari test_client Adding: * test_get_alerts_data() * test_check_response() * test_req_id()
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/ambari/test_client.py", "new_path": "sahara/tests/unit/plugins/ambari/test_client.py", "diff": "@@ -109,6 +109,76 @@ class AmbariClientTestCase(base.SaharaTestCase):\nverify=False, data=jsonutils.dumps({\"some\": \"data\"}),\nauth=client._auth, headers=self.headers)\n+ @mock.patch(\"sahara.plugins.ambari.client.AmbariClient.check_response\")\n+ def test_get_alerts_data(self, mock_check_response):\n+ cluster = mock.Mock()\n+ cluster.name = \"test_cluster\"\n+\n+ client = ambari_client.AmbariClient(self.instance)\n+\n+ # check_response returning empty json\n+ mock_check_response.return_value = {}\n+\n+ res = client.get_alerts_data(cluster)\n+ self.assertEqual(res, [])\n+\n+ self.http_client.get.assert_called_once_with(\n+ \"http://1.2.3.4:8080/api/v1/clusters/test_cluster/alerts?fields=*\",\n+ verify=False, auth=client._auth,\n+ headers=self.headers)\n+\n+ mock_check_response.assert_called_once()\n+\n+ # check_response returning json with items as key\n+ mock_check_response.return_value = {'items': ['item1', 'item2']}\n+\n+ res = client.get_alerts_data(cluster)\n+ self.assertEqual(res, ['item1', 'item2'])\n+\n+ self.http_client.get.assert_called_with(\n+ \"http://1.2.3.4:8080/api/v1/clusters/test_cluster/alerts?fields=*\",\n+ verify=False, auth=client._auth,\n+ headers=self.headers)\n+\n+ self.assertEqual(self.http_client.get.call_count, 2)\n+ self.assertEqual(mock_check_response.call_count, 2)\n+\n+ def test_check_response(self):\n+ resp = mock.Mock()\n+ resp.status_code = 404\n+\n+ self.assertRaises(ambari_client.AmbariNotFound,\n+ ambari_client.AmbariClient.check_response,\n+ resp, True)\n+\n+ resp.status_code = 200\n+ resp.text = u'{\"json\": \"example\"}'\n+ resp.raise_for_status = mock.Mock()\n+\n+ res = ambari_client.AmbariClient.check_response(resp)\n+\n+ self.assertEqual(res, {\"json\": \"example\"})\n+ resp.raise_for_status.assert_called_once()\n+\n+ def test_req_id(self):\n+ resp = mock.Mock()\n+\n+ resp.text = None\n+ self.assertRaises(p_exc.HadoopProvisionError,\n+ ambari_client.AmbariClient.req_id, resp)\n+\n+ resp.text = u'{\"text\" : \"example\"}'\n+ self.assertRaises(p_exc.HadoopProvisionError,\n+ ambari_client.AmbariClient.req_id, resp)\n+\n+ resp.text = u'{\"Requests\": {\"example\" : \"text\"}}'\n+ self.assertRaises(p_exc.HadoopProvisionError,\n+ ambari_client.AmbariClient.req_id, resp)\n+\n+ resp.text = u'{\"Requests\" : {\"id\" : \"test_id\"}}'\n+ res = ambari_client.AmbariClient.req_id(resp)\n+ self.assertEqual(res, \"test_id\")\n+\ndef test_get_registered_hosts(self):\nclient = ambari_client.AmbariClient(self.instance)\nresp_data = \"\"\"{\n" } ]
Python
Apache License 2.0
openstack/sahara
Adding missing tests to ambari test_client Adding: * test_get_alerts_data() * test_check_response() * test_req_id() Change-Id: I3a7ce797cd0bd726ddc1cb5b8c3411de3580cd24
488,278
17.02.2017 09:47:31
10,800
b844c426fdd99d2feafa69465dee8e74b9f4f952
Fixing Create hbase common lib shows warnings Closes-Bug:
[ { "change_type": "MODIFY", "old_path": "sahara/service/edp/hdfs_helper.py", "new_path": "sahara/service/edp/hdfs_helper.py", "diff": "@@ -31,7 +31,7 @@ HBASE_COMMON_LIB_PATH = \"/user/sahara-hbase-lib\"\ndef create_hbase_common_lib(r):\nr.execute_command(\n- 'sudo su - -c \"hadoop dfs -mkdir -p %s\" hdfs' % (\n+ 'sudo su - -c \"hdfs dfs -mkdir -p %s\" hdfs' % (\nHBASE_COMMON_LIB_PATH))\nret_code, stdout = r.execute_command(\n'hbase classpath')\n@@ -39,7 +39,7 @@ def create_hbase_common_lib(r):\npaths = stdout.split(':')\nfor p in paths:\nif p.endswith(\".jar\"):\n- r.execute_command('sudo su - -c \"hadoop fs -put -p %s %s\" hdfs'\n+ r.execute_command('sudo su - -c \"hdfs fs -put -p %s %s\" hdfs'\n% (p, HBASE_COMMON_LIB_PATH))\nelse:\nraise ex.RequiredServiceMissingException('hbase')\n@@ -53,26 +53,26 @@ def put_file_to_hdfs(r, file, file_name, path, hdfs_user):\ndef copy_from_local(r, source, target, hdfs_user):\n- r.execute_command('sudo su - -c \"hadoop dfs -copyFromLocal '\n+ r.execute_command('sudo su - -c \"hdfs dfs -copyFromLocal '\n'%s %s\" %s' % (source, target, hdfs_user))\ndef move_from_local(r, source, target, hdfs_user):\n# using copyFromLocal followed by rm to address permission issues that\n# arise when image user is not the same as hdfs user (permissions-wise).\n- r.execute_command('sudo su - -c \"hadoop dfs -copyFromLocal %(source)s '\n+ r.execute_command('sudo su - -c \"hdfs dfs -copyFromLocal %(source)s '\n'%(target)s\" %(user)s && sudo rm -f %(source)s' %\n{\"source\": source, \"target\": target, \"user\": hdfs_user})\ndef create_dir_hadoop1(r, dir_name, hdfs_user):\nr.execute_command(\n- 'sudo su - -c \"hadoop dfs -mkdir %s\" %s' % (dir_name, hdfs_user))\n+ 'sudo su - -c \"hdfs dfs -mkdir %s\" %s' % (dir_name, hdfs_user))\ndef create_dir_hadoop2(r, dir_name, hdfs_user):\nr.execute_command(\n- 'sudo su - -c \"hadoop dfs -mkdir -p %s\" %s' % (dir_name, hdfs_user))\n+ 'sudo su - -c \"hdfs dfs -mkdir -p %s\" %s' % (dir_name, hdfs_user))\ndef _get_cluster_hosts_information(host, cluster):\n" }, { "change_type": "MODIFY", "old_path": "sahara/tests/unit/service/edp/test_hdfs_helper.py", "new_path": "sahara/tests/unit/service/edp/test_hdfs_helper.py", "diff": "@@ -37,10 +37,10 @@ class HDFSHelperTestCase(base.SaharaTestCase):\nhelper.create_hbase_common_lib(self.cluster)\ncalls = [\n- mock.call(('sudo su - -c \"hadoop dfs -mkdir -p '\n+ mock.call(('sudo su - -c \"hdfs dfs -mkdir -p '\n'/user/sahara-hbase-lib\" hdfs')),\nmock.call('hbase classpath'),\n- mock.call(('sudo su - -c \"hadoop fs -put -p may.jar '\n+ mock.call(('sudo su - -c \"hdfs fs -put -p may.jar '\n'/user/sahara-hbase-lib\" hdfs'))]\nself.cluster.execute_command.assert_has_calls(calls)\n@@ -59,23 +59,23 @@ class HDFSHelperTestCase(base.SaharaTestCase):\ndef test_copy_from_local(self):\nhelper.copy_from_local(self.cluster, 'Galaxy', 'Earth', 'BigBang')\nself.cluster.execute_command.assert_called_once_with(\n- 'sudo su - -c \"hadoop dfs -copyFromLocal Galaxy Earth\" BigBang')\n+ 'sudo su - -c \"hdfs dfs -copyFromLocal Galaxy Earth\" BigBang')\ndef test_move_from_local(self):\nhelper.move_from_local(self.cluster, 'Galaxy', 'Earth', 'BigBang')\nself.cluster.execute_command.assert_called_once_with(\n- 'sudo su - -c \"hadoop dfs -copyFromLocal Galaxy Earth\" BigBang '\n+ 'sudo su - -c \"hdfs dfs -copyFromLocal Galaxy Earth\" BigBang '\n'&& sudo rm -f Galaxy')\ndef test_create_dir_hadoop1(self):\nhelper.create_dir_hadoop1(self.cluster, 'Earth', 'BigBang')\nself.cluster.execute_command.assert_called_once_with(\n- 'sudo su - -c \"hadoop dfs -mkdir Earth\" BigBang')\n+ 'sudo su - -c \"hdfs dfs -mkdir Earth\" BigBang')\ndef test_create_dir_hadoop2(self):\nhelper.create_dir_hadoop2(self.cluster, 'Earth', 'BigBang')\nself.cluster.execute_command.assert_called_once_with(\n- 'sudo su - -c \"hadoop dfs -mkdir -p Earth\" BigBang')\n+ 'sudo su - -c \"hdfs dfs -mkdir -p Earth\" BigBang')\[email protected]('sahara.utils.cluster.generate_etc_hosts')\[email protected]('sahara.plugins.utils.get_instances')\n@@ -147,5 +147,5 @@ class HDFSHelperTestCase(base.SaharaTestCase):\nhelper.put_file_to_hdfs(self.cluster, open_get, 'workflow',\n'/tmp', 'hdfs')\nself.cluster.execute_command.assert_called_once_with(\n- 'sudo su - -c \"hadoop dfs -copyFromLocal /tmp/workflow.111'\n+ 'sudo su - -c \"hdfs dfs -copyFromLocal /tmp/workflow.111'\n' /tmp/workflow\" hdfs && sudo rm -f /tmp/workflow.111')\n" } ]
Python
Apache License 2.0
openstack/sahara
Fixing Create hbase common lib shows warnings Change-Id: Ia6ffeedbbf038d04e19015856fc8f5e2290c4981 Closes-Bug: 1497947
488,302
16.02.2017 15:00:15
18,000
656593ae479b46452a76a0e7a383982d4ba38f29
Respect Apache's trademark as per docs
[ { "change_type": "MODIFY", "old_path": "doc/source/index.rst", "new_path": "doc/source/index.rst", "diff": "@@ -2,9 +2,9 @@ Welcome to Sahara!\n==================\nThe sahara project aims to provide users with a simple means to provision data\n-processing frameworks (such as Hadoop, Spark and Storm) on OpenStack. This is\n-accomplished by specifying configuration parameters such as the framework\n-version, cluster topology, node hardware details and more.\n+processing frameworks (such as Apache Hadoop, Apache Spark and Apache Storm)\n+on OpenStack. This is accomplished by specifying configuration parameters such\n+as the framework version, cluster topology, node hardware details and more.\nOverview\n--------\n" } ]
Python
Apache License 2.0
openstack/sahara
Respect Apache's trademark as per docs https://www.apache.org/foundation/marks/ Change-Id: Ic958dc0d7b899c6d215d08c2796ba7d8c24a9f61
488,286
28.02.2017 15:51:27
18,000
029430ddd76e9454e73a8f75c654d8d0be3995f1
Add missing tests to test_trusts.py Add: *test_delete_trust() *test_delete_trust_from_cluster()
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/service/test_trusts.py", "new_path": "sahara/tests/unit/service/test_trusts.py", "diff": "@@ -98,3 +98,41 @@ class TestTrusts(base.SaharaTestCase):\ncluster_update.assert_called_with(ctx, fake_cluster,\n{\"trust_id\": \"trust_id\"})\n+\n+ @mock.patch('sahara.utils.openstack.keystone.client_from_auth')\n+ @mock.patch('sahara.utils.openstack.keystone.auth_for_admin')\n+ @mock.patch('sahara.service.trusts.create_trust')\n+ def test_delete_trust(self, trust, auth_for_admin,\n+ client_from_auth):\n+ client = self._client()\n+ client_from_auth.return_value = client\n+ trust.return_value = 'test_id'\n+ trustor_auth = mock.Mock()\n+ trustee_auth = mock.Mock()\n+ auth_for_admin.return_value = trustee_auth\n+ trust_id = trusts.create_trust(trustor_auth, trustee_auth,\n+ \"role_names\")\n+\n+ trusts.delete_trust(trustee_auth, trust_id)\n+ client.trusts.delete.assert_called_with(trust_id)\n+\n+ @mock.patch('sahara.conductor.API.cluster_update')\n+ @mock.patch('sahara.utils.openstack.keystone.auth_for_admin')\n+ @mock.patch('sahara.service.trusts.delete_trust')\n+ @mock.patch('sahara.conductor.API.cluster_get')\n+ @mock.patch('sahara.context.current')\n+ def test_delete_trust_from_cluster(self, context_current, cl_get,\n+ delete_trust, auth_for_admin,\n+ cluster_update):\n+ fake_cluster = mock.Mock(trust_id='test_id')\n+ cl_get.return_value = fake_cluster\n+ trustor_auth = mock.Mock()\n+ trustee_auth = mock.Mock()\n+ auth_for_admin.return_value = trustee_auth\n+ ctx = mock.Mock(roles=\"role_names\", auth_plugin=trustor_auth)\n+ context_current.return_value = ctx\n+ trusts.delete_trust_from_cluster(\"cluster\")\n+\n+ delete_trust.assert_called_with(trustee_auth, 'test_id')\n+ cluster_update.assert_called_with(ctx, fake_cluster,\n+ {\"trust_id\": None})\n" } ]
Python
Apache License 2.0
openstack/sahara
Add missing tests to test_trusts.py Add: *test_delete_trust() *test_delete_trust_from_cluster() Change-Id: I73bc147f18d86b4f1a522d8ec16a2e127a1568a5
488,286
01.03.2017 11:04:13
18,000
bca23817a12449bfa97a4b5b266055674840354b
Add missing tests to utils/proxy.py Add: test_create_proxy_user_for_job_execution()
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/utils/test_proxy.py", "new_path": "sahara/tests/unit/utils/test_proxy.py", "diff": "@@ -26,6 +26,40 @@ class TestProxyUtils(base.SaharaWithDbTestCase):\ndef setUp(self):\nsuper(TestProxyUtils, self).setUp()\n+ @mock.patch('sahara.service.castellan.utils.store_secret')\n+ @mock.patch('sahara.context.ctx')\n+ @mock.patch('sahara.conductor.API.job_execution_update')\n+ @mock.patch('sahara.service.trusts.create_trust')\n+ @mock.patch('sahara.utils.openstack.keystone.auth_for_proxy')\n+ @mock.patch('sahara.utils.openstack.keystone.auth')\n+ @mock.patch('sahara.utils.proxy.proxy_user_create')\n+ def test_create_proxy_user_for_job_execution(self, proxy_user, trustor,\n+ trustee, trust,\n+ job_execution_update,\n+ context_current, passwd):\n+ job_execution = mock.Mock(id=1,\n+ output_id=2,\n+ job_id=3,\n+ job_configs=None)\n+ job_execution.job_configs = mock.Mock(to_dict=mock.Mock(\n+ return_value={}\n+ ))\n+ proxy_user.return_value = \"proxy_user\"\n+ passwd.return_value = \"test_password\"\n+ trustor.return_value = \"test_trustor\"\n+ trustee.return_value = \"test_trustee\"\n+ trust.return_value = \"123456\"\n+ ctx = mock.Mock()\n+ context_current.return_value = ctx\n+ p.create_proxy_user_for_job_execution(job_execution)\n+ update = {'job_configs': {'proxy_configs': None}}\n+ update['job_configs']['proxy_configs'] = {\n+ 'proxy_username': 'job_1',\n+ 'proxy_password': 'test_password',\n+ 'proxy_trust_id': '123456'\n+ }\n+ job_execution_update.assert_called_with(ctx, job_execution, update)\n+\[email protected]('sahara.conductor.API.job_get')\[email protected]('sahara.conductor.API.data_source_get')\[email protected]('sahara.conductor.API.data_source_count')\n" } ]
Python
Apache License 2.0
openstack/sahara
Add missing tests to utils/proxy.py Add: test_create_proxy_user_for_job_execution() Change-Id: I527ca2c47639f26208416fa85499afc1db910bf2
488,286
13.03.2017 18:57:21
14,400
e116c78bfdbfa15ca86ac12f920f92bd61977a42
Add missing test to ambari client Add test: *test_get_credential
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/ambari/test_client.py", "new_path": "sahara/tests/unit/plugins/ambari/test_client.py", "diff": "@@ -109,6 +109,23 @@ class AmbariClientTestCase(base.SaharaTestCase):\nverify=False, data=jsonutils.dumps({\"some\": \"data\"}),\nauth=client._auth, headers=self.headers)\n+ def test_get_credential(self):\n+ resp = mock.Mock()\n+ resp.text = \"\"\n+ resp.status_code = 200\n+ self.http_client.get.return_value = resp\n+ client = ambari_client.AmbariClient(self.instance)\n+\n+ client.get_credential(\"test\", alias=\"credential\")\n+ self.http_client.get.assert_called_once_with(\n+ \"http://1.2.3.4:8080/api/v1/clusters/test/credentials/credential\",\n+ verify=False, auth=client._auth, headers=self.headers)\n+\n+ resp.status_code = 404\n+ self.assertRaises(ambari_client.AmbariNotFound,\n+ ambari_client.AmbariClient.check_response,\n+ resp, True)\n+\[email protected](\"sahara.plugins.ambari.client.AmbariClient.check_response\")\ndef test_get_alerts_data(self, mock_check_response):\ncluster = mock.Mock()\n" } ]
Python
Apache License 2.0
openstack/sahara
Add missing test to ambari client Add test: *test_get_credential Change-Id: I69981206f1aa6797bccc4b578f5e9497d7bb28d3
488,286
14.03.2017 15:47:59
14,400
bf4b048280151e1fd83600fa4aa592da187ca229
Add missing tests to plugin ambari The tests for plugins ambari is not completed. Add: test_get_ambari_proc_list() test_get_clients() test_instances_have_process()
[ { "change_type": "ADD", "old_path": null, "new_path": "sahara/tests/unit/plugins/ambari/test_common.py", "diff": "+# Copyright (c) 2017 EasyStack Inc.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n+# implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+import mock\n+\n+from sahara.plugins.ambari import common\n+from sahara.tests.unit import base\n+\n+\n+class AmbariCommonTestCase(base.SaharaTestCase):\n+ def setUp(self):\n+ super(AmbariCommonTestCase, self).setUp()\n+ self.master_ng = mock.Mock()\n+ self.master_ng.node_processes = ['Ambari', 'HiveServer']\n+\n+ self.worker_ng = mock.Mock()\n+ self.worker_ng.node_processes = ['DataNode', 'Oozie']\n+\n+ self.cluster = mock.Mock()\n+ self.cluster.node_groups = [self.master_ng, self.worker_ng]\n+\n+ def test_get_ambari_proc_list(self):\n+ procs = common.get_ambari_proc_list(self.master_ng)\n+ expected = ['METRICS_COLLECTOR', 'HIVE_SERVER',\n+ 'MYSQL_SERVER', 'WEBHCAT_SERVER']\n+ self.assertEqual(procs, expected)\n+\n+ procs = common.get_ambari_proc_list(self.worker_ng)\n+ expected = ['DATANODE', 'OOZIE_SERVER', 'PIG']\n+ self.assertEqual(procs, expected)\n+\n+ @mock.patch('sahara.plugins.kerberos.is_kerberos_security_enabled')\n+ def test_get_clients(self, kerberos):\n+ kerberos.return_value = False\n+ clients = common.get_clients(self.cluster)\n+ expected = ['OOZIE_CLIENT', 'HIVE_CLIENT', 'HDFS_CLIENT',\n+ 'TEZ_CLIENT', 'METRICS_MONITOR']\n+ for e in expected:\n+ self.assertIn(e, clients)\n+\n+ kerberos.return_value = True\n+ clients = common.get_clients(self.cluster)\n+ expected = ['OOZIE_CLIENT', 'HIVE_CLIENT', 'HDFS_CLIENT',\n+ 'TEZ_CLIENT', 'METRICS_MONITOR', 'KERBEROS_CLIENT']\n+ for e in expected:\n+ self.assertIn(e, clients)\n+\n+ def test_instances_have_process(self):\n+ instance1 = mock.Mock()\n+ instance2 = mock.Mock()\n+ instance1.node_group = self.master_ng\n+ instance2.node_group = self.worker_ng\n+ self.assertTrue(common.instances_have_process([instance1], \"Ambari\"))\n+ self.assertTrue(common.instances_have_process([instance1, instance2],\n+ \"DataNode\"))\n+ self.assertFalse(common.instances_have_process([instance1, instance2],\n+ \"DRPC Server\"))\n" } ]
Python
Apache License 2.0
openstack/sahara
Add missing tests to plugin ambari The tests for plugins ambari is not completed. Add: test_get_ambari_proc_list() test_get_clients() test_instances_have_process() Change-Id: Id835131c9715b24adf523a252849143ede711fdf
488,286
17.03.2017 10:48:48
14,400
55996857dac477712eef1b0d5d172ca1a5ef6886
Add missing tests to ambari/configs.py Add: *test_get_service_to_configs_map()
[ { "change_type": "MODIFY", "old_path": "sahara/tests/unit/plugins/ambari/test_configs.py", "new_path": "sahara/tests/unit/plugins/ambari/test_configs.py", "diff": "import collections\nimport mock\n+import six\nfrom sahara.plugins.ambari import configs\nfrom sahara.tests.unit import base\n@@ -47,6 +48,42 @@ class AmbariConfigsTestCase(base.SaharaTestCase):\nself.assertEqual(len(expected), len(cnt_ex))\nself.assertEqual(len(actual), len(cnt_act))\n+ def test_get_service_to_configs_map(self):\n+ self.assertIsNone(configs.SERVICES_TO_CONFIGS_MAP)\n+ configs_map = configs.get_service_to_configs_map()\n+ configs_expected = {\n+ 'ZooKeeper': ['zoo.cfg', 'zookeeper-env'],\n+ 'Knox': ['knox-env', 'ranger-knox-plugin-properties',\n+ 'gateway-site'],\n+ 'YARN': ['yarn-site', 'mapred-env', 'yarn-env',\n+ 'capacity-scheduler', 'mapred-site'],\n+ 'general': ['cluster-env'], 'Flume': ['flume-env'],\n+ 'Ambari': ['ams-hbase-policy', 'ams-site', 'ams-env',\n+ 'ams-hbase-site', 'ams-hbase-env',\n+ 'ams-hbase-security-site'],\n+ 'HDFS': ['core-site', 'ranger-hdfs-plugin-properties',\n+ 'hadoop-policy', 'hdfs-site', 'hadoop-env'],\n+ 'Ranger': ['ranger-env', 'admin-properties',\n+ 'usersync-properties', 'ranger-site'],\n+ 'Spark': ['spark-defaults', 'spark-env'],\n+ 'Hive': ['hive-env', 'hive-site', 'hiveserver2-site',\n+ 'ranger-hive-plugin-properties'],\n+ 'Storm': ['ranger-storm-plugin-properties', 'storm-site',\n+ 'storm-env'],\n+ 'Oozie': ['oozie-env', 'oozie-site', 'tez-site'],\n+ 'HBase': ['ranger-hbase-plugin-properties', 'hbase-env',\n+ 'hbase-site', 'hbase-policy'],\n+ 'Sqoop': ['sqoop-env'], 'Kafka': ['kafka-broker', 'kafka-env'],\n+ 'Falcon': ['falcon-startup.properties',\n+ 'falcon-runtime.properties', 'falcon-env']\n+ }\n+ for (key, item) in six.iteritems(configs_map):\n+ item.sort()\n+ for (key, item) in six.iteritems(configs_expected):\n+ item.sort()\n+ self.assertEqual(configs_map, configs_expected)\n+ self.assertIsNotNone(configs.SERVICES_TO_CONFIGS_MAP)\n+\ndef test_get_instance_params_default(self):\ninstance_configs = configs.get_instance_params(self.instance)\nexpected = [\n" } ]
Python
Apache License 2.0
openstack/sahara
Add missing tests to ambari/configs.py Add: *test_get_service_to_configs_map() Change-Id: Id440a447a1029c8d592dfa048cf83565d42a6b46
488,286
20.03.2017 12:33:04
-28,800
779c9f65c811fc0bd49595d336ddab45992b168b
Deprecate CDH-5.5.0
[ { "change_type": "ADD", "old_path": null, "new_path": "releasenotes/notes/deprecate-cdh_5_5-0da56b562170566f.yaml", "diff": "+---\n+features:\n+ - Version 5.5.0 of Cloudera plugin is deprecated.\n" }, { "change_type": "MODIFY", "old_path": "sahara/plugins/cdh/plugin.py", "new_path": "sahara/plugins/cdh/plugin.py", "diff": "@@ -35,10 +35,12 @@ class CDHPluginProvider(p.ProvisioningPluginBase):\ndef get_labels(self):\ndefault = {'enabled': {'status': True}, 'stable': {'status': True}}\nresult = {'plugin_labels': copy.deepcopy(default)}\n+ deprecated = {'enabled': {'status': True},\n+ 'deprecated': {'status': True}}\nresult['version_labels'] = {\n'5.9.0': copy.deepcopy(default),\n'5.7.0': copy.deepcopy(default),\n- '5.5.0': copy.deepcopy(default),\n+ '5.5.0': copy.deepcopy(deprecated),\n}\nreturn result\n" } ]
Python
Apache License 2.0
openstack/sahara
Deprecate CDH-5.5.0 Change-Id: I30737fb02d08cd99cbbf02f6630049d2171749ba