Skip to content
Closed
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
10 changes: 7 additions & 3 deletions chart/templates/configmaps/statsd-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
Comment on lines +32 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this?

Suggested change
{{- with .Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}

{{- with .Values.statsd.configMapAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
Comment on lines +35 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add indent

Suggested change
{{- with .Values.statsd.configMapAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.statsd.configMapAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}

data:
mappings.yml: |-
{{- if .Values.statsd.overrideMappings }}
Expand Down
10 changes: 7 additions & 3 deletions chart/templates/configmaps/webserver-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ metadata:
release: {{ .Release.Name }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
Comment on lines +32 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here:

Suggested change
{{- with .Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }

{{- with .Values.webserver.configMapAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
Comment on lines +35 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add indent

Suggested change
{{- with .Values.webserver.configMapAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.webserver.configMapAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}

data:
webserver_config.py: |-
{{- tpl .Values.webserver.webserverConfig . | nindent 4 }}
Expand Down
16 changes: 16 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3509,6 +3509,14 @@
"my-webserver-configmap"
]
},
"configMapAnnotations": {
"description": "Annotations to add to the webserver configmap",
"type": "object",
"default": {},
"additionalProperties": {
"type": "string"
}
},
"service": {
"description": "Webserver Service configuration.",
"type": "object",
Expand Down Expand Up @@ -4253,6 +4261,14 @@
"type": "string"
}
},
"configMapAnnotations": {
"description": "Annotations to add to the StatsD configmap.",
"type": "object",
"default": {},
"additionalProperties": {
"type": "string"
}
},
"annotations": {
"description": "Annotations to add to the StatsD deployment.",
"type": "object",
Expand Down
4 changes: 4 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,8 @@ webserver:
# CSRF_ENABLED = True
webserverConfigConfigMapName: ~

configMapAnnotations: {}

service:
type: ClusterIP
## service annotations
Expand Down Expand Up @@ -1524,6 +1526,8 @@ statsd:

podAnnotations: {}

configMapAnnotations: {}

# PgBouncer settings
pgbouncer:
# Enable PgBouncer
Expand Down
11 changes: 11 additions & 0 deletions tests/charts/test_statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@ def test_statsd_args_can_be_overridden(self):

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

def test_should_add_statsd_configmap_annotations(self):
docs = render_chart(
values={
"statsd": {"configMapAnnotations": {"test_annotation": "test_annotation_value"}},
},
show_only=["templates/configmaps/statsd-configmap.yaml"],
)

assert "annotations" in jmespath.search("metadata", docs[0])
assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value"

def test_should_add_component_specific_annotations(self):
docs = render_chart(
values={
Expand Down
14 changes: 14 additions & 0 deletions tests/charts/test_webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,20 @@ def test_webserver_config_configmap(self):
== jmespath.search('data."webserver_config.py"', docs[0]).strip()
)

def test_webserver_configmap_annotation(self):
docs = render_chart(
values={
"webserver": {
"webserverConfig": "CSRF_ENABLED = True # {{ .Release.Name }}",
"configMapAnnotations": {"test_annotation": "test_annotation_value"},
},
},
show_only=["templates/configmaps/webserver-configmap.yaml"],
)

assert "annotations" in jmespath.search("metadata", docs[0])
assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value"


class TestWebserverNetworkPolicy:
def test_off_by_default(self):
Expand Down