{{- /* Copyright (c) 2025 Firmansyah Nainggolan. All Rights Reserved. SPDX-License-Identifier: APACHE-2.0 */}} apiVersion: v1 kind: Service 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 or .Values.service.annotations .Values.commonAnnotations .Values.metrics.annotations }} annotations: {{- if .Values.commonAnnotations }} {{- include "st-common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }} {{- end }} {{- if .Values.service.annotations }} {{- include "st-common.tplvalues.render" (dict "value" .Values.service.annotations "context" $) | nindent 4 }} {{- end }} {{- if and .Values.metrics.enabled .Values.metrics.annotations }} {{- include "st-common.tplvalues.render" (dict "value" .Values.metrics.annotations "context" $) | nindent 4 }} {{- end }} {{- end }} spec: type: {{ default "ClusterIP" .Values.service.type }} {{- if eq .Values.service.type "LoadBalancer" }} allocateLoadBalancerNodePorts: {{ eq .Values.service.allocateLoadBalancerNodePorts "true" }} {{- end }} {{- if and .Values.service.clusterIP (eq .Values.service.type "ClusterIP") }} clusterIP: {{ .Values.service.clusterIP }} {{- end }} {{- if and .Values.service.externalTrafficPolicy (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} {{- end }} ipFamilyPolicy: {{ .Values.service.ipFamilyPolicy }} {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerClass)) }} loadBalancerClass: {{ .Values.service.loadBalancerClass }} {{- end }} {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} loadBalancerIP: {{ .Values.service.loadBalancerIP }} {{- end }} {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }} loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }} {{- end }} {{- if .Values.service.sessionAffinity }} sessionAffinity: {{ .Values.service.sessionAffinity }} {{- end }} {{- if .Values.service.sessionAffinityConfig }} sessionAffinityConfig: {{- include "st-common.tplvalues.render" (dict "value" .Values.service.sessionAffinityConfig "context" $) | nindent 4 }} {{- end }} ports: - name: udp-auth port: {{ .Values.service.ports.auth }} protocol: UDP targetPort: {{ .Values.containerPorts.auth }} {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) .Values.service.nodePorts.auth) }} nodePort: {{ coalesce .Values.service.nodePorts.auth .Values.service.nodePort }} {{- else if eq .Values.service.type "ClusterIP" }} nodePort: null {{- end }} - name: udp-acct port: {{ .Values.service.ports.acct }} protocol: UDP targetPort: {{ .Values.containerPorts.acct }} {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) .Values.service.nodePorts.acct) }} nodePort: {{ .Values.service.nodePorts.acct }} {{- else if eq .Values.service.type "ClusterIP" }} nodePort: null {{- end }} {{- if .Values.sitesEnabled.coa.enabled }} - name: udp-coa port: {{ .Values.service.ports.coa }} protocol: UDP targetPort: {{ .Values.containerPorts.coa }} {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) .Values.service.nodePorts.coa) }} nodePort: {{ .Values.service.nodePorts.coa }} {{- else if eq .Values.service.type "ClusterIP" }} nodePort: null {{- end }} {{- end }} {{- if .Values.tls.enabled }} - name: tcp-radsec port: {{ .Values.service.ports.radsec }} protocol: TCP targetPort: {{ .Values.containerPorts.radsec }} {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) .Values.service.nodePorts.radsec) }} nodePort: {{ .Values.service.nodePorts.radsec }} {{- else if eq .Values.service.type "ClusterIP" }} nodePort: null {{- end }} {{- end }} selector: {{ include "st-common.labels.matchLabels" . | nindent 4 }} app.kubernetes.io/component: freeradius ---