From 9ea33dfe85f9cfd09899c7906bfd0fde265f1d73 Mon Sep 17 00:00:00 2001 From: Yasmin Valim Date: Thu, 7 Mar 2024 17:42:20 -0300 Subject: [PATCH] spec: new upstream version 2.18.0 resolves: #https://issues.redhat.com/browse/RHEL-28395?jql=text%20~%20%22Update%20ignition%20to%20latest%20upstream%20version%202.18.0%22 --- .gitignore | 1 + ...TP-requests-on-codes-404-410-and-429.patch | 97 ------------------- ignition.spec | 9 +- sources | 2 +- 4 files changed, 7 insertions(+), 102 deletions(-) delete mode 100644 0001-azure-retry-HTTP-requests-on-codes-404-410-and-429.patch diff --git a/.gitignore b/.gitignore index 26899ff..33665f9 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ /ignition-edge-35853de.tar.gz /ignition-2.16.2.tar.gz /ignition-2.17.0.tar.gz +/ignition-2.18.0.tar.gz diff --git a/0001-azure-retry-HTTP-requests-on-codes-404-410-and-429.patch b/0001-azure-retry-HTTP-requests-on-codes-404-410-and-429.patch deleted file mode 100644 index a49a0a4..0000000 --- a/0001-azure-retry-HTTP-requests-on-codes-404-410-and-429.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 3babc7a5b767fb60ca877213d9201568205e983f Mon Sep 17 00:00:00 2001 -From: Jonathan Lebon -Date: Thu, 8 Feb 2024 11:02:27 -0500 -Subject: [PATCH] azure: retry HTTP requests on codes 404, 410, and 429 - -For some reason, the Azure IMDS server expects clients to retry their -HTTP requests even on codes that usually would be considered final. -The documented one is 410[[1]], but let's just match the set from -cloud-init, which also includes 404 and 429[[2]]. - -Closes: #1806 - -[1]: https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service?tabs=linux#errors-and-debugging -[2]: https://github.com/canonical/cloud-init/commit/c1a2047cf291 - -travier: Edited to cleanly backport on top of 2.17.0 ---- - internal/providers/azure/azure.go | 11 ++++++++++- - internal/resource/http.go | 17 ++++++++++++++++- - internal/resource/url.go | 4 ++++ - 3 files changed, 30 insertions(+), 2 deletions(-) - -diff --git a/internal/providers/azure/azure.go b/internal/providers/azure/azure.go -index d3115f2b..caddcff5 100644 ---- a/internal/providers/azure/azure.go -+++ b/internal/providers/azure/azure.go -@@ -112,7 +112,16 @@ func fetchFromIMDS(f *resource.Fetcher) ([]byte, error) { - headers := make(http.Header) - headers.Set("Metadata", "true") - -- data, err := f.FetchToBuffer(imdsUserdataURL, resource.FetchOptions{Headers: headers}) -+ // Azure IMDS expects some codes <500 to still be retried... -+ // Here, we match the cloud-init set. -+ // https://github.com/canonical/cloud-init/commit/c1a2047cf291 -+ // https://github.com/coreos/ignition/issues/1806 -+ retryCodes := []int{ -+ 404, // not found -+ 410, // gone -+ 429, // rate-limited -+ } -+ data, err := f.FetchToBuffer(imdsUserdataURL, resource.FetchOptions{Headers: headers, RetryCodes: retryCodes}) - if err != nil { - return nil, fmt.Errorf("fetching to buffer: %w", err) - } -diff --git a/internal/resource/http.go b/internal/resource/http.go -index 0d8edace..872ce253 100644 ---- a/internal/resource/http.go -+++ b/internal/resource/http.go -@@ -263,6 +263,21 @@ func (f *Fetcher) newHttpClient() error { - return nil - } - -+func shouldRetryHttp(statusCode int, opts FetchOptions) bool { -+ // we always retry 500+ -+ if statusCode >= 500 { -+ return true -+ } -+ -+ for _, retryCode := range opts.RetryCodes { -+ if statusCode == retryCode { -+ return true -+ } -+ } -+ -+ return false -+} -+ - // httpReaderWithHeader performs an HTTP request on the provided URL with the - // provided request header & method and returns the response body Reader, HTTP - // status code, a cancel function for the result's context, and error (if any). -@@ -298,7 +313,7 @@ func (c HttpClient) httpReaderWithHeader(opts FetchOptions, url string) (io.Read - - if err == nil { - c.logger.Info("%s result: %s", opts.HTTPVerb, http.StatusText(resp.StatusCode)) -- if resp.StatusCode < 500 { -+ if !shouldRetryHttp(resp.StatusCode, opts) { - return resp.Body, resp.StatusCode, cancelFn, nil - } - resp.Body.Close() -diff --git a/internal/resource/url.go b/internal/resource/url.go -index 58e0b9fc..3d16cc59 100644 ---- a/internal/resource/url.go -+++ b/internal/resource/url.go -@@ -125,6 +125,10 @@ type FetchOptions struct { - // HTTPVerb is an HTTP request method to indicate the desired action to - // be performed for a given resource. - HTTPVerb string -+ -+ // List of HTTP codes to retry that usually would be considered as complete. -+ // Status codes >= 500 are always retried. -+ RetryCodes []int - } - - // FetchToBuffer will fetch the given url into a temporary file, and then read --- -2.43.0 - diff --git a/ignition.spec b/ignition.spec index 241ed20..5f6d74e 100644 --- a/ignition.spec +++ b/ignition.spec @@ -13,7 +13,7 @@ # https://github.com/coreos/ignition %global goipath github.com/coreos/ignition %global gomodulesmode GO111MODULE=on -Version: 2.17.0 +Version: 2.18.0 %gometa @@ -22,7 +22,7 @@ Version: 2.17.0 %global dracutlibdir %{_prefix}/lib/dracut Name: ignition -Release: 2%{?dist} +Release: 1%{?dist} Summary: First boot installer and configuration tool (RHEL CoreOS only) # Upstream license specification: Apache-2.0 @@ -31,8 +31,6 @@ URL: %{gourl} Source0: %{gosource} Source1: https://github.com/fedora-iot/ignition-edge/archive/%{ignedgecommit}/ignition-edge-%{ignedgeshortcommit}.tar.gz -Patch0: 0001-azure-retry-HTTP-requests-on-codes-404-410-and-429.patch - BuildRequires: libblkid-devel BuildRequires: systemd-rpm-macros @@ -354,6 +352,9 @@ install -p -m 0755 ./ignition %{buildroot}/%{dracutlibdir}/modules.d/30ignition %endif %changelog +* Thu Mar 07 2024 Yasmin Valim - 2.18.0-1 +- New release + * Fri Feb 09 2024 Timothée Ravier - 2.17.0-2 - Backport fix for unexpected Azure IMDS status codes diff --git a/sources b/sources index 0cb46d9..2bd9486 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (ignition-2.17.0.tar.gz) = cfbe1ec0fbeee66e568b2943a6893d11f3965867f85dc4005b3dc10299f314bf7e64141c68867a8422dfd911534011a714631c78921abebbaaa0d9705cb5a336 +SHA512 (ignition-2.18.0.tar.gz) = 8017d4d289b0c856805909669d05e54a044fd0fdbab88ad573ae4eee197c7cff6ec99997a356bfa138adc9597f75eba6e21e44e00d3f24b6dbf9878b71a5523c SHA512 (ignition-edge-35853de.tar.gz) = dc2ec47081e7d4ef35b00c5b02d2f4a26e1171fe5433a784060b007601a59e23a15e5621a9518602f131c3016a94c52ff6b28139a7e02afeba4af03f28b7aed2