Skip to content

Commit fd86c0e

Browse files
authored
feat(operator): Add client-feature-gates gate (#1208)
* feat(operator): Add client-feature-gates gate * docs(operator): Add module docs * chore(operator): Add changelog entry
1 parent d2e418b commit fd86c0e

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

crates/stackable-operator/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ All notable changes to this project will be documented in this file.
77
### Added
88

99
- Add `Client::{get_feature_gates,get_enabled_feature_gates,get_disabled_feature_gates}` associated
10-
functions to retrieve all, enabled, or disabled feature gates from the Kubernetes apiserver ([#1207]).
10+
functions to retrieve all, enabled, or disabled feature gates from the Kubernetes apiserver ([#1207], [#1208]).
1111

1212
### Changed
1313

1414
- BREAKING: Use `serde_json::Value` instead of `String` for user-provided JSON `configOverrides`. This change is marked as breaking, as it causes a breaking change to the CRDs ([#1206]).
1515

1616
[#1206]: https://github.com/stackabletech/operator-rs/pull/1206
1717
[#1207]: https://github.com/stackabletech/operator-rs/pull/1207
18+
[#1208]: https://github.com/stackabletech/operator-rs/pull/1208
1819

1920
## [0.111.1] - 2026-04-28
2021

crates/stackable-operator/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ repository.workspace = true
99

1010
[features]
1111
default = ["crds"]
12-
full = ["crds", "certs", "time", "webhook", "kube-ws"]
12+
full = ["client-feature-gates", "crds", "certs", "time", "webhook", "kube-ws"]
1313

14+
client-feature-gates = ["dep:winnow"]
1415
crds = ["dep:stackable-versioned"]
1516
certs = ["dep:stackable-certs"]
1617
time = ["stackable-shared/time"]
@@ -54,7 +55,7 @@ tracing.workspace = true
5455
tracing-appender.workspace = true
5556
tracing-subscriber.workspace = true
5657
url.workspace = true
57-
winnow.workspace = true
58+
winnow = { workspace = true, optional = true }
5859

5960
[dev-dependencies]
6061
indoc.workspace = true

crates/stackable-operator/src/client/feature_gates.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Provides functions and types to retrieve feature gates from the Kubernetes apiserver.
2+
13
use std::{collections::HashMap, str::FromStr};
24

35
use snafu::{OptionExt as _, ResultExt as _, Snafu};
@@ -14,7 +16,7 @@ use crate::client::{
1416
impl Client {
1517
/// Retrieves and parses all feature gates via a raw request to the `/metrics` endpoint.
1618
///
17-
/// This list of feature gates in combination with [`KubeClient::apiserver_version`] can be used
19+
/// This list of feature gates in combination with [`kube::Client::apiserver_version`] can be used
1820
/// to enable gated behaviour.
1921
pub async fn get_feature_gates(&self) -> Result<Vec<FeatureGate>> {
2022
let request =

crates/stackable-operator/src/client/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Provides additional functionality on top of [`kube::Client`].
2+
13
use std::{
24
convert::TryFrom,
35
fmt::{Debug, Display},
@@ -24,7 +26,8 @@ use crate::{
2426
utils::cluster_info::{KubernetesClusterInfo, KubernetesClusterInfoOptions},
2527
};
2628

27-
mod feature_gates;
29+
#[cfg(feature = "client-feature-gates")]
30+
pub mod feature_gates;
2831

2932
pub type Result<T, E = Error> = std::result::Result<T, E>;
3033

@@ -92,15 +95,18 @@ pub enum Error {
9295
source: crate::utils::cluster_info::Error,
9396
},
9497

98+
#[cfg(feature = "client-feature-gates")]
9599
#[snafu(display("failed to create raw {method} request"))]
96100
CreateRawRequest {
97101
source: http::Error,
98102
method: http::Method,
99103
},
100104

105+
#[cfg(feature = "client-feature-gates")]
101106
#[snafu(display("failed to perform raw request"))]
102107
PerformRawRequest { source: kube::Error },
103108

109+
#[cfg(feature = "client-feature-gates")]
104110
#[snafu(display("failed to parse feature gate: {error}"))]
105111
ParseFeatureGate { error: String },
106112
}

0 commit comments

Comments
 (0)