Skip to content

[Discussion] Non-root interferes with helm chart #181

Description

@MirandaStreeter

Since #141, OpenVoxProject/openvox-helm-chart is facing the following issue:
OpenVoxProject/openvox-helm-chart#44

/container-entrypoint.d/20-use-templates-initially.sh: line 12: cd: /opt/puppetlabs/server/data/puppetserver/.puppetlabs/etc/puppet: No such file or directory

I'm reporting this here because the causes (and most fixes) also land here.

Long story short, /opt/puppetlabs/server/data/puppetserver is puppetserver's master-var-dir (separate from vardir (that tripped me up)). It also holds the non-root homedir. It is also a directory people commonly mount a volume over. By default the helm chart does this via the "serverdata" PVC. Prior to #141 this was fine because the container was rootful and the home data lived elsewhere. Now, we get the above error.

If you work around this in any way puppetserver still dies with another, different error:

Caused by: org.jruby.exceptions.LoadError: (LoadError) cannot load such file -- puppet

This is because in #141 the Ubuntu container changed to match the Alpine behavior where we use puppetserver gem install openvox instead of installing puppet via the .deb file. Meaning, we're installing the gems during build time rather than runtime, and it's saving to that same master-var-dir, so it's similarly getting overwritten by the PVC.

On top of all that, anyone's workflow that was relying on the previous homedir location (say, for example, you mounted files into .ssh/ or .gitconfig/) has broken. The same goes for anyone mounting gems to the old location instead of using puppetserver gem install. And even then the latter gets wiped on container reboot.

I'm opening this to discussion because there are multiple approaches, and none of them are perfect.

  • Move the homedir and gemdir (maybe puppetserver/apps instead of puppetserver/data?)
    • The homedir is already set via ENV HOME to work around random UIDs, and the gem-path and gem-home are already set via puppetserver.conf, so this would be easy enough.
    • If someone is relying on the old non-root paths they'll have to update it to the new non-root path.
  • Specify --confdir/--config for all the puppet/puppetserver commands in entrypoint scripts
    • Less moving parts and easier to understand, imo
    • Anything calling puppet ad-hoc inside the container might not return correct results (don't know why someone would do this)
    • We'd still have to move the gemdir
  • Set data persistence on the serverdata PVC to default false
    • Don't have to move the gemdir
    • Another step in the long march towards immutability (of which I have strong feelings about)
    • May break certain workflows. For example, if you're extracting the reports manually instead of sending it to PDB.
  • Create an environment variable upstream for the confdir et al
    • I'm seeing prior art for run_dir
    • Blast radius is far larger if anything goes wrong
    • We'd still have to move the gemdir
    • Probably quite useful even outside of this use case
    • Likely duplicating work in the XDG basedir PR

Let me know what people think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions