Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
91ff1f17ae
commit
f0a719e3ed
@ -1,7 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use dagger_sdk::{Container, ImageMediaTypes};
|
||||
use dagger_sdk::Container;
|
||||
|
||||
use crate::dagger_middleware::DaggerMiddleware;
|
||||
|
||||
@ -17,6 +17,13 @@ impl Kubectl {
|
||||
}
|
||||
}
|
||||
|
||||
const KUBESLICEDOWNLOAD: &str = r#"slice_VERSION=v1.2.7 && \
|
||||
wget -O kubectl-slice_linux_x86_64.tar.gz "https://github.com/patrickdappollonio/kubectl-slice/releases/download/$slice_VERSION/kubectl-slice_linux_x86_64.tar.gz" && \
|
||||
tar -xf kubectl-slice_linux_x86_64.tar.gz && \
|
||||
chmod +x ./kubectl-slice && \
|
||||
mv ./kubectl-slice /usr/local/bin/kubectl-slice && \
|
||||
rm kubectl-slice_linux_x86_64.tar.gz"#;
|
||||
|
||||
#[async_trait]
|
||||
impl DaggerMiddleware for Kubectl {
|
||||
async fn handle(&self, container: Container) -> eyre::Result<Container> {
|
||||
@ -25,6 +32,13 @@ impl DaggerMiddleware for Kubectl {
|
||||
.container()
|
||||
.from("line/kubectl-kustomize:1.29.1-5.3.0");
|
||||
|
||||
let kubeslice = self
|
||||
.client
|
||||
.container()
|
||||
.from("alpine:3.19")
|
||||
.with_exec(vec!["apk", "add", "tar", "wget"])
|
||||
.with_exec(vec!["sh", "-c", KUBESLICEDOWNLOAD]);
|
||||
|
||||
Ok(container
|
||||
.with_file(
|
||||
"/usr/local/bin/kubectl",
|
||||
@ -33,6 +47,10 @@ impl DaggerMiddleware for Kubectl {
|
||||
.with_file(
|
||||
"/usr/local/bin/kustomize",
|
||||
kubectl.file("/usr/local/bin/kustomize"),
|
||||
)
|
||||
.with_file(
|
||||
"/usr/local/bin/kubectl-slice",
|
||||
kubeslice.file("kubectl-slice"),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user