Skip to content

Commit

Permalink
metal: add bundles-override argument to eks-a
Browse files Browse the repository at this point in the history
  • Loading branch information
gthao313 committed May 6, 2024
1 parent 5d504c2 commit befef74
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ use agent_utils::aws::aws_config;
use agent_utils::base64_decode_write_file;
use agent_utils::ssm::{create_ssm_activation, ensure_ssm_service_role, wait_for_ssm_ready};
use bottlerocket_agents::clusters::{
install_eks_a_binary, retrieve_workload_cluster_kubeconfig, write_validate_mgmt_kubeconfig,
download_eks_a_bundle, install_eks_a_binary, retrieve_workload_cluster_kubeconfig,
write_validate_mgmt_kubeconfig,
};
use bottlerocket_types::agent_config::{
CustomUserData, MetalK8sClusterConfig, AWS_CREDENTIALS_SECRET_NAME,
Expand Down Expand Up @@ -168,6 +169,7 @@ impl Create for MetalK8sClusterCreator {
)?;

let mgmt_kubeconfig_path = format!("{}/mgmt.kubeconfig", WORKING_DIR);
let bundle_manifest_path = format!("{}/bundles.yaml", WORKING_DIR);
let eksa_config_path = format!("{}/cluster.yaml", WORKING_DIR);
let hardware_csv_path = format!("{}/hardware.csv", WORKING_DIR);
base64_decode_write_file(&spec.configuration.hardware_csv_base64, &hardware_csv_path)
Expand Down Expand Up @@ -234,6 +236,12 @@ impl Create for MetalK8sClusterCreator {
)?;

install_eks_a_binary(&spec.configuration.eks_a_release_manifest_url, &resources).await?;
download_eks_a_bundle(
&spec.configuration.eks_a_release_manifest_url,
&bundle_manifest_path,
&resources,
)
.await?;

info!("Creating cluster");
memo.current_status = "Creating cluster".to_string();
Expand All @@ -252,6 +260,7 @@ impl Create for MetalK8sClusterCreator {
let status = Command::new("eksctl")
.args(["anywhere", "create", "cluster"])
.args(["--kubeconfig", &mgmt_kubeconfig_path])
.args(["--bundles-override", &bundle_manifest_path])
.args(["-f", &eksa_config_path])
.args(["--hardware-csv", &hardware_csv_path])
.arg("--skip-ip-check")
Expand Down Expand Up @@ -529,6 +538,7 @@ impl Destroy for MetalK8sClusterDestroyer {

// Set the cluster deletion configs paths
let mgmt_kubeconfig_path = format!("{}/mgmt.kubeconfig", WORKING_DIR);
let bundle_manifest_path = format!("{}/bundle.yaml", WORKING_DIR);
let eksa_config_path = format!("{}/cluster.yaml", WORKING_DIR);
let workload_kubeconfig_path =
format!("{}/{}-eks-a-cluster.kubeconfig", WORKING_DIR, cluster_name);
Expand All @@ -539,6 +549,12 @@ impl Destroy for MetalK8sClusterDestroyer {
.configuration;

install_eks_a_binary(&configuration.eks_a_release_manifest_url, &resources).await?;
download_eks_a_bundle(
&configuration.eks_a_release_manifest_url,
&bundle_manifest_path,
&resources,
)
.await?;

base64_decode_write_file(
&configuration.mgmt_cluster_kubeconfig_base64,
Expand Down Expand Up @@ -578,6 +594,7 @@ impl Destroy for MetalK8sClusterDestroyer {
let status = Command::new("eksctl")
.args(["anywhere", "delete", "cluster"])
.args(["--kubeconfig", &mgmt_kubeconfig_path])
.args(["--bundles-override", &bundle_manifest_path])
.args(["-f", &eksa_config_path])
.args(["--w-config", &workload_kubeconfig_path])
.args(["-v", "4"])
Expand Down

0 comments on commit befef74

Please sign in to comment.