{{- /* Copyright (c) 2025 Firmansyah Nainggolan. All Rights Reserved. SPDX-License-Identifier: APACHE-2.0 */}} {{- if .Values.networkPolicy.enabled }} apiVersion: {{ include "st-common.capabilities.networkPolicy.apiVersion" . }} kind: NetworkPolicy metadata: name: {{ include "st-common.names.fullname" . }} namespace: {{ include "st-common.names.namespace" . | quote }} labels: {{- include "st-common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: freeradius {{- if .Values.commonLabels }} {{- include "st-common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }} {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "st-common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }} {{- end }} spec: podSelector: matchLabels: {{- include "st-common.labels.matchLabels" . | nindent 6 }} ingress: - ports: - port: {{ .Values.containerPorts.auth }} protocol: UDP - port: {{ .Values.containerPorts.acct }} protocol: UDP {{- if .Values.tls.enabled }} - port: {{ .Values.containerPorts.radsec }} protocol: TCP {{- end }} {{- if .Values.metrics.enabled }} - port: {{ .Values.containerPorts.metrics }} protocol: TCP {{- end }} {{- if .Values.sitesEnabled.coa.enabled }} - port: {{ .Values.containerPorts.coa }} protocol: UDP {{- end }} {{- if .Values.sitesEnabled.status.enabled }} - port: {{ .Values.containerPorts.status }} protocol: UDP {{- end }} {{- if not .Values.networkPolicy.allowExternal }} from: - podSelector: matchLabels: {{ include "st-common.names.fullname" . }}-client: "true" - podSelector: matchLabels: {{- include "st-common.labels.matchLabels" . | nindent 14 }} app.kubernetes.io/component: freeradius {{- if .Values.networkPolicy.additionalRules }} {{- include "st-common.tplvalues.render" (dict "value" .Values.networkPolicy.additionalRules "context" $) | nindent 8 }} {{- end }} {{- end }} {{- end }}