Skip to content

Commit

Permalink
blackbox-exporter: respect .global.networkPolicy.enabled (#1999)
Browse files Browse the repository at this point in the history
* make new blackbox-exporter network policies respect global.networkPolicy.enabled

* update global network policy test cases

---------

Co-authored-by: Rob J. Caskey <rob.caskey@astronomer.io>
  • Loading branch information
pgvishnuram and rob-1126 committed Sep 20, 2023
1 parent 3814bd8 commit b4211cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Using this method it allows us to selectively include a policy
# or Not based on other variables. The templates with the actually policies
# start with "_" and are named bb-<service it is affecting>-policy.yaml

{{- if .Values.global.networkPolicy.enabled }}
{{- if .Values.astroServices.commander.enabled}}
---
{{- include "blackbox.commanderNetPol" .}}
Expand Down Expand Up @@ -42,3 +42,4 @@
# This one is unconditionally enabled because blackbox exporter is
# only useful when Prometheus is enabled.
{{- include "blackbox.prometheusPolicy" . }}
{{- end }}
3 changes: 2 additions & 1 deletion tests/chart_tests/test_global_network_policy_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
"charts/elasticsearch/templates/data/es-data-networkpolicy.yaml",
"charts/elasticsearch/templates/client/es-client-networkpolicy.yaml",
"templates/default-deny-network-policy/networkpolicy.yaml",
"charts/prometheus-blackbox-exporter/templates/blackbox-networkpolicy.yaml",
]


@pytest.mark.parametrize("np_enabled, num_of_docs", [(True, 24), (False, 0)])
@pytest.mark.parametrize("np_enabled, num_of_docs", [(True, 32), (False, 0)])
def test_render_global_network_policy(np_enabled, num_of_docs):
"""Test some things that should apply to all cases."""
docs = render_chart(
Expand Down

0 comments on commit b4211cd

Please sign in to comment.