From be12164290ef6aa428623c74b0d5f899086fabd1 Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot Date: Wed, 4 Mar 2020 14:46:38 -0800 Subject: [PATCH] Add option and defaults to configure metrics exporting in containerd (#5466) * Add metrics exporting in containerd config * Add containerd.yml with containerd configuration example to the sample group_vars --- inventory/sample/group_vars/all/containerd.yml | 15 +++++++++++++++ .../containerd/templates/config.toml.j2 | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 inventory/sample/group_vars/all/containerd.yml diff --git a/inventory/sample/group_vars/all/containerd.yml b/inventory/sample/group_vars/all/containerd.yml new file mode 100644 index 000000000..2fc66b636 --- /dev/null +++ b/inventory/sample/group_vars/all/containerd.yml @@ -0,0 +1,15 @@ +--- +# Please see roles/container-engine/containerd/defaults/main.yml for more configuration options + +# containerd_config: +# grpc: +# max_recv_message_size: 16777216 +# max_send_message_size: 16777216 +# debug: +# level: "" +# registries: +# "docker.io": "https://registry-1.docker.io" +# max_container_log_line_size: -1 +# metrics: +# address: "" +# grpc_histogram: false diff --git a/roles/container-engine/containerd/templates/config.toml.j2 b/roles/container-engine/containerd/templates/config.toml.j2 index 142b21fa5..78aad1287 100644 --- a/roles/container-engine/containerd/templates/config.toml.j2 +++ b/roles/container-engine/containerd/templates/config.toml.j2 @@ -44,3 +44,9 @@ disabled_plugins = ["restart"] endpoint = ["{{ addr }}"] {% endfor %} {% endif %} + +{% if 'metrics' in containerd_config %} +[metrics] + address = "{{ containerd_config.metrics.address | default('') }}" + grpc_histogram = {{ containerd_config.metrics.grpc_histogram | default(false) | lower }} +{% endif %}