Skip to content

Commit 48012f5

Browse files
committed
update v4.11.1
1 parent 64e5a75 commit 48012f5

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

connector/host/host_helper.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ func NewNodeHostInfo(ctx context.Context) (*NodeHostInfo, error) {
6565
return nil, err
6666
}
6767

68-
hostIPs, err := utils.GetHostIPs(ctx)
69-
if err != nil {
70-
log.AddContext(ctx).Warningf("failed to get host ips: [%v]", err)
71-
}
72-
7368
iscsiInitiator, err := proto.GetISCSIInitiator(ctx)
7469
if err != nil {
7570
log.AddContext(ctx).Warningf("failed to get ISCSI initiator: [%v]", err)
@@ -85,13 +80,22 @@ func NewNodeHostInfo(ctx context.Context) (*NodeHostInfo, error) {
8580
log.AddContext(ctx).Warningf("failed to get RoCE initiator: [%v]", err)
8681
}
8782

88-
return &NodeHostInfo{
83+
hostInfo := &NodeHostInfo{
8984
HostName: strings.Trim(hostName, " "),
90-
HostIPs: hostIPs,
9185
IscsiInitiator: iscsiInitiator,
9286
FCInitiators: fcInitiators,
9387
RoCEInitiator: roCEInitiator,
94-
}, nil
88+
}
89+
90+
if app.GetGlobalConfig().ReportNodeIP {
91+
if hostIPs, err := utils.GetHostIPs(ctx); err != nil {
92+
log.AddContext(ctx).Warningf("failed to get host ips: [%v]", err)
93+
} else {
94+
hostInfo.HostIPs = hostIPs
95+
}
96+
}
97+
98+
return hostInfo, nil
9599
}
96100

97101
// SaveNodeHostInfoToSecret save the current node host information to secret.

csi/app/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type serviceConfig struct {
6464

6565
// kubeletVolumeDevicesDirName, default is /volumeDevices/
6666
KubeletVolumeDevicesDirName string
67+
ReportNodeIP bool
6768
}
6869

6970
type connectorConfig struct {

csi/app/options/service.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type serviceOptions struct {
6666
timeout time.Duration
6767

6868
kubeletVolumeDevicesDirName string
69+
reportNodeIP bool
6970
}
7071

7172
// NewServiceOptions returns service configurations
@@ -119,6 +120,7 @@ func (opt *serviceOptions) AddFlags(ff *flag.FlagSet) {
119120
"The port of exported csi server")
120121
ff.StringVar(&opt.exportCsiServerAddress, "export-csi-service-address", "",
121122
"The address of exported csi server")
123+
ff.BoolVar(&opt.reportNodeIP, "report-node-ip", false, "Whether to report node IP")
122124
}
123125

124126
// ApplyFlags assign the service flags
@@ -145,6 +147,7 @@ func (opt *serviceOptions) ApplyFlags(cfg *config.AppConfig) {
145147
cfg.KubeletVolumeDevicesDirName = opt.kubeletVolumeDevicesDirName
146148
cfg.ExportCsiServerAddress = opt.exportCsiServerAddress
147149
cfg.ExportCsiServerPort = opt.exportCsiServerPort
150+
cfg.ReportNodeIP = opt.reportNodeIP
148151
}
149152

150153
// ValidateFlags validate the service flags

helm/esdk/templates/huawei-csi-node.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ spec:
180180
{{ if .Values.node.maxVolumesPerNode }}
181181
- "--max-volumes-per-node={{ .Values.node.maxVolumesPerNode }}"
182182
{{ end }}
183+
- "-report-node-ip={{ .Values.csiDriver.reportNodeIP | default false }}"
183184
env:
184185
- name: CSI_NODENAME
185186
valueFrom:
@@ -277,4 +278,4 @@ spec:
277278
- hostPath:
278279
path: /etc/localtime
279280
type: File
280-
name: host-time
281+
name: host-time

helm/esdk/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ csiDriver:
265265
fileSize: 20M
266266
# Maximum number of log files that can be backed up.
267267
maxBackups: 9
268+
# Whether to report node IP
269+
reportNodeIP: false
268270

269271
# leaderElection configuration
270272
leaderElection:

0 commit comments

Comments
 (0)