fix: Use ssh key from FileContent in OKDIpxe score instead of hardcoded path
Some checks failed
Run Check Script / check (pull_request) Failing after 28s
Some checks failed
Run Check Script / check (pull_request) Failing after 28s
This commit is contained in:
parent
b765e9b7dc
commit
680902e450
@ -13,7 +13,7 @@ use harmony::{
|
|||||||
okd::{
|
okd::{
|
||||||
bootstrap_dhcp::OKDBootstrapDhcpScore,
|
bootstrap_dhcp::OKDBootstrapDhcpScore,
|
||||||
bootstrap_load_balancer::OKDBootstrapLoadBalancerScore, dhcp::OKDDhcpScore,
|
bootstrap_load_balancer::OKDBootstrapLoadBalancerScore, dhcp::OKDDhcpScore,
|
||||||
dns::OKDDnsScore, ipxe::OkdIpxeScore,
|
dns::OKDDnsScore, ipxe::OKDIpxeScore,
|
||||||
},
|
},
|
||||||
tftp::TftpScore,
|
tftp::TftpScore,
|
||||||
},
|
},
|
||||||
@ -136,10 +136,10 @@ async fn main() {
|
|||||||
let cluster_pubkey_filename = "cluster_ssh_key.pub".to_string();
|
let cluster_pubkey_filename = "cluster_ssh_key.pub".to_string();
|
||||||
let harmony_inventory_agent = "harmony_inventory_agent".to_string();
|
let harmony_inventory_agent = "harmony_inventory_agent".to_string();
|
||||||
|
|
||||||
let ipxe_score = OkdIpxeScore {
|
let ipxe_score = OKDIpxeScore {
|
||||||
kickstart_filename,
|
kickstart_filename,
|
||||||
harmony_inventory_agent,
|
harmony_inventory_agent,
|
||||||
cluster_pubkey_filename,
|
cluster_pubkey,
|
||||||
};
|
};
|
||||||
|
|
||||||
harmony_tui::run(
|
harmony_tui::run(
|
||||||
|
@ -2,21 +2,25 @@ mod topology;
|
|||||||
|
|
||||||
use crate::topology::{get_inventory, get_topology};
|
use crate::topology::{get_inventory, get_topology};
|
||||||
use harmony::{
|
use harmony::{
|
||||||
modules::okd::{installation::OKDInstallationScore, ipxe::OkdIpxeScore},
|
config::secret::SshKeyPair, data::{FileContent, FilePath}, modules::okd::{installation::OKDInstallationScore, ipxe::OKDIpxeScore}, score::Score, topology::HAClusterTopology
|
||||||
score::Score,
|
|
||||||
topology::HAClusterTopology,
|
|
||||||
};
|
};
|
||||||
|
use harmony_secret::SecretManager;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let inventory = get_inventory();
|
let inventory = get_inventory();
|
||||||
let topology = get_topology().await;
|
let topology = get_topology().await;
|
||||||
|
|
||||||
|
let ssh_key = SecretManager::get_or_prompt::<SshKeyPair>().await.unwrap();
|
||||||
|
|
||||||
let scores: Vec<Box<dyn Score<HAClusterTopology>>> = vec![
|
let scores: Vec<Box<dyn Score<HAClusterTopology>>> = vec![
|
||||||
Box::new(OkdIpxeScore {
|
Box::new(OKDIpxeScore {
|
||||||
kickstart_filename: "inventory.kickstart".to_string(),
|
kickstart_filename: "inventory.kickstart".to_string(),
|
||||||
harmony_inventory_agent: "cluster_ssh_key.pub".to_string(),
|
harmony_inventory_agent: "harmony_inventory_agent".to_string(),
|
||||||
cluster_pubkey_filename: "harmony_inventory_agent".to_string(),
|
cluster_pubkey: FileContent {
|
||||||
|
path: FilePath::Relative("cluster_ssh_key.pub".to_string()),
|
||||||
|
content: ssh_key.public,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
Box::new(OKDInstallationScore {}),
|
Box::new(OKDInstallationScore {}),
|
||||||
];
|
];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
mod topology;
|
mod topology;
|
||||||
|
|
||||||
use crate::topology::{get_inventory, get_topology};
|
use crate::topology::{get_inventory, get_topology};
|
||||||
use harmony::modules::okd::ipxe::OkdIpxeScore;
|
use harmony::modules::okd::ipxe::OKDIpxeScore;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
@ -12,10 +12,10 @@ async fn main() {
|
|||||||
let cluster_pubkey_filename = "cluster_ssh_key.pub".to_string();
|
let cluster_pubkey_filename = "cluster_ssh_key.pub".to_string();
|
||||||
let harmony_inventory_agent = "harmony_inventory_agent".to_string();
|
let harmony_inventory_agent = "harmony_inventory_agent".to_string();
|
||||||
|
|
||||||
let ipxe_score = OkdIpxeScore {
|
let ipxe_score = OKDIpxeScore {
|
||||||
kickstart_filename,
|
kickstart_filename,
|
||||||
harmony_inventory_agent,
|
harmony_inventory_agent,
|
||||||
cluster_pubkey_filename,
|
cluster_pubkey,
|
||||||
};
|
};
|
||||||
|
|
||||||
harmony_cli::run(inventory, topology, vec![Box::new(ipxe_score)], None)
|
harmony_cli::run(inventory, topology, vec![Box::new(ipxe_score)], None)
|
||||||
|
@ -16,15 +16,15 @@ use crate::{
|
|||||||
use harmony_types::id::Id;
|
use harmony_types::id::Id;
|
||||||
|
|
||||||
#[derive(Debug, new, Clone, Serialize)]
|
#[derive(Debug, new, Clone, Serialize)]
|
||||||
pub struct OkdIpxeScore {
|
pub struct OKDIpxeScore {
|
||||||
pub kickstart_filename: String,
|
pub kickstart_filename: String,
|
||||||
pub harmony_inventory_agent: String,
|
pub harmony_inventory_agent: String,
|
||||||
pub cluster_pubkey_filename: String,
|
pub cluster_pubkey: FileContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Score<T> for OkdIpxeScore {
|
impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Score<T> for OKDIpxeScore {
|
||||||
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
|
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
|
||||||
Box::new(IpxeInterpret::new(self.clone()))
|
Box::new(OKDIpxeInterpret::new(self.clone()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn name(&self) -> String {
|
fn name(&self) -> String {
|
||||||
@ -33,12 +33,12 @@ impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Score<T> for O
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, new, Clone)]
|
#[derive(Debug, new, Clone)]
|
||||||
pub struct IpxeInterpret {
|
pub struct OKDIpxeInterpret {
|
||||||
score: OkdIpxeScore,
|
score: OKDIpxeScore,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Interpret<T> for IpxeInterpret {
|
impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Interpret<T> for OKDIpxeInterpret {
|
||||||
async fn execute(
|
async fn execute(
|
||||||
&self,
|
&self,
|
||||||
inventory: &Inventory,
|
inventory: &Inventory,
|
||||||
@ -81,6 +81,7 @@ impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Interpret<T> f
|
|||||||
folder_to_serve: None,
|
folder_to_serve: None,
|
||||||
// folder_to_serve: Some(Url::LocalFolder("./data/pxe/okd/http_files/".to_string())),
|
// folder_to_serve: Some(Url::LocalFolder("./data/pxe/okd/http_files/".to_string())),
|
||||||
files: vec![
|
files: vec![
|
||||||
|
|
||||||
FileContent {
|
FileContent {
|
||||||
path: FilePath::Relative("boot.ipxe".to_string()),
|
path: FilePath::Relative("boot.ipxe".to_string()),
|
||||||
content: BootIpxeTpl {
|
content: BootIpxeTpl {
|
||||||
@ -93,7 +94,7 @@ impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Interpret<T> f
|
|||||||
content: InventoryKickstartTpl {
|
content: InventoryKickstartTpl {
|
||||||
gateway_ip: &gateway_ip,
|
gateway_ip: &gateway_ip,
|
||||||
harmony_inventory_agent: &self.score.harmony_inventory_agent,
|
harmony_inventory_agent: &self.score.harmony_inventory_agent,
|
||||||
cluster_pubkey_filename: &self.score.cluster_pubkey_filename,
|
cluster_pubkey_filename: &self.score.cluster_pubkey.path.to_string(),
|
||||||
}
|
}
|
||||||
.to_string(),
|
.to_string(),
|
||||||
},
|
},
|
||||||
@ -105,6 +106,7 @@ impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Interpret<T> f
|
|||||||
}
|
}
|
||||||
.to_string(),
|
.to_string(),
|
||||||
},
|
},
|
||||||
|
self.score.cluster_pubkey.clone(),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user