Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Ported from Client in client.go.

Unlike Go’s NewClient(kubeconfig string), which reads the CommandRunner from an ambient context.Context on every call, this takes the executor explicitly at construction, matching docker::Client/git::Client/kubectl::Client.

kubeconfig’s materialization into a temp file + KUBECONFIG env var (Go’s kubeconfigEnv, backed by internal/kubeconfig) mirrors kubectl::Client::kubeconfig_env, which itself mirrors k3d::Driver’s TempKubeconfigGuard – all three exist because xianyun up’s k3d driver uses --kubeconfig-update-default=false, so nothing writes the cluster’s kubeconfig to ~/.kube/config; every client that talks to the cluster has to point itself at the real kubeconfig explicitly or it silently falls back to localhost:8080/the ambient default. Closed alongside kubectl’s own fix (see PORT_NOTES.md): an empty kubeconfig (Go’s no-op path) means kubeconfig_env returns None and every call behaves exactly as before.

Implementations§

Source§

impl Client

Source

pub fn new( kubeconfig: &str, executor: Arc<dyn CommandRunner + Send + Sync>, ) -> Self

Ported from NewClient.

Trait Implementations§

Source§

impl Backend for Client

Source§

fn install( &self, release_name: &str, chart_path: &str, args: &[&str], ) -> Result<(), ExecError>

Installs a Helm chart. args should include all flags and values for the install command.
Source§

fn uninstall( &self, release_name: &str, namespace: &str, ) -> Result<(), ExecError>

Uninstalls a Helm release.
Source§

fn upgrade( &self, release_name: &str, chart_path: &str, args: &[&str], ) -> Result<(), ExecError>

Upgrades a Helm release. args should include all flags and values for the upgrade command.
Source§

fn list(&self, namespace: &str, filter: &str) -> Result<String, ExecError>

Lists Helm releases in a namespace. Returns JSON output from helm list.
Source§

fn repo_list(&self) -> Result<String, ExecError>

Lists configured Helm repositories. Returns JSON output from helm repo list.
Source§

fn repo_add( &self, name: &str, url: &str, force_update: bool, ) -> Result<(), ExecError>

Adds a Helm repository, or updates it if force_update is true.
Source§

fn repo_update(&self, name: &str) -> Result<(), ExecError>

Updates a specific Helm repository to fetch the latest charts.
Source§

fn pull(&self, chart_ref: &str, untar_dir: &str) -> Result<(), ExecError>

Downloads the chart and unpacks it into untar_dir, which must be freshly created.
Source§

fn dependency_list(&self, chart_dir: &str) -> Result<String, ExecError>

Returns helm’s dependency list table. It exits 0 whatever it finds, so the caller must read the table rather than the error.
Source§

fn dependency_build( &self, chart_dir: &str, skip_refresh: bool, ) -> Result<(), ExecError>

Fetches the dependencies Chart.lock pins, leaving the lock untouched.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more