Skip to content

Commit 3b1f206

Browse files
committed
bump op-rs to 0.110.1
1 parent 9d315f7 commit 3b1f206

16 files changed

Lines changed: 389 additions & 222 deletions

File tree

Cargo.lock

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

Cargo.nix

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/nifi-operator"
1111

1212
[workspace.dependencies]
1313
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.8.0" }
14-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "chore/kube-3.1.0", features = ["webhook"] }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.110.1", features = ["webhook"] }
1515

1616
anyhow = "1.0"
1717
built = { version = "0.8", features = ["chrono", "git2"] }
@@ -27,7 +27,7 @@ semver = "1.0"
2727
serde = { version = "1.0", features = ["derive"] }
2828
serde_json = "1.0"
2929
serde_yaml = "0.9"
30-
snafu = "0.8"
30+
snafu = "0.9"
3131
strum = { version = "0.28", features = ["derive"] }
3232
tokio = { version = "1.40", features = ["full"] }
3333
tracing = "0.1"

crate-hashes.json

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

extra/crds.yaml

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ spec:
4848
description: This field contains OIDC-specific configuration. It is only required in case OIDC is used.
4949
nullable: true
5050
properties:
51-
clientAuthenticationMethod:
52-
default: client_secret_basic
53-
description: 'The client authentication method used when communicating with the token endpoint. Defaults to `client_secret_basic`. The required contents of `clientCredentialsSecret` depend on the chosen method: secret-based methods (`client_secret_basic`, `client_secret_post`, `client_secret_jwt`) expect a client secret, while `private_key_jwt` expects a private key.'
54-
enum:
55-
- client_secret_basic
56-
- client_secret_post
57-
- client_secret_jwt
58-
- private_key_jwt
59-
- none
60-
type: string
6151
clientCredentialsSecret:
6252
description: |-
6353
A reference to the OIDC client credentials secret. The secret contains
@@ -1260,17 +1250,43 @@ spec:
12601250
type: object
12611251
type: object
12621252
configOverrides:
1263-
additionalProperties:
1264-
additionalProperties:
1265-
type: string
1266-
type: object
1267-
default: {}
12681253
description: |-
12691254
The `configOverrides` can be used to configure properties in product config files
12701255
that are not exposed in the CRD. Read the
12711256
[config overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#config-overrides)
12721257
and consult the operator specific usage guide documentation for details on the
12731258
available config files and settings for the specific product.
1259+
properties:
1260+
bootstrap.conf:
1261+
additionalProperties:
1262+
type: string
1263+
description: |-
1264+
Flat key-value overrides for `*.properties`, Hadoop XML, etc.
1265+
1266+
This is backwards-compatible with the existing flat key-value YAML format
1267+
used by `HashMap<String, String>`.
1268+
nullable: true
1269+
type: object
1270+
nifi.properties:
1271+
additionalProperties:
1272+
type: string
1273+
description: |-
1274+
Flat key-value overrides for `*.properties`, Hadoop XML, etc.
1275+
1276+
This is backwards-compatible with the existing flat key-value YAML format
1277+
used by `HashMap<String, String>`.
1278+
nullable: true
1279+
type: object
1280+
security.properties:
1281+
additionalProperties:
1282+
type: string
1283+
description: |-
1284+
Flat key-value overrides for `*.properties`, Hadoop XML, etc.
1285+
1286+
This is backwards-compatible with the existing flat key-value YAML format
1287+
used by `HashMap<String, String>`.
1288+
nullable: true
1289+
type: object
12741290
type: object
12751291
envOverrides:
12761292
additionalProperties:
@@ -2105,17 +2121,43 @@ spec:
21052121
type: object
21062122
type: object
21072123
configOverrides:
2108-
additionalProperties:
2109-
additionalProperties:
2110-
type: string
2111-
type: object
2112-
default: {}
21132124
description: |-
21142125
The `configOverrides` can be used to configure properties in product config files
21152126
that are not exposed in the CRD. Read the
21162127
[config overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#config-overrides)
21172128
and consult the operator specific usage guide documentation for details on the
21182129
available config files and settings for the specific product.
2130+
properties:
2131+
bootstrap.conf:
2132+
additionalProperties:
2133+
type: string
2134+
description: |-
2135+
Flat key-value overrides for `*.properties`, Hadoop XML, etc.
2136+
2137+
This is backwards-compatible with the existing flat key-value YAML format
2138+
used by `HashMap<String, String>`.
2139+
nullable: true
2140+
type: object
2141+
nifi.properties:
2142+
additionalProperties:
2143+
type: string
2144+
description: |-
2145+
Flat key-value overrides for `*.properties`, Hadoop XML, etc.
2146+
2147+
This is backwards-compatible with the existing flat key-value YAML format
2148+
used by `HashMap<String, String>`.
2149+
nullable: true
2150+
type: object
2151+
security.properties:
2152+
additionalProperties:
2153+
type: string
2154+
description: |-
2155+
Flat key-value overrides for `*.properties`, Hadoop XML, etc.
2156+
2157+
This is backwards-compatible with the existing flat key-value YAML format
2158+
used by `HashMap<String, String>`.
2159+
nullable: true
2160+
type: object
21192161
type: object
21202162
envOverrides:
21212163
additionalProperties:

rust/operator-binary/src/config/jvm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use snafu::{OptionExt, ResultExt, Snafu};
22
use stackable_operator::{
33
memory::{BinaryMultiple, MemoryQuantity},
4-
role_utils::{self, JavaCommonConfig, JvmArgumentOverrides, Role},
4+
role_utils::{self, JvmArgumentOverrides},
55
};
66

77
use crate::{
88
config::{JVM_SECURITY_PROPERTIES_FILE, NIFI_CONFIG_DIRECTORY},
9-
crd::{NifiConfig, NifiConfigFragment, NifiNodeRoleConfig},
9+
crd::{NifiConfig, NifiRoleType},
1010
security::{
1111
authentication::{STACKABLE_SERVER_TLS_DIR, STACKABLE_TLS_STORE_PASSWORD},
1212
authorization::ResolvedNifiAuthorizationConfig,
@@ -33,7 +33,7 @@ pub enum Error {
3333
/// Create the NiFi bootstrap.conf
3434
pub fn build_merged_jvm_config(
3535
merged_config: &NifiConfig,
36-
role: &Role<NifiConfigFragment, NifiNodeRoleConfig, JavaCommonConfig>,
36+
role: &NifiRoleType,
3737
role_group: &str,
3838
authorization_config: Option<&ResolvedNifiAuthorizationConfig>,
3939
) -> Result<JvmArgumentOverrides, Error> {

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ use stackable_operator::{
1414
ValidatedRoleConfigByPropertyKind, transform_all_roles_to_config,
1515
validate_all_roles_and_groups_config,
1616
},
17-
role_utils::{JavaCommonConfig, Role},
1817
};
1918
use strum::{Display, EnumIter};
2019

2120
use crate::{
2221
crd::{
23-
HTTPS_PORT, NifiConfig, NifiConfigFragment, NifiNodeRoleConfig, NifiRole,
24-
NifiStorageConfig, PROTOCOL_PORT, sensitive_properties,
22+
HTTPS_PORT, NifiConfig, NifiRole, NifiRoleType, NifiStorageConfig, PROTOCOL_PORT,
23+
sensitive_properties,
2524
v1alpha1::{self, NifiClusteringBackend},
2625
},
2726
operations::graceful_shutdown::graceful_shutdown_config_properties,
@@ -116,7 +115,7 @@ pub enum Error {
116115
pub fn build_bootstrap_conf(
117116
merged_config: &NifiConfig,
118117
overrides: BTreeMap<String, String>,
119-
role: &Role<NifiConfigFragment, NifiNodeRoleConfig, JavaCommonConfig>,
118+
role: &NifiRoleType,
120119
role_group: &str,
121120
authorization_config: Option<&crate::security::authorization::ResolvedNifiAuthorizationConfig>,
122121
) -> Result<String, Error> {
@@ -756,7 +755,7 @@ pub fn build_state_management_xml(clustering_backend: &NifiClusteringBackend) ->
756755
pub fn validated_product_config(
757756
resource: &v1alpha1::NifiCluster,
758757
version: &str,
759-
role: &Role<NifiConfigFragment, NifiNodeRoleConfig, JavaCommonConfig>,
758+
role: &NifiRoleType,
760759
product_config: &ProductConfigManager,
761760
) -> Result<ValidatedRoleConfigByPropertyKind, Error> {
762761
let mut roles = HashMap::new();
@@ -775,7 +774,7 @@ pub fn validated_product_config(
775774
);
776775

777776
let role_config =
778-
transform_all_roles_to_config(resource, roles).context(ProductConfigTransformSnafu)?;
777+
transform_all_roles_to_config(resource, &roles).context(ProductConfigTransformSnafu)?;
779778

780779
validate_all_roles_and_groups_config(version, &role_config, product_config, false, false)
781780
.context(InvalidProductConfigSnafu)

rust/operator-binary/src/controller.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use stackable_operator::{
6363
CustomContainerLogConfig,
6464
},
6565
},
66-
role_utils::{GenericRoleConfig, JavaCommonConfig, Role, RoleGroupRef},
66+
role_utils::{GenericRoleConfig, RoleGroupRef},
6767
shared::time::Duration,
6868
status::condition::{
6969
compute_conditions, operations::ClusterOperationsConditionBuilder,
@@ -84,10 +84,10 @@ use crate::{
8484
},
8585
crd::{
8686
APP_NAME, BALANCE_PORT, BALANCE_PORT_NAME, Container, HTTPS_PORT, HTTPS_PORT_NAME,
87-
METRICS_PORT, METRICS_PORT_NAME, NifiConfig, NifiConfigFragment, NifiNodeRoleConfig,
88-
NifiRole, NifiStatus, PROTOCOL_PORT, PROTOCOL_PORT_NAME, STACKABLE_LOG_CONFIG_DIR,
89-
STACKABLE_LOG_DIR, authentication::AuthenticationClassResolved,
90-
authorization::NifiAccessPolicyProvider, v1alpha1,
87+
METRICS_PORT, METRICS_PORT_NAME, NifiConfig, NifiNodeRoleConfig, NifiRole, NifiRoleType,
88+
NifiStatus, PROTOCOL_PORT, PROTOCOL_PORT_NAME, STACKABLE_LOG_CONFIG_DIR, STACKABLE_LOG_DIR,
89+
authentication::AuthenticationClassResolved, authorization::NifiAccessPolicyProvider,
90+
v1alpha1,
9191
},
9292
listener::{
9393
LISTENER_VOLUME_DIR, LISTENER_VOLUME_NAME, build_group_listener, build_group_listener_pvc,
@@ -719,7 +719,7 @@ async fn build_node_rolegroup_config_map(
719719
resolved_product_image: &ResolvedProductImage,
720720
authentication_config: &NifiAuthenticationConfig,
721721
authorization_config: &ResolvedNifiAuthorizationConfig,
722-
role: &Role<NifiConfigFragment, NifiNodeRoleConfig, JavaCommonConfig>,
722+
role: &NifiRoleType,
723723
rolegroup: &RoleGroupRef<v1alpha1::NifiCluster>,
724724
rolegroup_config: &HashMap<PropertyNameKind, BTreeMap<String, String>>,
725725
merged_config: &NifiConfig,
@@ -755,7 +755,7 @@ async fn build_node_rolegroup_config_map(
755755
.name(rolegroup.object_name())
756756
.ownerreference_from_resource(nifi, None, Some(true))
757757
.context(ObjectMissingMetadataForOwnerRefSnafu)?
758-
.with_recommended_labels(build_recommended_labels(
758+
.with_recommended_labels(&build_recommended_labels(
759759
nifi,
760760
&resolved_product_image.app_version_label_value,
761761
&rolegroup.role,
@@ -843,7 +843,7 @@ async fn build_node_rolegroup_statefulset(
843843
resolved_product_image: &ResolvedProductImage,
844844
cluster_info: &KubernetesClusterInfo,
845845
rolegroup_ref: &RoleGroupRef<v1alpha1::NifiCluster>,
846-
role: &Role<NifiConfigFragment, NifiNodeRoleConfig, JavaCommonConfig>,
846+
role: &NifiRoleType,
847847
rolegroup_config: &HashMap<PropertyNameKind, BTreeMap<String, String>>,
848848
merged_config: &NifiConfig,
849849
authentication_config: &NifiAuthenticationConfig,
@@ -1303,7 +1303,7 @@ async fn build_node_rolegroup_statefulset(
13031303
.context(AddAuthVolumesSnafu)?;
13041304

13051305
let metadata = ObjectMetaBuilder::new()
1306-
.with_recommended_labels(build_recommended_labels(
1306+
.with_recommended_labels(&build_recommended_labels(
13071307
nifi,
13081308
&resolved_product_image.app_version_label_value,
13091309
&rolegroup_ref.role,
@@ -1422,7 +1422,7 @@ async fn build_node_rolegroup_statefulset(
14221422
.name(rolegroup_ref.object_name())
14231423
.ownerreference_from_resource(nifi, None, Some(true))
14241424
.context(ObjectMissingMetadataForOwnerRefSnafu)?
1425-
.with_recommended_labels(recommended_object_labels)
1425+
.with_recommended_labels(&recommended_object_labels)
14261426
.context(MetadataBuildSnafu)?
14271427
.with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned())
14281428
.build(),
@@ -1494,7 +1494,7 @@ fn get_volume_claim_templates(
14941494
];
14951495

14961496
// Used for PVC templates that cannot be modified once they are deployed
1497-
let unversioned_recommended_labels = Labels::recommended(build_recommended_labels(
1497+
let unversioned_recommended_labels = Labels::recommended(&build_recommended_labels(
14981498
nifi,
14991499
// A version value is required, and we do want to use the "recommended" format for the other desired labels
15001500
"none",

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

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use stackable_operator::{
2525
fragment::{self, Fragment, ValidationError},
2626
merge::Merge,
2727
},
28+
config_overrides::{KeyValueConfigOverrides, KeyValueOverridesProvider},
2829
crd::{authentication::core as auth_core, git_sync},
2930
deep_merger::ObjectOverrides,
3031
k8s_openapi::{
@@ -44,6 +45,8 @@ use stackable_operator::{
4445
};
4546
use tls::NifiTls;
4647

48+
use crate::config::{JVM_SECURITY_PROPERTIES_FILE, NIFI_BOOTSTRAP_CONF, NIFI_PROPERTIES};
49+
4750
pub const APP_NAME: &str = "nifi";
4851

4952
pub const HTTPS_PORT_NAME: &str = "https";
@@ -62,6 +65,9 @@ pub const MAX_NIFI_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity::from_mebi(10
6265

6366
const DEFAULT_NODE_GRACEFUL_SHUTDOWN_TIMEOUT: Duration = Duration::from_minutes_unchecked(5);
6467

68+
pub type NifiRoleType =
69+
Role<NifiConfigFragment, v1alpha1::NifiConfigOverrides, NifiNodeRoleConfig, JavaCommonConfig>;
70+
6571
#[derive(Snafu, Debug)]
6672
pub enum Error {
6773
#[snafu(display("the NiFi role [{role}] is missing from spec"))]
@@ -100,7 +106,7 @@ pub mod versioned {
100106

101107
// no doc - docs in Role struct.
102108
#[serde(default, skip_serializing_if = "Option::is_none")]
103-
pub nodes: Option<Role<NifiConfigFragment, NifiNodeRoleConfig, JavaCommonConfig>>,
109+
pub nodes: Option<NifiRoleType>,
104110

105111
// no doc - docs in ProductImage struct.
106112
pub image: ProductImage,
@@ -186,6 +192,39 @@ pub mod versioned {
186192
},
187193
Kubernetes {},
188194
}
195+
196+
#[derive(Clone, Debug, Default, Deserialize, JsonSchema, PartialEq, Serialize)]
197+
#[serde(rename_all = "camelCase")]
198+
pub struct NifiConfigOverrides {
199+
#[serde(rename = "bootstrap.conf")]
200+
pub bootstrap_conf: Option<KeyValueConfigOverrides>,
201+
202+
#[serde(rename = "nifi.properties")]
203+
pub nifi_properties: Option<KeyValueConfigOverrides>,
204+
205+
#[serde(rename = "security.properties")]
206+
pub security_properties: Option<KeyValueConfigOverrides>,
207+
}
208+
}
209+
210+
impl KeyValueOverridesProvider for v1alpha1::NifiConfigOverrides {
211+
fn get_key_value_overrides(&self, file: &str) -> BTreeMap<String, Option<String>> {
212+
let overrides = match file {
213+
NIFI_BOOTSTRAP_CONF => &self.bootstrap_conf,
214+
NIFI_PROPERTIES => &self.nifi_properties,
215+
JVM_SECURITY_PROPERTIES_FILE => &self.security_properties,
216+
_ => return BTreeMap::new(),
217+
};
218+
overrides
219+
.as_ref()
220+
.map(|o| {
221+
o.overrides
222+
.iter()
223+
.map(|(k, v)| (k.clone(), Some(v.clone())))
224+
.collect()
225+
})
226+
.unwrap_or_default()
227+
}
189228
}
190229

191230
impl HasStatusCondition for v1alpha1::NifiCluster {

0 commit comments

Comments
 (0)