Skip to content

Commit 5ef6c8e

Browse files
authored
Merge pull request #132 from IBM/pre-8.10.0
Pre 8.10.0 Release
2 parents 1e43fef + 23a88d3 commit 5ef6c8e

File tree

8 files changed

+75
-97
lines changed

8 files changed

+75
-97
lines changed

Cargo.lock

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

FAQ.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
## How should I integrate my own uploader?
2020

21+
**This custom upload scenario is being replaced by the event pattern implemented in v8.9.0.**
22+
**More documentation will follow as a client is implemented**
23+
2124
The core dump handler is designed to quickly move the cores *"off-box"* to an object storage environment with as much additional runtime information as possible.
2225
In order to provide the following benefits:
2326

@@ -27,7 +30,7 @@ In order to provide the following benefits:
2730

2831
- As Object Storage APIs have migrated to S3 as a defacto standard post processing services for scrubbers and indexing the data are easier to implement.
2932

30-
It's strongly recommened that you maintain the upload pattern of moving the cores off the machine but you may wish to move them to a none S3 compabible host.
33+
It's strongly recommended that you maintain the upload pattern of moving the cores off the machine but you may wish to move them to a none S3 compabible host.
3134

3235
This scenario is possible but the following aspects need consideration:
3336

charts/core-dump-handler/Chart.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ sources:
1010

1111
type: application
1212

13-
version: v8.9.0
13+
version: v8.10.0
1414

15-
appVersion: "v8.9.0"
15+
appVersion: "v8.10.0"
1616

1717
icon: https://raw.githubusercontent.com/No9/core-dump-handler/master/assets/handle-with-care-svgrepo-com.svg
1818

@@ -29,21 +29,26 @@ maintainers:
2929

3030
annotations:
3131
artifacthub.io/changes: |
32-
- kind: added
33-
description: Experimental event file creation
32+
- kind: fixed
33+
description: Fix event sourcing setup in chart templates
3434
links:
3535
- name: GitHub PR
36-
url: https://github.com/IBM/core-dump-handler/pull/122
36+
url: https://github.com/IBM/core-dump-handler/pull/127
3737
- kind: fixed
38-
description: Scheduler crashing due to updated depenendency
38+
description: Downgrade to 0.31.0
3939
links:
4040
- name: GitHub Issue
41-
url: https://github.com/IBM/core-dump-handler/issues/120
41+
url: https://github.com/IBM/core-dump-handler/issues/126
42+
- name: GitHub PR
43+
url: https://github.com/IBM/core-dump-handler/pull/128
44+
- kind: fixed
45+
description: Handle pullSecrets inside daemonset.yaml
46+
links:
4247
- name: GitHub PR
43-
url: https://github.com/IBM/core-dump-handler/pull/121
48+
url: https://github.com/IBM/core-dump-handler/pull/130
4449
artifacthub.io/images: |
4550
- name: core-dump-handler
46-
image: quay.io/icdh/core-dump-handler:v8.9.0
51+
image: quay.io/icdh/core-dump-handler:v8.10.0
4752
artifacthub.io/license: MIT
4853
artifacthub.io/signKey: |
4954
fingerprint: BED079E67FD431E45301B1C9949E671B46AC8A34

charts/core-dump-handler/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ replicaCount: 1
33
image:
44
registry: quay.io
55
repository: icdh/core-dump-handler
6-
tag: agent-s3-down
6+
tag: v8.10.0
77
pullPolicy: Always
88
pullSecrets: []
99
request_mem: "64Mi"

core-dump-agent/src/main.rs

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,20 @@ async fn main() -> Result<(), anyhow::Error> {
114114
copy_core_dump_composer_to_hostdir(host_location)?;
115115
apply_sysctl(
116116
"kernel.core_pattern",
117-
format!("{}/core_pattern.bak", host_location).as_str(),
117+
format!("{host_location}/core_pattern.bak").as_str(),
118118
format!(
119-
"|{}/{} -c=%c -e=%e -p=%p -s=%s -t=%t -d={} -h=%h -E=%E",
120-
host_location, CDC_NAME, core_dir_command
121-
)
119+
"|{host_location}/{CDC_NAME} -c=%c -e=%e -p=%p -s=%s -t=%t -d={core_dir_command} -h=%h -E=%E")
122120
.as_str(),
123121
)?;
124122
apply_sysctl(
125123
"kernel.core_pipe_limit",
126-
format!("{}/core_pipe_limit.bak", host_location).as_str(),
124+
format!("{host_location}/core_pipe_limit.bak").as_str(),
127125
"128",
128126
)?;
129127

130128
apply_sysctl(
131129
"fs.suid_dumpable",
132-
format!("{}/suid_dumpable.bak", host_location).as_str(),
130+
format!("{host_location}/suid_dumpable.bak").as_str(),
133131
&suid,
134132
)?;
135133

