Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Commit feb855b

Browse files
committed
Confluent deployment fixes
1 parent c12a2b2 commit feb855b

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

include/cloysterhpc/services/runner.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ namespace unsafe {
5555
int fmt(fmt::format_string<Args...> format, Args&&... args)
5656
{
5757
auto command = fmt::format(format, std::forward<Args>(args)...);
58-
LOG_DEBUG("Running shell command: {}", command);
5958
auto opts = cloyster::Singleton<const cloyster::services::Options>::get();
6059
if (!opts->dryRun) {
6160
LOG_DEBUG("Running shell command: {}", command);

src/services/confluent.cpp

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace {
1111
using namespace cloyster;
1212
using namespace cloyster::utils;
1313

14-
void addNode(const models::Node& node)
14+
void addNode(const models::Node& node, std::string_view image)
1515
{
1616
services::runner::shell::fmt(
1717
R"(
@@ -36,12 +36,18 @@ nodeattrib {nodeName} net.ipv4_address={nodeIp}/{nodeCIDR}
3636
fmt::arg("nodeMac", macOpt.value())
3737
);
3838
}
39+
40+
services::runner::shell::fmt("nodedeploy -p {nodeName} -n {image}-diskless",
41+
fmt::arg("nodeName", node.getHostname()),
42+
fmt::arg("image", image));
43+
44+
services::runner::shell::cmd("confluent2hosts -a everything");
3945
}
4046

41-
void addNodes()
47+
void addNodes(std::string_view image)
4248
{
4349
for (const auto& node : singleton::cluster()->getNodes()) {
44-
addNode(node);
50+
addNode(node, image);
4551
}
4652
}
4753
}
@@ -50,6 +56,11 @@ namespace cloyster::services {
5056

5157
void Confluent::install() {
5258
using namespace utils::singleton;
59+
60+
const auto image = fmt::format("{distro}-{arch}",
61+
fmt::arg("arch", cloyster::utils::enums::toString(os().getArch())),
62+
fmt::arg("distro", os().getDistroString()));
63+
//
5364
// NOTE: WIP - GENERALIZE THIS
5465
runner::shell::fmt(R"d(
5566
# Add the Confluent repository
@@ -78,7 +89,11 @@ if systemctl is-enabled -q firewalld; then
7889
fi
7990
8091
# Add basic settings to allow a minimalist boot environment for testing
81-
nodegroupattrib everything dns.servers={hnIp} dns.domain={domain} net.ipv4_gateway={gateway}
92+
nodegroupattrib everything \
93+
dns.servers={hnIp} \
94+
dns.domain={domain} \
95+
net.ipv4_gateway={hnIp} \
96+
deployment.useinsecureprotocols=always
8297
8398
# Fill required passwords
8499
# FIXME: Those strings are get from `stdin` we need to automate also
@@ -87,31 +102,22 @@ nodegroupattrib everything dns.servers={hnIp} dns.domain={domain} net.ipv4_gatew
87102
# Generate a keypair for internal cluster usage
88103
test -f ~/.ssh/id_ed25519 || ssh-keygen -t ed25519 -N ""
89104
90-
# Define a given node
91-
# nodedefine n01
92-
# nodeattrib n01 net.hwaddr=00:0c:29:7d:b6:67
93-
# nodeattrib n01 net.ipv4_address=100.64.0.1/24
94-
95-
# Add nodes to /etc/hosts
96-
# Needs to evaluate in the future if there is a better approach to add files to /etc/hosts; `dnsmasq` maybe?
97-
confluent2hosts -a everything
98-
99105
# Configure the osdeploy parameters; it's an interactive interface, so we must find a way to automate this step
100106
osdeploy initialize -u -s -k -l -p -a -t -g
101107
102108
# Import the OS ISO file.
103109
osdeploy import {isoPath}
104110
105111
# distro contains the osversion
106-
image={distro}-{arch}
107112
108113
rm -rf /tmp/scratchdir || :
114+
rm -rf /var/lib/confluent/public/os/{image}-diskless || :
109115
110116
# Create a temporary chroot to work as basis for the boot image
111-
imgutil build -y -s ${{image}} /tmp/scratchdir
117+
imgutil build -y -s {image} /tmp/scratchdir
112118
113119
# Pack the image from the temporary chroot and give a name
114-
imgutil pack /tmp/scratchdir/ ${{image}}-diskless
120+
imgutil pack /tmp/scratchdir/ {image}-diskless
115121
116122
# Check if the image shows up as available with the defined name
117123
osdeploy list
@@ -134,13 +140,9 @@ rm -rf /tmp/scratchdir
134140
answerfile()->management.con_interface,
135141
"Internal interface not found in [network_management]"
136142
)),
137-
fmt::arg("gateway",
138-
utils::optional::unwrap(
139-
answerfile()->management.gateway,
140-
"Internal gateway not found in [network_management]"
141-
))
143+
fmt::arg("image", image)
142144
);
143-
addNodes();
145+
addNodes(image);
144146
}
145147

146148
}

0 commit comments

Comments
 (0)