Skip to content

Commit

Permalink
qm: introduction to qm dropin sub-packages(s)
Browse files Browse the repository at this point in the history
QM developers are always looking for ways to help new users and
engineers onboard more easily. With this in mind, they decided
to break complex configurations into drop-in sub-package(s) when
 possible for adjusting the Podman engine configurations specifically
within the QM environment. Why? This approach provides an easy way to
extend or override settings without modifying the core (original)
configuration files.

Signed-off-by: Douglas Schilling Landgraf <[email protected]>
  • Loading branch information
dougsland committed Oct 1, 2024
1 parent 26ba84b commit e8fc584
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
21 changes: 20 additions & 1 deletion docs/devel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- [Building QM rpm manually with changes](#building-qm-rpm-manually-with-changes)
- [Building CentOS AutoSD and QM manually](#building-centos-autosd-and-qm-manually)
- [QM Drop-in sub-packages](#qm-drop-in-sub-packages)
- [Creating your own drop-in QM sub-package](#creating-your-own-drop-in-qm-sub-package)
- [Useful Commands](#useful-commands)
- [Installing software inside QM partition](#installing-software-inside-qm-partition)
- [Removing software inside QM partition](#removing-software-inside-qm-partition)
Expand Down Expand Up @@ -46,7 +48,7 @@ Make necessary changes using your preferred editor (e.g., vi/emacs).
**4.** Build the RPM

```bash
VERSION=1.0 make rpm
rm -rf rpmbuild && VERSION=1.0 make rpm
```

The rpm is created at the `${RPM_TOPDIR}/RPMS` folder, by default
Expand Down Expand Up @@ -244,3 +246,20 @@ bash-5.1# podman --root /usr/share/containers/storage pull alpine
Error: creating runtime static files directory "/usr/share/containers/storage/libpod":
mkdir /usr/share/containers/storage: read-only file system
```

## QM Drop-in sub-packages

QM developers are always looking for ways to help new users and engineers onboard more easily. With this in mind, they decided to break complex configurations into drop-in sub-package(s) when possible for adjusting the Podman engine configurations specifically within the QM environment. Why? This approach provides an easy way to extend or override settings without modifying the core (original) configuration files.

### Creating your own drop-in QM sub-package

We recommend using the existing drop-in files as a guide and adapting them to your specific needs. However, here are the step-by-step instructions:

1) Create a drop-in file in the directory: `etc/qm/containers/containers.conf.d`
2) Add it as a sub-package to `rpm/qm.spec`
3) Test it by running: `rm -rf rpmbuild/ && VERSION=YOURVERSIONHERE make rpm`
4) Additionally, test it without enabling the sub-package using:

```bash
rpmbuild --without qm_new_subpackage_name
```
13 changes: 13 additions & 0 deletions etc/qm/containers/containers.conf.d/qm_dropin_img_tempdir.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This configuration file was generated by qm-dropin sub-package:
# - qm-dropin-img-tempdir
#
# It configures the temporary directory used by the container engine
# for image copy operations. This setting is useful for performance
# optimizations or managing disk space.
#
# How it works?
#=================
# [engine] <- section
# image_copy_tmp_dir <- Specifies the directory for temporary image storage.
[engine]
image_copy_tmp_dir="/var/tmp.dir"
32 changes: 30 additions & 2 deletions rpm/qm.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
%global debug_package %{nil}

# By default, the qm-dropin-img-tempdir sub-package will be built.
# To disable it, you can pass --without qm_dropin_img_tempdir during
# the RPM build process (or in the Makefile):
# rpmbuild --without qm_dropin_img_tempdir
%bcond_without qm_dropin_img_tempdir

# Some bits borrowed from the openstack-selinux package
%global selinuxtype targeted
%global moduletype services
Expand All @@ -22,8 +28,6 @@
%bcond_without copr
%endif



%if 0%{?fedora}
%global podman_epoch 5
%else
Expand Down Expand Up @@ -91,6 +95,14 @@ sed -i 's/^install: man all/install:/' Makefile
%{__make} all

%install
# Create the directory for drop-in configurations
install -d %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d

%if %{with qm_dropin_img_tempdir}
install -m 644 %{_builddir}/qm-%{version}/etc/qm/containers/containers.conf.d/qm_dropin_img_tempdir.conf \
%{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_img_tempdir.conf
%endif

# install policy modules
%_format MODULES $x.pp.bz2
%{__make} DESTDIR=%{buildroot} DATADIR=%{_datadir} install
Expand Down Expand Up @@ -127,6 +139,7 @@ fi
%license LICENSE
%doc CODE-OF-CONDUCT.md NOTICE README.md SECURITY.md
%dir %{_datadir}/selinux
%dir %{_sysconfdir}/qm/containers/containers.conf.d
%{_datadir}/selinux/*
%dir %{_datadir}/qm
%{_datadir}/qm/containers.conf
Expand All @@ -146,6 +159,21 @@ fi
%ghost %dir %{_installscriptdir}/rootfs
%ghost %{_installscriptdir}/rootfs/*

%if %{with qm_dropin_img_tempdir}
%package -n qm-dropin-img-tempdir
Summary: Drop-in configuration for QM containers
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description -n qm-dropin-img-tempdir
This sub-package installs a drop-in configurations for the QM.
It creates the `/etc/qm/containers/containers.conf.d/` directory for adding
additional drop-in configurations.

%files -n qm-dropin-img-tempdir
%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_img_tempdir.conf
%endif

%changelog
%if %{defined autochangelog}
%autochangelog
Expand Down

0 comments on commit e8fc584

Please sign in to comment.