[lxc-devel] [lxc-ci/master] Fix cloud-init issues

monstermunchkin on Github lxc-bot at linuxcontainers.org
Tue Sep 10 15:19:28 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 302 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190910/7e5b2269/attachment.bin>
-------------- next part --------------
From 945329954f9d131dbb5b1e624c6f57a5afb2802f Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 9 Sep 2019 17:25:55 +0200
Subject: [PATCH 1/5] images: Source interfaces.d config files in Ubuntu

This fixes cloud-init network config.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 images/ubuntu.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/images/ubuntu.yaml b/images/ubuntu.yaml
index 075bd53..e8effea 100644
--- a/images/ubuntu.yaml
+++ b/images/ubuntu.yaml
@@ -327,6 +327,8 @@ files:
 
      auto eth0
      iface eth0 inet dhcp
+
+     source /etc/network/interfaces.d/*.cfg
    releases:
      - trusty
      - xenial

From fc3dcde46b5b0a60580288588e6e38d0b4147db0 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 10 Sep 2019 11:27:26 +0200
Subject: [PATCH 2/5] images: Fix cloud-init on Fedora

This installs network-scripts to avoid cloud-init complaining about
missing network renderers. Also, it enables NetworkManager instead of
systemd-networkd so that cloud-init network config works properly.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 images/fedora.yaml | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/images/fedora.yaml b/images/fedora.yaml
index f8dd5d9..313f09c 100644
--- a/images/fedora.yaml
+++ b/images/fedora.yaml
@@ -106,6 +106,8 @@ packages:
 
    - packages:
       - cloud-init
+      - network-scripts
+      - NetworkManager
      action: install
      variants:
       - cloud
@@ -123,6 +125,21 @@ actions:
       umount -l /etc/resolv.conf || true
       rm /etc/resolv.conf
       ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
-      systemctl enable systemd-networkd
       systemctl enable systemd-resolved
       cp -R /etc/skel/.bash* /root/
+
+  - trigger: post-packages
+    action: |-
+      #!/bin/sh
+      systemctl enable systemd-networkd
+    variants:
+      - default
+
+  - trigger: post-packages
+    action: |-
+      #!/bin/sh
+      systemctl disable systemd-networkd
+      systemctl enable NetworkManager
+      systemctl enable cloud-init
+    variants:
+      - cloud

From 2c8e49c6cd241c1845928cd9b703a9b34b03cd4a Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 10 Sep 2019 16:40:11 +0200
Subject: [PATCH 3/5] images: Source interfaces.d config files in Debian

This fixes the cloud-init network config.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 images/debian.yaml | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/images/debian.yaml b/images/debian.yaml
index 1b4cb6d..c71a351 100644
--- a/images/debian.yaml
+++ b/images/debian.yaml
@@ -848,6 +848,8 @@ files:
      auto eth0
      iface eth0 inet dhcp
 
+     source /etc/network/interfaces.d/*.cfg
+
  - name: meta-data
    generator: cloud-init
    variants:
@@ -877,6 +879,8 @@ packages:
     - packages:
       - dialog
       - ifupdown
+      - init
+      - iproute2
       - isc-dhcp-client
       - locales
       - netbase
@@ -910,11 +914,5 @@ actions:
       # Cleanup temporary shadow paths
       rm /etc/*-
 
-  - trigger: post-packages
-    action: |-
-      #!/bin/sh
-      set -eux
-      apt-get install iproute2 init -y
-
 mappings:
   architecture_map: debian

From 5ea2675d943b60198003d9899bd3777a6eb6c5b1 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 10 Sep 2019 17:05:56 +0200
Subject: [PATCH 4/5] images: Source interfaces.d in Kali

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 images/kali.yaml | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/images/kali.yaml b/images/kali.yaml
index 632f841..1f6d85d 100644
--- a/images/kali.yaml
+++ b/images/kali.yaml
@@ -1693,6 +1693,8 @@ files:
      auto eth0
      iface eth0 inet dhcp
 
+     source /etc/network/interfaces.d/*.cfg
+
  - name: meta-data
    generator: cloud-init
    variants:
@@ -1722,6 +1724,8 @@ packages:
     - packages:
       - dialog
       - ifupdown
+      - init
+      - iproute2
       - isc-dhcp-client
       - locales
       - netbase
@@ -1756,13 +1760,5 @@ actions:
       # Cleanup temporary shadow paths
       rm /etc/*-
 
-  - trigger: post-packages
-    action: |-
-      #!/bin/sh
-      set -eux
-      apt-get install iproute2 init -y
-    releases:
-      - kali-rolling
-
 mappings:
   architecture_map: debian

From b5550c7d96ecdc886846877f681c414a2748f40e Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 10 Sep 2019 17:06:23 +0200
Subject: [PATCH 5/5] jobs: Build Kali cloud image

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 jenkins/jobs/image-kali.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/jenkins/jobs/image-kali.yaml b/jenkins/jobs/image-kali.yaml
index 0ef5002..2bc4e3d 100644
--- a/jenkins/jobs/image-kali.yaml
+++ b/jenkins/jobs/image-kali.yaml
@@ -46,7 +46,9 @@
         exec sudo /lxc-ci/bin/build-distro /lxc-ci/images/kali.yaml \
             ${LXD_ARCHITECTURE} 1800 ${WORKSPACE} \
             -o image.architecture=${architecture} \
-            -o image.release=kali-rolling
+            -o image.release=kali-rolling \
+            -o image.variant=${variant}
+
 
     properties:
     - build-discarder:


More information about the lxc-devel mailing list