Struct roperator::config::ClientConfig[][src]

pub struct ClientConfig {
    pub api_server_endpoint: String,
    pub credentials: Credentials,
    pub ca_data: Option<CAData>,
    pub user_agent: String,
    pub verify_ssl_certs: bool,
    pub impersonate: Option<String>,
    pub impersonate_groups: Vec<String>,
}

Configuration for how to connect to the Kubernetes API server and authenticate. This configuration can typically be created from either a service account or a kubeconfig file using one of the provided functions, but you may also create configurations manually.

Fields

api_server_endpoint: String

The http(s) endpoint of the api server, including the scheme and port

credentials: Credentials

The credentials for authenticating with the api server

ca_data: Option<CAData>user_agent: String

The user-agent string to include in requests to the api server. This typically doesn’t affect the fuctioning of the operator, but it can be useful when looking through api server logs

verify_ssl_certs: bool

Escape hatch for turning off ssl certificate validation in test environments only. Don’t set to true in production. Don’t be that person.

impersonate: Option<String>

Optional user to impersonate

impersonate_groups: Vec<String>

optional list of groups to add when impersonating a user. Ignored if impersonate is empty.

Implementations

impl ClientConfig[src]

pub fn from_service_account(
    user_agent: impl Into<String>
) -> Result<ClientConfig, Error>
[src]

Attempts to build a ClientConfig from a service account that’s been mounted in the usual path (SERVICE_ACCOUNT_TOKEN_PATH). Returns an error if either the “token” or “ca.crt” files are missing.

The returned ClientConfig will use the default api_server_endpoint of "kubernetes.default.svc", so you’ll need to change that if your cluster uses something different.

The user_agent is typically the same value as the operator_name from the OperatorConfig.

pub fn from_kubeconfig(
    user_agent: impl Into<String>
) -> Result<ClientConfig, KubeConfigError>
[src]

Attempts to build a ClientConfig from a kubeconfig file. This respects the value of the KUBECONFIG environment variable. Most, but not all, of the authentication methods are supported, including certificates, username/password, token, and exec. Roperator does not currently support rotation of credentials, so any credentials taken from the kubeconfig will need to be valid for the lifetime of the application.

Trait Implementations

impl Clone for ClientConfig[src]

impl Debug for ClientConfig[src]

impl PartialEq<ClientConfig> for ClientConfig[src]

impl StructuralPartialEq for ClientConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.