{{- if eq (include "frontend.deployMethod" .) "haMode" }} kind: Service apiVersion: v1 metadata: name: {{ template "frontend.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 "frontend.selectorLabels" . | nindent 4 }} {{- if .Values.service -}} {{- if .Values.service.type }} type: "{{ .Values.service.type }}" {{- else }} type: ClusterIP {{- end }} {{- else }} type: ClusterIP {{- end }} {{- if (eq .Values.service.type "LoadBalancer") }} {{- if .Values.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} {{- end -}} {{- end }} ports: - 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 }} {{- 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 }}