svc-dolphinscheduler-api.yaml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. {{- if and .Values.api.enabled }}
  18. apiVersion: v1
  19. kind: Service
  20. metadata:
  21. name: {{ include "dolphinscheduler.fullname" . }}-api
  22. labels:
  23. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
  24. {{- include "dolphinscheduler.common.labels" . | nindent 4 }}
  25. {{- if .Values.api.service.annotations }}
  26. annotations: {{- toYaml .Values.api.service.annotations | nindent 4 }}
  27. {{- end }}
  28. spec:
  29. type: {{ .Values.api.service.type }}
  30. {{- if and (eq .Values.api.service.type "ClusterIP") .Values.api.service.clusterIP }}
  31. clusterIP: {{ .Values.api.service.clusterIP }}
  32. {{- end }}
  33. ports:
  34. - port: 12345
  35. targetPort: api-port
  36. {{- if and (eq .Values.api.service.type "NodePort") .Values.api.service.nodePort }}
  37. nodePort: {{ .Values.api.service.nodePort }}
  38. {{- end }}
  39. protocol: TCP
  40. name: api-port
  41. - port: 25333
  42. targetPort: python-api-port
  43. {{- if and (eq .Values.api.service.type "NodePort") .Values.api.service.pythonNodePort }}
  44. nodePort: {{ .Values.api.service.pythonNodePort }}
  45. {{- end }}
  46. protocol: TCP
  47. name: python-api-port
  48. {{- if .Values.api.service.externalIPs }}
  49. externalIPs:
  50. {{- toYaml .Values.api.service.externalIPs | nindent 4 }}
  51. {{- end }}
  52. {{- if and (eq .Values.api.service.type "ExternalName") .Values.api.service.externalName }}
  53. externalName: {{ .Values.api.service.externalName }}
  54. {{- end }}
  55. {{- if and (eq .Values.api.service.type "LoadBalancer") .Values.api.service.loadBalancerIP }}
  56. loadBalancerIP: {{ .Values.api.service.loadBalancerIP }}
  57. {{- end }}
  58. selector:
  59. {{- include "dolphinscheduler.api.labels" . | nindent 4 }}
  60. ---
  61. {{- if .Values.api.service.serviceMonitor.enabled }}
  62. apiVersion: monitoring.coreos.com/v1
  63. kind: ServiceMonitor
  64. metadata:
  65. name: {{ include "dolphinscheduler.fullname" . }}-api
  66. namespace: {{ .Release.Namespace }}
  67. labels:
  68. {{- include "dolphinscheduler.common.labels" . | nindent 4 }}
  69. {{- if .Values.api.service.serviceMonitor.labels }}
  70. {{- toYaml .Values.api.service.serviceMonitor.labels | nindent 4 }}
  71. {{- end }}
  72. {{- if .Values.api.service.serviceMonitor.annotations }}
  73. annotations: {{- toYaml .Values.api.service.serviceMonitor.annotations | nindent 4 }}
  74. {{- end }}
  75. spec:
  76. namespaceSelector:
  77. matchNames:
  78. - {{ .Values.api.service.serviceMonitor.namespace | default .Release.Namespace }}
  79. selector:
  80. matchLabels:
  81. app.kubernetes.io/name: {{ include "dolphinscheduler.fullname" . }}-api
  82. {{- include "dolphinscheduler.common.labels" . | nindent 6 }}
  83. endpoints:
  84. - scheme: http
  85. targetPort: api-port
  86. path: {{ .Values.api.service.serviceMonitor.path }}
  87. interval: {{ .Values.api.service.serviceMonitor.interval }}
  88. {{- end }}
  89. {{- end }}