Skip to content

Commit

Permalink
fix: Fix an error after a Node restart
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedweber committed Mar 7, 2025
1 parent c1f49eb commit 0191d93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ All notable changes to this project will be documented in this file.
### Fixed

- Give RBAC permission to `delete` Services, which is needed to set an ownerRef on already existing Services ([#283]).
- Fix the error "failed to write content: File exists (os error 17)" after a
Node restart ([#284]).

[#267]: https://github.com/stackabletech/listener-operator/pull/267
[#268]: https://github.com/stackabletech/listener-operator/pull/268
[#279]: https://github.com/stackabletech/listener-operator/pull/279
[#282]: https://github.com/stackabletech/listener-operator/pull/282
[#283]: https://github.com/stackabletech/listener-operator/pull/283
[#284]: https://github.com/stackabletech/listener-operator/pull/284

## [24.11.1] - 2025-01-10

Expand Down
9 changes: 8 additions & 1 deletion rust/operator-binary/src/csi_server/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,18 +585,25 @@ mod pod_dir {
let addr_dir = addrs_path.join(&addr.address);
let ports_dir = addr_dir.join("ports");
tokio::fs::create_dir_all(&ports_dir).await?;
tracing::info!("write: {:?}", addr_dir.join("address"));
tokio::fs::write(addr_dir.join("address"), addr.address.as_bytes()).await?;
for (port_name, port) in &addr.ports {
tokio::fs::write(ports_dir.join(port_name), port.to_string().as_bytes()).await?;
}
default_addr_dir.get_or_insert(addr_dir);
}

let default_addr_link = target_path.join("default-address");
// Remove any existing symlink because `tokio::fs::symlink` fails if it already exists.
// This happens if the node was restarted. The pod then restarts with the same UID and
// the pre-populated volume.
let _ = tokio::fs::remove_file(&default_addr_link).await;
tokio::fs::symlink(
default_addr_dir
.context(NoDefaultAddressSnafu)?
.strip_prefix(target_path)
.context(DefaultAddrIsOutsideRootSnafu)?,
target_path.join("default-address"),
&default_addr_link,
)
.await?;
Ok(())
Expand Down

0 comments on commit 0191d93

Please sign in to comment.