apt: Add full-system upgrade feature

Currently, the APT daemonset allows the installation of new packages or
upgrade of existing packages to a newer version. Sometimes, it may be
desirable to trigger an update for all packages. This change introduces
the ability to trigger a full-system upgrade using the .conf.apt.upgrade
chart value. The new option is disabled by default.

Change-Id: I611422c2093b9dbbae4e2d7cc05ebd726e895c88
Signed-off-by: Drew Walters <andrew.walters@att.com>
This commit is contained in:
Drew Walters 2019-07-17 13:55:22 +00:00
parent c503961841
commit 2e5ffaccca
3 changed files with 25 additions and 6 deletions

View File

@ -54,7 +54,7 @@ load_package_list_with_versions $(dpkg -l | awk 'NR>5 {print $2"="$3}')
################################################
#Stage 2
#Add repositories and install new packages
#Add repositories and install/upgrade packages
################################################
{{- if hasKey .Values.conf "apt" }}
@ -112,6 +112,16 @@ fi
REQUESTED_PACKAGES="$REQUESTED_PACKAGES {{ .name }}"
{{- end }}
{{- end }}
# Perform package upgrades
{{- if .Values.conf.apt.upgrade }}
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get dist-upgrade \
-y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold
if [[ -f "/var/run/reboot-required" ]]; then
log.INFO 'System reboot REQUIRED.'
fi
{{- end }}
{{- end }}
################################################

View File

@ -25,6 +25,7 @@ conf:
chroot_mnt_path: '/mnt'
log_colors: False
apt:
upgrade: false
blacklistpkgs:
- telnetd
- inetutils-telnetd

View File

@ -101,15 +101,23 @@ Used to manage host level apparmor profiles/rules. Ex.::
apt
---
``apt`` DaemonSet does package management. It is able to install a package of
a specific version (or upgrade an existing one to requested version). Version
is optional, and if not provided, the latest available package is installed.
It can also remove packages that were previously installed by divingbell (it is
done by excluding the packages you want to remove from the configuration).
``apt`` DaemonSet does package management. It is able to install a package of a
specific version, upgrade an existing one to requested version, and perform a
full-system upgrade. Version is optional, and if not provided, the latest
available package is installed. It can also remove packages that were
previously installed by divingbell (it is done by excluding the packages you
want to remove from the configuration).
.. NOTE::
When ``conf.apt.upgrade`` is ``true``, packages are upgraded `after` the
requested packages are installed.
Here is an example configuration for it::
conf:
apt:
upgrade: false
packages:
- name: <PACKAGE1>
version: <VERSION1>