Skip to content

Commit

Permalink
Updated rootful namespace home to var lib (#1749)
Browse files Browse the repository at this point in the history
* Updated rootful namespace home to var lib

* Only rootful namespace home has been updated to /var/lib
* Rootless remain as is assuming that XDG_DATA_HOME seems to be appropriate
  (see: https://specifications.freedesktop.org/basedir-spec/latest/)

Fixes #1689

* Fixed namespace home path on bootstrap documentation
  • Loading branch information
fgiorgetti authored Nov 5, 2024
1 parent 81a9f91 commit e9ce2cb
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmd/bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ files are stored, like certificates, configurations, the original sources
(original custom resources used to bootstrap the nonkube site) and
the runtime files generated during initialization.

Namespaces are stored under ${XDG_DATA_HOME}/.local/share/skupper/namespaces
Namespaces are stored under ${XDG_DATA_HOME}/skupper/namespaces
for regular users when XDG_DATA_HOME environment variable is set, or under
${HOME}/.local/share/skupper/namespaces when it is not set.
As the root user, namespaces are stored under: /usr/local/share/skupper/namespaces.
As the root user, namespaces are stored under: /var/lib/skupper/namespaces.

In case the path (-p) flag is omitted, Skupper will try to process
custom resources stored at the sources directory of the default namespace,
Expand Down
6 changes: 3 additions & 3 deletions cmd/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ files are stored, like certificates, configurations, the original sources
(original custom resources used to bootstrap the nonkube site) and
the runtime files generated during initialization.
Namespaces are stored under ${XDG_DATA_HOME}/.local/share/skupper/namespaces
Namespaces are stored under ${XDG_DATA_HOME}/skupper/namespaces
for regular users when XDG_DATA_HOME environment variable is set, or under
${HOME}/.local/share/skupper/namespaces when it is not set.
As the root user, namespaces are stored under: /usr/local/share/skupper/namespaces.
As the root user, namespaces are stored under: /var/lib/skupper/namespaces.
In case the path (-p) flag is omitted, Skupper will try to process
custom resources stored at the sources directory of the default namespace,
Expand Down Expand Up @@ -102,7 +102,7 @@ func main() {
// definition based on CR files, if an input path has been provided.
// The /output path must be mapped to the Host's XDG_DATA_HOME/skupper
// or $HOME/.local/share/skupper (non-root)
// and /usr/local/share/skupper (root).
// and /var/lib/skupper (root).
//
fmt.Printf("Skupper nonkube bootstrap (version: %s)\n", version.Version)

Expand Down
2 changes: 1 addition & 1 deletion cmd/bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ container_env() {
export CONTAINER_ENDPOINT_DEFAULT="unix:///run/podman/podman.sock"
fi
export USERNS=""
export SKUPPER_OUTPUT_PATH="/usr/local/share/skupper"
export SKUPPER_OUTPUT_PATH="/var/lib/skupper"
export SERVICE_DIR="/etc/systemd/system"
fi
mkdir -p "${SKUPPER_OUTPUT_PATH}"
Expand Down
2 changes: 1 addition & 1 deletion cmd/bootstrap/remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespaces_path="${XDG_DATA_HOME:-${HOME}/.local/share}/skupper/namespaces"
service_path="${XDG_CONFIG_HOME:-${HOME}/.config}/systemd/user"
systemctl="systemctl --user"
if [ "${UID}" -eq 0 ]; then
namespaces_path="/usr/local/share/skupper/namespaces"
namespaces_path="/var/lib/skupper/namespaces"
service_path="/etc/systemd/system"
systemctl="systemctl"
fi
Expand Down
2 changes: 1 addition & 1 deletion internal/nonkube/bundle/install.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export USERNS="keep-id"
GID=$(id -g "${UID}")
export RUNAS="${UID}:${GID}"
if [ "${UID}" -eq 0 ]; then
export SKUPPER_OUTPUT_PATH="/usr/local/share/skupper"
export SKUPPER_OUTPUT_PATH="/var/lib/skupper"
export SERVICE_DIR="/etc/systemd/system"
export RUNTIME_DIR="/run"
export SYSTEMCTL="systemctl"
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func GetPlatform() types.Platform {

func getDataHome() string {
if os.Getuid() == 0 {
return "/usr/local/share/skupper"
return "/var/lib/skupper"
}
dataHome, ok := os.LookupEnv("XDG_DATA_HOME")
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion pkg/nonkube/api/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var getUid IdGetter = os.Getuid

func GetDataHome() string {
if getUid() == 0 {
return "/usr/local/share/skupper"
return "/var/lib/skupper"
}
dataHome, ok := os.LookupEnv("XDG_DATA_HOME")
if !ok {
Expand Down

0 comments on commit e9ce2cb

Please sign in to comment.