Skip to content

Add podman anonymous UID allocator volume management - #879

Open
Firefishy wants to merge 2 commits into
openstreetmap:masterfrom
Firefishy:add-podman-uid-allocation
Open

Firefishy wants to merge 2 commits into
openstreetmap:masterfrom
Firefishy:add-podman-uid-allocation

Conversation

@Firefishy

@Firefishy Firefishy commented Nov 1, 2026 •

Copy link
Copy Markdown
Member
  • Add podman anonymous userid allocator in resource with mapping to service name. Deleted service mappings are retained.
  • Volume directories are managed by resource, with ability mapping of container required UID and permissions.

AI Disclosure: AI was used for feedback and recommendation of the tests. Used: OpenAI GPT-6.1 Sol. All code has been reviewed by me.

@Firefishy
Firefishy requested a review from tomhughes November 1, 2026 18:10
@Firefishy
Firefishy force-pushed the add-podman-uid-allocation branch from b395e77 to 1bc4f63 Compare November 1, 2026 19:38
@Firefishy

Firefishy commented Nov 1, 2026 •

Copy link
Copy Markdown
Member Author

Removed the silly >4294967295 checks based on feedback on irc, we're not going to be running THAT many containers. ;-)

@tomhughes tomhughes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my main question is whether this is the best solution or whether we'd be better allocating a host user for each container that needs to store files using our normal service user setup and then applying an idmap to the volume to map that user to the internal user in the container?

Comment thread cookbooks/podman/resources/service.rb Resolved
Comment on lines +98 to +104
valid = source.is_a?(String) && source.start_with?("/") &&
options[:target].is_a?(String) && options[:target].start_with?("/") &&
(options.keys - [:target, :uid, :gid, :mode]).empty? &&
[:uid, :gid].all? { |key| options.fetch(key, 0).is_a?(Integer) && options.fetch(key, 0).between?(0, 65535) } &&
options.fetch(:mode, "0700").is_a?(String) && options.fetch(:mode, "0700").match?(/\A[0-7]{3,4}\z/)

raise "Invalid managed volume #{source.inspect} for #{new_resource.service}" unless valid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean there's nothing wrong with this other than it being horrifically ugly but we wouldn't normally bother with such extreme validation.

Co-authored-by: Tom Hughes <tom@compton.nu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants