Skip to content

Commit 9d69ac0

Browse files
authored
[puppet] Add option to set service CLI arg (#6286)
1 parent 74f2583 commit 9d69ac0

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

deployments/puppet/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Unreleased
44

5+
### 💡 Enhancements 💡
6+
7+
- Add support for the `collector_command_line_args` option to
8+
configure the command line arguments for the Splunk OpenTelemetry Collector
9+
service.
10+
511
## puppet-v0.18.0
612

713
- Breaking change: The default for the `auto_instrumentation_otlp_endpoint` option has been changed from

deployments/puppet/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ This class accepts the following parameters:
6868
| `splunk_memory_total_mib` | Total memory in MIB to allocate to the collector. The `SPLUNK_MEMORY_TOTAL_MIB` environment variable will be set with this value for the collector service. | `512` |
6969
|**DEPRECATED** `splunk_ballast_size_mib` | Set the ballast size for the collector explicitly instead of the value calculated from the `$splunk_memory_total_mib` parameter. This should be set to 1/3 to 1/2 of configured memory. The `SPLUNK_BALLAST_SIZE_MIB` environment variable will be set with this value for the collector service. Only applicable if `collector_version` is < 0.97.0. | None |
7070
| `splunk_listen_interface` | Set the network interface the collector receivers will listen on. | `0.0.0.0` |
71+
| `collector_command_line_args` | Command-line arguments to pass to the collector service. The `OTELCOL_OPTIONS` environment variable will be set with this value for the collector service. | None |
7172
| `collector_config_source` | Source path to the collector config YAML file. This file will be copied to the `$collector_config_dest` path on the node. See the [source attribute](https://puppet.com/docs/puppet/latest/types/file.html#file-attribute-source) of the `file` resource for supported value types. The default source file is provided by the collector package. | Linux: `/etc/otel/collector/agent_config.yaml`<br>Windows: `%PROGRAMFILES\Splunk\OpenTelemetry Collector\agent_config.yaml` |
7273
| `collector_config_dest` | Destination path of the collector config file on the node. The `SPLUNK_CONFIG` environment variable will be set with this value for the collector service. | Linux: `/etc/otel/collector/agent_config.yaml`<br>Windows: `%PROGRAMDATA%\Splunk\OpenTelemetry Collector\agent_config.yaml` |
7374
| `service_user` and `$service_group` | **Linux only**: Set the user/group ownership for the collector service. The user/group will be created if they do not exist. | `splunk-otel-collector` |

deployments/puppet/manifests/init.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
$splunk_collectd_dir = $splunk_otel_collector::params::splunk_collectd_dir,
1111
$splunk_memory_total_mib = '512',
1212
$splunk_listen_interface = '',
13+
$collector_command_line_args = '',
1314
$collector_version = $splunk_otel_collector::params::collector_version,
1415
$collector_config_source = $splunk_otel_collector::params::collector_config_source,
1516
$collector_config_dest = $splunk_otel_collector::params::collector_config_dest,

deployments/puppet/templates/splunk-otel-collector.conf.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ SPLUNK_REALM=<%= @splunk_realm %>
1414
<% unless @gomemlimit.to_s.strip.empty? -%>
1515
GOMEMLIMIT=<%= @gomemlimit %>
1616
<% end -%>
17+
<% unless @collector_command_line_args.to_s.strip.empty? -%>
18+
OTELCOL_OPTIONS=<%= @collector_command_line_args %>
19+
<% end -%>
1720

1821
# Custom environment variables.
1922
<% @collector_additional_env_vars.each do |key, value| %>

packaging/tests/deployments/puppet/puppet_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class {{ splunk_otel_collector:
188188
splunk_listen_interface => '0.0.0.0',
189189
collector_version => '$version',
190190
with_fluentd => true,
191+
collector_command_line_args => '--discovery',
191192
collector_additional_env_vars => {{ 'MY_CUSTOM_VAR1' => 'value1', 'MY_CUSTOM_VAR2' => 'value2' }},
192193
}}
193194
"""
@@ -219,6 +220,7 @@ def test_puppet_with_custom_vars(distro, puppet_release):
219220
verify_package_version(container, "splunk-otel-collector", "0.86.0")
220221
verify_env_file(container, api_url, ingest_url, "fake-hec-token")
221222
verify_config_file(container, SPLUNK_ENV_PATH, "SPLUNK_LISTEN_INTERFACE", "0.0.0.0")
223+
verify_config_file(container, SPLUNK_ENV_PATH, "OTELCOL_OPTIONS", "--discovery")
222224
verify_config_file(container, SPLUNK_ENV_PATH, "MY_CUSTOM_VAR1", "value1")
223225
verify_config_file(container, SPLUNK_ENV_PATH, "MY_CUSTOM_VAR2", "value2")
224226
assert wait_for(lambda: service_is_running(container))

0 commit comments

Comments
 (0)