mirror of
https://github.com/jlengrand/engine.git
synced 2026-04-28 00:01:17 +00:00
feat: add qovery location (client side/qovery side)
This commit is contained in:
committed by
Pierre Mavro
parent
c155c8e2c6
commit
da8b02e8bc
@@ -1,9 +1,10 @@
|
||||
use crate::cloud_provider::aws::kubernetes::{Options, VpcQoveryNetworkMode};
|
||||
use crate::cloud_provider::helm::{
|
||||
get_chart_namespace, ChartInfo, ChartPayload, ChartSetValue, ChartValuesGenerated, CommonChart, CoreDNSConfigChart,
|
||||
HelmAction, HelmChart, HelmChartNamespaces, PrometheusOperatorConfigChart,
|
||||
get_chart_namespace, get_engine_helm_action_from_location, ChartInfo, ChartPayload, ChartSetValue,
|
||||
ChartValuesGenerated, CommonChart, CoreDNSConfigChart, HelmAction, HelmChart, HelmChartNamespaces,
|
||||
PrometheusOperatorConfigChart,
|
||||
};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, EngineLocation, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::cmd::kubectl::{kubectl_exec_get_daemonset, kubectl_exec_with_output};
|
||||
use crate::error::{SimpleError, SimpleErrorKind};
|
||||
use semver::Version;
|
||||
@@ -37,6 +38,7 @@ pub struct ChartsConfigPrerequisites {
|
||||
pub aws_access_key_id: String,
|
||||
pub aws_secret_access_key: String,
|
||||
pub vpc_qovery_network_mode: VpcQoveryNetworkMode,
|
||||
pub qovery_engine_location: EngineLocation,
|
||||
pub ff_log_history_enabled: bool,
|
||||
pub ff_metrics_history_enabled: bool,
|
||||
pub managed_dns_name: String,
|
||||
@@ -1063,6 +1065,7 @@ datasources:
|
||||
let qovery_engine = CommonChart {
|
||||
chart_info: ChartInfo {
|
||||
name: "qovery-engine".to_string(),
|
||||
action: get_engine_helm_action_from_location(&chart_config_prerequisites.qovery_engine_location),
|
||||
path: chart_path("common/charts/qovery-engine"),
|
||||
namespace: HelmChartNamespaces::Qovery,
|
||||
timeout: "900".to_string(),
|
||||
|
||||
@@ -20,6 +20,7 @@ use crate::cloud_provider::kubernetes::{
|
||||
KubernetesUpgradeStatus,
|
||||
};
|
||||
use crate::cloud_provider::models::WorkerNodeDataTemplate;
|
||||
use crate::cloud_provider::qovery::EngineLocation;
|
||||
use crate::cloud_provider::{kubernetes, CloudProvider};
|
||||
use crate::cmd;
|
||||
use crate::cmd::kubectl::{
|
||||
@@ -89,6 +90,7 @@ pub struct Options {
|
||||
pub elasticsearch_cidr_subnet: String,
|
||||
// Qovery
|
||||
pub qovery_api_url: String,
|
||||
pub qovery_engine_location: EngineLocation,
|
||||
pub engine_version_controller_token: String,
|
||||
pub agent_version_controller_token: String,
|
||||
pub grafana_admin_user: String,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::cloud_provider::digitalocean::kubernetes::DoksOptions;
|
||||
use crate::cloud_provider::helm::{
|
||||
get_chart_namespace, ChartInfo, ChartSetValue, ChartValuesGenerated, CommonChart, CoreDNSConfigChart, HelmAction,
|
||||
HelmChart, HelmChartNamespaces, PrometheusOperatorConfigChart,
|
||||
get_chart_namespace, get_engine_helm_action_from_location, ChartInfo, ChartSetValue, ChartValuesGenerated,
|
||||
CommonChart, CoreDNSConfigChart, HelmAction, HelmChart, HelmChartNamespaces, PrometheusOperatorConfigChart,
|
||||
};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, EngineLocation, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::error::{SimpleError, SimpleErrorKind};
|
||||
use semver::Version;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -33,6 +33,7 @@ pub struct ChartsConfigPrerequisites {
|
||||
pub do_space_secret_key: String,
|
||||
pub do_space_bucket_kubeconfig: String,
|
||||
pub do_space_kubeconfig_filename: String,
|
||||
pub qovery_engine_location: EngineLocation,
|
||||
pub ff_log_history_enabled: bool,
|
||||
pub ff_metrics_history_enabled: bool,
|
||||
pub managed_dns_name: String,
|
||||
@@ -62,6 +63,7 @@ impl ChartsConfigPrerequisites {
|
||||
do_space_secret_key: String,
|
||||
do_space_bucket_kubeconfig: String,
|
||||
do_space_kubeconfig_filename: String,
|
||||
qovery_engine_location: EngineLocation,
|
||||
ff_log_history_enabled: bool,
|
||||
ff_metrics_history_enabled: bool,
|
||||
managed_dns_name: String,
|
||||
@@ -88,6 +90,7 @@ impl ChartsConfigPrerequisites {
|
||||
do_space_secret_key,
|
||||
do_space_bucket_kubeconfig,
|
||||
do_space_kubeconfig_filename,
|
||||
qovery_engine_location,
|
||||
ff_log_history_enabled,
|
||||
ff_metrics_history_enabled,
|
||||
managed_dns_name,
|
||||
@@ -888,6 +891,7 @@ datasources:
|
||||
let qovery_engine = CommonChart {
|
||||
chart_info: ChartInfo {
|
||||
name: "qovery-engine".to_string(),
|
||||
action: get_engine_helm_action_from_location(&chart_config_prerequisites.qovery_engine_location),
|
||||
path: chart_path("common/charts/qovery-engine"),
|
||||
namespace: HelmChartNamespaces::Qovery,
|
||||
timeout: "900".to_string(),
|
||||
|
||||
@@ -21,6 +21,7 @@ use crate::cloud_provider::environment::Environment;
|
||||
use crate::cloud_provider::helm::{deploy_charts_levels, ChartInfo, ChartSetValue, HelmChartNamespaces};
|
||||
use crate::cloud_provider::kubernetes::{uninstall_cert_manager, Kind, Kubernetes, KubernetesNode};
|
||||
use crate::cloud_provider::models::WorkerNodeDataTemplate;
|
||||
use crate::cloud_provider::qovery::EngineLocation;
|
||||
use crate::cloud_provider::{kubernetes, CloudProvider};
|
||||
use crate::cmd::helm::{helm_exec_upgrade_with_chart_info, helm_upgrade_diff_with_chart_info};
|
||||
use crate::cmd::kubectl::{do_kubectl_exec_get_loadbalancer_id, kubectl_exec_get_all_namespaces};
|
||||
@@ -48,7 +49,7 @@ pub mod doks_api;
|
||||
pub mod helm_charts;
|
||||
pub mod node;
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct DoksOptions {
|
||||
// Digital Ocean
|
||||
@@ -57,6 +58,7 @@ pub struct DoksOptions {
|
||||
pub vpc_cidr_set: VpcInitKind,
|
||||
// Qovery
|
||||
pub qovery_api_url: String,
|
||||
pub qovery_engine_location: EngineLocation,
|
||||
pub engine_version_controller_token: String,
|
||||
pub agent_version_controller_token: String,
|
||||
pub grafana_admin_user: String,
|
||||
@@ -662,6 +664,7 @@ impl<'a> Kubernetes for DOKS<'a> {
|
||||
do_space_secret_key: self.cloud_provider.spaces_secret_key.to_string(),
|
||||
do_space_bucket_kubeconfig: self.kubeconfig_bucket_name(),
|
||||
do_space_kubeconfig_filename: self.kubeconfig_file_name(),
|
||||
qovery_engine_location: self.options.qovery_engine_location.clone(),
|
||||
ff_log_history_enabled: self.context.is_feature_enabled(&Features::LogsHistory),
|
||||
ff_metrics_history_enabled: self.context.is_feature_enabled(&Features::MetricsHistory),
|
||||
managed_dns_name: self.dns_provider.domain().to_string(),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::cloud_provider::helm::HelmAction::Deploy;
|
||||
use crate::cloud_provider::helm::HelmChartNamespaces::KubeSystem;
|
||||
use crate::cloud_provider::qovery::EngineLocation;
|
||||
use crate::cmd::helm::{
|
||||
helm_destroy_chart_if_breaking_changes_version_detected, helm_exec_uninstall_with_chart_info,
|
||||
helm_exec_upgrade_with_chart_info, helm_upgrade_diff_with_chart_info, is_chart_deployed,
|
||||
@@ -690,6 +691,13 @@ pub fn get_latest_successful_deployment(helm_history_list: &[HelmHistoryRow]) ->
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_engine_helm_action_from_location(location: &EngineLocation) -> HelmAction {
|
||||
match location {
|
||||
EngineLocation::ClientSide => HelmAction::Deploy,
|
||||
EngineLocation::QoverySide => HelmAction::Destroy,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::cloud_provider::helm::get_latest_successful_deployment;
|
||||
|
||||
@@ -16,6 +16,12 @@ pub struct QoveryEngine {
|
||||
pub object_type: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub enum EngineLocation {
|
||||
ClientSide,
|
||||
QoverySide,
|
||||
}
|
||||
|
||||
pub enum QoveryApp {
|
||||
QoveryAgent,
|
||||
QoveryEngine,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::cloud_provider::helm::{
|
||||
get_chart_namespace, ChartInfo, ChartSetValue, ChartValuesGenerated, CommonChart, CoreDNSConfigChart, HelmAction,
|
||||
get_chart_namespace, get_engine_helm_action_from_location, ChartInfo, ChartSetValue, ChartValuesGenerated, CommonChart, CoreDNSConfigChart, HelmAction,
|
||||
HelmChart, HelmChartNamespaces, PrometheusOperatorConfigChart,
|
||||
};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::cloud_provider::qovery::{get_qovery_app_version, EngineLocation, QoveryAgent, QoveryAppName, QoveryEngine};
|
||||
use crate::cloud_provider::scaleway::application::{Region, Zone};
|
||||
use crate::cloud_provider::scaleway::kubernetes::KapsuleOptions;
|
||||
use crate::error::{SimpleError, SimpleErrorKind};
|
||||
@@ -28,6 +28,7 @@ pub struct ChartsConfigPrerequisites {
|
||||
pub scw_access_key: String,
|
||||
pub scw_secret_key: String,
|
||||
pub scw_project_id: String,
|
||||
pub qovery_engine_location: EngineLocation,
|
||||
pub ff_log_history_enabled: bool,
|
||||
pub ff_metrics_history_enabled: bool,
|
||||
pub managed_dns_name: String,
|
||||
@@ -53,7 +54,7 @@ impl ChartsConfigPrerequisites {
|
||||
test_cluster: bool,
|
||||
scw_access_key: String,
|
||||
scw_secret_key: String,
|
||||
scw_project_id: String,
|
||||
qovery_engine_location: EngineLocation,
|
||||
ff_log_history_enabled: bool,
|
||||
ff_metrics_history_enabled: bool,
|
||||
managed_dns_name: String,
|
||||
@@ -78,6 +79,7 @@ impl ChartsConfigPrerequisites {
|
||||
scw_access_key,
|
||||
scw_secret_key,
|
||||
scw_project_id,
|
||||
qovery_engine_location,
|
||||
ff_log_history_enabled,
|
||||
ff_metrics_history_enabled,
|
||||
managed_dns_name,
|
||||
@@ -767,6 +769,7 @@ datasources:
|
||||
let qovery_engine = CommonChart {
|
||||
chart_info: ChartInfo {
|
||||
name: "qovery-engine".to_string(),
|
||||
action: get_engine_helm_action_from_location(&chart_config_prerequisites.qovery_engine_location),
|
||||
path: chart_path("common/charts/qovery-engine"),
|
||||
namespace: HelmChartNamespaces::Qovery,
|
||||
timeout: "900".to_string(),
|
||||
|
||||
@@ -36,7 +36,7 @@ use std::env;
|
||||
use std::path::PathBuf;
|
||||
use tera::Context as TeraContext;
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct KapsuleOptions {
|
||||
// Qovery
|
||||
pub qovery_api_url: String,
|
||||
@@ -47,6 +47,7 @@ pub struct KapsuleOptions {
|
||||
pub grafana_admin_user: String,
|
||||
pub grafana_admin_password: String,
|
||||
pub agent_version_controller_token: String,
|
||||
pub qovery_engine_location: EngineLocation,
|
||||
pub engine_version_controller_token: String,
|
||||
|
||||
// Scaleway
|
||||
@@ -68,6 +69,7 @@ impl KapsuleOptions {
|
||||
grafana_admin_user: String,
|
||||
grafana_admin_password: String,
|
||||
agent_version_controller_token: String,
|
||||
qovery_engine_location: EngineLocation,
|
||||
engine_version_controller_token: String,
|
||||
scaleway_project_id: String,
|
||||
scaleway_access_key: String,
|
||||
@@ -83,6 +85,7 @@ impl KapsuleOptions {
|
||||
grafana_admin_user,
|
||||
grafana_admin_password,
|
||||
agent_version_controller_token,
|
||||
qovery_engine_location,
|
||||
engine_version_controller_token,
|
||||
scaleway_project_id,
|
||||
scaleway_access_key,
|
||||
@@ -536,6 +539,7 @@ impl<'a> Kubernetes for Kapsule<'a> {
|
||||
self.cloud_provider.access_key.to_string(),
|
||||
self.cloud_provider.secret_key.to_string(),
|
||||
self.options.scaleway_project_id.to_string(),
|
||||
self.options.qovery_engine_location.clone(),
|
||||
self.context.is_feature_enabled(&Features::LogsHistory),
|
||||
self.context.is_feature_enabled(&Features::MetricsHistory),
|
||||
self.dns_provider.domain().to_string(),
|
||||
|
||||
@@ -14,6 +14,7 @@ use qovery_engine::models::Context;
|
||||
|
||||
use crate::cloudflare::dns_provider_cloudflare;
|
||||
use crate::utilities::{build_platform_local_docker, FuncTestsSecrets};
|
||||
use qovery_engine::cloud_provider::qovery::EngineLocation::ClientSide;
|
||||
|
||||
pub const AWS_QOVERY_ORGANIZATION_ID: &str = "u8nb94c7fwxzr2jt";
|
||||
pub const AWS_REGION_FOR_S3: &str = "eu-west-3";
|
||||
@@ -151,6 +152,7 @@ pub fn eks_options(secrets: FuncTestsSecrets) -> Options {
|
||||
elasticache_cidr_subnet: "23".to_string(),
|
||||
elasticsearch_cidr_subnet: "23".to_string(),
|
||||
qovery_api_url: secrets.QOVERY_API_URL.unwrap(),
|
||||
qovery_engine_location: ClientSide,
|
||||
engine_version_controller_token: secrets.QOVERY_ENGINE_CONTROLLER_TOKEN.unwrap(),
|
||||
agent_version_controller_token: secrets.QOVERY_AGENT_CONTROLLER_TOKEN.unwrap(),
|
||||
grafana_admin_user: "admin".to_string(),
|
||||
|
||||
@@ -15,6 +15,7 @@ use qovery_engine::transaction::{DeploymentOption, TransactionResult};
|
||||
use crate::cloudflare::dns_provider_cloudflare;
|
||||
use crate::utilities::{build_platform_local_docker, FuncTestsSecrets};
|
||||
use qovery_engine::cloud_provider::digitalocean::application::Region;
|
||||
use qovery_engine::cloud_provider::qovery::EngineLocation;
|
||||
|
||||
pub const DO_QOVERY_ORGANIZATION_ID: &str = "z3bc003d2";
|
||||
pub const DO_KUBERNETES_VERSION: &str = "1.19";
|
||||
@@ -109,6 +110,7 @@ pub fn do_kubernetes_cluster_options(secrets: FuncTestsSecrets, cluster_name: St
|
||||
vpc_cidr_set: VpcInitKind::Autodetect,
|
||||
vpc_name: cluster_name,
|
||||
qovery_api_url: secrets.QOVERY_API_URL.unwrap(),
|
||||
qovery_engine_location: EngineLocation::ClientSide,
|
||||
engine_version_controller_token: secrets.QOVERY_ENGINE_CONTROLLER_TOKEN.unwrap(),
|
||||
agent_version_controller_token: secrets.QOVERY_AGENT_CONTROLLER_TOKEN.unwrap(),
|
||||
grafana_admin_user: "admin".to_string(),
|
||||
|
||||
@@ -15,6 +15,7 @@ use qovery_engine::transaction::{DeploymentOption, TransactionResult};
|
||||
use crate::cloudflare::dns_provider_cloudflare;
|
||||
use crate::utilities::{build_platform_local_docker, generate_id, FuncTestsSecrets};
|
||||
|
||||
use qovery_engine::cloud_provider::qovery::EngineLocation;
|
||||
use tracing::error;
|
||||
|
||||
pub const SCW_QOVERY_ORGANIZATION_ID: &str = "zcf8e78e6";
|
||||
@@ -102,6 +103,7 @@ pub fn scw_kubernetes_cluster_options(secrets: FuncTestsSecrets) -> KapsuleOptio
|
||||
secrets
|
||||
.QOVERY_AGENT_CONTROLLER_TOKEN
|
||||
.expect("QOVERY_AGENT_CONTROLLER_TOKEN is not set in secrets"),
|
||||
EngineLocation::ClientSide,
|
||||
secrets
|
||||
.QOVERY_ENGINE_CONTROLLER_TOKEN
|
||||
.expect("QOVERY_ENGINE_CONTROLLER_TOKEN is not set in secrets"),
|
||||
|
||||
Reference in New Issue
Block a user