Skip to main content

Manager

Struct Manager 

Source
pub struct Manager<B: HelmBackend> { /* private fields */ }
Expand description

Ported from Manager in manager.go.

Implementations§

Source§

impl<B: HelmBackend> Manager<B>

Source

pub fn new(backend: B) -> Self

Ported from NewManager. The Go original panics if backend is nil; a Rust B: HelmBackend is never null, so that check has no equivalent here.

Source

pub fn deployer_type(&self) -> &'static str

Ported from Type.

Source§

impl<B: HelmBackend> Manager<B>

Source

pub fn build_dynamic_overrides( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<Option<Value>, HelmError>

Ported from buildDynamicOverrides. Merges every configured dynamic override into a single tree of Helm values. Later overrides win over earlier ones. Returns None when no override contributes a value.

ctx (Go’s context.Context, used there only to scope a slog.DebugContext log line) has no parameter here; see PORT_NOTES.md’s note on this crate’s explicit-dependency-injection convention for context-carried values that this session’s ported submodules do not otherwise need.

§Errors

Returns an error if an override names an unknown or not-yet-supported type, or if resolving one fails (an unreadable file, an invalid Helm key path, or a conflicting key path).

§Panics

Panics if deployer_config.helm is None; callers are expected to have already checked deployer_config.deployer_type == "helm" (ported from Manager::Validate/Deploy’s own type check, not yet wired up here – see PORT_NOTES.md).

Source§

impl<B: HelmBackend> Manager<B>

Source

pub fn deploy( &self, deployer_config: &DeployerConfig, cfg: &Container, ) -> Result<(), HelmError>

Ported from Deploy. Deploys the Helm chart, upgrading it if already deployed.

§Errors

Returns an error if deployer_config is not a helm deployer, preparing the chart source fails, building the values arguments fails, or the underlying helm install/helm upgrade call fails.

§Panics

Panics if deployer_config.helm is None; callers are expected to have already checked deployer_config.deployer_type == "helm" (this method’s own first check).

Source

pub fn status( &self, deployer_config: &DeployerConfig, _caproni_config: &CaproniConfig, ) -> Result<Status, HelmError>

Ported from Status. helm list failing (missing namespace, helm unavailable, …) is treated as “not deployed” for idempotency, matching the Go original’s //nolint:nilerr comment – this method never actually returns Err, but keeps a Result return type for parity with the rest of this module’s fallible methods.

§Errors

Never returns an error; the signature is Result for parity with the rest of this module.

§Panics

Panics if deployer_config.helm is None.

Source

pub fn undeploy( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<(), HelmError>

Ported from Undeploy. Uninstalls the release if it’s deployed, and does nothing if it isn’t, so removing twice is safe.

§Errors

Returns HelmError::NotHelmDeployer if deployer_config is not a helm deployer or has no helm block, and a HelmError::Backend if helm uninstall fails.

Source

pub fn prepare_chart_source( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<(String, Box<dyn FnOnce()>), HelmError>

Ported from prepareChartSource. Determines the chart reference to pass to helm install/helm upgrade.

Four chart source modes:

  1. Edit mode with repository — uses the local cloned directory path.
  2. Repository-based chart — runs helm repo add/update, returns a repo/chart reference.
  3. Direct chart reference (OCI, local path, etc.) — returns the chart string as-is.
  4. Absolute http(s) URL — fetches the chart and returns a local packaged copy.

Every mode that ends at a chart directory has its dependencies resolved first, since a chart source tree vendors only its in-tree subcharts. Modes ending at a repository, a registry, or an archive are left alone.

§Errors

Returns an error if deployer_config has no helm block, the repository named by edit mode is not found, helm.release is missing when required, adding/updating the configured helm repository fails, fetching a URL chart fails, or resolving a chart’s dependencies fails.

Source

pub fn validate( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<(), HelmError>

Ported from Validate. Validates the helm deployer configuration and referenced files.

§Errors

Returns an error if deployer_config is not a helm deployer, helm.release is missing when required, release.version is set without helm.repository, a dynamic override is invalid, or a referenced file doesn’t exist.

§Panics

Never panics: the deployer_config.helm.is_none() case is checked and returned as an error before the .expect() below runs.

Trait Implementations§

Source§

impl<B: HelmBackend> Manager for Manager<B>

Lets the orchestrator drive a helm Manager through the registry.

Source§

fn deployer_type(&self) -> String

The deployer type that this manager handles (e.g. "helm").
Source§

fn deploy( &self, deployer_config: &DeployerConfig, cfg: Option<&Container>, ) -> Result<(), Box<dyn Error + Send + Sync>>

Deploys the application to the cluster. If the application is already deployed, this updates it to match the current configuration.
Source§

fn undeploy( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<(), Box<dyn Error + Send + Sync>>

Removes this deployment from the cluster.
Source§

fn status( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<Status, Box<dyn Error + Send + Sync>>

Returns the current status of the deployment. Returns an error if unable to determine deployment state.
Source§

fn validate( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<(), Box<dyn Error + Send + Sync>>

Validates the deployer configuration and referenced files. Returns Ok(()) if valid, or an error describing validation failures. Files in uncloned repository directories should not cause validation to fail.

Auto Trait Implementations§

§

impl<B> Freeze for Manager<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for Manager<B>
where B: RefUnwindSafe,

§

impl<B> Send for Manager<B>
where B: Send,

§

impl<B> Sync for Manager<B>
where B: Sync,

§

impl<B> Unpin for Manager<B>
where B: Unpin,

§

impl<B> UnsafeUnpin for Manager<B>
where B: UnsafeUnpin,

§

impl<B> UnwindSafe for Manager<B>
where B: UnwindSafe,

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

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
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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