Skip to content

Commit 3085bf3

Browse files
refactor: update service configurations for device plugin and scheduler (#799)
Signed-off-by: haitwang-cloud <[email protected]>
1 parent 89368bd commit 3085bf3

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

charts/hami/templates/device-plugin/monitorservice.yaml

+13-10
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@ metadata:
55
labels:
66
app.kubernetes.io/component: hami-device-plugin
77
{{- include "hami-vgpu.labels" . | nindent 4 }}
8-
{{- if .Values.scheduler.service.labels }}
9-
{{ toYaml .Values.scheduler.service.labels | indent 4 }}
8+
{{- if .Values.devicePlugin.service.labels }} # Use devicePlugin instead of scheduler
9+
{{ toYaml .Values.devicePlugin.service.labels | indent 4 }}
1010
{{- end }}
11-
{{- if .Values.scheduler.service.annotations }}
12-
annotations: {{ toYaml .Values.scheduler.service.annotations | nindent 4 }}
11+
{{- if .Values.devicePlugin.service.annotations }} # Use devicePlugin instead of scheduler
12+
annotations: {{ toYaml .Values.devicePlugin.service.annotations | nindent 4 }}
1313
{{- end }}
1414
spec:
15-
externalTrafficPolicy: Local
16-
selector:
17-
app.kubernetes.io/component: hami-device-plugin
18-
type: NodePort
15+
type: {{ .Values.devicePlugin.service.type | default "NodePort" }} # Default type is NodePort
1916
ports:
2017
- name: monitorport
21-
port: {{ .Values.devicePlugin.service.httpPort }}
18+
port: {{ .Values.devicePlugin.service.httpPort | default 31992 }} # Default HTTP port is 31992
2219
targetPort: 9394
23-
nodePort: {{ .Values.devicePlugin.service.httpPort }}
20+
{{- if eq (.Values.devicePlugin.service.type | default "NodePort") "NodePort" }} # If type is NodePort, set nodePort
21+
nodePort: {{ .Values.devicePlugin.service.httpPort | default 31992 }}
22+
{{- end }}
23+
protocol: TCP
24+
selector:
25+
app.kubernetes.io/component: hami-device-plugin
26+
{{- include "hami-vgpu.selectorLabels" . | nindent 4 }}

charts/hami/templates/scheduler/service.yaml

+12-9
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@ metadata:
1212
annotations: {{ toYaml .Values.scheduler.service.annotations | nindent 4 }}
1313
{{- end }}
1414
spec:
15-
type: NodePort
15+
type: {{ .Values.scheduler.service.type | default "NodePort" }} # Default type is NodePort
1616
ports:
1717
- name: http
18-
port: {{ .Values.scheduler.service.httpPort }}
19-
targetPort: 443
20-
nodePort: {{ .Values.scheduler.service.schedulerPort }}
18+
port: {{ .Values.scheduler.service.httpPort | default 443 }} # Default HTTP port is 443
19+
targetPort: {{ .Values.scheduler.service.httpTargetPort | default 443 }}
20+
{{- if eq (.Values.scheduler.service.type | default "NodePort") "NodePort" }} # If type is NodePort, set nodePort
21+
nodePort: {{ .Values.scheduler.service.schedulerPort | default 31998 }}
22+
{{- end }}
2123
protocol: TCP
2224
- name: monitor
23-
port: {{ .Values.scheduler.service.monitorPort }}
24-
targetPort: {{ (split ":" (printf "%s" .Values.scheduler.metricsBindAddress))._1 }}
25-
nodePort: {{ .Values.scheduler.service.monitorPort }}
25+
port: {{ .Values.scheduler.service.monitorPort | default 31993 }} # Default monitoring port is 31993
26+
targetPort: {{ .Values.scheduler.service.monitorTargetPort | default 31993 }}
27+
{{- if eq (.Values.scheduler.service.type | default "NodePort") "NodePort" }} # If type is NodePort, set nodePort
28+
nodePort: {{ .Values.scheduler.service.monitorPort | default 31993 }}
29+
{{- end }}
2630
protocol: TCP
2731
selector:
2832
app.kubernetes.io/component: hami-scheduler
29-
{{- include "hami-vgpu.selectorLabels" . | nindent 4 }}
30-
33+
{{- include "hami-vgpu.selectorLabels" . | nindent 4 }}

charts/hami/values.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ scheduler:
119119
tolerations: []
120120
runAsUser: 2000
121121
service:
122-
httpPort: 443
123-
schedulerPort: 31998
124-
monitorPort: 31993
122+
type: NodePort # Default type is NodePort, can be changed to ClusterIP
123+
httpPort: 443 # HTTP port
124+
schedulerPort: 31998 # NodePort for HTTP
125+
monitorPort: 31993 # Monitoring port
125126
labels: {}
126127
annotations: {}
127128

@@ -141,7 +142,10 @@ devicePlugin:
141142
- -v=4
142143

143144
service:
145+
type: NodePort # Default type is NodePort, can be changed to ClusterIP
144146
httpPort: 31992
147+
labels: {}
148+
annotations: {}
145149

146150
pluginPath: /var/lib/kubelet/device-plugins
147151
libPath: /usr/local/vgpu

0 commit comments

Comments
 (0)