@@ -165,12 +163,12 @@ async fn main() -> Result<(), anyhow::Error> {
165163
let mut i_interval = match interval.parse::<u64>() {
166164
Ok(v) => v,
167165
Err(e) => {
168-
error!("Error parsing interval : {} Error: {}", interval, e);
169-
panic!("Error parsing interval {}", e);
166+
error!("Error parsing interval : {interval} Error: {e}");
167+
panic!("Error parsing interval {e}");
170168
}
171169
};
172170
i_interval /= 1000;
173-
schedule = format!("1/{} * * * * *", i_interval);
171+
schedule = format!("1/{i_interval} * * * * *");
174172
if use_inotify == "true" {
175173
warn!("Both schedule and INotify set. Running schedule")
176174
}
@@ -181,8 +179,8 @@ async fn main() -> Result<(), anyhow::Error> {
181179
let sched = match JobScheduler::new().await {
182180
Ok(v) => v,
183181
Err(e) => {
184-
error!("Schedule Creation Failed with {}", e);
185-
panic!("Schedule Creation Failed with {}", e)
182+
error!("Schedule Creation Failed with {e}");
183+
panic!("Schedule Creation Failed with {e}")
186184
}
187185
};
188186

@@ -200,23 +198,23 @@ async fn main() -> Result<(), anyhow::Error> {
200198
}) {
201199
Ok(v) => v,
202200
Err(e) => {
203-
error!("Schedule Job Creation with {} failed, {}", schedule, e);
204-
panic!("Schedule Job Creation with {} failed, {}", schedule, e)
201+
error!("Schedule Job Creation with {schedule} failed, {e}");
202+
panic!("Schedule Job Creation with {schedule} failed, {e}")
205203
}
206204
};
207205
info!("Created Schedule job: {:?}", s_job.guid());
208206
match sched.add(s_job).await {
209207
Ok(v) => v,
210208
Err(e) => {
211-
error!("Job Add failed {:#?}", e);
212-
panic!("Job Scheduing failed, {:#?}", e);
209+
error!("Job Add failed {e:#?}");
210+
panic!("Job Scheduing failed, {e:#?}");
213211
}
214212
};
215213
match sched.start().await {
216214
Ok(v) => v,
217215
Err(e) => {
218-
error!("Schedule Start failed {:#?}", e);
219-
panic!("Schedule Start failed, {:#?}", e);
216+
error!("Schedule Start failed {e:#?}");
217+
panic!("Schedule Start failed, {e:#?}");
220218
}
221219
};
222220
loop {
@@ -230,16 +228,16 @@ async fn main() -> Result<(), anyhow::Error> {
230228
let mut inotify = match Inotify::init() {
231229
Ok(v) => v,
232230
Err(e) => {
233-
error!("Inotify init failed: {}", e);
234-
panic!("Inotify init failed: {}", e)
231+
error!("Inotify init failed: {e}");
232+
panic!("Inotify init failed: {e}")
235233
}
236234
};
237235
info!("INotify Initialised...");
238236
match inotify.add_watch(&core_dir_command, WatchMask::CLOSE) {
239237
Ok(_) => {}
240238
Err(e) => {
241-
error!("Add watch failed: {}", e);
242-
panic!("Add watch failed: {}", e)
239+
error!("Add watch failed: {e}");
240+
panic!("Add watch failed: {e}")
243241
}
244242
};
245243
info!("INotify watching : {}", core_dir_command);
@@ -426,7 +424,7 @@ fn generate_crio_config(host_location: &str) -> Result<(), std::io::Error> {
426424
.unwrap_or_else(|_| "unix:///run/containerd/containerd.sock".to_string());
427425
let destination = format!("{}/{}", host_location, "crictl.yaml");
428426
let mut crictl_file = File::create(destination)?;
429-
let text = format!("runtime-endpoint: {}\nimage-endpoint: {}\ntimeout: 2\ndebug: false\npull-image-on-create: false", endpoint, endpoint);
427+
let text = format!("runtime-endpoint: {endpoint}\nimage-endpoint: {endpoint}\ntimeout: 2\ndebug: false\npull-image-on-create: false");
430428
crictl_file.write_all(text.as_bytes())?;
431429
crictl_file.flush()?;
432430
Ok(())
@@ -444,14 +442,14 @@ fn copy_core_dump_composer_to_hostdir(host_location: &str) -> Result<(), std::io
444442
let version = env::var("VENDOR").unwrap_or_else(|_| "default".to_string());
445443
match version.to_lowercase().as_str() {
446444
"default" => {
447-
let location = format!("./vendor/default/{}", CDC_NAME);
448-
let destination = format!("{}/{}", host_location, CDC_NAME);
445+
let location = format!("./vendor/default/{CDC_NAME}");
446+
let destination = format!("{host_location}/{CDC_NAME}");
449447
info!("Copying the composer from {} to {}", location, destination);
450448
fs::copy(location, destination)?;
451449
}
452450
"rhel7" => {
453-
let location = format!("./vendor/rhel7/{}", CDC_NAME);
454-
let destination = format!("{}/{}", host_location, CDC_NAME);
451+
let location = format!("./vendor/rhel7/{CDC_NAME}");
452+
let destination = format!("{host_location}/{CDC_NAME}");
455453
info!("Copying the composer from {} to {}", location, destination);
456454
fs::copy(location, destination)?;
457455
}
@@ -494,9 +492,7 @@ fn create_env_file(host_location: &str) -> Result<(), std::io::Error> {
494492
info!("Creating {} file with LOG_LEVEL={}", destination, loglevel);
495493
let mut env_file = File::create(destination)?;
496494
let text = format!(
497-
"LOG_LEVEL={}\nIGNORE_CRIO={}\nCRIO_IMAGE_CMD={}\nUSE_CRIO_CONF={}\nFILENAME_TEMPLATE={}\nLOG_LENGTH={}\nPOD_SELECTOR_LABEL={}\nTIMEOUT={}\nCOMPRESSION={}\nCORE_EVENTS={}\nEVENT_DIRECTORY={}\n",
498-
loglevel, ignore_crio, crio_image, use_crio_config, filename_template, log_length, pod_selector_label, timeout, compression, core_events, event_directory
499-
);
495+
"LOG_LEVEL={loglevel}\nIGNORE_CRIO={ignore_crio}\nCRIO_IMAGE_CMD={crio_image}\nUSE_CRIO_CONF={use_crio_config}\nFILENAME_TEMPLATE={filename_template}\nLOG_LENGTH={log_length}\nPOD_SELECTOR_LABEL={pod_selector_label}\nTIMEOUT={timeout}\nCOMPRESSION={compression}\nCORE_EVENTS={core_events}\nEVENT_DIRECTORY={event_directory}\n");
500496
info!("Writing composer .env \n{}", text);
501497
env_file.write_all(text.as_bytes())?;
502498
env_file.flush()?;
@@ -537,7 +533,7 @@ fn apply_sysctl(name: &str, location: &str, value: &str) -> Result<(), anyhow::E
537533
}
538534

539535
fn overwrite_sysctl(name: &str, value: &str) -> Result<(), anyhow::Error> {
540-
let s = format!("{}={}", name, value);
536+
let s = format!("{name}={value}");
541537
let output = Command::new("sysctl")
542538
.env("PATH", get_path())
543539
.args(["-w", s.as_str()])
@@ -557,11 +553,11 @@ fn remove() -> Result<(), anyhow::Error> {
557553
restore_sysctl("kernel", "core_pipe_limit")?;
558554
restore_sysctl("fs", "suid_dumpable")?;
559555
let host_dir = env::var("HOST_DIR").unwrap_or_else(|_| DEFAULT_BASE_DIR.to_string());
560-
let exe = format!("{}/{}", host_dir, CDC_NAME);
561-
let env_file = format!("{}/{}", host_dir, ".env");
562-
let crictl_file = format!("{}/{}", host_dir, "crictl.yaml");
563-
let composer_file = format!("{}/{}", host_dir, "composer.log");
564-
let crictl_exe = format!("{}/{}", host_dir, "crictl");
556+
let exe = format!("{host_dir}/{CDC_NAME}");
557+
let env_file = format!("{host_dir}/.env");
558+
let crictl_file = format!("{host_dir}/crictl.yaml");
559+
let composer_file = format!("{host_dir}/composer.log");
560+
let crictl_exe = format!("{host_dir}/crictl");
565561

566562
fs::remove_file(exe)?;
567563
fs::remove_file(env_file)?;
@@ -581,8 +577,8 @@ fn remove() -> Result<(), anyhow::Error> {
581577
fn restore_sysctl(prefix: &str, name: &str) -> Result<(), anyhow::Error> {
582578
info!("Restoring Backup of {}", name);
583579
let host_dir = env::var("HOST_DIR").unwrap_or_else(|_| DEFAULT_BASE_DIR.to_string());
584-
let file_name = format!("{}/{}.bak", host_dir, name);
585-
let sysctl_name = format!("{}.{}", prefix, name);
580+
let file_name = format!("{host_dir}/{name}.bak");
581+
let sysctl_name = format!("{prefix}.{name}");
586582
let line = fs::read_to_string(&file_name)?;
587583
overwrite_sysctl(sysctl_name.as_str(), line.as_str())?;
588584
fs::remove_file(file_name)?;

0 commit comments

Comments
 (0)