Skip to content

Commit 700070c

Browse files
committed
add feature flag for enabling collection of proc files
Signed-off-by: Ermin Hrkalovic <[email protected]>
1 parent 238e493 commit 700070c

File tree

10 files changed

+27
-1
lines changed

10 files changed

+27
-1
lines changed

charts/core-dump-handler/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ The agent pod has the following environment variables and these are all set by t
177177
false (Default): The composer will generate the additional JSON files.
178178
179179
true: The composer will only collect the core dump and save the core parameters as an additional JSON
180+
* COMP_INCLUDE_PROC_INFO - Defines if the composer should get additional proc files from the container process. *Warning:* These files can contain sensitive information regarding the process, use with caution
181+
182+
false (Default): The composer will not collect any pid related files
183+
184+
true: The composer will copy 'auxv', 'cmdline', 'environ', 'maps' and 'status' for every container into the zip
180185
* COMP_CRIO_IMAGE_CMD - The command to use to get image information for the core dump.
181186
182187
"img" (Default): This is the value most crictls expect.
@@ -271,6 +276,7 @@ Image
271276
Composer
272277
* logLevel: The log level for the composer (Default "Warn")
273278
* ignoreCrio: Maps to the COMP_IGNORE_CRIO enviroment variable (Default false)
279+
* includeProcInfo: Maps to the COMP_INCLUDE_PROC_INFO enviroment variable (Default false)
274280
* crioImageCmd: Maps to the COMP_CRIO_IMAGE_CMD enviroment variable (Default "img")
275281
* timeout: Maps to the COMP_TIMEOUT environment variable ("Default 600)
276282
* compression: Maps to the COMP_COMPRESSION environment variable (Default "true")

charts/core-dump-handler/ci/inotify-manage-store.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ storageClass: hostclass
2121

2222
composer:
2323
ignoreCrio: false
24+
includeProcInfo: false
2425
crioImageCmd: "img"
2526
logLevel: "Warn"
2627
# Double curlies are required otherwise helm trys to parse the string

charts/core-dump-handler/ci/interval-manage-store.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ storageClass: hostclass
2121

2222
composer:
2323
ignoreCrio: false
24+
includeProcInfo: false
2425
crioImageCmd: "img"
2526
logLevel: "Warn"
2627
# Double curlies are required otherwise helm trys to parse the string

charts/core-dump-handler/ci/schedule-no-manage-store.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ storageClass: hostclass
2121

2222
composer:
2323
ignoreCrio: false
24+
includeProcInfo: false
2425
crioImageCmd: "img"
2526
logLevel: "Warn"
2627
# Double curlies are required otherwise helm trys to parse the string

charts/core-dump-handler/templates/daemonset.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ spec:
4444
value: {{ .Values.composer.logLevel }}
4545
- name: COMP_IGNORE_CRIO
4646
value: {{ .Values.composer.ignoreCrio | quote }}
47+
- name: COMP_INCLUDE_PROC_INFO
48+
value: {{ .Values.composer.includeProcInfo | quote }}
4749
- name: COMP_CRIO_IMAGE_CMD
4850
value: {{ .Values.composer.crioImageCmd }}
4951
- name: COMP_POD_SELECTOR_LABEL

charts/core-dump-handler/values.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110
"ignoreCrio": {
111111
"type": "boolean"
112112
},
113+
"includeProcInfo": {
114+
"type": "boolean"
115+
},
113116
"crioImageCmd": {
114117
"type": "string"
115118
},
@@ -130,6 +133,7 @@
130133
"required": [
131134
"crioImageCmd",
132135
"ignoreCrio",
136+
"includeProcInfo",
133137
"logLevel",
134138
"logLength",
135139
"filenameTemplate",

charts/core-dump-handler/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ storageClass: hostclass
2323

2424
composer:
2525
ignoreCrio: false
26+
includeProcInfo: false
2627
crioImageCmd: "img"
2728
logLevel: "Warn"
2829
filenameTemplate: "{uuid}-dump-{timestamp}-{hostname}-{exe_name}-{pid}-{signal}"

core-dump-agent/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ fn create_env_file(host_location: &str) -> Result<(), std::io::Error> {
466466
let ignore_crio = env::var("COMP_IGNORE_CRIO")
467467
.unwrap_or_else(|_| "false".to_string())
468468
.to_lowercase();
469+
let include_proc_info = env::var("COMP_INCLUDE_PROC_INFO")
470+
.unwrap_or_else(|_| "false".to_string())
471+
.to_lowercase();
469472
let crio_image = env::var("COMP_CRIO_IMAGE_CMD").unwrap_or_else(|_| "img".to_string());
470473
let destination = format!("{}/{}", host_location, ".env");
471474
let use_crio_config = env::var("DEPLOY_CRIO_CONFIG")
@@ -492,7 +495,7 @@ fn create_env_file(host_location: &str) -> Result<(), std::io::Error> {
492495
info!("Creating {} file with LOG_LEVEL={}", destination, loglevel);
493496
let mut env_file = File::create(destination)?;
494497
let text = format!(
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");
498+
"LOG_LEVEL={loglevel}\nIGNORE_CRIO={ignore_crio}\nINCLUDE_PROC_INFO={include_proc_info}\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");
496499
info!("Writing composer .env \n{}", text);
497500
env_file.write_all(text.as_bytes())?;
498501
env_file.flush()?;

core-dump-agent/tests/basic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ fn basic() -> Result<(), std::io::Error> {
8989
let env_content = fs::read_to_string(&env_file).unwrap();
9090
assert!(env_content.contains("LOG_LEVEL=debug"));
9191
assert!(env_content.contains("IGNORE_CRIO=false"));
92+
assert!(env_content.contains("INCLUDE_PROC_INFO=false"));
9293
assert!(env_content.contains("CRIO_IMAGE_CMD=img"));
9394
assert!(env_content.contains("USE_CRIO_CONF=false"));
9495
assert!(env_content.contains(

core-dump-composer/src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub struct CoreConfig {
2121
pub pod_selector_label: String,
2222
pub use_crio_config: bool,
2323
pub ignore_crio: bool,
24+
pub include_proc_info: bool,
2425
pub core_events: bool,
2526
pub timeout: u32,
2627
pub compression: bool,
@@ -98,6 +99,10 @@ impl CoreConfig {
9899
.to_lowercase()
99100
.parse::<bool>()
100101
.unwrap();
102+
let include_proc_info = env::var("INCLUDE_PROC_INFO")
103+
.unwrap_or_else(|_| "false".to_string().to_lowercase())
104+
.parse::<bool>()
105+
.unwrap();
101106
let log_length = env::var("LOG_LENGTH")
102107
.unwrap_or_else(|_| "500".to_string())
103108
.parse::<u32>()
@@ -145,6 +150,7 @@ impl CoreConfig {
145150
log_level,
146151
pod_selector_label,
147152
ignore_crio,
153+
include_proc_info,
148154
dot_env_path,
149155
image_command,
150156
use_crio_config,

0 commit comments

Comments
 (0)