Skip to content

Commit dd3ea97

Browse files
authored
Merge pull request #66 from biersoeckli/fix/multipathd-in-setup-script-and-registry-deployment
Fix/multipathd in setup script and registry deployment
2 parents 0edb724 + c771770 commit dd3ea97

4 files changed

Lines changed: 48 additions & 10 deletions

File tree

setup/setup-canary.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ echo "Using Longhorn version: $LONGHORN_VERSION"
102102
sudo systemctl stop rpcbind.service rpcbind.socket
103103
sudo systemctl disable rpcbind.service rpcbind.socket
104104

105+
if systemctl list-units --full --all | grep -q 'multipathd'; then
106+
sudo systemctl stop multipathd
107+
sudo systemctl disable multipathd
108+
fi
109+
110+
if ! lsmod | grep -q dm_crypt; then
111+
sudo modprobe dm_crypt
112+
fi
113+
if ! grep -q 'dm_crypt' /etc/modules; then
114+
echo "dm_crypt" | sudo tee -a /etc/modules
115+
fi
116+
105117
# Installation of k3s
106118
#curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--node-ip=192.168.1.2 --advertise-address=192.168.1.2 --node-external-ip=188.245.236.232 --flannel-iface=enp7s0" INSTALL_K3S_VERSION="v1.31.3+k3s1" sh -
107119

setup/setup-worker.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ echo "Using K3s version: $K3S_VERSION"
7676
sudo systemctl stop rpcbind.service rpcbind.socket
7777
sudo systemctl disable rpcbind.service rpcbind.socket
7878

79+
if systemctl list-units --full --all | grep -q 'multipathd'; then
80+
sudo systemctl stop multipathd
81+
sudo systemctl disable multipathd
82+
fi
83+
84+
if ! lsmod | grep -q dm_crypt; then
85+
sudo modprobe dm_crypt
86+
fi
87+
if ! grep -q 'dm_crypt' /etc/modules; then
88+
echo "dm_crypt" | sudo tee -a /etc/modules
89+
fi
90+
7991
# Installation of k3s
8092
echo "Installing k3s with --flannel-iface=$selected_iface"
8193
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=$selected_iface" INSTALL_K3S_VERSION="$K3S_VERSION" K3S_URL=${K3S_URL} K3S_TOKEN=${JOIN_TOKEN} sh -

setup/setup.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ echo "Using Longhorn version: $LONGHORN_VERSION"
101101
sudo systemctl stop rpcbind.service rpcbind.socket
102102
sudo systemctl disable rpcbind.service rpcbind.socket
103103

104+
# Disable multipathd service, as it can cause issues with Longhorn --> https://longhorn.io/kb/troubleshooting-volume-with-multipath
105+
if systemctl list-units --full --all | grep -q 'multipathd'; then
106+
sudo systemctl stop multipathd
107+
sudo systemctl disable multipathd
108+
fi
109+
110+
# Enable dm_crypt module for Longhorn encryption support
111+
if ! lsmod | grep -q dm_crypt; then
112+
sudo modprobe dm_crypt
113+
fi
114+
if ! grep -q 'dm_crypt' /etc/modules; then
115+
echo "dm_crypt" | sudo tee -a /etc/modules
116+
fi
117+
104118
# Installation of k3s
105119
#curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--node-ip=192.168.1.2 --advertise-address=192.168.1.2 --node-external-ip=188.245.236.232 --flannel-iface=enp7s0" INSTALL_K3S_VERSION="v1.31.3+k3s1" sh -
106120

src/server/services/registry.service.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,23 @@ class RegistryService {
7373
}
7474

7575
async deployRegistry(registryLocation: string, forceDeploy = false) {
76-
const deployments = await k3s.apps.listNamespacedDeployment(BUILD_NAMESPACE);
77-
if (deployments.body.items.length > 0 && !forceDeploy) {
78-
return;
79-
}
80-
8176
const useLocalStorage = registryLocation === Constants.INTERNAL_REGISTRY_LOCATION;
8277
const s3Target = useLocalStorage ? undefined : await s3TargetService.getById(registryLocation!);
8378

84-
85-
console.log("(Re)deploying registry because it is not deployed or forced...");
86-
console.log(`Registry storage location is set to ${registryLocation}.`);
8779
console.log("Ensuring namespace is created...");
8880
await namespaceService.createNamespaceIfNotExists(BUILD_NAMESPACE);
8981

82+
// Always update the ConfigMap so storage settings are never stale
9083
await this.createOrUpdateRegistryConfigMap(s3Target);
9184

85+
const deployments = await k3s.apps.listNamespacedDeployment(BUILD_NAMESPACE);
86+
if (deployments.body.items.length > 0 && !forceDeploy) {
87+
return;
88+
}
89+
90+
console.log("(Re)deploying registry because it is not deployed or forced...");
91+
console.log(`Registry storage location is set to ${registryLocation}.`);
92+
9293
if (useLocalStorage) {
9394
await this.createPersistenvColumeCLaim();
9495
}
@@ -224,7 +225,7 @@ class RegistryService {
224225
containers: [
225226
{
226227
name: deploymentName,
227-
image: 'registry:latest',
228+
image: 'registry:2.8',
228229
volumeMounts: [
229230
...localStorageVolumeMount,
230231
{
@@ -314,7 +315,6 @@ http:
314315
`
315316
},
316317
};
317-
318318
const existingConfigMaps = await k3s.core.listNamespacedConfigMap(BUILD_NAMESPACE);
319319
if (existingConfigMaps.body.items.find(cm => cm.metadata?.name === REGISTRY_CONFIG_MAP_NAME)) {
320320
console.log("ConfigMap already exists, deleting and recreating...");

0 commit comments

Comments
 (0)