MCPcopy Create free account
hub / github.com/Qovery/engine / run

Method run

lib-engine/src/infrastructure/action/mod.rs:55–171  ·  view source on GitHub ↗
(&self, infra_ctx: &InfrastructureContext, action: Action)

Source from the content-addressed store, hash-verified

53 ) -> Result<(), Box<EngineError>>;
54
55 fn run(&self, infra_ctx: &InfrastructureContext, action: Action) -> Result<(), Box<EngineError>> {
56 let step = match action {
57 Action::Create => InfrastructureStep::Create,
58 Action::Pause => InfrastructureStep::Pause,
59 Action::Delete => InfrastructureStep::Delete,
60 Action::Restart => InfrastructureStep::RestartedError,
61 };
62 let logger = mk_logger(infra_ctx.kubernetes(), step);
63 let kubernetes = infra_ctx.kubernetes();
64 let cloud_provider = infra_ctx.cloud_provider();
65 if infra_ctx.context().is_dry_run_deploy() {
66 logger.warn("👻 Dry run mode is enabled. No changes will be made to the infrastructure");
67 }
68
69 logger.info(format!(
70 "{} {} cluster {}",
71 action,
72 infra_ctx.kubernetes().kind(),
73 infra_ctx.kubernetes().name()
74 ));
75
76 match action {
77 Action::Create => {
78 let mut cluster_has_been_upgraded = false;
79 if infra_ctx.context().is_first_cluster_deployment() {
80 self.bootstap_cluster(infra_ctx)?;
81 } else if let Some(upgrade_status) = self.is_upgrade_required(infra_ctx) {
82 let kube_client = infra_ctx.mk_kube_client()?;
83 let event_details = kubernetes.get_event_details(Infrastructure(InfrastructureStep::Upgrade));
84 let cluster_id = infra_ctx.context().cluster_long_id();
85
86 logger.info("Check if cluster has no calls to deprecated kubernetes API in next version");
87 info!(
88 "Running deprecated API compatibility check with scanner `pluto` for cluster `{}`",
89 cluster_id
90 );
91 let compatibility_check = infra_ctx
92 .kubernetes_api_deprecation_service()
93 .is_cluster_fully_compatible_with_kubernetes_version(
94 kubernetes.kubeconfig_local_file_path().as_path(),
95 Some(&upgrade_status.requested_version),
96 &cloud_provider.credentials_environment_variables(),
97 KubernetesApiDeprecationServiceGranuality::WithQoveryMetadata {
98 kube_client: kube_client.as_ref(),
99 },
100 );
101
102 match compatibility_check {
103 Ok(_) => logger.info("Cluster is compatible with the next version"),
104 Err(e) => {
105 return Err(Box::new(EngineError::new_k8s_deprecated_api_calls_found_error(
106 event_details.clone(),
107 &upgrade_status.requested_version,
108 e,
109 )));
110 }
111 }
112

Callers 2

deploy_charts_onceFunction · 0.45
install_karpenter_chartsFunction · 0.45

Implementers 6

mod.rslib-engine/src/infrastructure/action/g
mod.rslib-engine/src/infrastructure/action/a
mod.rslib-engine/src/infrastructure/action/s
mod.rslib-engine/src/infrastructure/action/e
mod.rslib-engine/src/infrastructure/action/s
mod.rslib-engine/src/infrastructure/action/e

Calls 15

mk_loggerFunction · 0.85
InfrastructureInterface · 0.85
kubernetesMethod · 0.80
is_dry_run_deployMethod · 0.80
mk_kube_clientMethod · 0.80
cluster_long_idMethod · 0.80
as_refMethod · 0.80
cloud_providerMethod · 0.45

Tested by

no test coverage detected