Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configurable crictl endpoint #97

Merged
merged 2 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions charts/core-dump-handler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ The agent pod has the following environment variables and these are all set by t
"img" (Default): This is the value most crictls expect.
"images": Digital Ocean, Newer OpenShift require this value

* CRIO_ENDPOINT - The CRIO endpoint to use.

"unix:///run/containerd/containerd.sock" (Default): This is the default for most containerd nodes
"unix:///var/run/dockershim.sock": Should match most nodes that still use dockershim

* COMP_FILENAME_TEMPLATE - Defines the template that generates the filename using [tinytemplate](https://crates.io/crates/tinytemplate#quickstart) and the [params object](https://github.com/IBM/core-dump-handler/blob/main/core-dump-composer/src/config.rs#L29)

* DEPLOY_CRIO_CONFIG - Defines whether the agent should deploy a crictl config to the host
Expand Down
1 change: 1 addition & 0 deletions charts/core-dump-handler/ci/inotify-manage-store.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ daemonset:
label: "core-dump-ds"
hostDirectory: "/var/mnt/core-dump-handler"
coreDirectory: "/var/mnt/core-dump-handler/cores"
crioEndpoint: "unix:///run/containerd/containerd.sock"
suidDumpable: 2
vendor: default
# interval: 60000
Expand Down
1 change: 1 addition & 0 deletions charts/core-dump-handler/ci/interval-manage-store.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ daemonset:
label: "core-dump-ds"
hostDirectory: "/var/mnt/core-dump-handler"
coreDirectory: "/var/mnt/core-dump-handler/cores"
crioEndpoint: "unix:///run/containerd/containerd.sock"
suidDumpable: 2
vendor: default
interval: 60000
Expand Down
1 change: 1 addition & 0 deletions charts/core-dump-handler/ci/schedule-no-manage-store.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ daemonset:
label: "core-dump-ds"
hostDirectory: "/var/mnt/core-dump-handler"
coreDirectory: "/var/mnt/core-dump-handler/cores"
crioEndpoint: "unix:///run/containerd/containerd.sock"
suidDumpable: 2
vendor: default
schedule: "1/60 * * * * *"
Expand Down
1 change: 1 addition & 0 deletions charts/core-dump-handler/ci/tolerations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ daemonset:
label: "core-dump-ds"
hostDirectory: "/var/mnt/core-dump-handler"
coreDirectory: "/var/mnt/core-dump-handler/cores"
crioEndpoint: "unix:///run/containerd/containerd.sock"
suidDumpable: 2
vendor: default
# interval: 60000
Expand Down
2 changes: 2 additions & 0 deletions charts/core-dump-handler/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ spec:
value: {{ .Values.composer.crioImageCmd }}
- name: DEPLOY_CRIO_CONFIG
value: {{ .Values.daemonset.deployCrioConfig | quote }}
- name: CRIO_ENDPOINT
value: {{ .Values.daemonset.crioEndpoint | quote }}
- name: HOST_DIR
value: {{ .Values.daemonset.hostDirectory }}
- name: CORE_DIR
Expand Down
3 changes: 3 additions & 0 deletions charts/core-dump-handler/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@
"deployCrioConfig": {
"type": "boolean"
},
"crioEndpoint": {
"type": "string"
},
"includeCrioExe": {
"type": "boolean"
},
Expand Down
1 change: 1 addition & 0 deletions charts/core-dump-handler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ daemonset:
label: "core-dump-ds"
hostDirectory: "/var/mnt/core-dump-handler"
coreDirectory: "/var/mnt/core-dump-handler/cores"
crioEndpoint: "unix:///run/containerd/containerd.sock"
suidDumpable: 2
vendor: default
# interval: 60000
Expand Down
4 changes: 3 additions & 1 deletion core-dump-agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,11 @@ async fn run_polling_agent(core_location: &str) {

fn generate_crio_config(host_location: &str) -> Result<(), std::io::Error> {
info!("Generating crio file");
let endpoint = env::var("CRIO_ENDPOINT")
.unwrap_or_else(|_| "unix:///run/containerd/containerd.sock".to_string());
let destination = format!("{}/{}", host_location, "crictl.yaml");
let mut crictl_file = File::create(destination)?;
let text = "runtime-endpoint: unix:///run/containerd/containerd.sock\nimage-endpoint: unix:///run/containerd/containerd.sock\ntimeout: 2\ndebug: false\npull-image-on-create: false";
let text = format!("runtime-endpoint: {}\nimage-endpoint: {}\ntimeout: 2\ndebug: false\npull-image-on-create: false", endpoint, endpoint);
crictl_file.write_all(text.as_bytes())?;
crictl_file.flush()?;
Ok(())
Expand Down