Fix/ci self hosted (#543)

This commit is contained in:
MacLikorne
2022-01-05 11:05:50 +01:00
committed by GitHub
parent 4d92ed9d04
commit ac73c0bb85
10 changed files with 36 additions and 21 deletions

View File

@@ -7,6 +7,7 @@ resource "aws_eks_node_group" "eks_cluster_workers_{{ loop.index }}" {
subnet_ids = flatten([aws_subnet.eks_zone_a[*].id, aws_subnet.eks_zone_b[*].id, aws_subnet.eks_zone_c[*].id])
instance_types = ["{{ eks_worker_node.instance_type }}"]
ami_type = "AL2_x86_64"
disk_size = "{{ eks_worker_node.disk_size_in_gib }}"
tags = merge(
local.tags_eks,

View File

@@ -75,17 +75,18 @@ mod tests {
#[test]
fn test_groups_nodes() {
assert!(NodeGroups::new("".to_string(), 2, 1, "t2.large".to_string()).is_err());
assert!(NodeGroups::new("".to_string(), 2, 2, "t2.large".to_string()).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 3, "t2.large".to_string()).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 1, "t2.large".to_string(), 20).is_err());
assert!(NodeGroups::new("".to_string(), 2, 2, "t2.large".to_string(), 20).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 3, "t2.large".to_string(), 20).is_ok());
assert_eq!(
NodeGroups::new("".to_string(), 2, 2, "t2.large".to_string()).unwrap(),
NodeGroups::new("".to_string(), 2, 2, "t2.large".to_string(), 20).unwrap(),
NodeGroups {
name: "".to_string(),
min_nodes: 2,
max_nodes: 2,
instance_type: "t2.large".to_string()
instance_type: "t2.large".to_string(),
disk_size_in_gib: 20
}
);
}

View File

@@ -80,17 +80,18 @@ mod tests {
#[test]
fn test_groups_nodes() {
assert!(NodeGroups::new("".to_string(), 2, 1, "s-2vcpu-4gb".to_string()).is_err());
assert!(NodeGroups::new("".to_string(), 2, 2, "s-2vcpu-4gb".to_string()).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 3, "s-2vcpu-4gb".to_string()).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 1, "s-2vcpu-4gb".to_string(), 20).is_err());
assert!(NodeGroups::new("".to_string(), 2, 2, "s-2vcpu-4gb".to_string(), 20).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 3, "s-2vcpu-4gb".to_string(), 20).is_ok());
assert_eq!(
NodeGroups::new("".to_string(), 2, 2, "s-2vcpu-4gb".to_string()).unwrap(),
NodeGroups::new("".to_string(), 2, 2, "s-2vcpu-4gb".to_string(), 20).unwrap(),
NodeGroups {
name: "".to_string(),
min_nodes: 2,
max_nodes: 2,
instance_type: "s-2vcpu-4gb".to_string()
instance_type: "s-2vcpu-4gb".to_string(),
disk_size_in_gib: 20
}
);
}

View File

@@ -1065,7 +1065,13 @@ pub trait InstanceType {
}
impl NodeGroups {
pub fn new(group_name: String, min_nodes: i32, max_nodes: i32, instance_type: String) -> Result<Self, SimpleError> {
pub fn new(
group_name: String,
min_nodes: i32,
max_nodes: i32,
instance_type: String,
disk_size_in_gib: i32,
) -> Result<Self, SimpleError> {
if min_nodes > max_nodes {
return Err(SimpleError {
kind: SimpleErrorKind::Other,
@@ -1081,6 +1087,7 @@ impl NodeGroups {
min_nodes,
max_nodes,
instance_type,
disk_size_in_gib,
})
}
}

View File

@@ -68,6 +68,7 @@ pub struct NodeGroups {
pub min_nodes: i32,
pub max_nodes: i32,
pub instance_type: String,
pub disk_size_in_gib: i32,
}
#[derive(Serialize, Deserialize)]
@@ -76,4 +77,5 @@ pub struct NodeGroupsFormat {
pub min_nodes: String,
pub max_nodes: String,
pub instance_type: String,
pub disk_size_in_gib: String,
}

View File

@@ -96,17 +96,18 @@ mod tests {
#[test]
fn test_groups_nodes() {
assert!(NodeGroups::new("".to_string(), 2, 1, "dev1-l".to_string()).is_err());
assert!(NodeGroups::new("".to_string(), 2, 2, "dev1-l".to_string()).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 3, "dev1-l".to_string()).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 1, "dev1-l".to_string(), 20).is_err());
assert!(NodeGroups::new("".to_string(), 2, 2, "dev1-l".to_string(), 20).is_ok());
assert!(NodeGroups::new("".to_string(), 2, 3, "dev1-l".to_string(), 20).is_ok());
assert_eq!(
NodeGroups::new("".to_string(), 2, 2, "dev1-l".to_string()).unwrap(),
NodeGroups::new("".to_string(), 2, 2, "dev1-l".to_string(), 20).unwrap(),
NodeGroups {
name: "".to_string(),
min_nodes: 2,
max_nodes: 2,
instance_type: "dev1-l".to_string()
instance_type: "dev1-l".to_string(),
disk_size_in_gib: 20
}
);
}

View File

@@ -112,8 +112,10 @@ impl Cluster<AWS, Options> for AWS {
}
fn kubernetes_nodes() -> Vec<NodeGroups> {
vec![NodeGroups::new("groupeks0".to_string(), 5, 10, "t3a.large".to_string())
.expect("Problem while setup EKS nodes")]
vec![
NodeGroups::new("groupeks0".to_string(), 5, 10, "t3a.large".to_string(), 100)
.expect("Problem while setup EKS nodes"),
]
}
fn kubernetes_cluster_options(secrets: FuncTestsSecrets, _cluster_name: Option<String>) -> Options {

View File

@@ -99,7 +99,7 @@ impl Cluster<DO, DoksOptions> for DO {
fn kubernetes_nodes() -> Vec<NodeGroups> {
vec![
NodeGroups::new("groupdoks0".to_string(), 5, 10, "s-4vcpu-8gb".to_string())
NodeGroups::new("groupdoks0".to_string(), 5, 10, "s-4vcpu-8gb".to_string(), 0)
.expect("Problem while setup DOKS nodes"),
]
}

View File

@@ -121,7 +121,7 @@ impl Cluster<Scaleway, KapsuleOptions> for Scaleway {
fn kubernetes_nodes() -> Vec<NodeGroups> {
// Note: Dev1M is a bit too small to handle engine + local docker, hence using Dev1L
vec![NodeGroups::new("groupscw0".to_string(), 5, 10, "dev1-l".to_string())
vec![NodeGroups::new("groupscw0".to_string(), 5, 10, "dev1-l".to_string(), 0)
.expect("Problem while setup SCW nodes")]
}

View File

@@ -9,7 +9,7 @@ use test_utilities::utilities::{context, engine_run_test, generate_cluster_id, g
#[cfg(feature = "test-scw-whole-enchilada")]
#[named]
#[test]
fn create_upgrade_and_destroy_kapsule_cluster_with_env_in_par_2() {
fn create_and_destroy_kapsule_cluster_with_env_in_par_2() {
let logger = logger();
let context = context();
let zone = Zone::Paris2;