Ignition 2.6.0

This commit is contained in:
Benjamin Gilbert 2020-08-07 23:50:33 -04:00
parent fd1940c70e
commit 0e08b0f288
4 changed files with 10 additions and 104 deletions

1
.gitignore vendored
View File

@ -47,3 +47,4 @@
/ignition-5260a5b.tar.gz
/ignition-dracut-6b1d128.tar.gz
/ignition-0d6f3e5.tar.gz
/ignition-947598e.tar.gz

View File

@ -1,97 +0,0 @@
From 96cb2f3776d453c50e55185a50c980ff210b1719 Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jonathan@jlebon.com>
Date: Fri, 31 Jul 2020 09:24:33 -0400
Subject: [PATCH] cloudstack|openstack: propagate ErrNeedNet
On CloudStack/OpenStack, we fetch from three different sources
simultaneously: two config drives, and the metadata service.
Error-handling for these goroutines was causing `ErrNeedNet` from the
latter to be ignored and so we weren't correctly propagating it back to
the caller (which keys off of it to signal to the OS that networking is
needed).
Do a simple hack where we check if `ErrNeedNet` was hit and if none of
the fetchers succeed, then we return that instead. (The better fix of
course is to not try to parallel guess the metadata source like this,
but that's a much bigger issue.)
Fixes: #956
Fixes: #1056
---
internal/providers/cloudstack/cloudstack.go | 10 ++++++++++
internal/providers/openstack/openstack.go | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/internal/providers/cloudstack/cloudstack.go b/internal/providers/cloudstack/cloudstack.go
index d4cc440c..83ed3700 100644
--- a/internal/providers/cloudstack/cloudstack.go
+++ b/internal/providers/cloudstack/cloudstack.go
@@ -50,6 +50,8 @@ func FetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) {
var data []byte
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
+ sawErrNeedNet := false
+
dispatch := func(name string, fn func() ([]byte, error)) {
raw, err := fn()
if err != nil {
@@ -57,6 +59,9 @@ func FetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) {
case context.Canceled:
case context.DeadlineExceeded:
f.Logger.Err("timed out while fetching config from %s", name)
+ case resource.ErrNeedNet:
+ sawErrNeedNet = true
+ fallthrough
default:
f.Logger.Err("failed to fetch config from %s: %v", name, err)
}
@@ -81,6 +86,11 @@ func FetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) {
<-ctx.Done()
if ctx.Err() == context.DeadlineExceeded {
+ // Did we hit neednet? If so, propagate that up instead. The OS should
+ // retry fetching again once networking is up.
+ if sawErrNeedNet {
+ return types.Config{}, report.Report{}, resource.ErrNeedNet
+ }
f.Logger.Info("neither config drive nor metadata service were available in time. Continuing without a config...")
}
diff --git a/internal/providers/openstack/openstack.go b/internal/providers/openstack/openstack.go
index d511bda2..41699515 100644
--- a/internal/providers/openstack/openstack.go
+++ b/internal/providers/openstack/openstack.go
@@ -55,6 +55,8 @@ func FetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) {
var data []byte
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
+ sawErrNeedNet := false
+
dispatch := func(name string, fn func() ([]byte, error)) {
raw, err := fn()
if err != nil {
@@ -62,6 +64,9 @@ func FetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) {
case context.Canceled:
case context.DeadlineExceeded:
f.Logger.Err("timed out while fetching config from %s", name)
+ case resource.ErrNeedNet:
+ sawErrNeedNet = true
+ fallthrough
default:
f.Logger.Err("failed to fetch config from %s: %v", name, err)
}
@@ -86,6 +91,11 @@ func FetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) {
<-ctx.Done()
if ctx.Err() == context.DeadlineExceeded {
+ // Did we hit neednet? If so, propagate that up instead. The OS should
+ // retry fetching again once networking is up.
+ if sawErrNeedNet {
+ return types.Config{}, report.Report{}, resource.ErrNeedNet
+ }
f.Logger.Info("neither config drive nor metadata service were available in time. Continuing without a config...")
}
--
2.26.2

View File

@ -49,7 +49,7 @@
# https://github.com/coreos/ignition
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}/v2
%global commit 0d6f3e5e859821134cd04fcaf47c2488c25aff0d
%global commit 947598ed908b374c50028f260eb52da9795a4ba4
%global shortcommit %(c=%{commit}; echo ${c:0:7})
# define ldflags, buildflags, testflags here. The ldflags were
# taken from ./build. We will need to periodically check these
@ -60,15 +60,13 @@
%global dracutlibdir %{_prefix}/lib/dracut
Name: ignition
Version: 2.5.0
Release: 3.git%{shortcommit}%{?dist}
Version: 2.6.0
Release: 1.git%{shortcommit}%{?dist}
Summary: First boot installer and configuration tool
License: ASL 2.0
URL: https://%{provider_prefix}
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
Patch0: 0001-cloudstack-openstack-propagate-ErrNeedNet.patch
%define gopath %{_datadir}/gocode
ExcludeArch: ppc64
BuildRequires: golang >= 1.10
@ -431,7 +429,6 @@ Ignition project's Github releases page.
# setup command reference: http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html
# unpack source0 and apply patches
%setup -T -b 0 -q -n %{repo}-%{commit}
%patch0 -p1
%build
# Set up PWD as a proper import path for go
@ -547,6 +544,8 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
%gotest %{import_path}/config/translate
%gotest %{import_path}/config/v3_0
%gotest %{import_path}/config/v3_0/types
%gotest %{import_path}/config/v3_1
%gotest %{import_path}/config/v3_1/types
%gotest %{import_path}/config/validate
%gotest %{import_path}/internal/exec/stages/files
%gotest %{import_path}/internal/exec/util
@ -589,6 +588,9 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
%endif
%changelog
* Fri Aug 07 2020 Benjamin Gilbert <bgilbert@redhat.com> - 2.6.0-1.git947598e
- New release
* Fri Aug 07 2020 Jonathan Lebon <jonathan@jlebon.com> - 2.5.0-3.git0d6f3e5
- Backport conditional networking fix for OpenStack and CloudStack
https://github.com/coreos/ignition/pull/1057

View File

@ -1 +1 @@
SHA512 (ignition-0d6f3e5.tar.gz) = 63bdb02ad34bf1826fd12c1cc93122b603df67a5d168a0f443b4d091b468bbb66dc8f8d920666b5d89d89adbb7e40a716acf367da7b2e81bea6c1aeaa795ef00
SHA512 (ignition-947598e.tar.gz) = ffdaab6d3ab25c1d95515b14ba54c7ca5c6adcc98cb73e74b911caf6f082d8648dc35eddeb4886b8f87dd884b80084f1432b4707362e20e5ebe9bd498aeb4edd