29 lines
742 B
Smarty
29 lines
742 B
Smarty
{{- define "lib.service" -}}
|
|
{{- $servicename := include "lib.fullname" . }}
|
|
{{- $labels := include "lib.labels" . }}
|
|
{{- $selectorlabels := include "lib.selectorLabels" . }}
|
|
{{- $ns := .Values.namespace }}
|
|
{{- range $name, $values := .Values.service }}
|
|
{{- if $values.enabled }}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ $servicename }}-{{ $name }}
|
|
namespace: {{ $ns }}
|
|
labels:
|
|
{{- $labels | nindent 4 }}
|
|
spec:
|
|
type: {{ $values.type }}
|
|
ports:
|
|
{{- range $k, $v := $values.ports }}
|
|
- port: {{ $v.port }}
|
|
targetPort: {{ default $v.targetPort $v.port }}
|
|
protocol: {{ $v.protocol }}
|
|
name: {{ $k }}
|
|
{{- end }}
|
|
selector:
|
|
{{- $selectorlabels | nindent 4 }}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}} |