kontena / pharos-host-upgrades

Kube DaemonSet for host OS upgrades
Apache License 2.0
41 stars 1 forks source link

Add support for debian upgrades #33

Closed jnummelin closed 5 years ago

jnummelin commented 5 years ago

Mostly what we had already for Ubuntu as they both use apt.

Some testing

Before running host-upgrader:

$ uname -a
Linux debian-9 4.9.0-7-amd64 #1 SMP Debian 4.9.110-1 (2018-07-05) x86_64 GNU/Linux

Run host-upgrader:

root@debian-9:/vagrant# docker run --rm --name host-upgrades --privileged   -v $PWD/config:/etc/host-upgrades   -v /run/host-upgrades:/run/host-upgrades   -v /var/run/dbus:/var/run/dbus   -v /run/log/journal:/run/log/journal   kontena/pharos-host-upgrades:dev /usr/local/bin/pharos-host-upgrades -v 9 -reboot
2018/10/02 12:14:04 pharos-host-upgrades version 0.2.0 (Go go1.10.2)
2018/10/02 12:14:04 Load config from --config-path=/etc/host-upgrades
2018/10/02 12:14:04 Copying configs to --host-mount=/run/host-upgrades
2018/10/02 12:14:04 hosts/ubuntu probe mismatch: Debian GNU/Linux 9 (stretch)
2018/10/02 12:14:04 hosts/centos probe mismatch: Debian GNU/Linux 9 (stretch)
2018/10/02 12:14:04 hosts/debian boot time: 2018-10-02 11:54:14 +0000 UTC
2018/10/02 12:14:04 hosts/debian probe success: hosts.Info{OperatingSystem:"Debian", OperatingSystemRelease:"GNU/Linux", Kernel:"Linux", KernelRelease:"4.9.0-7-amd64", BootTime:time.Time{wall:0x0, ext:63674078054, loc:(*time.Location)(0x1813020)}}
2018/10/02 12:14:04 Probed host: Debian GNU/Linux
2018/10/02 12:14:04 hosts/debian: using host path /run/host-upgrades for output files
2018/10/02 12:14:04 hosts/debian: using copied unattended-upgrades.conf at /run/host-upgrades/unattended-upgrades.conf
2018/10/02 12:14:04 hosts/debian: using generated host-upgrades.sh at /run/host-upgrades/host-upgrades.sh
2018/10/02 12:14:04 No --schedule given, will run once
2018/10/02 12:14:04 No --kube configuration
2018/10/02 12:14:04 Using --reboot, will reboot host after upgrades if required
2018/10/02 12:14:04 Skip kube locking
2018/10/02 12:14:04 Running host upgrades...
2018/10/02 12:14:04 hosts/debian upgrade...
2018/10/02 12:14:04 systemd/exec host-upgrades.service: systemd.ExecOptions{Unit:"host-upgrades.service", Cmd:[]string{"/bin/sh", "-x", "/run/host-upgrades/host-upgrades.sh"}, Env:[]string{"HOST_PATH=/run/host-upgrades", "APT_CONFIG=/run/host-upgrades/apt.conf"}}
2018/10/02 12:14:04 systemd/exec host-upgrades.service: reset
2018/10/02 12:14:04 systemd/exec host-upgrades.service: start []dbus.Property{dbus.Property{Name:"Type", Value:dbus.Variant{sig:dbus.Signature{str:"s"}, value:"oneshot"}}, dbus.Property{Name:"Environment", Value:dbus.Variant{sig:dbus.Signature{str:"as"}, value:[]string{"HOST_PATH=/run/host-upgrades", "APT_CONFIG=/run/host-upgrades/apt.conf"}}}, dbus.Property{Name:"ExecStart", Value:dbus.Variant{sig:dbus.Signature{str:"a(sasb)"}, value:[]dbus.execStart{dbus.execStart{Path:"/bin/sh", Args:[]string{"/bin/sh", "-x", "/run/host-upgrades/host-upgrades.sh"}, UncleanIsFailure:false}}}}}
2018/10/02 12:14:04 systemd/exec host-upgrades.service: wait...
2018/10/02 12:14:11 systemd/exec host-upgrades.service: done, status=done
2018/10/02 12:14:11 systemd/journal: read journal...
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:04.473651 +0000 UTC + set -ue
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:04.473651 +0000 UTC + apt-get update
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:04.637302 +0000 UTC Ign:1 http://deb.debian.org/debian stretch InRelease
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:04.661622 +0000 UTC Hit:2 http://deb.debian.org/debian stretch Release
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:04.790722 +0000 UTC Hit:3 http://security.debian.org/debian-security stretch/updates InRelease
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:04.9678 +0000 UTC Hit:5 https://download.docker.com/linux/debian stretch InRelease
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:05.341929 +0000 UTC Hit:6 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:06.098891 +0000 UTC Reading package lists...
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:06.126974 +0000 UTC + unattended-upgrade -v
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:11.512769 +0000 UTC debug: running /usr/lib/os-probes/50mounted-tests on /dev/sda2
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:11.522965 +0000 UTC debug: /dev/sda2 type not recognised; skipping
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:11.524933 +0000 UTC debug: os detected by /usr/lib/os-probes/50mounted-tests
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:11.530142 +0000 UTC debug: running /usr/lib/os-probes/50mounted-tests on /dev/sda5
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:11.536049 +0000 UTC debug: /dev/sda5 is a swap partition; skipping
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:11.537881 +0000 UTC debug: os detected by /usr/lib/os-probes/50mounted-tests
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:11.858785 +0000 UTC + [ -e /run/reboot-required ]
2018/10/02 12:14:11 systemd/journal: 2018-10-02 12:14:11.858785 +0000 UTC + cp -a /run/reboot-required /run/host-upgrades/reboot-required
2018/10/02 12:14:11 systemd/exec host-upgrades.service: done
2018/10/02 12:14:11 Skip updating kube node condition
2018/10/02 12:14:11 Reboot required, rebooting without draining kube node...
2018/10/02 12:14:11 hosts/debian reboot...
Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.

After reboot:

root@debian-9:~# uname -a
Linux debian-9 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u5 (2018-09-30) x86_64 GNU/Linux
jnummelin commented 5 years ago

Same instructions as with Ubuntu :) Added to README