-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug: networking between longhorn-csi-plugin and longhorn-manager …
…is broken after upgrading Longhorn to 1.7.0-rc3 1. Revert to set `HostPID: true` and mounting the host proc for CSI plugin pod 2. Revert to set `HostNetwork: false` 3. When RWX storage network is enabled, we mount NFS in the container namespace. When it is not we mount the NFS in host name space by nsenter the host namespace longhorn-9223 Signed-off-by: Phan Le <phan.le@suse.com>
- Loading branch information
1 parent
d4ab049
commit 591c106
Showing
5 changed files
with
101 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
PROC_DIR="/proc" | ||
|
||
os_distro_talos="talos" | ||
os_distro="" | ||
|
||
get_os_distro() { | ||
local version_info=$(< $PROC_DIR/version) | ||
|
||
[[ $version_info =~ $os_distro_talos ]] && os_distro=$os_distro_talos | ||
} | ||
|
||
target_pid=1 | ||
|
||
get_pid() { | ||
local process_name=$1 | ||
local pid | ||
local status_file | ||
local name | ||
|
||
for dir in $PROC_DIR/*/; do | ||
pid=$(basename "$dir") | ||
status_file="$PROC_DIR/$pid/status" | ||
|
||
if [ -f "$status_file" ]; then | ||
while IFS= read -r line; do | ||
if [[ $line == "Name:"* ]]; then | ||
name="${line#*:}" | ||
name="${name//[$'\t ']/}" # Remove both spaces and tabs | ||
break # Exit the loop once the Name is found | ||
fi | ||
done < "$status_file" | ||
fi | ||
|
||
if [ "$name" = "$process_name" ]; then | ||
target_pid=$pid | ||
fi | ||
done | ||
} | ||
|
||
get_os_distro | ||
|
||
[[ $os_distro = $os_distro_talos ]] && get_pid "kubelet" | ||
|
||
nsenter -t $target_pid -m -n -u -- "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters