Skip to content

Commit aad5110

Browse files
committed
fix: make opaconfig optional, rename logging module, document listener ephemeral API
1 parent 34459d4 commit aad5110

13 files changed

Lines changed: 61 additions & 21 deletions

File tree

extra/crds.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ spec:
6868
and the name of the Rego package containing your authorization rules.
6969
Consult the [OPA authorization documentation](https://docs.stackable.tech/home/nightly/concepts/opa)
7070
to learn how to deploy Rego authorization rules with OPA.
71+
nullable: true
7172
properties:
7273
configMapName:
7374
description: |-
@@ -81,8 +82,6 @@ spec:
8182
required:
8283
- configMapName
8384
type: object
84-
required:
85-
- opa
8685
type: object
8786
hdfsConfigMapName:
8887
description: |-

rust/operator-binary/src/controller/build/opa.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use snafu::{ResultExt, Snafu};
2-
use stackable_operator::{client::Client, commons::opa::OpaApiVersion};
2+
use stackable_operator::{
3+
client::Client,
4+
commons::opa::{OpaApiVersion, OpaConfig},
5+
};
36

4-
use crate::crd::{security::AuthorizationConfig, v1alpha1};
7+
use crate::crd::v1alpha1;
58

69
const DEFAULT_DRY_RUN: bool = false;
710
const DEFAULT_CACHE_ACTIVE: bool = true;
@@ -51,10 +54,9 @@ impl HbaseOpaConfig {
5154
pub async fn from_opa_config(
5255
client: &Client,
5356
hbase: &v1alpha1::HbaseCluster,
54-
authorization_config: &AuthorizationConfig,
57+
opa_config: &OpaConfig,
5558
) -> Result<Self> {
56-
let authorization_connection_string = authorization_config
57-
.opa
59+
let authorization_connection_string = opa_config
5860
.full_document_url_from_config_map(client, hbase, Some("allow"), &OpaApiVersion::V1)
5961
.await
6062
.context(ConstructOpaEndpointForAuthorizerSnafu)?;

rust/operator-binary/src/controller/build/properties/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use stackable_operator::v2::{
1111

1212
pub mod hbase_env;
1313
pub mod hbase_site;
14-
pub mod logging;
14+
pub mod product_logging;
1515
pub mod security_properties;
1616
pub mod ssl_client;
1717
pub mod ssl_server;

rust/operator-binary/src/controller/build/properties/logging/mod.rs renamed to rust/operator-binary/src/controller/build/properties/product_logging/mod.rs

File renamed without changes.

rust/operator-binary/src/controller/build/properties/logging/test-vector.sh renamed to rust/operator-binary/src/controller/build/properties/product_logging/test-vector.sh

File renamed without changes.

rust/operator-binary/src/controller/build/properties/logging/vector-test.yaml renamed to rust/operator-binary/src/controller/build/properties/product_logging/vector-test.yaml

File renamed without changes.

rust/operator-binary/src/controller/build/properties/logging/vector.yaml renamed to rust/operator-binary/src/controller/build/properties/product_logging/vector.yaml

File renamed without changes.

rust/operator-binary/src/controller/build/resource/config_map.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use crate::{
1616
jvm::construct_role_specific_non_heap_jvm_args,
1717
kerberos,
1818
properties::{
19-
ConfigFileName, hbase_env, hbase_site, logging, security_properties, ssl_client,
20-
ssl_server,
19+
ConfigFileName, hbase_env, hbase_site, product_logging, security_properties,
20+
ssl_client, ssl_server,
2121
},
2222
},
2323
},
@@ -136,11 +136,16 @@ pub fn build_rolegroup_config_map(
136136
builder.add_data(ConfigFileName::SslClient.to_string(), ssl_client_xml);
137137
}
138138

139-
if let Some(log4j2_properties) = logging::build_log4j2(&rg.config.logging.hbase_container) {
139+
if let Some(log4j2_properties) =
140+
product_logging::build_log4j2(&rg.config.logging.hbase_container)
141+
{
140142
builder.add_data(ConfigFileName::Log4j2.to_string(), log4j2_properties);
141143
}
142144
if rg.config.logging.enable_vector_agent {
143-
builder.add_data(VECTOR_CONFIG_FILE, logging::vector_config_file_content());
145+
builder.add_data(
146+
VECTOR_CONFIG_FILE,
147+
product_logging::vector_config_file_content(),
148+
);
144149
}
145150

146151
builder.build().with_context(|_| AssembleSnafu {

rust/operator-binary/src/controller/build/resource/listener.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ pub fn build_listener_volume(
5151
HbaseRole::Master | HbaseRole::RegionServer => Some(
5252
VolumeBuilder::new(LISTENER_VOLUME_NAME)
5353
.ephemeral(
54+
// The v2 framework only exposes a PVC builder
55+
// (`listener_operator_volume_source_builder_build_pvc`, used by
56+
// `build_listener_pvc`), so the ephemeral case still uses the legacy
57+
// `ListenerOperatorVolumeSourceBuilder` and its stringly-typed
58+
// `ListenerReference`. We keep the typed `listener_class()` and convert to a
59+
// `String` only at this boundary; switch to a v2 helper once one exists.
5460
ListenerOperatorVolumeSourceBuilder::new(
5561
&ListenerReference::ListenerClass(
5662
merged_config.listener_class().to_string(),

rust/operator-binary/src/controller/build/resource/statefulset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use crate::{
4040
build::{
4141
graceful_shutdown::{self, add_graceful_shutdown_config},
4242
kerberos::{self, add_kerberos_pod_config},
43-
properties::logging::{MAX_HBASE_LOG_FILES_SIZE, STACKABLE_LOG_DIR},
43+
properties::product_logging::{MAX_HBASE_LOG_FILES_SIZE, STACKABLE_LOG_DIR},
4444
},
4545
},
4646
crd::{CONFIG_DIR_NAME, HbaseRole, LISTENER_VOLUME_DIR, LISTENER_VOLUME_NAME},

0 commit comments

Comments
 (0)