Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tempo] Add Network Policy capability #2922

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7862f07
Added Network Policy for tempo
Sheikh-Abubaker Jan 21, 2024
5d91088
Updated README.md
Sheikh-Abubaker Jan 21, 2024
27d7a46
Updated README.md
Sheikh-Abubaker Jan 21, 2024
b39a68b
Updated README.md
Sheikh-Abubaker Jan 21, 2024
593209b
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Jan 22, 2024
813d4cf
Updated values.yaml
Sheikh-Abubaker Jan 22, 2024
389462d
Updated values.yaml
Sheikh-Abubaker Jan 22, 2024
ab4a11a
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Jan 24, 2024
ee5e4cb
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Feb 4, 2024
9009b0a
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Feb 7, 2024
30b2ca3
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Feb 16, 2024
3e50a89
Resolved conflicts
Sheikh-Abubaker Feb 17, 2024
566d824
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Feb 22, 2024
8f15ccc
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Feb 27, 2024
922e85b
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Mar 14, 2024
ad6b11b
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Mar 14, 2024
a15c86a
Merge branch 'main' into tempo-pr
zanhsieh Mar 31, 2024
31e32b9
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Apr 4, 2024
864b41b
Merge branch 'tempo-pr' of https://github.com/Sheikh-Abubaker/helm-ch…
Sheikh-Abubaker Apr 4, 2024
d8dd03a
Merge branch 'main' into tempo-pr
zanhsieh Apr 12, 2024
30ab33c
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker Apr 19, 2024
7d20bd9
Merge branch 'tempo-pr' of https://github.com/Sheikh-Abubaker/helm-ch…
Sheikh-Abubaker Apr 19, 2024
347f7b2
Merge branch 'main' into tempo-pr
zanhsieh Apr 25, 2024
e4ae24f
Merge branch 'main' of https://github.com/Sheikh-Abubaker/helm-charts…
Sheikh-Abubaker May 5, 2024
b107a90
Merge branch 'tempo-pr' of https://github.com/Sheikh-Abubaker/helm-ch…
Sheikh-Abubaker May 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/tempo/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: tempo
description: Grafana Tempo Single Binary Mode
type: application
version: 1.7.2
version: 1.8.0
appVersion: 2.3.1
engine: gotpl
home: https://grafana.net
Expand Down
12 changes: 11 additions & 1 deletion charts/tempo/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tempo

![Version: 1.7.2](https://img.shields.io/badge/Version-1.7.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.1](https://img.shields.io/badge/AppVersion-2.3.1-informational?style=flat-square)
![Version: 1.8.0](https://img.shields.io/badge/Version-1.8.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.1](https://img.shields.io/badge/AppVersion-2.3.1-informational?style=flat-square)

Grafana Tempo Single Binary Mode

Expand All @@ -18,7 +18,16 @@ Grafana Tempo Single Binary Mode
| extraLabels | object | `{}` | |
| extraVolumes | list | `[]` | Volumes to add |
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| labels | object | `{}` | labels for tempo |
| nameOverride | string | `""` | Overrides the chart's name |
| networkPolicy.allowExternal | bool | `true` | |
| networkPolicy.egress.blockDNSResolution | bool | `false` | |
| networkPolicy.egress.enabled | bool | `false` | |
| networkPolicy.egress.ports | list | `[]` | |
| networkPolicy.egress.to | list | `[]` | |
| networkPolicy.enabled | bool | `false` | |
| networkPolicy.explicitNamespacesSelector | object | `{}` | |
| networkPolicy.ingress | bool | `true` | |
| nodeSelector | object | `{}` | Node labels for pod assignment. See: https://kubernetes.io/docs/user-guide/node-selection/ |
| persistence.accessModes[0] | string | `"ReadWriteOnce"` | |
| persistence.enabled | bool | `false` | |
Expand All @@ -30,6 +39,7 @@ Grafana Tempo Single Binary Mode
| securityContext | object | `{}` | securityContext for container |
| service.annotations | object | `{}` | |
| service.labels | object | `{}` | |
| service.targetPort | string | `""` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | Annotations for the service account |
| serviceAccount.automountServiceAccountToken | bool | `true` | |
Expand Down
61 changes: 61 additions & 0 deletions charts/tempo/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.networkPolicy.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "tempo.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "tempo.labels" . | nindent 4 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
policyTypes:
{{- if .Values.networkPolicy.ingress }}
- Ingress
{{- end }}
{{- if .Values.networkPolicy.egress.enabled }}
- Egress
{{- end }}
podSelector:
matchLabels:
{{- include "tempo.selectorLabels" . | nindent 6 }}

{{- if .Values.networkPolicy.egress.enabled }}
egress:
{{- if not .Values.networkPolicy.egress.blockDNSResolution }}
- ports:
- port: 53
protocol: UDP
{{- end }}
- ports:
{{ .Values.networkPolicy.egress.ports | toJson }}
{{- with .Values.networkPolicy.egress.to }}
to:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.networkPolicy.ingress }}
ingress:
- ports:
- port: {{ .Values.service.targetPort }}
{{- if not .Values.networkPolicy.allowExternal }}
from:
- podSelector:
matchLabels:
{{ include "tempo.fullname" . }}-client: "true"
{{- with .Values.networkPolicy.explicitNamespacesSelector }}
- namespaceSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
- podSelector:
matchLabels:
{{- include "tempo.labels" . | nindent 14 }}
role: read
{{- end }}
{{- end }}
{{- end }}
59 changes: 59 additions & 0 deletions charts/tempo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ replicas: 1
# -- Number of old history to retain to allow rollback (If not set, default Kubernetes value is set to 10)
# revisionHistoryLimit: 1

