Skip to content

Commit 9707daf

Browse files
committed
chore: Bump stackable_operator to 0.93.0
Note: Common CRD structs are now versioned. The CRD descriptions will be improved once changes like stackabletech/operator-rs#1040
1 parent c2c639d commit 9707daf

File tree

12 files changed

+510
-540
lines changed

12 files changed

+510
-540
lines changed

Cargo.lock

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

Cargo.nix

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/druid-operator"
1111

1212
[workspace.dependencies]
1313
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
14-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.92.0" }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.93.0" }
1515

1616
anyhow = "1.0"
1717
built = { version = "0.7", features = ["chrono", "git2"] }

crate-hashes.json

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

deploy/helm/druid-operator/crds/crds.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,18 +519,27 @@ spec:
519519
items:
520520
properties:
521521
authenticationClass:
522-
description: Name of the [AuthenticationClass](https://docs.stackable.tech/home/nightly/concepts/authentication) used to authenticate users.
522+
description: |-
523+
Name of the [AuthenticationClass](https://docs.stackable.tech/home/nightly/concepts/authentication) used to authenticate users.
524+
525+
To get the concrete [`AuthenticationClass`], we must resolve it. This resolution can be achieved by using [`ClientAuthenticationDetails::resolve_class`].
523526
type: string
524527
oidc:
525-
description: This field contains OIDC-specific configuration. It is only required in case OIDC is used.
528+
description: |-
529+
This field contains OIDC-specific configuration. It is only required in case OIDC is used.
530+
531+
Use [`ClientAuthenticationDetails::oidc_or_error`] to get the value or report an error to the user.
526532
nullable: true
527533
properties:
528534
clientCredentialsSecret:
529535
description: A reference to the OIDC client credentials secret. The secret contains the client id and secret.
530536
type: string
531537
extraScopes:
532538
default: []
533-
description: An optional list of extra scopes which get merged with the scopes defined in the [`AuthenticationClass`].
539+
description: |-
540+
An optional list of extra scopes which get merged with the scopes defined in the [`AuthenticationClass`][1].
541+
542+
[1]: crate::crd::authentication::core::v1alpha1::AuthenticationClass
534543
items:
535544
type: string
536545
type: array

rust/operator-binary/src/authentication/ldap.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ use std::collections::BTreeMap;
33
use snafu::ResultExt;
44
use stackable_operator::{
55
builder::pod::{PodBuilder, container::ContainerBuilder},
6-
commons::authentication::ldap::AuthenticationProvider,
6+
crd::authentication::ldap,
77
};
88

9-
use crate::{
10-
authentication::{
11-
AddLdapVolumesSnafu, ConstructLdapEndpointUrlSnafu, Error, MissingLdapBindCredentialsSnafu,
12-
},
13-
crd::security::{STACKABLE_TLS_DIR, TLS_STORE_PASSWORD, add_cert_to_trust_store_cmd},
9+
use super::{
10+
AddLdapVolumesSnafu, ConstructLdapEndpointUrlSnafu, Error, MissingLdapBindCredentialsSnafu,
1411
};
12+
use crate::crd::security::{STACKABLE_TLS_DIR, TLS_STORE_PASSWORD, add_cert_to_trust_store_cmd};
1513

1614
fn add_authenticator_config(
17-
provider: &AuthenticationProvider,
15+
provider: &ldap::v1alpha1::AuthenticationProvider,
1816
config: &mut BTreeMap<String, Option<String>>,
1917
) -> Result<(), Error> {
2018
config.insert(
@@ -88,7 +86,7 @@ fn add_authorizer_config(config: &mut BTreeMap<String, Option<String>>) {
8886
}
8987

9088
pub fn generate_runtime_properties_config(
91-
provider: &AuthenticationProvider,
89+
provider: &ldap::v1alpha1::AuthenticationProvider,
9290
config: &mut BTreeMap<String, Option<String>>,
9391
) -> Result<(), Error> {
9492
add_authenticator_config(provider, config)?;
@@ -99,7 +97,7 @@ pub fn generate_runtime_properties_config(
9997

10098
pub fn prepare_container_commands(
10199
auth_class_name: &String,
102-
provider: &AuthenticationProvider,
100+
provider: &ldap::v1alpha1::AuthenticationProvider,
103101
command: &mut Vec<String>,
104102
) {
105103
if let Some(tls_ca_cert_mount_path) = provider.tls.tls_ca_cert_mount_path() {
@@ -113,7 +111,7 @@ pub fn prepare_container_commands(
113111
}
114112

115113
pub fn add_volumes_and_mounts(
116-
provider: &AuthenticationProvider,
114+
provider: &ldap::v1alpha1::AuthenticationProvider,
117115
pb: &mut PodBuilder,
118116
cb_druid: &mut ContainerBuilder,
119117
cb_prepare: &mut ContainerBuilder,

rust/operator-binary/src/authentication/mod.rs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@ use std::collections::BTreeMap;
33
use snafu::Snafu;
44
use stackable_operator::{
55
builder::pod::{PodBuilder, container::ContainerBuilder},
6-
commons::{
7-
authentication::{
8-
ldap::AuthenticationProvider as LdapAuthenticationProvider,
9-
oidc::{
10-
AuthenticationProvider as OidcAuthenticationProvider, ClientAuthenticationOptions,
11-
},
12-
},
13-
tls_verification::TlsClientDetailsError,
14-
},
6+
crd::authentication,
157
k8s_openapi::api::core::v1::EnvVar,
168
};
179

@@ -34,21 +26,23 @@ type Result<T, E = Error> = std::result::Result<T, E>;
3426
pub enum Error {
3527
#[snafu(display("failed to create LDAP endpoint url."))]
3628
ConstructLdapEndpointUrl {
37-
source: stackable_operator::commons::authentication::ldap::Error,
29+
source: stackable_operator::crd::authentication::ldap::v1alpha1::Error,
3830
},
3931

4032
#[snafu(display("failed to create the OIDC well-known url."))]
4133
ConstructOidcWellKnownUrl {
42-
source: stackable_operator::commons::authentication::oidc::Error,
34+
source: stackable_operator::crd::authentication::oidc::v1alpha1::Error,
4335
},
4436

4537
#[snafu(display("failed to add LDAP Volumes and VolumeMounts to the Pod and containers"))]
4638
AddLdapVolumes {
47-
source: stackable_operator::commons::authentication::ldap::Error,
39+
source: stackable_operator::crd::authentication::ldap::v1alpha1::Error,
4840
},
4941

5042
#[snafu(display("failed to add OIDC Volumes and VolumeMounts to the Pod and containers"))]
51-
AddOidcVolumes { source: TlsClientDetailsError },
43+
AddOidcVolumes {
44+
source: stackable_operator::commons::tls_verification::TlsClientDetailsError,
45+
},
5246

5347
#[snafu(display(
5448
"failed to access bind credentials although they are required for LDAP to work"
@@ -61,12 +55,12 @@ pub enum DruidAuthenticationConfig {
6155
Tls {},
6256
Ldap {
6357
auth_class_name: String,
64-
provider: LdapAuthenticationProvider,
58+
provider: authentication::ldap::v1alpha1::AuthenticationProvider,
6559
},
6660
Oidc {
6761
auth_class_name: String,
68-
provider: OidcAuthenticationProvider,
69-
oidc: ClientAuthenticationOptions,
62+
provider: authentication::oidc::v1alpha1::AuthenticationProvider,
63+
oidc: authentication::oidc::v1alpha1::ClientAuthenticationOptions,
7064
},
7165
}
7266

@@ -252,16 +246,16 @@ impl DruidAuthenticationConfig {
252246

253247
#[cfg(test)]
254248
mod test {
255-
use stackable_operator::commons::authentication::ldap::AuthenticationProvider as LdapAuthenticationProvider;
256-
257249
use super::*;
258250

259251
#[test]
260252
fn test_ldap_config_is_added() {
261253
let auth_config = DruidAuthenticationConfig::try_from(AuthenticationClassesResolved {
262254
auth_classes: vec![AuthenticationClassResolved::Ldap {
263255
auth_class_name: "ldap".to_string(),
264-
provider: serde_yaml::from_str::<LdapAuthenticationProvider>(
256+
provider: serde_yaml::from_str::<
257+
authentication::ldap::v1alpha1::AuthenticationProvider,
258+
>(
265259
"
266260
hostname: openldap
267261
searchBase: ou=users,dc=example,dc=org

rust/operator-binary/src/authentication/oidc.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,30 @@ use std::collections::BTreeMap;
33
use snafu::ResultExt;
44
use stackable_operator::{
55
builder::pod::{PodBuilder, container::ContainerBuilder},
6-
commons::authentication::oidc::{AuthenticationProvider, ClientAuthenticationOptions},
6+
crd::authentication::oidc,
77
k8s_openapi::api::core::v1::EnvVar,
88
};
99

10+
use super::{AddOidcVolumesSnafu, ConstructOidcWellKnownUrlSnafu, Error};
1011
use crate::{
11-
authentication::{AddOidcVolumesSnafu, ConstructOidcWellKnownUrlSnafu, Error},
1212
crd::{COOKIE_PASSPHRASE_ENV, DruidRole, security::add_cert_to_jvm_trust_store_cmd},
1313
internal_secret::env_var_from_secret,
1414
};
1515

1616
/// Creates OIDC authenticator config using the pac4j extension for Druid: <https://druid.apache.org/docs/latest/development/extensions-core/druid-pac4j>.
1717
fn add_authenticator_config(
18-
provider: &AuthenticationProvider,
19-
oidc: &ClientAuthenticationOptions,
18+
provider: &oidc::v1alpha1::AuthenticationProvider,
19+
oidc: &oidc::v1alpha1::ClientAuthenticationOptions,
2020
config: &mut BTreeMap<String, Option<String>>,
2121
) -> Result<(), Error> {
2222
let well_known_url = &provider
2323
.well_known_config_url()
2424
.context(ConstructOidcWellKnownUrlSnafu)?;
2525

2626
let (oidc_client_id_env, oidc_client_secret_env) =
27-
AuthenticationProvider::client_credentials_env_names(&oidc.client_credentials_secret_ref);
27+
oidc::v1alpha1::AuthenticationProvider::client_credentials_env_names(
28+
&oidc.client_credentials_secret_ref,
29+
);
2830

2931
let mut scopes = provider.scopes.clone();
3032
scopes.extend_from_slice(&oidc.extra_scopes);
@@ -84,8 +86,8 @@ fn add_authorizer_config(config: &mut BTreeMap<String, Option<String>>) {
8486
/// OIDC authentication is not configured on middlemanagers, because end users don't interact with them directly using the web console and
8587
/// turning on OIDC will lead to problems with the communication with coordinators during data ingest.
8688
pub fn generate_runtime_properties_config(
87-
provider: &AuthenticationProvider,
88-
oidc: &ClientAuthenticationOptions,
89+
provider: &oidc::v1alpha1::AuthenticationProvider,
90+
oidc: &oidc::v1alpha1::ClientAuthenticationOptions,
8991
role: &DruidRole,
9092
config: &mut BTreeMap<String, Option<String>>,
9193
) -> Result<(), Error> {
@@ -106,7 +108,7 @@ pub fn generate_runtime_properties_config(
106108

107109
pub fn main_container_commands(
108110
auth_class_name: &String,
109-
provider: &AuthenticationProvider,
111+
provider: &oidc::v1alpha1::AuthenticationProvider,
110112
command: &mut Vec<String>,
111113
) {
112114
if let Some(tls_ca_cert_mount_path) = provider.tls.tls_ca_cert_mount_path() {
@@ -121,16 +123,18 @@ pub fn main_container_commands(
121123
/// Not necessary on middlemanagers, because OIDC is not configured on them.
122124
pub fn get_env_var_mounts(
123125
role: &DruidRole,
124-
oidc: &ClientAuthenticationOptions,
126+
oidc: &oidc::v1alpha1::ClientAuthenticationOptions,
125127
internal_secret_name: &str,
126128
) -> Vec<EnvVar> {
127129
let mut envs = vec![];
128130
match role {
129131
DruidRole::MiddleManager => (),
130132
_ => {
131-
envs.extend(AuthenticationProvider::client_credentials_env_var_mounts(
132-
oidc.client_credentials_secret_ref.to_owned(),
133-
));
133+
envs.extend(
134+
oidc::v1alpha1::AuthenticationProvider::client_credentials_env_var_mounts(
135+
oidc.client_credentials_secret_ref.to_owned(),
136+
),
137+
);
134138
envs.push(env_var_from_secret(
135139
internal_secret_name,
136140
None,
@@ -142,7 +146,7 @@ pub fn get_env_var_mounts(
142146
}
143147

144148
pub fn add_volumes_and_mounts(
145-
provider: &AuthenticationProvider,
149+
provider: &oidc::v1alpha1::AuthenticationProvider,
146150
pb: &mut PodBuilder,
147151
cb_druid: &mut ContainerBuilder,
148152
cb_prepare: &mut ContainerBuilder,
@@ -165,13 +169,13 @@ mod tests {
165169
#[case("/realms/sdp/")]
166170
#[case("/realms/sdp/////")]
167171
fn test_add_authenticator_config(#[case] root_path: String) {
168-
use stackable_operator::commons::{
169-
authentication::oidc,
170-
tls_verification::{CaCert, TlsServerVerification, TlsVerification},
172+
use stackable_operator::{
173+
commons::tls_verification::{CaCert, TlsServerVerification, TlsVerification},
174+
crd::authentication::oidc,
171175
};
172176

173177
let mut properties = BTreeMap::new();
174-
let provider = oidc::AuthenticationProvider::new(
178+
let provider = oidc::v1alpha1::AuthenticationProvider::new(
175179
"keycloak.mycorp.org".to_owned().try_into().unwrap(),
176180
Some(443),
177181
root_path,
@@ -186,7 +190,7 @@ mod tests {
186190
vec!["openid".to_owned()],
187191
None,
188192
);
189-
let oidc = ClientAuthenticationOptions {
193+
let oidc = oidc::v1alpha1::ClientAuthenticationOptions {
190194
client_credentials_secret_ref: "nifi-keycloak-client".to_owned(),
191195
extra_scopes: vec![],
192196
product_specific_fields: (),

0 commit comments

Comments
 (0)