Files
devops-infra-helm-charts-gcp/helm-templates/opentelemetry-collector-latest/templates/networkpolicy.yaml
T
2026-08-26 03:39:42 +05:30

40 lines
1.3 KiB
YAML

{{- if .Values.networkPolicy.enabled }}
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: {{ include "opentelemetry-collector.fullname" . }}
namespace: {{ template "opentelemetry-collector.namespace" . }}
labels:
{{- include "opentelemetry-collector.labels" . | nindent 4 }}
{{- if .Values.networkPolicy.annotations }}
annotations:
{{- range $key, $value := .Values.networkPolicy.annotations }}
{{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
{{- end }}
{{- end }}
spec:
podSelector:
matchLabels:
{{- include "opentelemetry-collector.selectorLabels" . | nindent 6 }}
{{- include "opentelemetry-collector.component" . | nindent 6 }}
ingress:
- ports:
{{- range $port := .Values.ports }}
{{- if $port.enabled }}
- port: {{ $port.containerPort }}
protocol: {{ $port.protocol }}
{{- end }}
{{- end }}
{{- if .Values.networkPolicy.allowIngressFrom }}
from:
{{- toYaml .Values.networkPolicy.allowIngressFrom | nindent 8 }}
{{- end }}
{{- if .Values.networkPolicy.extraIngressRules }}
{{- toYaml .Values.networkPolicy.extraIngressRules | nindent 4 }}
{{- end }}
{{- if .Values.networkPolicy.egressRules }}
egress:
{{- toYaml .Values.networkPolicy.egressRules | nindent 4 }}
{{- end }}
{{- end }}