Skip to content
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: 3 additions & 2 deletions chart/templates/statsd/statsd-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ spec:
- name: statsd
image: {{ template "statsd_image" . }}
imagePullPolicy: {{ .Values.images.statsd.pullPolicy }}
args:
- "--statsd.mapping-config=/etc/statsd-exporter/mappings.yml"
{{- if .Values.statsd.args }}
args: {{ tpl (toYaml .Values.statsd.args) . | nindent 12 }}
{{- end }}
resources:
{{ toYaml .Values.statsd.resources | indent 12 }}
ports:
Expand Down
13 changes: 13 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4167,6 +4167,19 @@
"additionalProperties": {
"type": "string"
}
},
"args": {
"description": "Args to use when running statsd-exporter (templated).",
"type": [
"array",
"null"
],
"items": {
"type": "string"
},
"default": [
"--statsd.mapping-config=/etc/statsd-exporter/mappings.yml"
]
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,9 @@ statsd:
# Max number of old replicasets to retain
revisionHistoryLimit: ~

# Arguments for StatsD exporter command.
args: ["--statsd.mapping-config=/etc/statsd-exporter/mappings.yml"]

# Create ServiceAccount
serviceAccount:
# Specifies whether a ServiceAccount should be created
Expand Down
12 changes: 12 additions & 0 deletions tests/charts/test_statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def test_should_create_statsd_default(self):
"subPath": "mappings.yml",
} in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0])

default_args = ["--statsd.mapping-config=/etc/statsd-exporter/mappings.yml"]
assert default_args == jmespath.search("spec.template.spec.containers[0].args", docs[0])

def test_should_add_volume_and_volume_mount_when_exist_extra_mappings(self):
extra_mapping = {
"match": "airflow.pool.queued_slots.*",
Expand Down Expand Up @@ -210,3 +213,12 @@ def test_statsd_configmap_when_exist_override_mappings(self):

assert 1 == len(mappings_yml_obj["mappings"])
assert "airflow_pool_queued_slots" == mappings_yml_obj["mappings"][0]["name"]

def test_statsd_args_can_be_overridden(self):
args = ["--some-arg=foo"]
docs = render_chart(
values={"statsd": {"enabled": True, "args": args}},
show_only=["templates/statsd/statsd-deployment.yaml"],
)

assert jmespath.search("spec.template.spec.containers[0].args", docs[0]) == args