-
Notifications
You must be signed in to change notification settings - Fork 48
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
containerd-shim-spin shoud support outbound capabilities (eg redis) #58
Comments
Yes, as of today, the spin trigger only support the HTTP capability. Let me try to describe the work needed to support other capabilities: update The trigger type can be found in https://github.dev/fermyon/spin/blob/8dfc4d6fbb31d624eb034f78640cb207bec1f682/src/commands/up.rs#L146-L149. |
Hey @Mossaka thanks for the details, however I was referring to outbound redis in this particular issue, not about the redis trigger |
Ah okay. The outbound redis should be avialable in spin v0.6.0, which I added in this PR #55 . I will try to create an example that uses the outbound redis capability. |
Yes spin isn't the problem here. The shim has to load the output capabilities from spin explicitly, which is not done at the moment. |
Do you have any idea what to do here @Mossaka ? |
Yes, sorry for getting back to you late. I am looking into in this week. |
I just tried creating a Spin application with using the outbound redis capability. The spin application is written in rust: use anyhow::{anyhow, Result};
use spin_sdk::{
http::{internal_server_error, Request, Response},
http_component, redis,
};
const REDIS_ADDRESS_ENV: &str = "REDIS_ADDRESS";
const REDIS_CHANNEL_ENV: &str = "REDIS_CHANNEL";
#[http_component]
fn hello_world(_req: Request) -> Result<Response> {
let address = std::env::var(REDIS_ADDRESS_ENV)?;
let channel = std::env::var(REDIS_CHANNEL_ENV)?;
// Get the message to publish from the Redis key "mykey"
let payload = redis::get(&address, "mykey").map_err(|_| anyhow!("Error querying Redis"))?;
// Set the Redis key "spin-example" to value "Eureka!"
redis::set(&address, "spin-example", &b"Eureka!"[..])
.map_err(|_| anyhow!("Error executing Redis set command"))?;
// Set the Redis key "int-key" to value 0
redis::set(&address, "int-key", format!("{:x}", 0).as_bytes())
.map_err(|_| anyhow!("Error executing Redis set command"))?;
let int_value = redis::incr(&address, "int-key")
.map_err(|_| anyhow!("Error executing Redis incr command",))?;
assert_eq!(int_value, 1);
// Publish to Redis
match redis::publish(&address, &channel, &payload) {
Ok(()) => Ok(http::Response::builder().status(200).body(None)?),
Err(_e) => internal_server_error(),
}
Ok(http::Response::builder().status(200).body(None)?)
} Then I deployed this spin service and a redis service in kubernetes using the spin shim. One thing I found interesting is that for some reason, spin redis cannot find the redis-server using kubernetes DNS service's A/AAAA records like I am not sure if this is a shim's bug or spin's bug. Hope this helps! |
hey @ThorstenHans it appears that the version of spin in the shim does do outbound redis work successfully (with some oddities, as @Mossaka mentions). Can you confirm this? If you're using AKS to test, Microsoft needs to rebuild the shim and update the service, which it hopes to do this month. |
Closing this one out as we can't reproduce ths issue. |
I'll spin up a new AKS cluster these days and give it a try again. I'll keep you posted @Mossaka |
wait wait... new one flying in very shortly!!! |
containerd-shim-spin
currently supports simple workloads only. It should support all outbound capabilities provided by Spin like Redis and PostgreSQL.When deploying a Spin application that uses
outbound-redis::publish
currently results in the "pod" failing with:The text was updated successfully, but these errors were encountered: