Skip to content

Conversation

svend
Copy link
Contributor

@svend svend commented Apr 26, 2019

Allow the desired context name, cluster name, and user name to be specified when loading the Kubernetes configuration.

Do you prefer an option struct or separate arguments?

option struct

#[derive(Default)]
pub struct ConfigOptions {
    pub context: Option<String>,
    pub cluster: Option<String>,
    pub user: Option<String>,
}

pub fn load_kube_config_with(options: ConfigOptions)

usage:

let config_opts = config::ConfigOptions {
    context: "mycontext",
    ..Default::default()
};

let kubeconfig = config::load_kube_config_with(config_opts)?;

arguments

pub fn load_kube_config_with(
    context: Option<String>,
    cluster: Option<String>,
    user: Option<String>,
)

usage:

let kubeconfig = config::load_kube_config_with(Some("mycontext"), None, None)?;

@svend svend force-pushed the load-with-context branch from f5c40dd to cdb786a Compare May 8, 2019 17:39
Copy link
Owner

@ynqa ynqa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@svend LGTM. Sorry for response delay and thanks for contributions (fixing conflicts also) again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants