Skip to content

Commit

Permalink
Merge pull request bottlerocket-os#3440 from etungsten/testsys-eks-en…
Browse files Browse the repository at this point in the history
…dpoint

testsys: support for overriding EKS service endpoint
  • Loading branch information
etungsten authored Sep 13, 2023
2 parents 3434f0c + 810d719 commit f511ff1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tools/testsys-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ pub struct DeveloperConfig {
pub keep_tests_running: Option<bool>,
/// Use an alternate account for image lookup
pub image_account_id: Option<String>,
/// Overrides the EKS service endpoint for TestSys agents gathering EKS cluster metadata
/// (only for pre-existing EKS clusters, does not apply to new EKS cluster creation)
pub eks_service_endpoint: Option<String>,
}

impl DeveloperConfig {
Expand All @@ -374,6 +377,7 @@ impl DeveloperConfig {
.or(other.bottlerocket_destruction_policy),
keep_tests_running: self.keep_tests_running.or(other.keep_tests_running),
image_account_id: self.image_account_id.or(other.image_account_id),
eks_service_endpoint: self.eks_service_endpoint.or(other.eks_service_endpoint),
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions tools/testsys/src/aws_k8s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ impl CrdCreator for AwsK8sCreator {

let eks_crd = EksClusterConfig::builder()
.creation_policy(CreationPolicy::IfNotExists)
.eks_service_endpoint(
cluster_input
.crd_input
.config
.dev
.eks_service_endpoint
.clone(),
)
.assume_role(cluster_input.crd_input.config.agent_role.clone())
.config(config)
.image(
Expand Down
4 changes: 2 additions & 2 deletions tools/testsys/src/aws_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub(crate) async fn ec2_crd<'a>(
// Add in the EKS specific configuration.
if cluster_type == ClusterType::Eks {
ec2_builder
.subnet_ids_template(cluster_name, "privateSubnetIds")
.subnet_ids_template(cluster_name, "publicSubnetIds")
.endpoint_template(cluster_name, "endpoint")
.certificate_template(cluster_name, "certificate")
.cluster_dns_ip_template(cluster_name, "clusterDnsIp")
Expand Down Expand Up @@ -305,7 +305,7 @@ pub(crate) async fn ec2_karpenter_crd<'a>(
)
.cluster_name_template(cluster_name, "clusterName")
.region_template(cluster_name, "region")
.subnet_ids_template(cluster_name, "privateSubnetIds")
.subnet_ids_template(cluster_name, "publicSubnetIds")
.endpoint_template(cluster_name, "endpoint")
.cluster_sg_template(cluster_name, "clustersharedSg")
.device_mappings(device_mappings)
Expand Down

0 comments on commit f511ff1

Please sign in to comment.