Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

natsbox doesn't work in openshift - can't cd to /root #858

Closed
jaredmcqueen opened this issue Jan 18, 2024 · 3 comments
Closed

natsbox doesn't work in openshift - can't cd to /root #858

jaredmcqueen opened this issue Jan 18, 2024 · 3 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@jaredmcqueen
Copy link

What version were you using?

natsio/nats-box:0.14.2-nonroot

What environment was the server running in?

RedHat OpenShift

Is this defect reproducible?

the helm chart currently starts the natsbox deployment using:

      - args:
        - trap true INT TERM; sleep infinity & wait
        command:
        - sh
        - -ec
        - |
          work_dir="$(pwd)"
          mkdir -p "$XDG_CONFIG_HOME/nats"
          cd "$XDG_CONFIG_HOME/nats"
          if ! [ -s context ]; then
            ln -s /etc/nats-contexts context
          fi
          if ! [ -f context.txt ]; then
            echo -n "default" > context.txt
          fi
              # cd "$work_dir". <-- this breaks openshift
          exec sh -ec "$0"

If I comment out that line it'll deploy. When I terminal into the container, my $(pwd) is /root as expected but the kicker is that I can't change directory into that path. Odd because I'm in that path.
If I go back a folder, then try to go back to /root I get a permission denied. Take a look at the following:

/root
/root $ cd /root
sh: cd: can't cd to /root: Permission denied
/root $ cd .
sh: cd: can't cd to .: Permission denied
/root $ cd ..
~ $ cd root/
sh: cd: can't cd to root/: Permission denied

Given the capability you are leveraging, describe your expectation?

deployments to openshift without modifying the helm chart or commenting out the cd

Given the expectation, what is the defect you are observing?

permission denied

@jaredmcqueen jaredmcqueen added the defect Suspected defect such as a bug or regression label Jan 18, 2024
@jaredmcqueen
Copy link
Author

FYI my working config to deploy this via custom values is:

natsBox:
  enabled: true
  container:
    image:
      tag: 0.14.2-nonroot
    merge:
      command:
        - sh
        - -ec
        - |
          work_dir="$(pwd)"
          mkdir -p "$XDG_CONFIG_HOME/nats"
          cd "$XDG_CONFIG_HOME/nats"
          if ! [ -s context ]; then
            ln -s /etc/nats-contexts context
          fi
          if ! [ -f context.txt ]; then
            echo -n "default" > context.txt
          fi
          exec sh -ec "$0"

@sboulkour
Copy link
Contributor

@jaredmcqueen would you try with nats-box 0.14.3-nonroot ? This MR should fix your issue : nats-io/nats-box#66

@caleblloyd
Copy link
Contributor

Should be fixed by #883

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

3 participants