Skip to content

Commit d226b7e

Browse files
Add logging support to git-sync containers
1 parent d50432e commit d226b7e

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

rust/operator-binary/src/controller.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ pub const NIFI_FULL_CONTROLLER_NAME: &str = concatcp!(NIFI_CONTROLLER_NAME, '.',
109109
pub const NIFI_UID: i64 = 1000;
110110

111111
const DOCKER_IMAGE_BASE_NAME: &str = "nifi";
112+
const LOG_VOLUME_NAME: &str = "log";
112113

113114
pub struct Ctx {
114115
pub client: Client,
@@ -509,6 +510,8 @@ pub async fn reconcile_nifi(
509510
&resolved_product_image,
510511
&env_vars_from_rolegroup_config(rolegroup_config),
511512
&[],
513+
LOG_VOLUME_NAME,
514+
&merged_config.logging.for_container(&Container::GitSync),
512515
)
513516
.context(InvalidGitSyncSpecSnafu)?;
514517

@@ -1052,7 +1055,7 @@ async fn build_node_rolegroup_statefulset(
10521055
.context(AddVolumeMountSnafu)?
10531056
.add_volume_mount("sensitiveproperty", "/stackable/sensitiveproperty")
10541057
.context(AddVolumeMountSnafu)?
1055-
.add_volume_mount("log", STACKABLE_LOG_DIR)
1058+
.add_volume_mount(LOG_VOLUME_NAME, STACKABLE_LOG_DIR)
10561059
.context(AddVolumeMountSnafu)?
10571060
.add_volume_mount(TRUSTSTORE_VOLUME_NAME, STACKABLE_SERVER_TLS_DIR)
10581061
.context(AddVolumeMountSnafu)?
@@ -1128,7 +1131,7 @@ async fn build_node_rolegroup_statefulset(
11281131
.context(AddVolumeMountSnafu)?
11291132
.add_volume_mount("log-config", STACKABLE_LOG_CONFIG_DIR)
11301133
.context(AddVolumeMountSnafu)?
1131-
.add_volume_mount("log", STACKABLE_LOG_DIR)
1134+
.add_volume_mount(LOG_VOLUME_NAME, STACKABLE_LOG_DIR)
11321135
.context(AddVolumeMountSnafu)?
11331136
.add_volume_mount(TRUSTSTORE_VOLUME_NAME, STACKABLE_SERVER_TLS_DIR)
11341137
.context(AddVolumeMountSnafu)?
@@ -1242,7 +1245,7 @@ async fn build_node_rolegroup_statefulset(
12421245
product_logging::framework::vector_container(
12431246
resolved_product_image,
12441247
"config",
1245-
"log",
1248+
LOG_VOLUME_NAME,
12461249
merged_config.logging.containers.get(&Container::Vector),
12471250
ResourceRequirementsBuilder::new()
12481251
.with_cpu_request("250m")
@@ -1308,7 +1311,7 @@ async fn build_node_rolegroup_statefulset(
13081311
})
13091312
.context(AddVolumeSnafu)?
13101313
.add_empty_dir_volume(
1311-
"log",
1314+
LOG_VOLUME_NAME,
13121315
// Set volume size to higher than theoretically necessary to avoid running out of disk space as log rotation triggers are only checked by Logback every 5s.
13131316
Some(
13141317
MemoryQuantity {
@@ -1409,7 +1412,7 @@ async fn build_node_rolegroup_statefulset(
14091412
),
14101413
..LabelSelector::default()
14111414
},
1412-
service_name: rolegroup_ref.object_name(),
1415+
service_name: Some(rolegroup_ref.object_name()),
14131416
template: pod_template,
14141417
update_strategy: Some(StatefulSetUpdateStrategy {
14151418
type_: if rolling_update_supported {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ pub enum Container {
473473
Prepare,
474474
Vector,
475475
Nifi,
476+
GitSync,
476477
}
477478

478479
#[derive(Clone, Debug, Default, Fragment, JsonSchema, PartialEq)]

tests/templates/kuttl/logging/04-install-nifi.yaml.j2

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ spec:
9696
- authenticationClass: simple-nifi-users
9797
sensitiveProperties:
9898
keySecret: nifi-sensitive-property-key
99+
customProcessorsGitSync:
100+
- repo: https://github.com/stackabletech/nifi-operator
101+
branch: feat/custom-processors # TODO Change to commit
102+
gitFolder: tests/templates/kuttl/custom-processors-git-sync/processors-0
99103
vectorAggregatorConfigMapName: nifi-vector-aggregator-discovery
100104
zookeeperConfigMapName: test-nifi-znode
101105
nodes:
@@ -116,6 +120,14 @@ spec:
116120
loggers:
117121
ROOT:
118122
level: INFO
123+
git-sync:
124+
console:
125+
level: INFO
126+
file:
127+
level: INFO
128+
loggers:
129+
ROOT:
130+
level: INFO
119131
vector:
120132
console:
121133
level: INFO

tests/templates/kuttl/logging/nifi-vector-aggregator-values.yaml.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ customConfig:
3030
condition: >-
3131
.pod == "test-nifi-node-automatic-log-config-0" &&
3232
.container == "nifi"
33+
filteredAutomaticLogConfigNodeGitSync:
34+
type: filter
35+
inputs: [validEvents]
36+
condition: >-
37+
.pod == "test-nifi-node-automatic-log-config-0" &&
38+
.container == "git-sync-0"
3339
filteredAutomaticLogConfigNodeVector:
3440
type: filter
3541
inputs: [validEvents]

tests/test-definition.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dimensions:
44
values:
55
- 1.27.0
66
- 1.28.1
7-
- 2.2.0
7+
- 2.2.0,oci.stackable.tech/sandbox/git-sync/nifi:2.2.0-stackable0.0.0-dev
88
# Alternatively, if you want to use a custom image, append a comma and the full image name to the product version
99
# as in the example below.
1010
# - 2.2.0,oci.stackable.tech/sandbox/nifi:2.2.0-stackable0.0.0-dev

0 commit comments

Comments
 (0)