# -- labels for tempo
labels: {}

# -- Annotations for the StatefulSet
annotations: {}

Expand Down Expand Up @@ -256,6 +259,7 @@ service:
type: ClusterIP
annotations: {}
labels: {}
targetPort: ""

serviceMonitor:
enabled: false
Expand Down Expand Up @@ -294,3 +298,58 @@ affinity: {}

# -- The name of the PriorityClass
priorityClassName: null

networkPolicy:
## @param networkPolicy.enabled Enable creation of NetworkPolicy resources. Only Ingress traffic is filtered for now.
##
enabled: false
## @param networkPolicy.allowExternal Don't require client label for connections
## The Policy model to apply. When set to false, only pods with the correct
## client label will have network access to tempo port defined.
## When true, tempo will accept connections from any source
## (with the correct destination port).
##
ingress: true
## @param networkPolicy.ingress When true enables the creation
## an ingress network policy
##
allowExternal: true
## @param networkPolicy.explicitNamespacesSelector A Kubernetes LabelSelector to explicitly select namespaces from which traffic could be allowed
## If explicitNamespacesSelector is missing or set to {}, only client Pods that are in the networkPolicy's namespace
## and that match other criteria, the ones that have the good label, can reach the tempo.
## But sometimes, we want the tempo to be accessible to clients from other namespaces, in this case, we can use this
## LabelSelector to select these namespaces, note that the networkPolicy's namespace should also be explicitly added.
##
## Example:
## explicitNamespacesSelector:
## matchLabels:
## role: frontend
## matchExpressions:
## - {key: role, operator: In, values: [frontend]}
##
explicitNamespacesSelector: {}
##
egress:
## @param networkPolicy.egress.enabled When enabled, an egress network policy will be
## created allowing tempo to connect to external data sources from kubernetes cluster.
enabled: false
##
## @param networkPolicy.egress.blockDNSResolution When enabled, DNS resolution will be blocked
## for all pods in the tempo namespace.
blockDNSResolution: false
##
## @param networkPolicy.egress.ports Add individual ports to be allowed by the egress
ports: []
## Add ports to the egress by specifying - port: <port number>
## E.X.
## - port: 80
## - port: 443
##
## @param networkPolicy.egress.to Allow egress traffic to specific destinations
to: []
## Add destinations to the egress by specifying - ipBlock: <CIDR>
## E.X.
## to:
## - namespaceSelector:
## matchExpressions:
## - {key: role, operator: In, values: [tempo]}