Closed crusty-dave closed 3 years ago
Actually, I believe that I just figured it out, haven't tested yet, but it compiles:
let layer_opt = match config.auth_layer() {
Ok(layer) => layer,
Err(e) => {
error!("{} failed to get auth layer {:?}", FN_NAME, e);
break;
}
};
let service = ServiceBuilder::new()
.layer(config.base_uri_layer())
.option_layer(layer_opt)
.service(hyper::Client::new());
let client = Client::new(service, config.default_namespace);
I think you meant to file this at https://github.com/kube-rs/kube-rs/issues ?
@Arnavion - sorry, I wasn't sure which one. Even though the above compiled, I had tokio runtime issue when I tried to run it. So I started backing off versions.
I am trying this set, but the above code no longer compiles... sigh... kube = {registry = "crates-io-mirror", version="0.45.0", optional = true} k8s-openapi = {registry = "crates-io-mirror", version="0.10.0", default-features = false, features = ["api", "v1_19"], optional = true} tower-http = {registry = "crates-io-mirror", version="0.1", optional = true} tower = {registry = "crates-io-mirror", version="0.4", optional = true} hyper = {registry = "crates-io-mirror", version="0.14", features = ["client"], optional = true} hyper-tls = {registry = "crates-io-mirror", version="0.5", optional = true}
I have looked for an example of usage, but I cannot find one anywhere.
I just have a very simple task for which I need this API, I would like to verify the service token received from a different service. I believe that I need to provide my service token to make the request.
I am struggling with how to convert AuthLayer into a form that pp.field_manager.with_header() will take:
Perhaps this is the wrong approach?
Thanks in advance, -Dave