aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/authentication/components/oauth2-proxy/templates/service.yaml
blob: d16120ee9143b86963e5ba6028a9cb623ef9b06a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
apiVersion: v1
kind: Service
metadata:
  labels:
    app: {{ template "oauth2-proxy.name" . }}
{{- include "oauth2-proxy.labels" . | indent 4 }}
  name: {{ template "oauth2-proxy.fullname" . }}
  namespace: {{ template "oauth2-proxy.namespace" $ }}
{{- if .Values.service.annotations }}
  annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
spec:
{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }}
  type: ClusterIP
  {{- if .Values.service.clusterIP }}
  clusterIP: {{ .Values.service.clusterIP }}
  {{end}}
{{- else if eq .Values.service.type "LoadBalancer" }}
  type: {{ .Values.service.type }}
  {{- if .Values.service.loadBalancerIP }}
  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
  {{- end }}
  {{- if .Values.service.loadBalancerSourceRanges }}
  loadBalancerSourceRanges:
{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }}
  {{- end -}}
{{- else }}
  type: {{ .Values.service.type }}
{{- end }}
  ports:
    - port: {{ .Values.service.portNumber }}
      targetPort: {{ .Values.httpScheme }}
      {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
      nodePort: {{ .Values.service.nodePort }}
      {{- end }}
      protocol: TCP
      {{- with .Values.service.appProtocol }}
      appProtocol: {{ . }}
      {{- end }}
      name: {{ .Values.httpScheme }}
    {{- if and .Values.metrics.enabled .Values.metrics.port }}
    - port: {{ .Values.metrics.port }}
      protocol: TCP
      {{- with .Values.metrics.service.appProtocol }}
      appProtocol: {{ . }}
      {{- end }}
      targetPort: metrics
      {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.metrics.nodePort))) }}
      nodePort: {{ .Values.metrics.nodePort }}
      {{- end }}
      name: metrics
    {{- end }}
  selector:
    {{- include "oauth2-proxy.selectorLabels" . | indent 4 }}