From cf21dac61ff817c61b6a6389f0131ea4388164e0 Mon Sep 17 00:00:00 2001 From: aleskandro Date: Sun, 12 Nov 2023 18:22:47 +0100 Subject: [PATCH] Configure outbount interface via nmstate --- .../system-preset/99-microshift.preset | 3 ++- .../system/nmstate-outbound-interface.service | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 overlay.d/15-microshift/usr/lib/systemd/system/nmstate-outbound-interface.service diff --git a/overlay.d/15-microshift/usr/lib/systemd/system-preset/99-microshift.preset b/overlay.d/15-microshift/usr/lib/systemd/system-preset/99-microshift.preset index 18f1db3..f22fc6a 100644 --- a/overlay.d/15-microshift/usr/lib/systemd/system-preset/99-microshift.preset +++ b/overlay.d/15-microshift/usr/lib/systemd/system-preset/99-microshift.preset @@ -1,3 +1,4 @@ enable firewall-microshift.service enable fix-resolve-conf-dot.service -enable fix-resolv-conf-coredns.service \ No newline at end of file +enable fix-resolv-conf-coredns.service +enable nmstate-outbound-interface.service \ No newline at end of file diff --git a/overlay.d/15-microshift/usr/lib/systemd/system/nmstate-outbound-interface.service b/overlay.d/15-microshift/usr/lib/systemd/system/nmstate-outbound-interface.service new file mode 100644 index 0000000..75c7d02 --- /dev/null +++ b/overlay.d/15-microshift/usr/lib/systemd/system/nmstate-outbound-interface.service @@ -0,0 +1,19 @@ +[Unit] +Description="Configure firewalld for microshift" +Documentation="https://access.redhat.com/documentation/en-us/red_hat_build_of_microshift/4.14/html/installing/microshift-install-rpm" +After=network-online.target microshift-ovs-init.service +Before=microshift.service +ConditionPathExists=!/var/.microshift-outbound-interface-configured +ConditionPathExists=/etc/microshift/nmstate-outbound-interface.yaml + +[Service] +Type=oneshot +RemainAfterExit=true +# TODO: Take some values from the microshift config +ExecStartPre=/usr/bin/nmstate apply -f /etc/microshift/nmstate-outbound-interface.yaml +ExecStart=/usr/bin/touch /var/.microshift-outbound-interface-configured +Restart=on-failure +RestartSec=30 + +[Install] +WantedBy=multi-user.target