jenkins-controller-svc.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: {{template "jenkins.fullname" . }}
  5. namespace: {{ template "jenkins.namespace" . }}
  6. labels:
  7. "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
  8. {{- if .Values.renderHelmLabels }}
  9. "helm.sh/chart": "{{ template "jenkins.label" .}}"
  10. {{- end }}
  11. "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
  12. "app.kubernetes.io/instance": "{{ .Release.Name }}"
  13. "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
  14. {{- if .Values.controller.serviceLabels }}
  15. {{ toYaml .Values.controller.serviceLabels | indent 4 }}
  16. {{- end }}
  17. {{- if .Values.controller.serviceAnnotations }}
  18. annotations:
  19. {{ toYaml .Values.controller.serviceAnnotations | indent 4 }}
  20. {{- end }}
  21. spec:
  22. {{- if .Values.controller.serviceExternalTrafficPolicy }}
  23. externalTrafficPolicy: {{.Values.controller.serviceExternalTrafficPolicy}}
  24. {{- end }}
  25. {{- if (and (eq .Values.controller.serviceType "ClusterIP") (not (empty .Values.controller.clusterIP))) }}
  26. clusterIP: {{.Values.controller.clusterIP}}
  27. {{- end }}
  28. ports:
  29. - port: {{.Values.controller.servicePort}}
  30. name: http
  31. targetPort: {{ .Values.controller.targetPort }}
  32. {{- if (and (eq .Values.controller.serviceType "NodePort") (not (empty .Values.controller.nodePort))) }}
  33. nodePort: {{.Values.controller.nodePort}}
  34. {{- end }}
  35. {{- range $index, $port := .Values.controller.extraPorts }}
  36. - port: {{ $port.port }}
  37. name: {{ $port.name }}
  38. {{- if $port.targetPort }}
  39. targetPort: {{ $port.targetPort }}
  40. {{- else }}
  41. targetPort: {{ $port.port }}
  42. {{- end -}}
  43. {{- end }}
  44. selector:
  45. "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
  46. "app.kubernetes.io/instance": "{{ .Release.Name }}"
  47. type: {{.Values.controller.serviceType}}
  48. {{if eq .Values.controller.serviceType "LoadBalancer"}}
  49. {{- if .Values.controller.loadBalancerSourceRanges }}
  50. loadBalancerSourceRanges:
  51. {{ toYaml .Values.controller.loadBalancerSourceRanges | indent 4 }}
  52. {{- end }}
  53. {{if .Values.controller.loadBalancerIP}}
  54. loadBalancerIP: {{.Values.controller.loadBalancerIP}}
  55. {{end}}
  56. {{end}}