jenkins-agent-svc.yaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {{- if .Values.controller.agentListenerEnabled }}
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. name: {{ template "jenkins.fullname" . }}-agent
  6. namespace: {{ template "jenkins.namespace" . }}
  7. labels:
  8. "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
  9. {{- if .Values.renderHelmLabels }}
  10. "helm.sh/chart": "{{ template "jenkins.label" .}}"
  11. {{- end }}
  12. "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
  13. "app.kubernetes.io/instance": "{{ .Release.Name }}"
  14. "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
  15. {{- if .Values.controller.agentListenerServiceAnnotations }}
  16. annotations:
  17. {{- toYaml .Values.controller.agentListenerServiceAnnotations | nindent 4 }}
  18. {{- end }}
  19. spec:
  20. {{- if .Values.controller.agentListenerExternalTrafficPolicy }}
  21. externalTrafficPolicy: {{.Values.controller.agentListenerExternalTrafficPolicy}}
  22. {{- end }}
  23. ports:
  24. - port: {{ .Values.controller.agentListenerPort }}
  25. targetPort: {{ .Values.controller.agentListenerPort }}
  26. {{- if (and (eq .Values.controller.agentListenerServiceType "NodePort") (not (empty .Values.controller.agentListenerNodePort))) }}
  27. nodePort: {{ .Values.controller.agentListenerNodePort }}
  28. {{- end }}
  29. name: agent-listener
  30. selector:
  31. "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
  32. "app.kubernetes.io/instance": "{{ .Release.Name }}"
  33. type: {{ .Values.controller.agentListenerServiceType }}
  34. {{if eq .Values.controller.agentListenerServiceType "LoadBalancer"}}
  35. {{- if .Values.controller.agentListenerLoadBalancerSourceRanges }}
  36. loadBalancerSourceRanges:
  37. {{ toYaml .Values.controller.agentListenerLoadBalancerSourceRanges | indent 4 }}
  38. {{- end }}
  39. {{- end }}
  40. {{- if and (eq .Values.controller.agentListenerServiceType "LoadBalancer") (.Values.controller.agentListenerLoadBalancerIP) }}
  41. loadBalancerIP: {{ .Values.controller.agentListenerLoadBalancerIP }}
  42. {{- end }}
  43. {{- end }}