diff --git a/api/operator/v1/vlagent_types.go b/api/operator/v1/vlagent_types.go index d0117cc6a..68b3b36a8 100644 --- a/api/operator/v1/vlagent_types.go +++ b/api/operator/v1/vlagent_types.go @@ -393,7 +393,7 @@ func (cr *VLAgent) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VLAgent) GetExtraArgs() map[string]string { +func (cr *VLAgent) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1/vlcluster_types.go b/api/operator/v1/vlcluster_types.go index 02ad622d7..0f807c8e4 100644 --- a/api/operator/v1/vlcluster_types.go +++ b/api/operator/v1/vlcluster_types.go @@ -286,7 +286,7 @@ func (cr *VLInsert) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VLInsert) GetExtraArgs() map[string]string { +func (cr *VLInsert) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.ExtraArgs } @@ -438,7 +438,7 @@ func (cr *VLSelect) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VLSelect) GetExtraArgs() map[string]string { +func (cr *VLSelect) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.ExtraArgs } @@ -575,7 +575,7 @@ func (cr *VLStorage) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VLStorage) GetExtraArgs() map[string]string { +func (cr *VLStorage) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.ExtraArgs } @@ -776,7 +776,7 @@ func (cr *VLCluster) IsOwnsServiceAccount() bool { // nolint:dupl,lll func (cr *VLCluster) AsURL(kind vmv1beta1.ClusterComponent) string { var port string - var extraArgs map[string]string + var extraArgs map[string]vmv1beta1.ArgValue switch kind { case vmv1beta1.ClusterComponentSelect: if cr.Spec.VLSelect == nil { diff --git a/api/operator/v1/vlsingle_types.go b/api/operator/v1/vlsingle_types.go index 91092918c..538b52da9 100644 --- a/api/operator/v1/vlsingle_types.go +++ b/api/operator/v1/vlsingle_types.go @@ -285,7 +285,7 @@ func (cr *VLSingle) Validate() error { } // GetExtraArgs returns additionally configured command-line arguments -func (cr *VLSingle) GetExtraArgs() map[string]string { +func (cr *VLSingle) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1/vmanomaly_types.go b/api/operator/v1/vmanomaly_types.go index 0f373c656..c0c4941c2 100644 --- a/api/operator/v1/vmanomaly_types.go +++ b/api/operator/v1/vmanomaly_types.go @@ -344,7 +344,7 @@ func (cr *VMAnomaly) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VMAnomaly) GetExtraArgs() map[string]string { +func (cr *VMAnomaly) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1/vtcluster_types.go b/api/operator/v1/vtcluster_types.go index ea1171ca6..c87e3a8d3 100644 --- a/api/operator/v1/vtcluster_types.go +++ b/api/operator/v1/vtcluster_types.go @@ -283,7 +283,7 @@ func (cr *VTInsert) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VTInsert) GetExtraArgs() map[string]string { +func (cr *VTInsert) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.ExtraArgs } @@ -350,7 +350,7 @@ func (cr *VTSelect) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VTSelect) GetExtraArgs() map[string]string { +func (cr *VTSelect) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.ExtraArgs } @@ -490,7 +490,7 @@ func (cr *VTStorage) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VTStorage) GetExtraArgs() map[string]string { +func (cr *VTStorage) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.ExtraArgs } @@ -691,7 +691,7 @@ func (cr *VTCluster) IsOwnsServiceAccount() bool { // nolint:dupl,lll func (cr *VTCluster) AsURL(kind vmv1beta1.ClusterComponent) string { var port string - var extraArgs map[string]string + var extraArgs map[string]vmv1beta1.ArgValue switch kind { case vmv1beta1.ClusterComponentSelect: if cr.Spec.Select == nil { diff --git a/api/operator/v1/vtsingle_types.go b/api/operator/v1/vtsingle_types.go index 5f49a1b89..8b2f708ba 100644 --- a/api/operator/v1/vtsingle_types.go +++ b/api/operator/v1/vtsingle_types.go @@ -290,7 +290,7 @@ func (cr *VTSingle) Validate() error { } // GetExtraArgs returns additionally configured command-line arguments -func (cr *VTSingle) GetExtraArgs() map[string]string { +func (cr *VTSingle) GetExtraArgs() map[string]vmv1beta1.ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1beta1/vlogs_types.go b/api/operator/v1beta1/vlogs_types.go index da689f0f0..6f525c60b 100644 --- a/api/operator/v1beta1/vlogs_types.go +++ b/api/operator/v1beta1/vlogs_types.go @@ -273,7 +273,7 @@ func (cr *VLogs) Validate() error { } // GetExtraArgs returns additionally configured command-line arguments -func (cr *VLogs) GetExtraArgs() map[string]string { +func (cr *VLogs) GetExtraArgs() map[string]ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1beta1/vmagent_types.go b/api/operator/v1beta1/vmagent_types.go index fe8af8899..388e4a704 100644 --- a/api/operator/v1beta1/vmagent_types.go +++ b/api/operator/v1beta1/vmagent_types.go @@ -230,10 +230,8 @@ func (cr *VMAgent) GetReloaderParams() *CommonConfigReloaderParams { // UseProxyProtocol implements reloadable interface func (cr *VMAgent) UseProxyProtocol() bool { - if v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"]; ok && v == "true" { - return true - } - return false + v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"] + return ok && len(v) > 0 && v[0] == "true" } // AutomountServiceAccountToken implements reloadable interface @@ -545,7 +543,7 @@ func (cr *VMAgent) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VMAgent) GetExtraArgs() map[string]string { +func (cr *VMAgent) GetExtraArgs() map[string]ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1beta1/vmalert_types.go b/api/operator/v1beta1/vmalert_types.go index cd67a2b59..0736edfc9 100644 --- a/api/operator/v1beta1/vmalert_types.go +++ b/api/operator/v1beta1/vmalert_types.go @@ -171,7 +171,7 @@ func (cr *VMAlert) GetReloaderParams() *CommonConfigReloaderParams { // UseProxyProtocol implements reloadable interface func (cr *VMAlert) UseProxyProtocol() bool { v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"] - return ok && v == "true" + return ok && len(v) > 0 && v[0] == "true" } // AutomountServiceAccountToken implements reloadable interface @@ -457,7 +457,7 @@ func (cr *VMAlert) GetMetricPath() string { } // GetExtraArgs returns additionally configured command-line arguments -func (cr *VMAlert) GetExtraArgs() map[string]string { +func (cr *VMAlert) GetExtraArgs() map[string]ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1beta1/vmalert_types_test.go b/api/operator/v1beta1/vmalert_types_test.go index 0c50db4c9..25b22a41f 100644 --- a/api/operator/v1beta1/vmalert_types_test.go +++ b/api/operator/v1beta1/vmalert_types_test.go @@ -24,7 +24,7 @@ func TestVMAlert_ValidateOk(t *testing.T) { f(VMAlertSpec{ Datasource: VMAlertDatasourceSpec{URL: "http://some-url"}, CommonApplicationDeploymentParams: CommonApplicationDeploymentParams{ - ExtraArgs: map[string]string{"notifier.blackhole": "true"}, + ExtraArgs: map[string]ArgValue{"notifier.blackhole": []string{"true"}}, }, }) diff --git a/api/operator/v1beta1/vmalertmanager_types.go b/api/operator/v1beta1/vmalertmanager_types.go index a7253582f..01a45b53f 100644 --- a/api/operator/v1beta1/vmalertmanager_types.go +++ b/api/operator/v1beta1/vmalertmanager_types.go @@ -236,10 +236,8 @@ func (cr *VMAlertmanager) GetReloaderParams() *CommonConfigReloaderParams { // UseProxyProtocol implements reloadable interface func (cr *VMAlertmanager) UseProxyProtocol() bool { - if v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"]; ok && v == "true" { - return true - } - return false + v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"] + return ok && len(v) > 0 && v[0] == "true" } // AutomountServiceAccountToken implements reloadable interface @@ -423,7 +421,7 @@ func (cr *VMAlertmanager) GetMetricPath() string { } // GetExtraArgs returns additionally configured command-line arguments -func (cr *VMAlertmanager) GetExtraArgs() map[string]string { +func (cr *VMAlertmanager) GetExtraArgs() map[string]ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1beta1/vmauth_types.go b/api/operator/v1beta1/vmauth_types.go index 3d6ee9bd9..793bcf584 100644 --- a/api/operator/v1beta1/vmauth_types.go +++ b/api/operator/v1beta1/vmauth_types.go @@ -664,7 +664,7 @@ func (cr *VMAuth) GetMetricPath() string { } // GetExtraArgs returns additionally configured command-line arguments -func (cr *VMAuth) GetExtraArgs() map[string]string { +func (cr *VMAuth) GetExtraArgs() map[string]ArgValue { return cr.Spec.ExtraArgs } @@ -712,10 +712,8 @@ func (cr *VMAuth) UseProxyProtocol() bool { if cr.Spec.UseProxyProtocol { return hasInternalPorts } - if v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"]; ok && v == "true" { - return hasInternalPorts - } - return false + v, ok := cr.Spec.ExtraArgs["httpListenAddr.useProxyProtocol"] + return ok && len(v) > 0 && v[0] == "true" && hasInternalPorts } // AutomountServiceAccountToken implements reloadable interface diff --git a/api/operator/v1beta1/vmcluster_types.go b/api/operator/v1beta1/vmcluster_types.go index 367653a87..938aacda6 100644 --- a/api/operator/v1beta1/vmcluster_types.go +++ b/api/operator/v1beta1/vmcluster_types.go @@ -554,7 +554,9 @@ type VMBackup struct { Resources corev1.ResourceRequirements `json:"resources,omitempty"` // extra args like maxBytesPerSecond default 0 // +optional - ExtraArgs map[string]string `json:"extraArgs,omitempty"` + // +kubebuilder:validation:Schemaless + // +kubebuilder:pruning:PreserveUnknownFields + ExtraArgs map[string]ArgValue `json:"extraArgs,omitempty"` // +optional ExtraEnvs []corev1.EnvVar `json:"extraEnvs,omitempty"` // ExtraEnvsFrom defines source of env variables for the application container @@ -750,7 +752,7 @@ func (cr *VMSelect) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VMSelect) GetExtraArgs() map[string]string { +func (cr *VMSelect) GetExtraArgs() map[string]ArgValue { return cr.ExtraArgs } @@ -768,7 +770,7 @@ func (cr *VMInsert) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VMInsert) GetExtraArgs() map[string]string { +func (cr *VMInsert) GetExtraArgs() map[string]ArgValue { return cr.ExtraArgs } @@ -786,7 +788,7 @@ func (cr *VMStorage) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VMStorage) GetExtraArgs() map[string]string { +func (cr *VMStorage) GetExtraArgs() map[string]ArgValue { return cr.ExtraArgs } @@ -796,23 +798,23 @@ func (cr *VMStorage) GetServiceScrape() *VMServiceScrapeSpec { } // SnapshotCreatePathWithFlags returns url for accessing vmbackupmanager component -func (*VMBackup) SnapshotCreatePathWithFlags(port string, extraArgs map[string]string) string { +func (*VMBackup) SnapshotCreatePathWithFlags(port string, extraArgs map[string]ArgValue) string { return joinBackupAuthKey(fmt.Sprintf("http://localhost:%s%s", port, path.Join(BuildPathWithPrefixFlag(extraArgs, snapshotCreate))), extraArgs) } // SnapshotDeletePathWithFlags returns url for accessing vmbackupmanager component -func (*VMBackup) SnapshotDeletePathWithFlags(port string, extraArgs map[string]string) string { +func (*VMBackup) SnapshotDeletePathWithFlags(port string, extraArgs map[string]ArgValue) string { return joinBackupAuthKey(fmt.Sprintf("http://localhost:%s%s", port, path.Join(BuildPathWithPrefixFlag(extraArgs, snapshotDelete))), extraArgs) } -func joinBackupAuthKey(urlPath string, extraArgs map[string]string) string { - if authKey, ok := extraArgs["snapshotAuthKey"]; ok { +func joinBackupAuthKey(urlPath string, extraArgs map[string]ArgValue) string { + if authKey, ok := extraArgs["snapshotAuthKey"]; ok && len(authKey) > 0 { separator := "?" idx := strings.IndexByte(urlPath, '?') if idx > 0 { separator = "&" } - return urlPath + separator + "authKey=" + authKey + return urlPath + separator + "authKey=" + authKey[0] } return urlPath } @@ -833,7 +835,7 @@ func (cr *VMCluster) IsOwnsServiceAccount() bool { // AsURL implements stub for interface. func (cr *VMCluster) AsURL(kind ClusterComponent) string { var port string - var extraArgs map[string]string + var extraArgs map[string]ArgValue switch kind { case ClusterComponentSelect: if cr.Spec.VMSelect == nil { @@ -1010,7 +1012,7 @@ func (cr *VMAuthLoadBalancerSpec) GetServiceScrape() *VMServiceScrapeSpec { } // GetExtraArgs implements build.serviceScrapeBuilder interface -func (cr *VMAuthLoadBalancerSpec) GetExtraArgs() map[string]string { +func (cr *VMAuthLoadBalancerSpec) GetExtraArgs() map[string]ArgValue { return cr.ExtraArgs } diff --git a/api/operator/v1beta1/vmcluster_types_test.go b/api/operator/v1beta1/vmcluster_types_test.go index 7d9ec4d72..9c1558464 100644 --- a/api/operator/v1beta1/vmcluster_types_test.go +++ b/api/operator/v1beta1/vmcluster_types_test.go @@ -9,7 +9,7 @@ import ( func TestVMBackup_SnapshotDeletePathWithFlags(t *testing.T) { type opts struct { port string - extraArgs map[string]string + extraArgs map[string]ArgValue want string } f := func(o opts) { @@ -28,16 +28,19 @@ func TestVMBackup_SnapshotDeletePathWithFlags(t *testing.T) { // delete path with prefix f(opts{ - port: "8428", - extraArgs: map[string]string{vmPathPrefixFlagName: "/pref-1", "other-flag": "other-value"}, - want: "http://localhost:8428/pref-1/snapshot/delete", + port: "8428", + extraArgs: map[string]ArgValue{ + vmPathPrefixFlagName: []string{"/pref-1"}, + "other-flag": []string{"other-value"}, + }, + want: "http://localhost:8428/pref-1/snapshot/delete", }) } func TestVMBackup_SnapshotCreatePathWithFlags(t *testing.T) { type opts struct { port string - extraArgs map[string]string + extraArgs map[string]ArgValue want string } f := func(o opts) { @@ -56,8 +59,8 @@ func TestVMBackup_SnapshotCreatePathWithFlags(t *testing.T) { // with prefix f(opts{ port: "8429", - extraArgs: map[string]string{ - "http.pathPrefix": "/prefix/custom", + extraArgs: map[string]ArgValue{ + "http.pathPrefix": []string{"/prefix/custom"}, }, want: "http://localhost:8429/prefix/custom/snapshot/create", }) @@ -65,9 +68,9 @@ func TestVMBackup_SnapshotCreatePathWithFlags(t *testing.T) { // with prefix and auth key f(opts{ port: "8429", - extraArgs: map[string]string{ - "http.pathPrefix": "/prefix/custom", - "snapshotAuthKey": "some-auth-key", + extraArgs: map[string]ArgValue{ + "http.pathPrefix": []string{"/prefix/custom"}, + "snapshotAuthKey": []string{"some-auth-key"}, }, want: "http://localhost:8429/prefix/custom/snapshot/create?authKey=some-auth-key", }) diff --git a/api/operator/v1beta1/vmextra_types.go b/api/operator/v1beta1/vmextra_types.go index efb2d4cc4..a5cf0f642 100644 --- a/api/operator/v1beta1/vmextra_types.go +++ b/api/operator/v1beta1/vmextra_types.go @@ -392,37 +392,37 @@ func (ss *AdditionalServiceSpec) NameOrDefault(defaultName string) string { } // BuildReloadPathWithPort builds reload api path for given args -func BuildReloadPathWithPort(extraArgs map[string]string, port string) string { +func BuildReloadPathWithPort(extraArgs map[string]ArgValue, port string) string { proto := HTTPProtoFromFlags(extraArgs) urlPath := joinPathAuthKey(BuildPathWithPrefixFlag(extraArgs, reloadPath), reloadAuthKey, extraArgs) return fmt.Sprintf("%s://localhost:%s%s", proto, port, urlPath) } // BuildPathWithPrefixFlag returns provided path with possible prefix from flags -func BuildPathWithPrefixFlag(flags map[string]string, defaultPath string) string { - if prefix, ok := flags[vmPathPrefixFlagName]; ok { - return path.Join(prefix, defaultPath) +func BuildPathWithPrefixFlag(flags map[string]ArgValue, defaultPath string) string { + if prefix, ok := flags[vmPathPrefixFlagName]; ok && len(prefix) > 0 { + return path.Join(prefix[0], defaultPath) } return defaultPath } // HTTPProtoFromFlags returns HTTP protocol prefix from provided flags -func HTTPProtoFromFlags(flags map[string]string) string { +func HTTPProtoFromFlags(flags map[string]ArgValue) string { proto := "http" - if flags["tls"] == "true" { + if v, ok := flags["tls"]; ok && len(v) > 0 && v[0] == "true" { proto = "https" } return proto } -func joinPathAuthKey(urlPath string, keyName string, extraArgs map[string]string) string { - if authKey, ok := extraArgs[keyName]; ok { +func joinPathAuthKey(urlPath string, keyName string, extraArgs map[string]ArgValue) string { + if authKey, ok := extraArgs[keyName]; ok && len(authKey) > 0 { separator := "?" idx := strings.IndexByte(urlPath, '?') if idx > 0 { separator = "&" } - return urlPath + separator + "authKey=" + authKey + return urlPath + separator + "authKey=" + authKey[0] } return urlPath } @@ -703,6 +703,40 @@ type KeyValue struct { Value string `json:"value"` } +// ArgValue is a helper type for argument value, which can be either string, comma-separated string or array. +type ArgValue []string + +// UnmarshalJSON implements json.Unmarshaller interface +func (m *ArgValue) UnmarshalJSON(data []byte) error { + var raw any + if err := json.Unmarshal(data, &raw); err != nil { + return fmt.Errorf("cannot unmarshal match: %w", err) + } + rawType := reflect.TypeOf(raw) + switch rawType.Kind() { + case reflect.String: + var match string + if err := json.Unmarshal(data, &match); err != nil { + return err + } + *m = strings.Split(match, ",") + return nil + case reflect.Slice, reflect.Array: + var match []string + if err := json.Unmarshal(data, &match); err != nil { + return err + } + var result []string + for _, a := range match { + result = append(result, strings.Split(a, ",")...) + } + *m = result + return nil + default: + return &json.UnmarshalTypeError{Value: string(data), Type: rawType} + } +} + // StringOrArray is a helper type for storing string or array of string. type StringOrArray []string @@ -718,7 +752,7 @@ func (m StringOrArray) MarshalYAML() (any, error) { } } -// UnmarshalYAML implements yaml.Unmarshaler interface +// UnmarshalYAML implements yaml.Unmarshaler interface func (m *StringOrArray) UnmarshalYAML(unmarshal func(any) error) error { var raw any if err := unmarshal(&raw); err != nil { @@ -1201,7 +1235,9 @@ type CommonConfigReloaderParams struct { // ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container // for example resyncInterval: "30s" // +optional - ConfigReloaderExtraArgs map[string]string `json:"configReloaderExtraArgs,omitempty"` + // +kubebuilder:validation:Schemaless + // +kubebuilder:pruning:PreserveUnknownFields + ConfigReloaderExtraArgs map[string]ArgValue `json:"configReloaderExtraArgs,omitempty"` // ConfigReloadAuthKeySecret defines optional secret reference authKey for /-/reload API requests. // Given secret reference will be added to the application and vm-config-reloader as volume // available since v0.57.0 version @@ -1319,7 +1355,9 @@ type CommonApplicationDeploymentParams struct { // ExtraArgs that will be passed to the application container // for example remoteWrite.tmpDataPath: /tmp // +optional - ExtraArgs map[string]string `json:"extraArgs,omitempty"` + // +kubebuilder:validation:Schemaless + // +kubebuilder:pruning:PreserveUnknownFields + ExtraArgs map[string]ArgValue `json:"extraArgs,omitempty"` // ExtraEnvs that will be passed to the application container // +optional ExtraEnvs []corev1.EnvVar `json:"extraEnvs,omitempty"` diff --git a/api/operator/v1beta1/vmextra_types_test.go b/api/operator/v1beta1/vmextra_types_test.go index 538e9d063..98bbd749e 100644 --- a/api/operator/v1beta1/vmextra_types_test.go +++ b/api/operator/v1beta1/vmextra_types_test.go @@ -11,7 +11,7 @@ import ( func Test_buildPathWithPrefixFlag(t *testing.T) { type opts struct { - flags map[string]string + flags map[string]ArgValue defaultPath string want string } @@ -29,15 +29,21 @@ func Test_buildPathWithPrefixFlag(t *testing.T) { // with some prefix f(opts{ defaultPath: healthPath, - flags: map[string]string{"some.flag": "some-value", vmPathPrefixFlagName: "/prefix/path/"}, - want: fmt.Sprintf("/prefix/path%s", healthPath), + flags: map[string]ArgValue{ + "some.flag": []string{"some-value"}, + vmPathPrefixFlagName: []string{"/prefix/path/"}, + }, + want: fmt.Sprintf("/prefix/path%s", healthPath), }) // with bad path f(opts{ defaultPath: healthPath, - flags: map[string]string{"some.flag": "some-value", vmPathPrefixFlagName: "badpath/badvalue"}, - want: fmt.Sprintf("badpath/badvalue%s", healthPath), + flags: map[string]ArgValue{ + "some.flag": []string{"some-value"}, + vmPathPrefixFlagName: []string{"badpath/badvalue"}, + }, + want: fmt.Sprintf("badpath/badvalue%s", healthPath), }) } diff --git a/api/operator/v1beta1/vmsingle_types.go b/api/operator/v1beta1/vmsingle_types.go index 5f4aa2a93..3a5cc076e 100644 --- a/api/operator/v1beta1/vmsingle_types.go +++ b/api/operator/v1beta1/vmsingle_types.go @@ -254,7 +254,7 @@ func (cr *VMSingle) GetMetricPath() string { } // ExtraArgs returns additionally configured command-line arguments -func (cr *VMSingle) GetExtraArgs() map[string]string { +func (cr *VMSingle) GetExtraArgs() map[string]ArgValue { return cr.Spec.ExtraArgs } diff --git a/api/operator/v1beta1/zz_generated.deepcopy.go b/api/operator/v1beta1/zz_generated.deepcopy.go index da990529b..a2a0bc4c3 100644 --- a/api/operator/v1beta1/zz_generated.deepcopy.go +++ b/api/operator/v1beta1/zz_generated.deepcopy.go @@ -189,6 +189,25 @@ func (in *ArbitraryFSAccessThroughSMsConfig) DeepCopy() *ArbitraryFSAccessThroug return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ArgValue) DeepCopyInto(out *ArgValue) { + { + in := &in + *out = make(ArgValue, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArgValue. +func (in ArgValue) DeepCopy() ArgValue { + if in == nil { + return nil + } + out := new(ArgValue) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AttachMetadata) DeepCopyInto(out *AttachMetadata) { *out = *in @@ -484,9 +503,18 @@ func (in *CommonApplicationDeploymentParams) DeepCopyInto(out *CommonApplication } if in.ExtraArgs != nil { in, out := &in.ExtraArgs, &out.ExtraArgs - *out = make(map[string]string, len(*in)) + *out = make(map[string]ArgValue, len(*in)) for key, val := range *in { - (*out)[key] = val + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make(ArgValue, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal } } if in.ExtraEnvs != nil { @@ -526,9 +554,18 @@ func (in *CommonConfigReloaderParams) DeepCopyInto(out *CommonConfigReloaderPara in.ConfigReloaderResources.DeepCopyInto(&out.ConfigReloaderResources) if in.ConfigReloaderExtraArgs != nil { in, out := &in.ConfigReloaderExtraArgs, &out.ConfigReloaderExtraArgs - *out = make(map[string]string, len(*in)) + *out = make(map[string]ArgValue, len(*in)) for key, val := range *in { - (*out)[key] = val + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make(ArgValue, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal } } if in.ConfigReloadAuthKeySecret != nil { @@ -5398,9 +5435,18 @@ func (in *VMBackup) DeepCopyInto(out *VMBackup) { in.Resources.DeepCopyInto(&out.Resources) if in.ExtraArgs != nil { in, out := &in.ExtraArgs, &out.ExtraArgs - *out = make(map[string]string, len(*in)) + *out = make(map[string]ArgValue, len(*in)) for key, val := range *in { - (*out)[key] = val + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make(ArgValue, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal } } if in.ExtraEnvs != nil { diff --git a/config/crd/overlay/crd.yaml b/config/crd/overlay/crd.yaml index 8e9d45804..b1bb392ce 100644 --- a/config/crd/overlay/crd.yaml +++ b/config/crd/overlay/crd.yaml @@ -551,12 +551,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: @@ -2525,12 +2523,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -3451,12 +3447,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -4247,12 +4241,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -6005,12 +5997,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: @@ -7929,12 +7919,10 @@ spec: type: object x-kubernetes-map-type: atomic configReloaderExtraArgs: - additionalProperties: - type: string description: |- ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container for example resyncInterval: "30s" - type: object + x-kubernetes-preserve-unknown-fields: true configReloaderImage: description: ConfigReloaderImage defines image:tag for config-reloader container @@ -8116,12 +8104,10 @@ spec: it doesn't affect metrics ingested directly by push API's type: object extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: @@ -17687,12 +17673,10 @@ spec: type: object x-kubernetes-map-type: atomic configReloaderExtraArgs: - additionalProperties: - type: string description: |- ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container for example resyncInterval: "30s" - type: object + x-kubernetes-preserve-unknown-fields: true configReloaderImage: description: ConfigReloaderImage defines image:tag for config-reloader container @@ -17930,12 +17914,10 @@ spec: served from root of a DNS name. type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: @@ -19757,12 +19739,10 @@ spec: type: object x-kubernetes-map-type: atomic configReloaderExtraArgs: - additionalProperties: - type: string description: |- ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container for example resyncInterval: "30s" - type: object + x-kubernetes-preserve-unknown-fields: true configReloaderImage: description: ConfigReloaderImage defines image:tag for config-reloader container @@ -20049,12 +20029,10 @@ spec: all generated recording rules and alerts.' type: object extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: @@ -22280,12 +22258,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: @@ -24510,12 +24486,10 @@ spec: type: object x-kubernetes-map-type: atomic configReloaderExtraArgs: - additionalProperties: - type: string description: |- ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container for example resyncInterval: "30s" - type: object + x-kubernetes-preserve-unknown-fields: true configReloaderImage: description: ConfigReloaderImage defines image:tag for config-reloader container @@ -24709,12 +24683,10 @@ spec: x-kubernetes-map-type: atomic type: object extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: @@ -27392,12 +27364,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -28200,12 +28170,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -29463,12 +29431,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -30816,10 +30782,8 @@ spec: description: Defines if weekly backups disabled (default false) type: boolean extraArgs: - additionalProperties: - type: string description: extra args like maxBytesPerSecond default 0 - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: items: description: EnvVar represents an environment variable present @@ -39172,12 +39136,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: @@ -40411,10 +40373,8 @@ spec: description: Defines if weekly backups disabled (default false) type: boolean extraArgs: - additionalProperties: - type: string description: extra args like maxBytesPerSecond default 0 - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: items: description: EnvVar represents an environment variable present @@ -42751,12 +42711,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -43571,12 +43529,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -44372,12 +44328,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container @@ -45999,12 +45953,10 @@ spec: description: DNSPolicy sets DNS policy for the pod type: string extraArgs: - additionalProperties: - type: string description: |- ExtraArgs that will be passed to the application container for example remoteWrite.tmpDataPath: /tmp - type: object + x-kubernetes-preserve-unknown-fields: true extraEnvs: description: ExtraEnvs that will be passed to the application container items: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 35b2aca20..fcd32445e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -27,6 +27,7 @@ aliases: * FEATURE: [vlagent](https://docs.victoriametrics.com/operator/resources/vlagent): support logs collection. See [#1501](https://github.com/VictoriaMetrics/operator/issues/1501). * FEATURE: [vmoperator](https://docs.victoriametrics.com/operator/): use `operator_bad_objects_total` metric with `object_namespace` and `crd` labels to track invalid objects managed by VMAgent, VMAuth, VMAlert and VMAlertmanager. Old `operator_alertmanager_bad_objects_count` and `operator_vmalert_bad_objects_count` are deprecated and will be removed in next releases. * FEATURE: [vmoperator](https://docs.victoriametrics.com/operator/): added HPA support for all cluster CR storage. See [#1678](https://github.com/VictoriaMetrics/operator/issues/1678). +* FEATURE: [vmoperator](https://docs.victoriametrics.com/operator/): support both array and string values in extraArgs. * BUGFIX: [vmoperator](https://docs.victoriametrics.com/operator/): fixed HPA cleanup logic for all cluster resources, before it was constantly recreated. Bug introduced in [this commit](https://github.com/VictoriaMetrics/operator/commit/983d1678c37497a7d03d2f57821219fd4975deec). * BUGFIX: [VMCluster](https://docs.victoriametrics.com/operator/resources/vmcluster/), [VLCluster](https://docs.victoriametrics.com/operator/resources/vlcluster/) and [VTCluster](https://docs.victoriametrics.com/operator/resources/vtcluster/): prevent cluster load balancer secret from infinite reconcile. diff --git a/docs/api.md b/docs/api.md index 52eadc134..8abf3543a 100644 --- a/docs/api.md +++ b/docs/api.md @@ -248,7 +248,7 @@ Appears in: [VLAgent](#vlagent) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -354,7 +354,7 @@ Appears in: [VLClusterSpec](#vlclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -412,7 +412,7 @@ Appears in: [VLClusterSpec](#vlclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | extraStorageNodes#
_[VLStorageNode](#vlstoragenode) array_ | _(Required)_
ExtraStorageNodes - defines additional storage nodes to VLSelect | @@ -487,7 +487,7 @@ Appears in: [VLSingle](#vlsingle) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | futureRetention#
_string_ | _(Optional)_
FutureRetention for the stored logs
Log entries with timestamps bigger than now+futureRetention are rejected during data ingestion; see https://docs.victoriametrics.com/victorialogs/#retention | @@ -554,7 +554,7 @@ Appears in: [VLClusterSpec](#vlclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | futureRetention#
_string_ | _(Optional)_
FutureRetention for the stored logs
Log entries with timestamps bigger than now+futureRetention are rejected during data ingestion; see https://docs.victoriametrics.com/victorialogs/#retention | @@ -751,7 +751,7 @@ Appears in: [VMAnomaly](#vmanomaly) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -891,7 +891,7 @@ Appears in: [VTClusterSpec](#vtclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -948,7 +948,7 @@ Appears in: [VTClusterSpec](#vtclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | extraStorageNodes#
_[VTStorageNode](#vtstoragenode) array_ | _(Required)_
ExtraStorageNodes - defines additional storage nodes to VTSelect | @@ -1023,7 +1023,7 @@ Appears in: [VTSingle](#vtsingle) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | futureRetention#
_string_ | _(Optional)_
FutureRetention for the stored traces
Log entries with timestamps bigger than now+futureRetention are rejected during data ingestion;
see https://docs.victoriametrics.com/victoriatraces/#configure-and-run-victoriatraces | @@ -1089,7 +1089,7 @@ Appears in: [VTClusterSpec](#vtclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | futureRetention#
_string_ | _(Optional)_
FutureRetention for the stored traces
Log entries with timestamps bigger than now+futureRetention are rejected during data ingestion
see https://docs.victoriametrics.com/victoriatraces/#configure-and-run-victoriatraces | @@ -1295,6 +1295,16 @@ Appears in: [CommonScrapeParams](#commonscrapeparams), [CommonScrapeSecurityEnfo | deny#
_boolean_ | _(Required)_
| +#### ArgValue + +_Underlying type:_ _string array_ + +ArgValue is a helper type for argument value, which can be either string, comma-separated string or array. + +Appears in: [CommonApplicationDeploymentParams](#commonapplicationdeploymentparams), [CommonConfigReloaderParams](#commonconfigreloaderparams), [VLAgentSpec](#vlagentspec), [VLInsert](#vlinsert), [VLSelect](#vlselect), [VLSingleSpec](#vlsinglespec), [VLStorage](#vlstorage), [VLogsSpec](#vlogsspec), [VMAgentSpec](#vmagentspec), [VMAlertSpec](#vmalertspec), [VMAlertmanagerSpec](#vmalertmanagerspec), [VMAnomalySpec](#vmanomalyspec), [VMAuthLoadBalancerSpec](#vmauthloadbalancerspec), [VMAuthSpec](#vmauthspec), [VMBackup](#vmbackup), [VMInsert](#vminsert), [VMSelect](#vmselect), [VMSingleSpec](#vmsinglespec), [VMStorage](#vmstorage), [VTInsert](#vtinsert), [VTSelect](#vtselect), [VTSingleSpec](#vtsinglespec), [VTStorage](#vtstorage) + + + #### AttachMetadata @@ -1437,7 +1447,7 @@ Appears in: [VLAgentSpec](#vlagentspec), [VLInsert](#vlinsert), [VLSelect](#vlse | disableAutomountServiceAccountToken#
_boolean_ | _(Optional)_
DisableAutomountServiceAccountToken whether to disable serviceAccount auto mount by Kubernetes (available from v0.54.0).
Operator will conditionally create volumes and volumeMounts for containers if it requires k8s API access.
For example, vmagent and vm-config-reloader requires k8s API access.
Operator creates volumes with name: "kube-api-access", which can be used as volumeMount for extraContainers if needed.
And also adds VolumeMounts at /var/run/secrets/kubernetes.io/serviceaccount. | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -1474,7 +1484,7 @@ Appears in: [VMAgentSpec](#vmagentspec), [VMAlertSpec](#vmalertspec), [VMAlertma | Field | Description | | --- | --- | | configReloadAuthKeySecret#
_[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#secretkeyselector-v1-core)_ | _(Optional)_
ConfigReloadAuthKeySecret defines optional secret reference authKey for /-/reload API requests.
Given secret reference will be added to the application and vm-config-reloader as volume
available since v0.57.0 version | -| configReloaderExtraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | +| configReloaderExtraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | | configReloaderImage#
_string_ | _(Optional)_
ConfigReloaderImage defines image:tag for config-reloader container | | configReloaderImageTag#
_string_ | _(Optional)_
ConfigReloaderImageTag defines image:tag for config-reloader container
Deprecated: use configReloaderImage instead | | configReloaderResources#
_[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | _(Optional)_
ConfigReloaderResources config-reloader container resource request and limits, https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
if not defined default resources from operator config will be used | @@ -3434,7 +3444,7 @@ Appears in: [VLogs](#vlogs) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | futureRetention#
_string_ | _(Required)_
FutureRetention for the stored logs
Log entries with timestamps bigger than now+futureRetention are rejected during data ingestion; see https://docs.victoriametrics.com/victorialogs/#retention | @@ -3562,7 +3572,7 @@ Appears in: [VMAgent](#vmagent) | claimTemplates#
_[PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#persistentvolumeclaim-v1-core) array_ | _(Required)_
ClaimTemplates allows adding additional VolumeClaimTemplates for VMAgent in StatefulMode | | configMaps#
_string array_ | _(Optional)_
ConfigMaps is a list of ConfigMaps in the same namespace as the Application
object, which shall be mounted into the Application container
at /etc/vm/configs/CONFIGMAP_NAME folder | | configReloadAuthKeySecret#
_[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#secretkeyselector-v1-core)_ | _(Optional)_
ConfigReloadAuthKeySecret defines optional secret reference authKey for /-/reload API requests.
Given secret reference will be added to the application and vm-config-reloader as volume
available since v0.57.0 version | -| configReloaderExtraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | +| configReloaderExtraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | | configReloaderImage#
_string_ | _(Optional)_
ConfigReloaderImage defines image:tag for config-reloader container | | configReloaderImageTag#
_string_ | _(Optional)_
ConfigReloaderImageTag defines image:tag for config-reloader container
Deprecated: use configReloaderImage instead | | configReloaderResources#
_[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | _(Optional)_
ConfigReloaderResources config-reloader container resource request and limits, https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
if not defined default resources from operator config will be used | @@ -3576,7 +3586,7 @@ Appears in: [VMAgent](#vmagent) | enforcedNamespaceLabel#
_string_ | _(Optional)_
EnforcedNamespaceLabel enforces adding a namespace label of origin for each alert
and metric that is user created. The label value will always be the namespace of the object that is
being created. | | externalLabelName#
_string_ | _(Optional)_
ExternalLabelName Name of external label used to denote scraping agent instance
name. Defaults to the value of `prometheus`. External label will
_not_ be added when value is set to empty string (`""`). | | externalLabels#
_object (keys:string, values:string)_ | _(Optional)_
ExternalLabels The labels to add to any time series scraped by vmagent.
it doesn't affect metrics ingested directly by push API's | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | globalScrapeMetricRelabelConfigs#
_[RelabelConfig](#relabelconfig) array_ | _(Optional)_
GlobalScrapeMetricRelabelConfigs is a global metric relabel configuration, which is applied to each scrape job. | @@ -3767,7 +3777,7 @@ Appears in: [VMAlert](#vmalert) | affinity#
_[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#affinity-v1-core)_ | _(Optional)_
Affinity If specified, the pod's scheduling constraints. | | configMaps#
_string array_ | _(Optional)_
ConfigMaps is a list of ConfigMaps in the same namespace as the Application
object, which shall be mounted into the Application container
at /etc/vm/configs/CONFIGMAP_NAME folder | | configReloadAuthKeySecret#
_[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#secretkeyselector-v1-core)_ | _(Optional)_
ConfigReloadAuthKeySecret defines optional secret reference authKey for /-/reload API requests.
Given secret reference will be added to the application and vm-config-reloader as volume
available since v0.57.0 version | -| configReloaderExtraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | +| configReloaderExtraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | | configReloaderImage#
_string_ | _(Optional)_
ConfigReloaderImage defines image:tag for config-reloader container | | configReloaderImageTag#
_string_ | _(Optional)_
ConfigReloaderImageTag defines image:tag for config-reloader container
Deprecated: use configReloaderImage instead | | configReloaderResources#
_[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | _(Optional)_
ConfigReloaderResources config-reloader container resource request and limits, https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
if not defined default resources from operator config will be used | @@ -3780,7 +3790,7 @@ Appears in: [VMAlert](#vmalert) | enforcedNamespaceLabel#
_string_ | _(Optional)_
EnforcedNamespaceLabel enforces adding a namespace label of origin for each alert
and metric that is user created. The label value will always be the namespace of the object that is
being created. | | evaluationInterval#
_string_ | _(Optional)_
EvaluationInterval defines how often to evaluate rules by default | | externalLabels#
_object (keys:string, values:string)_ | _(Optional)_
ExternalLabels in the form 'name: value' to add to all generated recording rules and alerts. | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -3905,7 +3915,7 @@ Appears in: [VMAlertmanager](#vmalertmanager) | configNamespaceSelector#
_[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#labelselector-v1-meta)_ | _(Optional)_
ConfigNamespaceSelector defines namespace selector for VMAlertmanagerConfig.
Works in combination with Selector.
NamespaceSelector nil - only objects at VMAlertmanager namespace.
Selector nil - only objects at NamespaceSelector namespaces.
If both nil - behaviour controlled by selectAllByDefault | | configRawYaml#
_string_ | _(Optional)_
ConfigRawYaml - raw configuration for alertmanager,
it helps it to start without secret.
priority -> hardcoded ConfigRaw -> ConfigRaw, provided by user -> ConfigSecret. | | configReloadAuthKeySecret#
_[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#secretkeyselector-v1-core)_ | _(Optional)_
ConfigReloadAuthKeySecret defines optional secret reference authKey for /-/reload API requests.
Given secret reference will be added to the application and vm-config-reloader as volume
available since v0.57.0 version | -| configReloaderExtraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | +| configReloaderExtraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | | configReloaderImage#
_string_ | _(Optional)_
ConfigReloaderImage defines image:tag for config-reloader container | | configReloaderImageTag#
_string_ | _(Optional)_
ConfigReloaderImageTag defines image:tag for config-reloader container
Deprecated: use configReloaderImage instead | | configReloaderResources#
_[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | _(Optional)_
ConfigReloaderResources config-reloader container resource request and limits, https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
if not defined default resources from operator config will be used | @@ -3921,7 +3931,7 @@ Appears in: [VMAlertmanager](#vmalertmanager) | enforcedNamespaceLabel#
_string_ | _(Optional)_
EnforcedNamespaceLabel defines the namespace label key for top route matcher for VMAlertmanagerConfig
Default is "namespace" | | enforcedTopRouteMatchers#
_string array_ | _(Required)_
EnforcedTopRouteMatchers defines label matchers to be added for the top route
of VMAlertmanagerConfig
It allows to make some set of labels required for alerts.
https://prometheus.io/docs/alerting/latest/configuration/#matcher | | externalURL#
_string_ | _(Optional)_
ExternalURL the VMAlertmanager instances will be available under. This is
necessary to generate correct URLs. This is necessary if VMAlertmanager is not
served from root of a DNS name. | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | gossipConfig#
_[AlertmanagerGossipConfig](#alertmanagergossipconfig)_ | _(Optional)_
GossipConfig defines gossip TLS configuration for Alertmanager cluster | @@ -4025,7 +4035,7 @@ Appears in: [VMAuthLoadBalancer](#vmauthloadbalancer) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -4077,7 +4087,7 @@ Appears in: [VMAuth](#vmauth) | affinity#
_[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#affinity-v1-core)_ | _(Optional)_
Affinity If specified, the pod's scheduling constraints. | | configMaps#
_string array_ | _(Optional)_
ConfigMaps is a list of ConfigMaps in the same namespace as the Application
object, which shall be mounted into the Application container
at /etc/vm/configs/CONFIGMAP_NAME folder | | configReloadAuthKeySecret#
_[SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#secretkeyselector-v1-core)_ | _(Optional)_
ConfigReloadAuthKeySecret defines optional secret reference authKey for /-/reload API requests.
Given secret reference will be added to the application and vm-config-reloader as volume
available since v0.57.0 version | -| configReloaderExtraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | +| configReloaderExtraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ConfigReloaderExtraArgs that will be passed to VMAuths config-reloader container
for example resyncInterval: "30s" | | configReloaderImage#
_string_ | _(Optional)_
ConfigReloaderImage defines image:tag for config-reloader container | | configReloaderImageTag#
_string_ | _(Optional)_
ConfigReloaderImageTag defines image:tag for config-reloader container
Deprecated: use configReloaderImage instead | | configReloaderResources#
_[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core)_ | _(Optional)_
ConfigReloaderResources config-reloader container resource request and limits, https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
if not defined default resources from operator config will be used | @@ -4092,7 +4102,7 @@ Appears in: [VMAuth](#vmauth) | drop_src_path_prefix_parts#
_integer_ | _(Optional)_
DropSrcPathPrefixParts is the number of `/`-delimited request path prefix parts to drop before proxying the request to backend.
See [here](https://docs.victoriametrics.com/victoriametrics/vmauth/#dropping-request-path-prefix) for more details. | | dump_request_on_errors#
_boolean_ | _(Optional)_
DumpRequestOnErrors instructs vmauth to return detailed request params to the client
if routing rules don't allow to forward request to the backends.
Useful for debugging `src_hosts` and `src_headers` based routing rules

available since v1.107.0 vmauth version | | externalConfig#
_[ExternalConfig](#externalconfig)_ | _(Optional)_
ExternalConfig defines a source of external VMAuth configuration.
If it's defined, configuration for vmauth becomes unmanaged and operator'll not create any related secrets/config-reloaders | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | headers#
_string array_ | _(Optional)_
Headers represent additional http headers, that vmauth uses
in form of ["header_key: header_value"]
multiple values for header key:
["header_key: value1,value2"]
it's available since 1.68.0 version of vmauth | @@ -4200,7 +4210,7 @@ Appears in: [VMSingleSpec](#vmsinglespec), [VMStorage](#vmstorage) | disableHourly#
_boolean_ | _(Optional)_
Defines if hourly backups disabled (default false) | | disableMonthly#
_boolean_ | _(Optional)_
Defines if monthly backups disabled (default false) | | disableWeekly#
_boolean_ | _(Optional)_
Defines if weekly backups disabled (default false) | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
extra args like maxBytesPerSecond default 0 | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
extra args like maxBytesPerSecond default 0 | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
| | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | image#
_[Image](#image)_ | _(Optional)_
Image - docker image settings for VMBackuper | @@ -4277,7 +4287,7 @@ Appears in: [VMClusterSpec](#vmclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -4674,7 +4684,7 @@ Appears in: [VMClusterSpec](#vmclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -4791,7 +4801,7 @@ Appears in: [VMSingle](#vmsingle) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | @@ -4891,7 +4901,7 @@ Appears in: [VMClusterSpec](#vmclusterspec) | disableSelfServiceScrape#
_boolean_ | _(Optional)_
DisableSelfServiceScrape controls creation of VMServiceScrape by operator
for the application.
Has priority over `VM_DISABLESELFSERVICESCRAPECREATION` operator env variable | | dnsConfig#
_[PodDNSConfig](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#poddnsconfig-v1-core)_ | _(Optional)_
Specifies the DNS parameters of a pod.
Parameters specified here will be merged to the generated DNS
configuration based on DNSPolicy. | | dnsPolicy#
_[DNSPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#dnspolicy-v1-core)_ | _(Optional)_
DNSPolicy sets DNS policy for the pod | -| extraArgs#
_object (keys:string, values:string)_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | +| extraArgs#
_object (keys:string, values:[ArgValue](#argvalue))_ | _(Optional)_
ExtraArgs that will be passed to the application container
for example remoteWrite.tmpDataPath: /tmp | | extraEnvs#
_[EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envvar-v1-core) array_ | _(Optional)_
ExtraEnvs that will be passed to the application container | | extraEnvsFrom#
_[EnvFromSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#envfromsource-v1-core) array_ | _(Optional)_
ExtraEnvsFrom defines source of env variables for the application container
could either be secret or configmap | | hostAliases#
_[HostAlias](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#hostalias-v1-core) array_ | _(Optional)_
HostAliases provides mapping for ip and hostname,
that would be propagated to pod,
cannot be used with HostNetwork. | diff --git a/internal/controller/operator/factory/build/backup.go b/internal/controller/operator/factory/build/backup.go index ec876a976..292981db4 100644 --- a/internal/controller/operator/factory/build/backup.go +++ b/internal/controller/operator/factory/build/backup.go @@ -23,7 +23,7 @@ func VMBackupManager( port string, storagePath string, mounts []corev1.VolumeMount, - extraArgs map[string]string, + extraArgs map[string]vmv1beta1.ArgValue, isCluster bool, license *vmv1beta1.License, ) (*corev1.Container, error) { diff --git a/internal/controller/operator/factory/build/container.go b/internal/controller/operator/factory/build/container.go index b842a0c76..892b32b40 100644 --- a/internal/controller/operator/factory/build/container.go +++ b/internal/controller/operator/factory/build/container.go @@ -158,7 +158,7 @@ func Resources(crdResources corev1.ResourceRequirements, defaultResources config // it trims in-place args if it was set via extraArgs // no need to check for extraEnvs, it has priority over args at VictoriaMetrics apps // dashes is either "-" or "--", depending on the process. alertmanager needs two dashes. -func AddExtraArgsOverrideDefaults(args []string, extraArgs map[string]string, dashes string) []string { +func AddExtraArgsOverrideDefaults(args []string, extraArgs map[string]vmv1beta1.ArgValue, dashes string) []string { if len(extraArgs) == 0 { // fast path return args @@ -185,7 +185,7 @@ func AddExtraArgsOverrideDefaults(args []string, extraArgs map[string]string, da // trim in-place args = args[:cnt] // add extraArgs - for argKey, argValue := range extraArgs { + for argKey, argValues := range extraArgs { // hack for alertmanager migration // TODO remove it at the 28.0 release if len(dashes) == 2 && strings.HasPrefix(argKey, "-") { @@ -193,9 +193,9 @@ func AddExtraArgsOverrideDefaults(args []string, extraArgs map[string]string, da } // special hack for https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1145 if argKey == "rule" { - args = append(args, fmt.Sprintf("%s%s=%q", dashes, argKey, argValue)) + args = append(args, fmt.Sprintf("%s%s=%q", dashes, argKey, strings.Join(argValues, ","))) } else { - args = append(args, fmt.Sprintf("%s%s=%s", dashes, argKey, argValue)) + args = append(args, fmt.Sprintf("%s%s=%s", dashes, argKey, strings.Join(argValues, ","))) } } return args @@ -436,7 +436,7 @@ func AddConfigReloadAuthKeyVolume(dst []corev1.Volume, spec *vmv1beta1.CommonCon } // AddConfigReloadAuthKeyToApp adds authKey env var to the given application container -func AddConfigReloadAuthKeyToApp(container *corev1.Container, extraArgs map[string]string, spec *vmv1beta1.CommonConfigReloaderParams) { +func AddConfigReloadAuthKeyToApp(container *corev1.Container, spec *vmv1beta1.CommonConfigReloaderParams) { if spec.ConfigReloadAuthKeySecret == nil { return } diff --git a/internal/controller/operator/factory/build/container_test.go b/internal/controller/operator/factory/build/container_test.go index 61d553e20..32b4841c3 100644 --- a/internal/controller/operator/factory/build/container_test.go +++ b/internal/controller/operator/factory/build/container_test.go @@ -146,7 +146,7 @@ func Test_buildProbe(t *testing.T) { func Test_addExtraArgsOverrideDefaults(t *testing.T) { type opts struct { args []string - extraArgs map[string]string + extraArgs map[string]vmv1beta1.ArgValue dashes string want []string } @@ -168,42 +168,52 @@ func Test_addExtraArgsOverrideDefaults(t *testing.T) { // override default f(opts{ - args: []string{"-http.ListenAddr=:8081"}, - extraArgs: map[string]string{"http.ListenAddr": "127.0.0.1:8085"}, - dashes: "-", - want: []string{"-http.ListenAddr=127.0.0.1:8085"}, + args: []string{"-http.ListenAddr=:8081"}, + extraArgs: map[string]vmv1beta1.ArgValue{ + "http.ListenAddr": []string{"127.0.0.1:8085"}, + }, + dashes: "-", + want: []string{"-http.ListenAddr=127.0.0.1:8085"}, }) // override default, add to the end f(opts{ - args: []string{"-http.ListenAddr=:8081", "-promscrape.config=/opt/vmagent.yml"}, - extraArgs: map[string]string{"http.ListenAddr": "127.0.0.1:8085"}, - dashes: "-", - want: []string{"-promscrape.config=/opt/vmagent.yml", "-http.ListenAddr=127.0.0.1:8085"}, + args: []string{"-http.ListenAddr=:8081", "-promscrape.config=/opt/vmagent.yml"}, + extraArgs: map[string]vmv1beta1.ArgValue{ + "http.ListenAddr": []string{"127.0.0.1:8085"}, + }, + dashes: "-", + want: []string{"-promscrape.config=/opt/vmagent.yml", "-http.ListenAddr=127.0.0.1:8085"}, }) // two dashes, extend f(opts{ - args: []string{"--web.timeout=0"}, - extraArgs: map[string]string{"log.level": "debug"}, - dashes: "--", - want: []string{"--web.timeout=0", "--log.level=debug"}, + args: []string{"--web.timeout=0"}, + extraArgs: map[string]vmv1beta1.ArgValue{ + "log.level": []string{"debug"}, + }, + dashes: "--", + want: []string{"--web.timeout=0", "--log.level=debug"}, }) // two dashes, override default f(opts{ - args: []string{"--log.level=info"}, - extraArgs: map[string]string{"log.level": "debug"}, - dashes: "--", - want: []string{"--log.level=debug"}, + args: []string{"--log.level=info"}, + extraArgs: map[string]vmv1beta1.ArgValue{ + "log.level": []string{"debug"}, + }, + dashes: "--", + want: []string{"--log.level=debug"}, }) // two dashes, alertmanager migration f(opts{ - args: []string{"--log.level=info"}, - extraArgs: map[string]string{"-web.externalURL": "http://domain.example"}, - dashes: "--", - want: []string{"--log.level=info", "--web.externalURL=http://domain.example"}, + args: []string{"--log.level=info"}, + extraArgs: map[string]vmv1beta1.ArgValue{ + "-web.externalURL": []string{"http://domain.example"}, + }, + dashes: "--", + want: []string{"--log.level=info", "--web.externalURL=http://domain.example"}, }) } diff --git a/internal/controller/operator/factory/build/vmservicescrape.go b/internal/controller/operator/factory/build/vmservicescrape.go index e21d1ff04..7c23b50c5 100644 --- a/internal/controller/operator/factory/build/vmservicescrape.go +++ b/internal/controller/operator/factory/build/vmservicescrape.go @@ -12,20 +12,20 @@ import ( type serviceScrapeBuilder interface { GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec - GetExtraArgs() map[string]string + GetExtraArgs() map[string]vmv1beta1.ArgValue GetMetricPath() string } // VMServiceScrapeForServiceWithSpec build VMServiceScrape for VMAlertmanager func VMServiceScrapeForAlertmanager(service *corev1.Service, amCR *vmv1beta1.VMAlertmanager) *vmv1beta1.VMServiceScrape { - var extraArgs map[string]string + var extraArgs map[string]vmv1beta1.ArgValue isTLS := amCR.Spec.WebConfig != nil && amCR.Spec.WebConfig.TLSServerConfig != nil // use hack to emulate enabled tls in generic way with vm components if isTLS { - extraArgs = map[string]string{ - "tls": "true", + extraArgs = map[string]vmv1beta1.ArgValue{ + "tls": []string{"true"}, } } return vmServiceScrapeForServiceWithSpec(service, amCR.GetServiceScrape(), extraArgs, amCR.GetMetricPath()) @@ -40,18 +40,12 @@ func VMServiceScrapeForServiceWithSpec(service *corev1.Service, builder serviceS // VMServiceScrapeForServiceWithSpec build VMServiceScrape for given service with optional spec // optionally could filter out ports from service -func vmServiceScrapeForServiceWithSpec(service *corev1.Service, serviceScrapeSpec *vmv1beta1.VMServiceScrapeSpec, extraArgs map[string]string, metricPath string, additionalPortNames ...string) *vmv1beta1.VMServiceScrape { +func vmServiceScrapeForServiceWithSpec(service *corev1.Service, serviceScrapeSpec *vmv1beta1.VMServiceScrapeSpec, extraArgs map[string]vmv1beta1.ArgValue, metricPath string, additionalPortNames ...string) *vmv1beta1.VMServiceScrape { var endPoints []vmv1beta1.Endpoint var isTLS bool v, ok := extraArgs["tls"] - if ok { - // tls is array flag type at VictoriaMetrics components - // use first value - firstIdx := strings.IndexByte(v, ',') - if firstIdx > 0 { - v = v[:firstIdx] - } - isTLS = strings.ToLower(v) == "true" + if ok && len(v) > 0 { + isTLS = strings.ToLower(v[0]) == "true" } authKey := extraArgs["metricsAuthKey"] @@ -101,9 +95,9 @@ func vmServiceScrapeForServiceWithSpec(service *corev1.Service, serviceScrapeSpe InsecureSkipVerify: true, } } - if len(authKey) > 0 { + if len(authKey) > 0 && len(authKey[0]) > 0 { ep.Params = map[string][]string{ - "authKey": {authKey}, + "authKey": {authKey[0]}, } } endPoints = append(endPoints, ep) @@ -162,17 +156,11 @@ type podScrapeBuilder interface { // VMPodScrapeForObjectWithSpec build VMPodScrape for given podScrapeBuilder with provided args // optionally could filter out ports from service -func VMPodScrapeForObjectWithSpec(psb podScrapeBuilder, serviceScrapeSpec *vmv1beta1.VMServiceScrapeSpec, extraArgs map[string]string) *vmv1beta1.VMPodScrape { +func VMPodScrapeForObjectWithSpec(psb podScrapeBuilder, serviceScrapeSpec *vmv1beta1.VMServiceScrapeSpec, extraArgs map[string]vmv1beta1.ArgValue) *vmv1beta1.VMPodScrape { var isTLS bool v, ok := extraArgs["tls"] - if ok { - // tls is array flag type at VictoriaMetrics components - // use first value - firstIdx := strings.IndexByte(v, ',') - if firstIdx > 0 { - v = v[:firstIdx] - } - isTLS = strings.ToLower(v) == "true" + if ok && len(v) > 0 { + isTLS = strings.ToLower(v[0]) == "true" } authKey := extraArgs["metricsAuthKey"] @@ -190,9 +178,9 @@ func VMPodScrapeForObjectWithSpec(psb podScrapeBuilder, serviceScrapeSpec *vmv1b InsecureSkipVerify: true, } } - if len(authKey) > 0 { + if len(authKey) > 0 && len(authKey[0]) > 0 { defaultEP.Params = map[string][]string{ - "authKey": {authKey}, + "authKey": {authKey[0]}, } } diff --git a/internal/controller/operator/factory/build/vmservicescrape_test.go b/internal/controller/operator/factory/build/vmservicescrape_test.go index 766f91828..8055f79e0 100644 --- a/internal/controller/operator/factory/build/vmservicescrape_test.go +++ b/internal/controller/operator/factory/build/vmservicescrape_test.go @@ -14,7 +14,7 @@ import ( type testVMServiceScrapeForServiceWithSpecArgs struct { serviceScrapeSpecTemplate *vmv1beta1.VMServiceScrapeSpec metricPath string - extraArgs map[string]string + extraArgs map[string]vmv1beta1.ArgValue } func (tb *testVMServiceScrapeForServiceWithSpecArgs) GetServiceScrape() *vmv1beta1.VMServiceScrapeSpec { @@ -25,7 +25,7 @@ func (tb *testVMServiceScrapeForServiceWithSpecArgs) GetMetricPath() string { return tb.metricPath } -func (tb *testVMServiceScrapeForServiceWithSpecArgs) GetExtraArgs() map[string]string { +func (tb *testVMServiceScrapeForServiceWithSpecArgs) GetExtraArgs() map[string]vmv1beta1.ArgValue { return tb.extraArgs } @@ -279,9 +279,9 @@ func TestVMServiceScrapeForServiceWithSpec(t *testing.T) { }, spec: testVMServiceScrapeForServiceWithSpecArgs{ metricPath: "/metrics", - extraArgs: map[string]string{ - "tls": "true", - "metricsAuthKey": "some-access-key", + extraArgs: map[string]vmv1beta1.ArgValue{ + "tls": []string{"true"}, + "metricsAuthKey": []string{"some-access-key"}, }, }, wantServiceScrapeSpec: vmv1beta1.VMServiceScrapeSpec{ diff --git a/internal/controller/operator/factory/vlagent/vlagent_test.go b/internal/controller/operator/factory/vlagent/vlagent_test.go index 6f548afce..e6a40a7de 100644 --- a/internal/controller/operator/factory/vlagent/vlagent_test.go +++ b/internal/controller/operator/factory/vlagent/vlagent_test.go @@ -1211,8 +1211,8 @@ serviceaccountname: vlagent-agent Port: "9425", }, CommonApplicationDeploymentParams: vmv1beta1.CommonApplicationDeploymentParams{ - ExtraArgs: map[string]string{ - "remoteWrite.maxDiskUsagePerURL": "35GiB", + ExtraArgs: map[string]vmv1beta1.ArgValue{ + "remoteWrite.maxDiskUsagePerURL": []string{"35GiB"}, }, }, RemoteWrite: []vmv1.VLAgentRemoteWriteSpec{ diff --git a/internal/controller/operator/factory/vlcluster/vmauth_lb.go b/internal/controller/operator/factory/vlcluster/vmauth_lb.go index c3f854111..cf9a137d4 100644 --- a/internal/controller/operator/factory/vlcluster/vmauth_lb.go +++ b/internal/controller/operator/factory/vlcluster/vmauth_lb.go @@ -78,13 +78,13 @@ func buildVMauthLBSecret(cr *vmv1.VLCluster) *corev1.Secret { selectProto := "http" if cr.Spec.VLSelect != nil { selectPort = cr.Spec.VLSelect.Port - if v, ok := cr.Spec.VLSelect.ExtraArgs["tls"]; ok && v == "true" { + if v, ok := cr.Spec.VLSelect.ExtraArgs["tls"]; ok && len(v) > 0 && v[0] == "true" { selectProto = "https" } } if cr.Spec.VLInsert != nil { insertPort = cr.Spec.VLInsert.Port - if v, ok := cr.Spec.VLInsert.ExtraArgs["tls"]; ok && v == "true" { + if v, ok := cr.Spec.VLInsert.ExtraArgs["tls"]; ok && len(v) > 0 && v[0] == "true" { selectProto = "https" } } diff --git a/internal/controller/operator/factory/vmagent/vmagent.go b/internal/controller/operator/factory/vmagent/vmagent.go index fb5534832..1c9d9ef96 100644 --- a/internal/controller/operator/factory/vmagent/vmagent.go +++ b/internal/controller/operator/factory/vmagent/vmagent.go @@ -670,7 +670,7 @@ func newPodSpec(cr *vmv1beta1.VMAgent, ac *build.AssetsCache) (*corev1.PodSpec, vmagentContainer = build.Probe(vmagentContainer, cr) - build.AddConfigReloadAuthKeyToApp(&vmagentContainer, cr.Spec.ExtraArgs, &cr.Spec.CommonConfigReloaderParams) + build.AddConfigReloadAuthKeyToApp(&vmagentContainer, &cr.Spec.CommonConfigReloaderParams) var operatorContainers []corev1.Container var ic []corev1.Container diff --git a/internal/controller/operator/factory/vmagent/vmagent_test.go b/internal/controller/operator/factory/vmagent/vmagent_test.go index bc7962cdd..baae23197 100644 --- a/internal/controller/operator/factory/vmagent/vmagent_test.go +++ b/internal/controller/operator/factory/vmagent/vmagent_test.go @@ -2639,9 +2639,9 @@ serviceaccountname: vmagent-agent ConfigReloaderImage: "vmcustom:config-reloader-v0.35.0", }, CommonApplicationDeploymentParams: vmv1beta1.CommonApplicationDeploymentParams{ - ExtraArgs: map[string]string{ - "remoteWrite.maxDiskUsagePerURL": "35GiB", - "remoteWrite.forceVMProto": "false", + ExtraArgs: map[string]vmv1beta1.ArgValue{ + "remoteWrite.maxDiskUsagePerURL": []string{"35GiB"}, + "remoteWrite.forceVMProto": []string{"false"}, }, }, RemoteWrite: []vmv1beta1.VMAgentRemoteWriteSpec{ diff --git a/internal/controller/operator/factory/vmalert/vmalert.go b/internal/controller/operator/factory/vmalert/vmalert.go index f2004297b..08ca9a5d7 100644 --- a/internal/controller/operator/factory/vmalert/vmalert.go +++ b/internal/controller/operator/factory/vmalert/vmalert.go @@ -295,7 +295,7 @@ func newPodSpec(cr *vmv1beta1.VMAlert, ruleConfigMapNames []string, ac *build.As TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError, } vmalertContainer = build.Probe(vmalertContainer, cr) - build.AddConfigReloadAuthKeyToApp(&vmalertContainer, cr.Spec.ExtraArgs, &cr.Spec.CommonConfigReloaderParams) + build.AddConfigReloadAuthKeyToApp(&vmalertContainer, &cr.Spec.CommonConfigReloaderParams) vmalertContainers = append(vmalertContainers, vmalertContainer) if !cr.IsUnmanaged() { diff --git a/internal/controller/operator/factory/vmauth/vmauth.go b/internal/controller/operator/factory/vmauth/vmauth.go index 764641709..3c3b36513 100644 --- a/internal/controller/operator/factory/vmauth/vmauth.go +++ b/internal/controller/operator/factory/vmauth/vmauth.go @@ -346,7 +346,7 @@ func makeSpecForVMAuth(cr *vmv1beta1.VMAuth) (*corev1.PodTemplateSpec, error) { ImagePullPolicy: cr.Spec.Image.PullPolicy, } vmauthContainer = addVMAuthProbes(cr, vmauthContainer) - build.AddConfigReloadAuthKeyToApp(&vmauthContainer, cr.Spec.ExtraArgs, &cr.Spec.CommonConfigReloaderParams) + build.AddConfigReloadAuthKeyToApp(&vmauthContainer, &cr.Spec.CommonConfigReloaderParams) // move vmauth container to the 0 index operatorContainers = append([]corev1.Container{vmauthContainer}, operatorContainers...) diff --git a/internal/controller/operator/factory/vtcluster/vmauth_lb.go b/internal/controller/operator/factory/vtcluster/vmauth_lb.go index 58d0b72ce..cd96c10bf 100644 --- a/internal/controller/operator/factory/vtcluster/vmauth_lb.go +++ b/internal/controller/operator/factory/vtcluster/vmauth_lb.go @@ -77,13 +77,13 @@ func buildVMauthLBSecret(cr *vmv1.VTCluster) *corev1.Secret { selectProto := "http" if cr.Spec.Select != nil { selectPort = cr.Spec.Select.Port - if v, ok := cr.Spec.Select.ExtraArgs["tls"]; ok && v == "true" { + if v, ok := cr.Spec.Select.ExtraArgs["tls"]; ok && len(v) > 0 && v[0] == "true" { selectProto = "https" } } if cr.Spec.Insert != nil { insertPort = cr.Spec.Insert.Port - if v, ok := cr.Spec.Insert.ExtraArgs["tls"]; ok && v == "true" { + if v, ok := cr.Spec.Insert.ExtraArgs["tls"]; ok && len(v) > 0 && v[0] == "true" { selectProto = "https" } } diff --git a/test/e2e/vmalert_test.go b/test/e2e/vmalert_test.go index fb4413c74..4dd2bcf0c 100644 --- a/test/e2e/vmalert_test.go +++ b/test/e2e/vmalert_test.go @@ -312,7 +312,9 @@ var _ = Describe("test vmalert Controller", Label("vm", "alert"), func() { func(cr *vmv1beta1.VMAlert) { cr.Spec.ReplicaCount = ptr.To[int32](3) cr.Spec.LogLevel = "INFO" - cr.Spec.ExtraArgs = map[string]string{"http.pathPrefix": "/somenew/prefix"} + cr.Spec.ExtraArgs = map[string]vmv1beta1.ArgValue{ + "http.pathPrefix": []string{"/somenew/prefix"}, + } }, func(cr *vmv1beta1.VMAlert) { Eventually(func() string { diff --git a/test/e2e/vmcluster_test.go b/test/e2e/vmcluster_test.go index f515a55ce..1418ef002 100644 --- a/test/e2e/vmcluster_test.go +++ b/test/e2e/vmcluster_test.go @@ -676,8 +676,8 @@ var _ = Describe("e2e vmcluster", Label("vm", "cluster", "vmcluster"), func() { modify: func(cr *vmv1beta1.VMCluster) { cr.Spec.VMStorage = nil cr.Spec.VMInsert = nil - cr.Spec.VMSelect.ExtraArgs = map[string]string{ - "storageNode": "non-exist-vmstorage:8402", + cr.Spec.VMSelect.ExtraArgs = map[string]vmv1beta1.ArgValue{ + "storageNode": []string{"non-exist-vmstorage:8402"}, } }, verify: func(cr *vmv1beta1.VMCluster) {