testcontainers / testcontainers-rs-modules-community

Community maintained modules for Testcontainers for Rust
https://docs.rs/crate/testcontainers-modules/
MIT License
90 stars 43 forks source link

has someone gotten `k3s` to work? #200

Closed bbortt closed 2 months ago

bbortt commented 3 months ago

Feature request description

I am trying to deploy a pod into k3s. I've followed the contained test (roughly), but fail to get it working. I've also considered the pod_api.rs example over at kube-rs/kube.

has someone gotten this to work? I always end up with: Service(hyper_util::client::legacy::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }))).

this happens to be thrown in the pods.create line:

pub(crate) async fn deploy_argocd(client: Client) {
    let pods: Api<Pod> = Api::default_namespaced(client.clone());

    let argocd_pod: Pod =
        parse_yaml("tests/resources/k3s/argocd.pod.yml").expect("Failed to read ArgoCD deployment");

    pods.create(&PostParams::default(), &argocd_pod)
        .await
        .expect("Failed to deploy ArgoCD to K3s");
}

Image reference

k3s feature

DDtKey commented 3 months ago

Hi @bbortt 👋 Could you say what version of kube and k8s-openapi do you use in your tests?

It works in our test-suite at least 🤔

bbortt commented 3 months ago

@DDtKey thanks for the quick response. I saw that the test suite works and I can reproduce that. but it does only read pods, not create any new.. as soon as I go into this direction I end up with the mentioned error..

[dev-dependencies]
assert_cmd = "2.0.16"
k8s-openapi = { version = "0.22.0", features = ["latest"] }
kube = { version = "0.93.1", features = ["derive"] }
kube-derive = "0.93.1"
predicates = "3.1.2"
rustls = "0.23.12"
schemars = "0.8.21"
testcontainers-modules = { version = "0.9.0", features = [ "hashicorp_vault", "postgres"] }
DDtKey commented 3 months ago

I guess you've figured out the reason and described in https://github.com/testcontainers/testcontainers-rs-modules-community/pull/202

Let me know if you have any questions. Thank you!

bbortt commented 3 months ago

not exactly, that was to build this community modules project locally. sorry if I was not specific enough.

the build of the provided test still does not pass :/ tho not with the error I'd expect.

bbortt commented 2 months ago

for anyone interested, I've written a whole bunch of tests using testmodules and k3s in this project: https://github.com/postfinance/propeller/tree/main/tests.