Skip to content

Commit

Permalink
Helm: fix egress-dicovery netpols (grafana#11838)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:

This PR fix an issue happening when deploying the `egress-discovery`
networkPolicy or ciliumNetworkPolicy. When one wants to deploy the
`egress-discovery` netpol, one only has to specify the
`networkPolicy.discovery.port` field in the values. However, with the
current state of the templates, when this field is specified, **both**
the networkPolicy and the ciliumNetworkPolicy are generated since the
only condition for their creation is `if
.Values.networkPolicy.discovery.port`.

I thus added an additional condition : `eq .Values.networkPolicy.flavor
"cilium"` (or `"kubernetes"` for the networkPolicy) so that only one of
these is generated according to the `flavor` specified in the values.

**Special notes for your reviewer**:

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [ ] Documentation added
- [ ] Tests updated
- [x] `CHANGELOG.md` updated
- [ ] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/setup/upgrade/_index.md`
- [x] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](grafana@d10549e)
- [ ] If the change is deprecating or removing a configuration option,
update the `deprecated-config.yaml` and `deleted-config.yaml` files
respectively in the `tools/deprecated-config-checker` directory.
[Example
PR](grafana@0d4416a)

---------

Signed-off-by: QuantumEnigmaa <[email protected]>
Co-authored-by: Michel Hollands <[email protected]>
  • Loading branch information
2 people authored and rhnasc committed Apr 12, 2024
1 parent 01787bd commit ead5963
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Entries should include a reference to the pull request that introduced the chang

## 5.42.2

- [BUGFIX] Added condition for `egress-discovery` networkPolicies and ciliumNetworkPolicies.
- [BUGFIX] Remove trailing tab character in statefulset templates

## 5.42.1
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/templates/ciliumnetworkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ spec:

{{- end }}

{{- if .Values.networkPolicy.discovery.port }}
{{- if and .Values.networkPolicy.discovery.port (eq .Values.networkPolicy.flavor "cilium") }}
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ spec:

{{- end }}

{{- if .Values.networkPolicy.discovery.port }}
{{- if and .Values.networkPolicy.discovery.port (eq .Values.networkPolicy.flavor "kubernetes") }}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
Expand Down

0 comments on commit ead5963

Please sign in to comment.