Skip to content

Config API Proposal #656

Open
Open
@gronke

Description

@gronke

The JailConfig format was inherited from iocage. Because I was blocked from the entire iocage GitHub organization, it is no longer possible to upstream improvements to the project.

With this in mind, the goal to perform compatible operations on existing jails from python-iocage jails appears to remain unreached. We can use thisas an opportunity, however: ioc diverging from iocage, enables this project to re-think constraints from existing config formats.

The flat configuration design translating jail parameters to iocage JailConfig properties, has a design issue. Not only does it lead to confusion of users between the jail man page and ioc, but also it mixes the concepts of abstraction versus transparent passthrough of properties.

Tight control over jail parameters is essential, as such I am convinced that ioc features which access multiple OS features under the hood, must not belong mixed with resource limits and plain jail params.

The ioc Config Format

The proposed configuration format is structured in topics and does not duplicate information (such as interface names in interface and ip4_addr/ip6_addr). It is meant to model ioc features rather than mocking system tools formats with little quirks.

Although the (autocompleted) configuration via the ioc set command and the Python library remain the recommended way, a well structured YAML file appears to be another good option to apply jail configuration.

Example in YAML

---

name: myjail
release: 12.0-RELEASE

network:
  vnet: yes
  defaultrouter: 172.16.0.1
  #resolver: copy
  interface:
    vnet0:
      secure: yes           # secure vnet
      bridge: bridge0
      ip4_addr:
        - 172.16.0.2/24     # inet
        - 172.16.1.2/24     # alias0
    vnet1:
      bridge: bridge0
      ip4_addr: dhcp
      mtu: 1500

limit:
  vmemoryuse: 1g
  process: 512

storage:
  zfs:
    - zroot/my-shared-dataset
  nullfs:
    - source: /my/shared/path
      write: yes
    - source: /my/shared/home
      destination: /home

devfs_rules:
  - add path 'bpf*' unhide

# custom env for hooks and exec
env:
  PORT: 3000

hooks:
  start: |
    echo "This is an exec_start replacement"
    /bin/sh /etc/rc
    echo "The port is $PORT"

tags:
  - www

provision:
  method: puppet
  source: https://github.com/bsdci/puppet-control-repo

jail:
  # security.jail.* sysctl namespace exposed
  # jail params override automaticly configured values
  # which can be handy when ioc is behind on new OS features
  enforce_statfs: 0
  param:
    children:
      max: 100
    allow:
      mount:
        nullfs: 1
        zfs: 1

user:
  custom_field: "This can by any value!"    

Remarks

With these changes implemented, the project finally diverges from iocage. The compatibility layers built remain in place, but will be only available to migrate existing jails to the ioc config format.

It does not matter too much which output format is used, but YAML for instance does not require termination of values, such as the JSON format does.

Your opinion counts. This is not something I want to decide without exploring the ups and downs. Please feel invited to speak up and share your concerns, needs and ideas.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions