Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: feat: node agent api implementation #70

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
27f66b2
Run CI on the project-demo branch as well
sameo Aug 30, 2022
a071901
feat(scheduler): add parser module
iverly Aug 29, 2022
fac8cd0
feat(scheduler): add InstanceScheduled structure
iverly Aug 29, 2022
e93fc88
feat(scheduler): add NodeRegistered structure
iverly Aug 29, 2022
ea216d9
feat(kudoctl): update instance api call according to doc
nponsard Aug 29, 2022
f46b514
fix(kudoctl): remove default case in match to remove warnings
nponsard Aug 29, 2022
db8946b
feat(kudoctl): delete namespace command
nponsard Aug 29, 2022
75ba7fd
fix(kudoctl): use "default" namespace if the option is not defined
nponsard Aug 29, 2022
cb14914
Fix : Transform filter service into a generic service
Maxtho8 Aug 29, 2022
4ecaf31
Fix : Add ressources during workload PATCH & PUT
Maxtho8 Aug 30, 2022
f2598ab
feat: sending instance status
WoodenMaiden Jul 30, 2022
a51e2d0
feat: add create() abstraction and added result as channel type
WoodenMaiden Aug 27, 2022
88ecacf
feat(kudoctl): update workload api calls according to doc
nponsard Aug 29, 2022
99043f9
feat: add limits to container
Aug 29, 2022
60677aa
feat : create namespace service
Maxtho8 Aug 30, 2022
a005795
feat : add namespace controller
Maxtho8 Aug 30, 2022
2dc7bbe
fix : namespace for workload
Maxtho8 Aug 30, 2022
d2935f5
feat: add networking to container
Aug 30, 2022
399fb4d
fix: run ci as root
Aug 30, 2022
8ec7a83
feat: start node agent api implementation
EstebanBAR0N Aug 29, 2022
2229e61
feat: implement grpc server in node agent
EstebanBAR0N Aug 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,32 @@ name: Kudo CI

on:
push:
branches: [ "main" ]
branches: ["main", "project-demo-202208"]
pull_request:
branches: [ "main" ]
branches: ["main", "project-demo-202208"]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install clippy
run: rustup component add clippy
- name: Install rustfmt
run: rustup component add rustfmt
- name: Build
run: make kudo
- name: Lint
run: make lint
- name: Format
run: make format
- name: Tests
run: make check
- uses: actions/checkout@v3
- name: Install clippy
run: rustup component add clippy
- name: Install rustfmt
run: rustup component add rustfmt
- name: Cargo setup
run: |
echo "[target.x86_64-unknown-linux-gnu]" >> ~/.cargo/config
echo "runner = 'sudo -E'" >> ~/.cargo/config
- name: Build
run: make kudo
- name: Lint
run: make lint
- name: Format
run: make format
- name: Tests
run: make check
140 changes: 117 additions & 23 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion controller/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ tonic = "0.7.2"
proto = { path = "../../proto" }
log = "0.4.0"
tokio = { version = "1.20.0", features = ["rt-multi-thread", "macros"] }

serde_json = "1.0"

59 changes: 59 additions & 0 deletions controller/lib/src/external_api/generic/filter.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
use super::model::FilterError;
/// `FilterService` is a struct that can be used as a services to filter result.
pub struct FilterService {}

impl Default for FilterService {
fn default() -> Self {
Self::new()
}
}

impl FilterService {
pub fn new() -> Self {
FilterService {}
}

/// It takes a vector of <T> and a limit, and returns a vector that is limited to the
/// number specified by the limit
///
/// # Arguments:
///
/// * `vector`: A vector.
/// * `limit`: The number of elements in the vector to return.
///
/// # Returns:
///
/// A vector.

pub fn limit<T: Clone>(&mut self, vector: &Vec<T>, mut limit: u32) -> Vec<T> {
if limit > vector.len() as u32 {
limit = vector.len() as u32;
}
vector[0..limit as usize].to_vec()
}

/// "Return a subset of the vector, starting at the offset index."
///
/// The first thing we do is check if the offset is greater than the length of the vector. If
/// it is, we return an error
///
/// # Arguments:
///
/// * `vector`: A vector.
/// * `offset`: The offset to start from.
///
/// # Returns:
///
/// A vector.

pub fn offset<T: Clone>(
&mut self,
vector: &Vec<T>,
offset: u32,
) -> Result<Vec<T>, FilterError> {
if offset > vector.len() as u32 {
return Err(FilterError::OutOfRange);
}
Ok(vector[offset as usize..].to_vec())
}
}
2 changes: 2 additions & 0 deletions controller/lib/src/external_api/generic/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod filter;
pub mod model;
Loading