Skip to content

Commit d69aaed

Browse files
support both arrays and strings in extraArgs values
1 parent 42993f0 commit d69aaed

32 files changed

+275
-232
lines changed

api/operator/v1/vlagent_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ func (cr *VLAgent) GetMetricPath() string {
393393
}
394394

395395
// ExtraArgs returns additionally configured command-line arguments
396-
func (cr *VLAgent) GetExtraArgs() map[string]string {
396+
func (cr *VLAgent) GetExtraArgs() map[string]vmv1beta1.ArgValue {
397397
return cr.Spec.ExtraArgs
398398
}
399399

api/operator/v1/vlcluster_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func (cr *VLInsert) GetMetricPath() string {
286286
}
287287

288288
// ExtraArgs returns additionally configured command-line arguments
289-
func (cr *VLInsert) GetExtraArgs() map[string]string {
289+
func (cr *VLInsert) GetExtraArgs() map[string]vmv1beta1.ArgValue {
290290
return cr.ExtraArgs
291291
}
292292

@@ -438,7 +438,7 @@ func (cr *VLSelect) GetMetricPath() string {
438438
}
439439

440440
// ExtraArgs returns additionally configured command-line arguments
441-
func (cr *VLSelect) GetExtraArgs() map[string]string {
441+
func (cr *VLSelect) GetExtraArgs() map[string]vmv1beta1.ArgValue {
442442
return cr.ExtraArgs
443443
}
444444

@@ -575,7 +575,7 @@ func (cr *VLStorage) GetMetricPath() string {
575575
}
576576

577577
// ExtraArgs returns additionally configured command-line arguments
578-
func (cr *VLStorage) GetExtraArgs() map[string]string {
578+
func (cr *VLStorage) GetExtraArgs() map[string]vmv1beta1.ArgValue {
579579
return cr.ExtraArgs
580580
}
581581

@@ -776,7 +776,7 @@ func (cr *VLCluster) IsOwnsServiceAccount() bool {
776776
// nolint:dupl,lll
777777
func (cr *VLCluster) AsURL(kind vmv1beta1.ClusterComponent) string {
778778
var port string
779-
var extraArgs map[string]string
779+
var extraArgs map[string]vmv1beta1.ArgValue
780780
switch kind {
781781
case vmv1beta1.ClusterComponentSelect:
782782
if cr.Spec.VLSelect == nil {

api/operator/v1/vlsingle_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func (cr *VLSingle) Validate() error {
285285
}
286286

287287
// GetExtraArgs returns additionally configured command-line arguments
288-
func (cr *VLSingle) GetExtraArgs() map[string]string {
288+
func (cr *VLSingle) GetExtraArgs() map[string]vmv1beta1.ArgValue {
289289
return cr.Spec.ExtraArgs
290290
}
291291

api/operator/v1/vmanomaly_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func (cr *VMAnomaly) GetMetricPath() string {
344344
}
345345

346346
// ExtraArgs returns additionally configured command-line arguments
347-
func (cr *VMAnomaly) GetExtraArgs() map[string]string {
347+
func (cr *VMAnomaly) GetExtraArgs() map[string]vmv1beta1.ArgValue {
348348
return cr.Spec.ExtraArgs
349349
}
350350

api/operator/v1/vtcluster_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ func (cr *VTInsert) GetMetricPath() string {
283283
}
284284

285285
// ExtraArgs returns additionally configured command-line arguments
286-
func (cr *VTInsert) GetExtraArgs() map[string]string {
286+
func (cr *VTInsert) GetExtraArgs() map[string]vmv1beta1.ArgValue {
287287
return cr.ExtraArgs
288288
}
289289

@@ -350,7 +350,7 @@ func (cr *VTSelect) GetMetricPath() string {
350350
}
351351

352352
// ExtraArgs returns additionally configured command-line arguments
353-
func (cr *VTSelect) GetExtraArgs() map[string]string {
353+
func (cr *VTSelect) GetExtraArgs() map[string]vmv1beta1.ArgValue {
354354
return cr.ExtraArgs
355355
}
356356

@@ -490,7 +490,7 @@ func (cr *VTStorage) GetMetricPath() string {
490490
}
491491

492492
// ExtraArgs returns additionally configured command-line arguments
493-
func (cr *VTStorage) GetExtraArgs() map[string]string {
493+
func (cr *VTStorage) GetExtraArgs() map[string]vmv1beta1.ArgValue {
494494
return cr.ExtraArgs
495495
}
496496

@@ -691,7 +691,7 @@ func (cr *VTCluster) IsOwnsServiceAccount() bool {
691691
// nolint:dupl,lll
692692
func (cr *VTCluster) AsURL(kind vmv1beta1.ClusterComponent) string {
693693
var port string
694-
var extraArgs map[string]string
694+
var extraArgs map[string]vmv1beta1.ArgValue
695695
switch kind {
696696
case vmv1beta1.ClusterComponentSelect:
697697
if cr.Spec.Select == nil {

api/operator/v1/vtsingle_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func (cr *VTSingle) Validate() error {
290290
}
291291

292292
// GetExtraArgs returns additionally configured command-line arguments
293-
func (cr *VTSingle) GetExtraArgs() map[string]string {
293+
func (cr *VTSingle) GetExtraArgs() map[string]vmv1beta1.ArgValue {
294294
return cr.Spec.ExtraArgs
295295
}
296296

api/operator/v1beta1/vlogs_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func (cr *VLogs) Validate() error {
273273
}
274274

275275
// GetExtraArgs returns additionally configured command-line arguments
276-
func (cr *VLogs) GetExtraArgs() map[string]string {
276+
func (cr *VLogs) GetExtraArgs() map[string]ArgValue {
277277
return cr.Spec.ExtraArgs
278278
}
279279

api/operator/v1beta1/vmagent_types.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,8 @@ func (cr *VMAgent) GetReloaderParams() *CommonConfigReloaderParams {
436436

437437
// UseProxyProtocol implements reloadable interface
438438
func (cr *VMAgent) UseProxyProtocol() bool {
439-
if v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"]; ok && v == "true" {
440-
return true
441-
}
442-
return false
439+
v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"]
440+
return ok && len(v) > 0 && v[0] == "true"
443441
}
444442

445443
// AutomountServiceAccountToken implements reloadable interface
@@ -755,7 +753,7 @@ func (cr *VMAgent) GetMetricPath() string {
755753
}
756754

757755
// ExtraArgs returns additionally configured command-line arguments
758-
func (cr *VMAgent) GetExtraArgs() map[string]string {
756+
func (cr *VMAgent) GetExtraArgs() map[string]ArgValue {
759757
return cr.Spec.ExtraArgs
760758
}
761759

api/operator/v1beta1/vmalert_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (cr *VMAlert) GetReloaderParams() *CommonConfigReloaderParams {
171171
// UseProxyProtocol implements reloadable interface
172172
func (cr *VMAlert) UseProxyProtocol() bool {
173173
v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"]
174-
return ok && v == "true"
174+
return ok && len(v) > 0 && v[0] == "true"
175175
}
176176

177177
// AutomountServiceAccountToken implements reloadable interface
@@ -457,7 +457,7 @@ func (cr *VMAlert) GetMetricPath() string {
457457
}
458458

459459
// GetExtraArgs returns additionally configured command-line arguments
460-
func (cr *VMAlert) GetExtraArgs() map[string]string {
460+
func (cr *VMAlert) GetExtraArgs() map[string]ArgValue {
461461
return cr.Spec.ExtraArgs
462462
}
463463

api/operator/v1beta1/vmalertmanager_types.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,8 @@ func (cr *VMAlertmanager) GetReloaderParams() *CommonConfigReloaderParams {
236236

237237
// UseProxyProtocol implements reloadable interface
238238
func (cr *VMAlertmanager) UseProxyProtocol() bool {
239-
if v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"]; ok && v == "true" {
240-
return true
241-
}
242-
return false
239+
v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"]
240+
return ok && len(v) > 0 && v[0] == "true"
243241
}
244242

245243
// AutomountServiceAccountToken implements reloadable interface
@@ -423,7 +421,7 @@ func (cr *VMAlertmanager) GetMetricPath() string {
423421
}
424422

425423
// GetExtraArgs returns additionally configured command-line arguments
426-
func (cr *VMAlertmanager) GetExtraArgs() map[string]string {
424+
func (cr *VMAlertmanager) GetExtraArgs() map[string]ArgValue {
427425
return cr.Spec.ExtraArgs
428426
}
429427

0 commit comments

Comments
 (0)