Skip to content

Current state of the http proxy support? #1010

Answered by njust
njust asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks, if you need support for http proxies, you can use this code

async fn get_kube_client(kube_ctx: &str) -> Result<Client>{
    let config = Config::from_kubeconfig(&KubeConfigOptions{
        context: Some(kube_ctx.to_string()),
        ..KubeConfigOptions::default()
    }).await?;

    let client = if let Some(proxy_uri) = &config.proxy_url {
        let proxy = {
            let proxy = Proxy::new(Intercept::All, proxy_uri.clone());
            let mut proxy_connector = ProxyConnector::from_proxy(HttpConnector::new(), proxy)?;
            proxy_connector.set_tls(Some(config.native_tls_connector()?));
            proxy_connector
        };

        let service = ServiceBuilder::new()

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by njust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants