30 lines
777 B
Smarty
30 lines
777 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: {{ default "ClusterIP" $values.type }}
|
|
ports:
|
|
{{- range $k, $v := $values.ports }}
|
|
- port: {{ $v.port }}
|
|
targetPort: {{ default $v.port $v.targetPort }}
|
|
protocol: {{ default "TCP" $v.protocol }}
|
|
name: {{ $k }}
|
|
{{- end }}
|
|
selector:
|
|
{{- $selectorlabels | nindent 4 }}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|