add custom nodeport support (#1217)

This commit is contained in:
majinghe
2025-12-20 22:02:21 +08:00
committed by GitHub
parent cc31e88c91
commit 20ea591049
3 changed files with 29 additions and 18 deletions

View File

@@ -28,12 +28,10 @@ spec:
{{- end }}
{{- if .Values.ingress.tls.enabled }}
tls:
{{- range .Values.ingress.hosts }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- range .Values.ingress.hosts }}
- {{ .host | quote }}
{{- end }}
{{- end }}
secretName: {{ $secretName }}
{{- end }}
rules:

View File

@@ -13,15 +13,16 @@ spec:
clusterIP: None
publishNotReadyAddresses: true
ports:
- port: {{ .Values.service.ep_port }}
name: endpoint
- port: {{ .Values.service.console_port }}
name: console
- name: endpoint
port: {{ .Values.service.endpoint.port }}
- name: console
port: {{ .Values.service.console.port }}
selector:
{{- include "rustfs.selectorLabels" . | nindent 4 }}
{{- end }}
---
{{- $serviceType := .Values.service.type }}
apiVersion: v1
kind: Service
metadata:
@@ -40,19 +41,27 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.enabled }}
{{- if eq $serviceType "ClusterIP" }}
type: ClusterIP
{{- else }}
type: {{ .Values.service.type }}
{{- else if eq $serviceType "NodePort" }}
type: NodePort
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
{{- end }}
ports:
- port: {{ .Values.service.ep_port }}
name: endpoint
- port: {{ .Values.service.console_port }}
name: console
- name: endpoint
port: {{ .Values.service.endpoint.port }}
targetPort: {{ .Values.service.endpoint.port }}
{{- if eq $serviceType "NodePort" }}
nodePort: {{ .Values.service.endpoint.nodePort }}
{{- end }}
- name: console
port: {{ .Values.service.console.port }}
targetPort: {{ .Values.service.console.port }}
{{- if eq $serviceType "NodePort" }}
nodePort: {{ .Values.service.console.nodePort }}
{{- end }}
selector:
{{- include "rustfs.selectorLabels" . | nindent 4 }}

View File

@@ -90,9 +90,13 @@ containerSecurityContext:
runAsNonRoot: true
service:
type: NodePort
ep_port: 9000
console_port: 9001
type: ClusterIP
endpoint:
port: 9000
nodePort: 32000
console:
port: 9001
nodePort: 32001
# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/
ingress: