service.yaml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: {{ include "deepflow.fullname" . }}-server
  5. labels:
  6. {{- include "deepflow-server.labels" . | nindent 4 }}
  7. {{- if .Values.server.service.annotations }}
  8. annotations:
  9. {{ toYaml .Values.server.service.annotations | indent 4 }}
  10. {{- end }}
  11. spec:
  12. {{- if .Values.server.service.clusterIP }}
  13. clusterIP: {{ .Values.server.service.clusterIP }}
  14. {{- end }}
  15. {{- if .Values.server.service.externalIPs }}
  16. externalIPs:
  17. {{ toYaml .Values.server.service.externalIPs | indent 4 }}
  18. {{- end }}
  19. {{- if .Values.server.service.loadBalancerIP }}
  20. loadBalancerIP: {{ .Values.server.service.loadBalancerIP }}
  21. {{- end }}
  22. {{- if .Values.server.service.loadBalancerSourceRanges }}
  23. loadBalancerSourceRanges:
  24. {{- range $cidr := .Values.server.service.loadBalancerSourceRanges }}
  25. - {{ $cidr }}
  26. {{- end }}
  27. {{- end }}
  28. {{- if ne .Values.server.service.type "ClusterIP" }}
  29. externalTrafficPolicy: {{ .Values.server.service.externalTrafficPolicy }}
  30. {{- end }}
  31. ports:
  32. {{- $serviceType := .Values.server.service.type -}}
  33. {{- range .Values.server.service.ports }}
  34. - name: {{ tpl .name $ }}
  35. port: {{ tpl (toString .port) $ }}
  36. targetPort: {{ tpl (toString .targetPort) $ }}
  37. {{- if and (eq $serviceType "NodePort") (.nodePort) }}
  38. nodePort: {{ tpl (toString .nodePort) $ }}
  39. {{- end }}
  40. protocol: {{ tpl .protocol $ }}
  41. {{- end }}
  42. {{- if .Values.server.service.additionalPorts }}
  43. {{ toYaml .Values.server.service.additionalPorts | indent 2 }}
  44. {{- end }}
  45. selector:
  46. {{- include "deepflow-server.selectorLabels" . | nindent 4 }}
  47. type: "{{ .Values.server.service.type }}"
  48. ---
  49. apiVersion: v1
  50. kind: Service
  51. metadata:
  52. name: {{ include "deepflow.fullname" . }}-app
  53. labels:
  54. {{- include "deepflow-app.labels" . | nindent 4 }}
  55. {{- if .Values.app.service.annotations }}
  56. annotations:
  57. {{ toYaml .Values.app.service.annotations | indent 4 }}
  58. {{- end }}
  59. spec:
  60. {{- if .Values.app.service.clusterIP }}
  61. clusterIP: {{ .Values.app.service.clusterIP }}
  62. {{- end }}
  63. {{- if .Values.app.service.externalIPs }}
  64. externalIPs:
  65. {{ toYaml .Values.app.service.externalIPs | indent 4 }}
  66. {{- end }}
  67. {{- if .Values.app.service.loadBalancerIP }}
  68. loadBalancerIP: {{ .Values.app.service.loadBalancerIP }}
  69. {{- end }}
  70. {{- if .Values.app.service.loadBalancerSourceRanges }}
  71. loadBalancerSourceRanges:
  72. {{- range $cidr := .Values.app.service.loadBalancerSourceRanges }}
  73. - {{ $cidr }}
  74. {{- end }}
  75. {{- end }}
  76. {{- if ne .Values.app.service.type "ClusterIP" }}
  77. externalTrafficPolicy: {{ .Values.app.service.externalTrafficPolicy }}
  78. {{- end }}
  79. ports:
  80. {{- $serviceType := .Values.app.service.type -}}
  81. {{- range .Values.app.service.ports }}
  82. - name: {{ tpl .name $ }}
  83. port: {{ tpl (toString .port) $ }}
  84. targetPort: {{ tpl (toString .targetPort) $ }}
  85. {{- if and (eq $serviceType "NodePort") (.nodePort) }}
  86. nodePort: {{ tpl (toString .nodePort) $ }}
  87. {{- end }}
  88. protocol: {{ tpl .protocol $ }}
  89. {{- end }}
  90. {{- if .Values.app.service.additionalPorts }}
  91. {{ toYaml .Values.app.service.additionalPorts | indent 2 }}
  92. {{- end }}
  93. selector:
  94. {{- include "deepflow-app.selectorLabels" . | nindent 4 }}
  95. type: "{{ .Values.app.service.type }}"