rancher-partner-charts/charts/kubecost/cost-analyzer/2.0.2/templates/cost-analyzer-service-templ...

61 lines
1.7 KiB
YAML

{{- if and (not .Values.agent) (not .Values.cloudAgent) }}
kind: Service
apiVersion: v1
metadata:
name: {{ template "cost-analyzer.serviceName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if .Values.service.labels }}
{{ toYaml .Values.service.labels | indent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
spec:
selector:
{{ include "cost-analyzer.selectorLabels" . | nindent 4 }}
{{- if .Values.service -}}
{{- if .Values.service.type }}
type: "{{ .Values.service.type }}"
{{- else }}
type: ClusterIP
{{- end }}
{{- else }}
type: ClusterIP
{{- end }}
ports:
- name: tcp-model
port: 9003
targetPort: 9003
{{- with .Values.kubecostModel.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.kubecostFrontend.enabled }}
- name: tcp-frontend
{{- if (eq .Values.service.type "NodePort") }}
{{- if .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
{{- end }}
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
{{- end }}
{{- if or .Values.saml.enabled .Values.oidc.enabled}}
- name: apiserver
port: 9007
targetPort: 9007
{{- end }}
{{- if .Values.service.sessionAffinity.enabled }}
sessionAffinity: ClientIP
{{- if .Values.service.sessionAffinity.timeoutSeconds }}
sessionAffinityConfig:
clientIP:
timeoutSeconds: {{ .Values.service.sessionAffinity.timeoutSeconds }}
{{- end }}
{{- else }}
sessionAffinity: None
{{- end }}
{{- end }}