Files
coder/helm/coder/templates/service.yaml
T

61 lines
1.8 KiB
YAML

{{- if .Values.coder.service.enable }}
---
apiVersion: v1
kind: Service
metadata:
name: coder
labels:
{{- include "coder.labels" . | nindent 4 }}
annotations:
{{- toYaml .Values.coder.service.annotations | nindent 4 }}
spec:
type: {{ .Values.coder.service.type }}
sessionAffinity: {{ .Values.coder.service.sessionAffinity }}
ports:
- name: "http"
port: 80
targetPort: "http"
protocol: TCP
{{ if eq .Values.coder.service.type "NodePort" }}
nodePort: {{ .Values.coder.service.httpNodePort }}
{{ end }}
{{- if eq (include "coder.tlsEnabled" .) "true" }}
- name: "https"
port: 443
targetPort: "https"
protocol: TCP
{{ if eq .Values.coder.service.type "NodePort" }}
nodePort: {{ .Values.coder.service.httpsNodePort }}
{{ end }}
{{- end }}
{{- range .Values.coder.env }}
{{- if eq .name "CODER_PROMETHEUS_ENABLE" }}
{{/*
This sadly has to be nested to avoid evaluating the second part
of the condition too early and potentially getting type errors if
the value is not a string (like a `valueFrom`). We do not support
`valueFrom` for this env var specifically.
*/}}
{{- if eq .value "true" }}
- name: "prometheus-http"
port: 2112
targetPort: "prometheus-http"
protocol: TCP
{{ if eq $.Values.coder.service.type "NodePort" }}
nodePort: {{ $.Values.coder.service.prometheusNodePort }}
{{ end }}
{{- end }}
{{- end }}
{{- end }}
{{- if eq "LoadBalancer" .Values.coder.service.type }}
{{- with .Values.coder.service.loadBalancerIP }}
loadBalancerIP: {{ . | quote }}
{{- end }}
{{- with .Values.coder.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ . | quote }}
{{- end }}
{{- end }}
selector:
{{- include "coder.selectorLabels" . | nindent 4 }}
{{- end }}