volume-service.yaml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {{ $volumes := deepCopy .Values.volumes | mergeOverwrite (dict "" .Values.volume) }}
  2. {{- range $vname, $volume := $volumes }}
  3. {{- $volumeName := trimSuffix "-" (printf "volume-%s" $vname) }}
  4. {{- $volume := mergeOverwrite (deepCopy $.Values.volume) (dict "enabled" true) $volume }}
  5. {{- if $volume.enabled }}
  6. ---
  7. apiVersion: v1
  8. kind: Service
  9. metadata:
  10. name: {{ template "seaweedfs.name" $ }}-{{ $volumeName }}
  11. namespace: {{ $.Release.Namespace }}
  12. labels:
  13. app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
  14. app.kubernetes.io/component: {{ $volumeName }}
  15. helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}
  16. app.kubernetes.io/managed-by: {{ $.Release.Service }}
  17. {{- if $volume.annotations }}
  18. annotations:
  19. {{- toYaml $volume.annotations | nindent 4 }}
  20. {{- end }}
  21. spec:
  22. clusterIP: None
  23. internalTrafficPolicy: {{ $volume.internalTrafficPolicy | default "Cluster" }}
  24. ports:
  25. - name: "swfs-volume"
  26. port: {{ $volume.port }}
  27. targetPort: {{ $volume.port }}
  28. protocol: TCP
  29. - name: "swfs-volume-18080"
  30. port: {{ $volume.grpcPort }}
  31. targetPort: {{ $volume.grpcPort }}
  32. protocol: TCP
  33. {{- if $volume.metricsPort }}
  34. - name: "metrics"
  35. port: {{ $volume.metricsPort }}
  36. targetPort: {{ $volume.metricsPort }}
  37. protocol: TCP
  38. {{- end }}
  39. selector:
  40. app.kubernetes.io/name: {{ template "seaweedfs.name" $ }}
  41. app.kubernetes.io/component: {{ $volumeName }}
  42. {{- end }}
  43. {{- end }}