Skip to content
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

Allow context, cluster, and user names to be specified #17

Merged
merged 1 commit into from
May 14, 2019

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)?;

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!

This pull request was closed.
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