Skip to content

Commit f5df604

Browse files
sbernauerTechassi
andauthored
fix: Don't crash during release upgrade for SDP 25.11 (#418)
* fix: Don't crash during `release upgrade` for SDP 25.11 * changelog * Update rust/stackable-cockpit/src/platform/release/spec.rs Co-authored-by: Techassi <git@techassi.dev> * Improve docs * Fix typo --------- Co-authored-by: Techassi <git@techassi.dev>
1 parent c0fb5fa commit f5df604

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

rust/stackable-cockpit/src/platform/release/spec.rs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use futures::{StreamExt as _, TryStreamExt};
22
use indexmap::IndexMap;
3+
use reqwest::StatusCode;
34
use serde::{Deserialize, Serialize};
45
use snafu::{ResultExt, Snafu};
56
use tokio::task::JoinError;
6-
use tracing::{Instrument, Span, info, instrument};
7+
use tracing::{Instrument, Span, debug, info, instrument};
78
use tracing_indicatif::span_ext::IndicatifSpanExt as _;
89
#[cfg(feature = "openapi")]
910
use utoipa::ToSchema;
@@ -181,18 +182,38 @@ impl ReleaseSpec {
181182
}
182183
};
183184

184-
let request_url = &format!(
185+
let request_url_string = &format!(
185186
"https://raw.githubusercontent.com/stackabletech/{product_name}-operator/{release_branch}/deploy/helm/{product_name}-operator/crds/crds.yaml"
186187
);
187-
let request_url = request_url.into_path_or_url().context(ParsePathOrUrlSnafu {
188-
path_or_url: request_url.clone(),
188+
let request_url = request_url_string.into_path_or_url().context(ParsePathOrUrlSnafu {
189+
path_or_url: request_url_string,
189190
})?;
190191

191192
// Get CRD manifests from request_url
192-
let crd_manifests: String = transfer_client
193+
let crd_manifests = transfer_client
193194
.get(&request_url, &Text)
194-
.await
195-
.context(FileTransferSnafu)?;
195+
.await;
196+
let crd_manifests = match crd_manifests {
197+
Ok(crd_manifests) => crd_manifests,
198+
Err(crate::xfer::Error::FetchRemoteContent{source: reqwest_error})
199+
if reqwest_error.status() == Some(StatusCode::NOT_FOUND) => {
200+
// Ignore 404, as CRD versioning is rolled out to operators.
201+
// Starting with secret-operator 25.11.0, the CRD is maintained by the operator,
202+
// making this entire functionality obsolete.
203+
// As only some of the operators are migrated yet, some operator crds.yaml's
204+
// return a 404, others don't.
205+
debug!(
206+
product = product_name,
207+
// https://opentelemetry.io/docs/specs/semconv/http/http-spans/#http-client-span
208+
url.full = request_url_string,
209+
"Skipped updating CRD, as it doesn't exist in the upstream GitHub repo because the operator most likely uses CRD versioning"
210+
);
211+
return Ok(());
212+
},
213+
Err(err) => {
214+
return Err(Error::FileTransfer { source: err });
215+
},
216+
};
196217

197218
// Upgrade CRDs
198219
k8s_client

rust/stackablectl/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Fixed
8+
9+
- Don't crash during `release upgrade` for SDP 25.11.
10+
Previously it errored with `HTTP status client error (404 Not Found) for url (https://raw.githubusercontent.com/stackabletech/secret-operator/main/deploy/helm/secret-operator/crds/crds.yaml)`, as the secret-operator now maintains the CRD itself ([#418]).
11+
12+
[#418]: https://github.com/stackabletech/stackable-cockpit/pull/418
13+
714
## [1.2.0] - 2025-10-29
815

916
### Added

0 commit comments

Comments
 (0)