Skip to content

Commit e20ac20

Browse files
committed
chore: Merge branch 'main' into feat/label-ext
2 parents eea1420 + 5b7a4f6 commit e20ac20

File tree

12 files changed

+573
-280
lines changed

12 files changed

+573
-280
lines changed

crates/stackable-operator/CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,23 @@ All notable changes to this project will be documented in this file.
1111
- `Label::stackable_vendor`: stackable.tech/vendor=Stackable
1212
- `Label::instance`: app.kubernetes.io/instance
1313
- `Label::name`: app.kubernetes.io/name
14+
- BREAKING: Add new ListenerClass `.spec.pinnedNodePorts` field ([#1105]).
1415

16+
[#1105]: https://github.com/stackabletech/operator-rs/pull/1105
1517
[#1106]: https://github.com/stackabletech/operator-rs/pull/1106
1618

1719
## [0.99.0] - 2025-10-06
1820

1921
### Added
2022

23+
- Add `CustomResourceDefinitionMaintainer` which applies and patches CRDs triggered by TLS
24+
certificate rotations of the `ConversionWebhookServer`. It additionally provides a `oneshot`
25+
channel which can for example be used to trigger creation/patching of any custom resources deployed by
26+
the operator ([#1099]).
27+
- Add a `Client::create_if_missing` associated function to create a resource if it doesn't
28+
exist ([#1099]).
2129
- Add CLI argument and env var to disable the end-of-support checker: `EOS_DISABLED` (`--eos-disabled`) ([#1101]).
22-
- Add end-of-support checker ([#1096]).
30+
- Add end-of-support checker ([#1096], [#1103]).
2331
- The EoS checker can be constructed using `EndOfSupportChecker::new()`.
2432
- Add new `MaintenanceOptions` and `EndOfSupportOptions` structs.
2533
- Add new CLI arguments and env vars:
@@ -38,6 +46,7 @@ All notable changes to this project will be documented in this file.
3846

3947
[#1096]: https://github.com/stackabletech/operator-rs/pull/1096
4048
[#1098]: https://github.com/stackabletech/operator-rs/pull/1098
49+
[#1099]: https://github.com/stackabletech/operator-rs/pull/1099
4150
[#1101]: https://github.com/stackabletech/operator-rs/pull/1101
4251
[#1103]: https://github.com/stackabletech/operator-rs/pull/1103
4352

crates/stackable-operator/crds/ListenerClass.yaml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-operator/src/client.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,25 @@ impl Client {
253253
})
254254
}
255255

256+
/// Optionally creates a resource if it does not exist yet.
257+
///
258+
/// The name used for lookup is extracted from the resource via [`ResourceExt::name_any()`].
259+
/// This function either returns the existing resource or the newly created one.
260+
pub async fn create_if_missing<T>(&self, resource: &T) -> Result<T>
261+
where
262+
T: Clone + Debug + DeserializeOwned + Resource + Serialize + GetApi,
263+
<T as Resource>::DynamicType: Default,
264+
{
265+
if let Some(r) = self
266+
.get_opt(&resource.name_any(), resource.get_namespace())
267+
.await?
268+
{
269+
return Ok(r);
270+
}
271+
272+
self.create(resource).await
273+
}
274+
256275
/// Patches a resource using the `MERGE` patch strategy described
257276
/// in [JSON Merge Patch](https://tools.ietf.org/html/rfc7386)
258277
/// This will fail for objects that do not exist yet.

crates/stackable-operator/src/crd/listener/class/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,19 @@ pub mod versioned {
6666
/// Defaults to `HostnameConservative`.
6767
#[serde(default = "ListenerClassSpec::default_preferred_address_type")]
6868
pub preferred_address_type: core_v1alpha1::PreferredAddressType,
69+
70+
/// Whether or not a Pod exposed using a NodePort should be pinned to a specific Kubernetes node.
71+
///
72+
/// By pinning the Pod to a specific (stable) Kubernetes node, stable addresses can be
73+
/// provided using NodePorts. The pinning is achieved by listener-operator setting the
74+
/// `volume.kubernetes.io/selected-node` annotation on the Listener PVC.
75+
///
76+
/// However, this only works on setups with long-living nodes. If your nodes are rotated on
77+
/// a regular basis, the Pods previously running on a removed node will be stuck in Pending
78+
/// until you delete the PVC with the pinning.
79+
///
80+
/// Because of this we don't enable pinning by default to support all environments.
81+
#[serde(default)]
82+
pub pinned_node_ports: bool,
6983
}
7084
}

crates/stackable-webhook/CHANGELOG.md

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

55
## [Unreleased]
66

7+
### Changed
8+
9+
- BREAKING: `ConversionWebhookServer::new` now returns a pair of values ([#1099]):
10+
- The conversion webhook server itself
11+
- A `mpsc::Receiver<Certificate>` to provide consumers the newly generated TLS certificate
12+
- BREAKING: Constants for ports, IP addresses and socket addresses are now associated constants on
13+
`(Conversion)WebhookServer` instead of free-standing ones ([#1099]).
14+
15+
### Removed
16+
17+
- BREAKING: The `maintain_crds` and `field_manager` fields in `ConversionWebhookOptions`
18+
are removed ([#1099]).
19+
20+
[#1099]: https://github.com/stackabletech/operator-rs/pull/1099
21+
722
## [0.6.0] - 2025-09-09
823

924
### Added

crates/stackable-webhook/src/constants.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

crates/stackable-webhook/src/lib.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
//! enable complete control over these details if needed.
2727
//!
2828
//! [1]: crate::servers::ConversionWebhookServer
29+
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
30+
31+
use ::x509_cert::Certificate;
2932
use axum::{Router, routing::get};
3033
use futures_util::{FutureExt as _, pin_mut, select};
3134
use snafu::{ResultExt, Snafu};
@@ -35,19 +38,16 @@ use tokio::{
3538
sync::mpsc,
3639
};
3740
use tower::ServiceBuilder;
38-
use x509_cert::Certificate;
3941

40-
// use tower_http::trace::TraceLayer;
42+
// Selected re-exports
43+
pub use crate::options::WebhookOptions;
4144
use crate::tls::TlsServer;
4245

43-
pub mod constants;
46+
pub mod maintainer;
4447
pub mod options;
4548
pub mod servers;
4649
pub mod tls;
4750

48-
// Selected re-exports
49-
pub use crate::options::WebhookOptions;
50-
5151
/// A generic webhook handler receiving a request and sending back a response.
5252
///
5353
/// This trait is not intended to be implemented by external crates and this
@@ -86,6 +86,19 @@ pub struct WebhookServer {
8686
}
8787

8888
impl WebhookServer {
89+
/// The default HTTPS port `8443`
90+
pub const DEFAULT_HTTPS_PORT: u16 = 8443;
91+
/// The default IP address [`Ipv4Addr::UNSPECIFIED`] (`0.0.0.0`) the webhook server binds to,
92+
/// which represents binding on all network addresses.
93+
//
94+
// TODO: We might want to switch to `Ipv6Addr::UNSPECIFIED)` here, as this *normally* binds to IPv4
95+
// and IPv6. However, it's complicated and depends on the underlying system...
96+
// If we do so, we should set `set_only_v6(false)` on the socket to not rely on system defaults.
97+
pub const DEFAULT_LISTEN_ADDRESS: IpAddr = IpAddr::V4(Ipv4Addr::UNSPECIFIED);
98+
/// The default socket address `0.0.0.0:8443` the webhook server binds to.
99+
pub const DEFAULT_SOCKET_ADDRESS: SocketAddr =
100+
SocketAddr::new(Self::DEFAULT_LISTEN_ADDRESS, Self::DEFAULT_HTTPS_PORT);
101+
89102
/// Creates a new ready-to-use webhook server.
90103
///
91104
/// The server listens on `socket_addr` which is provided via the [`WebhookOptions`] and handles

0 commit comments

Comments
 (0)