pub struct Manager<B: HelmBackend> { /* private fields */ }Expand description
Ported from Manager in manager.go.
Implementations§
Source§impl<B: HelmBackend> Manager<B>
impl<B: HelmBackend> Manager<B>
Sourcepub fn new(backend: B) -> Self
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.
Sourcepub fn deployer_type(&self) -> &'static str
pub fn deployer_type(&self) -> &'static str
Ported from Type.
Source§impl<B: HelmBackend> Manager<B>
impl<B: HelmBackend> Manager<B>
Sourcepub fn build_dynamic_overrides(
&self,
deployer_config: &DeployerConfig,
caproni_config: &CaproniConfig,
) -> Result<Option<Value>, HelmError>
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>
impl<B: HelmBackend> Manager<B>
Sourcepub fn deploy(
&self,
deployer_config: &DeployerConfig,
cfg: &Container,
) -> Result<(), HelmError>
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).
Sourcepub fn status(
&self,
deployer_config: &DeployerConfig,
_caproni_config: &CaproniConfig,
) -> Result<Status, HelmError>
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.
Sourcepub fn undeploy(
&self,
deployer_config: &DeployerConfig,
caproni_config: &CaproniConfig,
) -> Result<(), HelmError>
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.
Sourcepub fn prepare_chart_source(
&self,
deployer_config: &DeployerConfig,
caproni_config: &CaproniConfig,
) -> Result<(String, Box<dyn FnOnce()>), HelmError>
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:
- Edit mode with repository — uses the local cloned directory path.
- Repository-based chart — runs
helm repo add/update, returns arepo/chartreference. - Direct chart reference (OCI, local path, etc.) — returns the chart string as-is.
- 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.
Sourcepub fn validate(
&self,
deployer_config: &DeployerConfig,
caproni_config: &CaproniConfig,
) -> Result<(), HelmError>
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.
impl<B: HelmBackend> Manager for Manager<B>
Lets the orchestrator drive a helm Manager through the registry.
Source§fn deployer_type(&self) -> String
fn deployer_type(&self) -> String
"helm").Source§fn deploy(
&self,
deployer_config: &DeployerConfig,
cfg: Option<&Container>,
) -> Result<(), Box<dyn Error + Send + Sync>>
fn deploy( &self, deployer_config: &DeployerConfig, cfg: Option<&Container>, ) -> Result<(), Box<dyn Error + Send + Sync>>
Source§fn undeploy(
&self,
deployer_config: &DeployerConfig,
caproni_config: &CaproniConfig,
) -> Result<(), Box<dyn Error + Send + Sync>>
fn undeploy( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<(), Box<dyn Error + Send + Sync>>
Source§fn status(
&self,
deployer_config: &DeployerConfig,
caproni_config: &CaproniConfig,
) -> Result<Status, Box<dyn Error + Send + Sync>>
fn status( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<Status, Box<dyn Error + Send + Sync>>
Source§fn validate(
&self,
deployer_config: &DeployerConfig,
caproni_config: &CaproniConfig,
) -> Result<(), Box<dyn Error + Send + Sync>>
fn validate( &self, deployer_config: &DeployerConfig, caproni_config: &CaproniConfig, ) -> Result<(), Box<dyn Error + Send + Sync>>
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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