Skip to content

Commit

Permalink
Merge pull request #81 from sebt3/dependabot/cargo/oci-client-0.14.0
Browse files Browse the repository at this point in the history
Bump oci-client from 0.12.1 to 0.14.0
  • Loading branch information
sebt3 committed Nov 13, 2024
2 parents a14741a + 7de7c94 commit 537d1cc
Show file tree
Hide file tree
Showing 16 changed files with 154 additions and 45 deletions.
113 changes: 107 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ version = "0.96.0"


[workspace.package]
version = "0.3.0"
version = "0.3.1"
authors = ["Sébastien Huss <[email protected]>"]
edition = "2021"
license = " BSD-3-Clause"
Expand Down
8 changes: 4 additions & 4 deletions agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG RUST_VERSION=1.81
ARG DEBIAN_VERSION=bookworm
ARG DEBIAN_NEXT=trixie
FROM docker.io/rust:${RUST_VERSION}-slim-${DEBIAN_VERSION} as builder
FROM docker.io/rust:${RUST_VERSION}-slim-${DEBIAN_VERSION} AS builder
ARG BUILD_DEPS="binutils libssl-dev pkg-config git build-essential g++"
WORKDIR /usr/src/agent
COPY Cargo.lock .
Expand All @@ -26,7 +26,7 @@ RUN touch common/src/lib.rs agent/src/lib.rs agent/src/main.rs \
&& cargo build -r --bin agent \
&& strip target/release/agent
# Then create the intermediary image with run-time dependencies installed
FROM docker.io/debian:${DEBIAN_NEXT}-slim as middle
FROM docker.io/debian:${DEBIAN_NEXT}-slim AS middle
ARG HELM_VERSION=v3.10.3
ARG KUBECTL_VERSION=v1.30.3
ARG TF_VERSION=1.8.1
Expand All @@ -52,12 +52,12 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& chmod 770 /var/lib/vynil /nonexistent \
&& chmod 700 /var/lib/vynil/keys
# Use the intermediary image to download the most used providers for runtime caching purpose
FROM middle as downloader
FROM middle AS downloader
WORKDIR /src
COPY agent/providers.tf .
RUN tofu init
# Finally assemble everything together
FROM middle as target
FROM middle AS target
COPY --from=builder /usr/src/agent/target/release/agent /usr/bin/agent
COPY agent/scripts /usr/lib/vynil/scripts
USER nobody
Expand Down
45 changes: 22 additions & 23 deletions agent/scripts/lib/wait.rhai
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fn workload(list, duration) {
for wl in list.filter(|wl| ["Deployment", "DaemonSet", "StatefulSet"].contains(wl.kind)) {
fn workload(lst, duration) {
for wl in lst.filter(|wl| ["Deployment", "DaemonSet", "StatefulSet"].contains(wl.kind)) {
log_info(`Waiting for ${wl.kind} ${wl.namespace} ${wl.name} to be available`);
if wl.kind == "Deployment" {
let deploy = get_deployment(wl.namespace, w.name);
let deploy = get_deployment(wl.namespace, wl.name);
deploy.wait_available(duration);
} else if wl.kind == "DaemonSet" {
let ds = get_deamonset(wl.namespace, wl.name);
Expand All @@ -13,23 +13,23 @@ fn workload(list, duration) {
}
}
}
fn workload(list) {
workload(list, 2*60);
fn workload(lst) {
workload(lst, 2*60);
}

fn job(list, duration) {
for j in applied_objs.filter(|j| j.kind == "Job") {
fn job(lst, duration) {
for j in lst.filter(|j| j.kind == "Job") {
log_info(`Waiting for ${j.kind} ${j.namespace} ${j.name} to finish`);
let job = get_job(j.namespace, j.name);
job.wait_done(duration);
}
}
fn job(list) {
job(list, 5*60);
fn job(lst) {
job(lst, 5*60);
}

fn vital(list, duration) {
for v in list {
fn vital(lst, duration) {
for v in lst {
if ["Cluster"].contains(v.kind) {
log_info(`Waiting for ${v.kind} ${v.namespace} ${v.name} to be available`);
let api = k8s_resource(v.kind, v.namespace);
Expand All @@ -42,23 +42,22 @@ fn vital(list, duration) {
obj.wait_condition("ClusterAvailable", duration);
} else if ["Redis", "MongoDBCommunity"].contains(v.kind) {
log_info(`Waiting for ${v.kind} ${v.namespace} ${v.name} to be available`);
let api = k8s_resource(v.kind, v.namespace);
let sts = get_statefulset(v.namespace, v.name);
sts.wait_available(duration);
}
}
}
fn vital(list) {
vital(list, 2*60);
fn vital(lst) {
vital(lst, 2*60);
}

fn all(list, duration) {
vital(list, duration);
job(list, duration);
workload(list, duration);
}
fn all(list) {
vital(list);
job(list);
workload(list);
fn all(lst, duration) {
vital(lst, duration);
job(lst, duration);
workload(lst, duration);
}
fn all(lst) {
vital(lst);
job(lst);
workload(lst);
}
3 changes: 3 additions & 0 deletions agent/scripts/system/context_system.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn run(instance, context) {
context
}
3 changes: 3 additions & 0 deletions agent/scripts/tenant/context_tenant.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn run(instance, context) {
context
}
2 changes: 1 addition & 1 deletion agent/src/system/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ pub struct Parameters {
pub async fn run(args: &Parameters) -> Result<()> {
let mut rhai = Script::new(vec![
format!("{}/scripts", args.package_dir),
format!("{}", args.config_dir),
format!("{}/system", args.script_dir),
format!("{}/lib", args.script_dir),
format!("{}", args.config_dir),
]);
let context = SystemInstance::get(args.namespace.clone(), args.instance.clone()).await?;
set_system(context.clone());
Expand Down
2 changes: 1 addition & 1 deletion agent/src/system/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ pub struct Parameters {
pub async fn run(args: &Parameters) -> Result<()> {
let mut rhai = Script::new(vec![
format!("{}/scripts", args.package_dir),
format!("{}", args.config_dir),
format!("{}/system", args.script_dir),
format!("{}/lib", args.script_dir),
format!("{}", args.config_dir),
]);
let context = SystemInstance::get(args.namespace.clone(), args.instance.clone()).await?;
set_system(context.clone());
Expand Down
1 change: 1 addition & 0 deletions agent/src/tenant/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub struct Parameters {
pub async fn run(args: &Parameters) -> Result<()> {
let mut rhai = Script::new(vec![
format!("{}/scripts", args.package_dir),
format!("{}", args.config_dir),
format!("{}/tenant", args.script_dir),
format!("{}/lib", args.script_dir),
]);
Expand Down
2 changes: 1 addition & 1 deletion agent/src/tenant/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ pub struct Parameters {
pub async fn run(args: &Parameters) -> Result<()> {
let mut rhai = Script::new(vec![
format!("{}/scripts", args.package_dir),
format!("{}", args.config_dir),
format!("{}/tenant", args.script_dir),
format!("{}/lib", args.script_dir),
format!("{}", args.config_dir),
]);
let context = TenantInstance::get(args.namespace.clone(), args.instance.clone()).await?;
set_tenant(context.clone());
Expand Down
2 changes: 1 addition & 1 deletion agent/src/tenant/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ pub struct Parameters {
pub async fn run(args: &Parameters) -> Result<()> {
let mut rhai = Script::new(vec![
format!("{}/scripts", args.package_dir),
format!("{}", args.config_dir),
format!("{}/tenant", args.script_dir),
format!("{}/lib", args.script_dir),
format!("{}", args.config_dir),
]);
let context = TenantInstance::get(args.namespace.clone(), args.instance.clone()).await?;
set_tenant(context.clone());
Expand Down
1 change: 1 addition & 0 deletions agent/src/tenant/reconfigure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub struct Parameters {
pub async fn run(args: &Parameters) -> Result<()> {
let mut rhai = Script::new(vec![
format!("{}/scripts", args.package_dir),
format!("{}", args.config_dir),
format!("{}/tenant", args.script_dir),
format!("{}/lib", args.script_dir),
]);
Expand Down
1 change: 1 addition & 0 deletions agent/src/tenant/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub struct Parameters {
pub async fn run(args: &Parameters) -> Result<()> {
let mut rhai = Script::new(vec![
format!("{}/scripts", args.package_dir),
format!("{}", args.config_dir),
format!("{}/tenant", args.script_dir),
format!("{}/lib", args.script_dir),
]);
Expand Down
2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ regex = "1.11.1"
semver = { version = "1.0.23", features = ["serde"] }
tar = "0.4.43"
flate2 = "1.0.33"
oci-client = "0.12.1"
oci-client = "0.14.0"
openapiv3 = "2.0.0"
sha256 = "1.5.0"
argon2 = { version = "0.5.3", features = ["std"] }
Expand Down
Loading

0 comments on commit 537d1cc

Please sign in to comment.