jenkins-master-svc.yaml 1.6 KB
Newer Older
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
apiVersion: v1
kind: Service
metadata:
  name: {{template "jenkins.fullname" . }}
  namespace: {{ template "jenkins.namespace" . }}
  labels:
    "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
    "helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version }}"
    "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
    "app.kubernetes.io/instance": "{{ .Release.Name }}"
    "app.kubernetes.io/component": "{{ .Values.master.componentName }}"
    {{- if .Values.master.serviceLabels }}
{{ toYaml .Values.master.serviceLabels | indent 4 }}
    {{- end }}
{{- if .Values.master.serviceAnnotations }}
  annotations:
{{ toYaml .Values.master.serviceAnnotations | indent 4 }}
{{- end }}
spec:
  ports:
    - port: {{.Values.master.servicePort}}
      name: http
      targetPort: {{ .Values.master.targetPort }}
      {{if (and (eq .Values.master.serviceType "NodePort") (not (empty .Values.master.nodePort)))}}
      nodePort: {{.Values.master.nodePort}}
      {{end}}
{{- range $index, $port := .Values.master.extraPorts }}
    - port: {{ $port.port }}
      name: {{ $port.name }}
      targetPort: {{ $port.port }}
{{- end }}
  selector:
    "app.kubernetes.io/component": "{{ .Values.master.componentName }}"
    "app.kubernetes.io/instance": "{{ .Release.Name }}"
  type: {{.Values.master.serviceType}}
  {{if eq .Values.master.serviceType "LoadBalancer"}}
{{- if .Values.master.loadBalancerSourceRanges }}
  loadBalancerSourceRanges:
{{ toYaml .Values.master.loadBalancerSourceRanges | indent 4 }}
{{- end }}
  {{if .Values.master.loadBalancerIP}}
  loadBalancerIP: {{.Values.master.loadBalancerIP}}
  {{end}}
  {{end}}